Authored by QC-L

修复微信支付后,订单状态不正确的问题

... ... @@ -22,42 +22,74 @@ exports.orderDetailData = (req, res, next) => {
if (req.query.openId) {
// 微信支付成功,发送支付确认接口
req.ctx(payModel).sendPayConfirm(orderCode, 22, uid);
}
Promise.all([
req.ctx(orderDetailModel).orderDetailData(uid, orderCode),
req.ctx(orderDetailModel).closeReasons(),
req.ctx(orderModel).refundReason()
]).then(result => {
let orderDetail = result[0];
let cancelReason = result[1];
let refundReason = result[2];
if (!orderDetail || _.isEmpty(orderDetail)) {
return next();
}
Object.assign(orderDetail, {
cancelReason: cancelReason
req.ctx(payModel).sendPayConfirm(orderCode, 22, uid).then(() => {
Promise.all([
req.ctx(orderDetailModel).orderDetailData(uid, orderCode),
req.ctx(orderDetailModel).closeReasons(),
req.ctx(orderModel).refundReason()
]).then(result => {
let orderDetail = result[0];
let cancelReason = result[1];
let refundReason = result[2];
if (!orderDetail || _.isEmpty(orderDetail)) {
return next();
}
Object.assign(orderDetail, {
cancelReason: cancelReason
});
orderDetail.serviceUrl = serviceUrl;
res.render('orderDetail', {
module: 'home',
page: 'orderdetail',
pageHeader: headerModel.setNav({
navTitle: '订单详情'
}),
title: '订单详情',
pageFooter: true,
orderDetail: orderDetail,
refundReason: refundReason,
width750: true,
localCss: true,
});
}).catch(next);
});
} else {
Promise.all([
req.ctx(orderDetailModel).orderDetailData(uid, orderCode),
req.ctx(orderDetailModel).closeReasons(),
req.ctx(orderModel).refundReason()
]).then(result => {
let orderDetail = result[0];
let cancelReason = result[1];
let refundReason = result[2];
if (!orderDetail || _.isEmpty(orderDetail)) {
return next();
}
Object.assign(orderDetail, {
cancelReason: cancelReason
});
orderDetail.serviceUrl = serviceUrl;
res.render('orderDetail', {
module: 'home',
page: 'orderdetail',
pageHeader: headerModel.setNav({
navTitle: '订单详情'
}),
title: '订单详情',
pageFooter: true,
orderDetail: orderDetail,
refundReason: refundReason,
width750: true,
localCss: true,
});
}).catch(next);
orderDetail.serviceUrl = serviceUrl;
res.render('orderDetail', {
module: 'home',
page: 'orderdetail',
pageHeader: headerModel.setNav({
navTitle: '订单详情'
}),
title: '订单详情',
pageFooter: true,
orderDetail: orderDetail,
refundReason: refundReason,
width750: true,
localCss: true,
});
}).catch(next);
}
};
// 删除订单
... ...