bundle-to-cart
Showing
20 changed files
with
655 additions
and
26 deletions
@@ -306,6 +306,7 @@ const modify = (req, res, next) => { | @@ -306,6 +306,7 @@ const modify = (req, res, next) => { | ||
306 | let oldProductSku = req.body.old_product_sku || 0, | 306 | let oldProductSku = req.body.old_product_sku || 0, |
307 | newProductSku = req.body.new_product_sku || 0, | 307 | newProductSku = req.body.new_product_sku || 0, |
308 | buyNumber = req.body.buy_number || 0, | 308 | buyNumber = req.body.buy_number || 0, |
309 | + activity_id = req.body.activity_id, | ||
309 | selected = req.body.selected; | 310 | selected = req.body.selected; |
310 | 311 | ||
311 | if (!oldProductSku || !newProductSku) { | 312 | if (!oldProductSku || !newProductSku) { |
@@ -321,7 +322,8 @@ const modify = (req, res, next) => { | @@ -321,7 +322,8 @@ const modify = (req, res, next) => { | ||
321 | old_product_sku: oldProductSku, | 322 | old_product_sku: oldProductSku, |
322 | new_product_sku: newProductSku, | 323 | new_product_sku: newProductSku, |
323 | buy_number: buyNumber, | 324 | buy_number: buyNumber, |
324 | - selected: selected | 325 | + selected: selected, |
326 | + activity_id: activity_id | ||
325 | }], shoppingKey).then(data => { | 327 | }], shoppingKey).then(data => { |
326 | data ? res.json(data) : res.status(400).json({ | 328 | data ? res.json(data) : res.status(400).json({ |
327 | message: '操作失败' | 329 | message: '操作失败' |
@@ -449,6 +451,49 @@ const giftinfo = (req, res, next) => { | @@ -449,6 +451,49 @@ const giftinfo = (req, res, next) => { | ||
449 | }).catch(next); | 451 | }).catch(next); |
450 | }; | 452 | }; |
451 | 453 | ||
454 | + | ||
455 | +/** | ||
456 | + * 增加套餐的数量 | ||
457 | + * @param {*} req | ||
458 | + * @param {*} res | ||
459 | + * @param {*} next | ||
460 | + */ | ||
461 | +const incrBundle = (req, res, next) => { | ||
462 | + let uid = req.user.uid; | ||
463 | + let shoppingKey = req.cookies._SPK || ''; | ||
464 | + | ||
465 | + return indexModel.incrBundle({ | ||
466 | + uid: uid, | ||
467 | + shopping_key: shoppingKey, | ||
468 | + activity_id: req.body.activity_id, | ||
469 | + sku_ids: req.body.sku_ids, | ||
470 | + batch_no: req.body.batch_no, | ||
471 | + }).then(result => { | ||
472 | + res.json(result); | ||
473 | + }).catch(next); | ||
474 | +}; | ||
475 | + | ||
476 | +/** | ||
477 | + * 增加套餐的数量 | ||
478 | + * @param {*} req | ||
479 | + * @param {*} res | ||
480 | + * @param {*} next | ||
481 | + */ | ||
482 | +const decrBundle = (req, res, next) => { | ||
483 | + let uid = req.user.uid; | ||
484 | + let shoppingKey = req.cookies._SPK || ''; | ||
485 | + | ||
486 | + return indexModel.decrBundle({ | ||
487 | + uid: uid, | ||
488 | + shopping_key: shoppingKey, | ||
489 | + activity_id: req.body.activity_id, | ||
490 | + sku_ids: req.body.sku_ids, | ||
491 | + batch_no: req.body.batch_no, | ||
492 | + }).then(result => { | ||
493 | + res.json(result); | ||
494 | + }).catch(next); | ||
495 | +}; | ||
496 | + | ||
452 | module.exports = { | 497 | module.exports = { |
453 | index, | 498 | index, |
454 | indexData, | 499 | indexData, |
@@ -462,5 +507,7 @@ module.exports = { | @@ -462,5 +507,7 @@ module.exports = { | ||
462 | gift, | 507 | gift, |
463 | giftinfo, | 508 | giftinfo, |
464 | advanceBuy, | 509 | advanceBuy, |
465 | - modifyPriceGift | 510 | + modifyPriceGift, |
511 | + incrBundle, | ||
512 | + decrBundle | ||
466 | }; | 513 | }; |
@@ -245,6 +245,38 @@ const getPriceGiftList = (promotionIds, promotionType) => { | @@ -245,6 +245,38 @@ const getPriceGiftList = (promotionIds, promotionType) => { | ||
245 | }); | 245 | }); |
246 | }; | 246 | }; |
247 | 247 | ||
248 | +/** | ||
249 | + * 增加套餐数量 | ||
250 | + * @param {*} params | ||
251 | + */ | ||
252 | +const incrBundle = (params) => { | ||
253 | + return api.post('', { | ||
254 | + method: 'app.Shopping.incrBundle', | ||
255 | + uid: params.uid, | ||
256 | + shopping_key: params.shopping_key, | ||
257 | + increase_number: params.increase_number || '1', | ||
258 | + activity_id: params.activity_id, | ||
259 | + sku_ids: params.sku_ids, | ||
260 | + batch_no: params.batch_no | ||
261 | + }); | ||
262 | +}; | ||
263 | + | ||
264 | +/** | ||
265 | + * 减少套餐数量 | ||
266 | + * @param {*} params | ||
267 | + */ | ||
268 | +const decrBundle = (params) => { | ||
269 | + return api.post('', { | ||
270 | + method: 'app.Shopping.decrBundle', | ||
271 | + uid: params.uid, | ||
272 | + shopping_key: params.shopping_key, | ||
273 | + decrease_number: params.decrease_number || '1', | ||
274 | + activity_id: params.activity_id, | ||
275 | + sku_ids: params.sku_ids, | ||
276 | + batch_no: params.batch_no | ||
277 | + }); | ||
278 | +}; | ||
279 | + | ||
248 | module.exports = { | 280 | module.exports = { |
249 | indexData, | 281 | indexData, |
250 | selectGood, | 282 | selectGood, |
@@ -258,5 +290,7 @@ module.exports = { | @@ -258,5 +290,7 @@ module.exports = { | ||
258 | modifyCartProduct, | 290 | modifyCartProduct, |
259 | giftProductData, | 291 | giftProductData, |
260 | getPriceGiftList, | 292 | getPriceGiftList, |
261 | - modifyCartPriceGiftProduct | 293 | + modifyCartPriceGiftProduct, |
294 | + incrBundle, | ||
295 | + decrBundle | ||
262 | }; | 296 | }; |
@@ -58,6 +58,8 @@ router.post('/index/new/modifyPriceGift', indexController.modifyPriceGift); // | @@ -58,6 +58,8 @@ router.post('/index/new/modifyPriceGift', indexController.modifyPriceGift); // | ||
58 | router.get('/index/new/gift', indexController.gift); // 获取购物车赠品 | 58 | router.get('/index/new/gift', indexController.gift); // 获取购物车赠品 |
59 | router.get('/index/new/advanceBuy', indexController.advanceBuy); // 获取购物车加价购 | 59 | router.get('/index/new/advanceBuy', indexController.advanceBuy); // 获取购物车加价购 |
60 | router.post('/index/new/giftinfo', indexController.giftinfo); // 获取购物车加价购商品数据,chosepanel | 60 | router.post('/index/new/giftinfo', indexController.giftinfo); // 获取购物车加价购商品数据,chosepanel |
61 | +router.post('/index/new/incrbundle', indexController.incrBundle); // 购物车增加套餐数量 | ||
62 | +router.post('/index/new/decrbundle', indexController.decrBundle); // 购物车减少加套餐数量 | ||
61 | 63 | ||
62 | 64 | ||
63 | // 支付中心 URL,由于微信安全限制,在现有 URL 后追加 new ,通过 subDomain 中间件转发到此 | 65 | // 支付中心 URL,由于微信安全限制,在现有 URL 后追加 new ,通过 subDomain 中间件转发到此 |
@@ -31,3 +31,18 @@ exports.detail = (req, res, next) => { | @@ -31,3 +31,18 @@ exports.detail = (req, res, next) => { | ||
31 | }, result)); | 31 | }, result)); |
32 | }).catch(next); | 32 | }).catch(next); |
33 | }; | 33 | }; |
34 | + | ||
35 | +/** | ||
36 | + * 套餐加入购物车 | ||
37 | + */ | ||
38 | +exports.addToCart = (req, res, next) => { | ||
39 | + bundleModel.addToCart({ | ||
40 | + uid: req.user.uid, | ||
41 | + activity_id: req.body.activity_id, | ||
42 | + product_sku_list: req.body.product_sku_list, | ||
43 | + shopping_key: req.cookies._SPK || '', | ||
44 | + userAgent: req.get('User-Agent') | ||
45 | + }).then(result => { | ||
46 | + return res.json(result); | ||
47 | + }).catch(next); | ||
48 | +}; |
@@ -65,7 +65,34 @@ const detail = (params, isApp) => { | @@ -65,7 +65,34 @@ const detail = (params, isApp) => { | ||
65 | }); | 65 | }); |
66 | }; | 66 | }; |
67 | 67 | ||
68 | +/** | ||
69 | + * 套餐加入购物车 | ||
70 | + * @param {*} params | ||
71 | + */ | ||
72 | +const addToCart = (params) => { | ||
73 | + let skuList = params.product_sku_list; | ||
74 | + let finalParams = { | ||
75 | + method: 'app.Shopping.addBundle', | ||
76 | + shopping_key: params.shopping_key, | ||
77 | + activity_id: params.activity_id, | ||
78 | + product_sku_list: skuList | ||
79 | + }; | ||
80 | + | ||
81 | + if (params.uid) { | ||
82 | + Object.assign(finalParams, { | ||
83 | + uid: params.uid | ||
84 | + }); | ||
85 | + } | ||
86 | + | ||
87 | + return api.post('', finalParams, { | ||
88 | + headers: { | ||
89 | + 'User-Agent': params.userAgent | ||
90 | + } | ||
91 | + }); | ||
92 | +}; | ||
93 | + | ||
68 | module.exports = { | 94 | module.exports = { |
69 | getBundleBySkn, | 95 | getBundleBySkn, |
70 | - detail | 96 | + detail, |
97 | + addToCart | ||
71 | }; | 98 | }; |
@@ -194,6 +194,7 @@ router.get('/newsale/hotrank', newsale.index); // 热销排行榜 | @@ -194,6 +194,7 @@ router.get('/newsale/hotrank', newsale.index); // 热销排行榜 | ||
194 | router.get('/newsale/selectHotrank', newsale.selectHotrank); // 热销排行榜 | 194 | router.get('/newsale/selectHotrank', newsale.selectHotrank); // 热销排行榜 |
195 | 195 | ||
196 | router.get('/bundle/detail', bundle.detail); // 套装详情页 | 196 | router.get('/bundle/detail', bundle.detail); // 套装详情页 |
197 | +router.post('/bundle/cart/add', bundle.addToCart); // 套装加入购物车 | ||
197 | 198 | ||
198 | router.post('/opt/favoriteProduct', newDetail.favoriteProduct); // 商品收藏、取消收藏 | 199 | router.post('/opt/favoriteProduct', newDetail.favoriteProduct); // 商品收藏、取消收藏 |
199 | router.get('/detail/limitHelp', newDetail.limitHelp); | 200 | router.get('/detail/limitHelp', newDetail.limitHelp); |
@@ -39,10 +39,8 @@ | @@ -39,10 +39,8 @@ | ||
39 | </div> | 39 | </div> |
40 | <div class="sale-price">销售价: {{salesPriceStr}}</div> | 40 | <div class="sale-price">销售价: {{salesPriceStr}}</div> |
41 | </div> | 41 | </div> |
42 | - <button id="bundle-buy-now" class="bundle-buy-btn">立即购买</button> | 42 | + <button id="bundle-buy-now" class="bundle-buy-btn">加入购物车</button> |
43 | {{/if}} | 43 | {{/if}} |
44 | - | ||
45 | - | ||
46 | </div> | 44 | </div> |
47 | <input type="hidden" id="activityId" value="{{bundleId}}"> | 45 | <input type="hidden" id="activityId" value="{{bundleId}}"> |
48 | {{/ bundleInfo}} | 46 | {{/ bundleInfo}} |
public/hbs/cart/index/cart-bundle.hbs
0 → 100644
1 | + <div class="bundle" data-activityid="{{poolId}}" data-poolbatchno="{{poolBatchNo}}" data-maxnum="{{poolStorageNumber}}" data-buynum="{{poolBuyNumber}}"> | ||
2 | + <div class="bundle-title"> | ||
3 | + <div class="opt"> | ||
4 | + {{#unless goods.0.inValid}} | ||
5 | + <i class="iconfont chk select{{#if selected}} checked{{/if}}"></i> | ||
6 | + {{/unless}} | ||
7 | + <i class="iconfont chk edit"></i> | ||
8 | + {{#if goods.0.inValid}} | ||
9 | + <span class="disable fill-text">失效</span> | ||
10 | + {{/if}} | ||
11 | + </div> | ||
12 | + <div class="title"> | ||
13 | + <span>优惠套装</span>{{poolTitle}} | ||
14 | + </div> | ||
15 | + </div> | ||
16 | + <div class="bundle-nums clearfix"> | ||
17 | + <div class="label"> | ||
18 | + <span>套餐数量</span> | ||
19 | + </div> | ||
20 | + <div class="num-opt"> | ||
21 | + <a href="javascript:;" class="btn btn-opt-minus{{#ifor minSelectNum isGift isAdvanceBuy}} disabled{{/ifor}}"><span class="iconfont"></span></a> | ||
22 | + <input type="text" class="good-num" disabled="true" value="{{poolBuyNumber}}" > | ||
23 | + <a href="javascript:;" class="btn btn-opt-plus{{#ifor maxSelectNum isGift isAdvanceBuy}} disabled{{/ifor}}"><span class="iconfont"></span></a> | ||
24 | + </div> | ||
25 | + <div class="count pull-right">x{{poolBuyNumber}}</div> | ||
26 | + </div> | ||
27 | + <div class="good-list"> | ||
28 | + {{#goods}} | ||
29 | + {{> cart-good parent=..}} | ||
30 | + {{/goods}} | ||
31 | + </div> | ||
32 | +</div> |
@@ -45,6 +45,9 @@ | @@ -45,6 +45,9 @@ | ||
45 | {{/goods}} | 45 | {{/goods}} |
46 | </div> | 46 | </div> |
47 | {{/if}} | 47 | {{/if}} |
48 | + {{#if isBundle}} | ||
49 | + {{> cart-bundle}} | ||
50 | + {{/if}} | ||
48 | </div> | 51 | </div> |
49 | {{/goodPools}} | 52 | {{/goodPools}} |
50 | {{#goods}} | 53 | {{#goods}} |
@@ -90,6 +93,9 @@ | @@ -90,6 +93,9 @@ | ||
90 | {{#notValidGoods}} | 93 | {{#notValidGoods}} |
91 | {{> cart-good}} | 94 | {{> cart-good}} |
92 | {{/notValidGoods}} | 95 | {{/notValidGoods}} |
96 | + {{#notValidPool}} | ||
97 | + {{> cart-bundle}} | ||
98 | + {{/notValidPool}} | ||
93 | {{#offShelveGoods}} | 99 | {{#offShelveGoods}} |
94 | {{> cart-good}} | 100 | {{> cart-good}} |
95 | {{/offShelveGoods}} | 101 | {{/offShelveGoods}} |
1 | -<div class="good-item{{#if lowStocks}} low-stocks{{/if}}{{#if isStudents}} is-students{{/if}}{{#if isVipPrice}} is-vip-price{{/if}}{{#ifand checked showCheckbox}} is-checked{{/ifand}}{{#if noEdit}} no-edit{{/if}}{{#if inValid}} in-valid{{/if}}{{#if inValidLow}} in-valid-low{{/if}}{{#ifor isGift isAdvanceBuy}} is-gift{{/ifor}}" data-promotion="{{promotion_id}}" data-id="{{id}}" data-skn="{{skn}}" data-mnum="{{minNumber}}" data-link="{{link}}"> | 1 | +<div class="good-item{{#if lowStocks}} low-stocks{{/if}}{{#if isStudents}} is-students{{/if}}{{#if isVipPrice}} is-vip-price{{/if}}{{#ifand checked showCheckbox}} is-checked{{/ifand}}{{#if noEdit}} no-edit{{/if}}{{#if inValid}} in-valid{{/if}}{{#if inValidLow}} in-valid-low{{/if}}{{#ifor isGift isAdvanceBuy}} is-gift{{/ifor}}" data-promotion="{{promotion_id}}" data-id="{{id}}" data-skn="{{skn}}" data-mnum="{{minNumber}}" data-link="{{link}}" data-activityid="{{parent.poolId}}" data-poolbatchno="{{parent.poolBatchNo}}"> |
2 | <div class="opt"> | 2 | <div class="opt"> |
3 | {{#if showCheckbox}} | 3 | {{#if showCheckbox}} |
4 | <i class="iconfont chk select{{#if checked}} checked{{/if}}"></i> | 4 | <i class="iconfont chk select{{#if checked}} checked{{/if}}"></i> |
@@ -18,6 +18,9 @@ | @@ -18,6 +18,9 @@ | ||
18 | {{#isAdvanceBuy}} | 18 | {{#isAdvanceBuy}} |
19 | <div class="flag price-gift"><div class="text">加价购</div></div> | 19 | <div class="flag price-gift"><div class="text">加价购</div></div> |
20 | {{/isAdvanceBuy}} | 20 | {{/isAdvanceBuy}} |
21 | + {{#if parent.isBundle}} | ||
22 | + <div class="flag bundle"></div> | ||
23 | + {{/if}} | ||
21 | </div> | 24 | </div> |
22 | </a> | 25 | </a> |
23 | <div class="info"> | 26 | <div class="info"> |
@@ -33,12 +36,16 @@ | @@ -33,12 +36,16 @@ | ||
33 | {{#ifnot noEdit}} | 36 | {{#ifnot noEdit}} |
34 | <div class="intro intro-edit"> | 37 | <div class="intro intro-edit"> |
35 | <div class="edit-box"> | 38 | <div class="edit-box"> |
39 | + {{#unless parent.isBundle}} | ||
36 | <div class="num-opt"> | 40 | <div class="num-opt"> |
37 | <a href="javascript:;" class="btn btn-opt-minus{{#ifor minSelectNum isGift isAdvanceBuy}} disabled{{/ifor}}"><span class="iconfont"></span></a> | 41 | <a href="javascript:;" class="btn btn-opt-minus{{#ifor minSelectNum isGift isAdvanceBuy}} disabled{{/ifor}}"><span class="iconfont"></span></a> |
38 | <input type="text" class="good-num" disabled="true" value="{{count}}" data-min="{{minNumber}}" data-max="{{maxNumber}}"> | 42 | <input type="text" class="good-num" disabled="true" value="{{count}}" data-min="{{minNumber}}" data-max="{{maxNumber}}"> |
39 | <a href="javascript:;" class="btn btn-opt-plus{{#ifor maxSelectNum isGift isAdvanceBuy}} disabled{{/ifor}}"><span class="iconfont"></span></a> | 43 | <a href="javascript:;" class="btn btn-opt-plus{{#ifor maxSelectNum isGift isAdvanceBuy}} disabled{{/ifor}}"><span class="iconfont"></span></a> |
40 | </div> | 44 | </div> |
41 | - <div class="edit-size-info"> | 45 | + {{^}} |
46 | + <input type="hidden" class="good-num" value="{{count}}" data-min="{{minNumber}}" data-max="{{maxNumber}}"> | ||
47 | + {{/unless}} | ||
48 | + <div class="edit-size-info {{#ifnot parent.isBundle}} edit-size-info-notop {{/ifnot}}"> | ||
42 | <div class="txt">颜色:{{color}} 尺码:{{size}}</div> | 49 | <div class="txt">颜色:{{color}} 尺码:{{size}}</div> |
43 | <div class="down"> | 50 | <div class="down"> |
44 | <i class="iconfont"></i> | 51 | <i class="iconfont"></i> |
@@ -51,15 +58,23 @@ | @@ -51,15 +58,23 @@ | ||
51 | {{/ifnot}} | 58 | {{/ifnot}} |
52 | <div class="count">x{{count}}</div> | 59 | <div class="count">x{{count}}</div> |
53 | </div> | 60 | </div> |
54 | - <p class="price"> | 61 | + <div class="bottom"> |
62 | + <div class="price{{#if reAddToCart}} pull-left{{/if}}"> | ||
55 | <span class="market-price">¥{{price}}</span> | 63 | <span class="market-price">¥{{price}}</span> |
56 | {{#if isStudents}}<span class="vip fill-text">学</span>{{/if}} | 64 | {{#if isStudents}}<span class="vip fill-text">学</span>{{/if}} |
57 | {{#if isVipPrice}}<span class="vip fill-text">VIP</span>{{/if}} | 65 | {{#if isVipPrice}}<span class="vip fill-text">VIP</span>{{/if}} |
58 | - </p> | 66 | + </div> |
67 | + {{#if reAddToCart}} | ||
68 | + <div class="re-add pull-right"> | ||
69 | + <span>重新加入购物车</span> | ||
70 | + </div> | ||
71 | + {{^}} | ||
59 | <div class="tags"> | 72 | <div class="tags"> |
60 | {{#if lowStocks}}<span class="low-stocks fill-text">库存不足</span>{{/if}} | 73 | {{#if lowStocks}}<span class="low-stocks fill-text">库存不足</span>{{/if}} |
61 | {{#appearDate}}<span class="appear-date">上市期:{{.}}</span>{{/appearDate}} | 74 | {{#appearDate}}<span class="appear-date">上市期:{{.}}</span>{{/appearDate}} |
62 | </div> | 75 | </div> |
76 | + {{/if}} | ||
77 | + </div> | ||
63 | </div> | 78 | </div> |
64 | </div> | 79 | </div> |
65 | </div> | 80 | </div> |
@@ -126,6 +126,7 @@ let indexObj = { | @@ -126,6 +126,7 @@ let indexObj = { | ||
126 | $('.cart-box').html(hbsTemplate(data)); | 126 | $('.cart-box').html(hbsTemplate(data)); |
127 | require('./index/cart').init(self); | 127 | require('./index/cart').init(self); |
128 | require('./index/good').init(self); | 128 | require('./index/good').init(self); |
129 | + require('./index/bundle').init(self); | ||
129 | $('.btn-edit').on('click', () => { | 130 | $('.btn-edit').on('click', () => { |
130 | self.navBtnClick(); | 131 | self.navBtnClick(); |
131 | }); | 132 | }); |
public/js/cart/index/bundle.js
0 → 100644
1 | +/* | ||
2 | + * @Author: Targaryen | ||
3 | + * @Date: 2017-04-06 16:51:52 | ||
4 | + * @Last Modified by: Targaryen | ||
5 | + * @Last Modified time: 2017-04-12 14:01:07 | ||
6 | + */ | ||
7 | + | ||
8 | +const $ = require('yoho-jquery'); | ||
9 | + | ||
10 | +let tip = require('plugin/tip'); | ||
11 | +let loading = require('plugin/loading'); | ||
12 | + | ||
13 | +let bundle = { | ||
14 | + init(handle) { | ||
15 | + let self = this; | ||
16 | + | ||
17 | + let $bundle = $('.bundle'); // 限定作用域 | ||
18 | + let activityId = $bundle.data('activityid'); | ||
19 | + let batchNo = $bundle.data('poolbatchno'); | ||
20 | + | ||
21 | + self.handle = handle; | ||
22 | + | ||
23 | + /** | ||
24 | + * 减少套餐数量 | ||
25 | + */ | ||
26 | + $bundle.on('click', '.bundle-nums .num-opt .btn-opt-minus', function(e) { | ||
27 | + let skuIdsArray = []; | ||
28 | + | ||
29 | + $(e.delegateTarget).find('.good-item').each(function() { | ||
30 | + skuIdsArray.push($(this).data('id')); | ||
31 | + }); | ||
32 | + | ||
33 | + self.decrBundle({ | ||
34 | + activity_id: activityId, | ||
35 | + batch_no: batchNo, | ||
36 | + sku_ids: skuIdsArray.join(',') | ||
37 | + }, e); | ||
38 | + }); | ||
39 | + | ||
40 | + /** | ||
41 | + * 增加套餐数量 | ||
42 | + */ | ||
43 | + $bundle.on('click', '.bundle-nums .num-opt .btn-opt-plus', function(e) { | ||
44 | + let skuIdsArray = []; | ||
45 | + | ||
46 | + $(e.delegateTarget).find('.good-item').each(function() { | ||
47 | + skuIdsArray.push($(this).data('id')); | ||
48 | + }); | ||
49 | + | ||
50 | + self.incrBundle({ | ||
51 | + activity_id: activityId, | ||
52 | + batch_no: batchNo, | ||
53 | + sku_ids: skuIdsArray.join(',') | ||
54 | + }, e); | ||
55 | + }); | ||
56 | + | ||
57 | + /** | ||
58 | + * 套餐选中/取消 | ||
59 | + */ | ||
60 | + $bundle.on('click', '.bundle-title .opt .select', function(e) { | ||
61 | + self.bundleCheckHandle(e); | ||
62 | + }); | ||
63 | + | ||
64 | + /** | ||
65 | + * 编辑状态下套餐选中/取消 | ||
66 | + */ | ||
67 | + $bundle.on('click', '.bundle-title .opt .edit', function(e) { | ||
68 | + self.bundleEditCheckHandle(e); | ||
69 | + }); | ||
70 | + }, | ||
71 | + | ||
72 | + /** | ||
73 | + * 增加套餐数量 | ||
74 | + * @param {*} params | ||
75 | + */ | ||
76 | + incrBundle(params, e) { | ||
77 | + let self = this; | ||
78 | + | ||
79 | + $.post('/cart/index/new/incrbundle', params, function(result) { | ||
80 | + let bundleNum = $(e.delegateTarget).find('.good-num'); | ||
81 | + let defaultValue = parseInt(bundleNum.val(), 10); | ||
82 | + | ||
83 | + if (result.code === 200) { | ||
84 | + bundleNum.val(defaultValue + 1); | ||
85 | + self.handle.refreshPage(); | ||
86 | + } else { | ||
87 | + tip.show(result.message); | ||
88 | + } | ||
89 | + }); | ||
90 | + }, | ||
91 | + | ||
92 | + /** | ||
93 | + * 减少套餐数量 | ||
94 | + * @param {*} params | ||
95 | + */ | ||
96 | + decrBundle(params, e) { | ||
97 | + let self = this; | ||
98 | + | ||
99 | + $.post('/cart/index/new/decrbundle', params, function(result) { | ||
100 | + let bundleNum = $(e.delegateTarget).find('.good-num'); | ||
101 | + let defaultValue = parseInt(bundleNum.val(), 10); | ||
102 | + | ||
103 | + if (result.code === 200) { | ||
104 | + bundleNum.val(defaultValue - 1); | ||
105 | + self.handle.refreshPage(); | ||
106 | + } else { | ||
107 | + tip.show(result.message); | ||
108 | + } | ||
109 | + }); | ||
110 | + }, | ||
111 | + | ||
112 | + /** | ||
113 | + * 套餐选中 | ||
114 | + * @param {*} e | ||
115 | + */ | ||
116 | + bundleCheckHandle(e) { | ||
117 | + let selectCheck = $(e.delegateTarget).find('.select'); | ||
118 | + let goodItem = $(e.delegateTarget).find('.good-item'); | ||
119 | + let skuData = []; | ||
120 | + let selected = 'Y'; | ||
121 | + | ||
122 | + if (selectCheck.hasClass('checked')) { | ||
123 | + selected = 'N'; | ||
124 | + } | ||
125 | + | ||
126 | + goodItem.each(function(index, element) { | ||
127 | + skuData.push({ | ||
128 | + product_sku: $(element).data('id'), | ||
129 | + buy_number: $(e.delegateTarget).data('buynum'), | ||
130 | + activity_id: $(e.delegateTarget).data('activityid'), | ||
131 | + batch_no: $(e.delegateTarget).data('poolbatchno'), | ||
132 | + selected: selected | ||
133 | + }); | ||
134 | + }); | ||
135 | + loading.showLoading(); | ||
136 | + $.ajax({ | ||
137 | + type: 'post', | ||
138 | + url: '/cart/index/new/select', | ||
139 | + data: { | ||
140 | + skuList: JSON.stringify(skuData) | ||
141 | + }, | ||
142 | + success: function(result) { | ||
143 | + if (result.code === 200) { | ||
144 | + selectCheck.toggleClass('checked'); | ||
145 | + } | ||
146 | + loading.hideLoading(); | ||
147 | + } | ||
148 | + }); | ||
149 | + }, | ||
150 | + | ||
151 | + /** | ||
152 | + * 编辑状态下套餐选中/取消 | ||
153 | + * @param {*} e | ||
154 | + */ | ||
155 | + bundleEditCheckHandle(e) { | ||
156 | + let editCheck = $(e.delegateTarget).find('.edit'); | ||
157 | + let goodItem = $(e.delegateTarget).find('.good-item'); | ||
158 | + | ||
159 | + if (editCheck.hasClass('checked')) { | ||
160 | + editCheck.removeClass('checked'); | ||
161 | + goodItem.find('.opt .edit').removeClass('checked'); | ||
162 | + } else { | ||
163 | + editCheck.addClass('checked'); | ||
164 | + goodItem.find('.opt .edit').addClass('checked'); | ||
165 | + } | ||
166 | + }, | ||
167 | +}; | ||
168 | + | ||
169 | +module.exports = bundle; |
@@ -35,6 +35,9 @@ let goodObj = { | @@ -35,6 +35,9 @@ let goodObj = { | ||
35 | $('.good-item').on('click', '.name,.color-size-row,.img', function(e) { | 35 | $('.good-item').on('click', '.name,.color-size-row,.img', function(e) { |
36 | self.goodClick(e); | 36 | self.goodClick(e); |
37 | }); | 37 | }); |
38 | + $('.good-item').on('click', '.bottom .re-add', function(e) { | ||
39 | + self.reAddGood(e); | ||
40 | + }); | ||
38 | $('.check-all').on('click', function(e) { | 41 | $('.check-all').on('click', function(e) { |
39 | self.checkedAllClick(e); | 42 | self.checkedAllClick(e); |
40 | }); | 43 | }); |
@@ -151,8 +154,10 @@ let goodObj = { | @@ -151,8 +154,10 @@ let goodObj = { | ||
151 | if (self.handle.editMode) { | 154 | if (self.handle.editMode) { |
152 | $(e.currentTarget).find('.chk.edit').toggleClass('checked'); | 155 | $(e.currentTarget).find('.chk.edit').toggleClass('checked'); |
153 | if ($(e.currentTarget).find('.chk.edit').hasClass('checked')) { | 156 | if ($(e.currentTarget).find('.chk.edit').hasClass('checked')) { |
157 | + $('.bundle-title .chk.edit').addClass('checked'); | ||
154 | $('.good-item .chk.edit').addClass('checked'); | 158 | $('.good-item .chk.edit').addClass('checked'); |
155 | } else { | 159 | } else { |
160 | + $('.bundle-title .chk.edit').removeClass('checked'); | ||
156 | $('.good-item .chk.edit').removeClass('checked'); | 161 | $('.good-item .chk.edit').removeClass('checked'); |
157 | } | 162 | } |
158 | } else { | 163 | } else { |
@@ -213,6 +218,32 @@ let goodObj = { | @@ -213,6 +218,32 @@ let goodObj = { | ||
213 | }); | 218 | }); |
214 | 219 | ||
215 | }, | 220 | }, |
221 | + reAddGood(eles) { | ||
222 | + let self = this; | ||
223 | + | ||
224 | + loading.showLoading(); | ||
225 | + $.ajax({ | ||
226 | + type: 'post', | ||
227 | + url: '/cart/index/add', | ||
228 | + data: { | ||
229 | + productSku: $(eles.delegateTarget).data('id') | ||
230 | + }, | ||
231 | + dataType: 'json', | ||
232 | + complete: () => { | ||
233 | + loading.hideLoading(); | ||
234 | + }, | ||
235 | + success: function(result) { | ||
236 | + if (result.code === 200) { | ||
237 | + self.handle.refreshPage(); | ||
238 | + } else { | ||
239 | + tip.show(result.message); | ||
240 | + } | ||
241 | + }, | ||
242 | + error: function() { | ||
243 | + tip.show('网络异常'); | ||
244 | + } | ||
245 | + }); | ||
246 | + }, | ||
216 | delGood(eles) { | 247 | delGood(eles) { |
217 | let self = this; | 248 | let self = this; |
218 | let skuData = self.getSelectGoodData(eles).map(ele => { | 249 | let skuData = self.getSelectGoodData(eles).map(ele => { |
@@ -286,7 +317,9 @@ let goodObj = { | @@ -286,7 +317,9 @@ let goodObj = { | ||
286 | let $this = $(ele), | 317 | let $this = $(ele), |
287 | $good = $this.closest('.good-item'), | 318 | $good = $this.closest('.good-item'), |
288 | id = $good.data('id'), | 319 | id = $good.data('id'), |
289 | - promotion = $good.data('promotion'); | 320 | + promotion = $good.data('promotion'), |
321 | + batch_no = $good.data('poolbatchno'), | ||
322 | + activity_id = $good.data('activityid'); | ||
290 | 323 | ||
291 | let goodInfo = {}; | 324 | let goodInfo = {}; |
292 | 325 | ||
@@ -299,6 +332,16 @@ let goodObj = { | @@ -299,6 +332,16 @@ let goodObj = { | ||
299 | goodInfo.product_sku = id; | 332 | goodInfo.product_sku = id; |
300 | goodInfo.promotion_id = promotion; | 333 | goodInfo.promotion_id = promotion; |
301 | goodInfo.buy_number = $good.find('.good-num').val(); | 334 | goodInfo.buy_number = $good.find('.good-num').val(); |
335 | + | ||
336 | + // 套餐活动 ID | ||
337 | + if (activity_id) { | ||
338 | + goodInfo.activity_id = activity_id; | ||
339 | + } | ||
340 | + | ||
341 | + // 套餐活动批次 | ||
342 | + if (batch_no) { | ||
343 | + goodInfo.batch_no = batch_no; | ||
344 | + } | ||
302 | return goodInfo; | 345 | return goodInfo; |
303 | })); | 346 | })); |
304 | 347 | ||
@@ -323,6 +366,11 @@ let goodObj = { | @@ -323,6 +366,11 @@ let goodObj = { | ||
323 | }, | 366 | }, |
324 | url; | 367 | url; |
325 | 368 | ||
369 | + // 套餐需要 activity_id | ||
370 | + if (data.activity_id) { | ||
371 | + Object.assign(goodData, {activity_id: data.activity_id}); | ||
372 | + } | ||
373 | + | ||
326 | if (promotionId) { | 374 | if (promotionId) { |
327 | url = '/cart/index/new/modifyPriceGift'; | 375 | url = '/cart/index/new/modifyPriceGift'; |
328 | } else { | 376 | } else { |
@@ -443,15 +491,17 @@ let goodObj = { | @@ -443,15 +491,17 @@ let goodObj = { | ||
443 | minNum, | 491 | minNum, |
444 | promotionId; | 492 | promotionId; |
445 | let isSelected = $(e.delegateTarget).find('.chk.select').hasClass('checked'); | 493 | let isSelected = $(e.delegateTarget).find('.chk.select').hasClass('checked'); |
494 | + let activityId = $(e.delegateTarget).data('activityid'); | ||
446 | 495 | ||
447 | id = $(e.delegateTarget).data('id'); | 496 | id = $(e.delegateTarget).data('id'); |
448 | count = $(e.delegateTarget).find('.good-num').val(); | 497 | count = $(e.delegateTarget).find('.good-num').val(); |
449 | minNum = $(e.delegateTarget).data('mnum'); | 498 | minNum = $(e.delegateTarget).data('mnum'); |
450 | promotionId = $(e.delegateTarget).data('promotion'); | 499 | promotionId = $(e.delegateTarget).data('promotion'); |
451 | 500 | ||
452 | - // 加价购或者赠品不能编辑数量 | 501 | + // 加价购或者赠品不能编辑数量,套餐不能编辑数量 |
453 | canEditNum = $(e.delegateTarget).find('.flag.gift').length || | 502 | canEditNum = $(e.delegateTarget).find('.flag.gift').length || |
454 | - $(e.delegateTarget).find('.flag.price-gift').length ? false : true; | 503 | + $(e.delegateTarget).find('.flag.price-gift').length || |
504 | + $(e.delegateTarget).find('.flag.bundle').length ? false : true; | ||
455 | e.stopPropagation(); | 505 | e.stopPropagation(); |
456 | loading.showLoading(); | 506 | loading.showLoading(); |
457 | $.ajax({ | 507 | $.ajax({ |
@@ -464,6 +514,11 @@ let goodObj = { | @@ -464,6 +514,11 @@ let goodObj = { | ||
464 | }, | 514 | }, |
465 | type: 'POST', | 515 | type: 'POST', |
466 | success: function(data) { | 516 | success: function(data) { |
517 | + | ||
518 | + // 套餐需要传 activityId | ||
519 | + if (activityId) { | ||
520 | + Object.assign(data, {activity_id: activityId}); | ||
521 | + } | ||
467 | self.showEditPannelWithSku(data, id, isSelected, canEditNum, promotionId, e); | 522 | self.showEditPannelWithSku(data, id, isSelected, canEditNum, promotionId, e); |
468 | }, | 523 | }, |
469 | error: function(err) { | 524 | error: function(err) { |
@@ -112,7 +112,8 @@ class ChosePanel { | @@ -112,7 +112,8 @@ class ChosePanel { | ||
112 | return '加入购物车'; | 112 | return '加入购物车'; |
113 | } | 113 | } |
114 | _defaultBuyNum() { | 114 | _defaultBuyNum() { |
115 | - return this.modes.discount && this.data.discountBuy.num || 1; | 115 | + return (this.modes.discount && this.data.discountBuy.num) || |
116 | + (this.data.cartInfo && this.data.cartInfo.num) || 1; | ||
116 | } | 117 | } |
117 | 118 | ||
118 | /** | 119 | /** |
@@ -152,13 +152,31 @@ $buyNowBtn.on('touchstart', function() { | @@ -152,13 +152,31 @@ $buyNowBtn.on('touchstart', function() { | ||
152 | } | 152 | } |
153 | 153 | ||
154 | if (gsknSelected) { | 154 | if (gsknSelected) { |
155 | - window.setCookie('_cartType', 'bundle', actCkOpthn); | ||
156 | - window.setCookie('activity-info', JSON.stringify({ | ||
157 | - product_sku_list: bundleGoods, | 155 | + // window.setCookie('_cartType', 'bundle', actCkOpthn); |
156 | + // window.setCookie('activity-info', JSON.stringify({ | ||
157 | + // product_sku_list: bundleGoods, | ||
158 | + // activity_id: bundleId | ||
159 | + // }), actCkOpthn); | ||
160 | + | ||
161 | + $.ajax({ | ||
162 | + method: 'post', | ||
163 | + url: '/product/bundle/cart/add', | ||
164 | + data: { | ||
165 | + product_sku_list: JSON.stringify(bundleGoods), | ||
158 | activity_id: bundleId | 166 | activity_id: bundleId |
159 | - }), actCkOpthn); | ||
160 | - | ||
161 | - window.location.href = '/cart/index/new/orderEnsure?cartType=bundle&activityType=bundle&productId=' + | ||
162 | - window.queryString.productId; | 167 | + }, |
168 | + success: function(result) { | ||
169 | + tip.show(result.message); | ||
170 | + | ||
171 | + if (result.code === 200) { | ||
172 | + setTimeout(function() { | ||
173 | + window.location.href = '/cart/index/index?cartType=ordinary'; | ||
174 | + }, 500); | ||
175 | + } | ||
176 | + }, | ||
177 | + error: function() { | ||
178 | + tip.show('请求失败,请重试!'); | ||
179 | + } | ||
180 | + }); | ||
163 | } | 181 | } |
164 | }); | 182 | }); |
public/scss/cart/_bundle.css
0 → 100644
1 | +.bundle > .bundle-title { | ||
2 | + height: 80px; | ||
3 | + display: flex; | ||
4 | + overflow: hidden; | ||
5 | + | ||
6 | + .opt { | ||
7 | + width: 100px; | ||
8 | + display: flex; | ||
9 | + align-items: center; | ||
10 | + justify-content: center; | ||
11 | + | ||
12 | + .select { | ||
13 | + display: block; | ||
14 | + } | ||
15 | + | ||
16 | + .edit { | ||
17 | + display: none; | ||
18 | + } | ||
19 | + | ||
20 | + .disable { | ||
21 | + background-color: #7f7f7f; | ||
22 | + } | ||
23 | + } | ||
24 | + | ||
25 | + .title { | ||
26 | + display: flex; | ||
27 | + align-items: center; | ||
28 | + | ||
29 | + span { | ||
30 | + height: 40px; | ||
31 | + margin-right: 30px; | ||
32 | + padding: 4px; | ||
33 | + font-size: 16px; | ||
34 | + background-color: #d1021c; | ||
35 | + color: #fff; | ||
36 | + border-radius: 5px; | ||
37 | + } | ||
38 | + } | ||
39 | +} | ||
40 | + | ||
41 | +.bundle > .bundle-nums { | ||
42 | + height: 80px; | ||
43 | + display: none; | ||
44 | + overflow: hidden; | ||
45 | + | ||
46 | + .label { | ||
47 | + width: 284px; | ||
48 | + height: 80px; | ||
49 | + display: flex; | ||
50 | + align-items: center; | ||
51 | + | ||
52 | + span { | ||
53 | + padding-left: 100px; | ||
54 | + } | ||
55 | + } | ||
56 | + | ||
57 | + .num-opt { | ||
58 | + border: solid 1PX #dfdfdf; | ||
59 | + border-radius: 5px; | ||
60 | + display: flex; | ||
61 | + align-items: center; | ||
62 | + overflow: hidden; | ||
63 | + | ||
64 | + .btn { | ||
65 | + width: 78px; | ||
66 | + display: block; | ||
67 | + height: 100%; | ||
68 | + text-align: center; | ||
69 | + line-height: 74px; | ||
70 | + | ||
71 | + .iconfont { | ||
72 | + color: #444; | ||
73 | + } | ||
74 | + | ||
75 | + &.disabled { | ||
76 | + .iconfont { | ||
77 | + color: #b0b0b0; | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + &.btn-opt-minus { | ||
82 | + border-right: 1PX solid #dfdfdf; | ||
83 | + | ||
84 | + .iconfont:before { | ||
85 | + content: "\e625"; | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | + &.btn-opt-plus { | ||
90 | + border-left: 1px solid #dfdfdf; | ||
91 | + | ||
92 | + .iconfont:before { | ||
93 | + content: "\e624"; | ||
94 | + } | ||
95 | + } | ||
96 | + } | ||
97 | + | ||
98 | + .good-num { | ||
99 | + width: 120px; | ||
100 | + text-align: center; | ||
101 | + color: #444; | ||
102 | + font-size: 32px; | ||
103 | + background-color: #fff; | ||
104 | + border: none; | ||
105 | + line-height: 74px; | ||
106 | + height: 74px; | ||
107 | + | ||
108 | + &:disabled { | ||
109 | + color: initial; | ||
110 | + } | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | + .count { | ||
115 | + width: 155px; | ||
116 | + text-align: right; | ||
117 | + margin-right: 30px; | ||
118 | + line-height: 80px; | ||
119 | + color: #999; | ||
120 | + } | ||
121 | +} | ||
122 | + | ||
123 | +.edit { | ||
124 | + .bundle-title { | ||
125 | + .opt { | ||
126 | + .select { | ||
127 | + display: none; | ||
128 | + } | ||
129 | + | ||
130 | + .edit { | ||
131 | + display: block; | ||
132 | + } | ||
133 | + | ||
134 | + .disable { | ||
135 | + display: none; | ||
136 | + } | ||
137 | + } | ||
138 | + } | ||
139 | + | ||
140 | + .bundle-nums { | ||
141 | + display: flex; | ||
142 | + } | ||
143 | +} | ||
144 | + | ||
145 | +.bundle > .good-list > .good-item { | ||
146 | + .opt { | ||
147 | + .chk { | ||
148 | + visibility: hidden; | ||
149 | + } | ||
150 | + | ||
151 | + .disable { | ||
152 | + visibility: hidden; | ||
153 | + } | ||
154 | + } | ||
155 | +} |
@@ -196,6 +196,14 @@ | @@ -196,6 +196,14 @@ | ||
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | + .bottom > .re-add > span { | ||
200 | + border: 1px solid #d0253b; | ||
201 | + padding: 4px; | ||
202 | + border-radius: 5px; | ||
203 | + color: #d0253b; | ||
204 | + font-size: 16px; | ||
205 | + } | ||
206 | + | ||
199 | .name-row { | 207 | .name-row { |
200 | display: flex; | 208 | display: flex; |
201 | 209 | ||
@@ -266,8 +274,7 @@ | @@ -266,8 +274,7 @@ | ||
266 | line-height: 74px; | 274 | line-height: 74px; |
267 | padding-left: 14px; | 275 | padding-left: 14px; |
268 | border: solid 1PX #dfdfdf; | 276 | border: solid 1PX #dfdfdf; |
269 | - border-top: none; | ||
270 | - border-radius: 0 0 5px 5px; | 277 | + border-radius: 5px; |
271 | display: flex; | 278 | display: flex; |
272 | color: #444; | 279 | color: #444; |
273 | 280 | ||
@@ -292,6 +299,11 @@ | @@ -292,6 +299,11 @@ | ||
292 | } | 299 | } |
293 | } | 300 | } |
294 | } | 301 | } |
302 | + | ||
303 | + .edit-size-info-notop { | ||
304 | + border-top: none; | ||
305 | + border-radius: 0 0 5px 5px; | ||
306 | + } | ||
295 | } | 307 | } |
296 | 308 | ||
297 | .num-opt { | 309 | .num-opt { |
@@ -129,6 +129,10 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid, inValidLow) => { | @@ -129,6 +129,10 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid, inValidLow) => { | ||
129 | result.inValidLow = inValidLow; | 129 | result.inValidLow = inValidLow; |
130 | } | 130 | } |
131 | 131 | ||
132 | + if (inValidLow && goodData.storage_number > 0) { | ||
133 | + result.reAddToCart = true; | ||
134 | + } | ||
135 | + | ||
132 | // gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品; | 136 | // gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品; |
133 | if (!goodData.goods_type) { | 137 | if (!goodData.goods_type) { |
134 | result.inValid = true; | 138 | result.inValid = true; |
@@ -156,6 +160,29 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid, inValidLow) => { | @@ -156,6 +160,29 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid, inValidLow) => { | ||
156 | result.link = helpers.urlFormat(`/product/${goodData.product_skn}.html`); // 商品url改版 | 160 | result.link = helpers.urlFormat(`/product/${goodData.product_skn}.html`); // 商品url改版 |
157 | return result; | 161 | return result; |
158 | }; | 162 | }; |
163 | + | ||
164 | +/** | ||
165 | + * 失效商品池数据处理 | ||
166 | + * @param {*} pool | ||
167 | + */ | ||
168 | +const formatValidPool = (pool) => { | ||
169 | + let poolTemp = { | ||
170 | + poolBuyNumber: pool.pool_buy_number, | ||
171 | + poolId: pool.pool_id, | ||
172 | + poolStorageNumber: pool.pool_storage_number, | ||
173 | + poolTitle: pool.pool_title, | ||
174 | + selected: pool.selected, | ||
175 | + showCheckbox: false, | ||
176 | + isBundle: true | ||
177 | + }; | ||
178 | + | ||
179 | + poolTemp.goods = _.get(pool, 'goods_list', []).map(good => { | ||
180 | + return formatCartGoods(good, false, false, true); | ||
181 | + }); | ||
182 | + | ||
183 | + return poolTemp; | ||
184 | +}; | ||
185 | + | ||
159 | const procPriceGiftData = (data, promotionType) => { | 186 | const procPriceGiftData = (data, promotionType) => { |
160 | let result = {}; | 187 | let result = {}; |
161 | let arrays = _.get(data, 'arrays', []); | 188 | let arrays = _.get(data, 'arrays', []); |
@@ -256,7 +283,13 @@ const procCartData = (data, isAdvanceCart) => { | @@ -256,7 +283,13 @@ const procCartData = (data, isAdvanceCart) => { | ||
256 | return { | 283 | return { |
257 | isBrand: pool.pool_type <= 1, | 284 | isBrand: pool.pool_type <= 1, |
258 | isPromotion: pool.pool_type === 2, | 285 | isPromotion: pool.pool_type === 2, |
286 | + isBundle: pool.pool_type === 3, | ||
259 | poolTitle: pool.pool_title, | 287 | poolTitle: pool.pool_title, |
288 | + poolBuyNumber: pool.pool_buy_number, | ||
289 | + poolId: pool.pool_id, // 套餐 activity_id | ||
290 | + poolBatchNo: pool.pool_batch_no, // 套餐批次 | ||
291 | + selected: pool.selected === 'Y', // 套餐是否选中 | ||
292 | + poolStorageNumber: pool.pool_storage_number, // 库存数量 | ||
260 | goods: _.get(pool, 'goods_list', []).map(good => { | 293 | goods: _.get(pool, 'goods_list', []).map(good => { |
261 | return formatCartGoods(good, isAdvanceCart); | 294 | return formatCartGoods(good, isAdvanceCart); |
262 | }), | 295 | }), |
@@ -285,6 +318,11 @@ const procCartData = (data, isAdvanceCart) => { | @@ -285,6 +318,11 @@ const procCartData = (data, isAdvanceCart) => { | ||
285 | return formatCartGoods(good, isAdvanceCart, false, true); | 318 | return formatCartGoods(good, isAdvanceCart, false, true); |
286 | }); | 319 | }); |
287 | 320 | ||
321 | + // 失效的商品池 | ||
322 | + result.notValidPool = _.get(data, 'sold_out_goods_pool', []).map(pool => { | ||
323 | + return formatValidPool(pool); | ||
324 | + }); | ||
325 | + | ||
288 | // 下架的商品列表 | 326 | // 下架的商品列表 |
289 | result.offShelveGoods = _.get(data, 'off_shelves_goods_list', []).map(good => { | 327 | result.offShelveGoods = _.get(data, 'off_shelves_goods_list', []).map(good => { |
290 | return formatCartGoods(good, isAdvanceCart, false); | 328 | return formatCartGoods(good, isAdvanceCart, false); |
@@ -347,7 +385,9 @@ const procCartData = (data, isAdvanceCart) => { | @@ -347,7 +385,9 @@ const procCartData = (data, isAdvanceCart) => { | ||
347 | result.count = data.shopping_cart_data.selected_goods_count; | 385 | result.count = data.shopping_cart_data.selected_goods_count; |
348 | result.isAllSelected = (goodCount <= data.shopping_cart_data.selected_goods_count) && (data.shopping_cart_data.selected_goods_count > 0);// eslint-disable-line | 386 | result.isAllSelected = (goodCount <= data.shopping_cart_data.selected_goods_count) && (data.shopping_cart_data.selected_goods_count > 0);// eslint-disable-line |
349 | result.sumPrice = transPrice(data.shopping_cart_data.last_order_amount); | 387 | result.sumPrice = transPrice(data.shopping_cart_data.last_order_amount); |
350 | - result.hasNoSaleGoods = result.notValidGoods.length || result.offShelveGoods.length; | 388 | + result.hasNoSaleGoods = result.notValidGoods.length || |
389 | + result.offShelveGoods.length || | ||
390 | + result.notValidPool.length; | ||
351 | 391 | ||
352 | return result; | 392 | return result; |
353 | }; | 393 | }; |
-
Please register or login to post a comment