...
|
...
|
@@ -8,7 +8,7 @@ |
|
|
|
|
|
let $ = require('yoho-jquery'),
|
|
|
tip = require('plugin/tip'),
|
|
|
chosePanel = require('../chose-panel'),
|
|
|
chosePanel = require('common/chose-panel-new'),
|
|
|
loading = require('plugin/loading'),
|
|
|
dialog = require('plugin/dialog');
|
|
|
|
...
|
...
|
@@ -303,35 +303,47 @@ let goodObj = { |
|
|
}));
|
|
|
|
|
|
},
|
|
|
showEditPannelWithSku(html, id, isSelected, isEditNum, isGift, e) {
|
|
|
showEditPannelWithSku(data, id, isSelected, isEditNum, promotionId, e) {
|
|
|
let self = this;
|
|
|
|
|
|
if (html.length < 2) {
|
|
|
tip.show('出错啦!');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
// 删掉页面上原有的pannel
|
|
|
chosePanel.remove();
|
|
|
|
|
|
$(html).appendTo('#chose-panel');
|
|
|
|
|
|
|
|
|
chosePanel.init();
|
|
|
chosePanel.setEditModeWithSknId(id, isSelected, isGift);
|
|
|
if (!isEditNum) {
|
|
|
chosePanel.disableNumEdit();
|
|
|
}
|
|
|
|
|
|
chosePanel.show('', (cartGoodData) => {
|
|
|
$(e.delegateTarget).data('id', cartGoodData.new_product_sku);
|
|
|
let goodNum = parseInt($(e.delegateTarget).find('.good-num').val(), 10);
|
|
|
let max = parseInt($(e.delegateTarget).find('.good-num').data('max'), 10);
|
|
|
|
|
|
if (!$(e.delegateTarget).find('.chk.select').hasClass('checked') && goodNum <= max) {
|
|
|
self.selectGood($(e.delegateTarget).find('.chk.select'));
|
|
|
} else {
|
|
|
self.handle.refreshPage();
|
|
|
chosePanel.show({
|
|
|
data,
|
|
|
disableNum: !isEditNum,
|
|
|
buttonText: '确认'
|
|
|
}).then(result => {
|
|
|
if (result && result.sku) {
|
|
|
let goodData = {
|
|
|
new_product_sku: result.sku.skuId,
|
|
|
new_product_skn: result.skn,
|
|
|
old_product_sku: id,
|
|
|
buy_number: result.buyNum,
|
|
|
selected: isSelected,
|
|
|
promotionId,
|
|
|
isEdit: 1
|
|
|
},
|
|
|
url;
|
|
|
|
|
|
if (promotionId) {
|
|
|
url = '/cart/index/new/modifyPriceGift';
|
|
|
} else {
|
|
|
url = '/cart/index/new/modify';
|
|
|
}
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: url,
|
|
|
data: goodData
|
|
|
}).done(function(res) {
|
|
|
if (res && res.code === 200) {
|
|
|
$(e.delegateTarget).data('id', result.sku.skuId);
|
|
|
if (!$(e.delegateTarget).find('.chk.select').hasClass('checked')) {
|
|
|
self.selectGood($(e.delegateTarget).find('.chk.select'));
|
|
|
} else {
|
|
|
self.handle.refreshPage();
|
|
|
}
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
tip.show('网络出了点问题~');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -451,9 +463,7 @@ let goodObj = { |
|
|
},
|
|
|
type: 'POST',
|
|
|
success: function(data) {
|
|
|
let html = require('common/chose-panel.hbs')(data);
|
|
|
|
|
|
self.showEditPannelWithSku(html, id, isSelected, canEditNum, isGift, e);
|
|
|
self.showEditPannelWithSku(data, id, isSelected, canEditNum, promotionId, e);
|
|
|
},
|
|
|
error: function(err) {
|
|
|
tip.show(err.responseJSON ? err.responseJSON.message : '网络异常');
|
...
|
...
|
|