<template>
	<u-navbar title="合托托盘" bgColor='#D3832A' leftIconColor='#ffffff' titleStyle='color:#ffffff' placeholder
		:autoBack="true" leftIconSize='35'></u-navbar>
	<view class="topbos">
		<view class="srview">
			<view>合并托盘码</view>
			<view>
				<input placeholder="请扫描或输入" v-model="resdata.trayCode" />
			</view>
		</view>
		<view class="srview">
			<view>托盘数量：{{resdata?.totalNum}}</view>
			<!-- <view>
				<input placeholder="请扫描或输入"/>
			</view> -->
		</view>
	</view>
	<!-- <view class="tabsetnumb">
		<view class="xz">
			<view>被合并托盘数据</view>
			<view></view>
		</view>
		<view>
			<view>合并托盘数据</view>
			<view></view>
		</view>
	</view> -->
	<!-- <view class="tarynumvw">
		托盘数量：10
	</view> -->
	<scroll-view scroll-y="true" class="scvorder">
		<view class="itembox" v-for="(item,index) in (resdata?.list)">
			<view class="topon1">
				<view>{{index+1}}</view>
				<view>
					<view :class="item.isFleeing=='0'?'xzc':''">正常</view>
					<view :class="item.isFleeing=='1'?'xze':''">异常</view>
				</view>
			</view>
			<!-- 定制品 -->
			<view v-if="item.goodsType === 1">
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>服务号：{{item.serviceNum}}</view>
				</view>
				<view class="tpbx" @click.stop="goorderdetail(item)">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>订单号：{{item.orderCode}}</view>
				</view>
				<!-- <view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>仓库地址：{{dtilobj.warehouseName}}</view>
				</view>
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>库位信息：{{dtilobj.areaTitle + '-' + dtilobj.allocationTitle}}</view>
				</view> -->
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>剩余数量：{{item.totalNum-item.shelfNum}}</view>
				</view>
			</view>

			<!-- 零担 -->
			<view v-if="item.goodsType === 2">
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>运单号：{{item.waybillNo}}</view>
				</view>
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>订单号：{{item.orderCode}}</view>
				</view>
				<!-- <view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>仓库地址：{{dtilobj.warehouseName}}</view>
				</view>
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>库位信息：{{dtilobj.areaTitle + '-' + dtilobj.allocationTitle}}</view>
				</view> -->
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>剩余数量：{{item.totalNum-item.shelfNum}}</view>
				</view>
			</view>

			<!-- 库存品 -->
			<view v-if="item.goodsType === 3">
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>物料编码：{{item.materialCode}}</view>
				</view>
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>物料名称：{{item.materialName}}</view>
				</view>
				<!-- <view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>仓库地址：{{dtilobj.warehouseName}}</view>
				</view>
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>库位信息：{{dtilobj.areaTitle + '-' + dtilobj.allocationTitle}}</view>
				</view> -->
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>订单号：{{item.orderCode}}</view>
				</view>
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>商场名称：{{item.marketName}}</view>
				</view>
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>批次号：{{item.incomingBatch}}</view>
				</view>
				<view class="tpbx">
					<image src="/pagesHome/static/kuweiicon.png"></image>
					<view>剩余数量：{{item.totalNum-item.shelfNum}}</view>
				</view>
			</view>

			<view class="viewnum">
				<view>总包数：{{item.totalNum}}</view>
				<view>已扫数量：{{item.shelfNum}}</view>
			</view>
		</view>
	</scroll-view>
	<!-- 	<view class="butys">
		<view class="qut">取消</view>
		<view class="conf" @click="">确认</view>
	</view> -->
</template>

<script lang="ts" setup>
	import {
		warehouseTrayTypescanTargetTrayCode
	} from '@/api/user.js'
	import {
		onLoad,
		onShow,
		onHide,
		onUnload
	} from '@dcloudio/uni-app'
	import { ref } from "vue";
	let trayCode = ref('')
	let resdata = ref<any>({})
	onLoad((op) => {
		trayCode.value = op.tray
	})
	onShow(() => {
		init()
	})
	function goorderdetail(item) {
		uni.navigateTo({
			url: '/pagesHome/pages/orderDetails/orderDetails?orderCode=' + item.orderCode
		})
	}
	async function init() {
		let data = {
			trayCode: trayCode.value
		}
		let res = await warehouseTrayTypescanTargetTrayCode(data)
		resdata.value = res.data
	}
</script>

