fix: 首次点击确认支付无反应——upsdk 异步注入未就绪即唤起,改为就绪 Promise 等待(9s超时)后再 pluginReady;容器判定去 SDK 依赖只认 UA

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jacobxu666
2026-09-24 21:31:20 +08:00
co-authored by Claude Fable 5
parent d39e30925d
commit be4aafa6fd
2 changed files with 44 additions and 40 deletions
+3 -4
View File
@@ -22,12 +22,11 @@ export const VOUCHER_USE_FLOW = [
'支付差额可选:油卡 / 现金等'
]
// xuchao: 云闪付容器判定。UA 特征 + window.upsdk 双判,真机实测后定稿(方案文档 §8 挂账项);
// 若实测 UA 关键字不符,只需调整下方正则。
// xuchao: 云闪付容器判定只看 UA——不能掺 window.upsdk 是否已加载(SDK 是异步注入的,
// 首屏点击时可能还没 load 完,会把云闪付内首点误判为站外)。UA 关键字真机实测后定稿。
export function isUnionPayApp() {
if (typeof navigator === 'undefined' || !navigator.userAgent) return false
if (!/unionpay|upsdk|云闪付/i.test(navigator.userAgent)) return false
return typeof window !== 'undefined' && !!window.upsdk
return /unionpay|upsdk|云闪付/i.test(navigator.userAgent)
}
// xuchao: open-api/hhService/voucher/* 为双层壳:外层 errcode,内层 data.code 才是业务码