var postData=[],obj,list; obj = !!obj ? obj : $(‘#dist_meici_checkinfo_form‘); obj.find(‘.dist_meici_product‘).each(function(i) { var ids={},quantity,quantityData,price,priceData,sku_id; quantity = $(this).find("[name=‘quantity[]‘]").attr(‘data-value‘); quantityData= $(this).find("[name=‘quantity[]‘]").val(); price = $(this).find("[name=‘price[]‘]").attr(‘data-value‘); priceData= $(this).find("[name=‘price[]‘]").val(); sku_id = $(this).find("[name=‘sku_id[]‘]").val(); if(quantity !== quantityData){ ids.quantity = quantityData; } if(price !== priceData){ ids.price = priceData; } console.log(ids); if(ids.price || ids.quantity){ ids.sku_id = sku_id; postData.push(ids); }else{ alert(‘您没有进行修改‘); return true; } //if($(this).find(‘i.checkable‘).hasClass(‘icon-checked‘)){ ids.push($(this).attr(‘data-id‘)); } }); if(postData && postData.length > 0){ list = JSON.stringify(postData); }else{ confirm(‘您没有进行修改‘);return; } console.log(list); $.postJ(‘/dist/meici/editdata‘,{data:list,dosubmit:1},function(json) { if(!!json.status) alert(1) });
时间: 2024-10-06 08:24:08