Authored by 毕凯

Merge branch 'feature/cartLimitTip' into 'release/6.3'

'购物车结算错误消息返回并提示'



See merge request !1116
... ... @@ -100,16 +100,16 @@ exports.orderEnsure = (req, res, next) => {
}
}
if (order.cartUrl) {
logger.info(`orderEnsure: order cartUrl has value:${order.cartUrl}, order data is null`);
return res.redirect(order.cartUrl);
}
if (req.xhr) {
logger.info(`orderEnsure: ajax request, return json:${JSON.stringify(order)}`);
return res.json(order);
}
if (order.cartUrl) {
logger.info(`orderEnsure: order cartUrl has value:${order.cartUrl}, order data is null`);
return res.redirect(order.cartUrl);
}
// 获取用户完整手机号
let mobile = _.get(userProfile, 'data.mobile', '');
let orderAddress = _.get(order, 'address', []);
... ...
... ... @@ -90,6 +90,9 @@ class cartModel extends global.yoho.BaseModel {
result.error = true;
result.message = pay.message;
} else {
// 错误消息要 暴露出去
result.error = true;
result.message = pay.message;
result.cartUrl = helpers.urlFormat('/cart/index/index');
}
... ...
... ... @@ -156,7 +156,15 @@ let cartObj = {
toOrderEnsure(cartType) {
cookie.get('_realyGift') && cookie.remove('_realyGift');
cookie.get('order-info') && cookie.remove('order-info');
window.location.href = '/cart/index/new/orderEnsure?cartType=' + cartType;
$.get('/cart/index/new/orderEnsure', {cartType: cartType}, function(result) {
if (result.error) {
tip.show(result.message);
return false;
}
window.location.href = '/cart/index/new/orderEnsure?cartType=' + cartType;
});
},
toOrderEnsureGift() {
let self = this;
... ...