<template>
	<view class="u-skeleton">
		<view class="bg">
			<view class="padding" style="width: 100%;height: 347px;">
				<image class="" style="width: 100%;height: 100%;border-radius: 30rpx;" :src="order.massageImg"></image>
			</view>

			<view class="padding-lr">
				<view class="margin-right-xs text-df"
					style="width: 400rpx; overflow: hidden;font-size:30rpx;font-weight: bold; nowrap;text-overflow: ellipsis;">
					{{order.title}}
				</view>
				<view class="text-xs margin-top-sm" style="color: #333; font-size: 26rpx;">
					<!-- ￥<text class="text-df">{{isVip? order.memberMoney :order.money}}/</text>60分钟 -->
					￥<text class="order-text">{{order.price}}/</text>{{order.duration}}分钟
				</view>
			
				<!-- <view class="margin-top-xs ">
					<text class="padding-xs margin-right-xs text-sm" style="color: #26C278;background-color: #FFEBF0;"
						v-for="(item,index) in order.gameName" :key="index">{{item}}</text>
				</view> -->
				<view class="margin-top-sm padding-bottom-sm" style="border-top: 2rpx solid #F5F5F2;">
					<view class="text-bold text-df padding-tb-xs">适用说明</view>
					<view class="text-sm " style="color: #666666;" v-html="order.content">
					</view>
				</view>
				
				<view class="qualification">
					<view class="qual-center">
						<image src="../../../static/images/index/renz1.png" style="width: 32upx;height: 28upx;"></image>
						<text class="margin-left-xs">实名认证</text>
					</view>
					<view class="qual-center">
						<image src="../../../static/images/index/renz2.png" style="width:28upx;height: 33upx;"></image>
						<text class="margin-left-xs">资质认证</text>
					</view>
					<view class="qual-center">
						<image src="../../../static/images/index/renz3.png" style="width: 28upx;height: 32upx;"></image>
						<text class="margin-left-xs">平台担保</text>
					</view>
				</view>
			</view>
		</view>

		<view class="detail-foot-nav">
			<span class="detail-foot-nav-text">项目详情</span>
			<span class="detail-foot-nav-bor"></span>
		</view>
		<view class="margin-top-sm bg radius u-skeleton-fillet">
			<view v-for="(item,index) in order.contentImg" :key="index" style="width: 100%;height: 100%;padding: 15px;">
				<image :src="item" style="width: 100%;height: 100%;" mode="widthFix"></image>
			</view>

		</view>
		<!-- <u-picker v-model="show" mode="time" :params="params" @confirm="statusChange"></u-picker> -->
		<u-skeleton :loading="loading" :animation="true" bgColor="#FFF"></u-skeleton>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				game: [],
				loading: true, // 是否显示骨架屏组件
				customStyle: {
					width: '400upx',
					color: '#FFFFFF',
					background: "#005DFF",
					border: 0
				},
				id: '',
				orderDet: {},
				page: 1,
				limit: 10,
				order: {},
				commentList: [],
				isFollow: false,
				myId: '',
				isVip: false,
				AUDIO: uni.createInnerAudioContext(),
				isPlay: false,
				show: false,
				params: {
					year: false,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: true,
					timestamp: true
				},
				startTime: '',
				mobile: '',
				name: '',
				cityaddress: '',
				detailaddress: '',
				latitude: '',
				longitude: '',
				province: '',
				city: '',
				district: '',
				age: 0
			}
		},
		onLoad(option) {
			// this.$queue.showLoading("加载中...");
			this.id = option.id
			this.getDet()
			this.getOrderComment()
			this.myId = uni.getStorageSync('userId')
			this.isVip = uni.getStorageSync('isVIP')
			console.log(this.isVip)

		},
		onShow() {

		},
		onReady() {
			this.AUDIO.onEnded(function(res) {
				this.isPlay = false;
			});
		},
		methods: {
			
			bindTophoto(index, id) {
				console.log(index, id)
				if (index == 1) {
					uni.navigateTo({
						url: './detailphoto?id=' + id
					})
				} else if (index == 2) {
					uni.navigateTo({
						url: './workphoto?id=' + id
					})
				}
			},
			// 详情
			getDet() {
				uni.showLoading({
					title: '加载中...'
					
				});
				this.$Request.get("/app/artificer/selectMassageTypeById", {
					massageTypeId: this.id,
				}).then(res => {
					this.loading = false;
					uni.hideLoading();
					if (res.code == 0) {
						this.order = res.data
						// this.order.gameName = this.order.gameName.split(",");
						this.order.contentImg = this.order.contentImg.split(",");
						// this.order.certificateImg = this.order.certificateImg.split(",");
						// this.order.headImg = this.order.headImg.split(",");
						// this.order.workImg = this.order.workImg.split(",");
						// this.selectFollow()
						// if (this.order.region) {
						// 	let region = this.order.region.split(",");
						// 	this.order.region = region[1]
						// } else {
						// 	this.order.region = '不限地区'
						// }
	
						// uni.hideLoading();
					} else {
						// this.loading = false;
						// uni.hideLoading();
					}


				});

			},
			// 评论
			// getOrderComment() {
			// 	this.$Request.get("/app/takingComment/selectOrderTakingComment", {
			// 		id: this.id,
			// 		page: this.page,
			// 		limit: this.limit
			// 	}).then(res => {
			// 		if (res.code == 0) {
			// 			this.commentList = [...this.commentList, ...res.data.list]
			// 		}
			// 	});
			// },
			// 是否关注
			selectFollow() {
				this.$Request.get("/app/userFollow/selectFollowUser", {
					followUserId: this.order.userId
				}).then(res => {
					if (res.data == true) {
						this.isFollow = true
					} else {
						this.isFollow = false
					}

				});
			},
			playVoice() {
				console.log(this.isPlay)
				this.AUDIO.src = this.order.voiceIntroduce;
				if (this.isPlay) {
					this.AUDIO.stop();
				} else {
					this.AUDIO.play();
				}
				this.isPlay = !this.isPlay;
			},
			goNav() {
				// if (this.startTime == '') {
				// 	uni.showToast({
				// 		icon: 'none',
				// 		title: '请选择上门时间'
				// 	});
				// 	return;
				// }
				uni.navigateTo({
					url: "/pages/index/game/orderDet?id=" + this.id
				})
			},
			goMsg() {
				let data = {
					userId: this.myId,
					focusedUserId: this.order.userId
				}
				this.$Request.postJson('/app/chat/insertChatConversation ', data).then(res => {
					if (res.code == 0) {
						let id = this.order.userId == res.data.userId ? res.data.focusedUserId : this.order.userId
						uni.navigateTo({
							url: '/pages/msg/im?chatConversationId=' + res.data.chatConversationId +
								'&byUserId=' + id
						})
					}
				})
			},
			// 关注
			follow() {
				let that = this
				that.$Request.get("/app/userFollow/insert", {
					followUserId: that.order.userId
				}).then(res => {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					setTimeout(function() {
						that.selectFollow()
					}, 500)
				});
			}
		}

	}
