Authored by 郭成尧

Merge branch 'feature/cart' into 'release/5.4.1'

修复了一些严重的BUG



See merge request !254
... ... @@ -14,7 +14,7 @@ const authcode = require(global.utils + '/authcode');
const actCkOpthn = {
expires: 0,
path: '/cart/index',
domain: '.m.yohobuy.com'
domain: 'm.yohobuy.com'
};
exports.orderEnsure = (req, res, next) => {
... ... @@ -81,9 +81,10 @@ exports.orderEnsure = (req, res, next) => {
let orderAddress = _.get(order, 'address', []);
let addressList = _.get(address, 'data', []);
orderAddress.length && addressList.forEach(address => { //eslint-disable-line
orderAddress.length && _.forEach(addressList, address => { //eslint-disable-line
if (address.address_id === orderAddress.address_id) {
mobile = address.mobile;
return false;
}
});
... ... @@ -143,7 +144,7 @@ exports.orderCompute = (req, res, next) => {
/**
* 确认结算订单
*/
exports.orderSub = (req, res) => {
exports.orderSub = (req, res, next) => {
let uid = req.user.uid;
let addressId = parseInt(crypto.decrypt('', req.body.addressId), 10);
let cartType = req.body.cartType || 'ordinary';
... ... @@ -242,7 +243,7 @@ exports.orderSub = (req, res) => {
} else {
return res.json(result);
}
})();
})().catch(next);
};
/**
... ... @@ -276,7 +277,7 @@ exports.couponList = (req, res, next) => {
return cartModel.getCouponList(uid)
.then(data => {
res.json(data);
});
}).catch(next);
} else {
return next();
}
... ... @@ -299,7 +300,7 @@ exports.couponSearch = (req, res, next) => {
return next();
}
})();
})().catch(next);
};
/**
... ... @@ -346,7 +347,7 @@ exports.selectAddress = (req, res, next) => {
/**
* 发票信息
*/
exports.invoiceInfo = (req, res) => {
exports.invoiceInfo = (req, res, next) => {
let uid = req.user.uid;
let cookieData = req.cookies['order-info'];
let orderInfo = JSON.parse(cookieData);
... ... @@ -366,7 +367,7 @@ exports.invoiceInfo = (req, res) => {
module: 'cart',
page: 'select-invoice'
}));
})();
})().catch(next);
};
/**
... ...
... ... @@ -3,7 +3,7 @@
* @Author: Targaryen
* @Date: 2017-01-04 15:17:51
* @Last Modified by: Targaryen
* @Last Modified time: 2017-02-09 10:50:07
* @Last Modified time: 2017-02-16 17:52:03
*/
'use strict';
... ... @@ -24,7 +24,7 @@ const common = require('../helpers/pay/common');
* @param res
* @param next
*/
const payCenter = (req, res) => {
const payCenter = (req, res, next) => {
let orderCode = req.query.order_code;
let uid = req.user.uid;
let sessionKey = req.session.TOKEN;
... ... @@ -87,7 +87,7 @@ const payCenter = (req, res) => {
};
res.render('pay/pay-center', responseData);
})();
})().catch(next);
};
/**
... ... @@ -143,8 +143,8 @@ const pay = (req, res, next) => {
} else {
return res.redirect('/');
}
}).catch(next);
})();
});
})().catch(next);
};
// 货到付款
... ...
... ... @@ -75,10 +75,12 @@ exports.cartPay = (uid, cartType, orderInfo, limitProductCode, sku, skn, buyNumb
}
// 区分套餐量贩和普通商品
let cartPayAPI = shoppingAPI.cartPayAPI(uid, cartType, 0, skuList);
let cartPayAPI;
if (activityInfo) {
cartPayAPI = shoppingAPI.cartPayAPI(uid, cartType, 0, skuList, activityInfo);
} else {
cartPayAPI = shoppingAPI.cartPayAPI(uid, cartType, 0, skuList);
}
return Promise.all([
... ...
... ... @@ -16,6 +16,7 @@ const processInvoiceData = (orderInfo, mobile, addresslist) => {
_.forEach(addresslist, addressValue => {
if (addressValue.address_id === crypto.encryption('', orderInfo.addressId)) {
mobile = addressValue.mobile;
return false;
}
});
}
... ...
... ... @@ -94,15 +94,15 @@
<a href="{{#if isLimit}}javascript:void(0);{{else}}/cart/index/new/selectCoupon{{/if}}">
<span class="title">优惠券</span>
{{# coupon}}
<span class="coupon-count">
{{count}}张可用
</span>
{{#if couponName}}
<span class="used coupon-use" data-name="{{couponName}}">
{{couponName}}
<i class="iconfont">&#xe614;</i>
</span>
{{^}}
<span class="coupon-count">
{{count}}张可用
</span>
<span class="not-used coupon-use">
{{#if isLimit}}该商品不可使用优惠券{{else}}未使用{{/if}}
<i class="iconfont">&#xe614;</i>
... ...
... ... @@ -320,7 +320,7 @@
.row .color {
display: inline-block;
max-width: 5rem;
max-width: 4rem;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
... ...