<style lang="scss">
	.butys {
		display: flex;
		align-items: center;
		margin-top: 20upx;
		justify-content: space-around;

		>.conf {
			width: 320upx;
			height: 100upx;
			border-radius: 20upx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 32upx;
			font-weight: 400;
			color: #FFFFFF;
			background-color: #D3832A;
		}

		>.qut {
			width: 320upx;
			height: 100upx;
			border-radius: 20upx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 32upx;
			font-weight: 400;
			color: #5A6875;
			background-color: #FFFFFF;
		}
	}

	.scvorder {
		width: 100%;
		margin-top: 20upx;
		height: 64vh;

		.itembox {
			width: 686upx;
			border-radius: 20upx;
			padding: 0 20upx;
			box-sizing: border-box;
			background-color: #ffffff;
			margin: auto;
			margin-bottom: 20upx;

			>.topon1 {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 20upx 10upx;
				box-sizing: border-box;
				border-bottom: 4upx solid #EEEEEE;

				>view:nth-of-type(1) {
					width: 50rpx;
					height: 50rpx;
					background: #178AF220;
					border-radius: 50%;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 28upx;
					font-weight: 500;
					color: #178AF2;
				}

				>view:nth-of-type(2) {
					display: flex;
					align-items: center;

					>view {
						width: 136upx;
						height: 64upx;
						border-radius: 8upx;
						display: flex;
						align-items: center;
						justify-content: center;
						font-size: 28rpx;
						font-weight: 400;
						color: #90A0AF;
						background-color: #F5F5F6;
						margin-right: 20upx;

						&:nth-last-child(1) {
							margin-right: 0upx;
						}
					}

					.xzc {
						background-color: #178AF2 !important;
						color: #ffffff !important;
					}

					.xze {
						background-color: #F8544B !important;
						color: #ffffff !important;
					}

					>image {
						width: 32upx;
						height: 32upx;
					}
				}
			}

			>.topon2 {
				display: flex;
				align-items: center;
				justify-content: flex-start;
				padding: 20upx 10upx;
				box-sizing: border-box;
				border-bottom: 4upx solid #EEEEEE;

				>image {
					width: 32upx;
					height: 32upx;
					margin-right: 20upx;
				}

				>view {
					font-size: 28upx;
					font-weight: 400;
					color: #020B18;
				}
			}
		}
	}

	.tarynumvw {
		width: 100%;
		padding: 24upx 70upx;
		box-sizing: border-box;
		background-color: #ffffff;
		margin-top: 4upx;
		box-sizing: border-box;
	}

	.tabsetnumb {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: #ffffff;
		margin-top: 20upx;

		.xz {
			>view:nth-of-type(1) {
				color: #D3832A !important;
			}

			>view:nth-of-type(2) {
				background-color: #D3832A !important;
			}
		}

		>view {
			width: 50%;
			display: flex;
			flex-direction: column;
			align-items: center;

			>view:nth-of-type(1) {
				font-size: 32upx;
				font-weight: 400;
				color: #020B18;
				padding: 30upx 0;
			}

			>view:nth-of-type(2) {
				width: 96upx;
				height: 8upx;
				background-color: #D3832A00;
				border-radius: 4upx;
			}
		}
	}

	.topbos {
		display: flex;
		flex-direction: column;

		>.srview {
			display: flex;
			align-items: center;
			padding: 26upx 32upx;
			box-sizing: border-box;
			background-color: #ffffff;
			margin-bottom: 4upx;

			&:nth-last-child(1) {
				margin-bottom: 0;
			}

			>view:nth-of-type(1) {
				width: 190upx;
				font-size: 28upx
			}

			>view:nth-of-type(2) {
				font-size: 28upx;
				flex: 1;

				>input {
					flex: 1;
				}
			}
		}
	}

	.tpbx {
		display: flex;
		align-items: center;
		padding: 18upx 24upx;
		box-sizing: border-box;
		border-bottom: 4upx solid #EEEEEE;

		>image {
			flex: none;
			width: 32upx;
			height: 32upx;
			margin-right: 15upx;
		}

		>view {
			font-size: 28upx;
			font-weight: 400;
			color: #020B18;

			.numb {
				font-size: 28upx;
				color: #178AF2;
			}
		}

	}

	.viewnum {
		height: 100upx;
		display: flex;
		align-items: center;
		justify-content: space-around;

		>view {
			font-size: 28upx;
			font-weight: 400;
			color: #020B18;
		}
	}
</style>