袁伟杰:V2.0.006 扫码不自动弹输入法

This commit is contained in:
yuan
2026-05-15 18:07:35 +08:00
parent 651cc999a7
commit 5f68a682a7
3 changed files with 26 additions and 2 deletions

View File

@@ -24,6 +24,7 @@
v-model="scanCode"
placeholder="请扫描采购订单号"
:loading="scanLoading"
:auto-focus="false"
:show-confirm-button="true"
camera-text="拍单号"
@submit="handleOrderScanSubmit"
@@ -131,7 +132,7 @@
:focus="activeScanField === 'batch'"
placeholder="请输入或扫描批次号"
confirm-type="next"
@focus="setActiveScanField('batch')"
@focus="handleScanFieldFocus('batch')"
@confirm="handleBatchConfirm"
>
<input
@@ -141,7 +142,7 @@
:focus="activeScanField === 'location'"
placeholder="请输入或扫描库位码"
confirm-type="done"
@focus="setActiveScanField('location')"
@focus="handleScanFieldFocus('location')"
@confirm="handleLocationConfirm"
>
</view>
@@ -349,6 +350,7 @@ const items = ref<PurchaseScanItem[]>([])
const feedback = ref<PurchaseScanFeedback>()
const lastScannedTargetKey = ref('')
const activeScanField = ref<'batch' | 'location'>('batch')
const suppressKeyboardField = ref<'batch' | 'location' | ''>('')
const hasSelectedOrder = computed(() => Boolean(selectedOrder.value?.id))
const currentWarehouse = computed(() =>
@@ -453,7 +455,27 @@ function setActiveScanField(field: 'batch' | 'location') {
activeScanField.value = field
}
function hideSoftKeyboardForAutoFocus() {
nextTick(() => {
uni.hideKeyboard()
setTimeout(() => {
uni.hideKeyboard()
}, 80)
})
}
function handleScanFieldFocus(field: 'batch' | 'location') {
setActiveScanField(field)
if (suppressKeyboardField.value !== field) {
return
}
suppressKeyboardField.value = ''
hideSoftKeyboardForAutoFocus()
}
async function focusScanField(field: 'batch' | 'location') {
suppressKeyboardField.value = field
activeScanField.value = field === 'batch' ? 'location' : 'batch'
await nextTick()
activeScanField.value = field

View File

@@ -37,6 +37,7 @@
v-model="scanCode"
placeholder="请先选择仓库,再扫描产品条码"
:loading="scanLoading"
:auto-focus="false"
@submit="handleScanSubmit"
@camera-scan="handleCameraScan"
/>

View File

@@ -37,6 +37,7 @@
v-model="scanCode"
placeholder="请先选择仓库,再扫描产品条码"
:loading="scanLoading"
:auto-focus="false"
@submit="handleScanSubmit"
@camera-scan="handleCameraScan"
/>