<template>
	<view class="content">
		<view class="header">
			<view class="header-top" :style="backgroundStyle" @click="goNav('/my/vip/index')">
				<image src="../../static/servicePackage/member_ba.png" mode="widthFix" v-if="!isVip"></image>
				<image src="../../static/activate2.png" mode="widthFix" v-if="isVip"></image>
			</view>
			<view class="header-bottom">
				<view class="header-bottom-top">
					<view class="header-bottom-title">
						<view class="header-bottom-title-text">
							{{mainData.title}} 
						</view>
						<view class="header-bottom-title-num">
							<span>{{mainData.sales}}</span>
							<span> 人选择</span>
						</view>
					</view>
					<view class="header-bottom-money-view">
						<view class="header-bottom-money">
							<view class="header-bottom-money-zhen">
								<span>￥</span>
								<span>{{mainData.price}}</span>
								<span>/套</span>
							</view>
							<view class="header-bottom-money-jia">
								￥{{mainData.oldPrice}}/套
							</view>
						</view>
					</view>
				</view>
				<view class="header-bottom-mian">
					<view class="header-bottom-mian-title">
						<image src="../../static/servicePackage/jianjie.png" mode=""></image>
						<span>套餐简介</span>
					</view>
					<view class="jianjie">
						{{mainData.content}}
					</view>
				</view>
				<view class="header-bottom-foot">
					<view><image class="header-bottom-foot-title" src="../../static/dituzhaoren1.png" ></image></view>
					<view class="header-bottom-foot-view">
						<image class="header-bottom-foot-view-img1" src="../../static/servicePackage/idCard.png" mode=""></image>
						<span>实名认证</span>
					</view>
					<view class="header-bottom-foot-view" style="margin: 0px 7px;">
						<image class="header-bottom-foot-view-img2" src="../../static/servicePackage/money.png" mode=""></image>
						<span>资质认证</span>
					</view>
					<view class="header-bottom-foot-view">
						<image class="header-bottom-foot-view-img3" src="../../static/servicePackage/shuangyue.png" mode=""></image>
						<span>平台担保</span>
					</view>
				</view>
			</view>
		</view>
		<view class="detail-foot">
			<view class="detail-foot-nav">
				<span class="detail-foot-nav-text">套餐详情</span>
				<span class="detail-foot-nav-bor"></span>
			</view>
			<view class="detail-foot-mian">
				<view class="detail-foot-list" v-for="(item,index) in detailData" :key="index" @click="detail(item)">
					<view class="detail-foot-list-top">
						<span style="margin-right: 5px;">{{item.title}}</span>
					</view>
					<view class="detail-view" style="position: relative;">
						<image class="detail-view-img" :src="item.massageImg" mode=""></image>
						<span v-if="serviData.name!='index'" class="img-span">{{item.status=='1'?'已使用':'未使用'}}</span>
						<view class="detail-view-mina">
							<view class="header-bottom-money" style="margin: 7px 0px;display: flex;justify-content: space-between; ">
								<view style="display: flex; align-items: flex-end;">
									<view class="header-bottom-money-zhen">
										<span>￥</span>
										<span>{{item.price}}</span>
									</view>
									<view class="header-bottom-money-jia" >
										￥{{item.oldPrice}}
									</view>
								</view>
								<view class="service-more" @click.stop="xiangqing(item)">{{item.status=='1'?'详情':'预约'}}</view>
							</view>
							<view style="color: #019c88; font-size: 26rpx;">服务时长:{{item.duration}}分钟</view>
							<view class="tese">
								<span>项目特色: </span>
								<span>{{item.jianjie}}</span>
							</view>
						</view>
					</view>
					
					<view class="detail-foot-title">
						服务项目{{index+1}}
					</view>
				</view>
				<view style="height: 70rpx;"></view>
				
			</view>
		</view>
		<view class="push-button">
			<view class="detail-btn" v-if="serviData.name=='index'" @click="openpay(mainData)">
				立即购买
			</view>
		</view>
		<!-- 支付方式 -->
		<u-popup v-model="showpay" mode="bottom" :closeable="closeable">
			<view class="popup_pay">
				<view style="background-color: #fff;">
					<view style="padding: 0 20upx;margin-top: 60rpx;margin-bottom: 20rpx;display: flex;flex-direction: column;justify-content: center;">
						<view
							style="width:92%;display: flex;height: 100upx;align-items: center;padding: 20upx 0;justify-content: center;"
							v-for="(item,index) in openLists" :key='item.id'>
							<image :src="item.image" style="width: 55upx;height: 55upx;border-radius: 50upx;">
							</image>
							<view style="font-size: 30upx;margin-left: 20upx;width: 70%;">
								{{item.text}}
							</view>
							<radio-group name="openWay" style="margin-left: 45upx;" @tap='selectWay(item)'>
								<label class="tui-radio">
									<radio color="#096f4b" :checked="openWay === item.id ? true : false" />
								</label>
							</radio-group>
						</view>
					</view>
				</view>
				<view class="pay_btn" @click="pay()">确认支付</view>
			</view>
		</u-popup>
	</view>
