Authored by jinhu.tung

check all and uncheck all

... ... @@ -92,15 +92,20 @@ var Cart = {
/*
* 取消全选
* @function [unCheckAllPros]
* @function [toggleCheckAllPros]
*/
unCheckAllPros: function() {
var target;
$('.toggle-chk-item').each(function() {
target = $(this);
target.next().val('');
toggleCheckAllPros: function(checked) {
var data = [],
goodInfo;
$('#cart_content').find('li.chk').each(function(){
goodInfo = $.parseJSON($(this).attr('data-product_info'));
goodInfo.selected = checked;
data.push(goodInfo);
});
Cart.resetCheckAllStyle();
Cart.toggleSelectGoods(data);
},
/*
... ... @@ -187,18 +192,9 @@ var Cart = {
$checkoutBtn.addClass('disable');
if (checkAll) {
Cart.unCheckAllPros();
// TODO
Cart.toggleCheckAllPros('N');
} else {
// TODO
Cart.resetCheckAllStyle();
// $this.next().val('');
// data.push($this.parent().attr('data-product_info'));
// console.log($this.parent().attr('data-product_info'));
// console.log($.parseJSON($this.parent().attr('data-product_info')))
goodInfo = $.parseJSON($this.parent().attr('data-product_info'));
goodInfo.selected = 'N';
data.push(goodInfo);
... ... @@ -207,13 +203,8 @@ var Cart = {
} else {
// 选择
if (checkAll) {
data = { productId: 'ALL' };
// TODO
Cart.toggleCheckAllPros('Y');
} else {
console.log($this.parent().attr('data-product_info'));
// console.log($.parseJSON($this.parent().attr('data-product_info')))
goodInfo = $.parseJSON($this.parent().attr('data-product_info'));
goodInfo.selected = 'Y';
data.push(goodInfo);
... ...