<template>
	<view>
		<view class="bgMain">
			<view>
				<view class="orderList" @click="clickItem">
					<view class="order">
						<view class="orderId">订单号：{{data.orderNo}}</view>
						<view class="orderStatus">{{data.status == 1?'未核销':'已核销'}}</view>
					</view>
					<view class="orderItem">
						<view>
							<image class="img" :src="data.goodsImage"></image>
						</view>
						<view class="goodsInfo">
							<view class="orderGoodsName">{{data.goodsName}}</view>
							<view class="orderGoodsType">{{data.goodsType}}</view>
							<view class="price">
								<view class="orderPrice">￥{{data.goodsPrice}}</view>
								<view class="goodsNum">×{{data.goodsNum}}</view>
							</view>
						</view>
					</view>
				</view>


				<view class="verificationInfo">
					<view class="bg"></view>
					<view class="verifi">订单信息</view>
				</view>

				<view class="orderInfo">
					<view class="orderId">
						<view class="orderTitle">订单号</view>
						<view>{{data.orderNo}}</view>
					</view>
					<view class="orderId">
						<view class="orderTitle">手机号</view>
						<view>{{data.phoneNumber}}</view>
					</view>
					<view class="orderId">
						<view class="orderTitle">交易方式</view>
						<view>{{data.transactions==1? "微信交易":"支付宝"}}</view>
					</view>
					<view class="orderId">
						<view class="orderTitle">下单时间</view>
						<view>{{data.orderTime}}</view>
					</view>
					<view class="orderId">
						<view class="orderTitle">付款时间</view>
						<view>{{data.paymentTime}}</view>
					</view>

				</view>
			</view>
		</view>
		
		<view class="confirmVerification" @click="confirmVerification">
			确认核销
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				couponCode: "",
				data: {}
			}
		},
		onLoad(options) {
			console.log(options)
			this.couponCode = options.id
			this.getOrderDetails();
		},
		methods: {
			
			//核销
			confirmVerification(){
				uni.showModal({
					title:'提示',
					content:'确认核销该订单吗，请确认！',
					success: (modalRes) => {
						console.log(modalRes);
						if(modalRes.confirm){
							this.$http.get('/api/store/writeOff/writeOff',{
								writeOffId:this.data.id
							}).then(res=>{
								uni.showToast({
									icon:'none',
									title:res.msg
								})
								if(res.code == 200){
									setTimeout(()=>{
										uni.navigateBack()
									},800)
								}
							})
						}
					}
				})
				
			},
			
			getOrderDetails() {
				this.$http.post("/api/store/writeOff/writeOffOrderDetails", {
					couponCode: this.couponCode,
				}).then(res => {
					if (res.code == 200)
						console.log(res.data)
					this.data = res.data

				})
			},
		}
	}
</script>

<style lang="scss">
	.left {}

	.infoleft {
		flex: 1;
	}

	.brandLogo {
		width: 60rpx;
		height: 52rpx;
	}

	.goodType {
		font-size: 24rpx;
		color: #999999;
	}

	.vehicleInfo {
		margin-top: 20rpx;
		display: flex;
		align-items: center;
		padding: 24rpx;
		background: #FFFFFF;
		border-radius: 18rpx 18rpx 18rpx 18rpx;

		.img {
			width: 11rpx;
			height: 23rpx;
		}

		.vehicle {
			display: flex;
			justify-content: space-between;

			.plate {
				display: flex;
				color: #FFFFFF;
				padding-right: 50rpx;

			}

		}

		.economize {
			background: #0087EF;
			border-radius: 8rpx 0rpx 0rpx 8rpx;
			font-size: 24rpx;
			padding: 12rpx 20rpx 12rpx 20rpx;
			border: 1rpx solid #0087EF;
		}

		.licensePlate {
			background: #E5EEF5;
			border-radius: 0rpx 8rpx 8rpx 0rpx;
			border: 1rpx solid #0087EF;
			padding: 12rpx 20rpx 12rpx 20rpx;
			color: #0087EF;
		}
	}

	.orderInfo {
		margin-top: 20rpx;
		padding: 24rpx;
		background: #FFFFFF;
		border-radius: 14rpx 14rpx 14rpx 14rpx;
		font-size: 28rpx;
		color: #333333;

		.orderTitle {
			font-size: 28rpx;
			color: #666666;
		}
	}

	.orderId {
		padding-top: 37rpx;
		display: flex;
		justify-content: space-between;
	}

	.qr {
		margin-top: 20rpx;
		background: #FFFFFF;
		border-radius: 14rpx 14rpx 14rpx 14rpx;

		.verificationTime {
			padding-left: 20rpx;
			padding-top: 5rpx;
			font-size: 28rpx;
			padding-bottom: 20rpx;
			color: #333333;
		}

		.verifQr {
			font-size: 28rpx;
			color: #333333;
		}

		.qrInfo {
			padding: 20rpx;
			justify-content: space-between;
			display: flex;

			.verifiedoff {
				font-size: 28rpx;
				color: #999999;
			}
		}

		.qrImg {
			text-align: center;
		}
	}

	.qrCode {
		padding-top: 20rpx;
		width: 493rpx;
		height: 322rpx;
	}

	.verificationInfo {
		display: flex;
		padding-top: 37rpx;

		.verifi {
			margin-left: 15rpx;
			font-size: 28rpx;
			color: #333333;
		}

		.bg {
			padding-top: 10rpx;
			width: 6rpx;
			height: 37rpx;
			background: #FF4502;
			border-radius: 0rpx 0rpx 0rpx 0rpx;
		}
	}

	.orderList {
		padding: 24rpx;
		background: #FFFFFF;
		border-radius: 14rpx 14rpx 14rpx 14rpx;

		.orderItem {
			display: flex;
			padding-top: 10rpx;

			.orderGoodsName {
				font-size: 28rpx;
				color: #333333;
			}

			.goodsInfo {
				padding-left: 10rpx;
				flex: 1
			}

			.orderGoodsType {
				padding-top: 10rpx;
				font-size: 24rpx;
				color: #999999;
			}

			.price {
				display: flex;
				justify-content: space-between;
				padding-top: 30rpx;

				.orderPrice {
					font-size: 32rpx;
					color: #FF4502;
					font-weight: 800;
				}

				.goodsNum {
					font-size: 24rpx;
					color: #999999;
				}
			}
		}

		.order {
			justify-content: space-between;
			display: flex;

			.orderId {
				font-size: 24rpx;
				color: #999999;
			}

			.orderStatus {
				font-size: 24rpx;
				color: #FF4502;
			}
		}

		.img {
			width: 156rpx;
			height: 156rpx;
		}
	}
	
	.confirmVerification{
		width: 702rpx;
		height: 100rpx;
		background: linear-gradient( 90deg, #FF4502 0%, #FF8903 100%);
		border-radius: 50rpx 50rpx 50rpx 50rpx;
		text-align: center;
		line-height: 100rpx;
		position: fixed;
		bottom: 50rpx;
		left: 50%;
		transform: translateX(-50%);
		font-weight: bold;
		font-size: 32rpx;
		color: #FFFFFF;
	}
</style>