<template>
	<view class="cented-box">
		<view class="Switchingbox">
			<view class="Switching1">
				<image class="Switching1-img" src="../../static/images/loupan.png" mode=""></image>
			</view>
			<view class="Switching2 u-line-1">项目：{{buildingname}}</view>
			<view class="Switching4" v-if="buildingishow" @click="piskbuilding()">切换项目</view>
		</view>
		<view class="title" style="margin-top: 30rpx; display: flex; justify-content: space-between;" v-if="permissions.myisshebei">
			<view class="gongpai">
				我的工牌:{{imeiCode||'未绑定'}}
			</view>
			<view class="" style="color: #2671E2; font-weight: normal;">
				<!-- 接待中 -->
				{{openFlag=='start'?'接待中':''}}
			</view>
		</view>
		<view v-if="permissions.myisshebei" style="margin-bottom: 20rpx">
			<view class="Workcard" v-if="Whetheroffline">
				<view class="Workcard-box">
					<view class="Workcardimg">
						<view class="Workcardimg1">
							<view v-if="percentage>20" class="bar" :style="{width : percentage + '%' }"></view>
							<view v-if="percentage<20" class="bar1" :style="{width : percentage + '%' }"></view>
						</view>
					</view>
					<view class="Workcardtext">电量：{{percentage}}%</view>
				</view>
				<view class="Workcard-box">
					<view class="Workcardimg">
						<image v-if="signalDevice==''" class="Workcardimg2" src="../../static/images/signal0.png"
							mode=""></image>
						<image v-else-if="signalDevice<20 && signalDevice>0" class="Workcardimg2"
							src="../../static/images/signal1.png" mode=""></image>
						<image v-else-if="signalDevice<50 && signalDevice>20" class="Workcardimg2"
							src="../../static/images/signal2.png" mode=""></image>
						<image v-else-if="signalDevice<70 && signalDevice>50" class="Workcardimg2"
							src="../../static/images/signal3.png" mode=""></image>
						<image v-else-if="signalDevice<90 && signalDevice>70" class="Workcardimg2"
							src="../../static/images/signal4.png" mode=""></image>
						<image v-else-if="signalDevice<=100 && signalDevice>90" class="Workcardimg2"
							src="../../static/images/signal5.png" mode=""></image>
					</view>
					<view class="Workcardtext">信号：{{signalDevicetext}}</view>
				</view>
				<view class="Workcard-box">
					<view class="Workcardimg">
						<image v-if="audioStatus=='true'" class="Workcardimg3"
							src="../../static/images/Thtapedrive1.png" mode=""></image>
						<image v-if="audioStatus=='false'" class="Workcardimg3"
							src="../../static/images/Thtapedrive2.png" mode=""></image>
					</view>
					<view v-if="audioStatus=='true'" class="Workcardtext">录音：已开启</view>
					<view v-if="audioStatus=='false'" class="Workcardtext">录音：未开启</view>
				</view>
			</view>
			<view class="Workcard" v-if="Whetheroffline==false">
				<view class="Workcard-box">
					<view class="Workcardimg">
						<image class="Workcardimg4" src="../../static/images/offline.png" mode=""></image>
					</view>
					<view class="Workcardtext">设备离线</view>
				</view>
			</view>
		</view>

<!-- 
		<view class="title" v-if="permissions.shebeinum">待处理</view>
		<view class="shebenbox" v-if="permissions.shebeinum" >
			<view class="shebenche" @click="indexStatus(0)">
				<view class="shebenchenum">{{operation.receptionCount || 0}}</view>
				<view class="shebenchetext">接待即将结束</view>
			</view>
			<view class="shebenche" @click="indexStatus(1)">
				<view class="shebenchenum">{{operation.accountCount || 0}}</view>
				<view class="shebenchetext">未标顾问</view>
			</view>
			<view class="shebenche" @click="indexStatus(3)">
				<view class="shebenchenum">{{operation.forbiddenCount || 0}}</view>
				<view class="shebenchetext">违禁提醒</view>
			</view>
		</view> -->

