<template>
	<uni-popup ref="popup">
		<view class="pop_detail" style="height:80%">
			<com-item :dataContent="dataContent.package"></com-item>
			<u-line></u-line>
			<scroll-view style="height:320px ">
				<view v-for="(item, index) in dataList" style="width: 100%;">
					<view class="item">
						<text class="item_title">{{item.item_title}} </text>
						<text v-if="(item.type=='')||(item.type==undefined)" class="text_wrap">{{item.content}} </text>
						<text v-else-if="item.type=='dateTime'" class="text_wrap">{{formatDate(item.content)}} </text>
						<text v-else-if="item.type=='boolean'" class="text_wrap">{{boolean(item.content)}} </text>
					</view>
				</view>
			</scroll-view>

			<view class="uni-flex u-row-center ">
				<view class="close_button" @click="closePopup">
					关闭</view>
				<!-- button 滚动不好使 -->
			</view>
		</view>
	</uni-popup>
</template>

<script>
	import comItem from '@/mycomponents/item/item.vue'
	import { dateFormat 	} from '@/common/basic.js';
	
	export default {
		emits: ['onClose'],
		components: {
			comItem
		},
		data() {
			return {
				dataContent: {
					type: Object,
					default: {}
				},
				dataList: []
			}
		},

		mounted() {},
		props: {

		},

		methods: {
			openPopup(val) {
				this.dataContent = val;
				this.getDataList();
				this.$refs.popup.open('bottom')

			},
			avaliable(value) {
				return value == "TRUE" ? "可用" : "不可用"
			},
			boolean(value) {
				return value == "TRUE" ? "是" : "否"
			},
			formatDate(val) {
				return dateFormat(val)
			},
			
			closePopup(val) {
				this.$refs.popup.close('bottom')
				// this.$emit('onClose')
			},

			getDataList() {
				// console.log(JSON.stringify(this.dataContent));
				this.dataList.length = 0;
				this.dataList.push(...[{
					item_title: '包装号',
					content: this.dataContent.packingNumber,
				}, {
					item_title: '器具代码',
					content: this.dataContent.containerNumber,
				}, {
					item_title: '物料代码',
					content: this.dataContent.itemCode,
				}, {
					item_title: '批次',
					content: this.dataContent.batch,
				}, {
					item_title: '替代批次',
					content: this.dataContent.altBatch,
				}, {
					item_title: '到货日期',
					content: this.dataContent.arriveDate,
					type:"dateTime"
				}, {
					item_title: '生产日期',
					content: this.dataContent.produceDate,
					type:"dateTime"
				}, {
					item_title: '失效日期',
					content: this.dataContent.expireDate,
					type:"dateTime"
				}, {
					item_title: '库存状态',
					content: this.dataContent.inventoryStatus,
					type:""
				}, {
					item_title: '库位代码',
					content: this.dataContent.locationCode,
					type:""
				}, {
					item_title: '库位组代码',
					content: this.dataContent.locationGroupCode,
					type:""
				}, {
					item_title: '库区代码',
					content: this.dataContent.areaCode,
					type:""
				}, {
					item_title: '仓库代码',
					content: this.dataContent.warehouseCode,
				}, {
					item_title: 'ERP库位代码',
					content: this.dataContent.erpLocationCode,
				}, {
					item_title: '货主代码',
					content: this.dataContent.ownerCode,
				}, {
					item_title: '计量单位',
					content: this.dataContent.uom,
					type:"uom"
				}, {
					item_title: '数量',
					content: this.dataContent.qty,
				}, {
					item_title: '锁定数量',
					content: this.dataContent.lockedQty,
				}, {
					item_title: '可用数量',
					content: this.dataContent.usableQty,
				}, {
					item_title: '单价',
					content: this.dataContent.singlePrice,
				}, {
					item_title: '金额',
					content: this.dataContent.amount,
				}, {
					item_title: '入库时间',
					content: this.dataContent.putInTime,
					type:"dateTime"
				}, {
					item_title: '是否冻结',
					content: this.dataContent.frozen,
					type:""
				}, {
					item_title: '冻结原因',
					content: this.dataContent.frozenReason,
				}, {
					item_title: '最后事务号',
					content: this.dataContent.lastTransNumber,
				}, {
					item_title: '重量',
					content: this.dataContent.weight,
				}, {
					item_title: '面积',
					content: this.dataContent.area,
				}, {
					item_title: '体积',
					content: this.dataContent.volume,
				}]);
				// console.log(JSON.stringify(this.dataList));


			},
		}
	}
</script>

<style>


</style>
