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.
86 lines
1.8 KiB
86 lines
1.8 KiB
2 years ago
|
<template>
|
||
|
<uni-popup ref="popup">
|
||
|
<view class="popup_box">
|
||
|
<view class="pop_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">{{title}}</view>
|
||
|
</view>
|
||
|
<view class="tab_info">
|
||
|
<win-com-scan ref="comScan" @getScanResult="getScanResult" :placeholder='title'></win-com-scan>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
<com-message ref="comMessage" @afterCloseCommitMessage='closeCommitMessage()'></com-message>
|
||
|
</uni-popup>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import winComScan from '@/mycomponents/wincom/winComScan.vue'
|
||
|
import comMessage from '@/mycomponents/common/comMessage.vue';
|
||
|
import {locations} from '@/api/index.js';
|
||
|
|
||
|
export default {
|
||
|
name: 'winScanByCode',
|
||
|
components: {
|
||
|
winComScan,
|
||
|
comMessage
|
||
|
},
|
||
|
props: {
|
||
|
title: {
|
||
|
type: String,
|
||
|
default: '库位'
|
||
|
},
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
code: '',
|
||
|
location: null
|
||
|
}
|
||
|
},
|
||
|
|
||
|
created() {
|
||
|
|
||
|
},
|
||
|
methods: {
|
||
|
openScanPopup() {
|
||
|
this.$refs.popup.open('bottom')
|
||
|
},
|
||
|
closeScanPopup() {
|
||
|
this.$refs.popup.close()
|
||
|
},
|
||
|
getScanResult(result) {
|
||
|
let that = this;
|
||
|
this.$refs["comScan"].losefocus();
|
||
|
if (result.data.scanType === 'qrcode') {
|
||
|
that.code = result.data.itemCode;
|
||
|
} else if (result.data.scanType === 'barcode') {
|
||
|
that.code = result.data.code;
|
||
|
}
|
||
|
that.scanLocation();
|
||
|
},
|
||
|
scanLocation() {
|
||
|
uni.showLoading({
|
||
|
title: '加载中...',
|
||
|
mask: true
|
||
|
})
|
||
|
locations(this.code).then(res => {
|
||
|
this.location = res;
|
||
|
this.closeScanPopup();
|
||
|
this.$emit("getLocation", this.location);
|
||
|
uni.hideLoading();
|
||
|
}).catch(err => {
|
||
|
uni.hideLoading();
|
||
|
this.$refs["comMessage"].showScanMessage(err);
|
||
|
});
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
</style>
|