<template>
	<view>
		<view class="cmain">
			<view class="box order_detail" style="padding: 13px">
				<u-steps :current="0">
					<u-steps-item title="订单确认"></u-steps-item>
				</u-steps>
			</view>
			<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.goodsUnit }}</text>
					</view>
					<view class="item">
						<text class="label">商铺名称</text>
						<text class="desc">¥ {{ item.shopName }}</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.netWeight }}</text>
					</view>
					<view class="item">
						<text class="label">毛重</text>
						<text class="desc">¥ {{ item.grossWeight }}</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.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();
		}
	},
	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) {
						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);
							}
						});
					}
				}
			});
		}
	}
};
</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>
