Authored by 郭成尧

bundle-del-edit-select

@@ -50,6 +50,7 @@ @@ -50,6 +50,7 @@
50 <div class="bundle-title"> 50 <div class="bundle-title">
51 <div class="opt"> 51 <div class="opt">
52 <i class="iconfont chk select{{#if goods.0.checked}} checked{{/if}}"></i> 52 <i class="iconfont chk select{{#if goods.0.checked}} checked{{/if}}"></i>
  53 + <i class="iconfont chk edit"></i>
53 {{#if goods.0.inValid}} 54 {{#if goods.0.inValid}}
54 <span class="disable fill-text">失效</span> 55 <span class="disable fill-text">失效</span>
55 {{/if}} 56 {{/if}}
1 <div class="good-item{{#if lowStocks}} low-stocks{{/if}}{{#if isStudents}} is-students{{/if}}{{#if isVipPrice}} is-vip-price{{/if}}{{#ifand checked showCheckbox}} is-checked{{/ifand}}{{#if noEdit}} no-edit{{/if}}{{#if inValid}} in-valid{{/if}}{{#if inValidLow}} in-valid-low{{/if}}{{#ifor isGift isAdvanceBuy}} is-gift{{/ifor}}" data-promotion="{{promotion_id}}" data-id="{{id}}" data-skn="{{skn}}" data-mnum="{{minNumber}}" data-link="{{link}}" data-activityid="{{parent.poolId}}"> 1 <div class="good-item{{#if lowStocks}} low-stocks{{/if}}{{#if isStudents}} is-students{{/if}}{{#if isVipPrice}} is-vip-price{{/if}}{{#ifand checked showCheckbox}} is-checked{{/ifand}}{{#if noEdit}} no-edit{{/if}}{{#if inValid}} in-valid{{/if}}{{#if inValidLow}} in-valid-low{{/if}}{{#ifor isGift isAdvanceBuy}} is-gift{{/ifor}}" data-promotion="{{promotion_id}}" data-id="{{id}}" data-skn="{{skn}}" data-mnum="{{minNumber}}" data-link="{{link}}" data-activityid="{{parent.poolId}}">
2 <div class="opt"> 2 <div class="opt">
3 - {{#unless parent.isBundle}}  
4 {{#if showCheckbox}} 3 {{#if showCheckbox}}
5 <i class="iconfont chk select{{#if checked}} checked{{/if}}"></i> 4 <i class="iconfont chk select{{#if checked}} checked{{/if}}"></i>
6 {{/if}} 5 {{/if}}
7 - {{/unless}}  
8 - {{#unless parent.isBundle}}  
9 <i class="iconfont chk edit"></i> 6 <i class="iconfont chk edit"></i>
10 - {{/unless}}  
11 {{#inValid}} 7 {{#inValid}}
12 <span class="disable fill-text">失效</span> 8 <span class="disable fill-text">失效</span>
13 {{/inValid}} 9 {{/inValid}}
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-04-06 16:51:52 3 * @Date: 2017-04-06 16:51:52
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-04-07 16:49:18 5 + * @Last Modified time: 2017-04-10 11:33:06
6 */ 6 */
7 7
8 const $ = require('yoho-jquery'); 8 const $ = require('yoho-jquery');
@@ -37,9 +37,19 @@ let bundle = { @@ -37,9 +37,19 @@ let bundle = {
37 }, e); 37 }, e);
38 }); 38 });
39 39
  40 + /**
  41 + * 套餐选中/取消
  42 + */
40 $bundle.on('click', '.bundle-title .opt .select', function(e) { 43 $bundle.on('click', '.bundle-title .opt .select', function(e) {
41 self.bundleCheckHandle(e); 44 self.bundleCheckHandle(e);
42 }); 45 });
  46 +
  47 + /**
  48 + * 编辑状态下套餐选中/取消
  49 + */
  50 + $bundle.on('click', '.bundle-title .opt .edit', function(e) {
  51 + self.bundleEditCheckHandle(e);
  52 + });
43 }, 53 },
44 54
45 /** 55 /**
@@ -118,7 +128,24 @@ let bundle = { @@ -118,7 +128,24 @@ let bundle = {
118 loading.hideLoading(); 128 loading.hideLoading();
119 } 129 }
120 }); 130 });
  131 + },
  132 +
  133 + /**
  134 + * 编辑状态下套餐选中/取消
  135 + * @param {*} e
  136 + */
  137 + bundleEditCheckHandle(e) {
  138 + let editCheck = $(e.delegateTarget).find('.edit');
  139 + let goodItem = $(e.delegateTarget).find('.good-item');
  140 +
  141 + if (editCheck.hasClass('checked')) {
  142 + editCheck.removeClass('checked');
  143 + goodItem.find('.opt .edit').removeClass('checked');
  144 + } else {
  145 + editCheck.addClass('checked');
  146 + goodItem.find('.opt .edit').addClass('checked');
121 } 147 }
  148 + },
122 }; 149 };
123 150
124 module.exports = bundle; 151 module.exports = bundle;
@@ -286,7 +286,8 @@ let goodObj = { @@ -286,7 +286,8 @@ let goodObj = {
286 let $this = $(ele), 286 let $this = $(ele),
287 $good = $this.closest('.good-item'), 287 $good = $this.closest('.good-item'),
288 id = $good.data('id'), 288 id = $good.data('id'),
289 - promotion = $good.data('promotion'); 289 + promotion = $good.data('promotion'),
  290 + activity_id = $good.data('activityid');
290 291
291 let goodInfo = {}; 292 let goodInfo = {};
292 293
@@ -299,6 +300,10 @@ let goodObj = { @@ -299,6 +300,10 @@ let goodObj = {
299 goodInfo.product_sku = id; 300 goodInfo.product_sku = id;
300 goodInfo.promotion_id = promotion; 301 goodInfo.promotion_id = promotion;
301 goodInfo.buy_number = $good.find('.good-num').val(); 302 goodInfo.buy_number = $good.find('.good-num').val();
  303 +
  304 + if (activity_id) {
  305 + goodInfo.activity_id = activity_id;
  306 + }
302 return goodInfo; 307 return goodInfo;
303 })); 308 }));
304 309
@@ -170,7 +170,7 @@ $buyNowBtn.on('touchstart', function() { @@ -170,7 +170,7 @@ $buyNowBtn.on('touchstart', function() {
170 170
171 if (result.code === 200) { 171 if (result.code === 200) {
172 setTimeout(function() { 172 setTimeout(function() {
173 - window.location.href = '/cart/index/'; 173 + window.location.href = '/cart/index/index';
174 }, 500); 174 }, 500);
175 } 175 }
176 }, 176 },
1 -.bundle-title { 1 +.bundle > .bundle-title {
2 height: 80px; 2 height: 80px;
3 display: flex; 3 display: flex;
4 overflow: hidden; 4 overflow: hidden;
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 } 38 }
39 } 39 }
40 40
41 -.bundle-nums { 41 +.bundle > .bundle-nums {
42 height: 80px; 42 height: 80px;
43 display: none; 43 display: none;
44 overflow: hidden; 44 overflow: hidden;
@@ -120,6 +120,26 @@ @@ -120,6 +120,26 @@
120 } 120 }
121 } 121 }
122 122
123 -.edit .bundle-nums { 123 +.edit {
  124 + .bundle-title {
  125 + .opt {
  126 + .select {
  127 + display: none;
  128 + }
  129 +
  130 + .edit {
  131 + display: block;
  132 + }
  133 + }
  134 + }
  135 +
  136 + .bundle-nums {
124 display: flex; 137 display: flex;
  138 + }
  139 +}
  140 +
  141 +.bundle > .good-list > .good-item {
  142 + .opt > .chk {
  143 + visibility: hidden;
  144 + }
125 } 145 }