<template>
	<view class="content">
		<view style="padding-top: 1rpx;" v-if="orderList.length">
			<view class="flex align-center margin-bottom-sm bg margin-sm content-list"
				v-for="(item,index) in orderList" :key='index' @click="goOrderDetail(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="https://admin.sjajk.com/file/uploadPath/2023/02/16/c551f3f0721aec54208011e6948a57cd.png"
						style="width: 42rpx;height: 36rpx;"></image>
				</view>
				<view class="content-img">
					<image :src="item.artificerImg?item.artificerImg: '../../static/logo.png'"
						@click.stop="saveImgs(item.artificerImg)"
						 mode="aspectFill"></image>
						
					<image v-if="item.isHot == 1"
						src="https://admin.sjajk.com/file/uploadPath/2023/02/16/9ae1b7e9fa931b5fc24cd8edecc10d9f.png"
						style="width: 30rpx;height: 36rpx;position: absolute;z-index: 99;top: 40rpx;left: 110rpx;">
					</image>
					
					<!--<image class="touxiang-frame"  src="../../static/vip/grade6.png"></image>-->
					<view class="zpmore_view" v-if="item.lifePhoto" @click.stop="saveImgss(item.lifePhoto,0)">更多照片</view>
				</view>
				<view class="flex flex-direction list-right-content" style="width: 100%; margin-left: 8rpx;">
					<view class="flex" style="width: 100%;display: flex;justify-content: space-between;">
						<view class="flex align-center" >
							<view class="flex">
								<span class="text-bold text-30 margin-right-xs">{{item.artificerName}}</span>
								<image class="touxiang-frame" style="width: 100rpx;height: 38rpx;"  :src="item.technicianType=='3'?'../../static/vip/grade1.gif':item.technicianType=='4'?'../../static/vip/grade2.gif':'../../static/vip/grade3.gif'"></image>
								<!-- <span class="label-word">{{item.artificerClassifyList[0].classifyName}}</span> -->
							</view>
							
						</view>
						<view class="keyuyue keyuyue-lan" v-if="item.status == 1">
								<view class="flex">
									<view class="timea-fu">可服务</view>
									<view class="timea-time">{{item.time}}</view>
								</view>
						</view>
						<view class="keyuyue keyuyue-hui" v-else>
							<view class="flex">
								<view class="timea-hui">休息中</view>
							</view>
						</view>
					</view>
					<view class="therapist-mian-top">
						<view class="therap-pin">
							<span>评论</span>
							<span class="therapist-mian-view-text">
								{{ item.commentCount ? item.commentCount : 0 }}
							</span>
						</view>
						<view class="therap-pin">
							<span>收藏</span>
							<span class="therapist-mian-view-text">
								{{ item.collectCount ? item.collectCount : 0 }}
							</span>
						</view>
					</view>
				
					<view class="list-right-top-bottom">
						{{ item.content}}
					</view>
					<view class="therapist-mian-bottom">
						<view class="flex align-center">
							<image class="therapist-bottom-dingwei" src="../../static/dituzhaoren6.png"></image>
							<view class="therapist-bottom-dingwei-text">
								{{ item.distance }}
							</view>
						</view>
						<view class="flex flex-wrap align-center" v-if="item.consortiaName">
							<image class="therapist-bottom-img" src="../../static/dituzhaoren5.png">
							</image>
							<view class="therapist-mian-bottom-text">{{item.consortiaName}}</view>
						</view>
						<!-- <view class="text-center text-sm" v-if="item.status == 1"
							style="background: linear-gradient(90deg, #019C88, #0FA78B, #35C495);color: #ffffff;width: 30%;border-radius: 30upx;height: 60upx;line-height: 60upx;margin-top: 10rpx;"
							@click.stop="goOrderDetail(item)">
							立即预约
						</view>
						<view class="text-center text-sm" v-else
							style="background: #d9d9d9;color: #ffffff;width: 30%;border-radius: 30upx;height: 60upx;line-height: 60upx;margin-top: 20rpx;">
							立即预约
						</view> -->
					</view>
					
				</view>
			</view>
		</view>
		<empty v-if="orderList.length == 0"></empty>

		<!-- <u-skeleton :loading="loading" :animation="true" elColor='#FFFFFF' bgColor='#FFFFFF'></u-skeleton> -->
	</view>
