From 721c641d3e634ae998544f1f7a1fb18de75801ee Mon Sep 17 00:00:00 2001 From: bb_pan Date: Wed, 27 Aug 2025 21:01:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E8=AF=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/devicesSearch/codeSearch.vue | 2 +- src/pages/repair/testedInBound/codeScan.vue | 56 ++++++++++++++------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/src/pages/devicesSearch/codeSearch.vue b/src/pages/devicesSearch/codeSearch.vue index cfc352a..6f1efc9 100644 --- a/src/pages/devicesSearch/codeSearch.vue +++ b/src/pages/devicesSearch/codeSearch.vue @@ -101,7 +101,7 @@ - + diff --git a/src/pages/repair/testedInBound/codeScan.vue b/src/pages/repair/testedInBound/codeScan.vue index 079e579..ddcfa3d 100644 --- a/src/pages/repair/testedInBound/codeScan.vue +++ b/src/pages/repair/testedInBound/codeScan.vue @@ -24,6 +24,9 @@ @scanSuccessBox="handleScanSuccessBox" @scanErrorBox="handleScanErrorBox" /> + + + 设备信息 @@ -112,8 +115,12 @@ const boxInfo = ref([]) const scanQrCodeRef = ref(null) const scanQrCodeRefBox = ref(null) //编码识别 -const ocrScan = () => { - +const ocrScan = async () => { + if (!maCode.value) { + uni.showToast({ title: '请输入设备编码', icon: 'none' }) + return + } + getInfo() } // 扫码识别按钮 @@ -159,22 +166,33 @@ const codeInBound = async () => { if(qrCode.value==""){ uni.showToast({ title: '扫码识别失败', icon: 'none'}) }else{ - let param = { - qrCode: qrCode.value, - } + getInfo() + } +} +const getInfo = async () => { + let param = { + qrCode: qrCode.value || '', + maCode: maCode.value || '' + } + try { + uni.showLoading({ title: '加载中...', mask: true }) //通过二维码获取相绑定的设备编码 - const res = await getInfoByQrcodeApi(param) - console.log(res) - if(res.code==200){ - maInfo.value = res.data[0] + const res = await getInfoByQrcodeApi(param) + console.log(res) + if(res.code==200){ + maInfo.value = res.data[0] if(maInfo.value.maId!=undefined&&maInfo.value.maId!=""){ }else{ uni.showToast({ title: '扫码二维码未绑定设备编码!', icon: 'none'}) } - }else{ - uni.showToast({ title: res.data.msg, icon: 'none'}) - } - } + }else{ + uni.showToast({ title: res.data.msg, icon: 'none'}) + } + } catch (error) { + console.log('🚀 ~ getInfo ~ error:', error) + } finally { + uni.hideLoading() + } } // 二维码入库确认 const cinfirmCodeInBound = async () => { @@ -191,7 +209,7 @@ const cinfirmCodeInBound = async () => { // agreementId: maInfo.value.agreementId, // maCodeList: arr, // } - let param = {qrCode:qrCode.value} + let param = { qrCode: qrCode.value, maCode: maInfo.value.maCode } console.log("bbbbbbbbbbbbbbbbb") const res = await repairInputWarehouseApiTwo(param) console.log("yyyyyyyyy",res) @@ -200,9 +218,13 @@ const cinfirmCodeInBound = async () => { title: '入库成功!', icon: 'none', }) - setTimeout(() => { - codeScan() - }, 800) + // 清空 + qrCode.value = '' + maCode.value = '' + maInfo.value = {} + // setTimeout(() => { + // codeScan() + // }, 800) } } }