<template>
	<view class="">
		<view class="headtop">
			<!-- 顶部 -->
			<view class="header" @click="binduser()">
				<view class="head_image">
					<image :src="avatar" style="border-radius: 50%;"></image>
				</view>
				<view class="head_name" v-if="userId">
					<view class="flex align-center justify-between">
						<view class="flex" style="color: #fff;">
							<view class="">{{nickName}}</view>
							<!-- v-if="shangxian=='否'" -->
							<view style="margin-left: 20rpx; padding: 8rpx 30rpx;background: #f56c6c;border-radius: 30rpx;">
								<view class="approve" v-if="checkCertification==2">已实名</view>
								<view class="approve" v-if="checkCertification == 1">实名审核中</view>
								<view class="flex align-center approve" v-if="checkCertification==3">
									<view class="" @click.stop="bindapprove">实名未通过</view>
									<view class="margin-left" style="color: red;">{{checkCertificationMessage}}</view>
								</view>
								<view class="approve" @click.stop="bindapprove"
									v-if="checkCertification==null||checkCertification==''">未实名</view>
							</view>
						</view>
						<!-- <view class="qrCodeImg">
							<image @click.stop="getMyQrCode()" src="../../static/my/quCodeIcon.png" mode=""></image>
						</view> -->

					</view>
					<view class="flex" style="padding: 15rpx 15rpx;display: flex; line-height: 50rpx;">
						<u-rate :allow-half="false" :disabled="true"  active-color="#e6a23c"  :is-fill="false" :value="3.5" style="margin-right: 15rpx;" /> 
						<view class="text-df margin-left" style="font-weight: 200;color: #fff;">信用分:{{creditScore}}分</view>
					</view>
					<view class="text-sm margin-left-sm margin-top-xs" style="font-weight: 200;color: #fff;">
							<text style="background: #00c18a; padding: 10rpx  20rpx;border-radius: 30rpx;">ID: {{userId}}</text>
					</view>
					
				</view>
				<view class="head_name" v-if="!userId" @click.stop="goLogin">
					登录
				</view>
			</view>
			<view v-if="isOpenVip == '是' && shangxian=='否'" class="vip flex align-center justify-center">
				<view class="vip-box flex align-center justify-between" @click="navgo('/my/vip/vip')">
					<view class="vip-box-l flex align-center">
						<image v-if="globalImages" :src="globalImages + 'imgs/static/my/vipIconMy.png'" mode="widthFix"></image>
						{{vipEndTime?'尊享接单特权':'开通会员享接单特权'}}
					</view>
					<view class="vip-box-r flex align-center">
						{{vipEndTime?'立即续费':'立即开通'}}
						<u-icon name="arrow-right" color="#8b4a24" size="24"></u-icon>
					</view>
				</view>
			</view>
			<!-- 收入和订单 -->
			<!-- v-if="shangxian=='否'" -->
		<!-- 	<view class="shouru" >
				<view class="user_box">
					<view class="box">
						<view class="user_name" @click="navgo('/pages/riderMy/myAccount/myAccount')">
							<view style="width: 6rpx;height: 28rpx;background: #FE3B27;"></view>
							<u-section title="信用分" :bold="true" :right="false" line-color="#FE3B27"></u-section>
						</view>
						<view class="user_price">{{creditScore ? creditScore : 0}}</view>
						<view class="user_tit ">当前信用分值</view>
					</view>
					<view class="box" @click="myOrders()">
						<view class="user_name">
							<view style="width: 6rpx;height: 28rpx;background: #009C66;"></view>
							<u-section title="订单统计" :right="false" line-color="#009C66"></u-section>
						</view>
						<view class="user_price">{{indent.indentCount?indent.indentCount:0}} <text>单</text></view>
						<view class="user_tit ">今日完成单量</view>
					</view>
				</view>
			</view> -->
		</view>
		<!-- 我的列表 -->
		<view class=" padding-tb bg-white " style="border-radius: 24rpx; margin: 30rpx 30rpx 30rpx 30rpx;">
			<view class="flex justify-between align-center padding-lr-sm">
				<view class="text-lg text-bold text-black">常用功能</view>
			</view>
			
			<view class="flex flex-wrap margin-top-sm">
				<view class="text-center margin-tb-sm" style="width: 20%;" @click="navgo('/my/realName/authentication')">
					<image v-if="globalImages" :src="globalImages + 'images/my/shiming.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">实名认证</view>
					<!-- <view class="weinumber" v-if="order&&order.djdOrders">{{order.djdOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/wallet/index')">
					<image v-if="globalImages" :src="globalImages + 'imgs/qianbao.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">钱包</view>
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/echarts/jgOrder/statistics')">
					<image v-if="globalImages" :src="globalImages + 'imgs/tongji.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">订单统计</view>
					<!-- <view class="weinumber" v-if="order&&order.jxzOrders">{{order.jxzOrders}}</view> -->
				</view>
			<!-- 	<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/setting/index')">
					<image v-if="globalImages" :src="globalImages + 'imgs/fuli.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">我的福利</view>
					<view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view>
				</view> -->
				<!-- v-if="shangxian=='否'" -->
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/pages/riderMy/invitationUser')">
					<image v-if="globalImages" :src="globalImages + 'imgs/haoyou.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">邀请好友</view>
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/wallet/baozhengjin')">
					<image v-if="globalImages" :src="globalImages + 'imgs/baozhengjin.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">保证金</view>
				</view>
				<!-- @click="navgo('/my/exchange/shoppingMall')" -->
				<view class="text-center margin-tb-sm"  style="width: 20%;" >
					<image v-if="globalImages" :src="globalImages + 'images/my/duihuan.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">兑换商城</view>
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/echarts/setting/xyf')">
					<image v-if="globalImages" :src="globalImages + 'imgs/mingxi.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">信用分明细</view>
					<view class="weinumber" style="right: 0rpx; top: -10rpx;" v-if="xxCount">{{xxCount}}</view>
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/setting/message')">
					<image v-if="globalImages" :src="globalImages + 'images/my/xiaoxi.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">消息中心</view>
					<view class="weinumber" style="right: 0rpx; top: -10rpx;" v-if="xxCount">{{xxCount}}</view>
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/setting/index')">
					<image v-if="globalImages" :src="globalImages + 'imgs/shezhi.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">设置</view>
					<view class="weinumber" style="right: 0rpx; top: -10rpx;" v-if="xxCount">{{xxCount}}</view>
				</view>
			</view>
		</view>
		
		<view class="margin  padding-tb bg-white " style="border-radius: 24rpx;">
			<view class="flex justify-between align-center padding-lr-sm">
				<view class="text-lg text-bold text-black">运营管理</view>
			</view>
			
			<view class="flex flex-wrap margin-top-sm">
				<view class="text-center margin-tb-sm" style="width: 20%;" @click="navgo('/my/mys/trip')">
					<image v-if="globalImages" :src="globalImages + 'imgs/xingcheng.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">我的行程</view>
					<!-- <view class="weinumber" v-if="order&&order.djdOrders">{{order.djdOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/echarts/jgOrder/revenue')">
					<image v-if="globalImages" :src="globalImages + 'imgs/tongji (2).png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">收入统计</view>
					<!-- <view class="weinumber" v-if="order&&order.yjdOrders">{{order.yjdOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/manage/message')" >
					<image v-if="globalImages" :src="globalImages + 'imgs/guanli.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">车辆管理</view>
					<!-- <view class="weinumber" v-if="order&&order.jxzOrders">{{order.jxzOrders}}</view> -->
				</view>
			<!-- 	<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/setting/logOff')">
					<image v-if="globalImages" :src="globalImages + 'imgs/zhaomu.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">招募车主</view>
					<view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view>
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo()">
					<image v-if="globalImages" :src="globalImages + 'imgs/chezhu.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">成为车主</view>
					<view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view>
				</view> -->
			</view>
		</view>
		
		<view class="margin  padding-tb bg-white " style="border-radius: 24rpx;">
			<view class="flex justify-between align-center padding-lr-sm">
				<view class="text-lg text-bold text-black">安全服务</view>
			</view>
			
			<view class="flex flex-wrap margin-top-sm">
				<view class="text-center margin-tb-sm" style="width: 20%;">
					<image v-if="globalImages" :src="globalImages + 'imgs/zhongxin.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">安全中心</view>
					<!-- <view class="weinumber" v-if="order&&order.djdOrders">{{order.djdOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;">
					<image v-if="globalImages" :src="globalImages + 'imgs/xvzhi.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">安全须知</view>
					<!-- <view class="weinumber" v-if="order&&order.yjdOrders">{{order.yjdOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/setting/index')">
					<image v-if="globalImages" :src="globalImages + 'imgs/lianxiren.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">紧急联系人</view>
					<!-- <view class="weinumber" v-if="order&&order.jxzOrders">{{order.jxzOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/setting/LostandFound')">
					<image v-if="globalImages" :src="globalImages + 'imgs/shuwu.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">失物招领</view>
					<!-- <view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 20%;" @click="navgo('/my/safety/video')">
					<image v-if="globalImages" :src="globalImages + 'imgs/kaoshi.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">安全考试</view>
					<!-- <view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view> -->
				</view>
			</view>
		</view>
		
		<view class="margin  padding-tb bg-white " style="border-radius: 24rpx;">
			<view class="flex justify-between align-center padding-lr-sm">
				<view class="text-lg text-bold text-black">出行服务</view>
			</view>
			
			<view class="flex flex-wrap margin-top-sm">
				<view class="text-center margin-tb-sm" style="width: 25%;">
					<image v-if="globalImages" :src="globalImages + 'images/my/zhinan.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">使用指南</view>
					<!-- <view class="weinumber" v-if="order&&order.djdOrders">{{order.djdOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 25%;" @click="navgo('/my/help/trainingList')">
					<image v-if="globalImages" :src="globalImages + 'images/my/wenda.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">常见问答</view>
					<!-- <view class="weinumber" v-if="order&&order.yjdOrders">{{order.yjdOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 25%;" @click="changekefu">
					<image v-if="globalImages" :src="globalImages + 'images/my/dianhua.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">客服电话</view>
					<!-- <view class="weinumber" v-if="order&&order.jxzOrders">{{order.jxzOrders}}</view> -->
				</view>
				<!-- <view class="text-center margin-tb-sm"  style="width: 25%;">
					<image v-if="globalImages" :src="globalImages + 'images/my/shoucang.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">我的收藏</view>
					<view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view>
				</view> -->
			</view>
		</view>
		
		<view class="margin  padding-tb bg-white " style="border-radius: 24rpx;">
			<view class="flex justify-between align-center padding-lr-sm">
				<view class="text-lg text-bold text-black">关于顺风车</view>
			</view>
			
			<view class="flex flex-wrap margin-top-sm">
				<view class="text-center margin-tb-sm" style="width: 25%;">
					<image v-if="globalImages" :src="globalImages + 'imgs/women.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">关于我们</view>
					<!-- <view class="weinumber" v-if="order&&order.djdOrders">{{order.djdOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 25%;"  @click="bindTo('/my/setting/xieyi')">
					<image v-if="globalImages" :src="globalImages + 'imgs/xieyi.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">服务协议</view>
					<!-- <view class="weinumber" v-if="order&&order.yjdOrders">{{order.yjdOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 25%;" @click="bindTo('/my/feedback/feedback')">
					<image v-if="globalImages" :src="globalImages + 'imgs/fankui.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">意见反馈</view>
					<!-- <view class="weinumber" v-if="order&&order.jxzOrders">{{order.jxzOrders}}</view> -->
				</view>
				<view class="text-center margin-tb-sm"  style="width: 25%;" @click="bindTo('/my/setting/logOff')">
					<image v-if="globalImages" :src="globalImages + 'imgs/zhuxiao.png'" style="width: 56rpx;height: 56rpx;" mode=""></image>
					<view class="text-sm">注销账号</view>
					<!-- <view class="weinumber" v-if="order&&order.dzfOrders">{{order.dzfOrders}}</view> -->
				</view>
			</view>
		</view>
		
		<view class="mylist ">
			<view class="mylist_title padding-lr">推荐工具</view>
			<view class="flex flex-wrap">
				<view class="list_box" @click="navgo('/my/renzheng/index')" v-if="shangxian=='否'">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/renz.png'" mode="scaleToFill" class="list_img"></image>
					<view class="list_name">实名认证</view>
				</view>
				<view v-if="isBindung == '是' && shangxian=='否'" class="list_box" @click="navgo('/my/wallet/baozhengjin')">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/bzj.png'" mode="scaleToFill" class="list_img"></image>
					<view class="list_name">保证金</view>
				</view>
				<view class="list_box" @click="navgo('/my/wallet/index')" v-if="shangxian=='否'">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/qianbao.png'" mode="scaleToFill" class="list_img"></image>
					<view class="list_name">我的钱包</view>
				</view>
				<view class="list_box" @click="navgo('/pages/riderMy/invitationUser')" v-if="shangxian=='否'">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/share.png'" mode="scaleToFill" class="list_img"></image>
					<view class="list_name">邀请好友</view>
				</view>
				<view class="list_box" @click="navgo('/my/team/team')" v-if="shangxian=='否'">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/team.png'" mode="scaleToFill'" class="list_img"></image>
					<view class="list_name">我的团队</view>
				</view>
				<view class="list_box" @click="changekefu">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/kefu.png'" mode="scaleToFill'" class="list_img"></image>
					<view class="list_name">联系客服</view>
				</view>
				<view class="list_box" @click="navgo('/my/setting/message')" style="position: relative;">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/upload/xiaoxi.png'" mode="scaleToFill" class="list_img"></image>
					<view class="list_name">我的消息</view>
					<view class="weinumber" v-if="xxCount">{{xxCount}}</view>
				</view>

				<!-- <view class="list_box" @click="navgo('/my/appeal/index')">
				<image src="../../static/my/shensu.png" mode="scaleToFill" class="list_img"></image>
				<view class="list_name">违规申诉</view>
			</view> -->
				<!-- <view class="list_box" @click="navgo('/my/evaluate/index')" v-if="shangxian=='否'">
					<image src="../../static/my/pj.png" mode="scaleToFill" class="list_img"></image>
					<view class="list_name">我的评价</view>
				</view> -->
				<view class="list_box" @click="navgo('/echarts/setting/xyf')">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/xyf.png'" mode="scaleToFill" class="list_img"></image>
					<view class="list_name">信用分明细</view>
				</view>
				<!-- #ifndef H5 -->
				<view class="list_box" @click="navgo('/my/setting/jinji')">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/jg.png'" mode="scaleToFill" class="list_img"
						style="width: 50rpx;height: 50rpx;"></image>
					<view class="list_name">紧急报警</view>
				</view>
				<!-- #endif -->
				<view class="list_box" @click="navgo('/my/help/trainingList')">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/hellp.png'" mode="scaleToFill" class="list_img"></image>
					<view class="list_name">司机指南</view>
				</view>
				<view class="list_box" @click="navgo('/my/setting/index')">
					<image v-if="globalImages" :src="globalImages + 'imgs/static/my/set.png'" mode="scaleToFill'" class="list_img"></image>
					<view class="list_name">系统设置</view>
				</view>
			</view>
		</view>

		<!-- 师傅二维码弹窗 -->
		<u-popup v-model="showQrcode" mode="center" closeable border-radius="14" width="600rpx">
			<view class="showQrcode-title">扫我下单</view>
			<view class="showQrcode-img">
				<image :src="qrCodeImg" mode="aspectFill"></image>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import configdata from '../../common/config.js';
	import { waitForGlobalImages } from '@/utils/globalImageLoader'
	export default {
		onShareAppMessage(res) { //发送给朋友
			return {
				title: this.tuiguang,
				path: '/pages/index/index',
				imageUrl: this.tuiguangImg,
			}
		},
		onShareTimeline(res) { //分享到朋友圈
			return {
				title: this.tuiguang,
				path: '/pages/index/index',
				imageUrl: this.tuiguangImg,
			}
		},
		data() {
			return {
				xxCount: 0,
				showQrcode: false, //是否显示二维码
				tuiguang: '',
				tuiguangImg: '',
				show: false,
				title: '我的',
				information: {}, //个人信息
				daySr: '',
				orders: '',
				indent: {},

				avatar: '../../static/logo.png',
				nickName: '匿名',
				checkCertification: '',
				userId: '',
				token: '',
				shangxian: '是',
				checkCertificationMessage: '',

				checked: false,
				loading: false,
				// 中间变量，避免在watch中多次回调，造成无限循环
				controlStatus: false,
				creditScore: 0,
				arr: [],
				showModal1: true,
				qrCodeImg: '',
				isOpenVip: '否', //是否开启会员功能
				vipEndTime: '', //会员到期时间
				isBindung: '是', //是否启用保证金
				globalImages: ''
			}
		},
		onLoad() {
			waitForGlobalImages().then((path) => {
			    console.log('✅ 全局图片路径:', path)
			    this.globalImages = path
			  })
			this.isOpenVip = uni.getStorageSync('isOpenVip')
			this.shangxian = uni.getStorageSync('shangxian')
			this.$Request.getT('/app/common/type/276').then(res => {
				if (res.code === 0) {
					uni.setStorageSync('tuiguang', res.data.value)
					this.tuiguang = res.data.value;
				}
			});
			this.$Request.getT('/app/common/type/277').then(res => {
				if (res.code === 0) {
					uni.setStorageSync('tuiguangImg', res.data.value)
					this.tuiguangImg = res.data.value;
				}
			});
			this.$Request.getT('/app/common/type/428').then(res => { //师傅端小程序订单状态通知 428

				if (res.code == 0) {
					if (res.data && res.data.value) {
						this.arr.push(res.data.value)
					}
				}
			})
			this.$Request.getT('/app/common/type/429').then(res => { //师傅端小程序新订单通知 429
				if (res.code == 0) {
					if (res.data && res.data.value) {
						this.arr.push(res.data.value)
					}
				}
			})

		},
		onShow() {
			this.isBindung = uni.getStorageSync('isBindung')
			this.token = this.$queue.getData('token');
			this.userId = this.$queue.getData('userId');
			if (this.token) {
				this.shouru()
				this.getUserInfo();
				this.getXXDetailNum();
				if (this.showModal1) {
					// #ifdef MP-WEIXIN
					this.openMsg()
					// #endif
				}
			} else {
				// this.goLogin();
				this.xxCount = 0;
				this.userId = ''
				this.creditScore = 0
				this.indent = []
				this.avatar = '../../static/logo.png'
				this.nickName = ''
				this.vipEndTime = ''
			}


		},
		methods: {
			bindTo(name) {
				let token = this.$queue.getData("token");
				if (token) {
					uni.navigateTo({
						url: name
					})
				}
			
			},
			//获取会员信息
			getVipInfo() {
				this.$Request.getT('/app/UserVip/selectUserVip').then(res => {
					if (res.code == 0) {
						if (res.data) {
							this.vipEndTime = res.data.endTime
						} else {
							this.vipEndTime = ''
						}
					}
				})
			},
			getXXDetailNum() {
				this.$Request.getT('/app/message/getRouteOrdersCount').then(res => {
					if (res.code == 0) {
						this.xxCount = res.data ? res.data : 0;
					}
				});
			},
			//获取师傅二维码
			getMyQrCode() {
				let that = this
				let userId = uni.getStorageSync('userId')
				uni.downloadFile({
					url: configdata.APIHOST + '/app/invite/riderQr?userId=' + userId,
					success(res) {
						that.qrCodeImg = res.tempFilePath
						that.showQrcode = true
					}
				})
			},
			// switch打开或者关闭时触发，值为true或者false
			change(status) {
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('sendMsg')) {
					uni.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							// console.log(re,'**********')
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				// #endif
				if (this.checked == false) {
					if (this.controlStatus == true) {
						this.controlStatus = false;
						return;
					}
					// 重新打开switch，并让它处于加载中的状态
					this.checked = true;
					if (uni.getStorageSync('token')) {
						this.loading = true;
						this.getRestultFromServer();
					} else {
						uni.navigateTo({
							url: '/pages/login/login'
						})
					}

					// 模拟向后端发起请求


				} else if (this.checked == true) {
					if (this.controlStatus == true) {
						this.controlStatus = false;
						return;
					}
					// 重新关闭switch，并让它处于加载中的状态
					this.checked = false;
					// 模拟向后端发起请求
					if (uni.getStorageSync('token')) {
						this.loading = true;
						this.getRestultFromServer1();
					} else {
						uni.navigateTo({
							url: '/pages/login/login'
						})
					}
				}
			},
			getRestultFromServer() {

				this.controlStatus = true;
				// 后端允许用户关闭switch，设置checked为false，结束loading状态
				let that = this
				uni.showModal({
					title: '提示',
					content: '确定要下线吗',
					complete: function(ret) {
						if (ret.confirm) {
							console.log('用户点击确定');
							uni.showLoading({
								title: '修改中...',
							})
							that.$Request.postT("/app/user/updateLine").then(res => {
								uni.hideLoading();
								that.loading = false;
								that.controlStatus = false
								if (res.code === 0) {
									that.checked = false;

									that.getUserInfo();
								} else {
									that.$queue.showToast(res.msg)
								}
							});
						} else if (ret.cancel) {
							console.log('用户点击取消');
							that.checked = true;
							that.loading = false;
							that.controlStatus = false
						}
					},
				});
			},
			getRestultFromServer1() {
				// 通过定时器模拟向后端请求
				this.controlStatus = true;
				// 后端允许用户关闭switch，设置checked为false，结束loading状态
				let that = this
				uni.showModal({
					title: '提示',
					content: '确定要上线吗',
					complete: function(ret) {
						if (ret.confirm) {
							console.log('用户点击确定');
							uni.showLoading({
								title: '修改中...',
							})
							that.$Request.postT("/app/user/updateLine").then(res => {
								uni.hideLoading();
								that.loading = false;
								that.controlStatus = false
								if (res.code === 0) {
									that.checked = true;
									that.getUserInfo();
								} else {
									that.$queue.showToast(res.msg)
								}
							});
						} else if (ret.cancel) {
							that.loading = false;
							console.log('用户点击取消');
							that.checked = false;
							that.controlStatus = false
						}
					}
				});
			},
			//联系客服
			changekefu() {
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('sendMsg')) {
					uni.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							// console.log(re,'**********')
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				// #endif
				let kefu = this.$queue.getData('kefu'); // 用户端联系方式 1 手机号 2企业微信
				let kefuPhone = this.$queue.getData('kefuPhone');
				if (kefu == 1) {
					uni.makePhoneCall({
						phoneNumber: kefuPhone //仅为示例
					});
				} else if (kefu == 2) {
					// #ifdef MP-WEIXIN
					let that = this
					try {
						wx.openCustomerServiceChat({
							extInfo: {
								url: that.$queue.getData('kefuUrl')
							},
							corpId: that.$queue.getData('kefuAppId'),
							success(res) {},
							fail(res) {
								console.error(res)
							}
						})
					} catch (error) {
						console.error("catchcatch" + error)
						uni.showToast({
							title: '请更新至微信最新版本'
						});
					}
					// #endif
					// #ifndef MP-WEIXIN
					let url = this.$queue.getData('kefuUrl');
					if (url.indexOf('/pages/') !== -1 || url.indexOf('/pageA/') !== -1 || url.indexOf('/my/') !== -1) {
						uni.navigateTo({
							url
						});
					} else {
						//#ifndef H5
						uni.navigateTo({
							url: '/pages/index/webView?url=' + url
						});
						//#endif
						//#ifdef H5
						window.location.href = url;
						//#endif
					}
					// #endif
				} else if (kefu == 3) {
					uni.navigateTo({
						url: '/my/kefu/index'
					});
				}
			},
			// 查看今日收入
			profit() {
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('sendMsg')) {
					uni.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							// console.log(re,'**********')
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				// #endif
				if (!this.userId) {
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return
				}
				uni.navigateTo({
					url: '/pages/riderMy/profit'
				})
			},
			// 查看订单统计
			myOrders() {
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('sendMsg')) {
					uni.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							// console.log(re,'**********')
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				// #endif
				if (!this.userId) {
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return
				}
				uni.navigateTo({
					url: '/pages/riderMy/order'
				})
			},
			bindapprove() {
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('sendMsg')) {
					uni.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							// console.log(re,'**********')
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				// #endif
				uni.navigateTo({
					url: '/my/renzheng/index'
				})
			},
			navgo(e) {
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('sendMsg')) {
					uni.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							// console.log(re,'**********')
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				// #endif
				let that = this
				if (that.token) {
					uni.navigateTo({
						url: e
					})
				} else {
					uni.navigateTo({
						url: '/pages/login/login'
					})
				}
			},
			binduser() {
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('sendMsg')) {
					uni.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							// console.log(re,'**********')
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				// #endif
				let token = this.$queue.getData('token');
				if (!token) {
					uni.navigateTo({
						url: '/pages/login/login'
					})
					return;
				}
				uni.navigateTo({
					url: '/pages/riderMy/userinfo'
				});
			},

			// 获取个人信息
			getUserInfo() {
				let userId = this.$queue.getData('userId');
				this.$Request.getT("/app/user/selectUserDetails?userId=" + userId).then(res => {
					if (res.code == 0) {
						if (res.data.isVip && res.data.isVip == 1) {
							this.getVipInfo()
						} else {
							this.vipEndTime = ''
						}
						this.$nextTick(function() {
							this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
							uni.setStorageSync('avatar', res.data.avatar)
							this.nickName = res.data.nickName
							uni.setStorageSync('nickName', res.data.nickName)
							this.creditScore = res.data.creditScore


							uni.setStorageSync('zhiFuBao', res.data.zhiFuBao)
							uni.setStorageSync('zhiFuBaoName', res.data.zhiFuBaoName)
							// console.log(this.checkCertification, '实名认证')
							this.userId = res.data.userId
							uni.setStorageSync('userId', res.data.userId)

							if (res.data.onLineFlag != 2) {
								this.checked = true
							} else {
								this.checked = false
							}


						})
					} else {
						this.$queue.logout();
						uni.showModal({
							showCancel: false,
							title: '登录失败',
							content: res.msg,
						});
					}
				});

				this.$Request.getT('/app/driver/selectDriverByUserId?userId=' + userId).then(res => {
					if (res.code == 0 && res.data) {
						this.checkCertification = res.data.status
						this.checkCertificationMessage = res.data.auditContent
						uni.setStorageSync('checkCertification', res.data.status)
						uni.setStorageSync('driverId', res.data.driverId)
					}
				})
			},
			// 今日收入、订单量
			shouru() {
				this.$Request.getT('/app/orders/findIncome').then(res => {
					if (res.code == 0) {
						// this.daySr = res.data.income
						// this.orders = res.data.indentCount
						this.indent = res.data
					}
					console.log('res', res)

				});
			},
			// 跳转去登录
			goLogin() {
				// this.$queue.setData('href', '/pages/my/index');
				uni.navigateTo({
					url: '/pages/login/login'
				});
			},
			//退出登录
			TuiLogin() {
				let that = this

				if (that.userId) {
					uni.showModal({
						title: '提示',
						content: '确认退出登录吗?',
						success: function(res) {
							if (res.confirm) {
								uni.removeStorageSync('userId')
								uni.removeStorageSync('token')
								uni.removeStorageSync('avatar')
								uni.removeStorageSync('nickName')
								uni.removeStorageSync('phone')
								uni.removeStorageSync('invitationCode')
								uni.removeStorageSync('inviterCode')
								uni.removeStorageSync('platform')
								uni.removeStorageSync('sex')
								uni.removeStorageSync('zhiFuBao')
								uni.removeStorageSync('zhiFuBaoName')
								uni.removeStorageSync('checkCertification')

								// uni.navigateBack()
								uni.redirectTo({
									url: '/pages/index/index'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
				} else {
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/pages/login/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}


			},
			// 开启订阅消息
			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) {
										console.log(that.arr)
										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.showModal1 = false
									} else if (res.cancel) {
										console.log('取消')
										// uni.setStorageSync('sendMsg', false)
										that.showModal1 = true
									}
								}
							})
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	::v-deep .u-title {
		color: #000000 !important;
	}

	::v-deep .u-navbar-fixed {
		background: none !important;
	}

	page {
		background: #F5F5F5;
	}

	.vip {
		width: 100%;
		height: 110rpx;
		position: relative;
		margin-bottom: 20rpx;

		.vip-box {
			width: 700rpx;
			height: 100%;
			background: linear-gradient(to right, #ebd6a6, #f3e0c0);
			border-radius: 24rpx;
			padding: 0 30rpx;
		}

		.vip-box-l {
			color: #8b4a24;
			font-size: 30rpx;
			font-weight: 500;

			image {
				width: 40rpx;
				margin-right: 10rpx;
			}
		}

		.vip-box-r {
			color: #8b4a24;
			font-size: 26rpx;
			font-weight: 500;
		}
	}

	.weinumber {
		width: 30upx;
		height: 30upx;
		background: red;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 24rpx;
		border-radius: 35upx;
		position: absolute;
		top: 0upx;
		right: 10upx;
		z-index: 99;
	}

	.showQrcode-title {
		width: 100%;
		text-align: center;
		font-size: 34rpx;
		font-weight: bold;
		margin-top: 24rpx;


	}

	.showQrcode-img {
		width: 500rpx;
		height: 500rpx;
		margin: 30rpx auto;
		margin-bottom: 40rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 10rpx;
		}
	}

	.headtop {
		background: linear-gradient(0deg, #c7ffef 0%, #32d0a3 100%);
		height: 400rpx;
		// position: fixed;
		// /* #ifdef H5 */
		// top: 0rpx;
		// padding-top: 30rpx;
		// /* #endif */
		// /* #ifndef H5 */
		// top: 0rpx;
		// /* #endif */
		// left: 0;
		// right: 0;
		// z-index: 0;
	}

	/* 顶部 */
	.header {
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		/* #ifndef H5 */
		// margin-top: 60rpx;
		/* #endif */

	}

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

	.head_image image {
		width: 90rpx;
		height: 90rpx;
	}

	.head_name {
		flex: 4;
		position: relative;
		font-size: 36rpx;
		font-weight: bold;
		color: #333333;
	}

	.qrCodeImg {
		width: 60rpx;
		height: 60rpx;
		margin-right: 30rpx;

		image {
			width: 100%;
			height: 100%;
			border-radius: 50%;
		}
	}



	.approve {
		font-size: 24rpx;
		font-weight: 500;
	}

	/* 用户信息 */
	.shouru {
		border-radius: 24rpx;
		overflow: hidden;
		width: 93%;
		margin: 0 auto;
		background: #ffffff;
		position: relative;
		z-index: 99;
		top: -90rpx;
	}

	.user_box {
		display: flex;
		height: 210rpx;
		padding: 0 20rpx 0 30rpx;

	}

	.box {
		flex: 1;
		/* margin-left: 40rpx; */
		margin-top: 40rpx;
	}

	.user_price {
		font-size: 44rpx;
		margin-top: 10rpx;
	}

	.user_price text {
		font-size: 21rpx;
		margin-left: 10rpx;
	}

	.user_tit {
		color: #B3B3B3;
		font-size: 21rpx;
		margin-top: 10rpx;
	}

	::v-deep .u-section__title {
		font-weight: 500 !important;
		color: #333333 !important;
		font-size: 14px !important;
		padding-left: 10px;
	}

	/* 我的列表 */
	.mylist {
		// width: 93%;
		// margin: 0 auto;
		margin: 30rpx;
		background-color: #FFFFFF;
		border-radius: 23rpx;
		padding: 30rpx 0rpx;
		position: relative;
		z-index: 99;
	}

	.mylist_title {
		font-family: PingFang SC;
		font-weight: bold;
		font-size: 32rpx;
		color: #333333;
		margin: 10rpx 0rpx 20rpx;
	}

	.list_box {
		/* width: 90%; */
		/* margin: 0 auto; */
		// height: 95rpx;
		width: 25%;
		text-align: center;
		margin-top: 20rpx;
		margin-bottom: 20rpx;
	}

	.list_left {
		flex: 1;
		display: flex;
		justify-content: left;
		align-items: center;
	}

	.list_img {
		width: 56rpx;
		height: 56rpx;
		// margin-right: 18rpx;
	}

	.list_name {
		font-size: 25rpx;
		letter-spacing: 2rpx;
	}


	.list_right {
		width: 12rpx;
		height: 20rpx;
	}

	.user_name {
		display: flex;
		align-items: center;
	}
</style>