<template>
	<view>
		<view class="listItemTitle">
			<view>
				<view class="item">入库条码：{{ item.qrcode }}</view>
				<view class="item">工单编号：{{ item.workorderNo }}</view>
				<view class="item">产品编号：{{ item.sapItemCode }}</view>
				<view class="item">产品描述：{{ item.itemName }}</view>
				<view class="item">入库仓位：{{ item.NLPLA }}</view>
				<view class="item">入库数量：{{ filterQuantity() }}</view>
				<view class="item">loss数量：{{ filterLoss() }}</view>
			</view>
			<u-button size="mini" type="primary" plain @click="deleGonds(idx)">
				<u-icon name="trash" size="28"></u-icon>
				删除
			</u-button>
		</view>
		<view class="listBottom">
			<view class="bottomTitle" @click="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" :key="ele.qrcode+idx" v-if="ele.qrcode === item.qrcode">
					<view class="items">尺码：{{ ele.standardSize }}</view>
					<view class="items">数量：{{ ele.quantity }}</view>
					<view class="items">loss数量：{{ ele.lossNum }}</view>
				</view>
			</view>
		</view>
		<!-- <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> -->
	</view>
</template>

<script>
import StickyNavBar from '@/components/StickyNavBar/index.vue';
import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
import BottomBtn from '@/components/BottomBtn/index.vue';
export default {
	components: {
		StickyNavBar,
		ContentLoadingMore,
		BottomBtn
	},
	props: {
		item: {
			type: Object,
			default: function () {
				return {};
			}
		},
		list: {
			type: Array,
			default: function () {
				return [];
			}
		},
		idx: {
			type: Number,
			default: 0
		}
	},
	computed:{
	},
	data() {
		return {
			show: true
		};
	},
	created() {
	},
	methods: {
		deleGonds(idx) {
			this.$emit('deleGonds',idx)
		},
		filterQuantity() {
			return this.list.filter(v => v.qrcode == this.item.qrcode).reduce((acc, cur) => acc + cur.quantity, 0)
		},
		filterLoss() {
			return this.list.filter(v => v.qrcode == this.item.qrcode).reduce((acc, cur) => acc + cur.lossNum, 0)
		}
	}
};
</script>

<style lang="scss" scoped>
page {
	background: #f8f8f8;
}
.headerTitle {
	padding: 20rpx;
	font-weight: 600;
	.items {
		line-height: 40rpx;
	}
}
.btn {
	padding: 20rpx;
	background: #fff;
	.topSearch {
		margin-bottom: 20rpx;
	}
}
.bottomBtn {
	position: sticky;
	padding: 20rpx;
	display: flex;
	justify-content: space-between;
	background: #fff;
	bottom: 0rpx;
	margin-top: 20rpx;
	.u-btn {
		width: 300rpx;
	}
}
.blue {
	color: #3f9dcc;
}
.total {
	background: #fff;
	color: #000;
	padding: 0rpx 40rpx;
	display: flex;
	justify-content: space-between;
	font-size: 32rpx;
	.line {
		margin: 0px 10rpx;
	}
}
.listItemTitle {
	display: flex;
	justify-content: space-between;
	padding: 20rpx;
	border-bottom: 2px solid #f8f8f8;
	.u-btn {
		width: 150rpx;
		margin: 0px;
		margin-top: 10rpx;
	}
	.item {
		line-height: 50rpx;
		color: #333;
		font-size: 28rpx;
		font-weight: 500;
		word-break: break-all;
		font-weight: 600;
	}
}
.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;
				line-height: 40rpx;
				/deep/ .uni-easyinput{
					width: 200rpx;
				}
			}
			.inputItem{
				display: inline-flex;
				// line-height: 76rpx;
			}
		}
	}
}
/deep/ .u-sticky {
	top: 0 !important;
	background: #fff;
}
</style>
