<template>
	<view class="marginTop">
		<u-list>
			<u-list-item v-for="(item, index) in list" :key="index" v-show="list.length !== 0">
				<view class="card_box" @click="goDetail(item)">
					<view class="item_box flex_between">
						<view class="rx-sc">
							<view class="round">{{Number(index)+1}}</view>
							<view class="orderId">{{item.allotCode}} </view>
						</view>
						<view class="status" :class="statusList[item.status] && statusList[item.status].class">
							{{ statusList[item.status] && statusList[item.status].label }}
						</view>
					</view>
					<view class="item_box rx-bc">
						<view class="item_one perce50 rx-sc">
							<view class="lable">调拨类型：</view>
							<view>{{ item.type == 1 ? '库内调拨' : '库外调拨' }}</view>
						</view>
					</view>
					<view class="item_box rx-bc">
						<view class="item_one perce50 rx-sc">
							<view class="lable"></view>
							<view>{{ item.sourceWarehouse }}
								<text class="arrow"></text>
								{{ item.type == 1 ? item.sourceWarehouse : item.targetWarehouse }}
							</view>
						</view>
					</view>
					<view class="item_box rx-bc">
						<view class="item_one perce50 rx-sc">
							<view class="lable">创建时间：</view>
							<view>{{item.createTime}}</view>
						</view>
					</view>
					<view class="item_box rx-bc">
						<view class="item_one perce50 rx-sc">
							<view class="lable">创建人：</view>
							<view>{{item.allotName}}</view>
						</view>
					</view>
				</view>
			</u-list-item>
			<u-list-item v-if="list.length === 0">
				<view style='margin-top: 20vh;'>
					<u-empty iconSize='150' textSize='32' text='暂无数据'>
					</u-empty>
				</view>
			</u-list-item>

		</u-list>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: () => []
			}
		},
		data() {
			return {
				statusList: {
					1: {
						class: '',
						label: '审核中'
					},
					0: {
						class: 'text-danger',
						label: '未提交'
					},
					2: {
						class: 'text-primary',
						label: '已完成'
					}
				}
			}
		},
		methods: {
			goDetail({
				id,
				auditStatus
			}) {
				// uni.navigateTo({
				// 	url: auditStatus === 4 ? `/pages/warehouse/inventoryAllocation/edit?&id=${id}` : `/pages/warehouse/inventoryAllocation/detail?&id=${id}`
				// })
				uni.navigateTo({
					url: `/pages/warehouse/inventoryAllocation/detail?&id=${id}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.marginTop {
		border-top: 20rpx solid $page-bg;
	}

	.arrow {
		display: inline-block;
		position: relative;
		width: 50rpx;
		height: 10rpx;
		margin: 0 20rpx;

		&::after,
		&::before {
			content: '';
			position: absolute;
		}

		&::after {
			border-top: 4rpx solid #aaaaaa;
			border-right: 4rpx solid #aaaaaa;
			width: 12rpx;
			height: 12rpx;
			right: 0rpx;
			top: -6rpx;
			transform: rotate(45deg);
		}

		&::before {
			height: 4rpx;
			background-color: #aaaaaa;
			width: 50rpx;
		}
	}

	.card_box {
		width: 750rpx;
		padding: 16rpx 32rpx;
		box-sizing: border-box;
		border-bottom: 2rpx solid #E1E1E1;


		.item_box {
			margin-top: 10rpx;

			.round {
				width: 40rpx;
				height: 40rpx;
				line-height: 40rpx;
				border-radius: 50%;
				background: $theme-color;
				color: #fff;
				text-align: center;
				font-size: 20rpx;
			}

			.orderId {
				color: #000;
				font-family: PingFang HK;
				font-size: 28rpx;
				font-style: normal;
				font-weight: 600;
				margin-left: 16rpx;
			}

			.item_one {
				width: 100%;
				font-size: 26rpx;
				font-style: normal;
				font-weight: 400;
				line-height: 38rpx;
				word-wrap: break-word;
			}

			.gylx {
				color: $theme-color;
			}

			.perce50 {
				width: 100%;
			}
		}

		.flex_between {
			display: flex;
			justify-content: space-between;
		}
	}

	.status {
		font-size: 28rpx;
		background-color: $page-bg;
		display: inline-block;
		padding: 2px 5px;
		border-radius: 18rpx;
	}
</style>