Authored by 刘传洋

m

... ... @@ -45,6 +45,8 @@ const setShoppingCookie = (req) => {
_r: 1
});
}
}).finally(() => {
return;
});
};
... ... @@ -179,6 +181,11 @@ const modifyProductNum = (req, res, next) => {
return setShoppingCookie().then(() => {
return res.send(ret);
});
} else {
return res.send({
code: 400,
message: '修改购物车商品数量失败!'
});
}
})
.catch(next);
... ...
... ... @@ -15,7 +15,6 @@ const easypay = require(`${cRoot}/easypay`);
const ensure = require(`${cRoot}/order-ensure`);
router.get('/index/getProductInfo', cart.getProductInfo);
router.get('/index/getProductData', cart.getProductData);
router.get('/address/list', address.getList); // 省市区列表信息
router.get('/address/area', address.getArea); // 省市区列表信息
... ... @@ -32,5 +31,13 @@ router.post('/easypay/compute', easypay.compute); // 价格重新计算
router.post('/easypay/submit', easypay.submit); // 限购商品订单提交
router.get('/cart', cart.cart);
router.post('/index/select', cart.selectProduct);
router.post('/index/modifyNum', cart.modifyProductNum);
router.post('/index/add', cart.cartAdd);
router.post('/index/updateProduct', cart.modifyProduct);
router.post('/index/remove', cart.removeProduct);
router.post('/index/fav', cart.moveToFav);
router.post('/index/checkFav', cart.checkFav);
router.get('/index/getProductData', cart.getProductData);
module.exports = router;
... ...
... ... @@ -6,7 +6,6 @@
<div class="dt {{#if focus}} active current-color{{/if}} {{#if disable}} disabled{{/if}}"
data-pic="{{image pic 100 134}}"
data-pid="{{pid}}"
data-
{{!--data-target="{{proId}}-color-{{@index}}"
data-title="{{this.color}}" --}}
data-color="{{name}}" data-total="{{total}}"
... ... @@ -21,7 +20,7 @@
<div class="size-row {{#unless focus}} hide{{/unless}}">
<div class="choose-size-detail">
{{#each sizes}}
<div class="dt active"
<div class="dt {{#if sizeFocus}}active{{/if}}"
{{#unless num}}class="disable"{{/unless}}
data-sku="{{sku}}"
data-num="{{num}}"
... ...
... ... @@ -139,10 +139,10 @@ var cartItemNumChg = (function(data) {
$.ajax({
type: 'POST',
dataType: 'json',
url: '/cart/index/modify',
url: '/cart/index/modifyNum',
data: data
}).then(function(d) {
alert(JSON.stringify(d));
if (d.code === 200) {
window.history.go(0);
} else {
... ... @@ -453,6 +453,7 @@ var Cart = {
var oprType = $this.hasClass('minus') ? 'decreaseNum' : 'increaseNum';
countJSON[oprType] = 1;
if ($this.siblings('input').val() === '1' && $this.hasClass('minus')) {
return false;
}
... ... @@ -520,11 +521,17 @@ var Cart = {
skn: skn
};
$payWapper.find('.pay-pro-detail').removeClass('active');
if ($selWin && $selWin.length && $selWin.is(':visible')) {
$selWin.hide();
return;
}
$item.find('.pay-pro-detail').addClass('active');
$payWapper.find('.goods-choose-box').hide();
if (!pinfo) {
getProductInfo(pid, skn).done(function(productInfo) {
... ...
... ... @@ -403,20 +403,22 @@ $('body').on('click', '.cut, .add', function() {
// 购物车列表 修改 显示隐藏
$goodsItem.on('click', '.pay-pro-detail', function() {
/*$goodsItem.on('click', '.pay-pro-detail', function() {
$('.pay-pro-info').find('span').removeClass('active');
$(this).addClass('active');
$('.goods-choose-box').addClass('none');
$(this).parents('li').children('.goods-choose-box').removeClass('none');
});
});*/
// 购物车列表 修改 颜色
/*
$goodsChoose.on('click', '.choose-color .dt', function() {
pacList = $(this).index();
$('.choose-color').find('.dt').removeClass('active');
$(this).addClass('active');
$('.bigImg').addClass('none').eq($(this).index()).removeClass('none');
});
*/
// 结算
$paySum.on('click', '.btn-account', function() {
... ...