<template>
	<view class="visitor-index">
		<zs-banner></zs-banner>

		<view class="list">
			<view class="combo">
				<view class="bg" :class="[active == index?'active':'']" @click="handleCard(index)"
					v-for="(item,index) in cardList" :key="item.title">
					<view class="card">

						<view class="combo-info">

							<view class="combo-title">
								{{item.title}}
							</view>
							<view class="combo-type">
								连续包月
							</view>
						</view>
						<view class="combo-desc">
							<view class="desc-item" v-for="(item,index) in equityList" :key="index">
								<image class="icon" :src="item.icon" mode=""></image>
								<view class="text">
									{{item.desc}}
								</view>
							</view>
						</view>
						<view class="btn">
							立即订购
						</view>
					</view>
				</view>
			</view>

		</view>



		<view class="table-box box">
			<view class="table-title">
				资费详情
			</view>
			<table class="table">
				<tr>
					<td class="label">名称</td>
					<td class="value">移动生活本地宝</td>
				</tr>
				<tr>
					<td class="label">月费</td>
					<td class="value">20元</td>
				</tr>
				<tr>
					<td class="label">尊享权益</td>
					<td class="value">
						加油充电8折起；<br>
						景区门票6折起；<br>
						千家酒店随心住<br>
					</td>
				</tr>
			</table>

			<view class="step-box">
				<view class="step-title">在线激活流程</view>

				<view class="step">
					<view class="step-item suffix">
						<image src="../../static/step1.png" class="icon" mode=""></image>
						<view class="label">
							用户注册
						</view>
					</view>
					<view class="step-item suffix">
						<image src="../../static/step2.png" class="icon" mode=""></image>
						<view class="label">
							受理开户
						</view>
					</view>
					<view class="step-item suffix">
						<image src="../../static/step3.png" class="icon" mode=""></image>
						<view class="label">
							注册核验
						</view>
					</view>
					<view class="step-item">
						<image src="../../static/step4.png" class="icon" mode=""></image>
						<view class="label">
							激活套餐
						</view>
					</view>
				</view>
			</view>

		</view>

		<view class="choose-btn" @click="handleBtn">
			立即办理
		</view>


		<!-- 登录弹窗 -->
		<zs-login v-model="show"></zs-login>

		<!-- 骨架屏 -->
		<zs-skeleton :loading="loading"></zs-skeleton>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				loading: true,
				active: 1, //套餐默认20
				cardList: [ //套餐列表
					{
						title: '10元套餐',
					},
					{
						title: '20元套餐',
					},
					{
						title: '30元套餐',
					}
				],
				equityList: [{
						icon: require('../../static/equity1.png'),
						desc: '加油充电9折起',
					},
					{
						icon: require('../../static/equity2.png'),
						desc: '景区门票8折起',
					},
					{
						icon: require('../../static/equity3.png'),
						desc: '千家酒店随心住',
					}
				],
			}
		},
		methods: {
			//选择套餐
			handleCard(index) {
				this.active = index
			},
			// 点击办理
			handleBtn() {
				this.show = true
				uni.setStorageSync('type', 1)
			},
		},
		onShow() {
			this.show = false
			this.loading = false
		},
		onHide() {
			this.show = false
		},
	}
</script>

