|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<uni-popup ref="popup" @change="change" :mask-click="false">
|
|
|
|
<view class="popup_box">
|
|
|
|
<view class="pop_title uni-flex space-between">
|
|
|
|
<view class="" style="font-size: 35rpx;">
|
|
|
|
扫描{{title}}
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="">
|
|
|
|
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg"
|
|
|
|
@click="closeScanPopup()"></image>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="">
|
|
|
|
<view class="">
|
|
|
|
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult"
|
|
|
|
:headerType="headerType" :isShowHistory="isShowHistory" :clearResult="true"></win-com-scan>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</uni-popup>
|
|
|
|
<!-- 模拟扫描功能 -->
|
|
|
|
<win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :headerType="headerType"
|
|
|
|
:isShowHistory="false" :clearResult="true"></win-com-scan>
|
|
|
|
<comMessage ref="comMessage" @afterClose="getfocus"></comMessage>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import winComScan from '@/mycomponents/scan/winComScan.vue'
|
|
|
|
import {
|
|
|
|
getBalanceByFilter
|
|
|
|
} from '@/api/request2.js';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'winScanPack',
|
|
|
|
components: {
|
|
|
|
winComScan,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: '箱标签'
|
|
|
|
},
|
|
|
|
isShowHistory: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
headerType: {
|
|
|
|
type: String,
|
|
|
|
default: 'HPQ,HMQ'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
show: false,
|
|
|
|
businessType: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
simulateScan(item) {
|
|
|
|
this.$refs.comscansimulate.setItemCodeSimulate(item.copyContent)
|
|
|
|
this.$refs.comscansimulate.clickScanMsg();
|
|
|
|
},
|
|
|
|
openScanPopup() {
|
|
|
|
setTimeout(res => {
|
|
|
|
this.$refs.popup.open('bottom')
|
|
|
|
}, 200)
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
openScanPopupByBusinessType(businessType) {
|
|
|
|
setTimeout(res => {
|
|
|
|
this.$refs.popup.open('bottom')
|
|
|
|
this.businessType = businessType;
|
|
|
|
|
|
|
|
}, 200)
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
closeScanPopup() {
|
|
|
|
this.$refs.popup.close();
|
|
|
|
this.$emit("close", '');
|
|
|
|
},
|
|
|
|
|
|
|
|
scanClick() {
|
|
|
|
if (this.$refs.comscan) {
|
|
|
|
this.$refs.comscan.clickScanMsg();
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
cancelClick() {
|
|
|
|
if (this.$refs.comscan) {
|
|
|
|
this.$refs.comscan.clearScanValue();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
getScanResult(result) {
|
|
|
|
if (result.success) {
|
|
|
|
this.getBalance(result, res => {
|
|
|
|
result.balance = res;
|
|
|
|
this.$emit("getResult", result);
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.showMessage(result.message)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
getBalance(result, callback) {
|
|
|
|
var filters = []
|
|
|
|
let label = result.label;
|
|
|
|
let packageInfo = result.package;
|
|
|
|
|
|
|
|
if (packageInfo.parentNumber) {
|
|
|
|
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
|
|
|
|
filters.push({
|
|
|
|
column: "packingNumber",
|
|
|
|
action: "in",
|
|
|
|
value: packingNumber
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
filters.push({
|
|
|
|
column: "packingNumber",
|
|
|
|
action: "==",
|
|
|
|
value: label.packingNumber
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
filters.push({
|
|
|
|
column: "itemCode",
|
|
|
|
action: "==",
|
|
|
|
value: label.itemCode
|
|
|
|
})
|
|
|
|
filters.push({
|
|
|
|
column: "batch",
|
|
|
|
action: "==",
|
|
|
|
value: label.batch
|
|
|
|
})
|
|
|
|
|
|
|
|
if (this.businessType != null) {
|
|
|
|
filters.push({
|
|
|
|
column: "inventoryStatus",
|
|
|
|
action: "in",
|
|
|
|
value: this.businessType.inInventoryStatuses
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
var params = {
|
|
|
|
filters: filters,
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 100,
|
|
|
|
}
|
|
|
|
getBalanceByFilter(params).then(res => {
|
|
|
|
if (res.length == 0) {
|
|
|
|
this.showErrorMessage('未查找到该包装的库存余额', res => {
|
|
|
|
this.packGetFocus();
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
callback(res.data)
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch(err => {
|
|
|
|
this.showErrorMessage(err.message);
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
getfocus() {
|
|
|
|
if (this.$refs.comscan != undefined) {
|
|
|
|
this.$refs.comscan.getfocus();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
losefocus() {
|
|
|
|
if (this.$refs.comscan != undefined) {
|
|
|
|
this.$refs.comscan.losefocus();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
showMessage(message) {
|
|
|
|
this.$refs.comMessage.showMessage(message);
|
|
|
|
},
|
|
|
|
change(e) {
|
|
|
|
this.show = e.show
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.scroll-view {
|
|
|
|
overflow-y: scroll;
|
|
|
|
height: auto;
|
|
|
|
max-height: 300rpx;
|
|
|
|
}
|
|
|
|
</style>
|