<template>
	<view class="history">
		<uni-section :title="'数量: ' + waybills.length"></uni-section>
		<view class="item" v-for="(item, i) in waybills" :key="i">
			<text class="code" :style="{ color: '#666' }">{{ item.order_box_no }}</text>
			<text class="type">重量: {{ item.weight }}KG</text>
			<view class="sub-items">
				<view class="sub-item">
					<text class="type">批次/船航/托盘</text>
					<text class="type">{{ item.batch_shipping_pallet }}</text>
				</view>
				<view class="sub-item">
					<text class="type">末公里运单号</text>
					<text class="type">{{ item.tracking_number|| '无' }}</text>
				</view>
			</view>
		</view>
		<view v-if="waybills.length === 0" class="is-empty">暂无运单</view>
	</view>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
const waybills = ref([]);
const getHistory = () => {
	waybills.value = uni.getStorageSync('waybills');
};
onLoad(() => {
	getHistory();
});
</script>

<style lang="scss" scoped>
.history {
	display: flex;
	width: 100%;
	flex-direction: column;
	justify-items: start;
 
	.type {
		padding-right: 20rpx;
		font-size: 24rpx;
		margin-top: 10rpx;
	}
	.code {
		font-weight: 600;
	}

	.item {
		padding: 20rpx;
		font-size: 20rpx;
		color: #666;
		border-radius: 10rpx;
		border: #666 1rpx solid;
		margin-bottom: 10rpx;
		margin-left: 10rpx;
		margin-right: 10rpx;
		display: flex;
		flex-direction: column;
	 .sub-items{
		 display: flex;
		 flex-direction: row;
		 .sub-item{
			 display: flex;
			 flex:1;
			 flex-direction: column
		 }
	 }
	}

	.is-empty {
		text-align: center;
		margin: 40px 0;
		color: #999;
	}
}
</style>
