<template>
	<!-- 技师实际收益公式：实付金额=（项目金额*会员比例-优惠卷）*分成比例*余额支付比例+车费 -->
	<view style="padding-bottom: 17px;">
		<view class="jishi-index">
			<view class=" u-flex padding-lr justify-between" style="padding-top: 30px;">
				<view class="u-m-r-10 back-img" 
				:style="{'background-image':
							technicianType=='3'?'url(../../static/grade1.png)':
							technicianType=='4'?'url(../../static/grade2.png)':
							technicianType=='5'?'url(../../static/grade3.png)':''
						}">
					<image :src="avatar" class="head-port"
						@click="goNav('/pages/my/userinfo')"></image>
				</view>
				<view style="position: relative;" class="u-flex-1 margin-left-sm text-white" v-if="isLogin && userName">
					<view class="flex align-center justify-between">
						<view class="">
							<view class="u-font-18 text-white" @click="goNav('/pages/my/user')">
								欢迎，{{ userName }}
							</view>
							<view class="labe margin-top-xs" @tap="stateSave" v-if="XCXIsSelect != '否'">
								<view class="online-tag" v-if="isTrue">在线</view>
								<view class="online-tag" v-if="!isTrue">离线</view>
								<!-- <switch :checked="isTrue" disabled/> -->
								<switch type="switch" :checked='isTrue' style="padding: 0 10rpx;transform:scale(0.8)"
									color="#029d88" disabled />
							</view>
							<view class="qiandao" @click="goNavs('/my/qiandao/index')">
								签到
							</view>
						</view>
						
						<!-- <view class="flex margin-left-sm " style="font-size: 22rpx;font-weight: 500;"
							v-if="XCXIsSelect != '否'">
							<view v-if="renzheng == 0" @click.stop="goNav('/my/renzheng/rzType')">
								暂未实名认证
							</view>
							<view v-if="renzheng == 1" @click.stop="goNav('/my/renzheng/index')">
								实名审核中
							</view>
							<view v-if="renzheng == 2">
								已实名认证
							</view>
							<view v-if="renzheng == 3" @click.stop="goNav('/my/renzheng/index')">
								实名已拒绝
							</view>
						</view> -->

					</view>
				</view>
				<view v-else class="logon" @click="goLogin('/pages/public/login')">
					登录
				</view>
			</view>
			<view class="gxbox" @click="goNavs('/my/qiandao/index')">
				<template v-if="loglataddress">
					<view class="flex align-center gengxin">
						位置：<text class="wztext">{{ loglataddress }}</text>
					</view>
					<view class="flex align-center gengxin">
						时间：<text class="wztext">{{ loglattime }}</text>
					</view>
				</template>
				<template v-else>
					<view class="flex align-center gengxin" style="justify-content: center;">
						点击更新位置
					</view>
				</template>
			</view>
			<!-- <view class="box" v-if="XCXIsSelect != '否'">
				<view class="">
					￥<text class="text-bold text-xl">{{sumMoney}}</text>
					<view>总收益</view>
				</view>
				<view class="">
					<text class="text-bold text-xl">{{countOrderNum}}</text>
					<view>总销量</view>
				</view>
				<view class="">
					<text class="text-bold text-xl">{{countTakingByUserId}}</text>
					<view>用户评价</view>
				</view>
				<view class="">
					<text class="text-bold text-xl">{{countByUserId}}</text>
					<view>访客人数</view>
				</view>
			</view> -->
		</view>
		<view style="margin-top: -156px;padding: 30rpx;">
			<view class="dengjibox">
				<view class="djtit">当前等级</view>
				<view class="djimg" @click="level">{{ currentGrade ? currentGrade : "A0" }}</view>
				<view class="" style="margin-top: 20px;">
					<!-- <text style="font-size: 30px;font-weight: bold;">当前业绩：{{ currentWholeIncome ? currentWholeIncome : 0 }}</text> -->
					<!-- <text style="font-size: 16px;">/{{ totalIncomeRange ? totalIncomeRange : 4000 }}</text> -->
				</view>
				
				<!-- <u-line-progress active-color="#46a396" :show-percent="false" :height="38" inactive-color="#098f7a"
					:percent="lineProgressData" :striped-active="true"></u-line-progress>

				<view v-if="!maxStatus && longUpgradeDescriptionSet.differenceOutstandingAchievement" class="dengji-text">
					还差{{ longUpgradeDescriptionSet.differenceOutstandingAchievement }}业绩;{{ longUpgradeDescriptionSet.differenceIntegral }}积分;可以升级{{ longUpgradeDescriptionSet.differenceGrade }}<u-icon
						style="padding-left: 2px;" size="30" color="#ffffff" name="question-circle-fill"
						@click="clickIcon" index="0"></u-icon>
				</view>
				<view v-if="maxStatus" class=" dengji-text">
					您已达到最高等级
				</view>
				<view>
					<u-popup v-model="showIconPopup" mode="center" border-radius="14" width="90%" height="240rpx"
						closeable>
						<view class="import" style="padding: 0px 10px;">
							<view class="innerPopup">
								<view class="" style="font-size: 18px;font-weight: bold;">
									当前{{ currentGrade }}等级，距离{{ longUpgradeDescriptionSet.differenceGrade }}等级还需:
								</view>
								<view class="innerOfPopup">
									<view class="firstInnerOfPopup">
										{{ longUpgradeDescriptionSet.differenceOutstandingAchievement }}业绩&nbsp;&nbsp;{{ longUpgradeDescriptionSet.differenceIntegral }}积分&nbsp;&nbsp;{{ longUpgradeDescriptionSet.differenceClockRate }}加钟率
									</view>
									<view class="firstInnerOfPopup">
										{{ longUpgradeDescriptionSet.differenceDurationOnline }}小时在线时长&nbsp;&nbsp;
									</view>
								</view>
							</view>
						</view>
					</u-popup>
				</view> -->
				<view class="flex align-center"
					style="justify-content: space-evenly;text-align: center;">
					<view class="" @click="handleYeji">
						<view  style="font-size: 24px;font-weight: bold;">{{ currentWholeIncome ? currentWholeIncome : 0 }}</view>
						<text style="font-size: 14px; ">当前业绩</text>
						<!-- <text style="font-size: 16px;">/{{ totalIncomeRange ? totalIncomeRange : 4000 }}</text> -->
					</view>
					<view class="shuxian"></view>
					<view class="" @click="dangqian">
						<view class="" style="font-size: 24px;font-weight: bold;">
							{{ currentRealIncome ? currentRealIncome : 0 }}
						</view>
						<view class="" style="font-size: 14px;">当期项目收益(元)</view>
					</view>
					<view class="shuxian"></view>
					<view class="" @tap="goNav('/pages/index/currentPoints')">
						<view class="" style="font-size: 24px;font-weight: bold;">{{ currentIntegral ? currentIntegral : 0 }}
						</view>
						<view class="" style="font-size: 14px;" >当期积分</view>
					</view>
				</view>
			</view>
			<view class="csda">
				<view class="flex align-center" style="font-size: 16px;font-weight: bold;color: #fff;margin-top: 8px; margin-left: 15rpx;">
					物料记录
					<image src="../../static/images/index/yiwen.png" style="width: 16px;height: 17px;margin-left: 3px;"
						@tap="viewHelp"></image>

					<!-- 物料包消耗提示 -->
					<view>
						<u-popup v-model="showViewHelp" mode="center" border-radius="20" width="90%" height="240rpx"
							closeable>
							<view class="import" style="padding: 0px 10px;">
								<view class="innerPopup">
									<view class="innerOfPopup">
										<view class="firstInnerOfPopup">
											每次服务会减少物料包数量，当数量少于一定值时将做停牌处理！
										</view>
									</view>
								</view>
							</view>
						</u-popup>
					</view>

					<!-- 物料包弹窗显示全部数据 -->
					<view style="position: relative;">
						<u-popup v-model="showMaterialPackageListStatus" mode="center" border-radius="20" width="90%"
							closeable>
							<view class="import" style="padding: 20px 20px;">
								<!-- 			<view class="materialPackageTitle">
									物料包
								</view> -->
								<view class="innerPopupOfViewmore">
									<view class="importMaterialPackageInner"
										v-for="(item, index) in homeMaterialPackageList" :key="item.id">
										<view class="">
											{{ item.materialName }}
										</view>
										<view class="">
											{{ item.residue }}
										</view>
									</view>
								</view>
							</view>
						</u-popup>
					</view>

					<view v-if="homeMaterialPackageList.length > 3" class="viewMore" @tap="showMoreMaterialPackageList">
						查看更多</view>
				</view>
				<view v-if="formatHomeMaterialPackageList.length > 0" class="flex align-center justify-between zbhsga">
					<view class="importMaterialPackage wuliao" v-for="(item, index) in formatHomeMaterialPackageList"
						:key="item.id">
						<view class="importMaterialPackage">
							<view class="importMaterialPackageInnerBox">
								{{ item.materialName }}
							</view>
							<view class="importMaterialPackageInnerBox">
								{{ item.residue }}
							</view>
						</view>
						<view v-if="index !== formatHomeMaterialPackageList.length - 1" class="xianc"></view>
					</view>
				</view>
				<!-- 兜底接口异常 -->
				<view v-else class="flex align-center justify-between zbhsga">
					<view class="">
						暂无物料包
					</view>
				</view>
			</view>
			<view class="flex align-center justify-between" style="margin-top: 20px;">
				<view :class="activeTab == item.id ? 'tapDsalk' : 'dsalk'" @click="getJqqd(item.id)" v-for="(item,homeIindex) in homePageCountNum" :key="homeIindex">
					<view class="sda flex align-center" v-if="homeIindex==indexImg" v-for="(imgItem,indexImg) in jiazhongIimg" :key="indexImg">
						<image :src="imgItem.url" mode="" style="width: 30px;height: 30px;"></image>
						<!-- <image :src="item.icon" style="width: 20px;height: 20px;"></image> -->
					</view>
					<view class="dqda">{{ item.title }}</view>
					<view class="" :style="{ fontSize: '20px', color: item.color, marginTop: '6px', fontWeight: 'bold' }">
						{{ item.num ? item.num : 0 }}
					</view>
				</view>

				<!-- 		<view class="dsalk">
					<view class="sda flex align-center">
						<image src="../../static/images/index/dd02.png" style="width: 20px;height: 20px;"></image>
					</view>
					<view class="dqda">当期加钟率</view>
					<view class="" style="font-size: 20px;color: #333333;margin-top: 6px;font-weight: bold;">
						{{currentRenewalNum?currentRenewalNum:0}}%
					</view>
				</view> -->
				<!-- 		<view class="dsalk">
					<view class="sda flex align-center">
						<image src="../../static/images/index/dd03.png" style="width: 20px;height: 20px;"></image>
					</view>
					<view class="dqda">当期充值率</view>
					<view class="" style="font-size: 20px;color: #ff6c25;margin-top: 6px;font-weight: bold;">
						{{currentRechargeNum?currentRechargeNum:0}}%
					</view>
				</view> -->
			</view>

			<!-- <view class="box1" @click="goNav('/my/shuju/index')">
				<view class="text-bold text-lg margin-bottom-sm">订单数据</view>
				<view class="orderbox ">
					<view class="text-center">
						￥<text class="text-bold text-xl">{{orderMoney}}</text>
						<view class="margin-top-xs">订单收入</view>
					</view>
					<view class="text-center">
						<text class="text-bold text-xl">{{countOrder}}</text>
						<view class="margin-top-xs">总订单数</view>
					</view>
					<view class="text-center">
						￥<text class="text-bold text-xl">{{sumRefund}}</text>
						<view class="margin-top-xs">退款金额</view>
					</view>
					<view class="text-center">
						<text class="text-bold text-xl">{{countByUserId}}</text>
						<view class="margin-top-xs">访客人数</view>
					</view>
				</view>
			</view> -->
			<!-- <view class="guanlibox"  @click="goDetail(1)" style="color: #FFFFFF; margin-top:30rpx;border-radius: 20rpx 20rpx 0 0; background-color: #FFFFFF;">
				<view class="text-bold text-lg margin-bottom-sm flex justify-between">
					<view>订单管理</view>
				</view>
				<view class="flex">
					<view class="flex align-center  radius" style="width: 33%;">
						<view class="margin-left" style="text-align: center;margin: 0 auto;">
							<view class="margin-top-xs">待服务</view>
							<text class="text-bold text-xl">{{countOrderIng}}</text>
						</view>
					</view>
					<view class="flex align-center  radius "
						style="padding: 10rpx auto;width: 33%;">
						<view class="margin-left" style="text-align: center;margin: 0 auto;">
							<view class="margin-top-xs">进行中</view>
							<text class="text-bold text-xl">{{countOrderAppraise}}</text>
						</view>
					</view>
					<view class="flex align-center radius "
						style="width: 33%;">
						<view class="margin-left" style="text-align: center; margin: 0 auto;">
							<view class="margin-top-xs"style="width: 100%">已完成</view>
							<text class="text-bold text-xl">{{countOrderEnd}}</text>
						</view>
					</view>
				</view>
			</view> -->
			<!-- <view  class="guanlibox2" style="border-radius: 0 0 20rpx 20rpx; background-color: #FFFFFF;">
				<view class="text-bold text-lg margin-bottom-sm flex justify-between">
					<view style="color: #FFFFFF;">订单数据</view>
				</view>
				<view class="flex" style="color: #FFFFFF;">
					<view class="flex align-center" style="width: 33%;">
						<view class="margin-left" style="text-align: center;margin: 0 auto;">
							<view class="margin-top-xs" >订单收入</view>
							<text class="text-bold text-xl" >{{orderMoney}}</text>
						</view>
					</view>
					<view class="flex align-center"
						style="padding: 10rpx auto;width: 33%;">
						<view class="margin-left" style="text-align: center;margin: 0 auto;">
							<view class="margin-top-xs">总订单数</view>
							<text class="text-bold text-xl">{{countOrder}}</text>
						</view>
					</view>
					<view class="flex align-center"
						style="padding: 10rpx auto;width: 33%;">
						<view class="margin-left" style="text-align: center;margin: 0 auto;">
							<view class="margin-top-xs">退款金额</view>
							<text class="text-bold text-xl">{{sumRefund}}</text>
						</view>
					</view>
				</view>
			</view> -->
			<view class="flex align-center justify-between butween-list" style="margin-top: 20px;" v-if="XCXIsSelect != '否'">
				<view class="text-center" @click="goNavs('/pages/my/mangshi')">
					<image src="../../static/index/order_5.png" style="width: 70rpx;height: 70rpx;"></image>
					<view class="tongji-text">忙时设置</view>
				</view>
				<view class="text-center" @click="goNav('/my/shuju/index')">
					<image src="../../static/index/order_4.png" style="width: 70rpx;height: 70rpx;"></image>
					<view class="tongji-text">数据统计</view>
				</view>
				<view class="text-center" @click="goNav('/my/commission/index')">
					<image src="../../static/index/order_3.png" style="width: 70rpx;height: 70rpx;"></image>
					<view class="tongji-text">分成明细</view>
				</view>
				<view class="text-center" @click="goNav('/my/fund/index')">
					<image src="../../static/index/order_2.png" style="width: 70rpx;height: 70rpx; "></image>
					<view class="tongji-text">资金明细</view>
				</view>
				<view class="text-center" @click="goNavs('/pages/index/jinji')">
					<image src="../../static/index/order_1.png" style="width: 70rpx;height: 70rpx;"></image>
					<view class="tongji-text">紧急报警</view>
				</view>
				<!-- <view class="text-center" @click="goNav('/my/dashang/index')">
					<image src="../../static/index/order_9.png" style="width: 70rpx;height: 70rpx;"></image>
					<view class="tongji-text">打赏明细</view>
				</view> -->
			</view>
			<!-- <view class="flex justify-between margin-top" style="border: 1rpx solid #cccccc;background-color: #e1f5ea; border-radius: 20rpx;">
				<view class="guanlibox" @click="goDetail(1)">
					<view class="text-bold text-lg margin-bottom-sm flex justify-between">
						<view>订单管理</view>
						<view>
							<image src="../../static/images/back.png" style="width: 12upx;height: 20upx;"></image>
						</view>
					</view>
					<view class="flex align-center  radius" style="background: #E8F9EF;padding: 10rpx 20rpx;">
						<image src="../../static/images/index/order1.png"
							style="width: 72rpx;height: 72rpx;border-radius: 50%;">
						</image>
						<view class="margin-left">
							<view class="margin-top-xs">待服务</view>
							<text class="text-bold text-xl">{{countOrderIng}}</text>
						</view>
					</view>
					<view class="flex align-center  radius margin-top-sm"
						style="background: #EFF3FF;padding: 10rpx 20rpx;">
						<image src="../../static/images/index/order2.png"
							style="width: 72rpx;height: 72rpx;border-radius: 50%;">
						</image>
						<view class="margin-left">
							<view class="margin-top-xs">进行中</view>
							<text class="text-bold text-xl">{{countOrderAppraise}}</text>
						</view>
					</view>
					<view class="flex align-center  radius margin-top-sm"
						style="background: #FEF8E8;padding: 10rpx 20rpx;">
						<image src="../../static/images/index/order3.png"
							style="width: 72rpx;height: 72rpx;border-radius: 50%;">
						</image>
						<view class="margin-left">
							<view class="margin-top-xs">已完成</view>
							<text class="text-bold text-xl">{{countOrderEnd}}</text>
						</view>
					</view>
				</view>
				<view style="border: 0.5rpx solid #EEEEEE;"></view>
				<view class="guanlibox2" @click="goNav('/my/shuju/index')">
					<view class="text-bold text-lg margin-bottom-sm flex justify-between">
						<view>订单数据</view>
						<view>
							<image src="../../static/images/back.png" style="width: 12upx;height: 20upx;"></image>
						</view>
					</view>
					<view class="flex align-center  radius" style="background: #E8F9EF;padding: 10rpx 20rpx;">
						<image src="../../static/images/index/order4.png"
							style="width: 72rpx;height: 72rpx;border-radius: 50%;">
						</image>
						<view class="margin-left">
							<view class="margin-top-xs">订单收入</view>
							<text class="text-bold text-xl">{{orderMoney}}</text>
						</view>
					</view>
					<view class="flex align-center  radius margin-top-sm"
						style="background: #EFF3FF;padding: 10rpx 20rpx;">
						<image src="../../static/images/index/order5.png"
							style="width: 72rpx;height: 72rpx;border-radius: 50%;">
						</image>
						<view class="margin-left">
							<view class="margin-top-xs">总订单数</view>
							<text class="text-bold text-xl">{{countOrder}}</text>
						</view>
					</view>
					<view class="flex align-center  radius margin-top-sm"
						style="background: #FEF8E8;padding: 10rpx 20rpx;">
						<image src="../../static/images/index/order6.png"
							style="width: 72rpx;height: 72rpx;border-radius: 50%;">
						</image>
						<view class="margin-left">
							<view class="margin-top-xs">退款金额</view>
							<text class="text-bold text-xl">{{sumRefund}}</text>
						</view>
					</view>

				</view>
			</view> -->

			<view style="margin-top: 45rpx;" v-if="goods.length > 0">
				<view class="text-bold text-lg" style="border-bottom: 5rpx solid #2FB57A;">
					<text style="border-radius: 10rpx 10rpx 0 0; background: linear-gradient(90deg, #019C88, #28BA92, #35C495);padding: 15rpx 15rpx 5rpx 15rpx;color: white;">
						今日服务
					</text>
				</view>
				<mescroll-body :sticky="true" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
					style="padding: 0 px;width: 100%;min-height: 100vh; background: #f5f5f5; margin-top: 12px;">
					<view class="bgwhite radius margin-top-sm padding-bottom-sm"
						:style="{ backgroundColor: item.status == 2 ? '#f6fcfa' : '', border: item.status == 2 ? '2px solid rgb(207, 237, 225)' : '' }"
						v-for="(item, index) in goods" :key='index' @click="goNav('/my/order/revenueDetails?ordersId=' + item.ordersId)">
						
						<view class="xian" v-if="item.status == 6"></view>
						<view class="pintuan_syrs flex justify-between" v-if="item.status == 6">
							<view class="pintuan-title" >
								<image src="../../static/clock.png" class="pintuan-img"></image>
								<span class="pintuan-text">服务倒计时</span>
							</view>
							<!-- <uni-countdown ref="countDownEl" :title="'剩余'" :fontSize="'14'" :showDay="false"
								:hour="item.endTime.hour" :minute="item.endTime.minute" :second="item.endTime.second"
								color="#20C675">
							</uni-countdown> -->
							<u-count-down :timestamp="item.endOfServiceTimer" separator-color="#20C675" color="#20C675"
								font-size="30" separator-size="30"></u-count-down>
						</view>
						
						<view class="flex justify-between padding-sm ">
							<view class="progress-text">
								<text class="title-font text-bold">预约时间：</text>
								<text class="title-font">{{ item.serveTime }}</text>
							</view>
							<view class="progress-status" v-if="item.status == 1">待付款</view>
							<view class="progress-status" v-if="item.status == 2">待服务</view>
							<view class="progress-status" v-if="item.status == 5">已完成</view>
							<view class="progress-status" v-if="item.status == 6">进行中</view>
							<view class="progress-status" v-if="item.status == 7">已出发</view>
							<view class="progress-status" v-if="item.status == 8">已到达</view>
							<view class="progress-status" v-if="item.status == 3">待评价</view>
							<view class="progress-status" v-if="item.status == 4" style="color: #666666;">已取消</view>
							<view class="progress-status" v-if="item.status == 9&&!item.refusalContent">待确认</view>
							<view class="progress-status" v-if="item.status == 9&&item.refusalContent">拒单审核中</view>
							<view class="progress-status" v-if="item.status == 10" >待补单</view>
							<view v-if="item.overTimeOrders == 1" class="progress-status-chaoshi">[超时]</view>
							<!-- <view class="text-green" v-if="item.state ==1 ||item.state ==2">待完成</view>
							<view class="text-green" v-if="item.state ==3||item.state ==4">已完成</view> -->
						</view>
						<view class=" u-flex u-p-t-30 padding-sm">
							<view class="u-m-r-10">
								<u-avatar :src="item.massageImg ? item.massageImg : '../../static/logo.png'" mode="square"
									size="160">
								</u-avatar>
							</view>
							<view class="u-flex-1  margin-left-xs">
								<view class="u-font-18  text-bold u-line-1">
									<view class="value-font">
										{{item.title}}
									</view>
								</view>
								<view class="title-font" style="margin-top: 8px;">{{ item.address }}</view>
							</view>
						</view>
						<view class="flex justify-between align-center padding-sm">
							<view class="flex-sub">
								<text class="title-font">实收：</text>
								<text class="value-font text-bold" style="color: #FF1200;">￥{{ item.artificerMoneyTotal }}</text>
							</view>
							<view class="flex title-font2">
								【{{ item.ordersNo }}】
								<!-- <u-button v-if="item.status == 1" :custom-style="customStyle" shape="circle" :plain="true"
									@click="cancelOrder(item)">取消订单</u-button> -->
								<u-button v-if="item.status == 1" :custom-style="customStyle1" shape="circle" :plain="true"
									@click="bindphone(item.phone)">联系TA</u-button>
								<u-button v-if="item.state == 1" :custom-style="customStyle1" shape="circle" :plain="true"
									@click="goNav('/my/order/pay?id=' + item.ordersId + '&isTrue=1')">查看详情</u-button>
								<!-- 							<u-button v-if="item.status == 6" :custom-style="customStyle" shape="circle" :plain="true"
									@click="cancel(item)">订单完成</u-button> -->
							</view>
						</view>
					</view>
				</mescroll-body>
			</view>
			<uni-popup ref="popup" type="center">
				<view style="background: #fff;width:658upx;height: 960upx; border-radius:17upx;position: relative;">
					<image :src="Guanggao" style="width: 100%;height: 100%;" mode="aspectFill"
						@tap="saveImgs(Guanggao)">
					</image>
				</view>
			</uni-popup>
		</view>
	</view>
