Authored by yyq

mini bag 删除商品

@@ -76,6 +76,39 @@ $('.yoho-group a').hover(function() { @@ -76,6 +76,39 @@ $('.yoho-group a').hover(function() {
76 $(this).text(data.en); 76 $(this).text(data.en);
77 }); 77 });
78 78
  79 +$bagGoodsList.on('click', '.del-good-btn', function() {
  80 + var $this = $(this),
  81 + data = $this.data();
  82 + var list = [];
  83 +
  84 + if (!data) {
  85 + return;
  86 + }
  87 +
  88 + list.push({
  89 + goods_type: data.type,
  90 + buy_number: data.num,
  91 + selected: 'Y',
  92 + product_sku: data.sku,
  93 + promotion_id: data.pid
  94 + });
  95 + $.ajax({
  96 + type: 'DELETE',
  97 + url: '/shopping/cart/product/remove',
  98 + data: {skuList: JSON.stringify(list)},
  99 + success: function(result) {
  100 + var num = parseInt($bagNum.text(), 10) || 0;
  101 +
  102 + if (result.code === 200) {
  103 + num = num - data.num;
  104 + $bagNum.text(num);
  105 + $this.closest('.goods-item').remove();
  106 + }
  107 + }
  108 + });
  109 +
  110 +});
  111 +
79 $('.contain-third').on({ 112 $('.contain-third').on({
80 mouseenter: function() { 113 mouseenter: function() {
81 var $thirdWrapper = $(this).children('.third-nav-wrapper'); 114 var $thirdWrapper = $(this).children('.third-nav-wrapper');
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 </div> 11 </div>
12 <div class="price"> 12 <div class="price">
13 <p>¥{{round sales_price 2}} X{{buy_number}}</p> 13 <p>¥{{round sales_price 2}} X{{buy_number}}</p>
14 - <span class="del-good-btn">删除</span> 14 + <span class="del-good-btn" data-type="{{goods_type}}" data-num="{{buy_number}}" data-num="{{buy_number}}" data-sku="{{product_sku}}" data-pid="{{promotion_id}}">删除</span>
15 </div> 15 </div>
16 </dd> 16 </dd>
17 {{/ goods}} 17 {{/ goods}}