...
|
...
|
@@ -38,12 +38,12 @@ function toggleCheckAllPros() { |
|
|
// checkbox提交ajax
|
|
|
function choiceOut(items) {
|
|
|
|
|
|
var skuList = $.isArray(items) ? items: [items];
|
|
|
var skuList = $.isArray(items) ? items : [items];
|
|
|
var hasPromotion = false;
|
|
|
|
|
|
$.each(skuList, function(idx, it){
|
|
|
$.each(skuList, function(idx, it) {
|
|
|
|
|
|
if(it.promotion_id) {
|
|
|
if (it.promotion_id) {
|
|
|
hasPromotion = true;
|
|
|
return false;
|
|
|
}
|
...
|
...
|
@@ -78,11 +78,11 @@ function choiceOut(items) { |
|
|
*/
|
|
|
function cartItemDel(items, type, cookieList) {
|
|
|
|
|
|
var selList = $.isArray(items) ? items: [items];
|
|
|
var selList = $.isArray(items) ? items : [items];
|
|
|
var hasPromotion = false;
|
|
|
|
|
|
$.each(selList, function(idx, it){
|
|
|
if(it.promotion_id) {
|
|
|
$.each(selList, function(idx, it) {
|
|
|
if (it.promotion_id) {
|
|
|
hasPromotion = true;
|
|
|
return false;
|
|
|
}
|
...
|
...
|
@@ -91,7 +91,7 @@ function cartItemDel(items, type, cookieList) { |
|
|
return $.ajax({
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
url: type === true ? CART_ITEM_DEL_URL: CART_ITEM_FAV_URL,
|
|
|
url: type === true ? CART_ITEM_DEL_URL : CART_ITEM_FAV_URL,
|
|
|
data: {
|
|
|
skuList: JSON.stringify(selList),
|
|
|
hasPromotion: hasPromotion
|
...
|
...
|
@@ -122,14 +122,14 @@ function cartItemDel(items, type, cookieList) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
//购物车商品增减
|
|
|
// 购物车商品增减
|
|
|
var cartItemNumChg = (function(data) {
|
|
|
|
|
|
var countBusy = false; // 保证一次只请求完成前不能再次发起
|
|
|
|
|
|
return function(data){
|
|
|
return function(data) {
|
|
|
|
|
|
if(countBusy) {
|
|
|
if (countBusy) {
|
|
|
return;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -147,7 +147,7 @@ var cartItemNumChg = (function(data) { |
|
|
}
|
|
|
countBusy = false;
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
})();
|
|
|
|
|
|
function getProductInfo(pid, skn) {
|
...
|
...
|
@@ -163,7 +163,7 @@ function getProductInfo(pid, skn) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
//加入购物车,弹出框中加入购物车
|
|
|
// 加入购物车,弹出框中加入购物车
|
|
|
function addcart(data, cookieList) {
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
...
|
...
|
@@ -189,6 +189,7 @@ function parseProductInfo(productInfo, defaultInfo) { |
|
|
var colors;
|
|
|
var colorsLen;
|
|
|
var color;
|
|
|
|
|
|
// 前端处理后的集合
|
|
|
var filterSet = [];
|
|
|
|
...
|
...
|
@@ -263,7 +264,7 @@ function renderAndShowSelWin($edit, pinfo) { |
|
|
}
|
|
|
|
|
|
var Cart = {
|
|
|
addToCart: function(params){
|
|
|
addToCart: function(params) {
|
|
|
|
|
|
},
|
|
|
toggleSelectOne: function() { // 单选
|
...
|
...
|
@@ -377,7 +378,7 @@ var Cart = { |
|
|
new Alert('请至少选择一件商品').show();
|
|
|
}
|
|
|
},
|
|
|
toFav: function () {
|
|
|
toFav: function() {
|
|
|
|
|
|
var $this = $(this);
|
|
|
var $item = $this.closest('li[data-role="pitem"]');
|
...
|
...
|
@@ -389,7 +390,7 @@ var Cart = { |
|
|
|
|
|
cartItemDel(item);
|
|
|
},
|
|
|
toFavAll: function(){
|
|
|
toFavAll: function() {
|
|
|
|
|
|
var selectArray = [];
|
|
|
|
...
|
...
|
@@ -471,7 +472,7 @@ var Cart = { |
|
|
new Alert('请至少选择一件商品').show();
|
|
|
}
|
|
|
},
|
|
|
showColorSizePanel: function(){
|
|
|
showColorSizePanel: function() {
|
|
|
|
|
|
var $this = $(this);
|
|
|
var $item = $this.closest('li[data-role="pitem"]');
|
...
|
...
|
@@ -486,18 +487,18 @@ var Cart = { |
|
|
skn: skn
|
|
|
};
|
|
|
|
|
|
if($selWin && $selWin.length && $selWin.is(':visible')) {
|
|
|
if ($selWin && $selWin.length && $selWin.is(':visible')) {
|
|
|
$selWin.hide();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(!pinfo) {
|
|
|
getProductInfo(pid, skn).done(function(productInfo){
|
|
|
if (!pinfo) {
|
|
|
getProductInfo(pid, skn).done(function(productInfo) {
|
|
|
|
|
|
pinfo = parseProductInfo(productInfo, defaultInfo);
|
|
|
$this.data('_p_info', pinfo);
|
|
|
renderAndShowSelWin($this, pinfo);
|
|
|
}).fail(function(){
|
|
|
}).fail(function() {
|
|
|
new Alert('此商品无法编辑颜色和尺寸').show();
|
|
|
});
|
|
|
return;
|
...
|
...
|
@@ -509,7 +510,7 @@ var Cart = { |
|
|
|
|
|
},
|
|
|
submit: function() {
|
|
|
/*understock = '';
|
|
|
/* understock = '';
|
|
|
if ($('.pay-wapper input:checked').parents('tr').find('.tipNoStore').length > 0) {
|
|
|
shopName = $('.pay-wapper input:checked').parents('tr').find('.tipNoStore');
|
|
|
$.each(shopName.parents('tr').find('.pay-pro-info a'), function() {
|
...
|
...
|
@@ -562,7 +563,7 @@ $('.btn_account').on('click', Cart.submit); // 结算 |
|
|
|
|
|
$payWapper.on('click', 'li[data-role="pitem"] .pay-pro-detail', Cart.showColorSizePanel);
|
|
|
|
|
|
/// 绑定颜色尺码弹窗事件 begin
|
|
|
// / 绑定颜色尺码弹窗事件 begin
|
|
|
/*
|
|
|
oldProductSku = editTarget.find('.current').attr('data-sku');
|
|
|
|
...
|
...
|
@@ -645,7 +646,7 @@ editTarget.find('.sizes-list.mb10').each(function() { |
|
|
}
|
|
|
});*/
|
|
|
|
|
|
/// 绑定颜色尺码弹窗事件 end
|
|
|
// / 绑定颜色尺码弹窗事件 end
|
|
|
|
|
|
// 显示赠品
|
|
|
var giftBtn = '[data-role=gift-view-btn],[data-role=gift-resel-btn],[data-role=gift-sel-btn]';
|
...
|
...
|
|