Authored by 郭成尧

bundle-info-to-ensure-cart

@@ -24,5 +24,6 @@ @@ -24,5 +24,6 @@
24 </div> 24 </div>
25 <button id="bundle-buy-now" class="bundle-buy-btn">立即购买</button> 25 <button id="bundle-buy-now" class="bundle-buy-btn">立即购买</button>
26 </div> 26 </div>
  27 + <input type="hidden" id="activityId" value="{{bundleId}}">
27 {{/ bundleInfo}} 28 {{/ bundleInfo}}
28 </div> 29 </div>
@@ -32,13 +32,27 @@ $selectBtn.on('click', function() { @@ -32,13 +32,27 @@ $selectBtn.on('click', function() {
32 * 立即购买 32 * 立即购买
33 */ 33 */
34 $buyNowBtn.on('click', function() { 34 $buyNowBtn.on('click', function() {
  35 + var bundleGoods = [],
  36 + bundleId = $('#activityId').val();
  37 +
35 $('span[id^="gskn"]').each(function() { 38 $('span[id^="gskn"]').each(function() {
36 if (!$(this).data('sku')) { 39 if (!$(this).data('sku')) {
37 tip.show('请为套餐商品选择属性'); 40 tip.show('请为套餐商品选择属性');
38 return; 41 return;
39 } 42 }
40 43
41 - // TODO tar 已经获取到 sku  
42 - console.log($(this).data('skn'), '-', $(this).data('sku')); 44 + bundleGoods.push({
  45 + type: 'bundle',
  46 + sku: $(this).data('sku'),
  47 + buy_number: 1
  48 + });
43 }); 49 });
  50 +
  51 + window.setCookie('bundle-info', JSON.stringify({
  52 + bundleGoods: bundleGoods,
  53 + bundleId: bundleId
  54 + }));
  55 +
  56 + window.location.href = '/cart/index/orderEnsure?cartType=ordinary&bundleId=' +
  57 + bundleId;
44 }); 58 });