<template>
	<view class="content">
		<view class="g-orderinfo-card">
			<view class="g-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分钟室内精品课程，一对一篮球30分</view>
					<view class="price-info">
						<view class="price"><text class="mini-text">￥</text>25.9</view>
						<view class="price-stepper">
							<view class="minus">-</view>
							<input type="number" />
							<view class="add">+</view>
						</view>
					</view>
				</view>
			</view>
			<view class="g-shoping-total">
				<view class="total-price">
					<view class="">商品总价（共1件）</view>
					<view class="">￥25.9</view>
				</view>
				<view class="total-price">
					<view class="">团购优惠</view>
					<view class="">-￥25.90</view>
				</view>
			</view>
			<view class="subtotal">小计 ￥125</view>
		</view>
		<!-- 无固定场进入 -->
		<view class="g-buy-tips" v-if="loadType==1">
			<view class="tips-title">购买须知</view>
			<view class="tips-info-card">
				<view class="title">有效期</view>
				<view class="text">购买后90天内有效</view>
				<view class="title">使用时间</view>
				<view class="text">10：00-22：00</view>
				<view class="title">预约信息</view>
				<view class="text">请您<text style="color: #222;">提前1小时</text>预约</view>
				<view class="title">使用人数</view>
				<view class="text">每张券最多20人使用</view>
				<view class="title">温馨提示</view>
				<view class="text">如需该券发票，请您在消费时，向场馆咨询。</view>
				<view class="text">为了保障您的权益，建议使用平台线上支付，若使用了其他方式支付导致纠纷，平台不承担任何责任，感谢您的理解和支持。</view>
			</view>
		</view>
		<!-- 课程进入 -->
		<view class="g-insurance-card" v-if="loadType==2">
			<view class="g-insurance-info">
				<view class="insurance-type">
					<view class="type-name">
						<view class="name">意外险</view>
						<view class="tips">不支持退款</view>
					</view>
					<view class="insurance-more">
						<text>查看详情</text>
						<zzx-icon name="ashRight" size="12"></zzx-icon>
					</view>
				</view>
				<view class="insurance-num" @click="select_insurance=!select_insurance">
					<view class="">￥3/人×1份（意外事故10万，社保内医疗1万）</view>
					<zzx-icon :name="select_insurance?'selected' : 'unchecked'" size="14"></zzx-icon>
				</view>
			</view>
			<view class="insurance-total">
				<view class="text">保险总价(共2件)</view>
				<view class="price">￥6</view>
			</view>
		</view>
		<view class="g-userinfo-card">
			<view class="r-user">
				<view class="user-title">用户信息</view>
				<view class="invite">
					<zzx-icon name="wechat" size="16"></zzx-icon>
					<view style="margin-bottom: 8rpx;">邀请微信好友</view>
					<zzx-icon name="ashRight" size="12"></zzx-icon>
				</view>
			</view>
			<view class="user-tags">张三</view>
			<view class="r-user-list" v-for="item in 2">
				<view class="minus-user">-</view>
				<view class="r-list">
					<view class="name">张三</view>
					<view class="id-num">身份证 51**************10</view>
				</view>
			</view>
			<view class="g-adduser-btn">
				<view class="add-icon">+</view>
				<view class="add-text">添加用户</view>
			</view>
		</view>
		<view class="g-usetips-card">
			<view class="use-title">使用须知</view>
			<view class="use-text">
				<view class="item-text">1.购买后，需按照课表按时上课；</view>
				<view class="item-text">2.如有特殊情况，需上传相关证明；</view>
				<view class="item-text">3.由于特殊情况耽误了课程，后续会发布补课表，集中补课</view>
			</view>
			<view class="use-tips-more" @click="RouterUtils.to_page('/pages/index/useNotice/index')">
				<view class="more-text">查看更多</view>
				<view class="use-line"></view>
			</view>
		</view>
		<view style="height: 166rpx;"></view>
		<view class="footer footer-box">
			<view class="footer-price">
				<view class="total-price">合计：</view>
				<view class="price"><text class="mini-text">￥</text>50.59</view>
				<view class="discount">优惠￥22.59</view>
			</view>
			<view class="footer-btn" @click="to_pay">
				<button>
					<view class="btn-price">￥57.8</view>
					<view class="btn-price">立即支付</view>
				</button>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import { ref } from 'vue';
	import { onLoad, onPageScroll } from '@dcloudio/uni-app';
	import { RouterUtils } from '@/utils/util';
	const select_insurance = ref(false);
	const loadType=ref(1)
	onLoad((options)=>{
		loadType.value=options.type
		
	})
	
	const to_pay=()=>{
		uni.navigateTo({
			url:'/pages/index/cancelOrder/index'
		})
	}
</script>

