<template>
	<view class="history">
		<view class="item" v-for="(item, i) in warehouseLogHistory" :key="i">
			<text class="type">{{ item.type }}</text>
			<text class="code" :style="{ color: item.status ? 'green' : '#666' }">{{ item.order_code }}</text>
			<uni-icons v-if="item.status" type="checkmarkempty" class="status" size="16" color="green"></uni-icons>
			<text class="status fail" v-else>F</text>
			<text style="margin-left: 10rpx; font-weight: 300">
				{{ '\r\n' + item.createTime }}
			</text>
		</view>
		<view v-if="warehouseLogHistory.length === 0" class="is-empty">暂无历史</view>
	</view>
</template>

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

<style lang="scss" scoped>
.history {
	display: flex;
	width: 100%;
	flex-direction: column;
	justify-items: start;

	.title {
		padding: 20rpx;
		font-size: 24rpx;
		font-weight: 600;
	}
	.type {
		padding-right: 20rpx;
		font-size: 24rpx;
	}
	.code {
		font-weight: 600;
	}

	.item {
		padding: 20rpx;
		font-size: 20rpx;
		color: #666;

		.status {
			padding-left: 20rpx;
		}

		.fail {
			font-weight: 600;
			color: #f00;
		}
	}

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