Merge branch 'feature/shoppingCart' of http://git.yoho.cn/fe/yohobuy-node into feature/shoppingCart
Showing
4 changed files
with
23 additions
and
4 deletions
@@ -299,8 +299,18 @@ var Cart = { | @@ -299,8 +299,18 @@ var Cart = { | ||
299 | }, | 299 | }, |
300 | submit: function() { | 300 | submit: function() { |
301 | 301 | ||
302 | + if ($(this).hasClass('btn-account-disable')) { | ||
303 | + return false; | ||
304 | + } | ||
305 | + | ||
302 | if ($('[data-role="gift-sel-btn"]').length) { | 306 | if ($('[data-role="gift-sel-btn"]').length) { |
303 | - alert('还有赠品未领取!'); | 307 | + var content = '<div><i class="iconfont"></i>您还未选择赠品</div><p>是否去选择赠品?</p>'; |
308 | + | ||
309 | + new RConfirm(content, function() { | ||
310 | + var firstGift = $('[data-role="gift-sel-btn"]')[0]; | ||
311 | + | ||
312 | + $("html,body").animate({scrollTop: $(firstGift).offset().top + "px"}, 500); | ||
313 | + }, '去选择', '不要赠品'); | ||
304 | } | 314 | } |
305 | 315 | ||
306 | capi.showMDialog('#Y_CartSelectDialog'); | 316 | capi.showMDialog('#Y_CartSelectDialog'); |
@@ -79,6 +79,8 @@ function isCheckFav() { | @@ -79,6 +79,8 @@ function isCheckFav() { | ||
79 | 79 | ||
80 | 80 | ||
81 | $(function() { | 81 | $(function() { |
82 | + var $itemChecked = $('[data-role=pitem] .cart-item-checked'); | ||
83 | + | ||
82 | $('.bottom-tab .change').click(function() { | 84 | $('.bottom-tab .change').click(function() { |
83 | $('.img-brand-switch .next').trigger('click'); | 85 | $('.img-brand-switch .next').trigger('click'); |
84 | }); | 86 | }); |
@@ -93,6 +95,10 @@ $(function() { | @@ -93,6 +95,10 @@ $(function() { | ||
93 | 95 | ||
94 | isCheckAll(); | 96 | isCheckAll(); |
95 | isCheckFav(); | 97 | isCheckFav(); |
98 | + | ||
99 | + if ($itemChecked.length === 0) { | ||
100 | + $('#Y_SubmitBtn').addClass('btn-account-disable'); | ||
101 | + } | ||
96 | }); | 102 | }); |
97 | 103 | ||
98 | require('./cart-action'); | 104 | require('./cart-action'); |
@@ -23,13 +23,13 @@ RDialog.prototype = new Dialog({ | @@ -23,13 +23,13 @@ RDialog.prototype = new Dialog({ | ||
23 | }); | 23 | }); |
24 | RDialog.prototype.constructor = RDialog; | 24 | RDialog.prototype.constructor = RDialog; |
25 | 25 | ||
26 | -function RConfirm(content, ok, cancel) { | 26 | +function RConfirm(content, ok, cancel, okName, cancelName) { |
27 | var rd = new RDialog({ | 27 | var rd = new RDialog({ |
28 | content: content, | 28 | content: content, |
29 | btns: [{ | 29 | btns: [{ |
30 | id: 'confirm-btn-ok', | 30 | id: 'confirm-btn-ok', |
31 | btnClass: ['alert-sure'], | 31 | btnClass: ['alert-sure'], |
32 | - name: '确定', | 32 | + name: okName || '确定', |
33 | cb: function() { | 33 | cb: function() { |
34 | rd.close(); | 34 | rd.close(); |
35 | (typeof ok === 'function') && ok(); | 35 | (typeof ok === 'function') && ok(); |
@@ -37,7 +37,7 @@ function RConfirm(content, ok, cancel) { | @@ -37,7 +37,7 @@ function RConfirm(content, ok, cancel) { | ||
37 | }, { | 37 | }, { |
38 | id: 'confirm-btn-cencel', | 38 | id: 'confirm-btn-cencel', |
39 | btnClass: ['btn-cancel'], | 39 | btnClass: ['btn-cancel'], |
40 | - name: '取消', | 40 | + name: cancelName || '取消', |
41 | cb: function() { | 41 | cb: function() { |
42 | rd.close(); | 42 | rd.close(); |
43 | } | 43 | } |
-
Please register or login to post a comment