</script>

<style>
	.detail-foot-nav-bor{
		width: 64px;
		height: 5px;
		border-radius: 2px;
		position: absolute;
		bottom: 0;
		background: linear-gradient(90deg,rgba(55, 182, 157,0.7),rgba(132, 211, 196,0.7));
	}
	.detail-foot-nav-text{
		font-weight: bold;
		font-size: 15px;
		color: #000000;
	}
	.detail-foot-nav{
		width: 90%;
		display: flex;
		flex-direction: column;
		position: relative;
		margin: 10px auto 17px auto;
	}
	page {
		background-color: #F7F7F7;
	}
	.qualification{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	.qual-center{
		display: flex;
	    flex-direction: row;
	    align-items: center;
	    justify-content: center;
	    width: 210rpx;
	    height: 22px;
	    line-height: 22px;
	    background-color: rgba(8, 162, 138, 0.1);
	    border-radius: 8px;
	    font-weight: 400;
	    font-size: 11px;
	    color: #029D88;
		margin: 15rpx 0;
		}
	.bgs {
		background-color: #FFFFFF;
	}

	.bg {
		background-color: #FFFFFF;
	}

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

	.line_x {
		display: inline-flex;
		width: 14rpx;
		height: 14rpx;
		background: #000000;
		border-radius: 50%;
		margin-right: 10rpx;
	}
	.order-text{
		font-size: 36rpx;
		color: #fb672b;
	}
</style>
