fix 聚合支付调用失败问题修改

This commit is contained in:
bootx
2025-11-26 20:55:00 +08:00
parent df879935ec
commit ff8b5df8b4
3 changed files with 18 additions and 45 deletions

View File

@@ -21,7 +21,7 @@ export function generateAuthUrl(orderNo, scene) {
return http.request<Result<string>>({
url: '/unipay/gateway/generateAuthUrl',
method: 'POST',
data: { orderNo, scene },
params: { orderNo, scene },
})
}
@@ -66,22 +66,6 @@ export interface AggregateOrderAndConfig {
order?: GatewayOrder
/** 收银台配置信息 */
config?: GatewayPayConfig
/** 聚合支付配置信息 */
aggregateConfig?: AggregateConfig
}
/**
* 收银台聚合配置信息
*/
export interface AggregateConfig {
/** 支付类型 */
scene?: string
/** 通道 */
channel?: string
/** 支付方式 */
payMethod?: string
/** 其他支付方式 */
otherMethod?: string
/** 自动拉起支付 */
autoLaunch?: boolean
/** 需要获取OpenId */
@@ -90,16 +74,6 @@ export interface AggregateConfig {
callType?: string
}
/**
* 获取认证URL参数
*/
export interface GatewayAuthUrlParam {
// 订单号
orderNo?: string
// 聚合支付类型
scene?: string
}
/**
* 认证参数
*/
@@ -172,5 +146,5 @@ export interface paySuccess {
// 金额
amount: number
// 超时时间
expiredTime
expiredTime: number
}

View File

@@ -6,7 +6,7 @@
<div class="payPrice">
<span class="unit"></span>
<div class="price">
{{ orderAndConfig?.order.amount }}
{{ orderAndConfig?.order?.amount }}
</div>
</div>
<!-- 支付时间 -->
@@ -19,14 +19,14 @@
<!-- 订单详情 -->
<div class="infoBox">
<div class="payMessItem titleOne">
{{ orderAndConfig?.order.title }}
{{ orderAndConfig?.order?.title }}
</div>
<div class="payMessItem">
<div class="itemTitle">
订单编号
</div>
<div class="itemContent">
{{ orderAndConfig?.order.orderNo }}
{{ orderAndConfig?.order?.orderNo }}
</div>
</div>
<div class="payMessItem">
@@ -34,10 +34,10 @@
商户订单号
</div>
<div class="itemContent">
{{ orderAndConfig?.order.bizOrderNo }}
{{ orderAndConfig?.order?.bizOrderNo }}
</div>
</div>
<div v-if="orderAndConfig?.order.description" class="payMessItem">
<div v-if="orderAndConfig?.order?.description" class="payMessItem">
<div class="itemTitle">
订单描述
</div>
@@ -50,13 +50,13 @@
订单结束时间
</div>
<div class="itemContent">
{{ orderAndConfig?.order.expiredTime }}
{{ orderAndConfig?.order?.expiredTime }}
</div>
</div>
</div>
</div>
</div>
<div v-show="!isAutoLaunch" class="payBtnBox">
<div v-show="!isAutoLaunch" class="payBtnBox" @click="pay">
立即支付
</div>
<!-- loading -->
@@ -145,18 +145,18 @@ function init() {
return
}
show.value = true
loading.value = false
orderAndConfig.value = data
// 判断是否自动拉起支付
if (orderAndConfig.value?.aggregateConfig?.autoLaunch) {
if (orderAndConfig.value?.autoLaunch) {
isAutoLaunch.value = true
pay()
}
else {
isAutoLaunch.value = false // 控制是否显示倒计时和时间
orderTime.getDownTotalTime(data.order.expiredTime) // 计算倒计时
orderTime.getDownTotalTime(orderAndConfig.value?.order?.expiredTime) // 计算倒计时
orderTime.getMinter() // 先执行一下 解决进入页面一秒后才显示倒计时
resume() // 开启倒计时
pay()
}
})
}
@@ -166,7 +166,7 @@ function init() {
*/
function pay() {
loading.value = true
if (orderAndConfig.value?.aggregateConfig?.callType === GatewayCallTypeEnum.link) {
if (orderAndConfig.value?.callType === GatewayCallTypeEnum.link) {
const from = {
orderNo: orderNo as string,
scene: AggregateEnum.ALI,

View File

@@ -56,7 +56,7 @@
</div>
</div>
</div>
<div v-show="!isAutoLaunch" class="payBtnBox">
<div v-show="!isAutoLaunch" class="payBtnBox" @click="payCallback">
立即支付
</div>
<!-- loading -->
@@ -176,7 +176,7 @@ async function init() {
orderAndConfig.value = data
})
// 判断是否需要获取OpenId
if (orderAndConfig.value?.aggregateConfig?.needOpenId) {
if (orderAndConfig.value?.needOpenId) {
// 不等于9说明是微信重定向过来的
if (isChannel !== '9') {
if (isChannel === '1') {
@@ -259,7 +259,7 @@ async function wxAuth() {
function payMethod() {
show.value = true
// 判断是否自动拉起支付
if (orderAndConfig.value?.aggregateConfig?.autoLaunch) {
if (orderAndConfig.value?.autoLaunch) {
isAutoLaunch.value = true
payCallback()
}
@@ -268,7 +268,6 @@ function payMethod() {
orderTime.getDownTotalTime(orderAndConfig.value?.order?.expiredTime) // 计算倒计时
orderTime.getMinter() // 先执行一下 解决进入页面一秒后才显示倒计时
resume() // 开启倒计时
payCallback()
}
}
@@ -289,11 +288,11 @@ function payCallback() {
return
}
// 根据类型拉起对应的支付 支持跳转和jsapi
if (orderAndConfig.value?.aggregateConfig?.callType === GatewayCallTypeEnum.jsapi) {
if (orderAndConfig.value?.callType === GatewayCallTypeEnum.jsapi) {
const json = JSON.parse(data.payBody)
jsapiPay(json)
}
if (orderAndConfig.value?.aggregateConfig?.callType === GatewayCallTypeEnum.link) {
if (orderAndConfig.value?.callType === GatewayCallTypeEnum.link) {
location.replace(data.payBody as any)
}
})