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.

120 lines
2.6 KiB

12 months ago
<template>
<uni-popup ref="popup" :maskClick='false'>
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;">
扫描{{title}}
</view>
<view>
<image class=" icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()">
</image>
</view>
</view>
<view class="">
<view class="">
<win-com-scan ref="scan" headerType='HCQ' @getResult="getScanResult" :placeholder='title' :clearResult="false"
12 months ago
:boxFocus="true" :isShowHistory="isShowHistory">
</win-com-scan>
</view>
</view>
</view>
</uni-popup>
<comMessage ref="comMessage"></comMessage>
</template>
<script>
import {
11 months ago
getContainerByNumber
12 months ago
} from '@/api/request2.js';
import winComScan from '@/mycomponents/scan/winComScan.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
export default {
components: {
winComScan,
comMessage
},
emits: ["getContainer"],
props: {
title: {
type: String,
11 months ago
default: '器具'
12 months ago
},
isShowHistory: {
type: Boolean,
default: false
}
},
data() {
return {
code: '',
containerInfo: {}
}
},
created() {
},
methods: {
openScanPopup() {
this.$refs.popup.open('bottom')
},
closeScanPopup() {
this.$refs.popup.close()
},
scanClick() {
this.$refs.scan.clickScanMsg();
},
cancelClick() {
this.$refs.scan.clearScanValue();
},
getScanResult(result) {
uni.showLoading({
title: '扫描中...',
mask: true
});
let label = result.label;
11 months ago
this.code = label.container;
getContainerByNumber(this.code).then(res => {
12 months ago
uni.hideLoading();
11 months ago
if (res.data.list.length > 0) {
this.containerInfo = res.data.list[0];
if (this.containerInfo.containerStatus == 'USED') {
11 months ago
this.callBack();
} else {
this.showErrorMessage("器具[" + this.code + "]状态是[" + this.containerInfo.status + "],不可以绑定")
}
12 months ago
} else {
11 months ago
this.showErrorMessage("未查找到器具[" + this.code + "]")
12 months ago
}
}).catch(error => {
uni.hideLoading();
this.showErrorMessage(error)
})
},
callBack() {
this.closeScanPopup();
this.$emit("getContainer", this.containerInfo);
},
getfocus() {
this.$refs.scan.getfocus();
},
losefocus() {
this.$refs.scan.losefocus();
},
showErrorMessage(message) {
setTimeout(r => {
this.losefocus();
this.$refs.comMessage.showErrorMessage(message, res => {
this.code = '';
this.getfocus();
})
})
}
}
}
</script>
<style>
</style>