fix:商户详情页移除付款码按钮及 upsdk 相关逻辑(真机容器链路待排查后再定方案)
- 移除头部卡付款码按钮、onPayCode/payGuide/loadUpSdk 方法与样式 - 已发布 hh.hn12301.net,入口 index.90c150ed.js,分片 ea4cd3b0 线上与本地 MD5 一致 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
db6a239560
commit
b4d8376dd4
@@ -29,10 +29,6 @@
|
|||||||
<text class="meta-line" v-if="shop.brandType || shop.category">{{ shop.brandType || shop.category }}</text>
|
<text class="meta-line" v-if="shop.brandType || shop.category">{{ shop.brandType || shop.category }}</text>
|
||||||
<text class="meta-line" v-if="shop.businessTime">营业时间:{{ shop.businessTime }}</text>
|
<text class="meta-line" v-if="shop.businessTime">营业时间:{{ shop.businessTime }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="pay-btn" @click="onPayCode()" @longpress="onPayCode(true)">
|
|
||||||
<svg width="17" height="17" viewBox="0 0 24 24" fill="none"><rect x="3" y="3" width="7" height="7" rx="1.5" stroke="#fff" stroke-width="2"/><rect x="14" y="3" width="7" height="7" rx="1.5" stroke="#fff" stroke-width="2"/><rect x="3" y="14" width="7" height="7" rx="1.5" stroke="#fff" stroke-width="2"/><path d="M14 14h3v3h-3zM18 18h3v3h-3z" fill="#fff"/></svg>
|
|
||||||
<text class="pay-btn-text">付款码</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 优惠说明 -->
|
<!-- 优惠说明 -->
|
||||||
@@ -145,88 +141,6 @@
|
|||||||
if (pages.length > 1) uni.navigateBack()
|
if (pages.length > 1) uni.navigateBack()
|
||||||
else uni.reLaunch({ url: '/pages/index/index' })
|
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) {
|
navTo(s) {
|
||||||
if (!s.lng || !s.lat) {
|
if (!s.lng || !s.lat) {
|
||||||
uni.showToast({ title: '该门店暂未录入坐标', icon: 'none' })
|
uni.showToast({ title: '该门店暂未录入坐标', icon: 'none' })
|
||||||
@@ -287,13 +201,6 @@
|
|||||||
.head-divider { height: 1rpx; background: #F3E7D7; margin: 24rpx 0 18rpx; }
|
.head-divider { height: 1rpx; background: #F3E7D7; margin: 24rpx 0 18rpx; }
|
||||||
.head-meta { display: flex; flex-direction: column; gap: 8rpx; }
|
.head-meta { display: flex; flex-direction: column; gap: 8rpx; }
|
||||||
.meta-line { font-size: 24rpx; color: #8A6E56; }
|
.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 { 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; }
|
.card-title { display: flex; align-items: center; gap: 14rpx; font-size: 32rpx; font-weight: 800; color: #33200F; }
|
||||||
|
|||||||
Reference in New Issue
Block a user