...
|
...
|
@@ -20,26 +20,32 @@ var Dialog = dialog.Dialog, |
|
|
RConfirm = rDialog.RConfirm,
|
|
|
RAlert = rDialog.RAlert;
|
|
|
|
|
|
var dialogTpl = require('hbs/cart/cart-togetherGoods.hbs');
|
|
|
|
|
|
var $cartGoodsDetail = $('#goodsTogetherDetail'),
|
|
|
$goodsDetail = $('.detail-goods'),
|
|
|
$payWapper = $('.pay-wapper'),
|
|
|
$goodsChoose = $('#goodsChoose'),
|
|
|
$goodsItem = $('.cart-table li'),
|
|
|
$paySum = $('#pay-sum'),
|
|
|
pacList = 0,
|
|
|
shopNum = 1,
|
|
|
productId,
|
|
|
promotionId,
|
|
|
productnum,
|
|
|
understock,
|
|
|
shopname,
|
|
|
delUrl,
|
|
|
dataJSON,
|
|
|
countJSON,
|
|
|
selectArray,
|
|
|
shopNumAll,
|
|
|
// promotionId,
|
|
|
// productnum,
|
|
|
// understock,
|
|
|
// shopname,
|
|
|
// delUrl,
|
|
|
// dataJSON,
|
|
|
// countJSON,
|
|
|
// selectArray,
|
|
|
// shopNumAll,
|
|
|
confirm,
|
|
|
hasPromotion = false;
|
|
|
|
|
|
var $togetherGoods = $('.individual-item-togetherGoods'),
|
|
|
$recommendGoods = $('.individual-item-recommendGoods'),
|
|
|
$latestWalk = $('.individual-item-latestWalk');
|
|
|
|
|
|
// 优惠券 显示和隐藏
|
|
|
$('.sale-info').mouseenter(function() {
|
|
|
$(this).addClass('active').children('ul').removeClass('none');
|
...
|
...
|
@@ -105,21 +111,10 @@ function cartDel(data, delUrl, cookieList) { |
|
|
);
|
|
|
});*/
|
|
|
|
|
|
// 凑单图片懒加载
|
|
|
var togetherDialog = {};
|
|
|
|
|
|
// var dialogTpl = require('hbs/cart/cart-togetherGoods.hbs');
|
|
|
|
|
|
lazyLoad($('#details-html img'));
|
|
|
|
|
|
|
|
|
// ----------------底部 为你优选,最近浏览 begin--------------
|
|
|
|
|
|
// 推荐、优选、浏览切换
|
|
|
$(function() {
|
|
|
var $togetherGoods = $('.individual-item-togetherGoods'),
|
|
|
$recommendGoods = $('.individual-item-recommendGoods'),
|
|
|
$latestWalk = $('.individual-item-latestWalk');
|
|
|
|
|
|
if ($togetherGoods.hasClass('none')) {
|
|
|
$recommendGoods.show();
|
...
|
...
|
@@ -165,7 +160,6 @@ $(function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
// 凑单 底部 轮播
|
|
|
function loadSlideGoods() {
|
|
|
$.ajax({
|
...
|
...
|
@@ -188,7 +182,7 @@ function loadSlideGoods() { |
|
|
|
|
|
$('.individual-item ').slider2({
|
|
|
shownum: 5,
|
|
|
isCircle: true
|
|
|
isCircle: false
|
|
|
});
|
|
|
|
|
|
// } else {
|
...
|
...
|
@@ -205,6 +199,82 @@ $(function() { |
|
|
});
|
|
|
|
|
|
// ----------------底部 为你优选,最近浏览 end--------------
|
|
|
|
|
|
// ----------------底部 凑单 begin --------------
|
|
|
// 凑单图片懒加载
|
|
|
var togetherDialog = {};
|
|
|
|
|
|
lazyLoad($('#details-html img'));
|
|
|
|
|
|
// 凑单弹框 显示
|
|
|
$('.shop-cart').on('click', '.btn-add-cart', function() {
|
|
|
|
|
|
var tid = $(this).attr('data-together-id');
|
|
|
showPromotion(tid);
|
|
|
|
|
|
});
|
|
|
function showPromotion(id) {
|
|
|
|
|
|
if (!id) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var d = new Dialog({
|
|
|
content: dialogTpl(),
|
|
|
className: 'cart-togetherGoods'
|
|
|
}).show();
|
|
|
|
|
|
d.$el.on('click', '.cut, .add',function() {
|
|
|
count = $(this).hasClass('minus') ? 'decreaseNum' : 'increaseNum';
|
|
|
// if (promotionId) {
|
|
|
if ($(this).hasClass('cut')) {
|
|
|
new Alert('-_-,已经是最后一件,不能再减了!').show();
|
|
|
} else {
|
|
|
new Alert('最多只能购买一件,您好像购买的太多了!').show();
|
|
|
}
|
|
|
// } else {
|
|
|
if ($(this).hasClass('add')) {
|
|
|
shopNum++;
|
|
|
} else {
|
|
|
shopNum--;
|
|
|
}
|
|
|
if (shopNum < 1) {
|
|
|
new Alert('-_-,已经是最后一件,不能在减了!').show();
|
|
|
shopNum = 1;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
$('#num').val(shopNum);
|
|
|
// }
|
|
|
|
|
|
})
|
|
|
}
|
|
|
|
|
|
// $('body').on('click', '.cut, .add', function() {
|
|
|
// count = $(this).hasClass('minus') ? 'decreaseNum' : 'increaseNum';
|
|
|
// // if (promotionId) {
|
|
|
// if ($(this).hasClass('cut')) {
|
|
|
// new Alert('-_-,已经是最后一件,不能再减了!').show();
|
|
|
// } else {
|
|
|
// new Alert('最多只能购买一件,您好像购买的太多了!').show();
|
|
|
// }
|
|
|
// // } else {
|
|
|
// if ($(this).hasClass('add')) {
|
|
|
// shopNum++;
|
|
|
// } else {
|
|
|
// shopNum--;
|
|
|
// }
|
|
|
// if (shopNum < 1) {
|
|
|
// new Alert('-_-,已经是最后一件,不能在减了!').show();
|
|
|
// shopNum = 1;
|
|
|
// return false;
|
|
|
// }
|
|
|
//
|
|
|
// $('#num').val(shopNum);
|
|
|
// // }
|
|
|
//
|
|
|
// })
|
|
|
|
|
|
// 凑单弹框 详情切换
|
|
|
/* $('body').on('click', '.piclist li', function() {
|
|
|
pacList = $(this).index();
|
...
|
...
|
@@ -267,31 +337,6 @@ $('body').on('click', '.showSizeBox span', function() { |
|
|
}
|
|
|
});
|
|
|
|
|
|
$('body').on('click', '.cut, .add', function() {
|
|
|
count = $(this).hasClass('minus') ? 'decreaseNum' : 'increaseNum';
|
|
|
if (promotionId) {
|
|
|
if ($(this).hasClass('cut')) {
|
|
|
new Alert('-_-,已经是最后一件,不能再减了!').show();
|
|
|
} else {
|
|
|
new Alert('最多只能购买一件,您好像购买的太多了!').show();
|
|
|
}
|
|
|
} else {
|
|
|
if ($(this).hasClass('add')) {
|
|
|
shopNum++;
|
|
|
} else {
|
|
|
shopNum--;
|
|
|
}
|
|
|
if (shopNum < 1) {
|
|
|
new Alert('-_-,已经是最后一件,不能在减了!').show();
|
|
|
shopNum = 1;
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
$('#num').val(shopNum);
|
|
|
}
|
|
|
|
|
|
});*/
|
|
|
|
|
|
// 凑单弹框 商品信息弹出框,加入收藏夹
|
|
|
$cartGoodsDetail.on('click', '.btn-favCount', function() {
|
|
|
$.ajax({
|
...
|
...
|
@@ -299,7 +344,7 @@ $cartGoodsDetail.on('click', '.btn-favCount', function() { |
|
|
dataType: 'json',
|
|
|
url: '',
|
|
|
data: {
|
|
|
productId: productId,
|
|
|
// productId: productId,
|
|
|
type: 'add'
|
|
|
}
|
|
|
}).then(function(d) {
|
...
|
...
|
@@ -452,6 +497,9 @@ $goodsChoose.on('click', '.choose-color .dt', function() { |
|
|
});
|
|
|
*/
|
|
|
|
|
|
|
|
|
// ----------------底部 凑单 end --------------
|
|
|
|
|
|
// 结算
|
|
|
$paySum.on('click', '.btn-account', function() {
|
|
|
// 结算
|
...
|
...
|
@@ -513,3 +561,5 @@ $('.shop-cart').on('click', '[data-role="cart-gift-win"] .close', function() { |
|
|
});
|
|
|
|
|
|
require('./cart-action');
|
|
|
|
|
|
|
...
|
...
|
|