<!-- 设备总览 -->
		<view class="contbox" v-if="permissions.shebeinum">
			<view class="title"> 
				<image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png" mode="" />
				设备总览</view>
			<view class="shebenbox">
				<view class="shebenche" @click="tapjumpequipment(0)">
					<view class="shebenchenum">{{equipmentobj.totalNum || 0}}</view>
					<view class="shebenchetext">设备总数</view>
				</view>
				<view class="shebenche" @click="tapjumpequipment(1)">
					<view class="shebenchenum">{{equipmentobj.onlineNum || 0}}</view>
					<view class="shebenchetext">在线</view>
				</view>
				<view class="shebenche" @click="tapjumpequipment(3)">
					<view class="shebenchenum">{{equipmentobj.activeNum || 0}}</view>
					<view class="shebenchetext">活跃</view>
				</view>
				<view class="shebenche" @click="tapjumpequipment(2)">
					<view class="shebenchenum" style="color: red;">{{operation.lowPowerNum || 0}}</view>
					<view class="shebenchetext">低电工牌</view>
				</view>
			</view>

		</view>
		<!-- 今日工作 -->
		<view class="contbox" v-if="permissions.shishinum">
			<view class="title" ><image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png" mode="" />今日工作</view>
			<view class="real-timebox">
				<view class="timebox">
					<view class="real" @click="tapjumpreception('1')">
						<view class="realnum u-flex"  style="justify-content: center">{{realtimeobj.fraction || 0}}% 
							<!-- <image class="qushi-icon" src="/static/images/excute.png"  mode="" /> -->
						</view>
						<view class="realtext">平均执行率</view>
					</view>
					<view class="real" @click="tapjumpreception('11')">
						<view class="realnum">{{realtimeobj.receptionCount || 0}}</view>
						<view class="realtext">接待量</view>
					</view>
					<view class="real" @click="tapjumpreception('2')">
						<view class="realnum">{{realtimeobj.receivingCustomer || 0}}</view>
						<view class="realtext">正在接待</view>
					</view>
					<view class="real" @click="tapjumpreception('6')">
						<view class="realnum">{{realtimeobj.activeCustomer|| 0}}</view>
						<view class="realtext">有效接待</view>
					</view>
				</view>
				<view class="timebox" style="margin-bottom:0;">
					<view class="real" @click="tapjumpreception('1')">
						<view class="realnum">{{realtimeobj.avgDuration|| 0}}min</view>
						<view class="realtext">平均接待时长</view>
					</view>
					<view class="real" @click="tapjumpreception('4')">
						<view class="realnum">{{realtimeobj.tagCustomer || 0}}</view>
						<view class="realtext">未标顾问</view>
					</view>
					<view class="real">
						<view @click="prohibitedtap(1)" v-if="methodsisshow==true" class="realnum" style="color: red;">
							{{realtimeobj.prohibitedCustomer || 0}}</view>
						<view @click="prohibitedtap(1)" v-if="methodsisshow==true" class="realtext">违禁预警</view>
					</view>
					<view class="real">
						<view class="realnum"></view>
						<view class="realtext"></view>
					</view>

				</view>
			</view>
		</view>
		<!-- 近30天 -->
		<view class="contbox"  v-if="permissions.jileinum">
			<view class="title">
				<image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png" mode="" />
				<view style="width: 70%;"  @click="taptimeisshow">
					<!-- 概览 -->
					{{choiceIndex}}累计<u-icon name="arrow-down" size="24" style="padding-left: 12rpx;"></u-icon>
				</view>
			</view>
			<!-- <view class="timeshow">统计时间：2022.05.20-2022.05.27</view> -->
			<view class="real-timebox" >
				<view class="timebox">
					<view class="real" @click="tapjumpreception('3')">
						<view class="realnum u-flex" style="justify-content: center">{{Thisweekobj.fraction || 0}}%
							<!-- <image class="qushi-icon" src="/static/images/qushi-up.png" mode="" /> -->
						</view>
						<view class="realtext">平均执行率</view>
					</view>
					<view class="real" @click="tapjumpreception('33')">
						<view class="realnum">{{Thisweekobj.receptionCount || 0}}</view>
						<view class="realtext">接待量</view>
					</view>
					<view class="real" @click="tapjumpreception('7')">
						<view class="realnum">{{Thisweekobj.activeCustomer|| 0}}</view>
						<view class="realtext">有效接待</view>
					</view>
				</view>
				<view class="timebox" style="margin-bottom:0;">
					<view class="real" @click="tapjumpreception('3')">
						<view class="realnum">{{Thisweekobj.avgDuration || 0}}min</view>
						<view class="realtext">平均接待时长</view>
					</view>
					<view class="real" @click="prohibitedtap(2)" v-if="methodsisshow">
						<view class="realnum" style="color: red;">{{Thisweekobj.prohibitedCustomer || 0}}</view>
						<view class="realtext">违禁预警</view>
					</view>
					<view class="real" v-else>
						<view class="realnum"></view>
						<view class="realtext"></view>
					</view>
					<view class="real">
						<view class="realnum"></view>
						<view class="realtext"></view>
					</view>
				</view>
			</view>
		</view>
		<!-- 常用功能 -->
	<view class="contbox" >
		<view class="title" v-if="permissions.commonly2||permissions.commonly3||permissions.commonly10">
			<image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png" mode="" />接待管理</view>
		<view class="commonly-box">
			<view class="commonly" @click="Piabodata('接待记录')" v-if="permissions.commonly2">
				<view class="commonly-img">
					<image class="commonly-img1" src="https://static.quhouse.com/4649b5bd19124afca0f1a809f93bfd73.png" mode=""></image>
				</view>
				<view class="commonly-text">接待记录</view>
			</view>
			<view class="commonly" @click="Piabodata('违禁记录')" v-if="permissions.commonly3">
				<view class="commonly-img">
					<image class="commonly-img1" src="https://static.quhouse.com/b1dd1da2a969465bbbf41818320b8487.png" mode=""></image>
				</view>
				<view class="commonly-text">违禁记录</view>
			</view>
			<view class="commonly" @click="toUserinsightinto()" v-if="permissions.commonly10">
				<view class="commonly-img">
					<image class="commonly-img1" src="https://static.quhouse.com/c2c2e1af3d5f41d180ec55a04a5d4f26.png" mode=""></image>
				</view>
				<view class="commonly-text">客户画像</view>
			</view>
		</view>
		<view class="title" v-if="permissions.commonly4||permissions.commonly8||permissions.commonly7||permissions.commonly9">
			<image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png" mode="" />数据分析</view>
		<view class="commonly-box">
			<view class="commonly" @click="Piabodata('销讲分析')" v-if="permissions.commonly4">
				<view class="commonly-img">
					<image class="commonly-img1" src="https://static.quhouse.com/1f01dfa38203493b88d9668a506fdff3.png" mode=""></image>
				</view>
				<view class="commonly-text">销讲分析</view>
			</view>
			<view class="commonly" @click="toTrendAnalysis()" v-if="permissions.commonly8">
				<view class="commonly-img">
					<image class="commonly-img1" src="https://static.quhouse.com/df070b1a2d5e48359c7de5654e4f7a17.png" mode=""></image>
				</view>
				<view class="commonly-text">销讲趋势</view>
			</view>
				<view class="commonly" @click="Piabodata('顾问排名')" v-if="permissions.commonly7">
				<view class="commonly-img">
					<image class="commonly-img1" src="https://static.quhouse.com/f5a6b2d6032348a1b256cfd7083be436.png" mode=""></image>
				</view>
				<view class="commonly-text">顾问排名</view>
				</view>
				<view class="commonly" @click="toStaffAnalysis()" v-if="permissions.commonly9">
				<view class="commonly-img">
					<image class="commonly-img1" src="https://static.quhouse.com/c2d3801540cf4880a68cce0e04eb59b0.png" mode=""></image>
				</view>
				<view class="commonly-text">员工分析</view>
				</view>
		</view>
		<view class="title" v-if="permissions.commonly11||permissions.commonly12||permissions.commonly5||permissions.commonly6">
			<image class="title-icon" src="https://static.quhouse.com/bc2ec951ad9a47e5bf58f2829926e143.png" mode="" />团队管理</view>
			<view class="commonly-box">
				<view class="commonly" @click="Theteamcompared()" v-if="permissions.commonly11">
						<view class="commonly-img">
							<image class="commonly-img1" src="https://static.quhouse.com/4f5a3a61c06a4508a806eb290ef678e6.png" mode=""></image>
						</view>
						<view class="commonly-text">团队对比</view>
					</view>
					<view class="commonly" @click="Groupcontrast()" v-if="permissions.commonly12">
						<view class="commonly-img">
							<image class="commonly-img1" src="https://static.quhouse.com/759c2e3240e54213827196559ce38fa4.png" mode=""></image>
						</view>
						<view class="commonly-text">集团对比</view>
					</view>
					<view class="commonly" @click="Piabodata('设备管理')" v-if="permissions.commonly5">
				<view class="commonly-img">
					<image class="commonly-img1" src="https://static.quhouse.com/e617133ecbbd46498e30719444fc02e8.png" mode=""></image>
				</view>
				<view class="commonly-text">设备管理</view>
			</view>
			<view class="commonly" @click="Piabodata('值班顾问')" v-if="permissions.commonly6">
				<view class="commonly-img">
					<image class="commonly-img1" src="https://static.quhouse.com/196fcbc7f6aa456cb9dff22cd3753445.png" mode=""></image>
				</view>
				<view class="commonly-text">值班顾问</view>
			</view>
			</view>
	</view>
		<!-- 项目切换 -->
		<view v-if="Showhiddenunits">
			<u-select :mask-close-able="false" v-model="Showhiddenunits" mode="single-column" :list="lpanlist"
				@cancel="cancel" @confirm="confirm"></u-select>
		</view>
		<u-calendar v-model="totalTimeShow" mode="range" @change="totalTimeChange"></u-calendar>
		<u-popup v-model="timeshow" mode="bottom">
			<view class="timeview" :style="{ color: zhixingcenterindex == 2 ? '#2B6EFF' : '#333333' }" @click="tabtimetap(2,'近7天')">近7天</view>
			<view class="timeview" :style="{ color: zhixingcenterindex == 6 ? '#2B6EFF' : '#333333' }" @click="tabtimetap(6,'近30天')">近30天</view>
			<view class="timeview" :style="{ color: zhixingcenterindex == 7 ? '#2B6EFF' : '#333333' }" @click="tabtimetap(7,'自定义')">自定义</view>
		</u-popup>
		<!-- 底部导航栏 -->
		<!-- <u-tabbar :mid-button="false" activeColor="#1296db" inactiveColor="#999999" v-model="current" :list="tabbarList"></u-tabbar> -->
	</view>
