<template>
	<uni-popup ref="popup">
		<view class="pop_detail" style="height:80%">
			<com-item :dataContent="dataContent"></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>
					</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');

			},
			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.number
				}, {
					item_title: '物料代码',
					content: this.dataContent.itemCode
				}, {
					item_title: '物品名称',
					content: this.dataContent.itemName
				}, {
					item_title: '物品描述1',
					content: this.dataContent.itemDesc1
				}, {
					item_title: '物品描述2',
					content: this.dataContent.itemDesc2
				}, {
					item_title: '批次',
					content: this.dataContent.batch
				}, {
					item_title: '替代批次',
					content: this.dataContent.altBatch
				}, {
					item_title: '生产日期',
					content: this.dataContent.produceDate,
					type:"dateTime"
				}, {
					item_title: '有效日期',
					content: this.dataContent.validityDays,
					type:"dateTime"
				}, {
					item_title: '失效日期',
					content: this.dataContent.expireDate,
					type:"dateTime"
				}, {
					item_title: '计量单位',
					content: this.dataContent.uom,
					type:"uom"
				}, {
					item_title: '数量',
					content: this.dataContent.qty
				}, {
					item_title: '替代计量单位',
					content: this.dataContent.altUom
				}, {
					item_title: '替代数量',
					content: this.dataContent.altQty
				}, {
					item_title: '转换率',
					content: this.dataContent.convertRate
				}, {
					item_title: '标包数量',
					content: this.dataContent.stdPackQty
				}, {
					item_title: '标包单位',
					content: this.dataContent.stdPackUnit
				}, {
					item_title: '仓库代码',
					content: this.dataContent.toWarehouseCode
				}, {
					item_title: '月台代码',
					content: this.dataContent.toDockCode
				}, {
					item_title: '库位代码',
					content: this.dataContent.toLocationCode
				}, {
					item_title: '供应商代码',
					content: this.dataContent.supplierCode
				}, {
					item_title: '供应商物品代码',
					content: this.dataContent.supplierItemCode
				}, {
					item_title: '采购订单号',
					content: this.dataContent.poNumber
				}, {
					item_title: '采购订单行',
					content: this.dataContent.poLine
				}, {
					item_title: '采购计划单号',
					content: this.dataContent.rpNumber
				}, {
					item_title: '发货单号',
					content: this.dataContent.asnNumber
				}, {
					item_title: '生产订单号',
					content: this.dataContent.woNumber
				}, {
					item_title: '生产订单行',
					content: this.dataContent.woLine
				}, {
					item_title: '生产线代码',
					content: this.dataContent.productionLineCode
				}, {
					item_title: '班组代码',
					content: this.dataContent.teamCode
				}, {
					item_title: '班次代码',
					content: this.dataContent.shiftCode
				}, {
					item_title: '客户代码',
					content: this.dataContent.customerCode
				}, {
					item_title: '客户月台代码',
					content: this.dataContent.customerDockCode
				}, {
					item_title: '客户物品代码',
					content: this.dataContent.customerItemCode
				}, {
					item_title: '销售订单号',
					content: this.dataContent.soNumber
				}, {
					item_title: '销售订单行',
					content: this.dataContent.soLine
				}, {
					item_title: '质量等级',
					content: this.dataContent.eqLevel
				}, {
					item_title: '货主代码',
					content: this.dataContent.ownerCode
				}, {
					item_title: '重量',
					content: this.dataContent.weight
				}, {
					item_title: '面积',
					content: this.dataContent.area
				}, {
					item_title: '体积',
					content: this.dataContent.volume
				}]);
			},
			formatDate(val) {
				return dateFormat(val)
			},
			
		}
	}
</script>

<style>


</style>
