<template>
	<view class="pages-mine" v-if="mineInfo.id">
		<!-- <u-status-bar></u-status-bar> -->
		<!-- <image mode="aspectFill" lazy-load class="mine-bg abs" :src="configInfo[image_type[userPageType]]"></image> -->
		<view class="usercontent">
			<!-- :class="[ { 'flex-warp': userInfo.nickName }, { 'flex-center': !userInfo.nickName } ]" -->
			<view class="myContent">
				<view class="mine">
					我的
					<view @tap.stop="$util.goUrl({url:`/user/pages/setting`})" class="notice-item ml-md">
						<i class="iconfont icon-xitong text-bold"></i>
					</view>
				</view>
				<view class="avatar_view">
					<image mode="aspectFill" class="avatar radius"
						:src="mineInfo.avatarUrl || `/static/mine/default_user.png`">
					</image>
					<view class="text" v-if="mineInfo.is_admin == 1">
						代理商
					</view>
				</view>

				<block v-if="userInfo && !userInfo.nickName">
					<auth :needAuth="userInfo && (!userInfo.phone || !userInfo.nickName)" :must="true"
						:type="!userInfo.phone ? 'phone' : 'userInfo'" class="flex-1">
						<view class="flex-1 f-md-title text-bold ml-md"
							:style="{color:configInfo[font_type[userPageType]]}">登录</view>
					</auth>
				</block>
				<view class="flex-1 uerInfoContent" :style="{color:configInfo[font_type[userPageType]]}" v-else>
					<view class="flex-between" style="margin-top:24upx">
						<view @tap.stop="authUserProfile" class="flex-y-center f-title">
							<view class="mr-sm max-500 ellipsis" style="font-size: 30upx;color: #FFFFFF;">
								{{ userInfo.nickName || '用户昵称' }}
							</view>
							<!-- #ifdef MP-WEIXIN -->
							<i class="flex-1 iconfont icon-shuaxin"></i>
							<!-- #endif -->
						</view>
					</view>
					<view class="flex-between" style="margin-top:24rpx;">
						<view class="member-tag flex-center pl-md pr-md f-caption radius ">
							<!-- {{ mineInfo.coach_status === 2 ? mineInfo.coach_level.title || '技师' : '普通用户' }} -->
							<i class="iconfont iconhuiyuanka mr-sm"></i>{{ mineInfo.coach_status === 2 ? '技师' : '普通用户' }}
						</view>
						<view class="f-desc" style="color:#fff">
							<block v-if=" mineInfo.coach_status === 2 && mineInfo.service_time_long * 1 > 0 ">
								{{ `已服务${mineInfo.service_time_long}分钟` }}
							</block>
						</view>
					</view>
					<!-- <view @tap.stop="toChooseLocation" class="flex-x-center mt-md f-caption" style="height: 72rpx"
						v-if="mineInfo.coach_status == 2">
						<i class="iconfont iconjuli mr-sm"></i>
						<view class="flex-1 ellipsis-2">{{ coach_info.address }}</view>
					</view>
					<view class="mt-md" style="height: 72rpx" v-else></view> -->
				</view>
			</view>
			<auth :needAuth="userInfo && (!userInfo.phone || !userInfo.nickName)" :must="true"
				:type="!userInfo.phone ? 'phone' : 'userInfo'" @go="$util.goUrl({ url: `/user/pages/stored/list` })"
			>
				<!-- <view
					class=" flex-between ml-sm mr-lg pt-lg pb-lg pl-md pr-sm fill-base f-caption c-desc box-shadow radius-16 ">
					<view>
						<view class="f-title text-bold mb-sm" :style="{ color: primaryColor }">充值</view>
						<view>余额充值 充送活动</view>
					</view>
					<view class="item-icon rel flex-center">
						<view class="item-icon radius abs" :style="{background:primaryColor}"></view>
						<i class="iconfont iconchongzhi" :style="{color:primaryColor}"></i>
					</view>
				</view> -->
				<view class="chongzhi">
					<text>充值加倍送，立即充值</text>
					<image src="../static/arrow.png" mode=""></image>
				</view>
			</auth>
			
		</view>
		<!-- 用户 -->
		<!-- coach_status 1申请中，2已通过，3已取消授权，4已拒绝 -->
		<block v-if="userPageType == 1">
			<view class="flex-center fill-base wallet">
				<view class="flex-center flex-column" style="width: 50%">
					<view style="color: #333333;font-size:30rpx">我的余额</view>
					<view style="color: #333333;font-size:48rpx;margin-top:22rpx">{{ mineInfo.balance || 0 }}</view>
				</view>
				<auth :needAuth="userInfo && (!userInfo.phone || !userInfo.nickName)" :must="true"
					:type="!userInfo.phone ? 'phone' : 'userInfo'" @go="$util.goUrl({ url: `/user/pages/coupon/list` })"
					style="width: 50%">
					<view class="flex-center flex-column f-caption c-caption" style="border-left:1px solid #EAEAEA">
						<view style="color: #333333;font-size:30rpx">我的卡券</view>
						<view style="color: #333333;font-size:48rpx;margin-top:22rpx">{{ mineInfo.coupon_count || 0 }}</view>
					</view>
				</auth>
			</view>

		<!-- 	<view class="share-list flex-between mt-md">
				<auth :needAuth="userInfo && (!userInfo.phone || !userInfo.nickName)" :must="true"
					:type="!userInfo.phone ? 'phone' : 'userInfo'" @go="toAtv" style="width: 50%">
					<view
						class="flex-between ml-lg mr-sm pt-lg pb-lg pl-md pr-sm fill-base f-caption c-desc box-shadow radius-16 ">
						<view>
							<view class="f-title text-bold mb-sm" :style="{ color: primaryColor }">邀请有礼</view>
							<view>邀请新人 获得福利</view>
						</view>
						<image class="coupon-img" src="/static/mine/coupon.png"></image>
					</view>
				</auth>
				
			</view> -->

			<!-- <view class="mine-menu-list box-shadow fill-base radius-16">
				<view @tap="toJumpAll(1)" class="menu-title flex-between pl-lg pr-md b-1px-b">
					<view class="f-paragraph c-title text-bold">我的订单</view>
					<view class="flex-y-center f-caption c-paragraph">全部订单<i class="iconfont icon-right"></i></view>
				</view>
				<view class="flex-warp pt-lg pb-lg">
					<view @tap.stop="toJump('orderList', index)"
						class="item-child flex-center flex-column f-caption c-paragraph"
						v-for="(item, index) in orderList" :key="index">
						<i class="iconfont" :class="item.icon" :style="{color:primaryColor}"></i>
						<view class="mt-sm">{{ item.text }}</view>
					</view>
				</view>
			</view> -->

			<!-- <view class="mine-menu-list box-shadow fill-base radius-16">
				<view class="menu-title flex-between pl-lg pr-md b-1px-b">
					<view class="f-paragraph c-title text-bold">分享赚钱</view>
				</view>
				<view class="flex-warp pt-lg pb-lg">
					<block v-for="(item, index) in mineInfo.is_fx ? distributionList : distributionApplyList"
						:key="index">
						<view @tap.stop="toJump(mineInfo.is_fx ?'distributionList':'distributionApplyList', index)"
							class="item-child flex-center flex-column f-caption c-paragraph"
							v-if="item.text == '绑定技师'?mineInfo.is_admin == 1?true:false:true">
							<view class="item-img flex-center radius" style="background: #F8F8F8;">
								<i class="iconfont c-title" :class="item.icon"></i>
							</view>
							<view class="mt-sm">{{ item.text }}</view>
						</view>
					</block>
				</view>
			</view> -->

			<view class="mine-tool-list fill-base radius-16">
				<block v-for="(item, index) in toolList" :key="index">
					<!-- #ifdef MP-WEIXIN -->
					<button :open-type="configInfo.im_type == 2 ?'contact':''" class="clear-btn"
						v-if="item.text == '联系客服' && configInfo.im_type == 2">
						<view class="list-item pt-lg pb-lg ml-lg mr-lg  flex-center"
							:class="[{ 'b-1px-t': index != 0 }]">
							<i class="iconfont" :class="item.icon" :style="{color:primaryColor}"></i>
							<view class="flex-1 flex-between ml-md">
								<view class="f-paragraph c-title">{{ item.text }}</view>
								<i class="iconfont icon-right"></i>
							</view>
						</view>
					</button>
					<block v-else>
						<auth :needAuth="userInfo && (!userInfo.phone || !userInfo.nickName)" :must="true"
							:type="!userInfo.phone ? 'phone' : 'userInfo'" @go="toJump('toolList', index)">
							<view class="list-item pt-lg pb-lg ml-lg mr-lg flex-center"
								:class="[{ 'b-1px-t': index != 0 }]">
								<i class="iconfont" :class="item.icon" :style="{color:primaryColor}"></i>
								<view class="flex-1 flex-between ml-md">
									<view class="f-paragraph c-title">{{ item.text }}</view>
									<i class="iconfont"
										:class="[{'iconbodadianhua text-bold':item.text == '联系客服'},{'icon-right':item.text != '联系客服'}]"
										:style="{fontSize:item.text == '联系客服'?'50rpx':'',color:item.text == '联系客服'?primaryColor:''}">
									</i>
								</view>
							</view>
						</auth>
					</block>
					<!-- #endif -->
					<!-- #ifndef MP-WEIXIN -->
					<view @tap.stop="toJump('toolList', index)" v-if="item.text!='邀请好友'" class="list-item pt-lg pb-lg ml-lg mr-lg flex-center"
						:class="[{ 'b-1px-t': index != 0 }]">
						<!-- <i class="iconfont" :class="item.icon" :style="{color:primaryColor}"></i> -->
						<image style="width:44rpx;height:44rpx;" :src="item.icon" mode=""></image>
						<view class="flex-1 flex-between ml-md">
							<view class="f-paragraph c-title">{{ item.text }}</view>
							<i class="iconfont"
								:class="[{'iconbodadianhua text-bold':item.text == '联系客服'},{'icon-right':item.text != '联系客服'}]"
								:style="{fontSize:item.text == '联系客服'?'50rpx':'',color:item.text == '联系客服'?primaryColor:''}">
							</i>
						</view>
					</view>
					<auth :needAuth="userInfo && (!userInfo.phone || !userInfo.nickName)" :must="true"
						:type="!userInfo.phone ? 'phone' : 'userInfo'" @go="toAtv" v-if="item.text=='邀请好友'">
						<view class="list-item pt-lg pb-lg ml-lg mr-lg flex-center"
							:class="[{ 'b-1px-t': index != 0 }]">
							<!-- <i class="iconfont" :class="item.icon" :style="{color:primaryColor}"></i> -->
							<image style="width:44rpx;height:44rpx;" :src="item.icon" mode=""></image>
							<view class="flex-1 flex-between ml-md">
								<view class="f-paragraph c-title">{{ item.text }}</view>
								
							</view>
						</view>
					</auth>
					<!-- #endif -->
				</block>
				<view @tap.stop="toChange" class="list-item pd-lg flex-center b-1px-t"
					v-if="mineInfo.coach_status == 2 || mineInfo.coach_status == 3">
					<i class="iconfont iconqiehuanjishiduan" :style="{color:primaryColor}"></i>
					<view class="flex-1 flex-between ml-md">
						<view class="f-paragraph c-title">切换技师端</view>
						<i class="iconfont icon-switch c-caption"></i>
					</view>
				</view>
			</view>
		</block>
		<!-- 技师 -->
		<block v-if="userPageType == 2">
			<view style="margin-top:20rpx;" class=" mine-count-list rel box-shadow ml-lg mr-lg fill-base f-caption c-caption radius-16 ">
				<view class="cancel-auth iconfont icon-biaoqian c-caption flex-center abs"
					v-if="mineInfo.coach_status == 3">
					<view class="text-bold f-icontext abs">取消授权</view>
				</view>
				<view @tap.stop="$util.goUrl({ url: `/technician/pages/income/index` })"
					class="flex-between pd-lg b-1px-b">
					<view>
						<view>服务收入(元)</view>
						<view class="f-md-title c-title">{{ coach_info.service_price || 0 }}</view>
					</view>
					<view class="cash-btn flex-center f-paragraph radius"
						:style="{ color: primaryColor, border: `1rpx solid ${primaryColor}` }">去提现</view>
				</view>
				<view @tap.stop=" $util.goUrl({ url: `/user/pages/cash-out?type=carfee` }) "
					class="flex-between pd-lg b-1px-b">
					<view>
						<view>车费(元)</view>
						<view class="f-md-title c-title">{{ coach_info.car_price || 0 }}</view>
					</view>
					<view class="cash-btn flex-center f-paragraph radius"
						:style="{ color: primaryColor, border: `1rpx solid ${primaryColor}` }">去提现</view>
				</view>
				<view @tap.stop=" $util.goUrl({ url: `/technician/pages/income/car-fee-record` }) "
					class="flex-between pt-md pb-md pr-lg f-paragraph">
					<view></view>
					<view class="flex-y-center">提现记录<i class="iconfont icon-right"></i></view>
				</view>
			</view>

			<view class="mine-menu-list box-shadow fill-base radius-16">
				<view class="menu-title flex-between pl-lg pr-sm b-1px-b">
					<view class="f-paragraph c-title text-bold">我的订单</view>
				</view>
				<view class="flex-warp pt-lg pb-lg">
					<view @tap.stop="toJump('orderList2', index)"
						class="item-child flex-center flex-column f-caption c-paragraph" style="width: 33.3%"
						v-for="(item, index) in orderList2" :key="index">
						<view class="item-img rel flex-center radius">
							<view class="item-img radius abs" :style="{background:primaryColor}"></view>
							<i class="iconfont c-title" :class="item.icon" :style="{color:primaryColor}"></i>
						</view>
						<view class="mt-sm">{{ item.text }}</view>
					</view>
				</view>
			</view>

			<view class="mine-tool-list box-shadow fill-base radius-16">
				<view @tap.stop="toJump('toolList2', index)" class="list-item pt-lg pb-lg ml-lg mr-lg flex-center"
					:class="[{ 'b-1px-t': index != 0 }]" v-for="(item, index) in toolList2" :key="index">
					<i class="iconfont" :class="item.icon" :style="{color:primaryColor}"></i>
					<view class="flex-1 flex-between ml-md">
						<view class="f-paragraph c-title">{{ item.text }}</view>
						<block v-if="item.url == 'change'">
							<i class="iconfont icon-switch c-caption"></i>
						</block>
						<i class="iconfont icon-right" v-else></i>
					</view>
				</view>
			</view>
		</block>

 
		<view @tap.stop="toHelp" class="fix help-img-info f-caption c-base"
			:style="{bottom:`${configInfo.tabbarHeight + 15}px`}" v-if="mineInfo.coach_status == 2">
			<view class="bg-img radius abs" :style="{background:primaryColor}">
			</view>
			<view class="help-info flex-center abs">
				<view class="help-img radius flex-center flex-column" :style="{background:primaryColor}">
					<i class="iconfont iconjingbao"></i>
					<view class="f-icontext">一键求救</view>
				</view>
			</view>
		</view>

		<view :class="[{'space-max-footer':mineInfo.coach_status == 2},{'space-footer':mineInfo.coach_status != 2}]">
		</view>

		<view :style="{height: `${configInfo.tabbarHeight}px`}"></view>
		<tabbar :cur="3"></tabbar>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from "vuex"
	import tabbar from "@/components/tabbar.vue"
	export default {
		components: {
			tabbar
		},
		data() {
			return {
				options: {},
				// 我的订单
				orderList: [{
					icon: 'icondaizhifu',
					text: '待支付',
					url: '/pages/order?tab=1'
				}, {
					icon: 'icondaifuwu',
					text: '待服务',
					url: '/pages/order?tab=2'
				}, {
					icon: 'iconanmo2',
					text: '服务中',
					url: '/pages/order?tab=3'
				}, {
					icon: 'icondaipingjia',
					text: '待评价',
					url: '/pages/order?tab=4'
				}, {
					icon: 'icontuikuan',
					text: '退款/售后',
					url: '/user/pages/refund/list'
				}],
				orderList2: [{
					icon: 'icondaijiedan',
					text: '待接单',
					url: '/technician/pages/order/list'
				}, {
					icon: 'iconyijiedan',
					text: '待服务',
					url: '/technician/pages/order/list?tab=1'
				}, {
					icon: 'iconfuwuzhong',
					text: '服务中',
					url: '/technician/pages/order/list?tab=2'
				}],
				// 分享赚钱
				distributionList: [{
					icon: 'iconwodeshouyi',
					text: '我的收益',
					url: '/user/pages/distribution/income'
				}, {
					icon: 'icontuiguanghaibao',
					text: '推广海报',
					url: '/user/pages/distribution/poster'
				}, {
					icon: 'iconwodetuandui1',
					text: '我的粉丝',
					url: '/user/pages/distribution/team'
				}, {
					icon: 'iconbangdingjishi',
					text: '绑定技师',
					url: '/user/pages/distribution/bind-technician'
				}],
				distributionApplyList: [{
					icon: 'iconwodeshouyi',
					text: '申请分销商',
					url: '/user/pages/distribution/apply'
				}, {
					icon: 'iconbangdingjishi',
					text: '绑定技师',
					url: '/user/pages/distribution/bind-technician'
				}],
				toolList: [ {
					icon: '../static/dizhi.png',
					text: '地址管理',
					url: '/user/pages/address/list'
				},{
					icon: '../static/guanzhu.png',
					text: '我的关注',
					url: '/user/pages/collect',
				}, 
				// {
				// 	icon: 'iconlianxikefu',
				// 	text: '联系客服',
				// 	url: ''
				// },
				{
					icon: '../static/gongg.png',
					text: '官方公告',
					url: '/user/pages/gonggao/list'
				},
				{
					icon: '../static/tousu.png',
					text: '投诉管理',
					url: ''
				},
				{
					icon: '../static/yaoq.png',
					text: '邀请好友',
					url: ''
				},
				],
				toolList2: [{
					icon: 'iconshenqingjishi',
					text: '编辑资料',
					url: '/technician/pages/apply?is_edit=1'
				}, {
					icon: 'iconshijianguanli',
					text: '时间管理',
					url: '/technician/pages/time-manage'
				}, {
					icon: 'iconqiehuanjishiduan',
					text: '切换用户端',
					url: 'change'
				}],
				image_type: {
					1: 'user_image',
					2: 'coach_image'
				},
				font_type: {
					1: 'user_font_color',
					2: 'coach_font_color'
				},
				coach_info: {},
				showAuth: false,
				offsetL: 360,
				offsetT: 0
			}
		},
		computed: mapState({
			primaryColor: state => state.config.configInfo.primaryColor,
			subColor: state => state.config.configInfo.subColor,
			configInfo: state => state.config.configInfo,
			commonOptions: state => state.user.commonOptions,
			userInfo: state => state.user.userInfo,
			userPageType: state => state.user.userPageType,
			mineInfo: state => state.user.mineInfo,
		}),
		onLoad(options) {
			this.options = options
			let {
				type = 0
			} = options
			if (type) {
				this.updateUserItem({
					key: 'userPageType',
					val: type
				})
			}
			if (!this.mineInfo.id) {
				this.$util.showLoading()
			}
			this.initIndex()
		},
		onPullDownRefresh() {
			// #ifndef APP-PLUS
			uni.showNavigationBarLoading()
			// #endif
			this.initRefresh();
			uni.stopPullDownRefresh()
		},
		methods: {
			...mapActions(['getConfigInfo', 'getMineInfo', 'getAuthUserProfile', 'updateCommonOptions', 'toPlayAudio']),
			...mapMutations(['updateUserItem']),
			async initIndex(refresh = false) {
				// #ifdef H5
				// if (!refresh && this.$jweixin.isWechat()) {
				// 	await this.$jweixin.initJssdk();
				// 	this.$jweixin.wxReady(() => {
				// 		this.$jweixin.hideOptionMenu()
				// 	})
				// }
				// #endif

				if (!this.configInfo.id || refresh) {
					await this.getConfigInfo()
				}
				await this.getMineInfo()
				this.$util.setNavigationBarColor({
					bg: this.primaryColor
				})

				let {
					fx_check
				} = this.configInfo
				let {
					coach_status,
					fx_status
				} = this.mineInfo

				let val = this.$util.deepCopy(this.mineInfo)
				val.is_fx = !fx_check || (fx_check && fx_status == 2)
				this.updateUserItem({
					key: 'mineInfo',
					val
				})
				this.updateUserItem({
					key: 'userPageType',
					val: coach_status == 2 || coach_status == 3 ? this.userPageType : 1
				})

				// let arr = ['coach_status', 'channel_status']
				let arr = ['coach_status']
				let textArr = {
					coach_status: {
						text: '技师入驻',
						list: {
							icon: '../static/ruzhu.png',
							text: '技师入驻',
							url: '/user/pages/apply'
						}
					},
					// channel_status: {
					// 	text: '申请渠道商',
					// 	list: {
					// 		icon: '../static/ruzhu.png',
					// 		text: '申请渠道商',
					// 		url: '/user/pages/channel/apply'
					// 	},
					// 	list2: {
					// 		icon: '../static/ruzhu.png',
					// 		text: '我是渠道商',
					// 		url: '/user/pages/channel/income'
					// 	}
					// }
				}
				arr.map(item => {
					if (this.mineInfo[item] != 2) {
						let arr = this.toolList.filter(aitem => {
							return aitem.text === textArr[item].text
						})
						if (arr.length === 0) {
							this.toolList.push(textArr[item].list)
						}
						// if (item === 'channel_status') {
						// 	let aindex = this.toolList.findIndex(aitem => {
						// 		return aitem.text === '我是渠道商'
						// 	})
						// 	if (aindex != -1) {
						// 		this.toolList.splice(aindex, 1)
						// 	}
						// }
					} else {
						this.toolList.map((aitem, aindex) => {
							if (aitem.text === textArr[item].text) {
								this.toolList.splice(aindex, 1)
							}
						})
						// if (item === 'channel_status') {
						// 	let arr = this.toolList.filter(aitem => {
						// 		return aitem.text === '我是渠道商'
						// 	})
						// 	if (arr.length === 0) {
						// 		this.toolList.unshift(textArr[item].list2)
						// 	}
						// }
					}
				})

				if (coach_status == 2 || coach_status == 3) {
					await this.getCoachInfo()
				}
				this.$util.hideAll()
			},
			initRefresh() {
				this.initIndex(true)
			},
			async getCoachInfo() {
				this.coach_info = await this.$api.technician.coachInfo()
			},
			// 更新用户信息
			async authUserProfile(e) {
				// #ifdef APP-PLUS
				uni.getUserInfo({
					provider: 'weixin',
					success: res => {
						let {
							userInfo = {}
						} = res
						this.toUpdateUserInfo(userInfo)
					}
				})
				// #endif
				// #ifndef APP-PLUS
				uni.getUserProfile({
					desc: '用于完善个人资料', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
					success: (res) => {
						let {
							userInfo = {},
								encryptedData,
								iv,
						} = res
						let param = Object.assign({}, userInfo, {
							encryptedData,
							iv,
						});
						this.toUpdateUserInfo(param)
					},
					fail: (res) => {
						console.log(res, "=====fail");
						this.toUpdateUserInfo()
					}
				})
				// #endif
			},
			async toUpdateUserInfo(userInfo = {}) {
				let {
					pMust
				} = this
				if (userInfo.nickName) {
					this.$util.showLoading({
						title: '更新中'
					})
					let {
						coupon_atv_id = 0
					} = this.commonOptions
					userInfo.coupon_atv_id = coupon_atv_id
					await this.getAuthUserProfile(userInfo)
					setTimeout(() => {
						this.$util.hideAll()
					}, 1000)
				}
			},
			// 选择地区
			async toChooseLocation(e) {
				await this.$util.checkAuth({
					type: 'userLocation'
				})
				let [, {
					address = '',
					longitude,
					latitude
				}] = await uni.chooseLocation();
				if (!address) return
				await this.$api.technician.coachUpdate({
					address,
					lng: longitude,
					lat: latitude
				})
				this.coach_info.address = address
				this.$util.showToast({
					title: `更新成功`
				})
			},
			// 跳转页面
			toJumpAll(key) {
				let url = {
					1: `/pages/order`,
					2: `/technician/pages/order/list`
				}
				let openType = {
					1: `reLaunch`,
					2: `navigateTo`
				}
				this.$util.goUrl({
					url: url[key],
					openType: openType[key]
				})
			},
			toJump(key, index) {
				let {
					url,
					text
				} = this[key][index]
				if (['技师入驻', '申请分销商', '申请渠道商'].includes(text)) {
					this.toApply(text == '技师入驻' ? 1 : text == '申请分销商' ? 2 : 3)
					return
				}
				if (text == '切换用户端') {
					this.toChange()
					return
				}
				if (text == '联系客服') {
					let {
						mobile: url,
						im_type
					} = this.configInfo
					// #ifdef MP-WEIXIN
					if (im_type == 2) return
					// #endif
					this.$util.goUrl({
						url,
						openType: 'call'

					})
					return
				}
				let openType = key == 'orderList' && index !== 4 ? `reLaunch` : 'navigateTo'
				this.$util.log(url,openType)
				this.$util.goUrl({
					url,
					openType
				})
			},
			async toAtv() {
				if (!this.mineInfo.is_atv) {
					this.$util.showToast({
						title: `暂无活动`
					})
					return
				}
				let options = this.commonOptions
				options.coupon_atv_id = 0
				await this.updateCommonOptions(options)
				this.$util.goUrl({
					url: `/user/pages/coupon/share`
				})
			},
			// 申请技师/分销商/渠道商
			async toApply(type) {
				let {
					coach_status = -1,
						fx_status = -1,
						channel_status = -1
				} = this.mineInfo
				let status = type == 1 ? coach_status : type == 2 ? fx_status :
					channel_status
				let page = {
					1: `/technician/pages/apply`,
					2: `/user/pages/distribution/apply`,
					3: `/user/pages/channel/apply`
				}
				// -1未申请，1审核中，2审核通过，3取消授权，4审核失败
				let url = status == -1 ? page[type] :
					`/user/pages/apply-result?type=${type}`
				this.$util.log(url)
				this.$util.goUrl({
					url
				})
			},
			// 切换用户/技师端
			async toChange() {
				let {
					userPageType = 1
				} = this
				if (userPageType == 2) {
					await this.getCoachInfo()
				}
				this.updateUserItem({
					key: 'userPageType',
					val: userPageType == 2 ? 1 : 2
				})
			},
			onChange(e) {
				let {
					x,
					y
				} = e.detail
				this.$nextTick(() => {
					this.offsetL = x
					this.offsetT = y
				})
			},
			// 求助
			async toHelp() {
				await this.$api.technician.police()
				this.$util.showToast({
					title: `求救成功`
				})
			}
		}
	}
