<template>
	<view class="container">
		<!-- 头部优惠券总数量区域 -->
		<view class="header">
			可使用优惠券
			<text>5张</text>
		</view>

		<!-- 优惠券列表区域 -->
		<view class="body">
			<!-- 每一张优惠券区域 -->
			<view class="body_item" v-for="item in list" :key="item.id">
				<img src="../../static/my/couponTitle.png" />
				<view class="item_type" v-if="item.type === 1">折扣卷</view>
				<view class="item_type" v-if="item.type === 2">代金卷</view>
				<view class="item_box">
					<view class="box_left">
						<view class="left_title">{{ item.name }}</view>
						<view class="left_tags">
							<view class="tag">有限期至2023.09.01</view>
							<view class="tag">可通用</view>
							<view class="tag">全民宿</view>
						</view>
					</view>
					<view class="box_right">
						<view class="right_info">
							<view class="info_top">{{ item.info }}</view>
							<view class="info_bottom">满200可用</view>
						</view>
						<view class="right_radio">
							<radio style="transform: scale(0.8)" color="#096562" :checked="item.isCheck" @click="handleChange(item)" />
						</view>
					</view>
				</view>
			</view>
		</view>

		<!-- 底部确定按钮区域 -->
		<view class="foot_btn">确定</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [
				{
					id: 1,
					name: '7.5折折扣卷',
					type: 1,
					info: '7.5折',
					isCheck: false
				},
				{
					id: 2,
					name: '20元代金券',
					type: 2,
					info: '¥20',
					isCheck: false
				},
				{
					id: 3,
					name: '7.5折折扣卷',
					type: 1,
					info: '7.5折',
					isCheck: false
				}
			]
		}
	},
	methods: {
		handleChange(item) {
			item.isCheck = !item.isCheck
		}
	}
}
</script>

<style lang="scss" scoped>
.container {
	box-sizing: border-box;
	padding: 0 30rpx;
	height: 100vh;
	background-color: #f7f7f7;

	.header {
		display: flex;
		align-items: center;
		height: 100rpx;
		font-size: 32rpx;

		text {
			margin-top: 10rpx;
			margin-left: 15rpx;
			color: #808080;
			font-size: 24rpx;
		}
	}

	.body {
		height: calc(100vh - 245rpx);
		overflow-y: auto;

		.body_item {
			position: relative;
			margin-bottom: 10rpx;
			padding-bottom: 10rpx;
			width: 690rpx;
			border-radius: 15rpx;
			background-color: #fff;

			img {
				width: 100rpx;
				height: 36rpx;
			}

			.item_type {
				position: absolute;
				top: 0;
				left: 14rpx;
				font-size: 24rpx;
				font-weight: bold;
				color: #fff;
			}

			.item_box {
				padding: 0 25rpx;
				display: flex;

				.box_left {
					flex: 6;
					overflow: hidden;

					.left_title {
						margin: 12rpx 0;
						font-size: 36rpx;
						font-weight: bold;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.left_tags {
						display: flex;
						flex-wrap: wrap;
						color: #808080;
						font-size: 24rpx;

						.tag {
							margin-right: 32rpx;
							margin-bottom: 15rpx;
						}
					}
				}

				.box_right {
					flex: 2;
					display: flex;

					.right_info {
						flex: 1;
						display: flex;
						flex-direction: column;
						width: 100rpx;
						color: #ff5733;

						.info_top {
							margin-top: 10rpx;
							font-size: 36rpx;
						}

						.info_bottom {
							margin-top: 10rpx;
							font-size: 20rpx;
						}
					}

					.right_radio {
						display: flex;
						justify-content: center;
						align-items: center;
						width: 40rpx;
					}
				}
			}
		}
	}

	.foot_btn {
		display: flex;
		justify-content: center;
		align-items: center;
		margin: 32rpx 0 17rpx;
		width: 690rpx;
		height: 96rpx;
		color: #fff;
		font-size: 32rpx;
		font-weight: bold;
		border-radius: 64rpx;
		background-color: #096562;
	}
}
</style>
