Authored by 郭成尧

order-goods

@@ -72,7 +72,8 @@ class payModel extends global.yoho.BaseModel { @@ -72,7 +72,8 @@ class payModel extends global.yoho.BaseModel {
72 payment_amount: _.get(result, 'data.order_extInfo.payment_amount') || 72 payment_amount: _.get(result, 'data.order_extInfo.payment_amount') ||
73 _.get(result, 'data.payment_amount'), 73 _.get(result, 'data.payment_amount'),
74 pay_expire: _.get(result, 'data.order_detail_info.ext.pay_expire') || 74 pay_expire: _.get(result, 'data.order_detail_info.ext.pay_expire') ||
75 - _.get(result, 'data.pay_expire') 75 + _.get(result, 'data.pay_expire'),
  76 + order_goods: _.get(result, 'data.order_goods')
76 } 77 }
77 }; 78 };
78 } 79 }
@@ -95,21 +96,14 @@ class payModel extends global.yoho.BaseModel { @@ -95,21 +96,14 @@ class payModel extends global.yoho.BaseModel {
95 96
96 // 购买此商品的用户也购买了,要先从订单详情获取商品skn 97 // 购买此商品的用户也购买了,要先从订单详情获取商品skn
97 _getOthersBuy(param) { 98 _getOthersBuy(param) {
98 - return Promise.all([  
99 - this.getOtherDetail(param)  
100 - ]).then((result) => { 99 + this.getOtherDetail(param).then(result => {
  100 + let skn = _.get(result, 'data.order_goods.0.product_skn', '');
101 101
102 - let goodSkn = '';  
103 -  
104 - if (result && result[0] && result[0].data && result[0].data.order_goods) {  
105 - goodSkn = result[0].data.order_goods[0].product_skn; 102 + if (skn) {
  103 + return this._getOthersBuy2(Object.assign(param, { skn: skn }));
  104 + } else {
  105 + return Promise.resolve([]);
106 } 106 }
107 -  
108 - return this._getOthersBuy2(Object.assign(param, { skn: goodSkn }));  
109 -  
110 - }).then((result) => {  
111 -  
112 - return result;  
113 }); 107 });
114 } 108 }
115 109
@@ -59,11 +59,13 @@ @@ -59,11 +59,13 @@
59 </a> 59 </a>
60 {{/data}} 60 {{/data}}
61 {{/banner}} 61 {{/banner}}
  62 + {{#if othersBuy}}
62 <div class="others-buy clearfix"> 63 <div class="others-buy clearfix">
63 <p>购买此商品的用户也购买了</p> 64 <p>购买此商品的用户也购买了</p>
64 {{# othersBuy}} 65 {{# othersBuy}}
65 {{> common/goods}} 66 {{> common/goods}}
66 {{/ othersBuy}} 67 {{/ othersBuy}}
67 </div> 68 </div>
  69 + {{/if}}
68 {{> home/maybe-like}} 70 {{> home/maybe-like}}
69 </div> 71 </div>