You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
160 lines
3.6 KiB
160 lines
3.6 KiB
<template>
|
|
<view>
|
|
<uni-popup ref="popup" @change="change" @maskClick="closeScanPopup()">
|
|
<view class="popup_box">
|
|
<view class="pop_title">
|
|
扫描{{title}}
|
|
<text class="fr" @click="closeScanPopup()">关闭</text>
|
|
</view>
|
|
<view class="pop_tab">
|
|
<!-- <view class="uni-flex uni-row">
|
|
<view class="tab_tit tab_tit_active">箱标签</view>
|
|
</view> -->
|
|
<view class="tab_info">
|
|
<win-com-scan ref="comscan" @getScanResult="getScanResult" :placeholder="title"
|
|
:clearResult="true"></win-com-scan>
|
|
<view class="uni-flex">
|
|
<button class="clean_scan_btn" @click="cancelClick()">清空</button>
|
|
<button class="scan_btn" @click="scanClick()">扫描</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<com-message ref="comMessage" @afterClose="getfocus"></com-message>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import winComScan from '@/mycomponents/wincom/winComScan.vue'
|
|
import comMessage from '@/mycomponents/common/comMessage.vue'
|
|
import {
|
|
getInventoryLabel
|
|
} from '@/api/index.js';
|
|
|
|
import {
|
|
scanFailedAudio
|
|
} from '@/common/basic.js';
|
|
|
|
export default {
|
|
name: 'winScanByPack',
|
|
components: {
|
|
winComScan,
|
|
comMessage
|
|
},
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
default: '箱标签'
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
scanResult: {},
|
|
show: false,
|
|
}
|
|
},
|
|
created() {
|
|
|
|
},
|
|
methods: {
|
|
openScanPopup(content) {
|
|
this.$refs.popup.open('bottom');
|
|
},
|
|
|
|
closeScanPopup(content) {
|
|
this.$refs.popup.close();
|
|
this.$emit("close", '');
|
|
},
|
|
|
|
scanClick() {
|
|
this.$refs.comscan.handelScanMsg();
|
|
},
|
|
cancelClick() {
|
|
this.$refs.comscan.clearScanValue();
|
|
},
|
|
|
|
getScanResult(result) {
|
|
if (result != null) {
|
|
uni.showLoading({
|
|
title: '扫描中...',
|
|
mask: true
|
|
})
|
|
//可以增加配置是否要查询标签表
|
|
getInventoryLabel(result.data.code).then(label => {
|
|
if (label) {
|
|
this.losefocus(); //扫描完失去焦点,扫描完成后在业务里调用getfocus()方法
|
|
let result = this.getLabelResult(label);
|
|
this.scanResult = result;
|
|
uni.hideLoading();
|
|
this.callBack();
|
|
} else {
|
|
scanFailedAudio()
|
|
this.showMessage('标签【' + result.data.code + '】,在标签表中不存在')
|
|
uni.hideLoading();
|
|
|
|
}
|
|
}).catch(err => {
|
|
scanFailedAudio()
|
|
uni.hideLoading();
|
|
this.showMessage(err.message)
|
|
});
|
|
}
|
|
},
|
|
|
|
getLabelResult(label) {
|
|
let labelResult = {
|
|
sucess: true,
|
|
message: "",
|
|
data: label,
|
|
// data: {
|
|
// isPack: true,
|
|
// // scanType: null,
|
|
// itemCode: label.itemCode,
|
|
// itemName: label.itemName,
|
|
// itemDesc1: label.itemDesc1,
|
|
// itemDesc2: label.itemDesc2,
|
|
// lot: label.lot,
|
|
// qty: label.qty,
|
|
// uom: label.uom,
|
|
// poNumber: label.poNumber,
|
|
// // asn: null,
|
|
// packingCode: label.code,
|
|
// supplierBatch: label.supplierBatch,
|
|
// // order: null,
|
|
// // poLine: null,
|
|
// code: label.code,
|
|
// }
|
|
|
|
};
|
|
labelResult.data.isPack = true;
|
|
labelResult.data.packingCode = label.code;
|
|
return labelResult;
|
|
},
|
|
|
|
callBack() {
|
|
this.$refs.comscan.clear();
|
|
this.$emit("getScanResult", this.scanResult);
|
|
},
|
|
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>
|
|
</style>
|
|
|