From f6ed231d124eb8747da6cf458f4da81fa02d18d6 Mon Sep 17 00:00:00 2001 From: BAKEYi <16298417+bakeyi@user.noreply.gitee.com> Date: Tue, 26 May 2026 14:29:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=BC=80=E7=9B=B8=E5=86=8C=E5=8F=88?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E6=89=AB=E7=A0=81=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/shop/verify/verify-order.nvue | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/pages/shop/verify/verify-order.nvue b/pages/shop/verify/verify-order.nvue index 4e6e8c8..83e98c2 100644 --- a/pages/shop/verify/verify-order.nvue +++ b/pages/shop/verify/verify-order.nvue @@ -106,17 +106,40 @@ export default { }); }, + // 从相册选择图片并识别二维码 chooseFromAlbum() { uni.chooseImage({ count: 1, + sourceType: ['album'], // 仅限相册 success: (res) => { + const filePath = res.tempFilePaths[0]; + uni.showLoading({ title: '识别中...' }); + + // #ifdef APP-PLUS + // 调用 App 底层引擎,静默解析本地图片,绝不弹出原生扫码界面 + plus.barcode.scan( + filePath, + (type, result) => { + uni.hideLoading(); + // 成功识别到二维码,直接将内容丢给你的处理逻辑 + this.handleCodeResult(result); + }, + (error) => { + uni.hideLoading(); + uni.showToast({ title: '未识别到有效二维码', icon: 'none' }); + } + ); + // #endif + + // #ifndef APP-PLUS + // 非 App 环境(比如小程序兜底),才走普通的 scanCode + uni.hideLoading(); uni.scanCode({ - onlyFromCamera: false, - scanType: ['qrCode'], success: (scanRes) => { this.handleCodeResult(scanRes.result); } }); + // #endif } }); },