<template>
	<view>
		<view class="cmain">
			<view class="box order_detail">
				<view>
					<view class="item ctt">订单确认</view>
				</view>
				<view class="expand" :style="{ height: expand ? 'auto' : '300px' }">
					<view class="item">
						<text class="label">订单编号</text>
						<text class="desc omit">{{ item.tradeNo }}</text>
					</view>
					<view class="item">
						<text class="label">结算单号</text>
						<text class="desc omit">{{ item.settleBillNo }}</text>
					</view>
					<view class="item">
						<text class="label">预申报编号</text>
						<text class="desc omit">{{ item.platSeqNo }}</text>
					</view>
					<view class="item">
						<text class="label">买家</text>
						<text class="desc omit">{{ item.buyUserName }}</text>
					</view>
					<view class="item">
						<text class="label">车牌号</text>
						<text class="desc">{{ item.veNo }}</text>
					</view>
					<view class="item">
						<text class="label">商品名称</text>
						<text class="desc">{{ item.goodsNames }}</text>
					</view>
					<view class="item">
						<text class="label">申报金额</text>
						<text class="desc">¥ {{ item.totalPrice }}</text>
					</view>
					<view class="item">
						<text class="label">净重</text>
						<text class="desc">{{ item.netWt }}</text>
					</view>
					<view class="item">
						<text class="label">毛重</text>
						<text class="desc">{{ item.grossWt }}</text>
					</view>
					<view class="item">
						<text class="label">申报数量</text>
						<text class="desc">{{ item.buyQty }}</text>
					</view>
					<view class="item">
						<text class="label">商户名称</text>
						<text class="desc">{{ item.enterpriseName }}</text>
					</view>
					<!-- 	<view class="item">
						<text class="label">边民额度序号</text>
						<text class="desc">{{ item.limitNo }}</text>
					</view> -->
					<view class="item">
						<text class="label">商品额度</text>
						<text class="desc">{{ item.glimit }}</text>
					</view>
					<view class="item">
						<text class="label">商品序号</text>
						<text class="desc">{{ item.gno }}</text>
					</view>
					<view class="item">
						<text class="label">交易地区名称</text>
						<text class="desc">{{ item.tradeAreaName }}</text>
					</view>
					<view class="item">
						<text class="label">进口预申报号</text>
						<text class="desc">{{ item.preIeportNo }}</text>
					</view>
					<view class="item">
						<text class="label">批次预录入号</text>
						<text class="desc">{{ item.preNo }}</text>
					</view>
				</view>
				<view class="more" @click="expand = !expand">
					<text class="icon">&#xe649;</text>
					<text>{{ expand ? '收起' : '更多信息' }}</text>
				</view>
			</view>
		</view>
		<view class="mfooter">
			<view class="flex">
				<view class="f">
					<button class="btn" @click="ok()">确定</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			expand: false, //展开
			item: {},
			orderId: ''
		};
	},
	onLoad(e) {
		if (e.orderId) {
			this.orderId = e.orderId;
			this.getData();
		}
		//人脸认证回调
		uni.$on('face', res => {
			this.http.request({
				url: '/level-one-server/app/TbOrder/confirmOrder',
				method: 'POST',
				data: { orderId: this.item.id },
				success: res => {
					uni.showToast({ title: '订单确认成功' });
					setTimeout(() => {
						uni.switchTab({ url: '/pages/index/index' });
					}, 1000);
				}
			});
		});
	},
	methods: {
		getData() {
			this.http.request({
				url: '/level-one-server/app/TbOrder/orderDetail',
				data: { orderId: this.orderId },
				success: res => {
					this.item = res.data.data;
				}
			});
		},
		ok() {
			uni.showModal({
				title: '提示',
				content: '我已核对信息无误',
				success: res => {
					if (res.confirm) {
						//跳转到人脸认证
						uni.navigateTo({url:'/pages/face/faceRegister?type=2'})
					}
				}
			});
		}
	},
	destroyed() {
		uni.$off('face');
	}
};
</script>

<style lang="scss">
page {
	background-color: $pg;
}
.cmain {
	padding-bottom: 100px;
}
.expand {
	overflow: hidden;
}
.more {
	text-align: center;
	padding: 10px 10px 15px 10px;
	.icon {
		padding-right: 3px;
	}
}
.ctt {
	text-align: center;
	font-weight: bold;
}
</style>
