<template>
	<view class="therapist">
		<view class="padding-lr padding-top-sm " style="width: 100%;padding-bottom: 10rpx;">
			<view v-if="XCXIsSelect !='否'" class="flex margin-right-sm" @tap="showCityList" style="line-height: 68rpx;">
				<image src="../../static/images/address.png" style="width: 40rpx;height: 40rpx;" class="margin-top-xs">
				</image>
				<view class="localName  margin-left-sm">{{city}}</view>
			</view>
			<u-search class="flex-sub search" clearabled placeholder="请输入商家名字" :focus="false" v-model="artificerName"
				:show-action="true" :animation="true" bg-color="#F7F7F7" color="#1A1A1A" @search="onSearch()"
				action-text="搜索" @custom="onSearch()"></u-search>
			<!-- <u-search style="width: 100%;" placeholder="搜索需要的师傅" :focus="true" v-model="keyword" :show-action="true"
				:animation="true" shape="square" bg-color="#F7F7F7" color="#1A1A1A" action-text="取消" @custom="goBack()"
				@search="doSearch(false)"></u-search> -->
		</view>

		<!-- 	<view class="bg flex justify-between padding">
			<view class="" v-for="(item,index) in tablist" :key="index" :class="tabIndex==item.id?'actve':''"
				@click="tanChange(item.id)">
				{{item.value}}
			</view>
		</view>
		<view class="bg flex align-center justify-between padding-lr padding-bottom">
			<view v-for="(item,index) in list" :key="index" @click="change(index)"
				:style="listIndex==index?'color:#20C675;font-size:30rpx;':''">
				{{item.name}}
			</view>
		</view> -->

		<view class="tabview1" v-if="XCXIsSelect != '否'">
			<!-- <view class="tabview" v-if="tablist && tablist.length > 1">
				<view v-for="(item,index) in tablist" :key="index" @tap="tanChange(index,item)"
					:class="tabIndex == item.id ? 'tabItem_sel' : 'tabItem'">
					<view>{{item.value}}</view>
				</view>
				
			</view> -->
			<!-- <view class="tabsx">
				<view v-for="(item,index) in list" :key="index" :class="listIndex==index?'active':''"
					@click="change(index)">{{item.name}}</view>
			</view> -->
			<view class="icon-box" style="margin-right: 50rpx;" @tap="tanChange(-1,0)">
				<view style="font-weight: 700;"
					:style="{color:tabIndex == -1?'#FF6E98':'',fontSize:tabIndex==-1?'36rpx':'32rpx'}">
					全部</view>
				<view style="height: 32rpx;display: flex;justify-content: center;">
					<svg t="1761021751826" v-show="tabIndex== -1" class="icon" viewBox="0 0 2970 1024" version="1.1"
						xmlns="http://www.w3.org/2000/svg" p-id="4553" width="24" height="24">
						<path
							d="M1483.968134 1024A1945.340076 1945.340076 0 0 1 65.537898 403.558292a245.597905 245.597905 0 0 1 0-334.217817 214.898167 214.898167 0 0 1 316.002639 0 1501.114864 1501.114864 0 0 0 2204.752863 0 214.898167 214.898167 0 0 1 316.002638 0 245.597905 245.597905 0 0 1 0 334.217817A1945.237743 1945.237743 0 0 1 1483.968134 1024z"
							fill="#FF6E98" p-id="4554"></path>
					</svg>
				</view>
			</view>
			<view class="icon-box" style="margin-right: 50rpx;" v-for="(item,index) in tablist"
				@tap="tanChange(index,item)">
				<view style="font-weight: 700;"
					:style="{color:tabIndex == item.id?'#FF6E98':'',fontSize:tabIndex==item.id?'36rpx':'32rpx'}">
					{{item.value}}
				</view>
				<view style="height: 32rpx;display: flex;justify-content: center;">
					<svg t="1761021751826" v-show="tabIndex == item.id" class="icon" viewBox="0 0 2970 1024" version="1.1"
						xmlns="http://www.w3.org/2000/svg" p-id="4553" width="24" height="24">
						<path
							d="M1483.968134 1024A1945.340076 1945.340076 0 0 1 65.537898 403.558292a245.597905 245.597905 0 0 1 0-334.217817 214.898167 214.898167 0 0 1 316.002639 0 1501.114864 1501.114864 0 0 0 2204.752863 0 214.898167 214.898167 0 0 1 316.002638 0 245.597905 245.597905 0 0 1 0 334.217817A1945.237743 1945.237743 0 0 1 1483.968134 1024z"
							fill="#FF6E98" p-id="4554"></path>
					</svg>
				</view>
			</view>
		</view>
		<view v-if="orderList.length" class="list" :style="XCXIsSelect != '否' ? '' : 'margin-top: 114rpx;'">
			<view class="flex align-center margin-bottom-sm bg padding-sm radius margin-sm"
				v-for="(item,index) in orderList" :key='index' @click="goOrder(item)"
				style="box-shadow: 6rpx 10rpx 4px #F5F5F5;position: relative;">
				<view style="position: absolute;z-index: 99;top: 0rpx;left: 0;" v-if="item.isGoods == 1">
					<image src="/static/image/text_you.png" style="width: 42rpx;height: 36rpx;"></image>
				</view>
				<view
					style="width:160rpx;height:190upx;border-radius: 10rpx;display: flex;flex-direction: column;align-items: center;">
					<image :src="item.artificerImg?item.artificerImg: '../../static/logo.png'"
						@click.stop="saveImgs(item.artificerImg)"
						style="width: 160rpx;height: 160rpx;border-radius: 50%;" mode="aspectFill"></image>
					<image v-if="item.isHot == 1" src="/static/image/icon_fire.png"
						style="width: 30rpx;height: 36rpx;position: absolute;z-index: 99;top: 40rpx;left: 110rpx;">
					</image>
					<view class="kyy_view" v-if="item.state == 1">可服务</view>
					<view class="kfw_view" v-else-if="item.state == 2">可预约</view>
					<view class="byy_view" v-else>休息中</view>
				</view>
				<view class="margin-left  flex flex-direction" style="width: 85%;">
					<view class="flex align-center justify-between">
						<view class="flex align-center">
							<view class="text-bold text-30 margin-right-xs jishi_name">{{item.artificerName}}</view>
							<!-- 		<image
								src="/static/image/icon_pao.png"
								style="width: 40rpx;height:40rpx;">
							</image> -->
							<view class="zpmore_view" v-if="item.lifePhoto" @click.stop="saveImgss(item.lifePhoto,0)">
								更多照片</view>
						</view>
						<view class="zz_view" v-if="item.status == 1 && item.time">
							<view class="zz_label">
								最早可约
							</view>
							<view class="zz_value">
								{{item.time}}
							</view>
						</view>
					</view>
					<view class="flex justify-between " style="margin:15rpx 0rpx 20rpx">
						<view class="flex align-center">
							<view v-if="item.ordersScore" class="flex margin-right-sm">
								<text style="color: #FCAD3D;">{{item.ordersScore}}</text>
								<u-rate activeColor="#FCAD3D" size="20rpx" :count="5"
									v-model="item.ordersScore"></u-rate>
							</view>

						</view>

						<view class="flex align-center" style="font-size: 26rpx;color: #f49650;font-weight: bold;"
							v-if="item.tripWay == 3">
							免出行费
						</view>
					</view>
					<view class="flex align-center" style="color: #AAAAAA;font-size: 24rpx;">
						<view class="flex align-center">已服务:
							<view style="color: #FF6E98;margin-left: 8rpx;">
								{{item.ordersCount}}单
							</view>
						</view>
						<view class="flex align-center" style="margin-left: 24rpx;" v-if="item.tripWay != 3">
							距您
							<view style="color: #FF6E98;margin-left: 8rpx;">{{item.distance}}</view>
						</view>
					</view>

					<view style="width: 100%;display: flex;justify-content: space-between;align-items: center;"
						v-if="XCXIsSelect !='否'">
						<view class="flex flex-wrap align-center" style="margin-top: 10rpx;">
							<image src="/static/image/icon_shang.png" style="width: 24rpx;height: 24rpx;"></image>
							<view style="margin-left: 10rpx;color: #999;font-size: 24rpx;margin-right: 24rpx;">商家</view>
							<image src="/static/image/icon_ping.png" style="width: 24rpx;height: 24rpx;"></image>
							<view style="margin-left: 10rpx;color: #999;font-size: 24rpx;margin-right: 24rpx;">
								{{item.commentCount ? item.commentCount : 0}}
							</view>
							<image src="/static/image/icon_cang.png" style="width: 24rpx;height: 24rpx;"></image>
							<view style="margin-left: 10rpx;color: #999;font-size: 24rpx;">
								{{item.collectCount ? item.collectCount : 0}}
							</view>
						</view>
						<view class="text-center text-sm" v-if="item.status == 1"
							style="background: linear-gradient( 313deg, #FFE6EE 0%, #FFBACA 100%);color: #222222;width: 160rpx;border-radius: 36rpx;line-height: 64rpx;font-weight: bold;position: relative;"
							@click.stop="goOrder(item)">
							立即预约
							<image style="position: absolute;width: 39rpx;height: 39rpx;top: -4rpx;right: -8rpx;"
								src="../../static/image/btn-icon.png" mode=""></image>
						</view>
						<view class="text-center text-sm" v-else
							style="background: #d9d9d9;color: #222222;width: 160rpx;border-radius: 36rpx;line-height: 64rpx;font-weight: bold;position: relative;">
							立即预约
							<image style="position: absolute;width: 39rpx;height: 39rpx;top: -4rpx;right: -8rpx;"
								src="../../static/image/btn-icon.png" mode=""></image>
						</view>
					</view>
				</view>
			</view>
		</view>
		<empty v-if="orderList.length == 0"></empty>
		<view style="position: fixed;z-index: 999;bottom: 160rpx;" v-if="showTP">
			<image src="/static/image/city_open.png" style="width: 690rpx;margin: 30rpx;height: 600rpx;"></image>
			<view
				style="position: absolute;bottom: 100rpx;width: 100%;text-align: center;display: flex;justify-content: center;">
				<view>
					<view style="color: #333333;font-size: 28rpx;"><text
							style="font-size: 44rpx;color:#ee6c54">{{tpCount}}</text>人已投票</view>
					<view class="tp_view" v-if="tpSel == 2" @tap="saveTP">投票</view>
					<view class="ytp_view" v-if="tpSel == 1">已投票</view>
				</view>
			</view>
		</view>
		<!-- 经验筛选 -->
		<u-select v-model="Cityshow" :list="cityList" @confirm="getCity"></u-select>
		<!-- <u-skeleton :loading="loading" :animation="true" elColor='#FFFFFF' bgColor='#FFFFFF'></u-skeleton> -->
	</view>
