|
@@ -329,7 +329,7 @@ |
|
@@ -329,7 +329,7 @@ |
329
|
<ul>
|
329
|
<ul>
|
330
|
{foreach name="$vo.car" item="c"}
|
330
|
{foreach name="$vo.car" item="c"}
|
331
|
<li>
|
331
|
<li>
|
332
|
- <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>
|
332
|
+ <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>
|
333
|
<div class="borderBox">
|
333
|
<div class="borderBox">
|
334
|
<div class="imgBox">
|
334
|
<div class="imgBox">
|
335
|
<img src="{$c.goods.thumbnail}" alt="img">
|
335
|
<img src="{$c.goods.thumbnail}" alt="img">
|
|
@@ -560,6 +560,31 @@ |
|
@@ -560,6 +560,31 @@ |
560
|
$('#checkAll_top').prop('checked', false)
|
560
|
$('#checkAll_top').prop('checked', false)
|
561
|
}
|
561
|
}
|
562
|
checkedAll(this)
|
562
|
checkedAll(this)
|
|
|
563
|
+ var data = [];
|
|
|
564
|
+ for(var i=0;i<$("input[class='commodityCheck']").length;i++){
|
|
|
565
|
+ var obj = {};
|
|
|
566
|
+ var car_id = $("input[class='commodityCheck']").eq(i).attr('data-car_id');
|
|
|
567
|
+ var is_selected = '2';
|
|
|
568
|
+ if($("input[class='commodityCheck']").eq(i).get(0).checked){
|
|
|
569
|
+ is_selected = "1";
|
|
|
570
|
+ };
|
|
|
571
|
+ obj.car_id = car_id;
|
|
|
572
|
+ obj.is_selected = is_selected;
|
|
|
573
|
+ data.push(obj);
|
|
|
574
|
+ }
|
|
|
575
|
+ $.ajax({
|
|
|
576
|
+ url:"{:url('index/car/selected')}",
|
|
|
577
|
+ type:"POST",
|
|
|
578
|
+ data:{'data':data},
|
|
|
579
|
+ success:function(res){
|
|
|
580
|
+ if(res.code == 1){
|
|
|
581
|
+
|
|
|
582
|
+ }
|
|
|
583
|
+ },
|
|
|
584
|
+ error:function(res){
|
|
|
585
|
+ toast('与服务器断开连接');
|
|
|
586
|
+ }
|
|
|
587
|
+ });
|
563
|
});
|
588
|
});
|
564
|
|
589
|
|
565
|
//全选、反选
|
590
|
//全选、反选
|
|
@@ -570,6 +595,31 @@ |
|
@@ -570,6 +595,31 @@ |
570
|
$('.shopBox').find('.commodityCheck').prop('checked', false);
|
595
|
$('.shopBox').find('.commodityCheck').prop('checked', false);
|
571
|
}
|
596
|
}
|
572
|
contTotalPrice();
|
597
|
contTotalPrice();
|
|
|
598
|
+ var data = [];
|
|
|
599
|
+ for(var i=0;i<$("input[class='commodityCheck']").length;i++){
|
|
|
600
|
+ var obj = {};
|
|
|
601
|
+ var car_id = $("input[class='commodityCheck']").eq(i).attr('data-car_id');
|
|
|
602
|
+ var is_selected = '2';
|
|
|
603
|
+ if($("input[class='commodityCheck']").eq(i).get(0).checked){
|
|
|
604
|
+ is_selected = "1";
|
|
|
605
|
+ };
|
|
|
606
|
+ obj.car_id = car_id;
|
|
|
607
|
+ obj.is_selected = is_selected;
|
|
|
608
|
+ data.push(obj);
|
|
|
609
|
+ }
|
|
|
610
|
+ $.ajax({
|
|
|
611
|
+ url:"{:url('index/car/selected')}",
|
|
|
612
|
+ type:"POST",
|
|
|
613
|
+ data:{'data':data},
|
|
|
614
|
+ success:function(res){
|
|
|
615
|
+ if(res.code == 1){
|
|
|
616
|
+
|
|
|
617
|
+ }
|
|
|
618
|
+ },
|
|
|
619
|
+ error:function(res){
|
|
|
620
|
+ toast('与服务器断开连接');
|
|
|
621
|
+ }
|
|
|
622
|
+ });
|
573
|
}
|
623
|
}
|
574
|
|
624
|
|
575
|
//单个商品选择按钮
|
625
|
//单个商品选择按钮
|
|
@@ -582,7 +632,43 @@ |
|
@@ -582,7 +632,43 @@ |
582
|
$('#checkAll_bottom').prop('checked', false);
|
632
|
$('#checkAll_bottom').prop('checked', false);
|
583
|
}
|
633
|
}
|
584
|
contTotalPrice();
|
634
|
contTotalPrice();
|
|
|
635
|
+ var data = [];
|
|
|
636
|
+ for(var i=0;i<$("input[class='commodityCheck']").length;i++){
|
|
|
637
|
+ var obj = {};
|
|
|
638
|
+ var car_id = $("input[class='commodityCheck']").eq(i).attr('data-car_id');
|
|
|
639
|
+ var is_selected = '2';
|
|
|
640
|
+ if($("input[class='commodityCheck']").eq(i).get(0).checked){
|
|
|
641
|
+ is_selected = "1";
|
|
|
642
|
+ };
|
|
|
643
|
+ obj.car_id = car_id;
|
|
|
644
|
+ obj.is_selected = is_selected;
|
|
|
645
|
+ data.push(obj);
|
|
|
646
|
+ }
|
|
|
647
|
+ $.ajax({
|
|
|
648
|
+ url:"{:url('index/car/selected')}",
|
|
|
649
|
+ type:"POST",
|
|
|
650
|
+ data:{'data':data},
|
|
|
651
|
+ success:function(res){
|
|
|
652
|
+ if(res.code == 1){
|
|
|
653
|
+
|
|
|
654
|
+ }
|
|
|
655
|
+ },
|
|
|
656
|
+ error:function(res){
|
|
|
657
|
+ toast('与服务器断开连接');
|
|
|
658
|
+ }
|
|
|
659
|
+ });
|
585
|
});
|
660
|
});
|
|
|
661
|
+ init();
|
|
|
662
|
+ function init(){
|
|
|
663
|
+ if($('.shopBox ul li').length == $("input[class='commodityCheck']:checked").length){
|
|
|
664
|
+ $('#checkAll_top').prop('checked', true);
|
|
|
665
|
+ $('#checkAll_bottom').prop('checked', true);
|
|
|
666
|
+ }else{
|
|
|
667
|
+ $('#checkAll_top').prop('checked', false);
|
|
|
668
|
+ $('#checkAll_bottom').prop('checked', false);
|
|
|
669
|
+ }
|
|
|
670
|
+ contTotalPrice();
|
|
|
671
|
+ }
|
586
|
|
672
|
|
587
|
//数量减
|
673
|
//数量减
|
588
|
$('.car-decrease').on('click', function() {
|
674
|
$('.car-decrease').on('click', function() {
|