<style lang="scss" scoped>
	.visitor-index {
		padding-bottom: 140rpx;

		.card-title {
			display: flex;
			justify-content: center;

			.title {
				font-size: 32rpx;
				text-align: center;
				color: #fff;
				width: 210rpx;
				line-height: 64rpx;
				background: linear-gradient(360deg, #3074F8 0%, #568FFF 100%);
				border-radius: 0rpx 0rpx 24rpx 24rpx;
			}

		}

		.list {
			padding: 0 20rpx 30rpx;
			position: relative;

			.combo {
				.bg {
					background: $uni-color-primary;
					padding: 12rpx;
					border-radius: 32rpx 32rpx 32rpx 32rpx;
					margin-top: 26rpx;
					opacity: .5;

					.card {
						display: flex;
						padding: 24rpx;
						background: #fff;
						border-radius: 32rpx 32rpx 32rpx 32rpx;

						.combo-info {
							width: 172rpx;
							height: 168rpx;
							background: url('../../static/combo.png') no-repeat;
							background-size: 100%;
							display: flex;
							flex-direction: column;
							align-items: center;

							.combo-title {
								font-size: 36rpx;
								font-family: DingTalk JinBuTi-Regular, DingTalk JinBuTi;
								font-weight: 400;
								color: $uni-text-primary;
								margin-top: 38rpx;
							}

							.combo-type {
								width: 112rpx;
								height: 36rpx;
								line-height: 36rpx;
								text-align: center;
								font-size: 24rpx;
								font-weight: 400;
								color: $uni-text-primary;
								background-color: #fff;
								border-radius: 18rpx;
								margin-top: 20rpx;
							}
						}
					}

					.combo-desc {
						flex: 1;
						margin-left: 38rpx;
						display: flex;
						flex-direction: column;
						justify-content: space-between;

						.desc-item {
							display: flex;
							align-items: center;
							align-content: flex-end;

							.icon {
								width: 36rpx;
								height: 36rpx;
							}

							.text {
								font-size: 24rpx;
								font-weight: 400;
								color: #121212;
								text-indent: 20rpx;
							}
						}
					}

					.btn {
						align-self: flex-end;
						width: 132rpx;
						height: 52rpx;
						line-height: 52rpx;
						font-size: 24rpx;
						color: #fff;
						text-align: center;
						background: $uni-color-primary;
						border-radius: 26rpx 26rpx 26rpx 26rpx;
					}


				}
			}

			.active {
				opacity: 1 !important;
			}

		}

		.choose-btn {
			width: 432rpx;
			line-height: 92rpx;
			text-align: center;
			color: #fff;
			font-weight: bold;
			font-size: 32rpx;
			background: linear-gradient(180deg, #FF876B 0%, #FE5B47 100%);
			box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255, 255, 255, 0.16);
			border-radius: 46rpx 46rpx 46rpx 46rpx;
			position: fixed;
			z-index: 2;
			bottom: 20rpx;
			left: 50%;
			transform: translateX(-50%);
		}

		.equity {
			display: flex;
			align-items: center;
			padding: 40rpx 20rpx;

			.item {
				flex: 1;
				text-align: center;
				padding: 0 15rpx;
				font-size: 24rpx;

				.icon {
					width: 84rpx;
					height: 84rpx;
				}

				.desc {
					margin-top: 10rpx;
				}
			}
		}

		.box {
			border: 6rpx solid #DCE8FF;
			background: #fff;
			border-radius: 28rpx;
			margin: 40rpx 30rpx 0;
		}

		.table-box {
			padding: 30rpx;

			.table-title {
				background: #FEB687;
				color: #fff;
				line-height: 80rpx;
				text-align: center;
				border-radius: 12rpx 12rpx 0 0;
			}

			.table {
				border-collapse: collapse;
				line-height: 50rpx;
				border-radius: 12rpx;
				background: #FFF6EF;

				tr {
					display: flex;

					td {
						border: 2rpx solid #FEB687;
						padding: 10rpx 0 10rpx 40rpx;

					}

					.label {
						width: 200rpx;
						display: flex;
						align-items: center;
					}

					.value {
						flex: 1;
					}
				}
			}
		}

		.step-box {
			padding: 30rpx;
			margin-top: 50rpx;

			.step-title {
				font-size: 30rpx;
				font-weight: bold;
				text-align: center;
				margin-bottom: 45rpx;
				position: relative;

				&::before {
					position: absolute;
					top: 50%;
					left: 80rpx;
					transform: translateY(-50%);
					content: '';
					width: 86rpx;
					height: 8rpx;
					background: linear-gradient(270deg, #FE5B47 0%, rgba(254, 91, 71, 0) 100%);
					border-radius: 8rpx;
				}

				&::after {
					position: absolute;
					top: 50%;
					right: 80rpx;
					transform: translateY(-50%);
					content: '';
					width: 86rpx;
					height: 8rpx;
					background: linear-gradient(90deg, #FE5B47 0%, rgba(254, 91, 71, 0) 100%);
					border-radius: 8rpx;
				}
			}

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

				.step-item {
					text-align: center;

					.icon {
						width: 80rpx;
						height: 80rpx;
					}

					.label {
						font-size: 24rpx;
						color: #121212;
					}
				}

				.suffix {
					position: relative;

					&::after {
						content: '';
						position: absolute;
						top: 50%;
						right: -40rpx;
						transform: translateY(calc(-50% - 20rpx));
						width: 25rpx;
						height: 25rpx;
						background: url('../../static/step5.png') no-repeat;
						background-size: 100%;
						display: block;
					}
				}

			}
		}

	}
</style>