diff --git a/src/mobile/views/aggregate/index.vue b/src/mobile/views/aggregate/index.vue index a19de92..47bb4ad 100644 --- a/src/mobile/views/aggregate/index.vue +++ b/src/mobile/views/aggregate/index.vue @@ -44,7 +44,7 @@ const paid = computed(() => order.value.status === 'paid') function detectClientEnv(): string { const ua = navigator.userAgent.toLowerCase() if (ua.includes('micromessenger')) { - return 'wechat_pay' + return 'wechat' } if (ua.includes('alipayclient') || ua.includes('alipay')) { return 'alipay' @@ -53,7 +53,7 @@ function detectClientEnv(): string { return 'union_pay' } // 默认按微信处理(浏览器扫码预览) - return 'wechat_pay' + return 'wechat' } /** diff --git a/src/mobile/views/cashier/index.vue b/src/mobile/views/cashier/index.vue index f449f40..8340e61 100644 --- a/src/mobile/views/cashier/index.vue +++ b/src/mobile/views/cashier/index.vue @@ -46,7 +46,7 @@ const paid = computed(() => order.value.status === 'paid') function detectClientEnv(): string { const ua = navigator.userAgent.toLowerCase() if (ua.includes('micromessenger')) { - return 'wechat_pay' + return 'wechat' } if (ua.includes('alipayclient') || ua.includes('alipay')) { return 'alipay' @@ -81,7 +81,7 @@ function iconClass(icon?: string) { if (icon && known.includes(icon)) { return icon } - if (icon === 'wechat_pay') { + if (icon === 'wechat') { return 'wechat' } return 'wechat' diff --git a/src/mobile/views/code-pay/index.vue b/src/mobile/views/code-pay/index.vue index 0bade9f..fa4923d 100644 --- a/src/mobile/views/code-pay/index.vue +++ b/src/mobile/views/code-pay/index.vue @@ -43,7 +43,7 @@ onMounted(loadInfo) function detectClientEnv(): string { const ua = navigator.userAgent.toLowerCase() if (ua.includes('micromessenger')) { - return 'wechat_pay' + return 'wechat' } if (ua.includes('alipayclient') || ua.includes('alipay')) { return 'alipay' @@ -55,7 +55,7 @@ function detectClientEnv(): string { return 'douyin' } // 浏览器扫码预览: 后端会拒绝 browser, 默认按微信便于开发调试 - return 'wechat_pay' + return 'wechat' } /** @@ -64,6 +64,10 @@ function detectClientEnv(): string { async function loadInfo() { try { info.value = await getCodePayInfo(code as string) + // 小程序码牌应在小程序落地, H5 页仅支持 h5 形态 + if (info.value.programType === 'mini_app') { + loadError.value = t('codePay.miniAppOnly') + } } catch (e: any) { loadError.value = e?.message || t('codePay.loadFail') @@ -109,6 +113,10 @@ async function pay() { if (paying.value || paid.value) { return } + if (info.value.programType === 'mini_app') { + showNotify({ type: 'warning', message: t('codePay.miniAppOnly') }) + return + } // 固定金额模式直接用码牌金额, 自定义模式校验输入 let amountFen: number | undefined if (info.value.amountType === 'random') { @@ -125,7 +133,7 @@ async function pay() { amount: amountFen, description: description.value || undefined, clientEnv: detectClientEnv(), - // 一期 H5; 小程序传 mini + // H5 码牌固定 h5, 与 programType 一致 runtime: 'h5', device: 'mobile', }) diff --git a/src/pc/views/aggregate/Index.vue b/src/pc/views/aggregate/Index.vue index 0e1c788..e8fce8d 100644 --- a/src/pc/views/aggregate/Index.vue +++ b/src/pc/views/aggregate/Index.vue @@ -32,7 +32,7 @@ const paid = computed(() => order.value.status === 'paid') function detectClientEnv(): string { const ua = navigator.userAgent.toLowerCase() if (ua.includes('micromessenger')) { - return 'wechat_pay' + return 'wechat' } if (ua.includes('alipayclient') || ua.includes('alipay')) { return 'alipay' @@ -40,7 +40,7 @@ function detectClientEnv(): string { if (ua.includes('unionpay') || ua.includes('cloudpay')) { return 'union_pay' } - return 'wechat_pay' + return 'wechat' } onMounted(async () => { diff --git a/src/pc/views/cashier/Index.vue b/src/pc/views/cashier/Index.vue index ed2e63c..325babd 100644 --- a/src/pc/views/cashier/Index.vue +++ b/src/pc/views/cashier/Index.vue @@ -55,7 +55,7 @@ function methodName(item?: CashierItemPublic | null) { } function iconClass(icon?: string) { - if (icon === 'wechat' || icon === 'wechat_pay') { + if (icon === 'wechat' || icon === 'wechat') { return 'wechat' } if (icon === 'alipay') {