</template>

<script>
	var config = require("../../config");
	import tabbarList from '@/utils/tabbar.js'
	export default {
		data() {
			return {
				// tabbar配置项
				current: 2,
				tabbarList: tabbarList,
				//--- end --- tabbar配置项
				userInfo: {},
				Showhiddenunits: false,
				lpanlist: [], //项目列表
				buildingname: '', //项目名
				buildingID: '', //项目id
				buildingishow: false, //是否选择项目
				// Myworkcard: false,
				percentage: '', //设备电量
				Whetheroffline: false, //是否离线
				signalDevice: 0, //信号
				signalDevicetext: "",
				imeiCode:'',//设备号
				openFlag:'',//接待是否
				choiceIndex:'近7天',
				audioStatus: false,
				equipmentisshow: false,
				timeshow:false,
				equipmentobj: {
					totalNum: '',
					onlineNum: '',
					activeNum: '',
					lowPowerNum: '',
				},
				operation:{
					receptionCount:'',
					accountCount:'',
					forbiddenCount:'',
					lowPowerNum:''
				},
				Menulist: [],
				realtimeobj: {
					sumCustomer: '',
					receivingCustomer: '',
					activeCustomer: '',
					prohibitedCustomer: '',
					tagCustomer: '',
					fraction: '',
					receptionCount: ''
				},
				Thisweekobj: {
					sumCustomer: '',
					receivingCustomer: '',
					activeCustomer: '',
					prohibitedCustomer: '',
					tagCustomer: '',
					fraction: '',
					receptionCount: ''
				},
				methodsisshow: false,
				zhixingcenterindex: 2,
				totalTimeShow: false,
				statDateStart: '',
				statDateEnd: '',
				permissions: {
					commonly1: false,
					commonly2: false,
					commonly3: false,
					commonly4: false,
					commonly5: false,
					commonly6: false,
					commonly7: false,
					myisshebei: false,
					shebeinum: false,
					shishinum: false,
					jileinum: false
				},

				// 标记顾问 bjgw
				// 接待无效标记 jdwxbj
				// 设为优秀案例 swyxal
				// 常错词 ccc
				// 校准 xz
				// 查看违禁执行 ckwjzx
			};
		},
		components: {},
		onLoad() {
			this.sendLog()
		},
		
		onPullDownRefresh() {
			this.getMenu()

			this.userInfo = uni.getStorageSync('weapp_session_userInfo_data');
			if (this.userInfo.dataCode == 6 || this.userInfo.dataCode == 3) {
				this.methodsisshow = false;
			} else {
				this.methodsisshow = true;
			}
			if (this.userInfo.zkProperties.length == 1) {
				this.buildingID = uni.getStorageSync('buildingID').id;
				this.buildingname = uni.getStorageSync('buildingID').name;
				this.buildingishow = false;
			} else {
				this.buildingishow = true;
				this.buildingname = uni.getStorageSync('buildingID').name;
				this.buildingID = uni.getStorageSync('buildingID').id;
				this.userInfo.zkProperties.forEach(item => {
					item.label = item.propertyName;
					item.value = item.id
				})
				this.lpanlist = this.userInfo.zkProperties
			}
			if (this.userInfo.dataCode == 6) {
				// this.Myworkcard = true;
				this.equipmentisshow = false;
				this.iniodianloang()
			} else {
				this.equipmentisshow = true;
				// this.Myworkcard = false;
				this.initequipment()
				this.waitForOperation()
			}
			this.initworkThisWeek()
			this.initrealTimeStatistics()
			setTimeout(() => {
				uni.stopPullDownRefresh()
			}, 3000)
		},
		
		onShow() {
			this.getMenu()

			this.userInfo = uni.getStorageSync('weapp_session_userInfo_data');
			if (this.userInfo.dataCode == 6 || this.userInfo.dataCode == 3) {
				this.methodsisshow = false;
			} else {
				this.methodsisshow = true;
			}
			if (this.userInfo.zkProperties&&this.userInfo.zkProperties.length == 1) {
				this.buildingID = uni.getStorageSync('buildingID').id;
				this.buildingname = uni.getStorageSync('buildingID').name;
				this.buildingishow = false;
				uni.setStorageSync('orgCode', this.userInfo.zkProperties[0].orgCode)
			} else {
				this.buildingishow = true;
				this.buildingname = uni.getStorageSync('buildingID').name;
				this.buildingID = uni.getStorageSync('buildingID').id;
				if(this.userInfo.zkProperties&&this.userInfo.zkProperties.length){
					this.userInfo.zkProperties.forEach(item => {
						item.label = item.propertyName;
						item.value = item.id
					})
				}
				this.lpanlist = this.userInfo.zkProperties
			}
			if (this.userInfo.dataCode == 6) {
				// this.Myworkcard = true;
				this.equipmentisshow = false;
				this.iniodianloang()
			} else {
				this.equipmentisshow = true;
				// this.Myworkcard = false;
				this.initequipment()
				this.waitForOperation()
			}
			this.initworkThisWeek()
			this.initrealTimeStatistics()
		},
		methods: {
			indexStatus(i){
				if (this.permissions.commonly5 == true) {
					if(i==0){
						uni.switchTab({
							url:"/pages/index/customer"
						})
					}else if(i==1){
						uni.navigateTo({
							url: '/pages/center/records/index?refresh=refresh&markAdvisor=0'
						});
					}else if(i==3){
						uni.navigateTo({
							url: '/pages/center/prohibited/index?refresh=refresh'
						});
					}
				}
			},
			sendLog(){
				uni.request({
					url: config.service.addLog,
					method: "POST",
					header: {
						'content-type': 'application/json',
						'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
					},
					data: {
						houseId: this.buildingID,
						serviceId:"test"
					},
					success: (data) => {
						console.log(data)
					}
				})
			},
			//时间选择
			tabtimetap(index,str){
				this.timeshow=false;
				if (index == 7) {
					this.totalTimeShow = true;
				} else {
					console.log(str)
					this.choiceIndex=str
					this.zhixingcenterindex = index;
					this.initworkThisWeek()
				}
			},
			taptimeisshow(){
				this.timeshow=true;
			},
			//获取权限
			getMenu() {
				uni.request({
					url: config.service.getMenu,
					method: "POST",
					header: {
						'content-type': 'application/json',
						'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
					},
					success: (data) => {
						console.log(data, 'dsadjsakljlkj123kl12321')
						let rescor = data.data;
						if (rescor.code == 0) {
							uni.setStorageSync("weapp_session_Menu_data", rescor.data)
							let newmenulist = uni.getStorageSync('weapp_session_Menu_data');
							this.permissions.commonly1 = newmenulist.khgl;
							this.permissions.commonly2 = newmenulist.jdjl;
							this.permissions.commonly3 = newmenulist.wjjl;
							this.permissions.commonly4 = newmenulist.xjfx;
							this.permissions.commonly5 = newmenulist.sbgl;
							this.permissions.commonly6 = newmenulist.zbgw;
							this.permissions.commonly7 = newmenulist.gwpm;
							
							this.permissions.commonly8=newmenulist.lpdb;
							this.permissions.commonly9=newmenulist.xjqs;
							this.permissions.commonly10=newmenulist.tddb;
							this.permissions.commonly11=newmenulist.gwnl;
							this.permissions.commonly12=newmenulist.yhhx;

							this.permissions.myisshebei = newmenulist.wdsb;
							this.permissions.shebeinum = newmenulist.sbtj;
							this.permissions.shishinum = newmenulist.sstj;
							this.permissions.jileinum = newmenulist.gzlj;
						}
					}
				})
			},
			//自定义时间
			totalTimeChange(e) {
				this.statDateStart = e.startDate;
				this.statDateEnd = e.endDate;
				this.choiceIndex= `${e.startDate.replace(/\-/g, '.')}-${e.endDate.replace(/\-/g, '.')}`
				this.zhixingcenterindex = 7;
				this.initworkThisWeek()
			},
			tabtimeclick(i) {
				if (i == 7) {
					this.totalTimeShow = true;
				} else {
					this.zhixingcenterindex = i;
					this.initworkThisWeek()
				}
			},
			initworkThisWeek() {
				uni.request({
					url: config.service.workThisWeek,
					method: "POST",
					header: {
						'content-type': 'application/json',
						'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
					},
					data: {
						houseId: this.buildingID,
						dateType: this.zhixingcenterindex == 7 ? null : this.zhixingcenterindex,
						statDateStart: this.statDateStart,
						statDateEnd: this.statDateEnd
					},
					success: (data) => {
						if (data.data.data == null) {
							return
						} else {
							this.Thisweekobj = {
								sumCustomer: data.data.data.sumCustomer,
								receivingCustomer: data.data.data.receivingCustomer,
								activeCustomer: data.data.data.activeCustomer,
								prohibitedCustomer: data.data.data.prohibitedCustomer,
								avgDuration: data.data.data.avgDuration || 0,
								tagCustomer: data.data.data.tagCustomer,
								fraction: data.data.data.fraction,
								receptionCount: data.data.data.receptionCount
							}
						}
					}
				})
			},
			//实时统计
			initrealTimeStatistics() {
				uni.request({
					url: config.service.realTimeStatistics,
					method: "POST",
					header: {
						'content-type': 'application/json',
						'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
					},
					data: {
						houseId: this.buildingID
					},
					success: (data) => {
						if (data.data.data == null) {
							return
						} else {
							this.realtimeobj = {
								sumCustomer: data.data.data.sumCustomer,
								receivingCustomer: data.data.data.receivingCustomer,
								activeCustomer: data.data.data.activeCustomer,
								prohibitedCustomer: data.data.data.prohibitedCustomer,
								avgDuration: data.data.data.avgDuration || 0,
								tagCustomer: data.data.data.tagCustomer,
								fraction: data.data.data.fraction,
								receptionCount: data.data.data.receptionCount
							}
						}
					}
				})
			},

			//设备
			initequipment() {
				uni.request({
					url: config.service.findEquipmentState,
					method: "POST",
					header: {
						'content-type': 'application/json',
						'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
					},
					data: {
						propertyId: this.buildingID
					},
					success: (data) => {
						if (data.data.data == null) {
							return
						} else {
							this.equipmentobj = {
								totalNum: data.data.data.totalNum,
								onlineNum: data.data.data.onlineNum,
								activeNum: data.data.data.activeNum,
								lowPowerNum: data.data.data.lowPowerNum,
							}
						}
					}
				})
			},
			// 待处理
			waitForOperation (){
				this.$u.post('/cusLvStatistics/waitForOperation ',{
					houseId:this.buildingID
				})
				.then(res=>{
					// console.log(res,'带接待')
					this.operation.receptionCount=res.receptionCount
					this.operation.accountCount=res.accountCount
					this.operation.forbiddenCount=res.forbiddenCount
					this.operation.lowPowerNum=res.lowPowerNum
				})
			},
			//我的工牌
			iniodianloang() {
				uni.request({
					url: config.service.findElectricity,
					method: "POST",
					header: {
						'content-type': 'application/json',
						'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
					},
					data: {
						propertyId: this.buildingID,
						accPhone: this.userInfo.username
					},
					success: (data) => {
						if (data.data.data == null) {
							return
						} else {
							this.imeiCode=data.data.data.imei
							this.openFlag=data.data.data.recCmd
							if (data.data.data > 100) {
								this.percentage = 100;
							} else {
								if (data.data.data.onLine == 0) {
									this.Whetheroffline = false;
								} else {
									this.Whetheroffline = true;
									this.percentage = data.data.data.electricity;
									this.signalDevice = data.data.data.signalDevice / 1;
									console.log(this.signalDevice)
									this.audioStatus = data.data.data.simAudioStatus;
									if (this.signalDevice > 80) {
										this.signalDevicetext = '高';
									} else {
										if (this.signalDevice == 0) {
											this.signalDevicetext = '无';
										} else {
											this.signalDevicetext = '低';
										}
									}
								}

							}
						}
					}
				})
			},
			//选择项目弹框
			piskbuilding() {
				// this.Showhiddenunits = true;
				uni.navigateTo({
					url:"../mine/selectBuilding"
				})
			},
			// 项目选择确认
			confirm(e) {
				this.buildingname = e[0].label;
				this.buildingID = e[0].value;
				let lopan = {
					id: e[0].value,
					name: e[0].label
				}
				uni.setStorageSync("buildingID", lopan); //项目id写入缓存
				uni.setStorageSync("orgCode", e[0].orgCode); //项目id写入缓存
				this.initworkThisWeek()
				this.initrealTimeStatistics()
				this.waitForOperation()
				this.initequipment()
				this.iniodianloang()

			},
			// 项目选择取消
			cancel() {
				this.Showhiddenunits = false;
			},
			tapjumpequipment(i) {
				if (this.permissions.commonly5 == true) {
					uni.navigateTo({
						url: '/pages/mine/equipment/index?active=' + i
					});
				}
			},
			prohibitedtap(i) {
				if (i == 1) {
					uni.navigateTo({
						url: '/pages/center/prohibited/index?refresh=refresh&activeTotal=0' + '&violatedStatus=1'
					});
				} else {
					if (this.zhixingcenterindex == 2) {
						uni.navigateTo({
							url: '/pages/center/prohibited/index?refresh=refresh&activeTotal=2' + '&violatedStatus=1'
						});
					} else if (this.zhixingcenterindex == 6) {//近30天
						uni.navigateTo({
							url: '/pages/center/prohibited/index?refresh=refresh&activeTotal=3' + '&violatedStatus=1'
						});
					} else {// 自定义时间段
						uni.navigateTo({
							url: '/pages/center/prohibited/index?refresh=refresh&activeTotal=4&staTime=' + this.statDateStart + '&endtime=' + this.statDateEnd + '&violatedStatus=1'
						});
					}
				}
			},
			tapjumpreception(i) {
				if (this.permissions.commonly2 == true) {
					if (i == 1) {
						uni.navigateTo({
							url: '/pages/center/records/index?refresh=refresh&activeTotal=0&validInvalid=0'
						});
					} else if (i == 11) {
						uni.navigateTo({
							url: '/pages/center/records/index?refresh=refresh&activeTotal=0'
						});
					} else if (i == 2) {
						uni.switchTab({
							url: '/pages/index/customer'
						});
					} else if (i == 3) {
						if (this.zhixingcenterindex == 2) {// 近7天
							uni.navigateTo({
								url: '/pages/center/records/index?refresh=refresh&activeTotal=2&validInvalid=0'
							});
						} else if (this.zhixingcenterindex == 6) {//近30天
							uni.navigateTo({
								url: '/pages/center/records/index?refresh=refresh&activeTotal=3&validInvalid=0'
							});
						} else {// 自定义时间段
							uni.navigateTo({
								url: '/pages/center/records/index?refresh=refresh&activeTotal=4&validInvalid=0&staTime=' + this.statDateStart + '&endtime=' + this.statDateEnd
							});
						}
					} else if (i == 33) {
						if (this.zhixingcenterindex == 2) {// 近7天
							uni.navigateTo({
								url: '/pages/center/records/index?refresh=refresh&activeTotal=2'
							});
						} else if (this.zhixingcenterindex == 6) {//近30天
							uni.navigateTo({
								url: '/pages/center/records/index?refresh=refresh&activeTotal=3'
							});
						} else {// 自定义时间段
							uni.navigateTo({
								url: '/pages/center/records/index?refresh=refresh&activeTotal=4&staTime=' + this.statDateStart + '&endtime=' + this.statDateEnd
							});
						}
					} else if (i == 6) {
						uni.navigateTo({
							url: '/pages/center/records/index?refresh=refresh&activeTotal=0&validInvalid=0'
						});
					} else if (i == 7) {
						if (this.zhixingcenterindex == 2) {
							uni.navigateTo({
								url: '/pages/center/records/index?refresh=refresh&activeTotal=2&validInvalid=0'
							});
						} else if (this.zhixingcenterindex == 6) {
							uni.navigateTo({
								url: '/pages/center/records/index?refresh=refresh&activeTotal=3&validInvalid=0'
							});
						} else {
							uni.navigateTo({
								url: '/pages/center/records/index?refresh=refresh&activeTotal=4&validInvalid=0&staTime=' + this.statDateStart + '&endtime=' + this.statDateEnd
							});
						}
					} else {
						uni.navigateTo({
							url: '/pages/center/records/index?refresh=refresh&activeTotal=0&markAdvisor=0'
						});
					}
				}
			},
			//集团对比
			Groupcontrast() {
				uni.navigateTo({
					url: '/pages/center/Piabodata/Groupcontrast'
				});
			},
			//团队对比
			Theteamcompared() {
				// if (this.teamList.length == 0) {
				// 	uni.showToast({
				// 		title: '没有团队呢',
				// 		icon: 'none'
				// 	})
				// 	return
				// }
				uni.navigateTo({
					url: '/pages/center/Piabodata/Theteamcompared'
				});
			},
			//用户洞察
			toUserinsightinto() {
				uni.navigateTo({
					url: '/pages/center/Piabodata/Userinsightinto'
				});
			},
			//趋势分析
			toTrendAnalysis() {
				uni.navigateTo({
					url: '/pages/center/Piabodata/TrendAnalysis'
				});
			},
			//员工分析
			toStaffAnalysis() {
				// if (this.staffList.length == 0) {
				// 	uni.showToast({
				// 		title: '没有团队呢',
				// 		icon: 'none'
				// 	})
				// 	return
				// }
				uni.navigateTo({
					url: '/pages/center/Piabodata/StaffAnalysis'
				});
			},
			Piabodata(item) {
				if (item == '销讲分析') {
					uni.navigateTo({
						url: '/pages/center/Piabodata/index'
					});
				} else if (item == '接待记录') {
					uni.navigateTo({
						url: '/pages/center/records/index?refresh=refresh'
					});
				} else if (item == '值班顾问') {
					uni.navigateTo({
						url: '/pages/mine/consultanonduty/index'
					});
				} else if (item == '设备管理') {
					uni.navigateTo({
						url: '/pages/mine/equipment/index'
					});
				} else if (item == '顾问排名') {
					uni.navigateTo({
						url: '/pages/center/Piabodata/Employeesstatistics'
					});
				} else if (item == '违禁记录') {
					uni.navigateTo({
						url: '/pages/center/prohibited/index?refresh=refresh'
					});
				}else if (item == '日报') {
					uni.navigateTo({
						url: '/pages/mine/daily/dailyList?refresh=refresh'
					});
				} else {
					uni.navigateTo({
						url: '/pages/center/consumer/index?refresh=refresh'
					});
				}


			},
		},

	};
