<template>
	<view class="ordersVerification">
		<view style="height: 24rpx;width: 100%;background:#F9F9F9 ;"></view>
		<!-- 表单 -->
		<view class="form">
			<uni-forms ref="baseForm" :modelValue="FormData">
				<uni-forms-item label="收货人" labelWidth="150rpx">
					<uni-easyinput v-model="FormData.name" placeholder="请输入收货人" />
				</uni-forms-item>
				<uni-forms-item label="联系方式" labelWidth="150rpx">
					<uni-easyinput v-model="FormData.contact" placeholder="请输入联系方式" />
				</uni-forms-item>
				<uni-forms-item label="兑换时间" labelWidth="150rpx">
					<uni-easyinput v-model="FormData.date" placeholder="请输入兑换时间" />
				</uni-forms-item>
				
				<!-- <uni-forms-item label="兑换时间" labelWidth="150rpx">
					<view class="date">
						<picker mode="date" :value="FormData.date" :start="startDate" :end="endDate"
							@change="bindDateChange">
							<view class="uni-input" >
								<text v-if="FormData.date==''||FormData.date==null"
									style="color: #999999 ;">选择兑换时间</text>
								<text v-if="FormData.date!=''">{{FormData.date}}</text>
							</view>
						</picker>
					</view>
				</uni-forms-item> -->
				
			</uni-forms>
		</view>
		
		<!-- 商品信息 -->
		<view class="card" >
			<view class="toptitle">
				<view>洲际天堂大饭店</view>
				<view>未核销</view>
			</view>
			<view class="shopCard">
				<image  src="/static/icon/Kudosbg.png"></image>
				<view style="margin-left: 24rpx;">
					<text class="name">端午佳节五香肉粽子，仅限前</text>
					<text class="tag">礼盒装 2000积分</text>
				</view>
			</view>
			<view class="points">
				<text class="totalName">共计:</text>
				<text class="totalContent">2000积分</text>
			</view>
			<view class="btn" >
				<text>核销</text>
			</view>
		</view>
		
		<!-- 核销订单按钮 -->
		<view class="bottombtn">
			<view class="btnitem" @click="verificationOrder">
				<text>核销订单</text>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default{
		data(){
			const currentDate = this.getDate({
				format: true
			})
			return{
				// 表单数据
				FormData:{
					name:'',
					contact:'',
					date:'',
				},
			}
		},
		computed: {
			startDate() {
				return this.getDate('start');
			},
			endDate() {
				return this.getDate('end');
			}
		},
		methods:{
			// 核销订单
			verificationOrder(){
				uni.showModal({
					title: '提示',
					content: '是否核销订单',
					cancelColor:'#333333',
					confirmColor:'#FF6200',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定');
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			// 选择兑换时间
			bindDateChange: function(e) {
				this.FormData.date=e.detail.value
			},
			// 获取时间
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();
			
				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 2;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			}
		},
	}
</script>

<style lang="scss" scoped>
	$pageColor:#F9F9F9;
	$bgColor:#FFFFFF;

	// flex布局居中对齐
	@mixin flexlayout {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.ordersVerification {
		height: 100%;
		background: $pageColor;
	}
	::v-deep .uni-forms-item.is-direction-left{
		border-bottom: 2rpx solid #F0F0F0;
	}
	::v-deep .uni-forms-item.is-direction-left:last-child{
		border-bottom: 0rpx solid #F0F0F0;
	}
	::v-deep .is-input-border {
		border: none;
	}
	.form {
		width: 750rpx;
		height: 328rpx;
		background: $bgColor;
		border-radius: 16rpx;
		padding:10rpx 30rpx;
		box-sizing: border-box;
	}
	.card{
		margin-top: 24rpx;
		// width: 750rpx;
		// height: 426rpx;
		background: $bgColor;
		border-radius: 16rpx;
		padding:32rpx 28rpx 24rpx 28rpx;
		box-sizing: border-box;
		.toptitle{
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 28rpx;
			font-family: PingFang-SC-Bold, PingFang-SC;
			font-weight: bold;
			color: #080F18;
		}
		.shopCard{
			margin-top: 28rpx;
			width: 694rpx;
			height: 164rpx;
			background: #F4F5F6;
			border-radius: 10rpx;
			display: flex;
			align-items: center;
			image{
				width: 132rpx;
				height: 132rpx; 
				margin-left: 16rpx;
				display: inline-block;
			}
			.name{
				font-size: 28rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #080F18;
				display: block;
			}
			.tag{
				font-size: 24rpx;
				font-family: PingFang-SC-Medium, PingFang-SC;
				font-weight: 500;
				color: #666666;
			}
		}
		.points{
			display: flex;
			justify-content: flex-end;
			align-items: center;
			margin-top: 30rpx;
			.totalName{
				font-size: 22rpx;
				font-family: PingFang-SC-Medium, PingFang-SC;
				font-weight: 500;
				color: #080F18;
				margin-right: 10rpx;
			}
			.totalContent{
				font-size: 30rpx;
				font-family: PingFang-SC-Heavy, PingFang-SC;
				font-weight: 800;
				color: #080F18;
			}
		}
		.btn{
			width: 170rpx;
			height: 60rpx;
			background: #FFFFFF;
			border-radius: 30rpx;
			border: 2rpx solid #D0D0D0;
			margin-left: 524rpx;
			margin-top: 15rpx;
			@include flexlayout()
			text{
				font-size: 26rpx;
				font-family: PingFang-SC-Medium, PingFang-SC;
				font-weight: 500;
				color: #080F18;
			}
		}
	}
	.bottombtn{
		width: 690rpx;
		height: 92rpx;
		background: linear-gradient(270deg, #FF6200 0%, #FF9342 100%);	
		border-radius: 12rpx;
		margin-left: 30rpx;
		position: fixed;
		bottom: 72rpx;
		@include flexlayout()
		.btnitem{
			@include flexlayout()
			text{
				font-size: 30rpx;
				font-family: PingFang-SC-Bold, PingFang-SC;
				font-weight: bold;
				color: $bgColor;
			}
		}
	}
	.date{
		width: 545rpx;
		height: 74rpx;
		background: #FFFFFF;
		display: flex;
		align-items:center;
		padding-left: 20rpx; 
		box-sizing: border-box;
		position: relative;
	}
</style>
