Authored by 郭成尧

order-computer-modified

@@ -162,30 +162,27 @@ exports.orderCompute = (req, res, next) => { @@ -162,30 +162,27 @@ exports.orderCompute = (req, res, next) => {
162 let type = req.body.type; 162 let type = req.body.type;
163 163
164 if (type !== 'tickets') { 164 if (type !== 'tickets') {
  165 + let params = {
  166 + uid: uid,
  167 + cart_type: cartType,
  168 + delivery_way: deliveryId,
  169 + payment_type: paymentType,
  170 + coupon_code: couponCode,
  171 + use_yoho_coin: yohoCoin,
  172 + };
  173 +
165 if (req.body.cartType === 'bundle') { 174 if (req.body.cartType === 'bundle') {
166 let activityInfo = JSON.parse(req.cookies['activity-info']); 175 let activityInfo = JSON.parse(req.cookies['activity-info']);
167 176
168 - cartModel.orderCompute({  
169 - uid: uid,  
170 - cartType: cartType,  
171 - deliveryWay: deliveryId,  
172 - paymentType: paymentType,  
173 - couponCode: couponCode,  
174 - yohoCoin: yohoCoin, 177 + cartModel.orderCompute(_.assign(params, {
175 activityInfo: activityInfo 178 activityInfo: activityInfo
176 - }).then(result => { 179 + })).then(result => {
177 res.json(result); 180 res.json(result);
178 }).catch(next); 181 }).catch(next);
179 } else { 182 } else {
180 - cartModel.orderCompute({  
181 - uid: uid,  
182 - cartType: cartType,  
183 - deliveryWay: deliveryId,  
184 - paymentType: paymentType,  
185 - couponCode: couponCode,  
186 - yohoCoin: yohoCoin,  
187 - skuList: skuList  
188 - }).then(result => { 183 + cartModel.orderCompute(_.assign(params, {
  184 + product_sku_list: skuList
  185 + })).then(result => {
189 res.json(result); 186 res.json(result);
190 }).catch(next); 187 }).catch(next);
191 } 188 }
@@ -120,16 +120,7 @@ exports.cartPay = (params) => { @@ -120,16 +120,7 @@ exports.cartPay = (params) => {
120 * @return array 接口返回的数据 120 * @return array 接口返回的数据
121 */ 121 */
122 exports.orderCompute = (params) => { 122 exports.orderCompute = (params) => {
123 - return shoppingAPI.orderComputeAPI({  
124 - uid: params.uid,  
125 - cart_type: params.cartType,  
126 - delivery_way: params.deliveryWay,  
127 - payment_type: params.paymentType,  
128 - coupon_code: params.couponCode,  
129 - use_yoho_coin: params.yohoCoin,  
130 - product_sku_list: params.skuList,  
131 - activityInfo: params.activityInfo  
132 - }).then(result => { 123 + return shoppingAPI.orderComputeAPI(params).then(result => {
133 if (result && result.data) { 124 if (result && result.data) {
134 result.data.use_yoho_coin = paymentProcess.transPrice(result.data.use_yoho_coin); 125 result.data.use_yoho_coin = paymentProcess.transPrice(result.data.use_yoho_coin);
135 result.data.yohoCoinCompute = paymentProcess.yohoCoinCompute(result.data); 126 result.data.yohoCoinCompute = paymentProcess.yohoCoinCompute(result.data);