</script>

<style lang="scss">
	.f_r_sb_c {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.pages-mine {
		.usercontent{
			position: relative;
			height: 640upx;
			background: linear-gradient(138deg, #0CC86E, #03B385);
			.mine{
				font-size: 36upx;
				font-family: Alibaba PuHuiTi;
				font-weight: 400;
				color: #FFFFFF;
				margin-top:82upx;
				margin-bottom:30rpx;
				width:100%;
				text-align: center;
				position:relative
			}
			.myContent{
				display: flex;
				align-items: center;
				flex-direction: column;
				justify-content: space-between;
			}
		}
		.notice-item{
			position: absolute;
			top:6upx;
			right:24rpx;
		}
		.mine-bg {
			width: 100%;
			height: 368rpx;
			z-index: 0;
		}

		.mine-master-bg {
			width: 100%;
			height: 514rpx;
			z-index: -1;
		}

		.avatar_view {
			width: 140rpx;
			height: 140rpx;
			position: relative;
			
			.avatar {
				width: 140rpx;
				height: 140rpx;
				overflow: hidden;

				open-data {
					width: 140rpx;
					height: 140rpx;
				}
			}

			.text {
				width: 110rpx;
				position: absolute;
				bottom: -5rpx;
				left: 5rpx;
				height: 36rpx;
				line-height: 36rpx;
				background: #FFFFFF;
				border-radius: 18rpx;
				color: #A40035;
				font-size: 24rpx;
				text-align: center;
			}
		}
		.uerInfoContent{
			display: flex;
			flex-direction: column;
			align-items: center;
		}

		.member-tag {
			min-width: 168rpx;
			height: 42rpx;
			background: rgba(255, 255, 255, 0.5);
			margin-right:20rpx;
			color:#ffffff;
			.iconfont {
				font-size: 28rpx;
			}
		}
		.chongzhi{
			padding:22rpx 41rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			background: rgba(255,255,255,0.16);
			// opacity: 0.16;
			margin:0 24rpx;
			margin-top:35rpx;
			border-radius: 38rpx;
			text{
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
			}
			image{
				width:44rpx;
				height:44rpx;
			}
		}
		.wallet{
			
			background: #FFFFFF;
			box-shadow: 0px 4px 10px 0px rgba(53,107,194,0.06);
			border-radius: 30rpx;
			padding:40rpx 0;
			margin:0 24rpx;
			position: relative;
			margin-top:-70rpx;
		}
		.icon-shuaxin,
		.icon-xitong {
			font-size: 40rpx;
		}

		.share-img {
			width: 86rpx;
			height: 86rpx;
		}

		.mine-count-list {
			.cancel-auth {
				width: 110rpx;
				height: 100rpx;
				font-size: 100rpx;
				top: 100rpx;
				left: 150rpx;

				.text-bold {
					height: 26rpx;
					transform: rotate(-32deg);
				}
			}

			.cash-btn {
				width: 138rpx;
				height: 52rpx;
				transform: rotateZ(360deg);
			}

			.icon-right {
				font-size: 28rpx;
			}
		}

		.share-list {
			.coupon-img {
				width: 97rpx;
				height: 87rpx;
			}

			.item-icon {
				width: 70rpx;
				height: 70rpx;

				.iconfont {
					font-size: 38rpx;
				}

				.item-icon {
					top: 0;
					left: 0;
					opacity: 0.1;
				}
			}
		}

		.mine-menu-list {
			margin: 20rpx 30rpx 0 30rpx;

			.menu-title {
				height: 90rpx;

				.iconfont {
					font-size: 24rpx;
				}
			}

			.item-child {
				width: 20%;
				margin: 10rpx 0;

				.iconfont {
					font-size: 52rpx;
				}

				.item-img {
					width: 88rpx;
					height: 88rpx;

					.iconfont {
						font-size: 44rpx;
					}

					.item-img {
						top: 0;
						left: 0;
						opacity: 0.1;
					}
				}

			}
		}

		.mine-tool-list {
			margin: 20rpx 30rpx 0 30rpx;
			box-shadow: 0px 3px 6px 0px rgba(227, 227, 227, 0.47);

			.list-item {
				.iconfont {
					font-size: 42rpx;
				}

				.icon-right {
					font-size: 28rpx;
				}

				.icon-switch {
					font-size: 70rpx;
					line-height: 48rpx;
				}
			}

			.list-item.b-1px-t:before {
				left: 60rpx;
			}
		}

		.help-img-info {
			width: 130rpx;
			height: 130rpx;
			right: 30rpx;
			
			.bg-img {
				width: 130rpx;
				height: 130rpx;
				opacity: 0.4;
				top: 0;
				left: 0;
			}

			.help-info {
				width: 130rpx;
				height: 130rpx;
				opacity: 1;
				top: 0;
				left: 0;

				.help-img {
					width: 118rpx;
					height: 118rpx;

					.iconfont {
						font-size: 44rpx;
						margin-bottom: 4rpx;
					}
				}
			}


		}
	}
</style>
