<template>
	<view :class="dataContent.scaned?'scan_view':''" style="background-color: #ffffff;margin-bottom: 1px; ">
		<view class="uni-flex uni-row space-between" style="align-items: center">
			<view>
				<pack v-if="dataContent.parentNumber" title="父包装" :packingCode="dataContent.parentNumber"></pack>
				<pack v-if="isShowPack && dataContent.packingNumber" :packingCode="dataContent.packingNumber"></pack>
				<batch v-if="isShowBatch && dataContent.batch" :batch="dataContent.batch"></batch>
				<location title="来源库位" v-if="isShowFromLocation" :locationCode="dataContent.locationCode"></location>
				<to-location title="目标库位" v-if="isShowToLocation" :locationCode="dataContent.toLocationCode">
				</to-location>
			</view>
			<view class="uni-flex" style="flex-direction: column;">
				<view class="uni-flex uni-row center">


					<!-- 	<qty v-if="dataContent.record==null ||dataContent.record==undefined " :dataContent="dataContent"
						:isShowStdPack="isShowStdPack" :isShowStatus="isShowStatus"></qty> -->
					<qty v-if="dataContent.handleQty==0 || dataContent.handleQty==undefined" :dataContent="dataContent"
						:isShowStdPack="isShowStdPack" :isShowStatus="isShowStatus"></qty>
					<compare-qty v-else :dataContent="dataContent" :recommendQty="Number( dataContent.qty)"
						:handleQty="Number (dataContent.handleQty)" :isShowStdPack="isShowStdPack"
						:isShowStatus='isShowStatus'>
					</compare-qty>


					<view class="uni-flex uni-row" style="vertical-align:center" v-if="isDevlement()">
						<text style="font-size: 30rpx;color: #2979ff;  width: 20px;" @click="copy">复制</text>
					</view>
				</view>
				<view class="" v-if="dataContent.inventoryStatus">
					<move-status :fromInventoryStatus="dataContent.inventoryStatus">
					</move-status>
				</view>

			</view>



		</view>
		<!-- <u-line></u-line> -->
	</view>
</template>

<script>
	import pack from '@/mycomponents/balance/pack.vue'
	import location from '@/mycomponents/balance/location.vue'
	import toLocation from '@/mycomponents/balance/toLocation.vue'
	import batch from '@/mycomponents/balance/batch.vue'
	import qty from '@/mycomponents/qty/qty.vue'
	import recommendQty from '@/mycomponents/qty/recommendQty.vue'
	import compareQty from '@/mycomponents/qty/compareQty.vue'
	import config from '@/static/config.js'
	import moveStatus from '@/mycomponents/balance/moveStatus.vue'

	export default {
		components: {
			pack,
			location,
			toLocation,
			batch,
			qty,
			recommendQty,
			compareQty,
			moveStatus
		},

		data() {
			return {

			}
		},
		props: {
			dataContent: {
				type: Object,
				default: {}
			},
			isShowPack: {
				type: Boolean,
				default: true
			},
			isShowBatch: {
				type: Boolean,
				default: true
			},
			isShowFromLocation: {
				type: Boolean,
				default: true
			},
			isShowStdPack: {
				type: Boolean,
				default: true
			},
			isShowStatus: {
				type: Boolean,
				default: true
			},
			isShowToLocation: {
				type: Boolean,
				default: false
			},
		},
		watch: {

		},
		methods: {
			copy() {
				// HPQ;V1.0;ICE115F11161AG;PP20230427000026;B20230427002;Q100
				var content = "HPQ;V1.0;I" + this.dataContent.itemCode + ";P" + this.dataContent.packingNumber + ";B" +
					this.dataContent.batch + ";Q" + this.dataContent.qty
				// #ifdef H5
				this.$copyText(content).then(
					res => {
						uni.showToast({
							title: '复制成功',
							icon: 'none'
						})
					}
				)
				// #endif
				// #ifndef H5
				uni.setClipboardData({
					data: content,
					success: () => {
						uni.showToast({
							title: '复制采购标签成功'
						})
					}
				})
				// #endif
			},
			copyPro() {
				// HPQ;V1.0;ICE115F11161AG;PP20230427000026;B20230427002;Q100
				var content = "HMQ;V1.0;I" + this.dataContent.itemCode + ";P" + this.dataContent.packingNumber + ";B" +
					this.dataContent.batch + ";Q" + this.dataContent.qty
				// #ifdef H5
				this.$copyText(content).then(
					res => {
						uni.showToast({
							title: '复制成功',
							icon: 'none'
						})
					}
				)
				// #endif
				// #ifndef H5
				uni.setClipboardData({
					data: content,
					success: () => {
						uni.showToast({
							title: '复制制品标签成功'
						})
					}
				})
				// #endif
			},
			isDevlement() {
				return config.isDevelopment;
			}
		}
	}
</script>

<style>
</style>