</template>

<script>
	import empty from '@/components/empty.vue'
	export default {
		components: {
			empty,
		},
		data() {
			return {
				loading: true, // 是否显示骨架屏组件
				game: [],
				orderList: [],
				isVip: false,
				myId: uni.getStorageSync('userId') ? uni.getStorageSync('userId') : '',
				showModal: true,
				arr: [],
				tab: '',
				massageTypeId: '',
				page: 1,
				limit: 10,
				latitude: '',
				XCXIsSelect:'否',
				longitude: ''
			}
		},
		onLoad(e) {
			let that = this
			that.XCXIsSelect = this.$queue.getData("XCXIsSelect");
			console.log("shouchang",that.XCXIsSelect)
			uni.getLocation({
				type: 'gcj02',
				geocode: true, //设置该参数为true可直接获取经纬度及城市信息
				success: function(res) {
					console.log(res, '地理位置')
					that.latitude = res.latitude
					that.longitude = res.longitude
					// uni.setStorageSync('latitude', res.latitude)
					// uni.setStorageSync('longitude', res.longitude)

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

			that.getData(139.2222,46.3333)
		},
		onShow() {
			if(this.latitude && this.longitude){
				this.getData(this.latitude, this.longitude)
			}
		},
		methods: {
			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
				});
			},
			getData(latitude, longitude) {
				let data = {
					page: this.page,
					limit: this.limit,
					latitude: latitude,
					longitude: longitude,
				}
				this.$Request.get("/app/artificer/selectCollectList", data).then(res => {
					this.loading = false;
					if (res.code == 0) {
						for (var i = 0; i < res.data.list.length; i++) {
							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 (res.data.list[i].lifePhoto) {
								res.data.list[i].lifePhoto = res.data.list[i].lifePhoto.split(',')
							}
						}
						if (this.page == 1) {
							this.orderList = res.data.list
						} else {
							this.orderList = [...this.orderList, ...res.data.list]
						}

					}

				}).catch(() => {
					//联网失败, 结束加载
					// this.mescroll.endErr();
				});

			},

			// 跳转订单
			goOrder(e) {
				let token = this.$queue.getData('token');
				if (token) {
					uni.navigateTo({
						url: "/pages/index/order/orderDet?artificerId=" + e.artificerId + '&massageTypeId=' + this
							.massageTypeId
					})
				} else {
					uni.navigateTo({
						url: '/pages/public/login'
					});
				}
			},
			goOrderDetail(e) {
				uni.navigateTo({
					url: "/pages/therapist/orderDetail?artificerId=" + e.artificerId + '&massageTypeId=' + this
						.massageTypeId
				})
			}
		},
		onReachBottom: function() {
			this.page = this.page + 1;
			this.getData(this.latitude, this.longitude)
		},
		onPullDownRefresh: function() {
			this.page = 1;
			this.getData(this.latitude, this.longitude)
			setTimeout(d => {
				uni.stopPullDownRefresh();
			}, 3000);
		},
	}
</script>