</template>

<script>
	import meTabs from "@/components/mescroll-uni/me-tabs/me-tabs.vue";
	import empty from '@/components/empty.vue'
	import RenDropdownFilter from '@/components/ren-dropdown-filter/ren-dropdown-filter.vue'
	// 调用手机系统权限
	// #ifdef APP-PLUS
	import permision from "@/components/permission.js";
	// #endif
	export default {
		components: {
			meTabs,
			empty,
			RenDropdownFilter
		},
		data() {
			return {
				artificerName: '',
				tpSel: 0,
				tpCount: 0,
				showTP: false,
				Cityshow: false,
				loading: true, // 是否显示骨架屏组件
				defaultSelected: [],
				value1: '',
				value2: '',
				value3: '',
				game: [],
				defaultIndex: [0, 0, 0],
				filterData: [
					[{
						label: '推荐',
						value: '',
					}],
					[{
							label: '服务热度',
							value: '0',
						},

						{
							label: '从高到低',
							value: '1',
						},
						{
							label: '从低到高',
							value: '2',
						}
					],
					[{
							label: '距离',
							value: '0',
						},
						{
							label: '从远到近',
							value: '2',
						},
						{
							label: '从近到远',
							value: '1',
						}
					],
				],
				list: [{
					name: '综合',
					id: 1
				}, {
					name: '距离',
					id: 2
				}, {
					name: '销量',
					id: 3
				}, {
					name: '好评',
					id: 4
				}],
				listIndex: 0,
				city: '请选择城市',
				latitude: '',
				longitude: '',
				orderList: [],
				page: 1,
				limit: 10,
				token: '',
				XCXIsSelect: '否',
				isVip: false,
				myId: uni.getStorageSync('userId') ? uni.getStorageSync('userId') : '',
				showModal: true,
				arr: [],
				tab: '',
				massageTypeId: '',
				cityList: [],
				tablist: [],
				tabIndex: -1,

				orderIndex: 0
			}
		},
		onLoad(e) {
			console.log(e.massageTypeId)
			let that = this
			that.massageTypeId = e.massageTypeId
			uni.getLocation({
				type: 'gcj02',
				geocode: true, //设置该参数为true可直接获取经纬度及城市信息
				success: function(res) {
					console.log(res, '地理位置')
					that.latitude = res.latitude
					that.longitude = res.longitude

					that.page = 1
					that.getTypeList();

				},
				fail: function() {
					console.log('获取地址失败')

					// #ifdef APP-PLUS
					that.checkPermission();
					// #endif
				}
			})

			// 获取邀请码保存到本地
			if (e.invitation) {
				that.$queue.setData('inviterCode', e.invitation);
			}

			if (this.myId) {
				that.$Request.getT('/app/common/type/235').then(res => { //报名成功通知
					if (res.code == 0) {
						if (res.data && res.data.value) {
							that.arr.push(res.data.value)
						}
					}
				})
				that.$Request.getT('/app/common/type/236').then(res => { //活动即将开始提醒
					if (res.code == 0) {
						if (res.data && res.data.value) {
							that.arr.push(res.data.value)
						}
					}
				})
			}
		},
		onShow() {
			let that = this
			that.getKTCityList();
			that.XCXIsSelect = this.$queue.getData("XCXIsSelect");
			that.city = uni.getStorageSync('city') ? uni.getStorageSync('city') : '请选择城市'
			that.getTpCount();
			that.getTpMy();
			that.token = uni.getStorageSync('token')
			// if (uni.getStorageSync('token')) {
			if (that.latitude && that.longitude) {
				that.page = 1
				that.getlist()
			} else {
				uni.getLocation({
					type: 'gcj02',
					geocode: true, //设置该参数为true可直接获取经纬度及城市信息
					success: function(res) {
						console.log(res, '地理位置')
						that.latitude = res.latitude
						that.longitude = res.longitude
						that.getTypeList();
					},
					fail: function() {
						that.getTypeList();
						console.log('获取地址失败')
					}
				})
			}
			// }
			that.myId = uni.getStorageSync('userId')
			// console.log(that.showModal, '------', that.myId)
			// #ifdef MP-WEIXIN
			//订阅
			if (that.myId) {
				that.getIsVip()
				if (this.showModal) {
					// this.openMsg()
				}
			}
			// #endif
		},
		methods: {
			showCityList() {
				// #ifdef APP-PLUS
				if (this.latitude === '' || this.longitude === '') {
					this.checkPermission();
					return;
				}
				// #endif
				this.Cityshow = true;
			},
			async checkPermission() {
				let status = permision.isIOS ? await permision.requestIOS('location') : await permision.requestAndroid(
					'android.permission.ACCESS_FINE_LOCATION');
				if (status === null || status === 1) {
					status = 1;
				} else if (status === 2) {
					uni.showModal({
						content: "系统定位已关闭",
						confirmText: "确定",
						showCancel: false,
						success: function(res) {}
					})
				} else if (status.code) {
					uni.showModal({
						content: status.message
					})
				} else {
					uni.showModal({
						title: '定位服务已关闭',
						content: "您需要打开定位权限，否则我们将无法获得到您附近的项目服务，导致我们无法为您提供服务，请到>设置>隐私>定位服务>中开启【上门服务】定位权限",
						confirmText: "设置",
						success: function(res) {
							if (res.confirm) {
								permision.gotoAppSetting();
							}
						}
					})
				}
				return status;
			},
			saveImgss(imgs, index) {
				console.log(imgs, index)
				// let that = this
				let imgArr = imgs
				// this.imgArr.push(imgs);
				// console.log(this.imgArr)
				// //预览图片
				uni.previewImage({
					urls: imgArr,
					current: imgArr[index]
				});
			},
			saveImgs(imgs) {
				let imgArr = [];
				imgArr.push(imgs);
				// //预览图片
				uni.previewImage({
					urls: imgArr,
					current: 0
				});
			},
			saveTP() {
				if (!this.token) {
					uni.navigateTo({
						url: '/pages/public/login'
					});
					return;
				}
				let userId = this.$queue.getData('userId');
				let userName = this.$queue.getData('userName');
				this.$queue.showLoading('投票中...');
				this.$Request.postJson('/app/message/insertMessage', {
						state: 11,
						content: this.city,
						userName: userName,
						userId: userId
					})
					.then(res => {
						if (res.code === 0) {
							uni.showToast({
								title: '投票成功！'
							});
							this.getTpCount();
							this.getTpMy();
						} else {
							uni.hideLoading();
							uni.showModal({
								showCancel: false,
								title: '投票失败',
								content: res.msg
							});
						}
					});
			},
			getTpMy() {
				this.$Request.getT('/app/message/selectMessageByUserId?page=1&limit=1&state=11').then(res => {
					if (res.code == 0) {
						if (res.data && res.data.list && res.data.list.length > 0) {
							this.tpSel = 1;
						} else {
							this.tpSel = 2;
						}
					}
				});
			},
			getTpCount() {
				this.$Request.getT('/app/message/selectCityCount?city=' + this.city).then(res => {
					if (res.code == 0) {
						this.tpCount = res.data ? res.data : 0;
					}
				});
			},
			getCity(e) {
				console.log(e[0].label);
				this.city = e[0].label;
				uni.setStorageSync('city', this.city)
				this.getKTCityList();
				this.page = 1
				this.getlist()
			},
			getKTCityList() {
				let cityName = uni.getStorageSync('city') ? uni.getStorageSync('city') : '请选择城市'
				// if (cityName === '请选择城市') {
				// 	return;
				// }
				this.$Request.getT('/app/trip/selectTripList').then(res => {
					if (res.code == 0) {
						this.cityList = [];
						let isOpen = false
						res.data.forEach((d, index) => {
							if (cityName === d.city) {
								isOpen = true;
							}
							let data = {}
							data.label = d.city
							data.value = index
							this.cityList.push(data);
						});

						if (!isOpen) {
							this.orderList = []
							this.showTP = true;
							// uni.showToast({
							// 	title: '当前城市暂未开通，请切换城市',
							// 	duration: 2000,
							// 	icon: 'none'
							// });
						} else {
							this.showTP = false;
						}
					}
				});
			},
			getTypeList() {
				this.$Request.get("/app/dict/list", {
					type: '服务类型'
				}).then(res => {
					if (res.code == 0) {
						if (res.data) {
							this.tablist = res.data
							console.log(res.data, '数据');
							// this.tabIndex = res.data[0].id;
							this.page = 1;
							this.getlist()
						}
					}
				});
			},
			// selectCity(longitude, latitude) {
			// 	this.$Request.get('/app/Login/selectCity?lat=' + latitude + '&lng=' + 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)
			// 		}
			// 	});
			// },
			tanChange(index, item) {
				this.orderIndex = index
				console.log(index, 'xxxxxxxxxx',item.id);
				
				this.tabIndex = index == -1 ? -1 : item.id
				console.log(this.tabIndex,'sasadasdasdasdasd');
				
				this.page = 1
				this.getlist()
			},
			// 开启订阅消息
			openMsg() {
				console.log('订阅消息')
				var that = this
				uni.getSetting({
					withSubscriptions: true, //是否获取用户订阅消息的订阅状态，默认false不返回
					success(ret) {
						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) {
												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
									}
								}
							})
						}
					}
				})
			},
			getIsVip() {
				this.$Request.get("/app/UserVip/isUserVip").then(res => {
					if (res.code == 0) {
						this.isVip = res.data
						uni.setStorageSync('isVIP', res.data)
					}
				});
			},
			onSearch(e) {
				// this.artificerName = e;
				this.page = 1;
				this.getlist()
			},
			getlist() {
				let that = this
				if (that.city === '请选择城市') {
					return;
				}
				if (that.tabIndex == 0) {
					return;
				}
				// let index = this.list[this.listIndex].id
				let index = 2
				let data = {
					// id: curTab,
					artificerName: that.artificerName,
					classifyId: that.tabIndex == -1 ? 0 : that.tabIndex,
					page: that.page,
					limit: that.limit,
					// condition: this.value1, //智能优选
					// authentication: this.value2, //不限男女
					by: index, //价格
					latitude: that.latitude,
					longitude: that.longitude,
					city: that.city
				}
				// console.log(data)
				that.$Request.get("/app/artificer/selectArtificerList", data).then(res => {
					that.loading = false;
					if (res.code == 0) {
						if (that.page == 1) {
							that.orderList = []
						}
						for (var i = 0; i < res.data.list.length; i++) {
							if (res.data.list[i].lifePhoto) {
								res.data.list[i].lifePhoto = res.data.list[i].lifePhoto.split(',')
							}
							if (res.data.list[i].distance > 1000) {
								res.data.list[i].distance = (res.data.list[i].distance / 1000).toFixed(1) +
									'km'
							} else {
								res.data.list[i].distance = (res.data.list[i].distance).toFixed(1) + 'm'
							}

						}
						if (that.page == 1) {
							that.orderList = res.data.list
						} else {
							that.orderList = [...that.orderList, ...res.data.list]
						}
					}
					uni.stopPullDownRefresh();
				})
			},
			// 切换菜单
			tabChange() {
				if (uni.getStorageSync('sendMsg')) {
					console.log('授权+1')
					wx.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							console.log(JSON.stringify(re), 111111111111)
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								// console.log(re)
							}
						},
						fail: (res) => {
							// console.log(res)
						}
					})
				}
				this.defaultIndex = [0, 0, 0]
				// this.$refs.uDropdown.close();
				this.page = 1
				this.getlist()
			},

			// 筛选
			change(index) {

				// this.value1 = e[0][0].value
				// this.value2 = e[1][0].value
				// this.value3 = e[2][0].value
				this.listIndex = index
				this.page = 1
				this.getlist()
			},
			// 选择城市
			goSelectCity() {
				// uni.navigateTo({
				// 	url: '/pages/index/citys/citys'
				// });
				let that = this
				uni.chooseLocation({
					success: function(res) {
						console.log('位置名称：' + res.name);
						console.log('详细地址：' + res.address);
						console.log('纬度：' + res.latitude);
						console.log('经度：' + res.longitude);
						that.latitude = res.latitude
						that.longitude = res.longitude
						uni.setStorageSync('latitude', res.latitude)
						uni.setStorageSync('longitude', res.longitude)
						that.selectCity(that.longitude, that.latitude);
					}
				});
			},
			selectCity(longitude, latitude) {
				this.$Request.get('/app/Login/selectCity?lat=' + latitude + '&lng=' + longitude).then(res => {
					if (res.code == 0) {
						this.city = res.data.city ? res.data.city : '未知'
						uni.setStorageSync('city', res.data.city)
						this.page = 1
						this.getlist()
					}
				});
			},
			// 乐享低价
			goLowTaking() {
				uni.navigateTo({
					url: '/pages/index/order/lowTaking'
				});
			},
			// 跳转游戏列表
			goNav(url) {
				console.log(url, '1111112333')
				if (uni.getStorageSync('sendMsg')) {
					console.log('授权+1')
					wx.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							console.log(JSON.stringify(re), 111111111111)
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				if (url.indexOf('/pages/') !== -1) {
					uni.navigateTo({
						url
					});
				} else {
					//#ifndef H5
					uni.navigateTo({
						url: '/pages/index/webView?url=' + url
					});
					//#endif
					//#ifdef H5
					window.location.href = url;
					//#endif
				}
			},
			// 跳转搜索
			goSearch(index) {
				if (uni.getStorageSync('sendMsg')) {
					console.log('授权+1')
					wx.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							// console.log(JSON.stringify(re), 111111111111)
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				uni.navigateTo({
					url: '/pages/index/search/index?index=' + index
				});
			},
			// 跳转订单
			goOrder(e) {
				console.log('授权', uni.getStorageSync('sendMsg'))
				if (uni.getStorageSync('sendMsg')) {
					console.log('授权+1')
					wx.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							console.log(JSON.stringify(re), 111111111111)
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				if (this.token) {
					uni.navigateTo({
						url: '/pages/therapist/orderDetail?artificerId=' + e.artificerId
					});
				} else {
					uni.navigateTo({
						url: '/pages/public/login'
					});
				}

			},
		},
		onReachBottom: function() {
			this.page = this.page + 1;
			this.getlist()
		},
		onPullDownRefresh: function() {
			this.page = 1;
			this.getlist()
		},
	}
</script>

<style lang="scss">
	.active {
		color: #FF6E98;
		font-size: 28rpx;
		font-weight: bold;
		padding: 4rpx 15rpx;
		box-sizing: border-box;
		background: linear-gradient(313deg, #FFE6EE 0%, #FFBACA 100%);
		border-radius: 36rpx 36rpx 36rpx 36rpx;
	}

	.normal {
		border-radius: 36rpx 36rpx 36rpx 36rpx;
		background-color: #fff;
		padding: 4rpx 15rpx;
	}

	// page {
	// 	background: linear-gradient( 180deg, #FFE5ED 0%, #F6F6F6 500rpx);
	// 	overflow: hidden;
	// }
	.therapist {
		background: linear-gradient(180deg, #FFE5ED 0%, #F6F6F6 500rpx);
		overflow: hidden;
		height: 100VH;
	}

	.list {
		max-height: 86vh;
		overflow: auto;
		padding-bottom: 200rpx;
	}

	.search ::v-deep .u-content,
	.search ::v-deep input {
		background: #FFFFFF !important;
	}

	.jishi_name {
		max-width: 120rpx;
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
	}

	.zz_view {
		display: flex;
		line-height: 40rpx;
		text-align: center;
		font-size: 24rpx;

		.zz_label {
			width: 120rpx;
			background: #4B2F20;
			border-radius: 32rpx 0 0 32rpx;
			color: #FFFFFF;
		}

		.zz_value {
			width: 88rpx;
			border-radius: 0 32rpx 32rpx 0;
			background: #EECEAC;
			color: #4B2F20;
		}
	}

	.zpmore_view {
		background: #07BF89;
		width: 128rpx;
		height: 40rpx;
		text-align: center;
		border-radius: 32rpx;
		line-height: 40rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		margin-left: 10rpx;
	}

	.byy_view {
		background: #ebebeb;
		width: 120upx;
		text-align: center;
		border-radius: 50rpx;
		height: 46rpx;
		line-height: 46rpx;
		font-size: 24rpx;
		color: #000000;
		// border: 3upx solid #999999;
		margin-top: 6rpx;
	}

	.kfw_view {
		background: #ffaa00;
		width: 120upx;
		text-align: center;
		border-radius: 50rpx;
		height: 46rpx;
		line-height: 46rpx;
		font-size: 24rpx;
		color: #FFFFFF;
		margin-top: 6rpx;
	}

	.kyy_view {
		background: #DCFFEA;
		width: 120upx;
		text-align: center;
		border-radius: 36rpx;
		height: 40rpx;
		line-height: 40rpx;
		font-size: 24rpx;
		color: #54CC84;
	}

	.kyy_view,
	.kfw_view,
	.byy_view {
		margin-top: -10rpx;
		z-index: 9;
	}

	.bg {
		background: #FFFFFF;
	}

	.ytp_view {
		background: #e3e3e3;
		width: 400rpx;
		border-radius: 10rpx;
		font-size: 28rpx;
		text-align: center;
		height: 80rpx;
		line-height: 80rpx;
		color: #848484;
		margin-top: 40rpx;
	}

	.tp_view {
		background: #ee6c54;
		width: 400rpx;
		border-radius: 10rpx;
		font-size: 28rpx;
		text-align: center;
		height: 80rpx;
		line-height: 80rpx;
		color: #FFFFFF;
		margin-top: 40rpx;
	}

	.sticky-tabs {
		z-index: 990;
		position: sticky;
		top: var(--window-top);
		// background-color: #fff;
	}

	/* // 使用mescroll-uni,则top为0 */
	.mescroll-uni,
	/deep/.mescroll-uni {
		.sticky-tabs {
			top: 0;
		}
	}

	.demo-tip {
		padding: 18upx;
		font-size: 24upx;
		text-align: center;
	}

	.line_s {
		display: inline-flex;
		width: 10rpx;
		height: 10rpx;
		background: #1AD566;
		border-radius: 50%;
		margin-right: 10rpx;
	}

	.line_x {
		display: inline-flex;
		width: 10rpx;
		height: 10rpx;
		background: #000000;
		border-radius: 50%;
		margin-right: 10rpx;
	}

	.box {
		// border: 3rpx solid #005dff;
		background: #E8FAE1;
		color: #2FB57A;
		padding: 5rpx 15rpx;
		font-size: 26rpx;
		letter-spacing: 2rpx;
		border-radius: 8rpx;
		// margin-top: 10rpx;
		margin-right: 8upx;
	}

	.actve {
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 800;
		color: #20C675;
	}

	.tabview1 {
		padding: 20rpx 20rpx;
		// width: 686upx;
		// height: 100upx;
		// z-index: 99;
		// display: flex;
		// line-height: 100upx;
		display: flex;

		align-items: center;

		.tabview {
			// width: 686upx;
			// // height: 100upx;
			background: #F2FFF9;
			border-radius: 24rpx 24rpx 0 0;
			// margin-top: -50upx;
			// z-index: 99;
			display: flex;
			line-height: 100upx;

			.tabItem_sel {
				font-size: 30upx;
				font-family: PingFang SC;
				font-weight: 800;
				color: #20C675;
				flex: 1;
				text-align: center;
			}

			.tabItem {
				font-size: 26upx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
				flex: 1;
				text-align: center;
			}
		}

		.tabsx {
			width: 686upx;
			border-radius: 24rpx;
			padding-bottom: 10rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx 30rpx;
			font-size: 26rpx;

			.active {
				color: #20C675;
				font-size: 30rpx;
				font-weight: bold;
			}
		}
	}
</style>