Showing
8 changed files
with
66 additions
and
36 deletions
@@ -94,8 +94,8 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys | @@ -94,8 +94,8 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys | ||
94 | if (goods.productNum > goods.storageNum) { | 94 | if (goods.productNum > goods.storageNum) { |
95 | goods.isTipNoStore = true; // 是否在结算时候显示库存不足 | 95 | goods.isTipNoStore = true; // 是否在结算时候显示库存不足 |
96 | goods.tipMessage = '库存不足'; | 96 | goods.tipMessage = '库存不足'; |
97 | - } else if (goods.storageNum <= 2) { | ||
98 | - goods.tipMessage = '余量有限'; | 97 | + } else if (goods.storageNum <= 3) { |
98 | + goods.tipMessage = '仅剩'+goods.storageNum+'件'; | ||
99 | } | 99 | } |
100 | } else { // 失效商品 | 100 | } else { // 失效商品 |
101 | goods.inValid = true; | 101 | goods.inValid = true; |
@@ -57,9 +57,9 @@ | @@ -57,9 +57,9 @@ | ||
57 | <div>{{productNum}}</div> | 57 | <div>{{productNum}}</div> |
58 | {{^}} | 58 | {{^}} |
59 | <div class="cart-num-cont"> | 59 | <div class="cart-num-cont"> |
60 | - <span class="minus"></span> | 60 | + <span class="minus cart-num-btn"><i class="iconfont icon-minus"></i></span> |
61 | <input type="text" value="{{productNum}}" readonly="readonly"/> | 61 | <input type="text" value="{{productNum}}" readonly="readonly"/> |
62 | - <span class="plus"></span> | 62 | + <span class="plus cart-num-btn"><i class="iconfont icon-plus"></i></span> |
63 | </div> | 63 | </div> |
64 | 64 | ||
65 | <p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p> | 65 | <p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p> |
@@ -102,13 +102,9 @@ | @@ -102,13 +102,9 @@ | ||
102 | <i class="sellOut iconfont"></i>已售罄 | 102 | <i class="sellOut iconfont"></i>已售罄 |
103 | </button> | 103 | </button> |
104 | {{#if isFav}} | 104 | {{#if isFav}} |
105 | - <button class="btn-favCount favAdd" data-role="fav-count"><i class="favCount iconfont coled"></i>已收藏</button> | ||
106 | - <button class="btn-favCount none favCancel" data-role="fav-count"><i class="favCount iconfont"></i>收藏商品</button> | ||
107 | - <button class="btn-favCount none favTip" data-role="fav-count"><i class="favCount iconfont coled"></i>取消收藏</button> | 105 | + <button class="btn-favCount favAdd" data-role="fav-count"><i class="favCount iconfont coled"></i><em>已收藏</em></button> |
108 | {{else}} | 106 | {{else}} |
109 | - <button class="btn-favCount favCancel" data-role="fav-count"><i class="favCount iconfont"></i>收藏商品</button> | ||
110 | - <button class="btn-favCount none favAdd" data-role="fav-count"><i class="favCount iconfont coled"></i>已收藏</button> | ||
111 | - <button class="btn-favCount none favTip" data-role="fav-count"><i class="favCount iconfont coled"></i>取消收藏</button> | 107 | + <button class="btn-favCount favCancel" data-role="fav-count"><i class="favCount iconfont"></i><em>收藏商品</em></button> |
112 | {{/if}} | 108 | {{/if}} |
113 | </div> | 109 | </div> |
114 | {{#if isView}} | 110 | {{#if isView}} |
@@ -220,6 +220,8 @@ Cart = { | @@ -220,6 +220,8 @@ Cart = { | ||
220 | 220 | ||
221 | var $this = $(this); | 221 | var $this = $(this); |
222 | var $item = $this.closest('li[data-role="pitem"]'); | 222 | var $item = $this.closest('li[data-role="pitem"]'); |
223 | + var content = '<div><i class="iconfont"></i>移入收藏</div><p>确定要将该商品从购物车中移入收藏夹吗?<br/>移入收藏后该商品将不在购物车中显示</p>'; | ||
224 | + | ||
223 | var item = { | 225 | var item = { |
224 | product_sku: $item.data('id'), | 226 | product_sku: $item.data('id'), |
225 | buy_number: $item.data('productnum'), | 227 | buy_number: $item.data('productnum'), |
@@ -230,7 +232,9 @@ Cart = { | @@ -230,7 +232,9 @@ Cart = { | ||
230 | return; | 232 | return; |
231 | } | 233 | } |
232 | 234 | ||
233 | - capi.cartItemDel(item); | 235 | + new RConfirm(content,function(){ |
236 | + capi.cartItemDel(item,true); | ||
237 | + }); | ||
234 | }, | 238 | }, |
235 | toFavAll: function() { | 239 | toFavAll: function() { |
236 | 240 |
@@ -236,12 +236,18 @@ GoodsWinAction = { | @@ -236,12 +236,18 @@ GoodsWinAction = { | ||
236 | } | 236 | } |
237 | 237 | ||
238 | }, | 238 | }, |
239 | + //收藏 | ||
239 | btnFav: function() { | 240 | btnFav: function() { |
240 | 241 | ||
241 | var favBtn = $('[data-role="fav-count"]'); | 242 | var favBtn = $('[data-role="fav-count"]'); |
242 | var $this = $(this); | 243 | var $this = $(this); |
243 | var $goodsDetail = $this.closest('.detail-goods'); | 244 | var $goodsDetail = $this.closest('.detail-goods'); |
244 | var pid = $goodsDetail.data('productid'); | 245 | var pid = $goodsDetail.data('productid'); |
246 | + var colTxt = { | ||
247 | + normal: '收藏商品', | ||
248 | + coled: '已收藏', | ||
249 | + hover: '取消收藏' | ||
250 | + }; | ||
245 | 251 | ||
246 | function tipFav(parent) { | 252 | function tipFav(parent) { |
247 | 253 | ||
@@ -256,7 +262,6 @@ GoodsWinAction = { | @@ -256,7 +262,6 @@ GoodsWinAction = { | ||
256 | 262 | ||
257 | if (favBtn.find('.favCount').hasClass('coled')) { | 263 | if (favBtn.find('.favCount').hasClass('coled')) { |
258 | console.log('取消'+888); | 264 | console.log('取消'+888); |
259 | - console.log(pid); | ||
260 | 265 | ||
261 | capi.productCollect(pid,true).done(function(obj){ | 266 | capi.productCollect(pid,true).done(function(obj){ |
262 | 267 | ||
@@ -264,14 +269,13 @@ GoodsWinAction = { | @@ -264,14 +269,13 @@ GoodsWinAction = { | ||
264 | tipFav(pid); | 269 | tipFav(pid); |
265 | return false; | 270 | return false; |
266 | } | 271 | } |
267 | - // $favBtn.addClass('none'); | ||
268 | - // $favBtn.hasClass('favCancel').removeClass('none').show(); | ||
269 | - favBtn.mouseover(function(){ | ||
270 | - favBtn.html('<i class="favCount iconfont"></i>收藏商品'); | 272 | + favBtn.find('.favCount').removeClass('coled'); |
273 | + favBtn.find('em').text(colTxt.normal); | ||
274 | + favBtn.mouseenter(function(){ | ||
275 | + favBtn.find('em').text(colTxt.normal); | ||
271 | }).mouseleave(function(){ | 276 | }).mouseleave(function(){ |
272 | - favBtn.html('<i class="favCount iconfont"></i>收藏商品'); | ||
273 | - }).html('<i class="favCount iconfont"></i>收藏商品'); | ||
274 | - event.stopPropagation(); | 277 | + favBtn.find('em').text(colTxt.normal); |
278 | + }); | ||
275 | 279 | ||
276 | }).fail(function(){ | 280 | }).fail(function(){ |
277 | 281 | ||
@@ -282,7 +286,6 @@ GoodsWinAction = { | @@ -282,7 +286,6 @@ GoodsWinAction = { | ||
282 | 286 | ||
283 | } else { | 287 | } else { |
284 | console.log('收藏'+9999); | 288 | console.log('收藏'+9999); |
285 | - console.log(pid); | ||
286 | capi.productCollect(pid).done(function(obj){ | 289 | capi.productCollect(pid).done(function(obj){ |
287 | 290 | ||
288 | if(!obj && obj.code !== 200){ | 291 | if(!obj && obj.code !== 200){ |
@@ -290,14 +293,14 @@ GoodsWinAction = { | @@ -290,14 +293,14 @@ GoodsWinAction = { | ||
290 | return false; | 293 | return false; |
291 | } | 294 | } |
292 | 295 | ||
293 | - // $favBtn.addClass('none'); | ||
294 | - // $favBtn.hasClass('favAdd').removeClass('none').show(); | ||
295 | - favBtn.mouseover(function(){ | ||
296 | - favBtn.html('<i class="favCount iconfont coled"></i>取消收藏').mouseleave(function(){ | ||
297 | - favBtn.html('<i class="favCount iconfont coled"></i>已收藏'); | ||
298 | - }); | ||
299 | - }).html('<i class="favCount iconfont coled"></i>已收藏'); | ||
300 | - event.stopPropagation(); | 296 | + favBtn.find('.favCount').addClass('coled'); |
297 | + favBtn.find('em').text(colTxt.coled); | ||
298 | + favBtn.mouseenter(function(){ | ||
299 | + favBtn.find('em').text(colTxt.hover); | ||
300 | + }).mouseleave(function(){ | ||
301 | + favBtn.find('em').text(colTxt.coled); | ||
302 | + }); | ||
303 | + obj.stopPropagation(); | ||
301 | 304 | ||
302 | }).fail(function(){ | 305 | }).fail(function(){ |
303 | 306 | ||
@@ -321,6 +324,7 @@ GoodsWinAction = { | @@ -321,6 +324,7 @@ GoodsWinAction = { | ||
321 | 324 | ||
322 | if ($curSize.length <= 0) { | 325 | if ($curSize.length <= 0) { |
323 | $this.closest('.detail-info').find('.size-p-tip').show(); | 326 | $this.closest('.detail-info').find('.size-p-tip').show(); |
327 | + $this.closest('.detail-info').find('.submit').css('marginTop','0'); | ||
324 | 328 | ||
325 | // new Alert('请选择尺码').show(); | 329 | // new Alert('请选择尺码').show(); |
326 | return false; | 330 | return false; |
@@ -397,13 +397,16 @@ | @@ -397,13 +397,16 @@ | ||
397 | box-sizing: border-box; | 397 | box-sizing: border-box; |
398 | outline: none; | 398 | outline: none; |
399 | cursor: pointer; | 399 | cursor: pointer; |
400 | - i{ | 400 | + i { |
401 | width: 16px; | 401 | width: 16px; |
402 | height: 16px; | 402 | height: 16px; |
403 | display: inline-block; | 403 | display: inline-block; |
404 | vertical-align: top; | 404 | vertical-align: top; |
405 | margin-right: 8px; | 405 | margin-right: 8px; |
406 | } | 406 | } |
407 | + em { | ||
408 | + font-weight: normal; | ||
409 | + } | ||
407 | .favCount { | 410 | .favCount { |
408 | color: #b0b0b0; | 411 | color: #b0b0b0; |
409 | &.coled { | 412 | &.coled { |
@@ -776,6 +776,7 @@ | @@ -776,6 +776,7 @@ | ||
776 | .dt { | 776 | .dt { |
777 | width: 25px; | 777 | width: 25px; |
778 | height: 35px; | 778 | height: 35px; |
779 | + cursor: pointer; | ||
779 | img { | 780 | img { |
780 | width: 25px; | 781 | width: 25px; |
781 | height: 35px; | 782 | height: 35px; |
@@ -895,7 +896,7 @@ | @@ -895,7 +896,7 @@ | ||
895 | .minus { | 896 | .minus { |
896 | position: absolute; | 897 | position: absolute; |
897 | top: 0; | 898 | top: 0; |
898 | - left: 0; | 899 | + left: 1px; |
899 | } | 900 | } |
900 | input { | 901 | input { |
901 | position: absolute; | 902 | position: absolute; |
@@ -917,18 +918,40 @@ | @@ -917,18 +918,40 @@ | ||
917 | font-size: 15px; | 918 | font-size: 15px; |
918 | border: 1px solid #e0e0e0; | 919 | border: 1px solid #e0e0e0; |
919 | } | 920 | } |
920 | - span { | 921 | + .cart-num-btn { |
921 | display: inline-block; | 922 | display: inline-block; |
922 | - width: 31px; | 923 | + width: 30px; |
923 | height: 30px; | 924 | height: 30px; |
925 | + border: 1px solid #e0e0e0; | ||
926 | + background-color: #fff; | ||
924 | cursor: pointer; | 927 | cursor: pointer; |
925 | font-size: 14px; | 928 | font-size: 14px; |
929 | + box-sizing: border-box; | ||
926 | } | 930 | } |
927 | - .minus{ | ||
928 | - background: url(/cart/ico_minus.png); | 931 | + .icon-minus { |
932 | + font-size: 18px; | ||
933 | + display: inline-block; | ||
934 | + vertical-align: middle; | ||
935 | + color: #b4b4b4; | ||
936 | + text-stroke-width: .5px; | ||
937 | + -webkit-text-stroke-width: .5px; | ||
938 | + &:before { | ||
939 | + content:'\e63c'; | ||
940 | + } | ||
929 | } | 941 | } |
930 | - .plus{ | ||
931 | - background: url(/cart/ico_plus.png); | 942 | + .icon-plus { |
943 | + display: inline-block; | ||
944 | + vertical-align: middle; | ||
945 | + font-size: 17px; | ||
946 | + color: #b4b4b4; | ||
947 | + &:before { | ||
948 | + content:'\e644'; | ||
949 | + } | ||
950 | + } | ||
951 | + .disabled { | ||
952 | + i { | ||
953 | + color: rgba(180,180,180,.3); | ||
954 | + } | ||
932 | } | 955 | } |
933 | } | 956 | } |
934 | 957 |
-
Please register or login to post a comment