<template>
	<view class="putway-item">
		<view class="listItemTitle">
			<view class="boxBtn">
				<view class="item">入库批次：{{ item.CHARG }}</view>
				<u-button size="mini" type="primary" plain @click="handleDelete()">
					<u-icon name="trash" size="28"></u-icon>
					删除
				</u-button>
			</view>
			<view class="item">物料编号：{{ item.MATNR }}</view>
			<view class="item">物料描述：{{ item.MAKTX }}</view>
			<view class="item">入库数量：{{ item.cardNum }}</view>
		</view>
		<view class="listBottom">
			<view class="bottomTitle" @tap="show = !show">
				<view class="desc">卷条码明细</view>
				<view class="topIcons">
					<view v-if="show">
						<u-icon name="arrow-down" color="#aaa" size="32"></u-icon>
						展开
					</view>
					<view v-else>
						<u-icon name="arrow-up" color="#aaa" size="32"></u-icon>
						收起
					</view>
				</view>
			</view>
			<view v-if="!show" class="bottomBox">
				<view class="bottomItem" v-for="(ele, idx) in list" v-if="ele.CHARG === item.CHARG">
					<view class="items plNum">{{ ele.PLNR }}</view>
					<view class="item">入库库位：{{ ele.NLPLA }}</view>
					<view class="items">数量：{{ ele.TOMNG }}</view>
					<view class="items">生产日期：{{ ele.BLDAT }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type: Object,
				default: () => {}
			},
			list: {
				typeof: Array,
				default: () => [{}]
			},
		},
		data() {
			return {
				num: "",
				show: true,
			}
		},
		methods: {
			handleDelete() {
				this.$emit('delGonds', this.item)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.listItemTitle {
		display: flex;
		flex-direction: column;
		width: 100%;
		padding: 20rpx;
		border-bottom: 2px solid #f8f8f8;

		.u-btn {
			width: 150rpx;
			margin: 0px;
			margin-top: 10rpx;
		}

		.item {
			line-height: 50rpx;
			color: #000;
			font-size: 28rpx;
			font-weight: 500;
			word-break: break-all;
		}
	}

	.listBottom {
		.bottomTitle {
			height: 80rpx;
			position: relative;

			.desc {
				color: #bbb;
				font-size: 24rpx;
				line-height: 80rpx;
				padding-left: 20rpx;
			}

			.topIcons {
				position: absolute;
				left: 50%;
				top: 50%;
				transform: translate(-50%, -50%);
				color: #aaa;
			}
		}

		.bottomBox {
			padding: 20rpx;

			.bottomItem {
				background: #f8f8f8;
				padding: 20rpx;
				margin-bottom: 20rpx;

				.items {
					color: #333;
					font-size: 24rpx;
					height: 40rpx;
					line-height: 40rpx;
				}

				.plNum {
					height: 80rpx;
					word-break: break-all;
				}
			}
		}
	}

	/deep/ .u-sticky {
		top: 0 !important;
		background: #fff;
	}

	.boxBtn {
		display: flex;
		justify-content: space-between;

		/deep/.u-btn {
			margin-right: 0 !important;
		}
	}
</style>