Authored by 姜枫

add shop cart free shipping tip

... ... @@ -41,6 +41,7 @@ const detail = (req, res, next) => {
const pageData = result[0];
const thumb = result[1];
console.log(pageData);
res.display('index', {
isMe: true,
... ...
<div class="order-status order" data-code="{{orderCode}}">
<div class="order-status order" data-code="{{orderCode}}" >
<div class="basic">
<p>订单号:{{orderCode}}</p>
<p>订单状态:{{statusStr}}</p>
... ...
... ... @@ -18,7 +18,6 @@ exports.index = (req, res, next) => {
if (result.code === 200) {
res.header('Cache-Control', 'no-store');
res.display('cart', _.merge({
module: 'shopping',
page: 'cart',
... ... @@ -135,7 +134,7 @@ exports.addToCart = (req, res, next) => {
shoppingKey: req.cookies._SPK || null,
uid: req.user.uid
}).then((result) => {
res.cookie('_SPK', result.data.shopping_key, { maxAge: 1000 * 60 * 60 * 24 * 365, httpOnly: true, path: '/'});
res.cookie('_SPK', result.data.shopping_key, {maxAge: 1000 * 60 * 60 * 24 * 365, httpOnly: true, path: '/'});
res.json(result);
}).catch(next);
};
... ... @@ -165,6 +164,9 @@ exports.toggleSelectGoods = (req, res, next) => {
}
cartModel.toggleSelectGoods(params).then(result => {
console.log(result)
res.json(_.merge(cartModel.filterCartData(result, uid), {code: result.code, message: result.message}));
}).catch(next);
};
... ...
... ... @@ -295,6 +295,20 @@ const filterCartData = (result, uid) => {
});
}
let freeShippingTip = '';
if (_.has(result, 'data.ordinary_cart_data.promotion_info')) {
let promotions = result.data.ordinary_cart_data.promotion_info;
let promotion = _.find(promotions, p => {
return p.promotion_type === 'FreeShippingCost';
});
if (promotion) {
freeShippingTip = promotion.promotion_title;
}
}
return _.merge(resData, {
hasGoods: advancedGoods.length || ordinaryGoods.length || invalidGoods.length,
preSalePros: (advancedSoldOutGoods.length || advancedGoods.length) ?
... ... @@ -304,6 +318,7 @@ const filterCartData = (result, uid) => {
selectedNum: selectedAdvanceNum + selectedOrdinaryNum,
checkAll: totalNum === (selectedAdvanceNum + selectedOrdinaryNum),
totalMoney: totalAdvanceMoney + totalOrdinaryMoney,
freeShippingTip: freeShippingTip,
noStorage
});
};
... ...
{{#if freeShippingTip}}
<div class="fregit-remark">
<span>免运费</span>
满399免运费
{{freeShippingTip}}
</div>
{{/if}}
<div class="cart-statement">
<div class="actions">
<div class="action">
... ... @@ -28,4 +30,4 @@
<div class="checkout">
<span class="btn {{#unless selectedNum}}disable{{/unless}}" id="checkout_btn">去结算</span>
</div>
</div>
\ No newline at end of file
</div>
... ...
... ... @@ -23,8 +23,8 @@ module.exports = {
cookieDomain: 'yohoblk.com',
domains: {
singleApi: 'http://single.yoho.cn/',
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
search: 'http://search.yohoops.org/yohosearch/'
},
useOneapm: false,
... ...
... ... @@ -203,6 +203,13 @@
</div>
{{/if}}
{{#if @root.freeShippingTip}}
<div class="fregit-remark">
<span>免运费</span>
{{@root.freeShippingTip}}
</div>
{{/if}}
<div class="cart-statement">
<div class="actions">
<div class="action">
... ... @@ -229,4 +236,4 @@
<div class="checkout">
<span class="btn {{#unless selectedNum}}disable{{/unless}}" id="checkout_btn">去结算</span>
</div>
</div>
\ No newline at end of file
</div>
... ...