Authored by 梁志锋

购物车修改

@@ -14,6 +14,7 @@ var chosePanel = require('./chose-panel'), @@ -14,6 +14,7 @@ var chosePanel = require('./chose-panel'),
14 var $cartContent = $('.cart-content'); 14 var $cartContent = $('.cart-content');
15 15
16 var navHammer, 16 var navHammer,
  17 + $advanceBuy = $('.advance-buy'),
17 cartType = $('#cartType').val(); 18 cartType = $('#cartType').val();
18 19
19 var hasChecked = $('.cart-goods .icon-cb-checked').length > 0 ? true : false; //是否有选中商品 20 var hasChecked = $('.cart-goods .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
@@ -56,6 +57,10 @@ if ($('.cart-nav').length > 0) { @@ -56,6 +57,10 @@ if ($('.cart-nav').length > 0) {
56 }, 3000); 57 }, 3000);
57 } 58 }
58 59
  60 +$('.advance-buy').on('touchend', function() {
  61 + window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
  62 +});
  63 +
59 $('.btn-balance').on('touchend', function() { 64 $('.btn-balance').on('touchend', function() {
60 if (hasChecked) { 65 if (hasChecked) {
61 window.location.href = '/cart/index/orderEnsure?cartType=' + cartType; 66 window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
@@ -17,9 +17,6 @@ var $chosePanel = $('#chose-panel'), @@ -17,9 +17,6 @@ var $chosePanel = $('#chose-panel'),
17 $num, 17 $num,
18 $chosed, 18 $chosed,
19 $imgsThumb, 19 $imgsThumb,
20 -  
21 - // re = /\d+/,  
22 -  
23 $leftNum, 20 $leftNum,
24 leftNum, 21 leftNum,
25 confirming, 22 confirming,
@@ -31,6 +28,7 @@ var $chosePanel = $('#chose-panel'), @@ -31,6 +28,7 @@ var $chosePanel = $('#chose-panel'),
31 $curSizeBlock, 28 $curSizeBlock,
32 $sizeRowList, 29 $sizeRowList,
33 cbFn, 30 cbFn,
  31 + cartType,
34 $allChoseItems, 32 $allChoseItems,
35 $yohoPage = $('.yoho-page'); 33 $yohoPage = $('.yoho-page');
36 34
@@ -41,10 +39,10 @@ function init() { @@ -41,10 +39,10 @@ function init() {
41 hasChooseColor = false; 39 hasChooseColor = false;
42 hasChooseSize = false; 40 hasChooseSize = false;
43 $curSizeBlock = null; 41 $curSizeBlock = null;
44 - $imgsThumb = $('.chose-panel').find('.thumb'),  
45 - $allChoseItems = $('.chose-items'),  
46 - $sizeRowList = $('.size-list ul'),  
47 - $leftNum = $('#left-num'), 42 + $imgsThumb = $('.chose-panel').find('.thumb');
  43 + $allChoseItems = $('.chose-items');
  44 + $sizeRowList = $('.size-list ul');
  45 + $leftNum = $('#left-num');
48 $firstRow = $sizeRowList.eq(0); 46 $firstRow = $sizeRowList.eq(0);
49 $firstRow.toggleClass('hide'); 47 $firstRow.toggleClass('hide');
50 $curSizeRow = $firstRow; 48 $curSizeRow = $firstRow;
@@ -77,7 +75,7 @@ function show(html, cb) { @@ -77,7 +75,7 @@ function show(html, cb) {
77 //隐藏当前Panel 75 //隐藏当前Panel
78 function hide() { 76 function hide() {
79 $('.chose-panel').hide(); 77 $('.chose-panel').hide();
80 - cbFn = null; 78 + //cbFn = null;
81 } 79 }
82 80
83 //修改加入购物车的文字和背景 81 //修改加入购物车的文字和背景
@@ -168,7 +166,6 @@ $yohoPage.on('touchstart', '.color-list .block', function(e) { @@ -168,7 +166,6 @@ $yohoPage.on('touchstart', '.color-list .block', function(e) {
168 // 之前选中的尺码去掉勾选样式 166 // 之前选中的尺码去掉勾选样式
169 if ($preSiblingBlock.length > 0) { 167 if ($preSiblingBlock.length > 0) {
170 $preSiblingBlock.removeClass('chosed'); 168 $preSiblingBlock.removeClass('chosed');
171 -  
172 } 169 }
173 170
174 curSizeBlock = $curSizeRow.children().get(scindex); 171 curSizeBlock = $curSizeRow.children().get(scindex);
@@ -328,7 +325,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -328,7 +325,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
328 productSku: productSku, 325 productSku: productSku,
329 buyNumber: buyNumber, 326 buyNumber: buyNumber,
330 promotionId: promotionId, 327 promotionId: promotionId,
331 - isEdit: isEdit 328 + isEdit: isEdit,
  329 + cartType: cartType
332 } 330 }
333 }).done(function(res) { 331 }).done(function(res) {
334 loading.hideLoadingMask(); 332 loading.hideLoadingMask();
@@ -338,7 +336,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() { @@ -338,7 +336,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
338 hide(); 336 hide();
339 337
340 if (cbFn) { 338 if (cbFn) {
341 - cbFn(res.location); 339 + cbFn();
342 } 340 }
343 } 341 }
344 if (res.message) { 342 if (res.message) {
@@ -10,7 +10,8 @@ var $ = require('jquery'), @@ -10,7 +10,8 @@ var $ = require('jquery'),
10 loading = require('../plugin/loading'), 10 loading = require('../plugin/loading'),
11 chosePanel = require('./chose-panel'); 11 chosePanel = require('./chose-panel');
12 12
13 -var $page = $('.gift-advance-page'); 13 +var $page = $('.gift-advance-page'),
  14 + queryString = $.queryString();
14 15
15 lazyLoad($('.lazy')); 16 lazyLoad($('.lazy'));
16 17
@@ -24,7 +25,9 @@ function getProductInfo(skn, promotionId) { @@ -24,7 +25,9 @@ function getProductInfo(skn, promotionId) {
24 tip.show('网络错误'); 25 tip.show('网络错误');
25 return; 26 return;
26 } 27 }
27 - chosePanel.show(html); 28 + chosePanel.show(html, function(){
  29 + window.location.href = '/cart/index/orderEnsure?cartType=' + queryString.cartType;
  30 + });
28 }, function() { 31 }, function() {
29 tip.show('网络错误'); 32 tip.show('网络错误');
30 }).always(function() { 33 }).always(function() {
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 <li class="advance-buy"> 25 <li class="advance-buy">
26 <span class="iconfont">&#xe61b;</span> 26 <span class="iconfont">&#xe61b;</span>
27 加价购 27 加价购
28 - <a href="/cart/index/advanceBuy"> 28 + <a href="">
29 <span class="count">{{advanceBuyCount}}</span> 29 <span class="count">{{advanceBuyCount}}</span>
30 <span class="iconfont icon-right-arrow">&#xe614;</span> 30 <span class="iconfont icon-right-arrow">&#xe614;</span>
31 </a> 31 </a>
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 37
38 <ul class="size-row clearfix hide"> 38 <ul class="size-row clearfix hide">
39 {{# size}} 39 {{# size}}
40 - <li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}"> 40 + <li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id="{{id}}" data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
41 {{name}} 41 {{name}}
42 </li> 42 </li>
43 {{/ size}} 43 {{/ size}}