From 5777fbf9ea5aaaeb7613610737da57e89bd4164d Mon Sep 17 00:00:00 2001 From: jacobxu666 Date: Mon, 26 Oct 2026 19:10:54 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BB=98=E6=AC=BE=E7=A0=81?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=94=A8=E6=8F=90=E7=A4=BA=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=B8=BA=E8=BF=90=E8=90=A5=E5=AE=9A=E7=A8=BF=E6=96=87=E6=A1=88?= =?UTF-8?q?=EF=BC=88=E6=B8=A9=E9=A6=A8=E6=8F=90=E7=A4=BA=EF=BC=9A=E8=AF=B7?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=BA=91=E9=97=AA=E4=BB=98=20app=20=E6=89=93?= =?UTF-8?q?=E5=BC=80=E4=BB=98=E6=AC=BE=E7=A0=81=E4=BD=BF=E7=94=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- pages/shop/detail.vue | 48 +++++++++++++------------------------------ 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/pages/shop/detail.vue b/pages/shop/detail.vue index a0c6ded..d59f322 100644 --- a/pages/shop/detail.vue +++ b/pages/shop/detail.vue @@ -146,50 +146,21 @@ else uni.reLaunch({ url: '/pages/index/index' }) }, // xuchao: 付款码——对齐 ysf 项目首页做法:upsdk.qrCodePay() 由云闪付容器原生拉起付款码,无 web 跳转。 - // SDK 加载复用加油页验证过的注入模式;非云闪付环境(微信/普通浏览器)给使用引导。 + // SDK 加载复用加油页验证过的注入模式;拉不起的场景(非容器/加载失败/非免密登录)统一弹 payGuide onPayCode() { this.loadUpSdk().then(ready => { - if (!ready) { - uni.showModal({ - title: '请在云闪付App内使用', - content: '付款码需在云闪付App中打开本页面后使用:打开云闪付App → 搜索怀化社保卡活动进入 → 点击付款码。', - showCancel: false, - confirmText: '知道了' - }) - return - } + if (!ready) { this.payGuide(); return } try { // xuchao: 微信等普通浏览器里 upsdk 脚本能加载但桥永不就绪,pluginReady 回调不到; - // 3 秒无响应即判定非云闪付容器,给使用引导(容器内通常 <1s 已拉起付款码) + // 3 秒无响应即判定非云闪付容器(容器内通常 <1s 已拉起付款码) let bridged = false - const timer = setTimeout(() => { - if (!bridged) { - uni.showModal({ - title: '请在云闪付App内使用', - content: '付款码需在云闪付App中打开本页面后使用:打开云闪付App → 搜索怀化社保卡活动进入 → 点击付款码。', - showCancel: false, - confirmText: '知道了' - }) - } - }, 3000) + const timer = setTimeout(() => { if (!bridged) this.payGuide() }, 3000) window.upsdk.pluginReady(() => { bridged = true clearTimeout(timer) // xuchao: 付款码依赖云闪付账号与社保卡的绑定关系——只对免密登录(ysf)会话开放; // 验证码登录/未登录时容器钱包账号与本活动身份可能不一致,提示而不是拉起 - const way = uni.getStorageSync('loginWay') - if (way !== 'ysf') { - const logged = !!uni.getStorageSync('phone') - uni.showModal({ - title: '暂无法使用付款码', - content: logged - ? '当前为手机号验证码登录,付款码立减需通过云闪付App的活动入口进入(自动免密登录,与钱包账号一致)后使用。' - : '请在云闪付App中通过本活动入口进入页面(自动免密登录)后,再使用付款码享优惠。', - showCancel: false, - confirmText: '知道了' - }) - return - } + if (uni.getStorageSync('loginWay') !== 'ysf') { this.payGuide(); return } try { window.upsdk.qrCodePay() } catch (e) { uni.showToast({ title: '拉起付款码失败,请重试', icon: 'none' }) } }) @@ -198,6 +169,15 @@ } }) }, + // xuchao: 付款码不可用时的统一提示(文案为运营定稿) + payGuide() { + uni.showModal({ + title: '温馨提示', + content: '暂无法使用付款码,请登录云闪付 app 打开付款码进行使用。', + showCancel: false, + confirmText: '知道了' + }) + }, // xuchao: upsdk 运行时注入并返回就绪 Promise(与 petrol/orderConfirm 同一模式,全局只注入一次; // 不能依赖 index.html 静态标签——HBuilderX 构建的 H5 模板不吃根 index.html) loadUpSdk(timeout = 9000) {