<template>
	<div class="container">
		<view class="desktop">
			<view v-for="item in container" :key="item.containerCode" class="desktopItem"
				:style="{backgroundColor:(item.pickQty?'#67c237':null)}">
				<span class="desktopLabel">{{ item.containerCode}}</span>
				<span v-if="item.pickQty" class="desktopValue">{{ item.pickQty }}</span>
			</view>
		</view>
		<div style="width: 250rpx; margin: 30rpx auto">
			<u-button type="primary" @click="checkOutPick()">继续拣选</u-button>
		</div>
	</div>

</template>

<script>
	export default {
		data() {
			return {
				pickGroup: '',
				container: []
			}
		},
		onLoad(e) {
			this.pickGroup = e.pickGroup
			if (e.pickGroup) {
				this.getDetail(e.pickGroup)
			}
		},
		methods: {
			checkOutPick() {
				this.$u.api.pickingManage.checkOutPick({
					taskType: 2
				}).then(res => {
					console.log(res)
					if (res.code === 200) {
						//  进入索取页面
						if (res.data.pickType === 200) {

							// 整散合一
							this.$u.route({
								url: 'pages/dispersion/index',
								type: 'navigateTo',
								params: {
									list: JSON.stringify(res.data.taskStaticList)
								}
							})
						}
						//进入拣货页面
						if (res.data.pickType === 800) {
							// 整散合一
							this.$u.route({
								url: 'pages/dispersion/picking',
								type: 'navigateTo',
								params: {
									list: JSON.stringify(res.data.businOutPickDTaskVo),
									container: JSON.stringify(res.data.containrList)
								}
							})

						}
						// 进入绑定周转箱页面
						if (res.data.pickType === 801) {
							// 整件
							// if(params.taskType===1) {
							// 	this.$u.route({
							// 		url: 'pages/allPiece/bind',
							// 		type: 'navigateTo',
							// 		params: {
							// 			list: res.data.taskAndContainerList
							// 		}
							// 	})
							// }
							// 整散合一
							this.$u.route({
								url: 'pages/dispersion/bind',
								type: 'navigateTo',
								params: {
									list: JSON.stringify(res.data.taskAndContainerList)
								}
							})
						}
					} else {
						this.$u.toast(res.msg);
					}

				});
			},

			getDetail(pickGroup) {
				this.$u.api.pickingManage.pdaCheckPlatform({
					pickGroup
				}).then((res) => {
					if (res.code === 200) {
						this.container = res.data
					}
				})
			}
		},
	}
</script>

<style lang="scss" scope>
	.container {
		width: 90%;
		margin: 0 auto;
		margin-top: 40rpx;
	}

	.desktop {
		border-top: 0.5px solid #333333;
		border-left: 0.5px solid #333333;
		display: flex;
		flex-wrap: wrap;
		width: 70%;
		margin: 0 auto;
	}

	.desktopItem {
		width: 50%;
		display: flex;
		align-items: center;
		flex-direction: column;
		justify-content: center;
		height: 140rpx;
		border-bottom: 0.5px solid #333333;
		border-right: 0.5px solid #333333;
	}

	.desktopLabel {
		text-align: center;
	}

	.desktopValue {
		text-align: center;
		color: #0000FF;
		;
	}
</style>
