<template>
	<view class="content">
		<view class="t-header">
			<view class="title">待使用</view>
			<view class="time"><text>0017 1712 5994</text>待使用，请按课表到上课地点按时上课。</view>
		</view>
		<view class="t-booking-card">
			<view class="booking-text">
				<view class="b-title">请您提前联系场馆进行预约</view>
				<view class="b-text">请提前一天预约>场馆确认>到馆消费</view>
			</view>
			<view class="booking-btn">立即预约</view>
		</view>
		<!-- 包场 -->
		<view class="c-scheduled-card">
			<view class="title">预定信息</view>
			<view class="schedule-address">
				<view class="text">场馆</view>
				<view class="name">体育馆综合训练馆(观山湖店)</view>
			</view>
			<view class="schedule-address">
				<view class="text">场次</view>
				<view class="">
					<view class="time-box" v-for="item in 3">
						<view class="time">06-11(周三)11:00-12:00|羽毛球1</view>
						<view class="status">已退款</view>
					</view>
				</view>
			</view>
		</view>
		<view class="t-shoping-card">
			<view class="venue-address">
				<view class="address">
					<zzx-icon name="venue-icon4" size="14"></zzx-icon>
					<view class="name">林旦综合运动馆</view>
					<view class="venue-tags">营业中</view>
				</view>
				<view class="check-all">
					<text>查看所有可用场馆</text>
					<zzx-icon name="ashRight" size="12"></zzx-icon>
				</view>
			</view>
			<view class="t-shoping-info">
				<image class="shoping-img" src="https://img.shetu66.com/2023/06/13/1686646672844195.jpg" mode="">
				</image>
				<view class="shoping-info">
					<view class="name">一对一篮球30分钟室内精品课程，一对...</view>
					<view class="shoping-price" @click="pricePopup.open()">
						<view class="price">￥45.9</view>
						<view class="text">
							<text>实付</text>
							<text class="mini-text">￥</text>
							<text class="price-big">25.1</text>
							<zzx-icon name="ashRight" size="10"></zzx-icon>
						</view>
					</view>
				</view>
			</view>
			<view class="t-shoping-address">
				<view class="address">上课地点：观山湖区第十二小学</view>
				<view class="course-time" @click="torecord_page">
					<text>10课时 05.06-05.11</text>
					<zzx-icon name="ashRight" size="10"></zzx-icon>
				</view>
			</view>
			<view class="t-invite">
				邀请好友报名
			</view>
		</view>
		<!-- 待使用展示 -->
		<view class="t-qrcode-card">
			<view class="qrcode-box">
				<view class="item-qrcode">
					<uv-qrcode ref="qrcode" size="100px" value="https://h5.uvui.cn"></uv-qrcode>
				</view>
			</view>
			<view class="download-qrcode" @click="download_qrcode">下载到手机</view>
			<view class="t-todeused">
				<view class="todeused">
					<view class="text">待使用</view>
					<view class="time">07-25 14：25：45 到期</view>
				</view>
				<view class="order-num" v-for="item in 2">0017 1712 5994</view>
			</view>
		</view>
		<!-- 已使用已过期展示 -->
		<view class="t-qrcode-card">
			<view class="t-todeused" v-for="item in 2" style="border-bottom: 1rpx solid #F0F0F0;">
				<view class="todeused">
					<view class="item-todeused">
						<view class="text">已使用</view>
						<view class="time">07-25 14：25：45 到期</view>
					</view>
					<view class="application-btn" @click="refundPopup.open()">申请退款</view>
				</view>
				<view class="order-num" @click="RouterUtils.to_page('/pages/index/tryUseRecord/index')">
					<text>0017 1712 5994 杨锦新</text>
					<zzx-icon name="ashRight" size="12"></zzx-icon>
				</view>
			</view>
		</view>
		<!-- 学校场地预定订单详情展示 -->
		<view class="t-scheduled-card">
			<view class="s-title">预定信息</view>
			<view class="t-scheduled-list">
				<view class="item-list">
					<view class="list-left">场地</view>
					<view class="list-right">体育馆综合训练馆(观山湖店)</view>
				</view>
				<view class="item-list">
					<view class="list-left">日期</view>
					<view class="list-right">06-11(今天)</view>
				</view>
				<view class="item-list">
					<view class="list-left">时段</view>
					<view class="list-right">11:00-12:00</view>
				</view>
				<view class="item-list">
					<view class="list-left">用户</view>
					<view class="list-right">杨锦新 赵四儿</view>
				</view>
			</view>
		</view>
		<view class="t-address-card">
			<view class="address">
				<zzx-icon name="location"></zzx-icon>
				<view class="">印象城购物中心6楼</view>
			</view>
			<view class="nav-info">
				<view class="nav">
					<zzx-icon name="navigation" size="14"></zzx-icon>
					<view class="nav-text">导航</view>
				</view>
				<view class="phone">
					<zzx-icon name="phone" size="14"></zzx-icon>
					<view class="">电话</view>
				</view>
			</view>
		</view>
		<view class="t-use-card">
			<view class="use-tips">
				<view class="title">使用须知</view>
				<view class="text">请妥善保存核销券号</view>
			</view>
			<view class="check-all">
				<text>查看全部</text>
				<zzx-icon name="ashRight" size="12"></zzx-icon>
			</view>
		</view>
		<view class="t-use-card">
			<view class="use-tips">
				<view class="title">参赛意外险</view>
				<view class="text">实际付款：6元（3元/份×2）</view>
			</view>
			<view class="check-all">
				<text>查看详情</text>
				<zzx-icon name="ashRight" size="12"></zzx-icon>
			</view>
		</view>
		<view class="t-use-card">
			<view class="use-tips">
				<view class="title">电子合同</view>
				<view class="text">该电子合同具有法律效力</view>
			</view>
			<view class="check-all">
				<text>查看详情</text>
				<zzx-icon name="ashRight" size="12"></zzx-icon>
			</view>
		</view>
		<view class="t-order-info-card">
			<view class="title">订单信息</view>
			<view class="info-list">
				<view class="item-left">实际付款</view>
				<view class="item-right">￥25.9</view>
			</view>
			<view class="info-list">
				<view class="item-left">手机号码</view>
				<view class="item-right">189****5960</view>
			</view>
			<view class="info-list">
				<view class="item-left">订单编号</view>
				<view class="item-right">46476465456464156486</view>
			</view>
			<view class="info-list">
				<view class="item-left">下单时间</view>
				<view class="item-right">2023-7-25 14：25：45</view>
			</view>
			<view class="info-list">
				<view class="item-left">付款时间</view>
				<view class="item-right">2023-7-25 14：25：45</view>
			</view>
		</view>
		<!-- 已使用展示 -->
		<view class="appraise-btn" @click="RouterUtils.to_page('/pages/index/writeComments/index')">
			写评价
		</view>
	</view>
	<!-- 价格详情弹窗 -->
	<uni-popup ref="pricePopup" :safe-area="false" type="bottom">
		<view class="price-detail">
			<view class="price-title">价格明细</view>
			<view class="price-list">
				<view class="price-total">
					<view class="text">商品总价(共2件)</view>
					<view class="price">￥45.9</view>
				</view>
				<view class="price-total">
					<view class="text">团购优惠</view>
					<view class="price">-￥2</view>
				</view>
				<view class="price-total">
					<view class="text">实付金额</view>
					<view class="price">￥45.9</view>
				</view>
			</view>
		</view>
	</uni-popup>
	<!-- 退款 -->
	<uni-popup ref="refundPopup" :safe-area="false" type="bottom">
		<view class="refund-detail">
			<view class="refund-title">申请退款</view>
			<view class="refund-text">足球五人制闲时1小时</view>
			<view class="refund-num-card">
				<view class="refund-number">
					<view class="text">退款数量<text style="color: #AAAAAA ;">(上限2张)</text></view>
					<view class="price-stepper">
						<view class="minus">-</view>
						<input type="number" />
						<view class="add">+</view>
					</view>
				</view>
				<!-- 包场 -->
				<view class="c-scheduled-card">
					<view class="title">退款信息</view>
					<view class="schedule-address">
						<view class="text">场馆</view>
						<view class="name">体育馆综合训练馆(观山湖店)</view>
					</view>
					<view class="schedule-address">
						<view class="text">场次</view>
						<view class="">
							<view class="time-box" v-for="item in 3">
								<view class="time">06-11(周三)11:00-12:00|羽毛球1</view>
								<view class="time-icon">
									<zzx-icon name="selected" size="14"></zzx-icon>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="refund-price">
					<view class="p-text">退款金额<text style="color: #AAAAAA ;">(实付金额)</text></view>
					<view class="p-price">￥45.9</view>
				</view>
				<view class="refund-account">
					<view class="a-text">退款账户</view>
					<view class="a-account">原支付账户</view>
				</view>
				<view class="refund-tips"><text style="color: #FB5B5B;">1-3个工作日</text>内到账</view>
			</view>
			<view class="refund-cause-card">
				<view class="c-title">退款原因<text style="color: #AAAAAA ;">(必选)</text></view>
				<view class="c-cause-list">
					<view class="cause-list" v-for="item in 10">
						<view class="cause">价格不划算</view>
						<zzx-icon :name="selected ? 'selected' : 'unchecked'" size="14"></zzx-icon>
					</view>
				</view>
			</view>
			<view class="refund-tips">
				<view class="tips-icon">!</view>
				<view class="tips-text">退款申请一经提交，不可取消</view>
			</view>
			<view style="height: 130rpx;"></view>
			<view class="refund-btn-box">
				<view class="refund-btn" @click="refund_btn">申请退款</view>
			</view>
		</view>
	</uni-popup>
