refactor(orderDetail): 优化支付逻辑

- 移除了冗余的支付成功处理代码
-简化了支付流程,提高了代码可读性
- 删除了未使用的条码扫描支付相关代码
main
Tuzki 7 months ago
parent 4eac970b96
commit ee34241a5b
  1. 120
      pages/orderDetail/orderDetail.vue

@ -229,37 +229,42 @@
console.log('支付结果', res)
const data = res.data;
if (data.status === 0) {
that.clearQueryInterval();
uni.showToast({
icon: 'none',
title: '支付成功!',
duration: 1000
//
uni.showLoading({
title: '支付中...',
mask: true
});
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
});
})
.catch((err) => {
console.log(err);
});
this.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;
}
//
uni.showLoading({
title: '支付中...',
mask: true
});
this.createQueryInterval();
}).catch(err => {
// uni.showLoading({
// title: '...'
@ -269,67 +274,6 @@
}
});
}
// if (val == 2) {
// //
// uni.hideLoading();
// uni.scanCode({
// scanType: ['barCode', 'qrCode'],
// success: function(resposon) {
// console.log('' + resposon.result);
// // console.log('this.orderDetail', this.orderDetail);
// const obj = {
// channelCode: 'alipay_bar',
// channelExtras: {
// auth_code: resposon.result
// },
// id: that.orderDetail.orderInfo.belongingPayOrderId,
// returnUrl: ''
// };
// debugger
// submitOrder(obj).then((res) => {
// console.log('', res)
// const data = res.data;
// if (data.status === 10) {
// that.clearQueryInterval();
// uni.showToast({
// icon: 'none',
// 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
// });
// })
// .catch((err) => {
// console.log(err);
// });
// return;
// }
// //
// uni.showLoading({
// title: '...',
// mask: true
// });
// this.createQueryInterval();
// }).catch(err => {
// // uni.showLoading({
// // title: '...'
// // });
// // this.createQueryInterval();
// })
// }
// });
// }
if (val == 'cash') {
const obj = {

Loading…
Cancel
Save