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.

126 lines
2.7 KiB

2 years ago
<template>
1 year ago
<view>
<u-popup mode="bottom" v-model="show">
1 year ago
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx"> 扫描{{ title }} </view>
2 years ago
1 year ago
<view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" @click="closeScanPopup()"></image>
</view>
</view>
<view class="">
<view class="">
<win-com-scan ref="comscan" :placeholder="title"
@getResult="getScanResult" :headerType="headerType"
:isShowHistory="isShowHistory" :clearResult="true"
:locationCode='locationCode'></win-com-scan>
1 year ago
</view>
</view>
</view>
</u-popup>
<com-message ref="comMessageRef" @afterClose="getfocus" />
</view>
2 years ago
</template>
1 year ago
<script setup lang="ts">
import { ref, getCurrentInstance, nextTick, onMounted } from 'vue'
import winComScan from '@/mycomponents/scan/winComScan.vue'
2 years ago
import { getLabelInfo } from '@/common/label.js'
1 year ago
const props = defineProps({
title: {
type: String,
default: '箱标签'
},
isShowHistory: {
type: Boolean,
default: true
},
headerType: {
type: String,
default: 'HPQ'
}
})
const show = ref(false)
const comMessageRef = ref()
const comscan = ref()
const locationCode = ref('')
11 months ago
// 模拟扫描功能
const simulateScan = (scanMessage) => {
getLabelInfo(scanMessage, props.headerType, (callback) => {
if (callback.success) {
getScanResult(callback)
} else {
showMessage(callback.message)
}
})
11 months ago
}
const openScanPopup = (locationCode1) => {
1 year ago
setTimeout((res) => {
show.value = true
locationCode.value = locationCode1
getfocus()
}, 500)
1 year ago
}
2 years ago
1 year ago
const closeScanPopup = () => {
losefocus()
1 year ago
show.value = false
emit('close', '')
}
2 years ago
1 year ago
const scanClick = () => {
if (comscan.value) {
comscan.value.clickScanMsg()
}
1 year ago
}
const cancelClick = () => {
if (comscan.value) {
comscan.value.clearScanValue()
}
1 year ago
}
2 years ago
1 year ago
const getScanResult = (result) => {
if (result.success) {
emit('getResult', result)
} else {
showMessage(result.message)
}
}
2 years ago
1 year ago
const getfocus = () => {
if (comscan.value != undefined) {
comscan.value.getfocus()
}
}
2 years ago
1 year ago
const losefocus = () => {
if (comscan.value != undefined) {
comscan.value.losefocus()
}
}
2 years ago
1 year ago
const showMessage = (message) => {
comMessageRef.value.showMessage(message)
}
// 传递给父类
const emit = defineEmits(['close', 'getResult'])
defineExpose({
openScanPopup,
closeScanPopup,
getfocus,
11 months ago
losefocus,
simulateScan
1 year ago
})
2 years ago
</script>
<style lang="scss">
1 year ago
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
}
2 years ago
</style>