Authored by 刘传洋

Merge branch 'feature/shoppingCart' of http://git.yoho.cn/fe/yohobuy-node into feature/shoppingCart

... ... @@ -244,7 +244,7 @@ const checkFav = (req, res) => {
co(function * () {
let uid = req.user.uid;
let pids = req.body.pidList;
let pids = req.body.pidList.split(',');
let ret = {
code: 200,
message: '是否收藏',
... ...
... ... @@ -38,7 +38,8 @@ var $cartGoodsDetail = $('#goodsTogetherDetail'),
selectArray,
shopNumAll,
confirm,
hasPromotion = false;
hasPromotion = false,
$sellBox = $('.cart-table .pre-sell-box');
// 优惠券 显示和隐藏
$('.sale-info').mouseenter(function() {
... ... @@ -198,10 +199,66 @@ function loadSlideGoods() {
}
loadSlideGoods();
$(function() {
$('.bottom-tab .change').click(function() {
$('.img-brand-switch .next').trigger('click');
});
// 判断商品是否已收藏,是否全选
function isCheckFav() {
var pidArray = [],
isAllCheck = true;
$sellBox.each(function() {
var $checkItem = $(this).find('.cart-item-check');
//有一个没选中,跳出循环
if (!$checkItem.hasClass('cart-item-checked')) {
isAllCheck = false;
return false;
}
});
if (isAllCheck) {
//头部全选
$('.cart-title .cart-item-check').addClass('cart-item-checked');
//底部全选
$('#cbSelAllGoods').addClass('cart-item-checked');
}
$sellBox.each(function () {
pidArray.push($(this).data('pid'));
});
$.ajax({
type: 'POST',
url: '/cart/index/checkFav',
data: {
pidList: pidArray.join(',')
}
}).then(function(result) {
$.each(result.data,function(pid,obj) {
if (obj.code !== 200) {
return false;
}
if (obj.data) {
$sellBox.each(function () {
if (String($(this).data('pid')) === String(pid)) {
$(this).find('.cart-col-btn').addClass('has-col-btn').html('已收藏');
return false;
}
});
}
});
});
}
isCheckFav();
});
// ----------------底部 为你优选,最近浏览 end--------------
... ...
... ... @@ -986,6 +986,9 @@
text-align:right;
cursor: pointer;
}
.has-col-btn {
color: #9a9a9a;
}
}
.sub-total {
margin-top: 33px;
... ...