Showing
6 changed files
with
41 additions
and
14 deletions
@@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
62 | </div> | 62 | </div> |
63 | </div> | 63 | </div> |
64 | </div> | 64 | </div> |
65 | - <a class="btn-account btn-account-black" href="{{ensureUrl}}">去结算</a> | 65 | + <a class="btn-account" href="{{ensureUrl}}">去结算</a> |
66 | {{/ordinaryCart}} | 66 | {{/ordinaryCart}} |
67 | <p class="pre-sell-tip">温馨提示:您需要分开结算【预售商品】和【普通商品】</p> | 67 | <p class="pre-sell-tip">温馨提示:您需要分开结算【预售商品】和【普通商品】</p> |
68 | </div> | 68 | </div> |
@@ -4,12 +4,11 @@ | @@ -4,12 +4,11 @@ | ||
4 | 4 | ||
5 | var $ = require('yoho-jquery'); | 5 | var $ = require('yoho-jquery'); |
6 | var dialog = require('../common/dialog'); | 6 | var dialog = require('../common/dialog'); |
7 | -var Dialog = dialog.Dialog; | ||
8 | var Alert = dialog.Alert; | 7 | var Alert = dialog.Alert; |
9 | var Confirm = dialog.Confirm; | 8 | var Confirm = dialog.Confirm; |
10 | var rDialog = require('./rdialog'); | 9 | var rDialog = require('./rdialog'); |
11 | var RConfirm = rDialog.RConfirm; | 10 | var RConfirm = rDialog.RConfirm; |
12 | -var RAlert = rDialog.RAlert; | 11 | +var Cart; |
13 | 12 | ||
14 | var $cartnewTips = $('.cartnew-tips'), | 13 | var $cartnewTips = $('.cartnew-tips'), |
15 | $payWapper = $('.pay-wapper'), | 14 | $payWapper = $('.pay-wapper'), |
@@ -22,7 +21,7 @@ $cartnewTips.find('.btn_close').click(function() { | @@ -22,7 +21,7 @@ $cartnewTips.find('.btn_close').click(function() { | ||
22 | }); | 21 | }); |
23 | 22 | ||
24 | // 滚动到第一个选中的商品 | 23 | // 滚动到第一个选中的商品 |
25 | -function scrollToFirst() { | 24 | +/*function scrollToFirst() { |
26 | var $selected = $payWapper.find('li[data-role="pitem"] .cart-item-check.cart-item-checked:eq(0)'); | 25 | var $selected = $payWapper.find('li[data-role="pitem"] .cart-item-check.cart-item-checked:eq(0)'); |
27 | var top = 0; | 26 | var top = 0; |
28 | 27 | ||
@@ -32,7 +31,7 @@ function scrollToFirst() { | @@ -32,7 +31,7 @@ function scrollToFirst() { | ||
32 | } | 31 | } |
33 | 32 | ||
34 | return false; | 33 | return false; |
35 | -} | 34 | +}*/ |
36 | 35 | ||
37 | function toastNoStore(parent) { | 36 | function toastNoStore(parent) { |
38 | 37 | ||
@@ -45,10 +44,10 @@ function toastNoStore(parent) { | @@ -45,10 +44,10 @@ function toastNoStore(parent) { | ||
45 | }, 2000); | 44 | }, 2000); |
46 | } | 45 | } |
47 | 46 | ||
48 | -var Cart = { | ||
49 | - addToCart: function(params) { | 47 | +Cart = { |
48 | + /* addToCart: function(params) { | ||
50 | 49 | ||
51 | - }, | 50 | + },*/ |
52 | toggleSelectOne: function() { // 单选 | 51 | toggleSelectOne: function() { // 单选 |
53 | 52 | ||
54 | var $this = $(this); | 53 | var $this = $(this); |
@@ -143,6 +142,7 @@ var Cart = { | @@ -143,6 +142,7 @@ var Cart = { | ||
143 | 142 | ||
144 | var $chk = $(this); | 143 | var $chk = $(this); |
145 | var $item = $chk.closest('[data-role=pitem]'); | 144 | var $item = $chk.closest('[data-role=pitem]'); |
145 | + | ||
146 | if ($chk.hasClass('cart-item-checked')) { | 146 | if ($chk.hasClass('cart-item-checked')) { |
147 | 147 | ||
148 | if ($item.data('id')) { | 148 | if ($item.data('id')) { |
@@ -240,6 +240,7 @@ var Cart = { | @@ -240,6 +240,7 @@ var Cart = { | ||
240 | 240 | ||
241 | var $item = $(this); | 241 | var $item = $(this); |
242 | var $chk = $item.find('.cart-item-check'); | 242 | var $chk = $item.find('.cart-item-check'); |
243 | + | ||
243 | if ($chk.hasClass('cart-item-checked')) { | 244 | if ($chk.hasClass('cart-item-checked')) { |
244 | 245 | ||
245 | if ($item.data('id')) { | 246 | if ($item.data('id')) { |
@@ -299,11 +300,23 @@ var Cart = { | @@ -299,11 +300,23 @@ var Cart = { | ||
299 | }, | 300 | }, |
300 | submit: function() { | 301 | submit: function() { |
301 | 302 | ||
303 | + var content = '<div><i class="iconfont"></i>您还未选择赠品</div><p>是否去选择赠品?</p>'; | ||
304 | + | ||
305 | + if ($(this).hasClass('btn-account-disable')) { | ||
306 | + return false; | ||
307 | + } | ||
308 | + | ||
302 | if ($('[data-role="gift-sel-btn"]').length) { | 309 | if ($('[data-role="gift-sel-btn"]').length) { |
303 | - alert('还有赠品未领取!'); | 310 | + |
311 | + new RConfirm(content, function() { | ||
312 | + var firstGift = $('[data-role="gift-sel-btn"]')[0]; | ||
313 | + | ||
314 | + $('html,body').animate({scrollTop: $(firstGift).offset().top + 'px'}, 500); | ||
315 | + }, function(){ | ||
316 | + capi.showMDialog('#Y_CartSelectDialog'); | ||
317 | + }, '去选择', '不要赠品'); | ||
304 | } | 318 | } |
305 | 319 | ||
306 | - capi.showMDialog('#Y_CartSelectDialog'); | ||
307 | // $('.cart-preSell-dialog').show(); | 320 | // $('.cart-preSell-dialog').show(); |
308 | 321 | ||
309 | // $('.cart-togetherGoods').show(); | 322 | // $('.cart-togetherGoods').show(); |
@@ -6,7 +6,6 @@ | @@ -6,7 +6,6 @@ | ||
6 | 6 | ||
7 | var $ = require('yoho-jquery'), | 7 | var $ = require('yoho-jquery'), |
8 | lazyLoad = require('yoho-jquery-lazyload'), | 8 | lazyLoad = require('yoho-jquery-lazyload'), |
9 | - dialog = require('../common/dialog'), | ||
10 | $sellBox = $('.cart-table .pre-sell-box'); | 9 | $sellBox = $('.cart-table .pre-sell-box'); |
11 | 10 | ||
12 | require('../plugins/slider'); | 11 | require('../plugins/slider'); |
@@ -25,6 +24,7 @@ lazyLoad($('#details-html img')); | @@ -25,6 +24,7 @@ lazyLoad($('#details-html img')); | ||
25 | function isCheckAll() { | 24 | function isCheckAll() { |
26 | 25 | ||
27 | var isAllCheck = true; | 26 | var isAllCheck = true; |
27 | + | ||
28 | $('[data-role=pitem] [data-role=cart-item-check]').each(function() { | 28 | $('[data-role=pitem] [data-role=cart-item-check]').each(function() { |
29 | 29 | ||
30 | // 有一个没选中,跳出循环 | 30 | // 有一个没选中,跳出循环 |
@@ -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,9 +37,10 @@ function RConfirm(content, ok, cancel) { | @@ -37,9 +37,10 @@ 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 | + (typeof cancel === 'function') && cancel(); | ||
43 | } | 44 | } |
44 | }] | 45 | }] |
45 | }); | 46 | }); |
@@ -632,6 +632,10 @@ | @@ -632,6 +632,10 @@ | ||
632 | box-sizing: border-box; | 632 | box-sizing: border-box; |
633 | background-color: #fff; | 633 | background-color: #fff; |
634 | cursor: pointer; | 634 | cursor: pointer; |
635 | + &:hover { | ||
636 | + background-color: #000; | ||
637 | + color: #fff; | ||
638 | + } | ||
635 | } | 639 | } |
636 | .btn-account-black { | 640 | .btn-account-black { |
637 | background-color: #000; | 641 | background-color: #000; |
-
Please register or login to post a comment