修复购买微信团购券不到帐问题

This commit is contained in:
2024-06-11 23:01:50 +08:00
parent 49b1968ba5
commit 63b30c0695
10 changed files with 65 additions and 33 deletions

View File

@@ -33,9 +33,10 @@ export const handlePayResult = (orderId: string | undefined, e: any, { onSuccess
const str = url.split('?')[1];
const resultObj = JSON.parse(str.replaceAll('result=', ''));
getApp().globalData?.logger?.info('pay reuslt : ', orderId, resultObj);
if(resultObj?.is_success === true) {
if(onSuccess) {
onSuccess();
onSuccess(resultObj);
} else {
showToast('支付成功', {
icon: 'success',
@@ -45,14 +46,18 @@ export const handlePayResult = (orderId: string | undefined, e: any, { onSuccess
});
}
} else {
getApp().globalData?.logger?.error('pay failure :', resultObj);
if(onFailure) {
onFailure();
} else {
const msg = resultObj?.error_message || '支付失败';
showToast(msg, {
complete: () => {
setTimeout(() => {
uni.navigateBack();
}, 1500);
}
});
}
const msg = resultObj?.error_message || '支付失败';
showToast(msg, {
complete: () => {
uni.navigateBack();
}
});
}
};