diff --git a/src/pages-erp/purchase-in/scan-in/index.vue b/src/pages-erp/purchase-in/scan-in/index.vue index 04e0827..b6f65c6 100644 --- a/src/pages-erp/purchase-in/scan-in/index.vue +++ b/src/pages-erp/purchase-in/scan-in/index.vue @@ -268,17 +268,28 @@ onMounted(async () => { }, 500) }) +const ERROR_DISPLAY_MS = 2000 + /** 重置到初始状态 */ function resetToIdle() { clearScanInputs() locationInfo.value = null productPreview.value = null step.value = 'idle' - // 延迟清空错误 + 聚焦光标,让用户先看到错误提示 setTimeout(() => { clearFeedback() focusLocationInput() - }, 800) + }, ERROR_DISPLAY_MS) +} + +/** 停留在产品扫码阶段 + 聚焦产品输入框(扫产品失败用) */ +function resetToProductScan() { + productBarCode.value = '' + productPreview.value = null + setTimeout(() => { + clearFeedback() + focusProductInput() + }, ERROR_DISPLAY_MS) } /** 聚焦库位码输入框 */ @@ -394,13 +405,13 @@ async function handleProductScan() { productPreview.value = await getProductByBarCode(code) } catch { setErrorFeedback(`条码 ${code} 未匹配到产品`) - resetToIdle() + resetToProductScan() return } if (!productPreview.value?.id) { setErrorFeedback(`条码 ${code} 未匹配到产品`) - resetToIdle() + resetToProductScan() return } diff --git a/src/pages-erp/sale-out/scan-out/components/recent-scan-list.vue b/src/pages-erp/sale-out/scan-out/components/recent-scan-list.vue index 20b1c9b..130925e 100644 --- a/src/pages-erp/sale-out/scan-out/components/recent-scan-list.vue +++ b/src/pages-erp/sale-out/scan-out/components/recent-scan-list.vue @@ -3,134 +3,129 @@ 暂无扫码记录 + - - - {{ record.productName || '-' }} - {{ record.productSpec || '-' }} - - - {{ record.locationCode || '-' }} - x{{ record.scanCount || 1 }} - + + {{ record.productName || '-' }} + 删除 - - {{ formatTime(record.scanTime) }} - 删除 + + + 条码:{{ record.productBarCode || '-' }} + 规格:{{ record.productSpec || '-' }} + + + 仓库:{{ record.warehouseName || '-' }} + 单位:{{ record.productUnit || '-' }} + + + 库位:{{ record.locationCode || '-' }} + 批次:{{ record.batchNo || '-' }} + + + {{ formatTime(record.scanTime) }} + {{ record.scanCount }} diff --git a/src/pages-erp/sale-out/scan-out/index.vue b/src/pages-erp/sale-out/scan-out/index.vue index 4f9f5e8..1710f50 100644 --- a/src/pages-erp/sale-out/scan-out/index.vue +++ b/src/pages-erp/sale-out/scan-out/index.vue @@ -268,17 +268,28 @@ onMounted(async () => { }, 500) }) +const ERROR_DISPLAY_MS = 2000 + /** 重置到初始状态 */ function resetToIdle() { clearScanInputs() locationInfo.value = null productPreview.value = null step.value = 'idle' - // 延迟清空错误 + 聚焦光标,让用户先看到错误提示 setTimeout(() => { clearFeedback() focusLocationInput() - }, 800) + }, ERROR_DISPLAY_MS) +} + +/** 停留在产品扫码阶段 + 聚焦产品输入框(扫产品失败用) */ +function resetToProductScan() { + productBarCode.value = '' + productPreview.value = null + setTimeout(() => { + clearFeedback() + focusProductInput() + }, ERROR_DISPLAY_MS) } /** 聚焦库位码输入框 */ @@ -394,13 +405,13 @@ async function handleProductScan() { productPreview.value = await getProductByBarCode(code) } catch { setErrorFeedback(`条码 ${code} 未匹配到产品`) - resetToIdle() + resetToProductScan() return } if (!productPreview.value?.id) { setErrorFeedback(`条码 ${code} 未匹配到产品`) - resetToIdle() + resetToProductScan() return }