修改支付页跳转

This commit is contained in:
zhouyanli
2026-07-25 16:30:50 +08:00
parent 6cb10fee08
commit ebc8cfa3cb
4 changed files with 74 additions and 75 deletions

View File

@@ -191,14 +191,15 @@
const res = await getBankMiniProgramParams({
acct: uni.getStorageSync('userId'),
orderType: '20',
orderType: '10',
orderAmount: String(Math.round(Number(amount) * 100)),
// orderAmount: String(Math.round(Number(arrearsAmount.value) * 100)),
deviceCode: paymentItem.deviceCode || '',
deviceType: mappedDeviceType,
billId: paymentItem.billId || '',
residentUserId: uni.getStorageSync('userId'),
goodName: paymentItem.name || ''
goodName: paymentItem.name || switchStatus(paymentItem.type) || '',
remark:'服务费'
})
uni.hideLoading()
@@ -220,20 +221,13 @@
return
}
// 解析 extraData后端返回可能是字符串或对象
/* let extraDataObj = extraData
if (typeof extraData === 'string') {
try {
extraDataObj = JSON.parse(extraData)
} catch (e) {
console.error('extraData JSON解析失败使用空对象', e)
extraDataObj = {}
}
}
if (!extraDataObj || typeof extraDataObj !== 'object') {
extraDataObj = {}
}
console.log('解析-----extraDataObj', extraDataObj) */
// 把支付金额和token拼接到 extraData 查询字符串中传入中间小程序,实现免登录
const token = uni.getStorageSync('token') || ''
const payAmountStr = String(payAmount.value)
const orderAmountStr = String(Math.round(Number(amount) * 100))
const custId = uni.getStorageSync('custId') || ''
const extraDataWithAmount = extraData + '&payAmount=' + encodeURIComponent(payAmountStr) + '&orderAmount=' + encodeURIComponent(orderAmountStr) + '&token=' + encodeURIComponent(token) + '&custId=' + encodeURIComponent(custId)
console.log('传入中间小程序的extraData:', extraDataWithAmount)
// #ifdef APP-PLUS
// 原生App通过微信SDK拉起小程序
plus.share.getServices((services) => {
@@ -247,25 +241,24 @@
return
}
weixin.launchMiniProgram({
id: 'gh_4ba5e4fdaa83',
// appId:'00004951',
type: 1, // 0=正式版 1=测试版 2=预览版
path: path,
// extMsg: JSON.stringify({ extraData: extraData })
extraData: extraData
id: 'gh_a765aef0172c',
// appId: 'wx40625124315d2de1',
type:1, // 0 正式版 / 1测试版 / 2预览版
path: 'pageSubPack/payment-list/arrearsPayment',
extraData: extraDataWithAmount,
}, (res) => {
console.log('ress-------------',res)
if (res.retCode === 'SUCCESS') {
console.log('成功拉起日照银行小程序App', res.retCode)
} else {
console.log('拉起日照银行小程序返回失败App======)', res.retMsg)
}
// if (res.retCode === 'SUCCESS') {
// console.log('成功拉起日照银行小程序App', res.retCode)
// } else {
// console.log('拉起日照银行小程序返回失败App======)', res.retMsg)
// }
console.log('回调---日照银行小程序回调结果App', JSON.stringify(res))
console.log('回调---回调结果App', JSON.stringify(res))
}, (err) => {
console.error('拉起日照银行小程序失败App', JSON.stringify(err))
console.error('err---拉起失败App', JSON.stringify(err))
uni.showToast({ title: '拉起支付小程序失败', icon: 'none' })
})
})