Authored by 郭成尧

compute

@@ -109,9 +109,17 @@ exports.orderCompute = (req, res, next) => { @@ -109,9 +109,17 @@ exports.orderCompute = (req, res, next) => {
109 let type = req.body.type; 109 let type = req.body.type;
110 110
111 if (type !== 'tickets') { 111 if (type !== 'tickets') {
  112 + if (req.body.activityType === 'bundle') {
  113 + let activityInfo = JSON.parse(req.cookies['activity-info']);
  114 +
  115 + cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, null, activityInfo).then(result => {
  116 + res.json(result);
  117 + }).catch(next);
  118 + } else {
112 cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, skuList).then(result => { 119 cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, skuList).then(result => {
113 res.json(result); 120 res.json(result);
114 }).catch(next); 121 }).catch(next);
  122 + }
115 } else { 123 } else {
116 cartModel.ticketsOrderCompute(uid, productSku, buyNumber, yohoCoin).then(result => { 124 cartModel.ticketsOrderCompute(uid, productSku, buyNumber, yohoCoin).then(result => {
117 res.json(result); 125 res.json(result);
@@ -156,8 +156,8 @@ exports.cartPay = (uid, cartType, orderInfo, limitProductCode, sku, skn, buyNumb @@ -156,8 +156,8 @@ exports.cartPay = (uid, cartType, orderInfo, limitProductCode, sku, skn, buyNumb
156 * @param string $skuList 购买限购商品时需要传递的参数 156 * @param string $skuList 购买限购商品时需要传递的参数
157 * @return array 接口返回的数据 157 * @return array 接口返回的数据
158 */ 158 */
159 -exports.orderCompute = (uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList) => {  
160 - return shoppingAPI.orderComputeAPI(uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList).then(result => { 159 +exports.orderCompute = (uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList, activityInfo) => {
  160 + return shoppingAPI.orderComputeAPI(uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList, activityInfo).then(result => {
161 if (result && result.data) { 161 if (result && result.data) {
162 result.data.use_yoho_coin = transPrice(result.data.use_yoho_coin); 162 result.data.use_yoho_coin = transPrice(result.data.use_yoho_coin);
163 result.data.yohoCoinCompute = _yohoCoinCompute(result.data); 163 result.data.yohoCoinCompute = _yohoCoinCompute(result.data);
@@ -64,9 +64,13 @@ exports.cartPayAPI = (uid, cartType, isUseYohoCoin, skuList, activityInfo) => { @@ -64,9 +64,13 @@ exports.cartPayAPI = (uid, cartType, isUseYohoCoin, skuList, activityInfo) => {
64 * 2. 除非同时调用app.Shopping.payment 与该接口,用改接口的data值替换app.Shopping.payment相关值, 64 * 2. 除非同时调用app.Shopping.payment 与该接口,用改接口的data值替换app.Shopping.payment相关值,
65 * 显示调用utils/payment-process.js@tranformPayment(他会帮你调yohoCoinCompute)处理payment的data; 65 * 显示调用utils/payment-process.js@tranformPayment(他会帮你调yohoCoinCompute)处理payment的data;
66 */ 66 */
67 -exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yohoCoin, skuList) => { 67 +exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yohoCoin, skuList, activityInfo) => {
  68 + if (!activityInfo) {
  69 + activityInfo = null;
  70 + }
  71 +
68 let param = { 72 let param = {
69 - method: 'app.Shopping.compute', 73 + method: activityInfo ? 'app.Shopping.easyCompute' : 'app.Shopping.compute',
70 cart_type: cartType, 74 cart_type: cartType,
71 delive_way: deliveWay, 75 delive_way: deliveWay,
72 payment_type: paymentType 76 payment_type: paymentType
@@ -80,10 +84,16 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo @@ -80,10 +84,16 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo
80 param.use_yoho_coin = yohoCoin; 84 param.use_yoho_coin = yohoCoin;
81 } 85 }
82 86
83 - if (!_.isEmpty(skuList)) { 87 + if (!_.isEmpty(skuList) && !activityInfo) {
84 param.product_sku_list = skuList; 88 param.product_sku_list = skuList;
85 } 89 }
86 90
  91 + // 购买套餐商品需要的数据
  92 + if (activityInfo) {
  93 + param.activity_id = activityInfo.activity_id;
  94 + param.product_sku_list = activityInfo.product_sku_list;
  95 + }
  96 +
87 return api.get('', param, {code: 200}); 97 return api.get('', param, {code: 200});
88 }; 98 };
89 99