...
|
...
|
@@ -329,7 +329,7 @@ |
|
|
<ul>
|
|
|
{foreach name="$vo.car" item="c"}
|
|
|
<li>
|
|
|
<div class="radioBox"><input class="commodityCheck" type="checkbox" data-car_id="{$c.id}" data-goods_id="{$c.goods_id}" data-number="{$c.number}" value="{$c.id}"></div>
|
|
|
<div class="radioBox"><input class="commodityCheck" type="checkbox" data-car_id="{$c.id}" data-goods_id="{$c.goods_id}" data-number="{$c.number}" {if condition="$c.is_selected eq 1"}checked{/if} value="{$c.id}"></div>
|
|
|
<div class="borderBox">
|
|
|
<div class="imgBox">
|
|
|
<img src="{$c.goods.thumbnail}" alt="img">
|
...
|
...
|
@@ -560,6 +560,31 @@ |
|
|
$('#checkAll_top').prop('checked', false)
|
|
|
}
|
|
|
checkedAll(this)
|
|
|
var data = [];
|
|
|
for(var i=0;i<$("input[class='commodityCheck']").length;i++){
|
|
|
var obj = {};
|
|
|
var car_id = $("input[class='commodityCheck']").eq(i).attr('data-car_id');
|
|
|
var is_selected = '2';
|
|
|
if($("input[class='commodityCheck']").eq(i).get(0).checked){
|
|
|
is_selected = "1";
|
|
|
};
|
|
|
obj.car_id = car_id;
|
|
|
obj.is_selected = is_selected;
|
|
|
data.push(obj);
|
|
|
}
|
|
|
$.ajax({
|
|
|
url:"{:url('index/car/selected')}",
|
|
|
type:"POST",
|
|
|
data:{'data':data},
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
|
|
|
}
|
|
|
},
|
|
|
error:function(res){
|
|
|
toast('与服务器断开连接');
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//全选、反选
|
...
|
...
|
@@ -570,6 +595,31 @@ |
|
|
$('.shopBox').find('.commodityCheck').prop('checked', false);
|
|
|
}
|
|
|
contTotalPrice();
|
|
|
var data = [];
|
|
|
for(var i=0;i<$("input[class='commodityCheck']").length;i++){
|
|
|
var obj = {};
|
|
|
var car_id = $("input[class='commodityCheck']").eq(i).attr('data-car_id');
|
|
|
var is_selected = '2';
|
|
|
if($("input[class='commodityCheck']").eq(i).get(0).checked){
|
|
|
is_selected = "1";
|
|
|
};
|
|
|
obj.car_id = car_id;
|
|
|
obj.is_selected = is_selected;
|
|
|
data.push(obj);
|
|
|
}
|
|
|
$.ajax({
|
|
|
url:"{:url('index/car/selected')}",
|
|
|
type:"POST",
|
|
|
data:{'data':data},
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
|
|
|
}
|
|
|
},
|
|
|
error:function(res){
|
|
|
toast('与服务器断开连接');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//单个商品选择按钮
|
...
|
...
|
@@ -582,7 +632,43 @@ |
|
|
$('#checkAll_bottom').prop('checked', false);
|
|
|
}
|
|
|
contTotalPrice();
|
|
|
var data = [];
|
|
|
for(var i=0;i<$("input[class='commodityCheck']").length;i++){
|
|
|
var obj = {};
|
|
|
var car_id = $("input[class='commodityCheck']").eq(i).attr('data-car_id');
|
|
|
var is_selected = '2';
|
|
|
if($("input[class='commodityCheck']").eq(i).get(0).checked){
|
|
|
is_selected = "1";
|
|
|
};
|
|
|
obj.car_id = car_id;
|
|
|
obj.is_selected = is_selected;
|
|
|
data.push(obj);
|
|
|
}
|
|
|
$.ajax({
|
|
|
url:"{:url('index/car/selected')}",
|
|
|
type:"POST",
|
|
|
data:{'data':data},
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
|
|
|
}
|
|
|
},
|
|
|
error:function(res){
|
|
|
toast('与服务器断开连接');
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
init();
|
|
|
function init(){
|
|
|
if($('.shopBox ul li').length == $("input[class='commodityCheck']:checked").length){
|
|
|
$('#checkAll_top').prop('checked', true);
|
|
|
$('#checkAll_bottom').prop('checked', true);
|
|
|
}else{
|
|
|
$('#checkAll_top').prop('checked', false);
|
|
|
$('#checkAll_bottom').prop('checked', false);
|
|
|
}
|
|
|
contTotalPrice();
|
|
|
}
|
|
|
|
|
|
//数量减
|
|
|
$('.car-decrease').on('click', function() {
|
...
|
...
|
|