<style lang="less" scoped>
	.g-orderinfo-card {
		background: #FFFFFF;
		border-radius: 32rpx;
		padding: 20rpx;
		margin-top: 20rpx;

		.g-shoping-info {
			display: flex;
			align-items: center;
			gap: 20rpx;

			.shoping-img {
				width: 200rpx;
				height: 200rpx;
				border-radius: 32rpx;
			}

			.shoping-info {
				width: 440rpx;

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

				.price-info {
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-top: 26rpx;

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

					.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;
						}
					}
				}
			}
		}

		.g-shoping-total {
			height: 148rpx;
			margin-top: 24rpx;
			border-top: 1rpx solid #F0F0F0;

			.total-price {
				margin-top: 24rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 28rpx;
				color: #222222;
			}
		}

		.subtotal {
			border-top: 1rpx solid #F0F0F0;
			height: 84rpx;
			line-height: 84rpx;
			font-weight: bold;
			font-size: 28rpx;
			color: #FB5B5B;
			text-align: right;
		}
	}

	.g-buy-tips {
		margin-top: 20rpx;

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

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

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

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

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

		.g-insurance-info {
			.insurance-type {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.type-name {
					display: flex;
					align-items: center;
					gap: 10rpx;

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

					.tips {
						width: 136rpx;
						height: 36rpx;
						background: #FDD143;
						border-radius: 8rpx;
						font-size: 22rpx;
						color: #222222;
						text-align: center;
						line-height: 36rpx;
					}
				}

				.insurance-more {
					display: flex;
					align-items: center;
					gap: 10rpx;

					&>text {
						margin-bottom: 4rpx;
						font-size: 24rpx;
						color: #AAAAAA;
					}
				}
			}

			.insurance-num {
				margin-top: 16rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 24rpx;
				color: #AAAAAA;
			}
		}

		.insurance-total {
			margin-top: 20rpx;
			border-top: 1rpx solid #F0F0F0;
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 88rpx;

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

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

	.g-userinfo-card{
		margin-top: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 32rpx;
		.r-user {
			display: flex;
			align-items: center;
			justify-content: space-between;
			.user-title {
				font-weight: bold;
				font-size: 28rpx;
				color: #222222;
			}
			.invite{
				display: flex;
				align-items: center;
				gap: 8rpx;
				font-size: 24rpx;
				color: #AAAAAA;
			}
		}
		.user-tags{
			margin-top: 20rpx;
			width: 112rpx;
			height: 40rpx;
			background: #FDD143;
			border-radius: 8rpx;
			line-height: 40rpx;
			font-weight: bold;
			font-size: 28rpx;
			color: #222222;
			text-align: center;
			font-size: 28rpx;
			color: #222222;
		}
		.r-user-list{
			margin-top: 20rpx;
			display: flex;
			align-items: center;
			gap: 20rpx;
			border-top: 1rpx solid #F0F0F0;
			height: 140rpx;
			.minus-user{
				width: 30rpx;
				height: 30rpx;
				border-radius: 50%;
				background: #FB5B5B;
				text-align: center;
				line-height:20rpx;
				font-weight: 600;
				color: #fff;
				font-size: 40rpx;
			}
			.r-list{
				.name{
					font-weight: bold;
					font-size: 28rpx;
					color: #222222;
				}
				.id-num{
					font-size: 28rpx;
					color: #222222;
				}
			}
		}
		.g-adduser-btn{
			display: flex;
			height: 88rpx;
			align-items: center;
			justify-content: center;
			gap: 20rpx;
			border-top: 1rpx solid #F0F0F0;
			.add-icon{
				width: 30rpx;
				height: 30rpx;
				border-radius: 50%;
				background: #FDD143;
				font-size:30rpx;
				font-weight: 600;
				color: #fff;
				text-align: center;
				line-height: 20rpx;
			}
			.add-text{
				font-size: 28rpx;
				color: #FDD143;
			}
		}
	}
	.g-usetips-card{
		margin-top: 20rpx;
		padding: 20rpx;
		background: #FFFFFF;
		border-radius: 32rpx;
		.use-title{
			font-weight: bold;
			font-size: 28rpx;
			color: #222222;
		}
		.use-text{
			font-size: 24rpx;
			color: #222222;
			.item-text{
				margin-top: 20rpx;
			}
		}
		.use-tips-more{
			margin-top: 20rpx;
			.more-text{
				text-align: center;
				font-size: 24rpx;
				color: #CCCCCC;
			}
			.use-line{
				margin: auto;
				margin-top: 10rpx;
				width: 38rpx;
				height: 4rpx;
				background: #CCCCCC;
				border-radius: 2rpx;
			}
		}
	}
	.footer {
		left: 0;

		.footer-price {
			display: flex;
			align-items: center;

			.total-price {
				font-weight: bold;
				font-size: 28rpx;
				color: #222222;
			}

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

			.discount {
				margin-left: 10rpx;
				font-size: 24rpx;
				color: #222222;
			}
		}

		.footer-btn {
			&>button {
				width: 226rpx;
				height: 100rpx;
				background: #C8FF0C;
				border-radius: 60rpx;
				font-weight: bold;
				font-size: 32rpx;
				color: #222222;
				line-height: 44rpx;
			}

			&>button::after {
				border: none;
			}
		}
	}
</style>