|
|
|
<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="箱标签"
|
|
|
|
:clearResult="true" :placeholder="title"></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 {
|
|
|
|
getitems,
|
|
|
|
getMesBarCode
|
|
|
|
} from '@/api/index.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() {
|
|
|
|
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
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
getMesBarCode(result.data.code).then(item=>{
|
|
|
|
if (item) {
|
|
|
|
this.losefocus(); //扫描完失去焦点,扫描完成后在业务里调用getfocus()方法
|
|
|
|
this.scanResult = {
|
|
|
|
scanCode:result.data.code,
|
|
|
|
itemCode:item.itemCode,
|
|
|
|
itemName:item.itemName,
|
|
|
|
itemDesc1:item.itemDesc1,
|
|
|
|
stdPackQty: item.stdPackQty,
|
|
|
|
uom: item.uom,
|
|
|
|
qty:item.qty,
|
|
|
|
locationCode:item.locationCode
|
|
|
|
};
|
|
|
|
uni.hideLoading();
|
|
|
|
this.callBack();
|
|
|
|
} else {
|
|
|
|
this.showMessage('单件码【' + result.data.code + '】,不存在')
|
|
|
|
uni.hideLoading();
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
uni.hideLoading();
|
|
|
|
this.showMessage(err.message)
|
|
|
|
});
|
|
|
|
|
|
|
|
// getitems(result.data.code).then(item => {
|
|
|
|
// if (item) {
|
|
|
|
// this.losefocus(); //扫描完失去焦点,扫描完成后在业务里调用getfocus()方法
|
|
|
|
// this.scanResult = {
|
|
|
|
// itemCode:item.code,
|
|
|
|
// itemName:item.name,
|
|
|
|
// itemDesc1:item.desc1,
|
|
|
|
// stdPackQty: item.stdPackQty,
|
|
|
|
// uom: item.basicUom
|
|
|
|
// };
|
|
|
|
// uni.hideLoading();
|
|
|
|
// this.callBack();
|
|
|
|
// } else {
|
|
|
|
// this.showMessage('单件码【' + result.data.code + '】,在物料表中不存在')
|
|
|
|
// uni.hideLoading();
|
|
|
|
// }
|
|
|
|
// }).catch(err => {
|
|
|
|
// uni.hideLoading();
|
|
|
|
// this.showMessage(err.message)
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|