style:根据支付分免押规范进行页面样式变更(整体)
This commit is contained in:
+36
-1
@@ -72,7 +72,42 @@ export const getUserInfo = () => {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 调用微信支付分接口
|
||||
export const initiateWeChatScorePayment = (paymentData) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 确保paymentData包含所需数据
|
||||
if (!paymentData || !paymentData.data || !paymentData.data.package) {
|
||||
reject(new Error('支付参数不完整'));
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用wx.openBusinessView打开微信支付分小程序
|
||||
wx.openBusinessView({
|
||||
businessType: 'wxpayScoreUse',
|
||||
extraData: {
|
||||
mch_id: paymentData.data.mch_id,
|
||||
package: paymentData.data.package
|
||||
},
|
||||
success: (businessRes) => {
|
||||
console.log('微信支付分小程序调用成功', businessRes);
|
||||
// 根据返回结果判断是否完成支付
|
||||
if (businessRes.errMsg === 'openBusinessView:ok') {
|
||||
resolve(businessRes);
|
||||
} else {
|
||||
reject(new Error('支付流程未完成'));
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
console.error('微信支付分小程序调用失败', error);
|
||||
uni.showToast({
|
||||
title: error.errMsg || '支付分接口调用失败',
|
||||
icon: 'none'
|
||||
});
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const getQueryString = function (url, name) {
|
||||
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
|
||||
|
||||
Reference in New Issue
Block a user