</template>
<script>
	export default{
		data(){
			return{
				checkbox:false,
				couponData:[],
				couponId:'',
				tordersId: '',
				tpayMoney: '',
				paySel: 0,
				openWay: 1,
				openLists: [],
				closeable: true,
				showpay: false,
				serviData:[],
				isVip:false,
				mainData:[],
				detailData:[],
				// 背景图片的URL可以是动态的，比如从API获取或根据条件生成
				backgroundImageUrl: '',
				zong:''
			}
		},
		computed: {
		    backgroundStyle() {
		      return {
		        backgroundImage: `url(${this.backgroundImageUrl})`,
		        backgroundSize: 'cover', // 根据需要调整
		      };
		    }
		  },
		onLoad(e){
			var that=this;
			that.serviData=e;
			that.getData();
			that.isVip=this.$queue.getData('isVIP');
		},
		
		methods:{
			goNav(e) {
				uni.navigateTo({
					url: e
				})
			},
			openpay(item) {
				
				uni.navigateTo({
					url:'/my/order/payModifyTc?ordersId='+item.id
				})
				// this.goOrder()
				// this.showpay = true
			},
			xiangqing(item){
				uni.navigateTo({
					url:'/pages/my/myMsOderDrtail?mainId='+item.mainId+'&id='+item.id+
						'&massageTypeId='+item.massageTypeId+
						'&status='+item.status
				})
			},
			detail(item){
				if(item.status=='1'){
					uni.showToast({
						title:'该项目已使用！'
					})
				}else{
					uni.navigateTo({
						url:'/pages/my/myMsOderDrtail?mainId='+item.mainId+'&id='+item.id+
							'&massageTypeId='+item.massageTypeId+
							'&page='+1+
							'&limit='+10
					})
				}
				
			},
			getData(){
				var that=this;
					let data = {
							  mainId: that.serviData.id,
							  page: that.serviData.page,
							  limit:  that.serviData.limit,
							}
					that.$Request.get('/app/user/package/detail/findMyPackageDetailList',data).then(res => {
						if (res.code == 0) {
							that.mainData=res.data.mainData;
							that.detailData=res.data.detailData;
							that.backgroundImageUrl=that.mainData.packageImg;
						}
					})	
			},
		}
	}
