Authored by 姜枫

Merge branch 'feature/cart-remove-invalid' into 'develop'

添加购物车清空实效商品

需求 Redmine :http://redmine.yoho.cn/issues/13043

购物车清空实效商品

See merge request !1
... ... @@ -15,6 +15,7 @@
</div>
<div id="remove_selected" class="action hoverable">删除选中的商品</div>
<div id="send_favorite" class="action hoverable">移入收藏夹</div>
<div id="remove_invalid" class="action hoverable">清除失效商品</div>
<div class="selected-num">已选<span>{{selectedNum}}</span></div>
<div class="checkout-total">
<div class="total-title">商品金额:</div>
... ...
... ... @@ -23,8 +23,8 @@ module.exports = {
cookieDomain: 'yohoblk.com',
domains: {
singleApi: 'http://single.yoho.cn/',
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
search: 'http://search.yohoops.org/yohosearch/'
},
useOneapm: false,
... ...
... ... @@ -63,7 +63,7 @@
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.1.4",
"xss": "^0.2.13",
"yoho-node-lib": "0.0.51"
"yoho-node-lib": "0.2.0"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
... ...
... ... @@ -140,6 +140,10 @@ $(function() {
});
});
$('#remove_invalid').off().on('click', function() {
Cart.removeInvalid();
});
// 变动商品数量
Stepper.init();
});
... ...
... ... @@ -575,6 +575,40 @@ Cart = {
}
}
});
},
/**
* 清除失效商品
*/
removeInvalid: function() {
var invalidEles;
var products = [];
var dialog = new _confirm({
content: '您确定要清除失效商品吗?',
cb: function() {
dialog.close();
invalidEles = $('.invalid-pros ul li.chk');
if (invalidEles.length > 0) {
$(invalidEles).each(function() {
products.push(JSON.parse($(this).attr('data-product_info')));
});
Util.ajax({
url: '/shopping/cart/product/remove',
data: {skuList: JSON.stringify(products)},
type: 'DELETE',
success: function(res) {
Util.refreshCart(res, function() {
});
}
});
} else {
new _alert('购物袋中没有失效商品!').show();
}
}
}).show();
}
};
... ...