<style lang="scss" scoped>
	.keyuyue{
		padding: 0rpx 10rpx;
		height: 44rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		border-radius:  30rpx 20rpx 20rpx 30rpx ;
		font-size: 24rpx;
	}
	.keyuyue-lan{
		background: #eefdf8;
	}
	.keyuyue-hui{
		background: #d9d9d9;
	}
	.timea-fu{
		color: #2dbe93;
		font-size: 24rpx;
		line-height: 44rpx;
		margin-left: 8rpx;
		margin-right: 5rpx;
	}
	.timea-hui{
		color: #ffffff;
		font-size: 24rpx;
		line-height: 44rpx;
		margin-left: 8rpx;
		margin-right: 5rpx;
	}
	.therapist-mian-bottom-text{
		font-weight: bold;
		font-size: 26rpx;
		color: #222222;
		white-space: pre-wrap;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
		overflow: hidden;
		width: 60px;
	}
	.therap-pin{
		font-size: 24rpx;
		display: flex;
		align-items: flex-end;
		margin-right: 10rpx;
	}
	.therap-pin span:nth-child(2){
		color: #019c88;
	}
	.therap-pin span:nth-child(1){
		color: #666;
		margin-right: 10rpx;
	}
	.therapist-mian-top{
		width: 100%;
		display: flex;
		flex-direction:row;
	}

	.timea-img{
		background:#2dbe93 url('../../static/timea.png') 2rpx 1rpx;
		background-size: 28rpx 28rpx;
		background-repeat: no-repeat;
		width: 30rpx;
		height: 30rpx;
		border-radius:8rpx;
		margin-top: 8rpx;
	}
	
	.timea-time{
		font-size: 25rpx;
		color: #2dbe93;
		line-height: 44rpx;
		padding-right: 10rpx;
	}
	.icon-text{
		margin-left: 2px;
		font-weight: 400;
		font-size: 26rpx;
		color: #666;
	}
	.icon-text1{
		margin-left: 2px;		
		color: #666;
		font-size: 26rpx;
	}
	.pinglun{
		width: 28rpx;
		height: 26rpx;		
	}
	.shouc-img{
		width: 26rpx;
		height: 26rpx;
	}
	.list-right-top-bottom{
		width: 100%;
		text-align: left;
		font-weight: 400;
		font-size: 26rpx;
		color: #999;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2; /* 显示的行数，可以根据需要修改 */
		overflow: hidden;
		text-overflow: ellipsis;
		margin-top: 5px;
	}
	.list-right-content{
		padding-right:20rpx;
		}
	.therapist-bottom-dingwei-text{
		font-size: 24rpx;
		color: #666;
		margin-top: 3px;
	}
	.therapist-bottom-dingwei{
		width: 20.36rpx;
		height: 24.14rpx;
		margin-right:3px;
		margin-top: 3px;
	}
	.therapist-bottom-img{
		width: 30rpx;
		height: 30rpx;
		margin-right:3px;
	}
	
	.therapist-mian-bottom{
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		}
	
	.zz_view {
		color: #039E89;
		font-size: 22rpx;
		padding: 0px 3px;
		background: #EBEBEB;
		height: 38rpx;
		line-height: 38rpx;
		text-align: center;
		border-top-right-radius: 7rpx;
		border-bottom-right-radius: 7rpx;
	}
	.shou-top-btn{
		height: 38rpx;
		line-height: 38rpx;
		text-align: center;
		padding: 0px 5px;
		border-top-left-radius: 10rpx;
		border-bottom-left-radius: 10rpx;
	}
	.byy_view {
		color: #666;
		background-color: #ebebeb;
		border-radius: 20rpx;
		font-size: 24rpx;
		padding: 3rpx 20rpx;
	}
	
	.kfw_view {
		background: linear-gradient(90deg, #029d88, #1eb28f);
		color: #FFFFFF;
		font-size: 20rpx;
	}
	
	.shou-top{
		display: flex;
		flex-direction: row;
		align-items: center;
		}
	.dituzhaoren{
		width: 145.75rpx;
		height: 40.97rpx;
	}
	.content-list{
		height: 240rpx;
		border-radius: 14rpx;
	}
	.content-img image{
		width: 150rpx;
		height: 150rpx;
		border-radius:300rpx;
	}
	.content-img{
		width: 200.08rpx;
		height: 100%;
		position: relative;
		padding:20rpx;
	}
	.content {
		width: 100%;
		height: 100vh;
		background-color: #F7F7F7;
	}
	.zpmore_view {
		position: absolute;
		top:140rpx;
		left: 25rpx;
		color: #fff;
		background: linear-gradient(to right, #019c88, #73d8b4);
		width: 126upx;
		text-align: center;
		border-radius:90rpx 60rpx 60rpx 30rpx;
		height: 42rpx;
		line-height: 42rpx;
		font-size: 22rpx;
		margin-left: 10rpx;
	}
	.touxiang-frame{
		//position: absolute;
		width: 100rpx;
		height: 38rpx;
		//left: 44rpx;
		//top:140rpx;
	}
	

	.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: #096f4b;
		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;
		background: #FFFFFF;
		// margin-top: -50upx;
		// z-index: 99;
		// display: flex;
		// line-height: 100upx;

		.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;
			}
		}
	}
	.label-word{
		background: #f9f1e7;
		color: #9b7a6e;
		border-radius: 30rpx;
		padding: 0rpx 14rpx;
		line-height:34rpx;
		border: 1px solid #9b7a6e;
		font-size: 22rpx;
		margin-left: 10rpx;
	}
</style>
