Authored by QC-L

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

@@ -22,42 +22,74 @@ exports.orderDetailData = (req, res, next) => { @@ -22,42 +22,74 @@ exports.orderDetailData = (req, res, next) => {
22 22
23 if (req.query.openId) { 23 if (req.query.openId) {
24 // 微信支付成功,发送支付确认接口 24 // 微信支付成功,发送支付确认接口
25 - req.ctx(payModel).sendPayConfirm(orderCode, 22, uid);  
26 - }  
27 -  
28 - Promise.all([  
29 - req.ctx(orderDetailModel).orderDetailData(uid, orderCode),  
30 - req.ctx(orderDetailModel).closeReasons(),  
31 - req.ctx(orderModel).refundReason()  
32 - ]).then(result => {  
33 - let orderDetail = result[0];  
34 - let cancelReason = result[1];  
35 - let refundReason = result[2];  
36 -  
37 - if (!orderDetail || _.isEmpty(orderDetail)) {  
38 - return next();  
39 - }  
40 -  
41 - Object.assign(orderDetail, {  
42 - cancelReason: cancelReason 25 + req.ctx(payModel).sendPayConfirm(orderCode, 22, uid).then(() => {
  26 + Promise.all([
  27 + req.ctx(orderDetailModel).orderDetailData(uid, orderCode),
  28 + req.ctx(orderDetailModel).closeReasons(),
  29 + req.ctx(orderModel).refundReason()
  30 + ]).then(result => {
  31 + let orderDetail = result[0];
  32 + let cancelReason = result[1];
  33 + let refundReason = result[2];
  34 +
  35 + if (!orderDetail || _.isEmpty(orderDetail)) {
  36 + return next();
  37 + }
  38 +
  39 + Object.assign(orderDetail, {
  40 + cancelReason: cancelReason
  41 + });
  42 +
  43 + orderDetail.serviceUrl = serviceUrl;
  44 + res.render('orderDetail', {
  45 + module: 'home',
  46 + page: 'orderdetail',
  47 + pageHeader: headerModel.setNav({
  48 + navTitle: '订单详情'
  49 + }),
  50 + title: '订单详情',
  51 + pageFooter: true,
  52 + orderDetail: orderDetail,
  53 + refundReason: refundReason,
  54 + width750: true,
  55 + localCss: true,
  56 + });
  57 + }).catch(next);
43 }); 58 });
  59 + } else {
  60 + Promise.all([
  61 + req.ctx(orderDetailModel).orderDetailData(uid, orderCode),
  62 + req.ctx(orderDetailModel).closeReasons(),
  63 + req.ctx(orderModel).refundReason()
  64 + ]).then(result => {
  65 + let orderDetail = result[0];
  66 + let cancelReason = result[1];
  67 + let refundReason = result[2];
  68 +
  69 + if (!orderDetail || _.isEmpty(orderDetail)) {
  70 + return next();
  71 + }
  72 +
  73 + Object.assign(orderDetail, {
  74 + cancelReason: cancelReason
  75 + });
44 76
45 - orderDetail.serviceUrl = serviceUrl;  
46 - res.render('orderDetail', {  
47 - module: 'home',  
48 - page: 'orderdetail',  
49 - pageHeader: headerModel.setNav({  
50 - navTitle: '订单详情'  
51 - }),  
52 - title: '订单详情',  
53 - pageFooter: true,  
54 - orderDetail: orderDetail,  
55 - refundReason: refundReason,  
56 - width750: true,  
57 - localCss: true,  
58 - });  
59 - }).catch(next);  
60 - 77 + orderDetail.serviceUrl = serviceUrl;
  78 + res.render('orderDetail', {
  79 + module: 'home',
  80 + page: 'orderdetail',
  81 + pageHeader: headerModel.setNav({
  82 + navTitle: '订单详情'
  83 + }),
  84 + title: '订单详情',
  85 + pageFooter: true,
  86 + orderDetail: orderDetail,
  87 + refundReason: refundReason,
  88 + width750: true,
  89 + localCss: true,
  90 + });
  91 + }).catch(next);
  92 + }
61 }; 93 };
62 94
63 // 删除订单 95 // 删除订单