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

View File

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

View File

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