</script>

<style lang="scss" scoped>
	.activecllasscet {
		font-size: 28rpx;
		font-weight: 400;
		color: #008ef2;
	}

	.cet {
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;

		.cetview {
			margin-left: 20rpx;
		}
	}

	.cented-box {
		padding: 30rpx;
		background: #F8F8F8;
		width: 100%;
		height: 100%;
	}

	.Switchingbox {
		width: 100%;
		height: 44rpx;
		margin-bottom: 30rpx;
		display: flex;
		align-items: center;

		.Switching1 {
			width: 44rpx;
			height: 44rpx;
			.Switching1-img {
				width: 44rpx;
				height: 44rpx;
			}
		}

		.Switching2 {
			margin: 0 12rpx;
			flex:1;
			height: 44rpx;
			font-size: 32rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #303030;
			line-height: 44rpx;
		}

		.Switching4 {
			width: 112rpx;
			font-size: 28rpx;
			color: #303030;
			font-weight: 400;
			text-align: right;
			text-decoration: underline;
			font-family: PingFangSC-Regular, PingFang SC;
		}
	}

	.gongpai{
		margin-bottom: 20rpx;
	}
	.Workcard {
		width: 100%;
		background: #FFFFFF;
		height: 154rpx;
		box-shadow: 0px 0px 12rpx 0px rgba(224, 224, 224, 0.3);
		border-radius: 12rpx;
		display: flex;

		.Workcard-box {
			flex: 1;
			height: 100%;

			.Workcardimg {
				width: 100%;
				display: flex;
				justify-content: center;
				margin-top: 42rpx;

				.Workcardimg1 {
					width: 64rpx;
					height: 36rpx;
					background-image: url(../../static/images/battery.png);
					background-size: 100% 100%;
					padding: 8rpx;
					transform: rotate(-90deg);
					.bar {
						background-color: #43CD80;
						height: 100%;
						border-radius: 4rpx;
					}

					.bar1 {
						background-color: red;
						height: 100%;
						border-radius: 4rpx;
					}
				}

				.Workcardimg2 {
					width: 56rpx;
					height: 36rpx;
				}

				.Workcardimg3 {
					width: 34rpx;
					height: 36rpx;
				}

				.Workcardimg4 {
					width: 50rpx;
					height: 40rpx;
				}
			}

			.Workcardtext {
				width: 100%;
				text-align: center;
				font-size: 24rpx;
				font-weight: 400;
				color: #666666;
				margin-top: 20rpx;
			}
		}
	}

	.contbox{
		width: 690rpx;
		background: #FFFFFF;
		border-radius: 12rpx;
		padding: 24rpx 0 30rpx;
		margin-bottom: 20rpx;
		.title {
			height: 42rpx;
			font-size: 30rpx;
			font-family: PingFangSC-Semibold, PingFang SC;
			font-weight: 600;
			color: #333333;
			line-height: 42rpx;
			margin-bottom: 24rpx;
			display: flex;
			align-items: center;
			.title-icon{
				width: 12rpx;
				height: 20rpx;
				margin-right: 18rpx;
			}
		}
		.timeshow{
			height: 40rpx;
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #666666;
			line-height: 40rpx;
			margin: -18rpx 0 24rpx 35rpx ;
		}
	}

	.shebenbox {
		width: 100%;
		display: flex;
		.shebenche {
			width: 25%;
			height: 100%;
			.shebenchenum {
				width: 100%;
				text-align: center;
				height: 50rpx;
				font-size: 44rpx;
				font-family: DINAlternate-Bold, DINAlternate;
				font-weight: bold;
				color: #333333;
				line-height: 50rpx;
			}

			.shebenchetext {
				width: 100%;
				color: #666666;
				text-align: center;
				margin-top: 8rpx;
				height: 32rpx;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				line-height: 32rpx;
			}
		}
	}
	//今日工作
	.real-timebox {
		width: 100%;
		.timebox {
			width: 100%;
			display: flex;
			margin-bottom: 20rpx;
			.real {
				flex: 1;
				height: 100%;

				.realnum {
					width: 100%;
					text-align: center;
					height: 50rpx;
					font-size: 44rpx;
					font-family: DINAlternate-Bold, DINAlternate;
					font-weight: bold;
					color: #333333;
					line-height: 50rpx;
					.qushi-icon{
						width: 28rpx;
						height: 14rpx;
						margin-left: 2rpx;
					}
				}

				.realtext {
					width: 100%;
					text-align: center;
					margin-top: 8rpx;
					height: 32rpx;
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #666666;
					line-height: 32rpx;
				}
			}
		}

	}

	.commonly-box {
		width: 100%;
		display: flex;
		flex-wrap: wrap;

		.commonly {
			width: 25%;
			margin-bottom: 28rpx;

			.commonly-img {
				width: 100%;
				height: 80rpx;
				text-align: center;
				.commonly-img1 {
					width: 80rpx;
					height: 80rpx;
				}
			}

			.commonly-text {
				width: 100%;
				text-align: center;
				margin-top: 12rpx;
				height: 32rpx;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;
				line-height: 32rpx;
			}
		}
	}
	.timeview{
		height: 90rpx;
		line-height: 90rpx;
		width: 100%;
		text-align: center;
		border-bottom: 1rpx solid #f8f8f8;
	}
</style>
