...
|
...
|
@@ -2,7 +2,7 @@ |
|
|
* @Author: Targaryen
|
|
|
* @Date: 2017-04-06 16:51:52
|
|
|
* @Last Modified by: Targaryen
|
|
|
* @Last Modified time: 2017-04-06 17:38:12
|
|
|
* @Last Modified time: 2017-04-07 13:34:40
|
|
|
*/
|
|
|
|
|
|
const $ = require('yoho-jquery');
|
...
|
...
|
@@ -13,15 +13,15 @@ let bundle = { |
|
|
init(handle) {
|
|
|
let self = this;
|
|
|
|
|
|
let $bundleNum = $('.bundle-nums'); // 限定作用域
|
|
|
let activityId = $bundleNum.data('activityid');
|
|
|
let $bundle = $('.bundle'); // 限定作用域
|
|
|
let activityId = $bundle.data('activityid');
|
|
|
|
|
|
self.handle = handle;
|
|
|
|
|
|
/**
|
|
|
* 减少套餐数量
|
|
|
*/
|
|
|
$bundleNum.on('click', '.num-opt .btn-opt-minus', function(e) {
|
|
|
$bundle.on('click', '.bundle-nums .num-opt .btn-opt-minus', function(e) {
|
|
|
self.decrBundle({
|
|
|
activity_id: activityId
|
|
|
}, e);
|
...
|
...
|
@@ -30,11 +30,15 @@ let bundle = { |
|
|
/**
|
|
|
* 增加套餐数量
|
|
|
*/
|
|
|
$bundleNum.on('click', '.num-opt .btn-opt-plus', function(e) {
|
|
|
$bundle.on('click', '.bundle-nums .num-opt .btn-opt-plus', function(e) {
|
|
|
self.incrBundle({
|
|
|
activity_id: activityId
|
|
|
}, e);
|
|
|
});
|
|
|
|
|
|
$bundle.on('click', '.bundle-title .opt .select', function(e) {
|
|
|
self.bundleCheckHandle(e);
|
|
|
});
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -76,6 +80,36 @@ let bundle = { |
|
|
}
|
|
|
});
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 套餐选中
|
|
|
* @param {*} e
|
|
|
*/
|
|
|
bundleCheckHandle(e) {
|
|
|
$(e.delegateTarget).find('.select').toggleClass('checked');
|
|
|
let goodItem = $(e.delegateTarget).find('.good-item');
|
|
|
let skuData = [];
|
|
|
|
|
|
goodItem.each(function(index, element) {
|
|
|
skuData.push({
|
|
|
product_sku: $(element).data('id'),
|
|
|
buy_number: $(element).data('mnum'),
|
|
|
activity_id: $(e.delegateTarget).data('activityid'),
|
|
|
selected: 'Y'
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'post',
|
|
|
url: '/cart/index/new/select',
|
|
|
data: {
|
|
|
skuList: JSON.stringify(skuData)
|
|
|
},
|
|
|
success: function(result) {
|
|
|
console.log(result);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
module.exports = bundle; |
...
|
...
|
|