</template>

<script>
import MescrollMixin from "@/components/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import mescrollBody from "@/components/mescroll-uni/components/mescroll-body/mescroll-body.vue";
import empty from '@/components/empty.vue'
import * as websocketUtils from 'utils/websocketUtils.js';
export default {
	mixins: [MescrollMixin], // 使用mixin
	components: {
		mescrollBody,
		empty
	},
	data() {
		return {
			technicianType:'',
			jiazhongIimg:[
				{url:'../../static/index/order_8.png',id:0},
				{url:'../../static/index/order_7.png',id:1},
				{url:'../../static/index/order_6.png',id:3}
			],
			Guanggao: '',
			ssDW: false,
			stateName: '休息中',
			avatar: '../../static/logo.png',
			isLogin: false,
			userName: '',
			renzheng: 0,
			num: 1,
			goods: [],
			sumMoney: 0, //总收益
			countOrderNum: 0, //总销量
			countTakingByUserId: 0, //用户评价数
			orderMoney: 0, //订单收入
			countOrder: 0, //总订单数
			sumRefund: 0, //退款金额
			countByUserId: 0, //访客人数
			countOrderIng: 0, //待接单
			countOrderAppraise: 0, //待完成
			countOrderEnd: 0, //已完成
			putaway: 0, //上架中
			soldOut: 0, //下架中
			page: 1,
			limit: 10,
			longitude: '',
			latitude: '',
			isTrue: true,
			showModal: true,
			userId: '',
			arr: [],
			city: '',
			invitationCode: '',
			isCashDeposit: 0,
			loglattime: '',
			loglataddress: '',
			isJsjdsfxywl:false,//技师接单是否需要物料
			switchList: [{
				title: '在线',
				value: true
			}, {
				title: '离线',
				value: false
			}],
			customStyle: {
				color: '#999999',
				border: '2rpx solid #999999',
				// backgroundColor: '#1E1F31',
				border: "8rpx",
				width: '180rpx',
				height: '54rpx',
				margin: "0 0 0 20rpx"
			},
			customStyle1: {
				color: '#2FB57A',
				border: '2rpx solid #2FB57A',
				border: "8rpx",
				width: '180rpx',
				height: '54rpx',
				margin: "0 0 0 20rpx"
			},
			XCXIsSelect: '否',
			time: '',
			currentWholeIncome: null, //App首页当期总收益
			totalIncomeRange: null, //App首页当前阶段收益总数
			currentRealIncome: null, //App首页当期实际收益（已扣除各项）
			currentIntegral: null, //App首页当期积分
			currentOrdersNum: null, //App首页当期订单数量
			currentRenewalNum: null, //App首页当期加钟率
			currentRechargeNum: null, //App首页当期充值率
			upgradeDescriptionStatus: false, // App首页升级描述
			currentGrade: null, //App首页当前等级
			lineProgressData: 0,
			homePageCountNum: [{
				id: 1,
				title: "当期订单",
				icon: "../../static/images/index/dd01.png",
				color: "#2FB57A",
				num: 0,
			},
			{
				id: 2,
				title: "当期加钟率",
				icon: "../../static/images/index/dd02.png",
				color: "#333333",
				num: 0,
			},
			{
				id: 3,
				title: "当期充值率",
				icon: "../../static/images/index/dd03.png",
				color: "#ff6c25",
				num: 0,
			}
			],
			activeTab: null,
			endOfServiceTimer: null,
			changedecscription: false,
			longUpgradeDescriptionSet: {},
			showIconPopup: false,
			maxStatus: null,
			homeMaterialPackageList: [],
			formatHomeMaterialPackageList: [],
			currentPage: null,
			pageSize: null,
			showViewHelp: false,
			showMaterialPackageListStatus: false,
			shouyiMoeny:'',
			homePageCountNumTwo:'',
			homePageCountNumOme:''
		}
	},
	onShareAppMessage(res) { //发送给朋友
		return {
			title: this.tuiguang,
			path: '/pages/index/index?invitation=' + this.invitationCode,
			imageUrl: this.tuiguangImg,
		}
	},
	onShareTimeline(res) { //分享到朋友圈
		return {
			title: this.tuiguang,
			path: '/pages/index/index?invitation=' + this.invitationCode,
			imageUrl: this.tuiguangImg,
		}
	},
	mounted() {
		uni.$on("exitLoginStatus", (status) => {
			clearInterval(this.time);
		})
	},
	onLoad(e) {
		//获取App首页数据
		this.getHomeListData();
		this.userId = uni.getStorageSync('userId');
		console.log("ueser========",this.userId)
		// 获取邀请码保存到本地
		if (e.invitation) {
			this.$queue.setData('inviterCode', e.invitation);
		}
		// #ifdef MP-WEIXIN
		if (e.scene) {
			const scene = decodeURIComponent(e.scene);
			this.$queue.setData('inviterCode', scene.split(',')[0]);
		}
		// #endif
		this.$Request.getT('/app/common/type/247').then(res => { //下单成功
			if (res.code == 0) {
				if (res.data && res.data.value) {
					this.arr.push(res.data.value)
				}
			}
		})
		this.$Request.getT('/app/common/type/249').then(res => { //用户完成成功
			if (res.code == 0) {
				if (res.data && res.data.value) {
					this.arr.push(res.data.value)
				}
			}
		})
		this.$Request.getT('/app/common/type/309').then(res => { //用户完成成功
			if (res.code == 0) {
				if (res.data && res.data.value) {
					this.arr.push(res.data.value)
				}
			}
		})

		// 理疗师端首页是否弹框 380
		this.$Request.get('/app/common/type/380').then(res => {
			if (res.code == 0 && res.data.value && res.data.value === '是') {
				this.$Request.get('/app/common/type/379').then(res => {
					if (res.code == 0 && res.data && res.data.value) {
						this.Guanggao = res.data.value;
						this.$refs.popup.open();
					}
				});
			}
		});
		// this.getcity()
		
	},
	onShow() {
		this.getHomeListData();
		this.getHomeMaterialPackageList();
		//是否开启理疗师端实时定位	330
		this.$Request.get('/app/common/type/330').then(res => {
			if (res.code == 0 && res.data) {
				if (res.data.value != '是') {
					this.ssDW = true;
				} else {
					this.ssDW = false;
				}
			}
		});

		// 理疗师端首页是否弹框 380
		this.$Request.get('/app/common/type/448').then(res => {
			this.isJsjdsfxywl = res.data.value;
		});
		this.$Request.get('/app/common/type/238').then(res => {
			if (res.code == 0) {
				// #ifdef MP-WEIXIN
				this.$queue.setData('XCXIsSelect', res.data.value);
				// #endif
				// #ifndef MP-WEIXIN
				this.$queue.setData('XCXIsSelect', '是');
				// #endif
				this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
			}
		});
		// this.userId = uni.getStorageSync('userId')
		this.userId = this.$queue.getData("userId")
		
			console.log('this.userId------------->',this.userId);
		this.isCashDeposit = uni.getStorageSync('isCashDeposit')
		if (this.userId) {
			console.log(this.userId, "dwdwadwdawd============>");
			this.isLogin = true
			this.getJinRiOrder();
			this.getUserInfo()
			this.getFb()

			this.getArtificer()

			this.getNewOrder()


			// #ifdef MP-WEIXIN
			//订阅
			if (this.showModal) {
				this.openMsg()
			}
			// #endif
			let that = this
			if (that.time) clearInterval(that.time);
			if (this.isLogin) {
				that.time = setInterval(function () {
					that.getNewOrder()
					console.log(that.time);
				}, 10000)
			}
		} else {
			console.log(this.userId,"false============>");
			this.isLogin = false
			this.userName = ''
			this.browse = 0
			this.fans = 0
			this.follow = 0
			this.visitor = 0
			this.avatar = '../../static/logo.png'
			clearInterval(this.time);
		}
		// if (this.isLogin) this.getJinRiOrder();
		this.getcity()
	},
	destroyed() {
		clearInterval(this.time);
	},
	watch: {
		isTrue(newValue) {
			// debugger;
			if (newValue) {
				this.$queue.showToast('您已上线');
				// debugger;
				uni.$emit("onlineStatus", 1);
			} else {
				// debugger;
				this.$queue.showToast('您已离线');
				uni.$emit("onlineStatus", 2);
			}
		},
		isLogin(newValue) {
			if (!newValue) {
				this.currentWholeIncome = null;
				this.upgradeDescriptionStatus = null;
				this.currentRealIncome = null;
				this.lineProgressData = 0;
				this.currentGrade = "A0";
				this.totalIncomeRange = 4000;
				this.currentIntegral = null;
				this.homePageCountNum[0].num = 0;
				this.homePageCountNum[1].num = 0;
				this.homePageCountNum[2].num = 0;
				this.goods = [];
			}
		}
	},
	methods: {
		level(){//跳往 技师等级
			uni.navigateTo({
				url:'/pages/index/technicianLevel'
			})
		},
		dangqian(){//跳往当前收益
			uni.navigateTo({
				url:'/pages/index/currentIncome'
			})
		},
		handleYeji(){//跳往业绩页面
			uni.navigateTo({
				url:'/pages/index/currentYeji'
			})
		},
		showMoreMaterialPackageList() {
			this.showMaterialPackageListStatus = true;
		},
		viewHelp() {
			this.showViewHelp = true;
		},
		// 获取APP端首页物料记录数据
		getHomeMaterialPackageList() {
			let artificerId = uni.getStorageSync("artificerId");
			if(artificerId){
				this.$Request.getXZX("/app/material/selectMaterialArtificer?artificerId=" + artificerId + "&page=" + (this
					.currentPage ? this
					.currentPage : '') + "&limit=" + (this.pageSize ? this.pageSize : '')).then((res) => {
						if (res && res.data && res.code === 0) {
							this.formatHomeMaterialPackageList = res?.data.slice(0, 3);
							// this.formatHomeMaterialPackageList = [];
							this.homeMaterialPackageList = res.data;
							
							
							console.log('this.homeMaterialPackageList------>>',this.homeMaterialPackageList);
							console.log('this.formatHomeMaterialPackageList------>>',this.formatHomeMaterialPackageList);
							
						}
					})
			}
			
		},
		clickIcon(index) {
			console.log(index);
			if (index) this.showIconPopup = true;
		},
		getJqqd(id) {
			if(id!='1'){
				this.$queue.setData("homePageCountNumOne",[this.homePageCountNumOne,this.homePageCountNumTwo])
				uni.navigateTo({
					url:'/pages/index/addClock?type='+id
				})
			}else{
				uni.navigateTo({
					url:'/pages/index/currentIncome?type='+id+'&shouyiMoeny='+this.shouyiMoeny
				})
			}
			
			// this.$queue.showToast('敬请期待！')
			// 如果需要当期订单/当期加钟率/当期充值率点击样式时解开注释即可
			// if (id !== undefined) this.activeTab = id;
		},
		//获取App首页数据
		getHomeListData() {
			let artificerId = uni.getStorageSync("artificerId");
			
			console.log('artificerId------->',artificerId);
			if (artificerId) {
				this.$Request.getXZX("/app/artificer/integral/home/?artificerId=" + artificerId,).then((res) => {
					if (res && res.data) {
						console.log(res, "dwdw00of");
						this.shouyiMoeny=res?.data?.currentMonthsIncome
						
						this.homePageCountNum[0].num = res?.data?.currentPeriodOrdersSum;
						
						let formathomePageCountNum = (res?.data?.currentPeriodAddBellsSum * 1) * 100;
						this.homePageCountNum[1].num = Math.ceil(formathomePageCountNum) + "%";
						this.homePageCountNumOne=this.homePageCountNum[1].num;
						
						let currentPeriodRechargeSum = ((res?.data?.currentPeriodRechargeSum * 1) * 100);
						this.homePageCountNum[2].num = Math.ceil(currentPeriodRechargeSum) + "%";
						this.homePageCountNumTwo=this.homePageCountNum[2].num;
						
						this.currentWholeIncome = Math.ceil(res?.data?.currentPerformance);
						this.currentRealIncome = res?.data?.earnings;
						this.currentIntegral = res?.data?.integral;
						this.maxStatus = res?.data.maxStatus;
						this.currentRechargeNum = Math.ceil(res?.data?.currentPeriodRechargeSum);
						this.longUpgradeDescriptionSet = {
							differenceOutstandingAchievement: res?.data?.differenceOutstandingAchievement,
							differenceIntegral: res?.data?.differenceIntegral,
							differenceClockRate: res?.data?.differenceClockRate + "%",
							differenceDurationOnline: res?.data?.differenceDurationOnline,
							currentLevel: res?.data?.currentLevel,
							differenceGrade: res?.data?.differenceGrade,
						};
						this.upgradeDescriptionStatus = res?.data?.newUltimately;
						this.currentGrade = res?.data?.grade;
						uni.setStorageSync("currentRealIncome", res?.data?.earnings);
						this.totalIncomeRange = res?.data?.suffix;
						// if (this.currentWholeIncome < 4000) {
						// 	this.totalIncomeRange = 4000;
						// } else if (this.currentWholeIncome < 6000 && this.currentWholeIncome > 4000) {
						// 	this.totalIncomeRange = 6000;
						// } else if (this.currentWholeIncome < 8000 && this.currentWholeIncome > 6000) {
						// 	this.totalIncomeRange = 8000;
						// } else if (this.currentWholeIncome < 10000 && this.currentWholeIncome > 8000) {
						// 	this.totalIncomeRange = 10000;
						// } else {
						// 	this.totalIncomeRange = 4000;
						// }
						// this.currentWholeIncome = 2000;
						this.lineProgressData = this.currentWholeIncome / this.totalIncomeRange * 100;
					}
				})
			}
		},
		jumpIntegralStatistics() {
			uni.navigateTo({
				url: ""
			})
		},
		
		getNewOrder() {
			let data = {
				page: 1,
				limit: 100,
				state: 51
			}
			this.$Request.getT('/app/message/selectMessageByUserIds', data).then(res => {
				if (res.code == 0) {
					if (res.data.totalCount > 0) {
						this.aplayAudios()
					}
				} else {
					this.$queue.showToast(res.msg);
				}
			});
		},
		// 新订单语音播放
		aplayAudios() {
			console.log('语音提示')

			// uni.getPushClientId({
			// 	success: (res) => {
			// 		console.log(res, "success");
			// 	},
			// 	fail(err) {
			// 		console.log(err, "fail")
			// 	}
			// })
			uni.onPushMessage((res) => {
				console.log(res, "监听推送");
			})
			uni.createPushMessage({
				title: "盛安到家",
				content: "你有新的订单，请注意查收！",
				sound: "system",
				success: (res) => {
					console.log(res, "进来咯额");
				},
				fail: (err) => {
					console.log(err, "错误了");
				},
				complete: (msg) => {
					console.log("complete");
				}
			})
			//自定义通知铃声暂不配置
			// const plugin = uni.requireNativePlugin("DCloud-PushSound");
			// plugin.setCustomPushChannel({
			// 	soundName: "pushsound",
			// 	channelId: "test",
			// 	channelDesc: "test渠道描述",
			// 	enableVibration: true,
			// 	importance: 3,
			// 	lockscreenVisibility: 0,
			// });
			// plugin.getAllChannels((p) => {
			// 	console.log("channels :" + JSON.stringify(p)); //返回数组
			// })
			// var info = plus.push.getClientInfo();
			//盛安到家app新订单提示音
			const innerAudioContext = uni.createInnerAudioContext();
			innerAudioContext.autoplay = true;
			innerAudioContext.src =
				'https://pw.xianmxkj.com/file/uploadPath/2022/03/15/c096db4257ecc2547814d4f51c6518bd.mp3';
			innerAudioContext.onPlay(() => {
				console.log('开始播放');
			});
			innerAudioContext.onError((res) => {
				console.log(res.errMsg);
				console.log(res.errCode);
			});
		},
		saveImgs(imgs) {
			let imgArr = [];
			imgArr.push(imgs);
			// //预览图片
			uni.previewImage({
				urls: imgArr,
				current: 0
			});
		},
		stateSave() {
			let materialPackageCountFlag = this.homeMaterialPackageList.some((item) => item.residue <= item.materialMinimum);
			console.log(this.isTrue,materialPackageCountFlag,this.isJsjdsfxywl);
			if (!this.isTrue && materialPackageCountFlag && this.isJsjdsfxywl == '是') {
				this.$queue.showToast("当前剩余物料包数量不足，请检查");
				return;
			}
			this.$Request.postT('/app/artificer/updateArtificer').then(res => {
				if (res.code == 0) {
					this.getArtificer();
					this.$queue.showToast('切换成功！')
				} else {
					this.$queue.showToast(res.msg);
				}
			});
		},
		// 取消订单
		cancelOrder(e) {
			let that = this
			uni.showModal({
				title: '提示',
				content: '确认取消并删除订单？',
				success: function (res) {
					if (res.confirm) {
						let data = {
							ordersId: e.ordersId,
						}
						that.$queue.showLoading('提交中...')
						that.$Request.post('/app/artificer/deleteOrders', data).then(res => {
							uni.hideLoading();
							if (res.code == 0) {
								that.getJinRiOrder();
							} else {
								that.$queue.showToast(res.msg);
							}
						})
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
			});
		},
		// 完成订单
		cancel(e) {
			let that = this
			console.log(that.longitude, that.latitude, "测试首页经纬度");
			return;
			uni.showModal({
				title: '提示',
				content: '如果服务未完成点击完成订单会遭到平台违规处理，请确认服务是否完毕?',
				success: function (res) {
					if (res.confirm) {
						let data = {
							ordersId: e.ordersId,
							accomplishLongitude: that.longitude,
							accomplishLatitude: that.latitude
						}
						that.$queue.showLoading('提交中...')
						that.$Request.post('/app/artificer/accomplishOrders', data).then(res => {
							uni.hideLoading();
							if (res.code == 0) {
								that.getJinRiOrder();
								websocketUtils.uploadAudioEnd(); //关闭音频上传
							} else {
								that.$queue.showToast(res.msg);
							}
						})
					} else if (res.cancel) {
						console.log('用户点击取消');
					}
				}
			});
		},
		timeFormat(param) {
			return param < 10 ? '0' + param : param;
		},
		getJinRiOrder() {
			let data = {
				type: 1,
				page: 1,
				limit: 10,
				startTime: '',
				endTime: ''
			}
			this.$Request.getT('/app/artificer/selectTodayOrder', data).then(res => {
				this.goods = [];
				if (res.code == 0) {
					res.data.list.forEach(d => {
						if (d.status == 6 && d.endTime) {
							let afterTimeStamp = new Date(d.endTime).getTime() / 1000;
							let currentTimeStamp = new Date().getTime() / 1000;
							let formatTimeStamp = Math.floor(afterTimeStamp - currentTimeStamp);
							console.log(currentTimeStamp,"currentTimeStamp=======？");
							d.endOfServiceTimer = formatTimeStamp;
							
						}
						this.goods.push(d);
					});
				}
			})
		},
		getcity() {
			let that = this
			console.log("---------------------------");
			uni.getLocation({
				type: 'wgs84',
				isHighAccuracy: true,
				success: function (res) {
					console.log('当前位置的经度：' + res.longitude);
					console.log('当前位置的纬度：' + res.latitude);
					that.latitude = res.latitude
					that.longitude = res.longitude
					that.getcitys()
				},
				fail() {
					console.log("-------失败");
				}
			});
		},
		getcitys() {
			this.$Request.get('/app/Login/selectCity?lat=' + this.latitude + '&lng=' + this.longitude).then(res => {
				if (res.code == 0) {
					this.city = res.data.city ? res.data.city : '未知'
					// uni.setStorageSync('city', res.data.city)
					// let data = {
					// 	num: 1,
					// 	size: 10
					// }
					// this.getData(data)
				}
			});
		},
		//上线开关
		bindopen() {
			let bzjCheck = this.$queue.getData("bzjCheck");
			if (this.isCashDeposit == 0 && bzjCheck != '否') {
				uni.showModal({
					title: '提示',
					content: '请先去缴纳保证金',
					success: function (res) {
						if (res.confirm) {
							uni.navigateTo({
								url: '/my/publish/money'
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			} else {
				let data = {
					longitude: this.longitude,
					latitude: this.latitude,
					// status: this.status,
					city: this.city
				}
				this.$Request.post("/app/artificer/updateArtificer", data).then(res => {
					if (res.code == 0) {
						this.getArtificer()
						this.getUserInfo()
					} else {
						// uni.showToast({
						// 	title: res.msg,
						// 	icon: 'none'
						// })
						uni.showModal({
							title: '提示',
							content: res.msg,
							success: function (res) {
								if (res.confirm) {
									uni.navigateTo({
										url: '/my/publish/money'
									})
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
					}
				})
			}

		},
		//获取理疗师的信息
		getArtificer() {
			this.$Request.getT("/app/artificer/selectArtificer").then(res => {
				if (res.code == 0) {
					// uni.setStorageSync("status", res.data.status)
					this.technicianType=res.data.technicianType
					if (res.data) {
						if (res.data.status == 1) {
							this.isTrue = true
						} else if (res.data.status == 2) {
							this.isTrue = false
							this.$queue.setData("onlineStatus", 2);
						}
					} else {
						this.isTrue = false
					}
					websocketUtils.changeGoLiveFn(this.isTrue);
					uni.setStorageSync('artificerId', res.data?.artificerId)
				}
			});
		},
		//获取用户发布
		getFb() {

			this.$Request.get("/app/artificer/selectArtificerIndex").then(res => {
				if (res.code == 0) {
					this.sumMoney = res.data.sumMoney //总收益
					this.putaway = res.data.putaway //上架中
					this.soldOut = res.data.soldOut //下架中
					this.countOrderNum = res.data.countOrderNum //总销量
					this.countTakingByUserId = res.data.countTakingByUserId //用户评价
					this.orderMoney = res.data.orderMoney //订单收入
					this.countOrder = res.data.countOrder //总订单数
					this.sumRefund = res.data.sumRefund //退款金额
					this.countByUserId = res.data.countByUserId //访客人数
					this.countOrderIng = res.data.countOrderIng //进行中
					this.countOrderEnd = res.data.countOrderEnd //已完成
					this.countOrderAppraise = res.data.countOrderJin //进行中
				}
			})
		},

		goDetail(index) {
			if (index == 1) {
				uni.switchTab({
					url: '/pages/order/index'
				})
			}
			if (index == 2) {
				uni.navigateTo({
					url: '/my/publish/index'
				})
			}
		},
		bindFb() {
			let userId = uni.getStorageSync('userId')
			let renzheng = uni.getStorageSync('renzheng')
			if (userId) {
				if (renzheng == 2) {
					uni.navigateTo({
						url: '/my/publish/index'
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '您还未实名认证,请先认证',
						success: function (res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/my/renzheng/index'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}

			} else {
				uni.showModal({
					title: '提示',
					content: '您还未登录,请先登录',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.navigateTo({
								url: '/pages/public/login'
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			}
		},
		goNavs(e, name) {
			console.log(e)
			if (this.userId) {
				let renzheng = uni.getStorageSync('renzheng')
				if (renzheng == 2) {
					let bzjCheck = this.$queue.getData("bzjCheck");
					if (bzjCheck != '否') {
						if (this.isCashDeposit == 0) {
							uni.showModal({
								title: '提示',
								content: '请先去缴纳保证金',
								success: function (res) {
									if (res.confirm) {
										uni.navigateTo({
											url: '/my/publish/money'
										})
									} else if (res.cancel) {
										console.log('用户点击取消');
									}
								}
							});
						} else {
							uni.navigateTo({
								url: e,
							})
						}
					} else {
						uni.navigateTo({
							url: e,
						})
					}
				} else {
					uni.showModal({
						title: '提示',
						content: '您还未实名认证,请先认证',
						success: function (res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/my/renzheng/rzType'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}
			} else {
				uni.showModal({
					title: '提示',
					content: '您还未登录,请先登录',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.navigateTo({
								url: '/pages/public/login'
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			}
		},
		goNav(e, name) {
			console.log(e)
			if (this.userId) {
				uni.navigateTo({
					url: e
				})
			} else {
				uni.showModal({
					title: '提示',
					content: '您还未登录,请先登录',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.navigateTo({
								url: '/pages/public/login'
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			}
		},
		getUserInfo() {
			this.$Request.get("/app/user/selectUserById").then(res => {
				if (res.code == 0) {
					this.userName = res.data.userName
					this.invitationCode = res.data.invitationCode
					this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
					this.isAuthentication = res.data.isAuthentication
					this.isCashDeposit = res.data.isCashDeposit
					this.loglattime = res.data.loglattime
					this.loglataddress = res.data.loglataddress
					uni.setStorageSync('avatar', res.data.avatar)
					uni.setStorageSync('userName', res.data.userName)
					uni.setStorageSync('invitationCode', res.data.invitationCode)
					// uni.setStorageSync('zhiFuBao', res.data.zhiFuBao)
					// uni.setStorageSync('zhiFuBaoName', res.data.zhiFuBaoName)

					if (res.data.isAuthentication == 0 || res.data.isAuthentication == null) {
						this.renzheng = 0
						uni.setStorageSync("renzheng", this.renzheng)
					} else if (res.data.isAuthentication == 1) {
						this.renzheng = 1
						uni.setStorageSync("renzheng", this.renzheng)
					} else if (res.data.isAuthentication == 2) {
						this.renzheng = 2
						uni.setStorageSync("renzheng", this.renzheng)
					} else if (res.data.isAuthentication == 3) {
						this.renzheng = 3
						uni.setStorageSync("renzheng", this.renzheng)
					} else if (res.data.isAuthentication == 4) {
						this.renzheng = 4
						uni.setStorageSync("renzheng", this.renzheng)
					} else if (res.data.isAuthentication == 5) {
						this.renzheng = 5
						uni.setStorageSync("renzheng", this.renzheng)
					} else if (res.data.isAuthentication == 6) {
						this.renzheng = 6
						uni.setStorageSync("renzheng", this.renzheng)
					}

				}
			});
		},
		goLogin(e) {
			uni.navigateTo({
				url: e
			})
		},
		// 开启订阅消息
		openMsg() {
			console.log('订阅消息')
			var that = this
			uni.getSetting({
				withSubscriptions: true, //是否获取用户订阅消息的订阅状态，默认false不返回
				success(ret) {
					console.log(ret.subscriptionsSetting, '------------------')
					// if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
					if (ret.subscriptionsSetting.itemSettings) {
						uni.setStorageSync('sendMsg', true)
						uni.openSetting({ // 打开设置页 
							success(rea) {
								console.log(rea.authSetting)
							}
						});
					} else { // 用户没有点击“总是保持以上，不再询问”则每次都会调起订阅消息
						console.log(99999)
						uni.setStorageSync('sendMsg', false)
						uni.showModal({
							title: '提示',
							content: '为了更好的体验,请绑定消息推送',
							confirmText: '确定',
							cancelText: '取消',
							success: function (res) {
								if (res.confirm) {
									wx.requestSubscribeMessage({
										tmplIds: that.arr,
										success(re) {
											console.log(JSON.stringify(re),
												'++++++++++++++')
											var datas = JSON.stringify(re);
											if (datas.indexOf("accept") != -1) {
												console.log(re)
												// uni.setStorageSync('sendMsg', true)
											}
										},
										fail: (res) => {
											console.log(res)
										}
									})
									// uni.setStorageSync('sendMsg', true)
									console.log('确认')
									that.showModal = false
								} else if (res.cancel) {
									console.log('取消')
									// uni.setStorageSync('sendMsg', false)
									that.showModal = true
								}
							}
						})
					}
				}
			})
		},
		/*下拉刷新的回调 */
		downCallback() {
			// 这里加载你想下拉刷新的数据, 比如刷新轮播数据
			// loadSwiper();
			// 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
			this.mescroll.resetUpScroll()
		},
		/*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
		upCallback(page) {
			console.log('upCallback-->',page);
			// debugger;
			if (!this.isLogin) {
				uni.hideLoading();
				if (this.mescroll) this.mescroll.endSuccess(); // 隐藏加载状态栏
				return;
			}
			// debugger;
			this.num = page.num;
			let data = {
				type: 1,
				page: page.num,
				limit: page.size,
				startTime: '',
				endTime: ''
			}
			this.$Request.getT('/app/artificer/selectTodayOrder', data).then(res => {
				this.goods = [];
				if (res.code == 0) {
					res.data.list.forEach(d => {
						if (d.status == 6 && d.endTime) {
							let afterTimeStamp = new Date(d.endTime).getTime() / 1000;
							let currentTimeStamp = new Date().getTime() / 1000;
							let formatTimeStamp = Math.floor(afterTimeStamp - currentTimeStamp);
							console.log(currentTimeStamp,"currentTimeStamp=======？");
							d.endOfServiceTimer = formatTimeStamp;
							
						}
						this.goods.push(d);
					});
				}
				uni.hideLoading();
				this.mescroll.endBySize(res.data.list.length, res.data.totalCount)
				if (page.num == 1) this.goods = []; //如果是第一页需手动制空列表
				this.goods = [...this.goods, ...res.data.list]; //追加新数据
						
				this.goods.forEach(ret => {
					if (ret.status == 6 && ret.endTime) {
						let afterTimeStamp = new Date(ret.endTime).getTime() / 1000;
						let currentTimeStamp = new Date().getTime() / 1000;
						let formatTimeStamp = Math.floor(afterTimeStamp - currentTimeStamp);
						ret.endOfServiceTimer = formatTimeStamp;
					}
					if (this.$refs.countDownEl) this.$refs.countDownEl.update();
				})
				this.mescroll.endSuccess(res.data.list.length); // 隐藏加载状态栏					
			}).catch(() => {
				//联网失败, 结束加载
				this.mescroll.endErr();
			});
		},
	}
}
</script>

<style lang="scss" scoped>
	.back-img{
		background-repeat: no-repeat;
		background-size: 100%;
		width: 84px;
		height: 84px;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
	}
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&display=swap');
	.qiandao{
		width: 61px;
		height: 30px;
		line-height: 30px;
		border: 1px solid #fff;
		color: #fff;
		font-size: 12px;
		text-align: center;
		position: absolute;
		top: 0;
		right: 0;
		border-radius: 40px;
	}
body {
  font-family: Helvetica Neue, Helvetica, sans-serif;
}
	.logon{
	background:#fff;
	border-radius: 30rpx;
	color:#019c88;
	font-size: 26rpx;
	padding: 8rpx 20rpx;
	}
	.butween-list{
	width: 96%;
	margin: 0 auto;
	}
	.tongji-text{
		margin-top: 5px;
		font-size: 26rpx;
		color: #3A414B;
	}
	.wuliao:last-child .xianc{
		display: none;
	}
	.shuxian{
		width: 2rpx;
		height: 50rpx;
		background-color: rgba(255, 255, 255, 0.5);
	}
	.dengji-text{
		text-align: center;
		font-size: 26rpx;
		color: #FFFFFF;
	}
	.gengxin{
		color: #def7f4;
	}
	.jishi-index-title{
		width: 100%;
		text-align: center;
		font-weight: bold;
		font-size: 33rpx;
		color: #FFFFFF;
		padding-top: 20px;
	}
	.jishi-index{
		width: 100%;
		height: 286px;
		padding: 0 20px;
		background-image: url('../../static/index/technician15.png');
		background-repeat: no-repeat;
		background-size: 100%;
	}
page {
	background-color: #f7f7f7;
}
.progress-text{
	padding-top: 8rpx;
}
.progress-status{
	color: #fff;
	border-radius:20rpx 8rpx 20rpx 8rpx ;
	padding: 4rpx 10rpx;
	background-image: linear-gradient(to bottom, #fe9130, #ff9868);
	font-size: 30rpx;
}
.progress-status-chaoshi{
	color: #ff0000;
	border-radius:20rpx 8rpx 20rpx 8rpx ;
	padding: 4rpx 10rpx;
	font-size: 30rpx;
}

// .bg {
// 	background-color: #05C25C;
// }
.bg {
	/* 定义一个线性渐变，从红色开始，到蓝色结束 */
	background-image: linear-gradient(to bottom, #019c88, #1cb08f);
}

.gxbox {
	display: flex;
	font-size: 20rpx;
	width: 100%;
	background-color: #019c88;
	color: #fff;
	border-radius: 15px 15px 0 0;
	padding: 0 30rpx;
	height: 60rpx;
	margin-top: 2rpx;
	justify-content: space-between;
}

.wztext {
	width: 200rpx;
	overflow: hidden;
	//text-overflow: ellipsis;
	white-space: nowrap;
}


.dengjibox {
	position: relative;
	width: 100%;
	height: 276rpx;
	background: linear-gradient(-45deg, #88d7c9, #1BB9A5, #88d7c9);
	//box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(26,25,26,0.3);
	border-radius: 20rpx 20rpx 0 0;
	padding: 30rpx;
	color: #ffffff;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}

.djtit {
	position: absolute;
	left: 0;
	top: 0;
	width: 80px;
	height: 26px;
	line-height: 26px;
	text-align: center;
	color: #FFE257;
	font-size: 26rpx;
	background-color: #171717;
	border-radius: 10px 0 10px 0;
}

.djimg {
	position: absolute;
	right: 45px;
	top: 0;
	background: url(../../static/images/index/vip.png) no-repeat center;
	background-size: cover;
	width: 220rpx;
	height: 77px;
	font-size: 22px;
	text-align: center;
	line-height: 90px;
}

.xianb {
	width: 1px;
	height: 26px;
	background-color: #88baa8;
}

.xianc {
	width: 1px;
	height: 16px;
	background-color: #88baa8;
	margin: 0px 10px;
}

.csda {
	height: 202rpx;
	border-radius: 30rpx;
	background: url(../../static/index/fun_banner2.png);
	background-size: cover;
	padding: 30rpx 14rpx 14rpx 14rpx;
	margin-top: 20px;
	position: relative;
}

.zbhsga {
	height: 70rpx;
	background: #029D88;
	border-radius: 20rpx;
	color: #ffffff;
	width: 100%;
	padding: 0 8rpx;
	margin-top: 14px;
	display: flex;
	justify-content: space-around;
	align-items: center;
}

.dsalk {
	width: 31%;
	border: 2px #ededed solid;
	border-radius: 10px;
	padding: 30rpx;
	background: #fff;
	text-align:center;
}

.tapDsalk {
	width: 31%;
	border: 2px #ededed solid;
	border-radius: 10px;
	padding: 30rpx;
	border: 2px solid rgb(207, 237, 225);
	background-color: rgb(246, 252, 250);
}

.sda {
	height: 36px;
	line-height: 30px;
	text-align: center;
	border-radius: 30px;
	justify-content: center;
}

.dqda {
	font-size: 26rpx;
	color: #999999;
	margin-top: 6px;
	text-align:center;
}

.online-tag {
	color: #ffffff;
	font-size: 29rpx;
}

.img-avatar {
	width: 100rpx;
	height: 100rpx;
	border-radius: 15rpx;
	background-color: #FFFFFF;
}

.bgwhite {
	background-color: #FFFFFF;
}

.xian {
	width: 100%;
	height: 1rpx;
	border: 1rpx solid #f8f8f8;
	margin-bottom: 10rpx;
}

.pintuan_syrs {
	color: #fff;
	font-size: 20upx;
	display: flex;
	padding-right: 18upx;
	background: #5abfb2 ;
	padding: 10rpx;
	border-radius: 10rpx;
}
.pintuan-title{
		font-size: 30rpx;
		font-family: Helvetica Neue, Helvetica, sans-serif;
		color: #fff;
		display: flex;
		flex-direction: row; 
		align-items: center;
		justify-content: center;
	}
.pintuan-img{
	width: 40rpx;
	height: 40rpx;
}
.box {
	color: #FFFFFF;
	padding: 40upx 40upx 60upx 40upx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	text-align: center;

}

// uni-switch .uni-switch-input.uni-switch-input-checked{
// 	background-color: #ffffff !important;
// }
.box1 {
	background: #FFFFFF;
	border-radius: 24rpx;
	padding: 30rpx;
	margin-top: 30rpx;
}

.orderbox {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.guanlibox {
	border-left-radius: 24rpx;
	padding: 30rpx;
	background-image: linear-gradient(to bottom, #223845, #117250);
}

.guanlibox2 {
	border-right-radius: 24rpx;
	padding: 30rpx;
	background-image: linear-gradient(to bottom, #117250, #00a85b);
}

.labe {
	display: inline-flex;
	align-items: center;
	border-radius: 18rpx;
	color: #ffffff;
	font-size: 22rpx;
	font-weight: 500;
	height: 36rpx;
	justify-content: center;
	margin-top: 6px;

	text {
		width: 12rpx;
		height: 12rpx;
		background: #20C675;
		border-radius: 50%;
		margin-right: 8rpx;
	}
}

uni-switch .wx-switch-input:not([class*="bg-"]),
uni-switch .uni-switch-input:not([class*="bg-"]) {
	background: #ffffff !important;
}

uni-switch .wx-switch-input::after,
uni-switch .uni-switch-input::after {
	background: #019c88 !important;
}

uni-switch[disabled] .uni-switch-input {
	opacity: 1 !important;
}

uni-switch::after,
uni-switch::before {
	display: none !important;
}

.u-progress {
	// padding: 3px;
	margin-top: 10px;
}

// ::v-deep .u-active {
// 	border-radius: 50px !important;
// }
.radius {
	border-radius: 20rpx;
}

::v-deep .u-mode-center-box {
	display: flex;
	justify-content: center;
	align-items: center;
	background: linear-gradient(180deg, #90dacd, #ebfffa, #ebfffa);
	// box-shadow: inset 40px 20px 60px #107050,
	// 	inset -20px -40px 60px #00a55a;


	// box-shadow: inset 7px 7px 10px #0c593f,
	// inset -7px -7px 10px #00a55a;
	// background-color: red !important;
}

::v-deep .uni-scroll-view-content {
	display: flex;
	justify-content: center;
	align-items: center;
}

.innerPopup {
	color: #FFFFFF;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
}

.innerPopupOfViewmore {
	color: #FFFFFF;
	display: flex;
	justify-content: left;
	align-items: center;
	flex-wrap: wrap;
}

.innerOfPopup {
	width: 72%;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	color: #019c88;

}

.firstInnerOfPopup {
	display: flex;
	justify-content: left;
	align-items: center;
	font-size: 16px;
	padding-top: 10px;
	
}

.import {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
}

.importMaterialPackage {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-grow: 1;
}

.importMaterialPackage .importMaterialPackageInnerBox {
	// font-size: 22rpx;
}

.importMaterialPackage view:last-child {
	margin-left: 3px;
	// margin-top: 4px;
}

.viewMore {
	position: absolute;
	right: 15px;
	top: 25px;
	font-size: 22rpx;
	color: #019c88;
}

.materialPackageTitle {
	font-size: 18px;
	font-weight: bold;
	width: 100%;
	text-align: center;
}

.importMaterialPackageInner {
	width: 45%;
	// height: 40px;
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 10px;
	// border: 1px solid;
	background: #7ed3c5;
	margin-right: 10rpx;
	padding: 8rpx 15rpx;
	color: #fff;
	border-radius: 30rpx;
}

.importMaterialPackageInner view {
	height: 100%;
	display: flex;
	justify-content: left;
	align-items: center;
	// border: 1px solid;
}

.importMaterialPackageInner view:nth-child(1) {
	width: 75%;
}
.head-port{
	width: 55px;
	height: 55px;
	border-radius: 50%;
	margin-bottom: 5px;
}

.title-font{
	font-size: 30rpx;
	color: #666666;
}
.title-font2{
	font-size: 28rpx;
	color: #666666;
}
.value-font{
	font-size: 32rpx;
	color: #333333;
}

.padding-sm{
  padding: 11px 11px 0px 11px;
}

</style>