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; }