</script>
<style scoped>
	.img-span{
		    padding: 2px 5px;
		    font-weight: 400;
		    font-size: 8px;
		    color: #FFFFFF;
		    background: linear-gradient(-90deg, #FF6F48, #FF9E69);
		    border-radius: 7px 0px 7px 0px;
		    position: absolute;
		    bottom: 0px;
		    left: 0;
		    margin-bottom: 14px;
			margin-left: 27px;
	}
	.detail-view-mina{
		width: 74%;
		display: flex;
		flex-direction: column;
		justify-content: space-around;
	}
	.detail-view-img{
		width: 80px;
		height: 80px;
		border-radius: 9px;
	}
	.detail-view{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	/deep/uni-checkbox .uni-checkbox-input{
		width: 26px;
		height: 26px;
		border-radius: 50%;
	}
	.youhui-img{
		width: 111.81rpx;
		height: 111.81rpx;
	}
	.youhui-view-right-btn{
		width: 158rpx;
		height: 64rpx;
		background: linear-gradient(-90deg, #019C88, #2DC48E);
		border-radius: 32rpx;
		text-align: center;
		line-height: 64rpx;
		font-weight: 400;
		font-size: 28rpx;
		color: #FFFFFF;
		text-shadow: 0rpx 2rpx 4rpx rgba(0,119,104,0.44);
		margin-left: 10px;
	}
	.youhui-view-right-time{
		font-weight: 400;
		font-size: 22rpx;
		color: #999999;
	}
	.youhui-view-right-title{
		width: 105px;
		font-weight: 400;
		font-size: 32rpx;
		color: #333333;
	}
	.youhui-view-right-top{
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.youhui-view-right{
		width: 502.08rpx;
		height: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-around;
	}
	.youhui-view-left-bottom{
		font-weight: 400;
		font-size: 22rpx;
		color: #FFFFFF;
	}
	.youhui-view-left-yuan{
		display: flex;
		flex-direction: row;
		align-items: baseline;
		color: #FFFFFF;
	}
	.youhui-view-left-num{
		font-weight: bold;
		font-size: 89rpx;
	}
	.youhui-view-left-text{
		font-weight: bold;
		font-size:24.31rpx;
	}
	.youhui-view-left{
		width: 199rpx;
		height: 242rpx;
		display: flex;
		flex-direction:column;
		align-items: center;
		justify-content: center;
	}
	.youhui-yiyong{
		background-image: url('../../static/youhuijuan/coupons7.png');
	}
	.youhui-weiyong{
		background-image: url('../../static/youhuijuan/coupons1.png');
	}
	.youhui-list{
		width: 95%;
		display: flex;
		flex-direction: row;
		height: 242rpx;
		border-radius: 21rpx;
		background-size: 100%;
		margin: 20px auto;
		justify-content: space-between;
	}
	.popup_pay {
		width: 100%;
		position: relative;
		padding-bottom: 45rpx;
		/* height: 400px; */
		/* height: 160px; */
		/* #ifndef MP-WEIXIN */
		/* height: 130px; */
		/* #endif */
	
	}
	.pay_btn {
		width: 90%;
		margin: 0 auto;
		text-align: center;
		background: linear-gradient(90deg, #019C88, #28BA92, #35C495);
		height: 80rpx;
		border-radius: 60rpx;
		color: #ffffff;
		line-height: 80rpx;
	}
	.push-button{
	width: 100%;
	height: 48px;
	position: fixed;
	bottom: 0px;
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 0 auto;
	}
	.detail-btn{
	display: inline-block;
	width: 92%;
	text-align: center;
	background: linear-gradient(90deg, #019C88, #28BA92, #35C495);
	height: 40px;
	border-radius: 28px;
	color: #ffffff;
	line-height: 40px;
	margin-top: 4px;
	font-size: 34rpx;
	}
	.header-top image{
		width: 706.25rpx;
		height: 105.07rpx;
	}
	.header-top{
		width: 100%;
		height: 745.83rpx;
		background-image: url('../../static/servicePackage/display.png');
		/* background-size: 100%;
		background-repeat: no-repeat; */
		display: flex;
		align-items: flex-end;
		justify-content: center;
	}
	.shouc image{
		width: 34.03rpx;
		height: 32.64rpx;
	}
	
	.shouc{
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.detail-foot-nav-bor{
		width: 64px;
		height: 11rpx;
		border-radius: 6rpx;
		position: absolute;
		bottom: 0;
		background: linear-gradient(90deg,rgba(234, 248, 245,0.7),rgba(132, 211, 196,0.7));
	}
	.detail-foot-nav-text{
		font-weight: bold;
		font-size: 34rpx;
		color: #000000;
	}
	.detail-foot-nav{
		width: 90%;
		display: flex;
		flex-direction: column;
		position: relative;
	}
	.detail-foot-title{
		    width: 115px;
		    height: 32px;
			background-image: url(../../static/servicePackage/horn.png);
		    background-repeat: no-repeat;
		    background-size: 100% 100%;
		    font-weight: 400;
		    font-size: 13px;
		    color: #FFFFFF;
		    text-align: right;
		    line-height: 32px;
		    padding-right: 15px;
			position: absolute;
			    right: 0;
			    top: 0;
	}
	.detail-foot-list-top{
		width: 95%;
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	.detail-foot-list{
		width: 95%;
		border-radius: 21rpx;
		position: relative;
		margin: 6px 0px 5px 0px;
		padding: 15px;
		display: flex;
		flex-direction: column;
		background-color: #fff;
	}
	.detail-foot{
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 15px 0px;
	}
	
	.tese span:nth-child(1){
		font-weight: bold;
		font-size: 24rpx;
		color: #666;
	}
	.tese span:nth-child(2){
		font-size: 24rpx;
		color: #8D9194;
	}
	.tese{
		width: 100%;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2; /* 显示的行数，可以根据需要修改 */
		overflow: hidden;
		text-overflow: ellipsis;
		margin-top: 4rpx;
	}
	.detail-foot-list-top span:nth-child(1){
		font-weight: bold;
		font-size: 31rpx;
		color: #3F3F3F;
	}
	.detail-foot-list-top span:nth-child(2){
		width: 76rpx;
		height: 33rpx;
		line-height: 33rpx;
		text-align: center;
		border-radius: 16rpx;
		border: 1px solid #7D7D7D;
		font-weight: 400;
		font-size: 20rpx;
		color: #777777;
		margin: 0px 25px 0px 5px;
	}
	.detail-foot-list-top span:nth-child(3){
		font-size: 30rpx;
		color: #029d88;
	}
	
	.detail-foot-mian{
		width: 100%;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin-top: 8px;
	}
	.jianjie{
		font-weight: 400;
		font-size: 24rpx;
		color: #8D9194;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2; /* 显示的行数，可以根据需要修改 */
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.header-bottom-mian{
		margin: 3px 0px;
	}
	.header-bottom-mian-title{
		width: 100%;
		display: flex;
		align-items: center;
	}
	.header-bottom-mian-title span{
		font-weight: 400;
		font-size: 28rpx;
		color: #20AB95;
		margin-left: 5px;
		padding: 10rpx 0;
	}
	.header-bottom-mian-title image{
		width: 30.56rpx;
		height: 29.86rpx;
	}
	.header-bottom-foot-view-img1{
		width: 30rpx;
		height: 30rpx;
	}
	.header-bottom-foot-view-img2{
		width: 28rpx;
		height: 28rpx;
	}
	.header-bottom-foot-view-img3{
		width: 30rpx;
		height: 30rpx;
	}
	.header-bottom-foot-view image{
		margin-right: 3px;
	}
	.header-bottom-foot-view{
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		width: 80px;
		height: 22px;
		line-height: 22px;
		background-color: rgba(8, 162, 138, 0.1);
		border-radius: 8px;
		font-weight: 400;
		font-size: 11px;
		color: #029D88;
	}
	.header-bottom-foot-title{
		width: 65px;
		height: 17px;
		margin-right: 8rpx;
		margin-top: 4rpx;
	}
	.header-bottom-foot{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center; 
		margin-top: 8rpx;
	}
	.header-bottom-money-jia{
		font-size: 28rpx;
		color: #848484;
		line-height: 37rpx;
		text-decoration-line: line-through;
		margin-left: 5px;
	}
	.header-bottom-money-zhen span{
		color: #F95900;
	}
	.header-bottom-money-zhen span:nth-child(1){
		font-size: 26rpx;
	}
	.header-bottom-money-zhen span:nth-child(2){
		font-size:38rpx;
		font-weight: bold;
	}
	.header-bottom-money-zhen span:nth-child(3){
		font-size: 26rpx;
	}
	.header-bottom-money-zhen{
		display: flex;
		flex-direction: row;
		align-items: baseline;
	}
	
	.header-bottom-money-view{
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		margin-top:8px;
	}
	.header-bottom-money{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: flex-end;
	}
	.header-bottom-title-num span{
		font-size: 28rpx;
	}
	.header-bottom-title-num span:nth-child(1){
		font-weight: bold;
		color: #08A28A;
	}
	.header-bottom-title-num span:nth-child(2){
		color: #848485;
		margin-left: 5px;
	}
	.header-bottom-title-text{
		font-weight: bold;
		font-size: 35rpx;
		color: #13141A;
	}
	.header-bottom-title{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
	.header-bottom-top{
		width: 100%;
		display: flex;
		flex-direction: column;
	}
	.header-bottom{
		width: 100%;
		background-color: #fff;
		padding: 15px 20px;
		display: flex;
		flex-direction: column;
	}
	
	.header{
		width: 100%;
		display: flex;
		flex-direction: column;
	}
	.content{
		width: 100%;
		height: 100vh;
		position: relative;
		background-color: #f7f7f7;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.service-more{
		    width: 50px;
		    height: 26px;
		    font-size: 13px;
		    border-radius: 15px;
		    line-height: 26px;
			border: 1px #2dbe93 solid ;
		    color: #019c88;
		    text-align: center;
		    justify-content: fex-end;
			background: #eefffa;
	}
</style>