作者 王晓刚
1 个管道 的构建 通过 耗费 11 秒

后无车页面优化

... ... @@ -592,11 +592,12 @@
data:{'goods_id':goods_id,'type':type,'province_id':province_id},
success:function(res){
if(res.code == 1){
var val = parseInt(self.closest('li').find('.contInput').val());
var val = parseFloat(self.closest('li').find('.contInput').val());
(val===1)?1:(val--);
$(self.closest('li').find('.contInput')[0]).val(val);
contPrice(self, val);
toast('操作成功');
contTotalPrice();
// toast('操作成功');
}else{
toast(res.msg);
}
... ... @@ -618,7 +619,7 @@
data:{'goods_id':goods_id,'type':type,'province_id':province_id},
success:function(res){
if(res.code == 1){
var val = parseInt(self.closest('li').find('.contInput').val());
var val = parseFloat(self.closest('li').find('.contInput').val());
val++;
$(self.closest('li').find('.contInput')[0]).val(val);
contPrice(self, val);
... ... @@ -635,7 +636,7 @@
//计算小计
function contPrice(_this, val){
var unitPrice = parseInt($($(_this).closest('li').find('.unitPriceBox')[0]).html().split('¥')[1]);
var unitPrice = parseFloat($($(_this).closest('li').find('.unitPriceBox')[0]).html().split('¥')[1]);
$($(_this).closest('li').find('.subtotalBox')[0]).html('¥' + (unitPrice * val).toFixed(2));
contTotalPrice();
}
... ... @@ -647,13 +648,13 @@
var totalFreight = 0;
/*for(var i=0;i<$('.shopBox ul li').length;i++){
if($($('.shopBox ul li')[i]).find('.commodityCheck')[0].checked==true){
var subtotalNum = parseInt($($('.shopBox ul li')[i]).find('.contInput').val());
var subtotalNum = parseFloat($($('.shopBox ul li')[i]).find('.contInput').val());
totalCount += subtotalNum;
var subtotal = parseInt($($('.shopBox ul li')[i]).find('.subtotalBox').html().split('¥')[1]);
var subtotal = parseFloat($($('.shopBox ul li')[i]).find('.subtotalBox').html().split('¥')[1]);
var freight = parseInt($($('.shopBox')[i]).attr('data-freight'));//运费
var free_freight = parseInt($($('.shopBox')[i]).attr('data-free_freight'));//满免运费
var freight = parseFloat($($('.shopBox')[i]).attr('data-freight'));//运费
var free_freight = parseFloat($($('.shopBox')[i]).attr('data-free_freight'));//满免运费
if(subtotal < free_freight){
subtotal += freight;
}
... ... @@ -664,14 +665,14 @@
}
}*/
for(var i1=0;i1<$('.shopBox').length;i1++){
var freight = parseInt($($('.shopBox')[i1]).attr('data-freight'));//运费
var free_freight = parseInt($($('.shopBox')[i1]).attr('data-free_freight'));//满免运费
var freight = parseFloat($($('.shopBox')[i1]).attr('data-freight'));//运费
var free_freight = parseFloat($($('.shopBox')[i1]).attr('data-free_freight'));//满免运费
for(var i2=0;i2<$('.shopBox').eq(i1).find('ul li').length;i2++){
if($('.shopBox').eq(i1).find('ul li').eq(i2).find('.commodityCheck')[0].checked==true) {
var subtotalNum = parseInt($('.shopBox').eq(i1).find('ul li').eq(i2).find('.contInput').val());
var subtotalNum = parseFloat($('.shopBox').eq(i1).find('ul li').eq(i2).find('.contInput').val());
totalCount += subtotalNum;
var subtotal = parseInt($('.shopBox').eq(i1).find('ul li').eq(i2).find('.subtotalBox').html().split('¥')[1]);
var subtotal = parseFloat($('.shopBox').eq(i1).find('ul li').eq(i2).find('.subtotalBox').html().split('¥')[1]);
totalPrice += subtotal;
}
}
... ...