</template>

<script lang="ts" setup>
	import { ref } from 'vue';
	import { TipsUtils, RouterUtils } from '@/utils/util'
	const qrcode = ref();
	const pricePopup=ref()  //价格
	const refundPopup=ref()  //退款
	const selected=ref(false)
	const download_qrcode = () => {     //下载二维码
		uni.showLoading()
		qrcode.value.save({
			success: (res) => {
				uni.hideLoading()
				TipsUtils.tips_toast('下载成功')
			},
			fail: (err) => {
				uni.hideLoading()
			}
		});
	}

	const torecord_page = () => {
		uni.navigateTo({
			url: '/pages/index/verificationRecord/index'
		})
	}
	
	const refund_btn=()=>{
		uni.navigateTo({
			url:'/pages/index/refundDetail/index'
		})
	}
</script>

<style lang="less" scoped>
	.t-header {
		margin-top: 20rpx;

		.title {
			font-weight: bold;
			font-size: 36rpx;
			color: #222222;
		}

		.time {
			margin-top: 20rpx;
			font-size: 24rpx;
			color: #AAAAAA;

			&>text {
				font-size: 28rpx;
				color: #222222;
			}
		}
	}

	.t-booking-card {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: #FFFFFF;
		border-radius: 32rpx;
		padding: 20rpx;
		margin-top: 20rpx;
		.booking-text {
			.b-title {
				font-weight: bold;
				font-size: 32rpx;
				color: #222222;
			}

			.b-text {
				margin-top: 20rpx;
				font-size: 28rpx;
				color: #AAAAAA;
			}
		}

		.booking-btn {
			width: 152rpx;
			height: 48rpx;
			background: #C8FF0C;
			border-radius: 8rpx;
			font-weight: bold;
			font-size: 28rpx;
			color: #222222;
			text-align: center;
			line-height: 48rpx;
		}
	}
	.c-scheduled-card {
		margin-top: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 32rpx;
	
		.title {
			font-weight: bold;
			font-size: 28rpx;
			color: #222222;
		}
	
		.schedule-address {
			display: flex;
			gap: 20rpx;
			margin-top: 20rpx;
	
			.text {
				font-size: 24rpx;
				color: #AAAAAA;
			}
	
			.name {
				font-weight: bold;
				font-size: 24rpx;
				color: #222222;
			}
	
			.time-box {
				height:60rpx;
				display: flex;
				align-items: center;
				gap: 10rpx;
				.time{
					font-weight: bold;
					font-size: 24rpx;
					color: #222222;
					margin-bottom: 20rpx;
				}
				.status{
					margin-bottom: 20rpx;
					width: 112rpx;
					height: 40rpx;
					background: #F6F6F6;
					border-radius: 8rpx;
					font-size: 24rpx;
					color: #AAAAAA;
					text-align: center;
					line-height: 40rpx;
				}

			}
		}
	}

	.t-shoping-card {
		margin-top: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 32rpx;
		.venue-address {
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1rpx solid #F0F0F0;
			padding-bottom: 20rpx;
		
			.address {
				display: flex;
				align-items: center;
				gap: 4rpx;
		
				.name {
					font-weight: 800;
					font-size: 32rpx;
					color: #222222;
				}
		
				.venue-tags {
					width: 98rpx;
					height: 32rpx;
					background: rgba(77, 217, 81, 0.2);
					border-radius: 8rpx;
					font-size: 22rpx;
					color: #4DD951;
					text-align: center;
					line-height: 32rpx;
				}
			}
		
			.check-all {
				font-size: 24rpx;
				color: #AAAAAA;
				display: flex;
				align-items: center;
				gap: 8rpx;
		
				&>text {
					margin-bottom: 10rpx;
				}
			}
		}
		.t-shoping-info {
			display: flex;
			align-items: center;
			gap: 20rpx;
			margin-top: 4rpx;
			.shoping-img {
				width: 200rpx;
				height: 200rpx;
				border-radius: 32rpx;
			}

			.shoping-info {
				width: 450rpx;

				.name {
					font-weight: 800;
					font-size: 32rpx;
					color: #222222;
				}

				.shoping-price {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.price {
						font-weight: bold;
						font-size: 32rpx;
						color: #FB5B5B;
					}

					.text {
						&>text:first-child {
							font-size: 28rpx;
							color: #222222;
						}

						.price-big {
							font-weight: 800;
							font-size: 48rpx;
							color: #FB5B5B;
						}
					}
				}
			}
		}

		.t-shoping-address {
			margin-top: 20rpx;
			font-size: 24rpx;
			color: #AAAAAA;

			.address {
				border-top: 1rpx solid #F0F0F0;
				height: 56rpx;
				line-height: 60rpx;
			}

			.course-time {
				border-bottom: 1rpx solid #F0F0F0;
				height: 58rpx;
				line-height: 60rpx;
				display: flex;
				align-items: center;
				gap: 10rpx;
			}
		}

		.t-invite {
			margin-top: 24rpx;
			font-size: 28rpx;
			color: #FDD143;
			text-align: center;
		}
	}

	.t-qrcode-card {
		margin-top: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 32rpx;
		.qrcode-box{
			height: 200rpx;
			position: relative;
			.item-qrcode {
				position: absolute;
				margin-left: 35%;
				width: 200rpx;
				height: 200rpx;
				border-radius: 16rpx;
			}
		}

		.download-qrcode {
			margin: auto;
			margin-top: 24rpx;
			width: 226rpx;
			height: 68rpx;
			background: #C8FF0C;
			border-radius: 60rpx;
			font-weight: bold;
			font-size: 28rpx;
			color: #222222;
			text-align: center;
			line-height: 68rpx;
		}

		.t-todeused {
			margin-top: 20rpx;

			.todeused {
				display: flex;
				align-items: center;
				justify-content: space-between;
				.item-todeused{
					display: flex;
					align-items: center;
					gap: 20rpx;
				}
				.text {
					font-size: 28rpx;
					color: #222222;
				}

				.time {
					font-size: 28rpx;
					color: #AAAAAA;
				}
			}

			.order-num {
				margin-top: 20rpx;
				font-size: 28rpx;
				color: #AAAAAA;
				display: flex;
				align-items: center;
				gap: 8rpx;

				&>text {
					margin-bottom: 8rpx;
				}
			}
		}
		.application-btn{
			width: 152rpx;
			height: 48rpx;
			background: #C8FF0C;
			border-radius: 8rpx;
			font-size: 28rpx;
			color: #222222;
			text-align: center;
			line-height: 48rpx;
			margin-top: 20rpx;
		}
	}

	.t-scheduled-card {
		margin-top: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 32rpx;

		.s-title {
			font-weight: bold;
			font-size: 28rpx;
			color: #222222;
		}

		.t-scheduled-list {
			.item-list {
				display: flex;
				align-items: center;
				gap: 20rpx;
				margin-top: 20rpx;

				.list-left {
					font-size: 24rpx;
					color: #AAAAAA;
				}

				.list-right {
					font-weight: bold;
					font-size: 24rpx;
					color: #222222;
				}
			}
		}
	}

	.t-address-card {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-top: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 32rpx;

		.address {
			display: flex;
			align-items: center;
			gap: 4rpx;
			font-weight: bold;
			font-size: 24rpx;
			color: #222222;
		}

		.nav-info {
			display: flex;
			align-items: center;
			text-align: center;
			gap: 32rpx;
			font-size: 22rpx;
			color: #222222;
		}
	}

	.t-use-card {
		margin-top: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 32rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.use-tips {
			.title {
				font-weight: bold;
				font-size: 32rpx;
				color: #222222;
			}

			.text {
				margin-top: 20rpx;
				font-size: 28rpx;
				color: #AAAAAA;
			}
		}

		.check-all {
			display: flex;
			align-items: center;
			gap: 10rpx;
			font-size: 24rpx;
			color: #AAAAAA;

			&>text {
				margin-bottom: 10rpx;
			}
		}
	}

	.t-order-info-card {
		margin-top: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 32rpx;

		.title {
			font-weight: bold;
			font-size: 32rpx;
			color: #222222;
		}

		.info-list {
			display: flex;
			align-items: center;
			gap: 24rpx;
			margin-top: 20rpx;

			.item-left {
				font-size: 28rpx;
				color: #AAAAAA;
			}

			.item-right {
				font-size: 28rpx;
				color: #222222;
			}
		}
	}

	.appraise-btn {
		margin-top: 20rpx;
		width: 686rpx;
		height: 100rpx;
		background: #C8FF0C;
		border-radius: 60rpx;
		font-weight: bold;
		font-size: 32rpx;
		color: #222222;
		text-align: center;
		line-height: 100rpx;
	}
	.price-detail{
		background: #FFFFFF;
		border-radius: 32rpx 32rpx 0rpx 0rpx;
		padding: 20rpx;
		.price-title{
			font-weight: bold;
			font-size: 32rpx;
			color: #222222;
			text-align: center;
		}
		.price-list{
			.price-total{
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 24rpx;
				.text{
					font-size: 28rpx;
					color: #222222;
				}
				.price{
					font-weight: bold;
					font-size: 28rpx;
					color: #FB5B5B;
				}
			}
		}
	}
	.refund-detail{
		background:#F6F6F6;
		border-radius: 32rpx 32rpx 0rpx 0rpx;
		padding: 20rpx;
		max-height: 1200rpx;
		overflow: auto;
		.refund-title{
			text-align: center;
			font-weight: bold;
			font-size: 32rpx;
			color: #222222;
		}
		.refund-text{
			margin-top: 20rpx;
			padding: 20rpx;
			background: #FFFFFF;
			border-radius: 32rpx;
			font-weight: bold;
			font-size: 32rpx;
			color: #222222;
		}
		.refund-num-card{
			background: #FFFFFF;
			border-radius: 32rpx;
			padding: 20rpx;
			margin-top: 20rpx;
			.refund-number{
				display: flex;
				align-items: center;
				justify-content: space-between;
				.text{
					font-size: 28rpx;
					color: #222222;
				}
				
				.price-stepper {
					display: flex;
					align-items: center;
					border: 1rpx solid #F0F0F0;
					border-radius: 8rpx;
				
					.minus {
						text-align: center;
						width: 44rpx;
						border-right: 1rpx solid #F0F0F0;
					}
				
					&>input {
						width: 80rpx;
						font-size: 28rpx;
						color: #222222;
					}
				
					.add {
						text-align: center;
						width: 44rpx;
						border-left: 1rpx solid #F0F0F0;
					}
				}
			}
			.refund-price{
				margin-top: 20rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.p-text{
					font-size: 28rpx;
					color: #222222;
				}
				.p-price{
					font-weight: bold;
					font-size: 28rpx;
					color: #FB5B5B;
				}
			}
			.refund-account{
				margin-top: 20rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.a-text{
					font-size: 28rpx;
					color: #222222;
				}
				.a-account{
					font-size: 28rpx;
					color: #222222;
				}
			}
			.refund-tips{
				display: flex;
				align-items: center;
				justify-content: flex-end;
				height: 80rpx;
				line-height: 80rpx;
				font-size: 24rpx;
				color: #222222;
			}
		}
		.c-scheduled-card {
			margin-top: 20rpx;
			padding: 20rpx;
			background: #FFFFFF;
			border-radius: 32rpx;
		
			.title {
				font-weight: bold;
				font-size: 28rpx;
				color: #222222;
			}
		
			.schedule-address {
				display: flex;
				gap: 20rpx;
				margin-top: 20rpx;
		
				.text {
					font-size: 24rpx;
					color: #AAAAAA;
				}
		
				.name {
					font-weight: bold;
					font-size: 24rpx;
					color: #222222;
				}
		
				.time-box {
					height:60rpx;
					display: flex;
					align-items: center;
					gap: 160rpx;
					.time{
						font-weight: bold;
						font-size: 24rpx;
						color: #222222;
						margin-bottom: 20rpx;
					}
					.time-icon{
						margin-bottom: 20rpx;
					}
				}
			}
		}
		
		.refund-cause-card{
			background: #FFFFFF;
			border-radius: 32rpx;
			padding: 20rpx;
			margin-top: 20rpx;
			.c-title{
				font-weight: bold;
				font-size: 28rpx;
				color: #222222;
			}
			.c-cause-list{
				.cause-list{
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-top: 20rpx;
					.cause{
						font-size: 24rpx;
						color: #222222;
					}
				}
			}
		}
		.refund-tips{
			display: flex;
			align-items: center;
			gap: 8rpx;
			margin-top: 20rpx;
			.tips-icon{
				width: 30rpx;
				height: 30rpx;
				border-radius: 50%;
				background: #FFA347;
				color: #fff;
				text-align: center;
				line-height: 30rpx;
			}
			.tips-text{
				font-size: 24rpx;
				color: #222222;
			}
		}
		.refund-btn-box{
			position: fixed;
			bottom: 0;
			left: 0;
			width: 95%;
			background: #FFFFFF;
			box-shadow: 0rpx -6rpx 12rpx 2rpx rgba(0,0,0,0.09);
			border-radius: 32rpx 32rpx 0rpx 0rpx;
			padding: 20rpx;
			.refund-btn{
				width: 686rpx;
				height: 100rpx;
				background: #C8FF0C;
				border-radius: 60rpx;
				font-weight: bold;
				font-size: 32rpx;
				color: #222222;
				text-align: center;
				line-height: 100rpx;
			}
		}
	}


</style>