Authored by 郭成尧

bundle-del-edit-select

... ... @@ -50,6 +50,7 @@
<div class="bundle-title">
<div class="opt">
<i class="iconfont chk select{{#if goods.0.checked}} checked{{/if}}"></i>
<i class="iconfont chk edit"></i>
{{#if goods.0.inValid}}
<span class="disable fill-text">失效</span>
{{/if}}
... ...
<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}}">
<div class="opt">
{{#unless parent.isBundle}}
{{#if showCheckbox}}
<i class="iconfont chk select{{#if checked}} checked{{/if}}"></i>
{{/if}}
{{/unless}}
{{#unless parent.isBundle}}
<i class="iconfont chk edit"></i>
{{/unless}}
{{#inValid}}
<span class="disable fill-text">失效</span>
{{/inValid}}
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-04-06 16:51:52
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-07 16:49:18
* @Last Modified time: 2017-04-10 11:33:06
*/
const $ = require('yoho-jquery');
... ... @@ -37,9 +37,19 @@ let bundle = {
}, e);
});
/**
* 套餐选中/取消
*/
$bundle.on('click', '.bundle-title .opt .select', function(e) {
self.bundleCheckHandle(e);
});
/**
* 编辑状态下套餐选中/取消
*/
$bundle.on('click', '.bundle-title .opt .edit', function(e) {
self.bundleEditCheckHandle(e);
});
},
/**
... ... @@ -118,7 +128,24 @@ let bundle = {
loading.hideLoading();
}
});
}
},
/**
* 编辑状态下套餐选中/取消
* @param {*} e
*/
bundleEditCheckHandle(e) {
let editCheck = $(e.delegateTarget).find('.edit');
let goodItem = $(e.delegateTarget).find('.good-item');
if (editCheck.hasClass('checked')) {
editCheck.removeClass('checked');
goodItem.find('.opt .edit').removeClass('checked');
} else {
editCheck.addClass('checked');
goodItem.find('.opt .edit').addClass('checked');
}
},
};
module.exports = bundle;
... ...
... ... @@ -286,7 +286,8 @@ let goodObj = {
let $this = $(ele),
$good = $this.closest('.good-item'),
id = $good.data('id'),
promotion = $good.data('promotion');
promotion = $good.data('promotion'),
activity_id = $good.data('activityid');
let goodInfo = {};
... ... @@ -299,6 +300,10 @@ let goodObj = {
goodInfo.product_sku = id;
goodInfo.promotion_id = promotion;
goodInfo.buy_number = $good.find('.good-num').val();
if (activity_id) {
goodInfo.activity_id = activity_id;
}
return goodInfo;
}));
... ...
... ... @@ -170,7 +170,7 @@ $buyNowBtn.on('touchstart', function() {
if (result.code === 200) {
setTimeout(function() {
window.location.href = '/cart/index/';
window.location.href = '/cart/index/index';
}, 500);
}
},
... ...
.bundle-title {
.bundle > .bundle-title {
height: 80px;
display: flex;
overflow: hidden;
... ... @@ -38,7 +38,7 @@
}
}
.bundle-nums {
.bundle > .bundle-nums {
height: 80px;
display: none;
overflow: hidden;
... ... @@ -120,6 +120,26 @@
}
}
.edit .bundle-nums {
display: flex;
.edit {
.bundle-title {
.opt {
.select {
display: none;
}
.edit {
display: block;
}
}
}
.bundle-nums {
display: flex;
}
}
.bundle > .good-list > .good-item {
.opt > .chk {
visibility: hidden;
}
}
... ...