Authored by 郝肖肖

套餐 尺码编辑

... ... @@ -361,18 +361,13 @@ function parseProductInfo(productInfo, defaultInfo) {
};
}
function updateCartItem(newSku, oldSku) {
function updateCartItem(swapData) {
return $.ajax({
type: 'POST',
url: '/cart/cart/updateProduct',
data: {
swapData: JSON.stringify([{
buy_number: '1',
selected: 'Y',
new_product_sku: newSku,
old_product_sku: oldSku
}])
swapData: JSON.stringify([swapData])
}
}).then(function(d) {
if (d.code === 200) {
... ...
... ... @@ -75,11 +75,14 @@ ColorPanelAction = {
var $item = $this.closest('li[data-role="pitem"]');
// var pid = $item.data('pid');
var swapData = {};
var oldSku = $item.data('id');
var $size = $this.closest('.goods-choose-box').find('.choose-size .dt.active');
var newSku = $size.data('sku');
var newSkn = $this.closest('.goods-info').data('skn');
var promotionId = $item.data('promotionid');
var poolId = $item.data('pool-id');
var batchNo = $item.data('batch-no');
// 没有重新选择颜色-尺码,则不用重新请求显示
if (!oldSku || !newSku || oldSku === newSku) {
... ... @@ -91,7 +94,23 @@ ColorPanelAction = {
if ($item.data('isgift') || $item.data('ispricegift')) {
return capi.updateCartGiftItem(promotionId, newSkn, newSku);
}
capi.updateCartItem(newSku, oldSku);
swapData = {
buy_number: '1',
selected: 'Y',
new_product_sku: newSku,
old_product_sku: oldSku
}
// 套餐编辑尺码
if (poolId) {
$.extend(swapData, {
activity_id: poolId,
batch_no: batchNo
});
}
capi.updateCartItem(swapData);
},
_hideColorSizePanel: function($item) {
$item.find('.goods-choose-box').hide();
... ...