fix: 云闪付控件唤起路线B——发布脚本向构建产物index.html注入upsdk静态标签(HBuilderX不吃根模板,控件桥需静态加载);白名单豁免下线,唤起失败统一弹指引模态

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jacobxu666
2026-09-28 19:25:11 +08:00
co-authored by Claude Fable 5
parent 8b3ac20e34
commit b6bbb0b219
3 changed files with 24 additions and 19 deletions
+9 -10
View File
@@ -53,7 +53,7 @@
<script>
import {
VOUCHER_NAME, VOUCHER_PRICE_TEXT, VOUCHER_GUIDE_TEXT,
VOUCHER_PAY_WHITELIST_PHONE, isUnionPayApp, bizOk, bizMsg, bizData
bizOk, bizMsg, bizData
} from '@/common/petrolVoucher.js'
export default {
@@ -81,7 +81,7 @@ export default {
uni.redirectTo({ url: '/pages/index/login?redirect=' + encodeURIComponent('/pages/venue/detail?id=851219003520709&type=2') })
return
}
this.loadUpSdk() // xuchao: 运行时注入云闪付 SDK(构建模板不可靠,见 loadUpSdk 注释)
this.loadUpSdk() // xuchao: 运行时兜底注入(静态标签已在发布脚本注入产物 index.html,见 h5-release.sh)
if (options.orderNo) this.orderNo = options.orderNo
this.initFromServer()
},
@@ -116,7 +116,7 @@ export default {
this._upSdkPromise = loading
return loading
},
// xuchao: 价格展示以服务端 latest 为准(测试期 0.01);已有待支付单自动续用;已发券直接跳券详情
// xuchao: 价格展示以服务端 latest 为准;已有待支付单自动续用;已发券直接跳券详情
initFromServer() {
this.$u.api.voucherLatest({ phone: this.phone }).then(res => {
if (!bizOk(res)) return
@@ -133,11 +133,8 @@ export default {
},
onConfirmPay() {
if (this.submitting) return
// xuchao: 容器拦截——非云闪付且非联调白名单号,弹窗不发起支付(决策 11/13)
if (!isUnionPayApp() && this.phone !== VOUCHER_PAY_WHITELIST_PHONE) {
this.guideModal = true
return
}
// xuchao: 不做容器/白名单前置拦截,直接发起;云闪付控件在站外唤不起时
// 由 pay 的 fail 回调统一弹「去云闪付」指引模态(决策 11 修订:去白名单)
this.submitting = true
this.doPay()
},
@@ -168,7 +165,7 @@ export default {
const ready = await this.loadUpSdk()
if (!ready) {
this.submitting = false
uni.showToast({ title: '支付组件加载失败,请稍后重试', icon: 'none' })
this.guideModal = true
return
}
window.upsdk.pluginReady(() => {
@@ -178,8 +175,10 @@ export default {
uni.redirectTo({ url: '/pages/petrol/voucherDetail?orderNo=' + this.orderNo })
},
fail: () => {
// xuchao: 唤起失败(多为不在云闪付内)→ 指引模态;云闪付内取消也会走这里,
// 订单仍保留可"继续支付",统一用文案引导,不做环境猜测
this.submitting = false
uni.showToast({ title: '支付未完成,可在门店页继续支付', icon: 'none' })
this.guideModal = true
}
})
})