Authored by 陈峰

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

Feature/cart



See merge request !225
... ... @@ -88,7 +88,9 @@ exports.orderEnsure = (req, res, next) => {
let viewData = {
orderEnsurePage: true,
isOrdinaryCart: cartType !== 'advance',
orderEnsure: order,
orderEnsure: _.assign(order, {
isOrdinaryCart: cartType !== 'advance'
}),
userMobile: mobile,
pageHeader: headerData,
pageFooter: false,
... ...
... ... @@ -72,7 +72,7 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo
let param = {
method: activityInfo ? 'app.Shopping.easyCompute' : 'app.Shopping.compute',
cart_type: cartType,
delive_way: deliveWay,
delivery_way: deliveWay,
payment_type: paymentType,
uid: uid
};
... ...
... ... @@ -6,7 +6,7 @@
{{#promotions}}
<div class="promo-item" data-id="{{promotionId}}" data-title="{{promotionOriginTitle}}" data-type="{{promotionType}}" data-status="{{status}}">
<div class="info"><i class="iconfont cuxiao"></i>{{promotionTitle}}</div>
<div class="opt to-gift">
<div class="opt to-gift {{#if noStorage}}no-storage{{/if}}">
<a href="javascript:;">{{optTitle}}</a><i class="iconfont to-arrow"></i>
</div>
</div>
... ... @@ -23,7 +23,7 @@
<div class="info">
<span class="flag">{{promotionFlag}}</span>{{promotionTitle}}
</div>
<div class="opt to-gift">
<div class="opt to-gift {{#if noStorage}}no-storage{{/if}}">
<a href="javascript:;">{{optTitle}}</a><i class="iconfont to-arrow"></i>
</div>
</div>
... ... @@ -63,9 +63,9 @@
<i class="iconfont price-gift"></i>
</div>
<div class="content">
<div class="info">已满足全场加价购</div>
<div class="opt to-gift">
<a href="javascript:;">去换购</a><i class="iconfont to-arrow"></i>
<div class="info">加价购</div>
<div class="opt to-gift {{#ifnot advanceHasStorage}}no-storage{{/ifnot}}">
<a href="javascript:;">{{#if advanceHasStorage}}去换购{{^}}已抢光{{/if}}</a><i class="iconfont to-arrow"></i>
</div>
</div>
</div>
... ... @@ -76,9 +76,9 @@
<i class="iconfont gift"></i>
</div>
<div class="content">
<div class="info">已满足全场赠品</div>
<div class="opt to-gift">
<a href="javascript:;">领赠品</a><i class="iconfont to-arrow"></i>
<div class="info">赠品</div>
<div class="opt to-gift {{#ifnot giftHasStorage}}no-storage{{/ifnot}}">
<a href="javascript:;">{{#if giftHasStorage}}领赠品{{^}}已抢光{{/if}}</a><i class="iconfont to-arrow"></i>
</div>
</div>
</div>
... ...
... ... @@ -218,7 +218,11 @@
.to-gift {
text-align: right;
width: 139px;
&.no-storage {
a {
color: #c6c6c6;
}
}
a {
color: #ff575c;
font-size: 23px;
... ...
... ... @@ -67,8 +67,8 @@ const formatAdvanceGoods = (advanceGood, isGift) => {
id: good.product_skn,
name: good.product_name,
thumb: good.goods_images ? helpers.image(good.goods_images, 120, 160) : '',
price: transPrice(advanceGood.last_price),
marketPrice: isGift ? '0.00' : transPrice(advanceGood.market_price),
price: transPrice(good.last_price),
marketPrice: isGift ? '0.00' : transPrice(good.market_price),
count: good.storage_number
};
})
... ... @@ -105,6 +105,7 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid, inValidLow) => {
count: goodData.buy_number,
promotion_id: _.toNumber(goodData.promotion_id) === 0 ? '' : goodData.promotion_id
};
goodData.storage_number = _.parseInt(goodData.storage_number);
goodData.min_buy_number = _.parseInt(goodData.min_buy_number);
goodData.buy_number = _.parseInt(goodData.buy_number);
... ... @@ -196,7 +197,8 @@ const formatPromotion = (promo) => {
promotionType: promo.promotion_type,
alreadyMatch: promo.alreadyMatch,
optTitle: formatPromotionOpt(promo),
promotionFlag: getPromotionFlag(promo)
promotionFlag: getPromotionFlag(promo),
noStorage: promo.status === 20
};
};
... ... @@ -251,7 +253,7 @@ const procCartData = (data, onlyGift, onlyAdvanceBuy, isAdvanceCart) => {
if (onlyAdvanceBuy) {
// 加价购
result.advanceBuy = data.price_gift.map(good => {
return formatAdvanceGoods(good, true);
return formatAdvanceGoods(good);
});
return result;
}
... ... @@ -312,12 +314,22 @@ const procCartData = (data, onlyGift, onlyAdvanceBuy, isAdvanceCart) => {
return formatAdvanceGoods(good);
});
result.giftCount = result.freebie.length;
result.giftHasStorage = _.some(result.freebie, freebie => {
return _.some(freebie.goods, good => {
return good.count > 0;
});
});
// 加价购
result.advanceBuy = data.price_gift.map(good => {
return formatAdvanceGoods(good);
});
result.advanceBuyCount = result.advanceBuy.length;
result.advanceHasStorage = _.some(result.advanceBuy, advanceBuy => {
return _.some(advanceBuy.goods, good => {
return good.count > 0;
});
});
}
// 已参加的活动
... ... @@ -405,7 +417,7 @@ const handleBundleInfo = (apiResult) => {
if (apiResult && apiResult.code === 200 && apiResult.data) {
if (_.has(apiResult.data, 'bundleInfo')) {
result.mnum = apiResult.data.bundleInfo.bundleCount;
result.num = apiResult.data.bundleInfo.bundleCount;
result.discount = _.has(apiResult.data.bundleInfo, 'discount') ? apiResult.data.bundleInfo.discount : false;
result.promotionPhrase = apiResult.data.bundleInfo.promotionPhrase;
}
... ...