refactor(orderDetail): 优化支付流程和界面显示

- 移除支付成功后的冗余代码和注释
- 调整支付成功提示文本,去掉感叹号
- 在支付过程中添加 loading 提示
- 优化支付成功后的跳转逻辑,使用 setTimeout延迟执行
main
Tuzki 7 months ago
parent 47b0632505
commit 463d5a0162
  1. 75
      pages/orderDetail/orderDetail.vue

@ -169,7 +169,7 @@
uni.hideLoading();
uni.showToast({
icon: 'none',
title: '支付成功',
title: '支付成功',
duration: 1000
});
const ob = {
@ -229,73 +229,48 @@
id: that.orderDetail.orderInfo.belongingPayOrderId,
returnUrl: ''
};
uni.showLoading({
title: '支付中...',
mask: true
});
submitOrder(obj).then((res) => {
console.log('支付结果', res)
const data = res.data;
//
if (data.status === 0) {
//
uni.showLoading({
title: '支付中...',
mask: true
});
that.createQueryInterval();
// that.clearQueryInterval();
// uni.showToast({
// icon: 'none',
// title: '',
// duration: 1000
// });
// const ob = {
// orderNumber: that.orderDetail.orderInfo.orderNumber
// };
// printTicket(ob)
// .then((ress) => {
// console.log('ress',ress);
// const datas = JSON.stringify(that.orderDetail.orderInfo
// .ticketList);
// // console.log(data)
// uni.navigateTo({
// url: '/pages/payResult/payResult?status=success&detail=' +
// datas + '&tickets=' + ress.data
// });
// })
// .catch((err) => {
// console.log(err);
// });
return;
}
//
else if (response.data.status === 10) {
else if (data.status === 10) {
that.clearQueryInterval();
uni.hideLoading();
uni.showToast({
icon: 'none',
title: '支付成功',
title: '支付成功',
duration: 1000
});
const ob = {
orderNumber: that.orderDetail.orderInfo.orderNumber
};
printTicket(ob)
.then((ress) => {
const datas = JSON.stringify(that.orderDetail.orderInfo
.ticketList);
// console.log(data)
uni.navigateTo({
url: '/pages/payResult/payResult?status=success&detail=' +
datas + '&tickets=' + ress.data
setTimeout(()=>{
printTicket(ob)
.then((ress) => {
const datas = JSON.stringify(that.orderDetail.orderInfo
.ticketList);
console.log('ress',ress)
uni.navigateTo({
url: '/pages/payResult/payResult?status=success&detail=' +
datas + '&tickets=' + ress.data
});
})
.catch((err) => {
console.log(err);
});
})
.catch((err) => {
console.log(err);
});
return
},1000)
return
}
}).catch(err => {

Loading…
Cancel
Save