...
|
...
|
@@ -10,6 +10,7 @@ let $ = require('yoho-jquery'), |
|
|
tip = require('js/plugin/tip'),
|
|
|
chosePanel = require('js/common/chose-panel-new'),
|
|
|
loading = require('js/plugin/loading'),
|
|
|
isModify = false,
|
|
|
dialog = require('js/plugin/dialog');
|
|
|
|
|
|
let goodObj = {
|
...
|
...
|
@@ -198,14 +199,17 @@ let goodObj = { |
|
|
return;
|
|
|
}
|
|
|
self.handle.posting = true;
|
|
|
let modeType = isModify ? 1 : 0;
|
|
|
let skuData = self.getSelectGoodData(eles, selectAll);
|
|
|
|
|
|
|
|
|
loading.showLoading();
|
|
|
return $.ajax({
|
|
|
type: 'post',
|
|
|
url: '/cart/index/new/select',
|
|
|
data: {
|
|
|
skuList: JSON.stringify(skuData)
|
|
|
skuList: JSON.stringify(skuData),
|
|
|
modeType: modeType
|
|
|
},
|
|
|
complete: () => {
|
|
|
self.handle.posting = false;
|
...
|
...
|
@@ -317,6 +321,7 @@ let goodObj = { |
|
|
});
|
|
|
},
|
|
|
getSelectGoodData(eles, selectAll) {
|
|
|
|
|
|
return Array.from(eles.map((i, ele) => {
|
|
|
let $this = $(ele),
|
|
|
$good = $this.closest('.good-item'),
|
...
|
...
|
@@ -324,7 +329,6 @@ let goodObj = { |
|
|
promotion = $good.data('promotion'),
|
|
|
batch_no = $good.data('poolbatchno'),
|
|
|
activity_id = $good.data('activityid');
|
|
|
|
|
|
let goodInfo = {};
|
|
|
|
|
|
goodInfo.goods_type = $('#cartType').val();
|
...
|
...
|
@@ -333,6 +337,9 @@ let goodObj = { |
|
|
} else {
|
|
|
goodInfo.selected = $this.hasClass('checked') ? 'N' : 'Y';
|
|
|
}
|
|
|
if ($this.hasClass('presale') && isModify) {
|
|
|
goodInfo.selected = 'N';
|
|
|
}
|
|
|
goodInfo.product_sku = id;
|
|
|
goodInfo.promotion_id = promotion;
|
|
|
goodInfo.buy_number = $good.find('.good-num').val();
|
...
|
...
|
@@ -346,6 +353,7 @@ let goodObj = { |
|
|
if (batch_no) {
|
|
|
goodInfo.batch_no = batch_no;
|
|
|
}
|
|
|
isModify = false;
|
|
|
return goodInfo;
|
|
|
}));
|
|
|
|
...
|
...
|
@@ -392,6 +400,7 @@ let goodObj = { |
|
|
}).done(function(res) {
|
|
|
if (res && res.code === 200) {
|
|
|
$(e.delegateTarget).data('id', result.sku.skuId);
|
|
|
isModify = true;
|
|
|
if (!$(e.delegateTarget).find('.chk.select').hasClass('checked')) {
|
|
|
self.selectGood($(e.delegateTarget).find('.chk.select'));
|
|
|
} else {
|
...
|
...
|
@@ -471,6 +480,7 @@ let goodObj = { |
|
|
goodNum = parseInt($(e.delegateTarget).find('.good-num').val(), 10);
|
|
|
let max = parseInt($(e.delegateTarget).find('.good-num').data('max'), 10);
|
|
|
|
|
|
isModify = true;
|
|
|
if (!$(e.delegateTarget).find('.chk.select').hasClass('checked') && goodNum <= max) {
|
|
|
self.handle.posting = false;
|
|
|
self.selectGood($(e.delegateTarget).find('.chk.select'));
|
...
|
...
|
|