Merge branch 'feature/cart' of git.yoho.cn:fe/yohobuywap-node into feature/cart
Showing
7 changed files
with
44 additions
and
37 deletions
@@ -17,12 +17,12 @@ module.exports = { | @@ -17,12 +17,12 @@ module.exports = { | ||
17 | assetUrl: '//127.0.0.1:5001', | 17 | assetUrl: '//127.0.0.1:5001', |
18 | testCode: 'yoho4946abcdef#$%&!@', | 18 | testCode: 'yoho4946abcdef#$%&!@', |
19 | domains: { | 19 | domains: { |
20 | - // api: 'http://api-test2.yohops.com:9999/', | 20 | + api: 'http://api-test3.yohops.com:9999/', |
21 | // service: 'http://service-test3.yohops.com:9999/', | 21 | // service: 'http://service-test3.yohops.com:9999/', |
22 | // liveApi: 'http://testapi.live.yohops.com:9999/', | 22 | // liveApi: 'http://testapi.live.yohops.com:9999/', |
23 | // singleApi: 'http://api-test3.yohops.com:9999/', | 23 | // singleApi: 'http://api-test3.yohops.com:9999/', |
24 | 24 | ||
25 | - api: 'http://dev-api.yohops.com:9999/', | 25 | + // api: 'http://dev-api.yohops.com:9999/', |
26 | service: 'http://service.yoho.cn/', | 26 | service: 'http://service.yoho.cn/', |
27 | liveApi: 'http://api.live.yoho.cn/', | 27 | liveApi: 'http://api.live.yoho.cn/', |
28 | singleApi: 'http://single.yoho.cn/', | 28 | singleApi: 'http://single.yoho.cn/', |
@@ -47,20 +47,20 @@ | @@ -47,20 +47,20 @@ | ||
47 | <div class="num"> | 47 | <div class="num"> |
48 | <span class="name">数量</span> | 48 | <span class="name">数量</span> |
49 | <div class="clearfix"> | 49 | <div class="clearfix"> |
50 | - <a class="btn btn-minus {{#if @root.discountBuy}}discount-gray{{/if}}" href="javascript:void(0);"> | ||
51 | - <span class="iconfont {{#if promotionId}}disabled{{/if}}"></span> | 50 | + <a class="btn btn-minus {{#if discountBuy}}discount-gray{{/if}}" href="javascript:void(0);"> |
51 | + <span class="iconfont {{#if ../promotionId}}disabled{{/if}}"></span> | ||
52 | </a> | 52 | </a> |
53 | - <input id="good-num" class="good-num disabled" type="text" {{#if @root.discountBuy}}value="{{@root.discountBuy.num}}" {{^}} value="1"{{/if}} disabled="true"> | 53 | + <input id="good-num" class="good-num disabled" type="text" {{#if discountBuy}}value="{{discountBuy.num}}" {{^}} value="1"{{/if}} disabled="true"> |
54 | <a class="btn btn-plus" href="javascript:void(0);"> | 54 | <a class="btn btn-plus" href="javascript:void(0);"> |
55 | - <span class="iconfont {{#if promotionId}}disabled{{/if}}"></span> | 55 | + <span class="iconfont {{#if ../promotionId}}disabled{{/if}}"></span> |
56 | </a> | 56 | </a> |
57 | </div> | 57 | </div> |
58 | - {{#if @root.discountBuy}} | ||
59 | - <input id="mnum" type="hidden" value="{{@root.discountBuy.num}}"> | ||
60 | - {{#if @root.discountBuy.discount}} | ||
61 | - <span class="left-num-discount" style="color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;">{{@root.discountBuy.num}}件起购享{{@root.discountBuy.discount}}折</span> | 58 | + {{#if discountBuy}} |
59 | + <input id="mnum" type="hidden" value="{{discountBuy.num}}"> | ||
60 | + {{#if discountBuy.discount}} | ||
61 | + <span class="left-num-discount" style="color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;">{{discountBuy.num}}件起购享{{discountBuy.discount}}折</span> | ||
62 | {{^}} | 62 | {{^}} |
63 | - <span class="left-num-discount" style="color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;">{{@root.discountBuy.num}}件起购</span> | 63 | + <span class="left-num-discount" style="color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;">{{discountBuy.num}}件起购</span> |
64 | {{/if}} | 64 | {{/if}} |
65 | {{^}} | 65 | {{^}} |
66 | <span class="left-num"></span> | 66 | <span class="left-num"></span> |
@@ -77,4 +77,4 @@ | @@ -77,4 +77,4 @@ | ||
77 | </div> | 77 | </div> |
78 | {{/ cartInfo}} | 78 | {{/ cartInfo}} |
79 | <input id="promotionId" type="hidden" value="{{promotionId}}"> | 79 | <input id="promotionId" type="hidden" value="{{promotionId}}"> |
80 | -<input id="single" type="hidden" value="{{@root.single}}"> | ||
80 | +<input id="single" type="hidden" value="{{@root.single}}"> |
@@ -83,6 +83,7 @@ function disableNumEdit() { | @@ -83,6 +83,7 @@ function disableNumEdit() { | ||
83 | 83 | ||
84 | // 初始化购物车面板显示 | 84 | // 初始化购物车面板显示 |
85 | function init() { | 85 | function init() { |
86 | + discountNum = $('#mnum').val() - 0; | ||
86 | hasChooseColor = false; | 87 | hasChooseColor = false; |
87 | hasChooseSize = false; | 88 | hasChooseSize = false; |
88 | $curSizeBlock = null; | 89 | $curSizeBlock = null; |
@@ -17,14 +17,6 @@ let indexObj = { | @@ -17,14 +17,6 @@ let indexObj = { | ||
17 | init() { | 17 | init() { |
18 | let self = this; | 18 | let self = this; |
19 | 19 | ||
20 | - $('.nav-btn').on('click', () => { | ||
21 | - $('.main-wrap').toggleClass('edit'); | ||
22 | - if ($('.main-wrap').hasClass('edit')) { | ||
23 | - self.editMode = true; | ||
24 | - } else { | ||
25 | - self.editMode = false; | ||
26 | - } | ||
27 | - }); | ||
28 | self.refreshPage(); | 20 | self.refreshPage(); |
29 | require('./index/recommend-for-you').init(self); | 21 | require('./index/recommend-for-you').init(self); |
30 | }, | 22 | }, |
@@ -16,8 +16,8 @@ let cartObj = { | @@ -16,8 +16,8 @@ let cartObj = { | ||
16 | 16 | ||
17 | self.handle = handle; | 17 | self.handle = handle; |
18 | 18 | ||
19 | - $('.cart-nav').on('click', 'li', function() { | ||
20 | - self.cartNavClick(); | 19 | + $('.cart-nav').on('click', 'li', function(e) { |
20 | + self.cartNavClick(e); | ||
21 | }); | 21 | }); |
22 | $('.more-box>.down-arrow').on('click', function(e) { | 22 | $('.more-box>.down-arrow').on('click', function(e) { |
23 | self.arrowClick(e); | 23 | self.arrowClick(e); |
@@ -31,14 +31,28 @@ let cartObj = { | @@ -31,14 +31,28 @@ let cartObj = { | ||
31 | $('.all-gift-box').on('click', '.gift-item', (e) => { | 31 | $('.all-gift-box').on('click', '.gift-item', (e) => { |
32 | self.allGiftBoxClick(e); | 32 | self.allGiftBoxClick(e); |
33 | }); | 33 | }); |
34 | + $('.nav-btn').on('click', () => { | ||
35 | + self.navClick(); | ||
36 | + }); | ||
34 | self.initPresellTip(); | 37 | self.initPresellTip(); |
35 | }, | 38 | }, |
39 | + navClick() { | ||
40 | + let self = this; | ||
41 | + | ||
42 | + $('.main-wrap').toggleClass('edit'); | ||
43 | + if ($('.main-wrap').hasClass('edit')) { | ||
44 | + self.handle.editMode = true; | ||
45 | + $('.chk.edit').removeClass('checked'); | ||
46 | + } else { | ||
47 | + self.handle.editMode = false; | ||
48 | + } | ||
49 | + }, | ||
36 | arrowClick(e) { | 50 | arrowClick(e) { |
37 | $(e.currentTarget).parent().toggleClass('down'); | 51 | $(e.currentTarget).parent().toggleClass('down'); |
38 | }, | 52 | }, |
39 | - cartNavClick() { | 53 | + cartNavClick(e) { |
40 | let self = this; | 54 | let self = this; |
41 | - let type = $(this).data('type'); | 55 | + let type = $(e.currentTarget).data('type'); |
42 | 56 | ||
43 | window.setCookie('cartType', type); | 57 | window.setCookie('cartType', type); |
44 | self.handle.refreshPage(''); | 58 | self.handle.refreshPage(''); |
@@ -130,7 +144,7 @@ let cartObj = { | @@ -130,7 +144,7 @@ let cartObj = { | ||
130 | tip.show('请先勾选商品'); | 144 | tip.show('请先勾选商品'); |
131 | return false; | 145 | return false; |
132 | } | 146 | } |
133 | - window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; | 147 | + window.location.href = '/cart/index/new/orderEnsure?cartType=' + cartType; |
134 | } | 148 | } |
135 | }; | 149 | }; |
136 | 150 |
@@ -35,8 +35,8 @@ let goodObj = { | @@ -35,8 +35,8 @@ 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 | - $('.check-all').on('click', function() { | ||
39 | - self.checkedAllClick(); | 38 | + $('.check-all').on('click', function(e) { |
39 | + self.checkedAllClick(e); | ||
40 | }); | 40 | }); |
41 | $('.btn-del').on('click', function() { | 41 | $('.btn-del').on('click', function() { |
42 | self.delClick(); | 42 | self.delClick(); |
@@ -50,6 +50,8 @@ let goodObj = { | @@ -50,6 +50,8 @@ let goodObj = { | ||
50 | $(e.currentTarget).toggleClass('checked'); | 50 | $(e.currentTarget).toggleClass('checked'); |
51 | }, | 51 | }, |
52 | removeInvalidClick() { | 52 | removeInvalidClick() { |
53 | + let self = this; | ||
54 | + | ||
53 | dialog.showDialog({ | 55 | dialog.showDialog({ |
54 | dialogText: '您确定要清空失效商品吗?', | 56 | dialogText: '您确定要清空失效商品吗?', |
55 | hasFooter: { | 57 | hasFooter: { |
@@ -143,17 +145,19 @@ let goodObj = { | @@ -143,17 +145,19 @@ let goodObj = { | ||
143 | dialog.hideDialog(); | 145 | dialog.hideDialog(); |
144 | }); | 146 | }); |
145 | }, | 147 | }, |
146 | - checkedAllClick() { | 148 | + checkedAllClick(e) { |
149 | + let self = this; | ||
150 | + | ||
147 | if (self.handle.editMode) { | 151 | if (self.handle.editMode) { |
148 | - $(this).find('.chk.edit').toggleClass('checked'); | ||
149 | - if ($(this).find('.chk.edit').hasClass('checked')) { | 152 | + $(e.currentTarget).find('.chk.edit').toggleClass('checked'); |
153 | + if ($(e.currentTarget).find('.chk.edit').hasClass('checked')) { | ||
150 | $('.good-item .chk.edit').addClass('checked'); | 154 | $('.good-item .chk.edit').addClass('checked'); |
151 | } else { | 155 | } else { |
152 | $('.good-item .chk.edit').removeClass('checked'); | 156 | $('.good-item .chk.edit').removeClass('checked'); |
153 | } | 157 | } |
154 | } else { | 158 | } else { |
155 | - $(this).find('.chk.select').toggleClass('checked'); | ||
156 | - let checked = $(this).find('.chk.select').hasClass('checked'); | 159 | + $(e.currentTarget).find('.chk.select').toggleClass('checked'); |
160 | + let checked = $(e.currentTarget).find('.chk.select').hasClass('checked'); | ||
157 | 161 | ||
158 | if (checked) { | 162 | if (checked) { |
159 | let promise = self.clearLowStock(); | 163 | let promise = self.clearLowStock(); |
@@ -406,16 +410,12 @@ let goodObj = { | @@ -406,16 +410,12 @@ let goodObj = { | ||
406 | }, | 410 | }, |
407 | openChosepanel(e, isGift) { | 411 | openChosepanel(e, isGift) { |
408 | let self = this; | 412 | let self = this; |
409 | - | ||
410 | let skn = $(e.delegateTarget).data('skn'); | 413 | let skn = $(e.delegateTarget).data('skn'); |
411 | - | ||
412 | let id, | 414 | let id, |
413 | count, | 415 | count, |
414 | canEditNum, | 416 | canEditNum, |
415 | minNum, | 417 | minNum, |
416 | promotionId; | 418 | promotionId; |
417 | - | ||
418 | - | ||
419 | let isSelected = $(e.delegateTarget).find('.chk.select').hasClass('checked'); | 419 | let isSelected = $(e.delegateTarget).find('.chk.select').hasClass('checked'); |
420 | 420 | ||
421 | id = $(e.delegateTarget).data('id'); | 421 | id = $(e.delegateTarget).data('id'); |
@@ -99,7 +99,7 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid = true, inValidLow = f | @@ -99,7 +99,7 @@ const formatCartGoods = (goodData, isAdvanceCart, isValid = true, inValidLow = f | ||
99 | promotion_id: _.toNumber(goodData.promotion_id) === 0 ? '' : goodData.promotion_id | 99 | promotion_id: _.toNumber(goodData.promotion_id) === 0 ? '' : goodData.promotion_id |
100 | }; | 100 | }; |
101 | 101 | ||
102 | - if (goodData.min_buy_number && goodData.min_buy_number > 0) { | 102 | + if (goodData.min_buy_number && goodData.min_buy_number > 1) { |
103 | result.minNumber = parseInt(goodData.min_buy_number, 10); | 103 | result.minNumber = parseInt(goodData.min_buy_number, 10); |
104 | } | 104 | } |
105 | result.maxNumber = parseInt(goodData.storage_number, 10); | 105 | result.maxNumber = parseInt(goodData.storage_number, 10); |
-
Please register or login to post a comment