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.
 
 
 
 
 
 

102 lines
2.0 KiB

<template>
<view class="">
<uni-popup ref="popup">
<view class="popup_box">
<view class="pop_title">
扫描{{title}}
<text class="fr" @click="closeScanPopup()">关闭</text>
</view>
<view class="pop_tab">
<view class="tab_info">
<win-com-scan @getScanResult="getScanResult" :placeholder='title'></win-com-scan>
</view>
</view>
</view>
</uni-popup>
<com-message ref="comMessage" ></com-message>
</view>
</template>
<script>
import {
locations
} from '@/api/index.js';
import {
scanSuccessAudio,
scanFailedAudio
} from '@/common/basic.js';
import winComScan from '@/mycomponents/wincom/winComScan.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
export default {
name: 'winScanByCode',
components: {
winComScan,
comMessage
},
props: {
title: {
type: String,
default: ''
},
},
data() {
return {
code: '',
locationInfo:null
}
},
created() {
},
methods: {
openScanPopup() {
this.$refs.popup.open('bottom')
},
closeScanPopup() {
this.$refs.popup.close()
},
getScanResult(result) {
if (result.data.scanType === 'qrcode') {
this.code = result.data.itemCode;
} else if (result.data.scanType === 'barcode') {
this.code = result.data.code;
}
this.getLocationInfo(this.code)
},
callBack() {
this.closeScanPopup();
this.$emit("getLocation", this.locationInfo);
},
showMessage(message) {
this.$refs.comMessage.showMessage(message);
},
getLocationInfo(code) {
uni.showLoading({
title: "正在查询库位信息...",
mask: true
});
locations(code).then((res) => {
uni.hideLoading();
if (res) {
this.locationInfo=res
this.callBack()
} else {
scanFailedAudio()
this.showMessage('未查找到库位【' + code + '】');
this.locationInfo=null
}
}).catch((err) => {
this.locationInfo=null
this.showMessage(err.message);
uni.hideLoading();
})
},
}
}
</script>
<style>
</style>