From b4d8376dd4f828543b93847fcc402054d68f4bee Mon Sep 17 00:00:00 2001 From: jacobxu666 Date: Tue, 27 Oct 2026 16:40:21 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=95=86=E6=88=B7=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E7=A7=BB=E9=99=A4=E4=BB=98=E6=AC=BE=E7=A0=81?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=8F=8A=20upsdk=20=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=88=E7=9C=9F=E6=9C=BA=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E9=93=BE=E8=B7=AF=E5=BE=85=E6=8E=92=E6=9F=A5=E5=90=8E=E5=86=8D?= =?UTF-8?q?=E5=AE=9A=E6=96=B9=E6=A1=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除头部卡付款码按钮、onPayCode/payGuide/loadUpSdk 方法与样式 - 已发布 hh.hn12301.net,入口 index.90c150ed.js,分片 ea4cd3b0 线上与本地 MD5 一致 Co-Authored-By: Claude Fable 5 --- pages/shop/detail.vue | 93 ------------------------------------------- 1 file changed, 93 deletions(-) diff --git a/pages/shop/detail.vue b/pages/shop/detail.vue index 45a59c9..0795ad7 100644 --- a/pages/shop/detail.vue +++ b/pages/shop/detail.vue @@ -29,10 +29,6 @@ {{ shop.brandType || shop.category }} 营业时间:{{ shop.businessTime }} - - - 付款码 - @@ -145,88 +141,6 @@ if (pages.length > 1) uni.navigateBack() else uni.reLaunch({ url: '/pages/index/index' }) }, - // xuchao: 付款码——对齐 ysf 项目首页做法:upsdk.qrCodePay() 由云闪付容器原生拉起付款码,无 web 跳转。 - // SDK 加载复用加油页验证过的注入模式;拉不起的场景(非容器/加载失败/非免密登录)统一弹 payGuide - onPayCode(forceDiag) { - // xuchao: 付款码诊断——短按=正常流程(轻提示);长按 或 ?vc=1=诊断弹窗(每步状态可见)。 - // 云闪付内不便加 URL 参数,长按即真机诊断入口 - const diag = [] - const t0 = Date.now() - const dbg = forceDiag === true || /[?&#]vc=1/.test(typeof window !== 'undefined' ? window.location.href : '') - diag.push('UA=' + String(navigator.userAgent || '').slice(0, 90)) - const fail = (why) => { - diag.push('结果=' + why + ' 耗时' + (Date.now() - t0) + 'ms') - console.warn('[paycode]', diag.join(' | ')) - if (dbg) { - uni.showModal({ title: '付款码诊断', content: diag.join('\n'), showCancel: false, confirmText: '关闭' }) - } else { - this.payGuide() - } - } - this.loadUpSdk().then(ready => { - diag.push('upsdk加载=' + ready) - if (!ready) { fail('SDK脚本未加载'); return } - diag.push('window.upsdk=' + typeof window.upsdk) - try { - // xuchao: 微信等普通浏览器里 upsdk 脚本能加载但桥永不就绪,pluginReady 回调不到; - // 3 秒无响应即判定非云闪付容器(容器内通常 <1s 已拉起付款码) - let bridged = false - const timer = setTimeout(() => { if (!bridged) fail('桥未就绪(3s超时,非云闪付容器)') }, 3000) - window.upsdk.pluginReady(() => { - bridged = true - clearTimeout(timer) - diag.push('pluginReady=ok') - // xuchao: 付款码依赖云闪付账号与社保卡的绑定关系——只对免密登录(ysf)会话开放; - // 验证码登录/未登录时容器钱包账号与本活动身份可能不一致,提示而不是拉起 - const way = uni.getStorageSync('loginWay') || '(空)' - diag.push('loginWay=' + way) - if (way !== 'ysf') { fail('非免密会话:' + way); return } - try { - window.upsdk.qrCodePay() - diag.push('qrCodePay=已调用') - console.warn('[paycode]', diag.join(' | ')) - } catch (e) { fail('qrCodePay异常:' + (e && e.message || e)) } - }) - } catch (e) { fail('pluginReady异常:' + (e && e.message || e)) } - }).catch(e => fail('loadUpSdk异常:' + (e && e.message || e))) - }, - // xuchao: 付款码不可用时的统一提示(运营定稿文案;按反馈改为轻提示两行显示,不用确认弹窗) - payGuide() { - uni.showToast({ - title: '暂时无法使用付款码\n请登录云闪付 app 打开付款码进行使用', - icon: 'none', - duration: 2500 - }) - }, - // xuchao: upsdk 运行时注入并返回就绪 Promise(与 petrol/orderConfirm 同一模式,全局只注入一次; - // 不能依赖 index.html 静态标签——HBuilderX 构建的 H5 模板不吃根 index.html) - loadUpSdk(timeout = 9000) { - if (typeof window === 'undefined' || typeof document === 'undefined') return Promise.resolve(false) - if (window.upsdk) return Promise.resolve(true) - if (this._upSdkPromise) return this._upSdkPromise - const loading = new Promise(resolve => { - let done = false - const finish = v => { if (!done) { done = true; resolve(v) } } - const exists = document.querySelector('script[data-upsdk]') - if (exists) { - const t0 = Date.now() - const timer = setInterval(() => { - if (window.upsdk) { clearInterval(timer); finish(true) } - else if (Date.now() - t0 > timeout) { clearInterval(timer); finish(false) } - }, 200) - return - } - const s = document.createElement('script') - s.src = 'https://open.95516.com/s/open/js/upsdk.js' - s.setAttribute('data-upsdk', '1') - s.onload = () => finish(!!window.upsdk) - s.onerror = () => finish(false) - document.head.appendChild(s) - setTimeout(() => finish(!!window.upsdk), timeout) - }) - this._upSdkPromise = loading - return loading - }, navTo(s) { if (!s.lng || !s.lat) { uni.showToast({ title: '该门店暂未录入坐标', icon: 'none' }) @@ -287,13 +201,6 @@ .head-divider { height: 1rpx; background: #F3E7D7; margin: 24rpx 0 18rpx; } .head-meta { display: flex; flex-direction: column; gap: 8rpx; } .meta-line { font-size: 24rpx; color: #8A6E56; } - .pay-btn { - margin-top: 28rpx; height: 88rpx; border-radius: 16rpx; - background: linear-gradient(90deg, #D8431F, #E8542F 55%, #F0703C); - display: flex; align-items: center; justify-content: center; gap: 12rpx; - box-shadow: 0 8rpx 18rpx rgba(216, 67, 31, .28); - } - .pay-btn-text { font-size: 32rpx; font-weight: 700; color: #fff; letter-spacing: 2rpx; } .card { background: #fff; border-radius: 28rpx; padding: 28rpx; margin-top: 24rpx; } .card-title { display: flex; align-items: center; gap: 14rpx; font-size: 32rpx; font-weight: 800; color: #33200F; }