<template>
	<view class="container">
		<!-- 头部信息 -->
		<view class="basicInfoBox">
			<view class="avatar">
				<img src="/static/cffp_logo.jpg" alt="" srcset="">
			</view>
			<view class="infoBox">
				<view class="firstLineBox">
					<view>
						<strong>XXX</strong>
						<text class="csTag">推广人</text>
					</view>
					<view class="personalInfoBtn">
						<text>个人资料</text>
						<i class="iconfont icon-bianji"></i>
					</view>
				</view>
				<view>昵称：XXXX</view>
				<view>CFFPxxxxx</view>
			</view>
		</view>
		<!-- 主要菜单 -->
		<view class="mainMenuBox">
			<view class="item" v-for="mainMenu in mainMenuLists" :key="mainMenu.id">
				<h4>{{mainMenu.categoryName}}</h4>
				<view class="menuItemBox">
					<view class="mainMenuItem" v-for="menuItem in mainMenu.children.filter(v=>v.isShow)" :key="menuItem.title" @click="goDetail(menuItem)">
						<img :src="'/static/moduleIcon/'+menuItem.icon+'.png'" alt="" srcset="">
						<text>{{menuItem.title}}</text>
					</view>
				</view>
			</view>
			
		</view>
		<!-- 个人信息 -->
		<view class="personalInfo">
			<ul>
				<li v-for="item in minorMenuLists.filter(v=>v.isShow)" :key="item.title" @click="goDetail(item)">
					<view class="infoBox">
						<img :src="'/static/moduleIcon/'+item.icon+'.png'" alt="" srcset="">
						<text>{{item.title}}</text>
					</view>
					<view class="iconBox">
						<i class="iconfont icon-youjiantou"></i>
					</view>
				</li>
			</ul>
		</view>
		<tabBar :currentPage="currentPage"></tabBar>
	</view>
</template>

<script>
	import common from "../../common/common";
	import tabBar from '../../components/tabBar/tabBar.vue';
	export default {
		data() {
			return {
				currentPage:'personalCenter',
				customerBasicInfo:{},
				mainMenuLists:[
					{id:'00',categoryName:'销售管理',
						children:[
							{title:'销售课程',icon:'salesCourse',link:'/components/courselist/courselist',isOpen:true,isShow:true},
							{title:'销售保单',icon:'salesOrder',link:'',isOpen:true,isShow:false},
							{title:'我的售后',icon:'afterSales',link:'',isOpen:false,isShow:true}
						],
					},
					{id:'01',categoryName:'积分管理',
						children:[
							{title:'我的积分',icon:'integral',link:'',isOpen:true,isShow:true},
							{title:'积分兑换',icon:'integralShopping',link:'',isOpen:true,isShow:true}
						],
					},
					{id:'02',categoryName:'活动管理',
						children:[
							{title:'我的学习',icon:'myLearning',link:'',isOpen:true,isShow:true},
							{title:'学习认证',icon:'learningCertify',link:'',isOpen:true,isShow:true},
							{title:'我的分享',icon:'share',link:'',isOpen:true,isShow:true}
						],
					},
					{id:'03',categoryName:'人员管理',
						children:[
							{title:'成交客户',icon:'dealCustomer',link:'',isOpen:true,isShow:false},
							{title:'申请加盟',icon:'applyJoin',link:'',isOpen:true,isShow:true}
						],
					},
					{id:'04',categoryName:'团队管理',
						children:[
							{title:'我的团队',icon:'team',link:'',isOpen:true,isShow:true},
							{title:'邀请加盟',icon:'shareJoin',link:'/pages/inviteJoin/inviteJoin',isOpen:true,isShow:true}
						],
					}
				],
				minorMenuLists:[
					{title:'我的邀请码',icon:'shareEcode',link:'',isOpen:true,isShow:true},
					{title:'我的卡包',icon:'card',link:'',isOpen:true,isShow:true},
					{title:'我的认证',icon:'myCertify',link:'/pages/myCertify/myCertify',isOpen:true,isShow:true},
					{title:'我的消息',icon:'message',link:'',isOpen:true,isShow:true},
					{title:'系统设置',icon:'setting',link:'',isOpen:true,isShow:true}
				]
				
			}
		},
		components:{
			tabBar
		},
		methods: {
			// 菜单跳转页面
			goDetail(item){
				if(item.isShow && item.isOpen){
					uni.navigateTo({
						url: item.link
					});
				}else{
					common.errorDialog(2,'该模块正在开发中，敬请期待！','提示');
				}
			},
			// 弹窗
			errorDialog(type,content){
				common.errorDialog(type,content);
				return false;
			}
		}
	}
</script>

<style lang="scss">
	.container{
		padding-bottom: 160rpx;
	}
	.basicInfoBox{
		display: flex;
		padding: 17rpx 20rpx 0 28rpx;
		background:linear-gradient(26deg, #D8E2E5 0%, #F0E6DD 31%, #E7DBDF 100%);
		min-height: 220rpx;
		.avatar{
			width: 80rpx;
			height: 80rpx;
			border-radius: 50%;
			overflow: hidden;
			margin-right: 17rpx;
		}
		.infoBox{
			width:100%;
			color: #666666;
			strong{
				color: #333;
			}
			view{
				margin-bottom: 8rpx;
				.csTag{
					border-radius: 10rpx;
					border:1rpx solid #666;
					padding: 4rpx 10rpx;
					margin-left: 10rpx;
					font-size: 24rpx;
				}
				.personalInfoBtn{
					border-radius: 10rpx;
					background-color:#5359CD;
					color: #fff;
					text-align: center;
					padding: 6rpx 7rpx;
					font-size: 24rpx;
					.iconfont{
						font-size: 24rpx;
						margin-left: 4rpx;
					}
				}
			}
			.firstLineBox{
				display: flex;
				justify-content: space-between;
				align-items: center;
			}
		}
	}
	.mainMenuBox{
		background-color: #fff;
		width: 95%;
		margin: -60rpx auto 30rpx;
		border-radius: 10rpx;
		padding: 12rpx 30rpx;
		box-sizing: border-box;
		h4{
			font-size: 30rpx;
			color: #333;
			margin-bottom: 10rpx;
		}
		.item{
			margin-bottom: 30rpx;
		}
		.menuItemBox{
			display: flex;
			flex-wrap: wrap;
			.mainMenuItem{
				display: flex;
				flex-direction: column;
				align-items: center;
				max-width: 20%;
				flex: 1;
				img{
					width: 80rpx;
				}
				text{
					font-size: 28rpx;
					color: #333;
				}
			}
		}
		
	}
	.personalInfo{
		background: #fff;
		width: 95%;
		margin: 6rpx auto 0;
		ul{
			padding: 0 30rpx;
			li{
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-bottom: 1px solid #E6E6E6;
				height: 92rpx;
				.infoBox{
					display: flex;
					align-items: center;
					img{
						width: 52rpx;
						height: 52rpx;
					}
				}
				&:last-child{
					border:none;
				}
			}
		}
	}
</style>
