Merge branch 'feature/cart' into 'release/5.4.1'
Feature/cart See merge request !225
Showing
5 changed files
with
34 additions
and
16 deletions
@@ -88,7 +88,9 @@ exports.orderEnsure = (req, res, next) => { | @@ -88,7 +88,9 @@ exports.orderEnsure = (req, res, next) => { | ||
88 | let viewData = { | 88 | let viewData = { |
89 | orderEnsurePage: true, | 89 | orderEnsurePage: true, |
90 | isOrdinaryCart: cartType !== 'advance', | 90 | isOrdinaryCart: cartType !== 'advance', |
91 | - orderEnsure: order, | 91 | + orderEnsure: _.assign(order, { |
92 | + isOrdinaryCart: cartType !== 'advance' | ||
93 | + }), | ||
92 | userMobile: mobile, | 94 | userMobile: mobile, |
93 | pageHeader: headerData, | 95 | pageHeader: headerData, |
94 | pageFooter: false, | 96 | pageFooter: false, |
@@ -72,7 +72,7 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo | @@ -72,7 +72,7 @@ exports.orderComputeAPI = (uid, cartType, deliveWay, paymentType, couponCode, yo | ||
72 | let param = { | 72 | let param = { |
73 | method: activityInfo ? 'app.Shopping.easyCompute' : 'app.Shopping.compute', | 73 | method: activityInfo ? 'app.Shopping.easyCompute' : 'app.Shopping.compute', |
74 | cart_type: cartType, | 74 | cart_type: cartType, |
75 | - delive_way: deliveWay, | 75 | + delivery_way: deliveWay, |
76 | payment_type: paymentType, | 76 | payment_type: paymentType, |
77 | uid: uid | 77 | uid: uid |
78 | }; | 78 | }; |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | {{#promotions}} | 6 | {{#promotions}} |
7 | <div class="promo-item" data-id="{{promotionId}}" data-title="{{promotionOriginTitle}}" data-type="{{promotionType}}" data-status="{{status}}"> | 7 | <div class="promo-item" data-id="{{promotionId}}" data-title="{{promotionOriginTitle}}" data-type="{{promotionType}}" data-status="{{status}}"> |
8 | <div class="info"><i class="iconfont cuxiao"></i>{{promotionTitle}}</div> | 8 | <div class="info"><i class="iconfont cuxiao"></i>{{promotionTitle}}</div> |
9 | - <div class="opt to-gift"> | 9 | + <div class="opt to-gift {{#if noStorage}}no-storage{{/if}}"> |
10 | <a href="javascript:;">{{optTitle}}</a><i class="iconfont to-arrow"></i> | 10 | <a href="javascript:;">{{optTitle}}</a><i class="iconfont to-arrow"></i> |
11 | </div> | 11 | </div> |
12 | </div> | 12 | </div> |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | <div class="info"> | 23 | <div class="info"> |
24 | <span class="flag">{{promotionFlag}}</span>{{promotionTitle}} | 24 | <span class="flag">{{promotionFlag}}</span>{{promotionTitle}} |
25 | </div> | 25 | </div> |
26 | - <div class="opt to-gift"> | 26 | + <div class="opt to-gift {{#if noStorage}}no-storage{{/if}}"> |
27 | <a href="javascript:;">{{optTitle}}</a><i class="iconfont to-arrow"></i> | 27 | <a href="javascript:;">{{optTitle}}</a><i class="iconfont to-arrow"></i> |
28 | </div> | 28 | </div> |
29 | </div> | 29 | </div> |
@@ -63,9 +63,9 @@ | @@ -63,9 +63,9 @@ | ||
63 | <i class="iconfont price-gift"></i> | 63 | <i class="iconfont price-gift"></i> |
64 | </div> | 64 | </div> |
65 | <div class="content"> | 65 | <div class="content"> |
66 | - <div class="info">已满足全场加价购</div> | ||
67 | - <div class="opt to-gift"> | ||
68 | - <a href="javascript:;">去换购</a><i class="iconfont to-arrow"></i> | 66 | + <div class="info">加价购</div> |
67 | + <div class="opt to-gift {{#ifnot advanceHasStorage}}no-storage{{/ifnot}}"> | ||
68 | + <a href="javascript:;">{{#if advanceHasStorage}}去换购{{^}}已抢光{{/if}}</a><i class="iconfont to-arrow"></i> | ||
69 | </div> | 69 | </div> |
70 | </div> | 70 | </div> |
71 | </div> | 71 | </div> |
@@ -76,9 +76,9 @@ | @@ -76,9 +76,9 @@ | ||
76 | <i class="iconfont gift"></i> | 76 | <i class="iconfont gift"></i> |
77 | </div> | 77 | </div> |
78 | <div class="content"> | 78 | <div class="content"> |
79 | - <div class="info">已满足全场赠品</div> | ||
80 | - <div class="opt to-gift"> | ||
81 | - <a href="javascript:;">领赠品</a><i class="iconfont to-arrow"></i> | 79 | + <div class="info">赠品</div> |
80 | + <div class="opt to-gift {{#ifnot giftHasStorage}}no-storage{{/ifnot}}"> | ||
81 | + <a href="javascript:;">{{#if giftHasStorage}}领赠品{{^}}已抢光{{/if}}</a><i class="iconfont to-arrow"></i> | ||
82 | </div> | 82 | </div> |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
@@ -218,7 +218,11 @@ | @@ -218,7 +218,11 @@ | ||
218 | .to-gift { | 218 | .to-gift { |
219 | text-align: right; | 219 | text-align: right; |
220 | width: 139px; | 220 | width: 139px; |
221 | - | 221 | + &.no-storage { |
222 | + a { | ||
223 | + color: #c6c6c6; | ||
224 | + } | ||
225 | + } | ||
222 | a { | 226 | a { |
223 | color: #ff575c; | 227 | color: #ff575c; |
224 | font-size: 23px; | 228 | font-size: 23px; |
@@ -67,8 +67,8 @@ const formatAdvanceGoods = (advanceGood, isGift) => { | @@ -67,8 +67,8 @@ const formatAdvanceGoods = (advanceGood, isGift) => { | ||
67 | id: good.product_skn, | 67 | id: good.product_skn, |
68 | name: good.product_name, | 68 | name: good.product_name, |
69 | thumb: good.goods_images ? helpers.image(good.goods_images, 120, 160) : '', | 69 | thumb: good.goods_images ? helpers.image(good.goods_images, 120, 160) : '', |
70 | - price: transPrice(advanceGood.last_price), | ||
71 | - marketPrice: isGift ? '0.00' : transPrice(advanceGood.market_price), | 70 | + price: transPrice(good.last_price), |
71 | + marketPrice: isGift ? '0.00' : transPrice(good.market_price), | ||
72 | count: good.storage_number | 72 | count: good.storage_number |
73 | }; | 73 | }; |
74 | }) | 74 | }) |
@@ -105,6 +105,7 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid, inValidLow) => { | @@ -105,6 +105,7 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid, inValidLow) => { | ||
105 | count: goodData.buy_number, | 105 | count: goodData.buy_number, |
106 | promotion_id: _.toNumber(goodData.promotion_id) === 0 ? '' : goodData.promotion_id | 106 | promotion_id: _.toNumber(goodData.promotion_id) === 0 ? '' : goodData.promotion_id |
107 | }; | 107 | }; |
108 | + | ||
108 | goodData.storage_number = _.parseInt(goodData.storage_number); | 109 | goodData.storage_number = _.parseInt(goodData.storage_number); |
109 | goodData.min_buy_number = _.parseInt(goodData.min_buy_number); | 110 | goodData.min_buy_number = _.parseInt(goodData.min_buy_number); |
110 | goodData.buy_number = _.parseInt(goodData.buy_number); | 111 | goodData.buy_number = _.parseInt(goodData.buy_number); |
@@ -196,7 +197,8 @@ const formatPromotion = (promo) => { | @@ -196,7 +197,8 @@ const formatPromotion = (promo) => { | ||
196 | promotionType: promo.promotion_type, | 197 | promotionType: promo.promotion_type, |
197 | alreadyMatch: promo.alreadyMatch, | 198 | alreadyMatch: promo.alreadyMatch, |
198 | optTitle: formatPromotionOpt(promo), | 199 | optTitle: formatPromotionOpt(promo), |
199 | - promotionFlag: getPromotionFlag(promo) | 200 | + promotionFlag: getPromotionFlag(promo), |
201 | + noStorage: promo.status === 20 | ||
200 | }; | 202 | }; |
201 | }; | 203 | }; |
202 | 204 | ||
@@ -251,7 +253,7 @@ const procCartData = (data, onlyGift, onlyAdvanceBuy, isAdvanceCart) => { | @@ -251,7 +253,7 @@ const procCartData = (data, onlyGift, onlyAdvanceBuy, isAdvanceCart) => { | ||
251 | if (onlyAdvanceBuy) { | 253 | if (onlyAdvanceBuy) { |
252 | // 加价购 | 254 | // 加价购 |
253 | result.advanceBuy = data.price_gift.map(good => { | 255 | result.advanceBuy = data.price_gift.map(good => { |
254 | - return formatAdvanceGoods(good, true); | 256 | + return formatAdvanceGoods(good); |
255 | }); | 257 | }); |
256 | return result; | 258 | return result; |
257 | } | 259 | } |
@@ -312,12 +314,22 @@ const procCartData = (data, onlyGift, onlyAdvanceBuy, isAdvanceCart) => { | @@ -312,12 +314,22 @@ const procCartData = (data, onlyGift, onlyAdvanceBuy, isAdvanceCart) => { | ||
312 | return formatAdvanceGoods(good); | 314 | return formatAdvanceGoods(good); |
313 | }); | 315 | }); |
314 | result.giftCount = result.freebie.length; | 316 | result.giftCount = result.freebie.length; |
317 | + result.giftHasStorage = _.some(result.freebie, freebie => { | ||
318 | + return _.some(freebie.goods, good => { | ||
319 | + return good.count > 0; | ||
320 | + }); | ||
321 | + }); | ||
315 | 322 | ||
316 | // 加价购 | 323 | // 加价购 |
317 | result.advanceBuy = data.price_gift.map(good => { | 324 | result.advanceBuy = data.price_gift.map(good => { |
318 | return formatAdvanceGoods(good); | 325 | return formatAdvanceGoods(good); |
319 | }); | 326 | }); |
320 | result.advanceBuyCount = result.advanceBuy.length; | 327 | result.advanceBuyCount = result.advanceBuy.length; |
328 | + result.advanceHasStorage = _.some(result.advanceBuy, advanceBuy => { | ||
329 | + return _.some(advanceBuy.goods, good => { | ||
330 | + return good.count > 0; | ||
331 | + }); | ||
332 | + }); | ||
321 | } | 333 | } |
322 | 334 | ||
323 | // 已参加的活动 | 335 | // 已参加的活动 |
@@ -405,7 +417,7 @@ const handleBundleInfo = (apiResult) => { | @@ -405,7 +417,7 @@ const handleBundleInfo = (apiResult) => { | ||
405 | 417 | ||
406 | if (apiResult && apiResult.code === 200 && apiResult.data) { | 418 | if (apiResult && apiResult.code === 200 && apiResult.data) { |
407 | if (_.has(apiResult.data, 'bundleInfo')) { | 419 | if (_.has(apiResult.data, 'bundleInfo')) { |
408 | - result.mnum = apiResult.data.bundleInfo.bundleCount; | 420 | + result.num = apiResult.data.bundleInfo.bundleCount; |
409 | result.discount = _.has(apiResult.data.bundleInfo, 'discount') ? apiResult.data.bundleInfo.discount : false; | 421 | result.discount = _.has(apiResult.data.bundleInfo, 'discount') ? apiResult.data.bundleInfo.discount : false; |
410 | result.promotionPhrase = apiResult.data.bundleInfo.promotionPhrase; | 422 | result.promotionPhrase = apiResult.data.bundleInfo.promotionPhrase; |
411 | } | 423 | } |
-
Please register or login to post a comment