<template>
	<view>
		<view class="top_search">
			<u-input v-model="value" type="text" class="search_input" placeholder="请扫描条码" @input="handleInput" :border="true" />
			<u-button class="refresh" size="mini">刷新</u-button>
		</view>
		<view class="content">
			<view v-for="item in result" :key="item.id" class="content_box">
				<view class="item">
					<view class="item_content">
						<span class="item_title">业主名称</span>
						<span class="item_value">{{item.consignorName}}</span>
					</view>
					<span v-if="item.lineStatus==='OING'">已索取</span>
					<span v-if="item.lineStatus==='WAIT'">未索取</span>
				</view>
				<view class="item_content">
					<span class="item_title">单据编号</span>
					<span class="item_value">{{ item.orderNo }}</span>
				</view>
				<view class="item_content">
					<span class="item_title">客户名称</span>
					<span class="item_value">{{ item.companyName }}</span>
				</view>
				<view class="item_content_last">
					<view class="item_content">
						<span class="item_title">总箱数</span>
						<span class="item_value">{{ item.totalPackage }}</span>
					</view>
					<view class="item_content">
						<span class="item_title">整件数</span>
						<span class="item_value">{{ item.actualCaseQty }}</span>
					</view>
					<view class="item_content">
						<span class="item_title">拼箱数</span>
						<span class="item_value">{{ item.actualQty }}</span>
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: '',
				result: []
			};
		},
		mounted() {
			this.loadList()
		},
		methods: {
			loadList() {
				this.$u.api.reviewManage.searchReviewTask().then(res => {
					console.log(res)
					if(res.code===200) {
						this.result = res.rows
					} else {
						this.$u.toast(res.msg);
					}
				});
			},
			handleInput() {
				this.$u.api.reviewManage.reviewTaskDetail({
					barcodeCode: this.value,
				}).then(res => {
					console.log(res)
					if(res.code===200) {
						this.$u.route({
							url: 'pages/toReview/receviewHomeWork',
							type: 'navigateTo',
							params: {
								list: JSON.stringify(res.data)
							}
						})
					} else {
						this.$u.toast(res.msg);
					}
				});
			}
		}
	}
</script>

<style lang="less" scoped>
	.top_search {
		display: flex;
		align-items: center;
		padding: 0 30rpx;
		margin-top: 30rpx;

		.search_input {
			width: 200rpx;
		}

		.refresh {
			margin-left: 20rpx;
			margin-right: 100rpx;
		}
	}
	.content {
		padding: 0 30rpx;
	}
	.content_box {
		border: 0.5px solid rgba(121, 121, 121, 1);
		padding: 20rpx 20rpx;
		margin-top: 30rpx;
	}
	.item {
		display: flex;
		justify-content: space-between;
		
	}
	.item_content {
		display: flex;
		align-items: center;
		line-height: 50rpx;
	}
	.item_title {
		width: 110rpx;
		color: #333333;
		font-size: 24rpx;
	}
	.item_value {
		color: #555555;
		font-size: 24rpx;
	}
	.item_content_last {
		display: flex;
		justify-content: space-between;
	}
</style>
