<template>
	<view>
		<ContentLoadingMore class="cardbox" :loadmore='true' :status="status" :list='goodsList'>
			<view class="cardContent" v-for="(item, index) in goodsList">
				<view class="listItemTitle" @click="handleClick(item)">
					<view>
						<view class="item">{{$t('产品编号：{0}', [ item.ml001 ])}}</view>
						<!-- <view class="item">物料编号：{{ item.sapItemCode }}</view> -->
						<!-- <view class="item">物料描述：{{ item.itemName }}</view> -->
						<view class="item">{{$t('产品名称：{0}', [ item.materialName ])}}</view>
						<view class="item">{{$t('库房/储位：{0}|{1}', [ item.ml002 , item.ml003 ])}}</view>
						<view class="item">{{$t('库存数：')}}{{item.ml005}}</view>
					</view>
				</view>
			</view>
		</ContentLoadingMore>
		<!-- <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> -->
	</view>
</template>

<script>
import i18n from '../../../lang/index'

import ContentLoadingMore from '@/components/ContentLoadingMore/index.vue';
export default {
	components: {
		ContentLoadingMore
	},
    props: {
		order: {
			type: String
		},
        currentKc: {
            type: Object
        }
	},
	data() {
		return {
			number: 0,
			totalNum: 0,
			show: true,
			nlpla: '',
			wxparams: '',
			goodsList: [],
			pagination: {
				pageNum:1,
				pageSize:10,
			},
			total: 0,
			status: 'loadmore'
		};
	},
	created() {
        if(this.order) {
		    this.getPlnr(this.order);
        }
	},
	watch: {
		currentKc(){
			this.getPlnr(this.order);
		}
	},
	methods: {
		handleClick(item){

		},
		getPlnr(order) {
			this.totalNum = 0;
            if (this.currentKc) {
                this.$u.api
                .getforinvmlinfo({
					ml001: this.currentKc.materialNo
				}).then((res) => {
                    if (res && res.success) {
						this.goodsList = res.data;
					} else {
						this.$u.toast(res.msg);
					}
                })
            } else {
                this.$u.api
				.stockList({
					saleOutNo: order
				})
				.then((res) => {
					if (res && res.success) {
						this.goodsList = res.data;
					} else {
						this.$u.toast(res.msg);
					}
				});
            }
			
		}
	}
};
</script>

<style lang="scss" scoped>
page {
	background: #f8f8f8;
}
.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;
	}
}
.cardbox {
	min-height: calc(100vh - 540rpx);
	padding: 0rpx 20rpx;
	margin-top: 20rpx;
}
.cardContent {
	border-radius: 8px;
	background: #fff;
	margin-bottom: 20rpx;
}
.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: #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;
			}
		}
	}
}
::v-deep .u-sticky {
	top: 0 !important;
	background: #fff;
}
</style>