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.
 
 
 
 
 
 

97 lines
1.9 KiB

<template>
<uni-popup ref="popup" @change="change">
<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">扫描{{title}}</view>
</view> -->
<view class="tab_info">
<win-com-scan ref="scan" @getScanResult="getScanResult" :placeholder='title' :clearResult="false">
</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>
</template>
<script>
import winComScan from '@/mycomponents/wincom/winComScan.vue'
export default {
name: 'winScanByCode',
components: {
winComScan
},
props: {
title: {
type: String,
default: ''
}
},
data() {
return {
code: '',
isShow: false
}
},
created() {
},
methods: {
openScanPopup() {
this.$refs.popup.open('bottom')
},
closeScanPopup() {
this.$refs.popup.close()
},
getfocus() {
if (this.isShow) {
if(this.$refs.scan){
this.$refs.scan.getfocus()
}
}
},
losefocus() {
if(this.$refs.scan){
this.$refs.scan.losefocus()
}
},
scanClick() {
this.$refs.scan.handelScanMsg();
},
cancelClick() {
this.$refs.scan.clearScanValue();
},
getScanResult(result) {
if (result.data.scanType === 'qrcode') {
this.code = result.data.itemCode;
} else if (result.data.scanType === 'barcode') {
this.code = result.data.code;
}
this.callBack();
},
callBack() {
this.$refs.scan.clear();
this.$emit("getScanCode", this.code);
},
change(e) {
this.isShow = e.show
}
}
}
</script>
<style>
</style>