<template>
	<view class="home">
		<view class='main' v-if='userInfo.user==1'>
			<scroll-view scroll-x class=" nav">
				<view class="flex text-center">
					<view class="cu-item light flex-sub" :class="[TabCur==0?'bg-red text-white':'']" @tap="tabSelect" :data-id="0">
						<text class="cuIcon-circle"></text> 工作台
					</view>
					<view class="cu-item light flex-sub" :class="[TabCur==1?'bg-red text-white':'']" @tap="tabSelect" :data-id="1">
						<text class="cuIcon-activity"></text> 门店数据
					</view>
				</view>
			</scroll-view>

			<!-- 工作台 -->
			<view v-if="TabCur==0">
				<view class="cu-list grid ">
					<!-- 疗程服务 -->
					<navigator url='./service-log/service-log' class="cu-item">
						<view class="cuIcon-formfill text-red">

						</view>
						<text>疗程服务日志</text>
					</navigator>
					<!-- 业绩提成 -->
					<navigator url='./sales-commission/sales-commission' class="cu-item">
						<view class="cuIcon-rankfill text-red"></view>
						<text>业绩提成</text>
					</navigator>
					<navigator url='./client-evaluation/client-evaluation' class="cu-item">
						<view class="cuIcon-form text-red"></view>
						<text>个人客户评价</text>
					</navigator>
					<navigator url='./client-follow/client-follow' class="cu-item">
						<view class="cuIcon-edit text-red"></view>
						<text>客户跟进</text>
					</navigator>

				</view>
			</view>
			<!-- 数据分析 -->
			<view v-if="TabCur==1">
				<view class="cu-list grid ">
					<!-- 门店日报 -->
					<navigator url='./all-powerful/all-powerful' class="cu-item">
						<view class="cuIcon-formfill text-red"></view>
						<text>门店日报</text>
					</navigator>
					<navigator url='./all-powerful/all-powerful' class="cu-item">
						<view class="cuIcon-rankfill text-red"></view>
						<text>门店业绩</text>
					</navigator>
					<navigator url='./all-powerful/all-powerful' class="cu-item">
						<view class="cuIcon-rankfill text-red"></view>
						<text>门店排行榜</text>
					</navigator>
					<navigator url='./todays-star/todays-star' class="cu-item">
						<view class="cuIcon-favorfill text-red"></view>
						<text>今日之星</text>
					</navigator>
				</view>
			</view>
			<!-- 未开发菜单 -->
			<view>
			</view>
		</view>
		<view class='main'  v-if='userInfo.user==0' style="margin-top: 40upx;">
			<view class="cu-list grid ">
				<navigator url='./all-powerful/all-powerful' class="cu-item">
					<view class="cuIcon-favorfill text-red"></view>
					<text>全能测试页面</text>
				</navigator>
				<!-- 我的预约 -->
				<navigator url='./reservation/reservation' class="cu-item">
					<view class="cuIcon-formfill text-red"></view>
					<text>我的预约</text>
				</navigator>
				<!-- 服务反馈 -->
				<navigator url='./service-feedback/service-feedback' class="cu-item">
					<view class="cuIcon-rankfill text-red"></view>
					<text>服务反馈</text>
				</navigator>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				TabCur: 0,
				userInfo: null,
				hiddenShow: false,
			};
		},
		methods: {
			tabSelect(e) {
				this.TabCur = e.currentTarget.dataset.id * 1;

			}

		},
		created() {
			
			console.log(this.userInfo);
			this.userInfo = uni.getStorageSync('userInfo')
			// uni.reLaunch({
			// 	url:'./all-powerful/all-powerful'
			// })
			
			if (this.userInfo.user == 1) {
				this.hiddenShow = false
				//员工
			} else {
				// 会员
				this.hiddenShow = true
			}
		},
		onPullDownRefresh() {
			console.log('refresh');
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		}
	}
</script>

<style>
	navigator {
		width: 33.3%;
	}

	.home .nav .cu-item {
		padding: 0;
		margin: 0;
	}
</style>
