优化错误提示

This commit is contained in:
2024-06-15 19:08:56 +08:00
parent f83bf3dd98
commit 41384ef8e9
3 changed files with 25 additions and 9 deletions

View File

@@ -138,19 +138,30 @@ const navigateTo = (e: any) => {
}, },
onFailure: (e: any) => { onFailure: (e: any) => {
getApp().globalData?.logger?.error('coupon pay failure params: ', buildSqbParams.value, e); getApp().globalData?.logger?.error('coupon pay failure params: ', buildSqbParams.value, e);
showToast('支付失败', {
uni.showToast({
title: e,
icon: 'none', icon: 'none',
complete: () => { duration: 1500,
uni.navigateBack(); complete(result) {
} }
}); });
// showToast(e, {
// icon: 'none',
// complete: () => {
// setTimeout(() => {
// uni.navigateBack();
// }, 1500);
// }
// });
} }
}); });
}; };
const createOrder = () => { const createOrder = () => {
if(!terminalInfo.value) { if(!terminalInfo.value) {
utils_common_index.showToast('当前店铺未配置收款渠道,请联系商家'); showToast('当前店铺未配置收款渠道,请联系商家');
return; return;
} }
const params = { const params = {

View File

@@ -163,7 +163,7 @@ const buildSqbParams = computed(() => {
total_amount: Number(((totalPrice.value || 0) * 100).toFixed(2)), total_amount: Number(((totalPrice.value || 0) * 100).toFixed(2)),
terminal_sn: terminalInfo.value?.terminalSn, terminal_sn: terminalInfo.value?.terminalSn,
subject: orderBean?.value?.orderGoods[0].name || '未知', subject: orderBean?.value?.orderGoods[0].name || '未知',
subject_img: orderBean?.value?.orderGoods[0].images || '', subject_img: orderBean?.value?.orderGoods[0].images || 'xxx',
merchant_name: terminalInfo.value?.companyName, merchant_name: terminalInfo.value?.companyName,
notify_url: 'https://www.baidu.com' notify_url: 'https://www.baidu.com'
}, true); }, true);

View File

@@ -46,11 +46,16 @@ export const handlePayResult = (orderId: string | undefined, e: any, { onSuccess
}); });
} }
} else { } else {
getApp().globalData?.logger?.error('pay failure :', orderId, resultObj); getApp().globalData?.logger?.error('pay failure :', orderId, str, resultObj);
if(onFailure) { let msg = '支付失败';
onFailure(resultObj); if(resultObj) {
msg = resultObj?.error_message || '支付失败';
} else {
msg = JSON.parse(str)?.error_message || '支付失败';
}
if(onFailure) {
onFailure(msg);
} else { } else {
const msg = resultObj?.error_message || '支付失败';
showToast(msg, { showToast(msg, {
complete: () => { complete: () => {
setTimeout(() => { setTimeout(() => {