<template>
	<view class="scenic-makeOut">
		<u--form
			labelPosition="left"
			:model="form"
			:rules="rules"
			ref="uForm"
			labelWidth="150rpx"
			>
			<view class="content info">
				<view class="title">
					敦煌鸣沙山与月牙泉门票成人票
				</view>
				<view class="notice">
					<view class="text">
						预定须知 
					</view>
					<image class="jiantou" src="../static/right.png" mode=""></image>
				</view>
				<u-form-item
						label="出游日期"
						borderBottom
						ref="item1"
				>
					<view class="time-box" @click="chooseTime">
						<image class="right-icon" src="../static/right.png" mode=""></image>
					</view>
				</u-form-item>
				<view class="signUp-box">
					<view class="label-box">
						<view class="label">
							报名人数
						</view>
						<view class="desc">
							（最多10张）
						</view>
					</view>
					<view class="num-box">
						<view class="btn" :class="[num == 1?'disabled':'']" @click="add(-1)">
							-
						</view>
						<view class="num">
							{{num}}
						</view>
						<view class="btn" :class="[num == 10?'disabled':'']" @click="add(1)">
							+
						</view>
					</view>
				</view>
			</view>
			
			<view class="content ">
				<view class="sub-title">
					取票人信息
				</view>
				<u-form-item
						label="姓名"
						borderBottom
						ref="item1"
				>
					<u--input
							v-model="form.name"
							border="none"
							placeholder="请输入姓名"
					></u--input>
				</u-form-item>
				<u-form-item
						label="手机号"
						borderBottom
						ref="item1"
				>
					<u--input
							v-model="form.name"
							border="none"
							placeholder="请输入手机号"
					></u--input>
				</u-form-item>
				<u-form-item
						label="证件类型"
						borderBottom
						ref="item1"
				>
					<view class="time-box" @click="chooseTime">
						<image class="right-icon" src="../static/right.png" mode=""></image>
					</view>
				</u-form-item>
				<u-form-item
						label="证件号"
						ref="item1"
				>
					<u--input
							v-model="form.name"
							border="none"
							placeholder="请输入证件号"
					></u--input>
				</u-form-item>
			</view>
			
			<view class="content" v-for="item in num" :key="item">
				<view class="sub-title">
					出游人信息
				</view>
				<view class="no">
					第{{item+1}}位
				</view>
				<u-form-item
						label="姓名"
						borderBottom
						ref="item1"
				>
					<u--input
							v-model="form.name"
							border="none"
							placeholder="请输入姓名"
					></u--input>
				</u-form-item>
				<u-form-item
						label="手机号"
						borderBottom
						ref="item1"
				>
					<u--input
							v-model="form.name"
							border="none"
							placeholder="请输入手机号"
					></u--input>
				</u-form-item>
				<u-form-item
						label="证件类型"
						borderBottom
						ref="item1"
				>
					<view class="time-box" @click="chooseTime">
						<image class="right-icon" src="../static/right.png" mode=""></image>
					</view>
				</u-form-item>
				<u-form-item
						label="证件号"
						ref="item1"
				>
					<u--input
							v-model="form.name"
							border="none"
							placeholder="请输入证件号"
					></u--input>
				</u-form-item>
			</view>
			
		</u--form>
		
		<view class="btn-box">
			<view class="left">
				<view class="num">
					共{{num}}件
				</view>
				<view class="total">
					合计 <view class="price-box">
						<view class="unit">
							￥
						</view>
						<view class="price">
							{{total}}
						</view>
					</view>
				</view>
			</view>
			<button class="btn" @click="handleBuy" :loading="loading">
				立即报名
			</button>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				num:1,
				total:0,
				loading:false,
				form:{
					name:''
				},
				rules: {
						'name': {
							type: 'string',
							required: true,
							message: '请填写姓名',
							trigger: ['blur', 'change']
						},
					},
			}
		},
		methods: {
			chooseTime() {
				console.log(1111);
			},
			add(val){
				if((val==-1&&this.num == 1)||(val==1&&this.num == 10)) return
				this.num += val
			},
			handleBuy(){
				
			}
		},
		onReady() {
				//如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
		    	this.$refs.uForm.setRules(this.rules)
		    },
	}
</script>

<style lang="scss" >
.scenic-makeOut{
	background: #F9F9F9;
	border-radius: 0rpx 0rpx 0rpx 0rpx;
	padding: 20rpx 24rpx 120rpx;
	.content{
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin-bottom: 20rpx;
		padding: 24rpx;
	}
	.sub-title{
		font-weight: 600;
		font-size: 28rpx;
		color: #222222;
		padding-bottom: 24rpx;
		border-bottom: 1rpx solid #F0F0F0;
	}
	.no{
		padding: 24rpx 0;
		font-size: 28rpx;
		color: #222222;
	}
	.time-box{
		display: flex;
		justify-content: flex-end;
		.right-icon{
			width: 48rpx;
			height: 48rpx;
		}
	}
	.info{
		.title{
			font-weight: 600;
			font-size: 36rpx;
			color: #222222;
			width: 100%;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
			margin-top: 10rpx;
		}
		.notice{
			display: flex;
			align-items: center;
			font-size: 24rpx;
			color: #AAAAAA;
			margin-top: 20rpx;
			.jiantou{
				width: 48rpx;
				height: 48rpx;
			}
		}
		
		.signUp-box{
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding-top: 20rpx;
			.label-box{
				display: flex;
				align-items: center;
				.label{
					font-weight: 300;
					font-size: 24rpx;
					color: #181818;
				}
				.desc{
					font-weight: 300;
					font-size: 24rpx;
					color: #AAAAAA;
				}
			}
			.num-box{
				display: flex;
				align-items: center;
				.btn.disabled{
					background: #F0F0F0;
					color: #AAAAAA;
				}
				.btn{
					width: 36rpx;
					height: 36rpx;
					line-height: 36rpx;
					border-radius: 50%;
					background: #E2ECFF;
					color: #3879F9;
					font-size: 30rpx;
					text-align: center;
					vertical-align: top;
				}
				.num{
					font-weight: 400;
					font-size: 24rpx;
					color: #222222;
					width: 50rpx;
					text-align: center;
					
				}
			}
		}
		
	}
	.btn-box {
		position: fixed;
		bottom: 0%;
		left: 0%;
		z-index: 2;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		box-sizing: border-box;
		padding: 10rpx 24rpx env(safe-area-inset-bottom);
		background: #fff;
		border-top: 1rpx solid #EEEEEE;
		.left{
			display: flex;
			align-items: flex-end;
			.num{
				font-weight: 300;
				font-size: 24rpx;
				color: #AAAAAA;
			}
			.total{
				font-weight: 300;
				font-size: 24rpx;
				color: #222222;
				display: flex;
				align-items: flex-end;
				margin-left: 6rpx;
				.price-box{
					display: flex;
					align-items: flex-end;
					font-weight: 400;
					font-size: 32rpx;
					color: #222222;
					.unit{
						font-size: 20rpx;
					}
				}
			}
		}
	
		.btn {
			width: 280rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			background: $uni-color-primary;
			border-radius: 40rpx;
			font-weight: 600;
			font-size: 28rpx;
			color: #FFFFFF;
			margin: 0;
		}
	}
}
</style>