Authored by 郭成尧

compute

... ... @@ -109,9 +109,17 @@ exports.orderCompute = (req, res, next) => {
let type = req.body.type;
if (type !== 'tickets') {
cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, skuList).then(result => {
res.json(result);
}).catch(next);
if (req.body.activityType === 'bundle') {
let activityInfo = JSON.parse(req.cookies['activity-info']);
cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, null, activityInfo).then(result => {
res.json(result);
}).catch(next);
} else {
cartModel.orderCompute(uid, cartType, deliveryId, paymentTypeId, couponCode, yohoCoin, skuList).then(result => {
res.json(result);
}).catch(next);
}
} else {
cartModel.ticketsOrderCompute(uid, productSku, buyNumber, yohoCoin).then(result => {
res.json(result);
... ...
... ... @@ -156,8 +156,8 @@ exports.cartPay = (uid, cartType, orderInfo, limitProductCode, sku, skn, buyNumb
* @param string $skuList 购买限购商品时需要传递的参数
* @return array 接口返回的数据
*/
exports.orderCompute = (uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList) => {
return shoppingAPI.orderComputeAPI(uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList).then(result => {
exports.orderCompute = (uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList, activityInfo) => {
return shoppingAPI.orderComputeAPI(uid, cartType, deliveryWay, paymentType, couponCode, yohoCoin, skuList, activityInfo).then(result => {
if (result && result.data) {
result.data.use_yoho_coin = transPrice(result.data.use_yoho_coin);
result.data.yohoCoinCompute = _yohoCoinCompute(result.data);
... ...
... ... @@ -64,9 +64,13 @@ exports.cartPayAPI = (uid, cartType, isUseYohoCoin, skuList, activityInfo) => {
* 2. 除非同时调用app.Shopping.payment 与该接口,用改接口的data值替换app.Shopping.payment相关值,
* 显示调用utils/payment-process.js@tranformPayment(他会帮你调yohoCoinCompute)处理payment的data;
*/
exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yohoCoin, skuList) => {
exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yohoCoin, skuList, activityInfo) => {
if (!activityInfo) {
activityInfo = null;
}
let param = {
method: 'app.Shopping.compute',
method: activityInfo ? 'app.Shopping.easyCompute' : 'app.Shopping.compute',
cart_type: cartType,
delive_way: deliveWay,
payment_type: paymentType
... ... @@ -80,10 +84,16 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo
param.use_yoho_coin = yohoCoin;
}
if (!_.isEmpty(skuList)) {
if (!_.isEmpty(skuList) && !activityInfo) {
param.product_sku_list = skuList;
}
// 购买套餐商品需要的数据
if (activityInfo) {
param.activity_id = activityInfo.activity_id;
param.product_sku_list = activityInfo.product_sku_list;
}
return api.get('', param, {code: 200});
};
... ...