/*ajax请求返回数据,模板中的数据处理*/ function QueryGameAsset(){ var new_start_time=$(‘#new_start_time‘).val();//开始时间 var new_end_time=$(‘#new_end_time‘).val();//结束时间 if(!new_start_time||!new_end_time){ alert("时间不能为空"); return false; } $.ajax({ url:‘/StatisticsGame/SettlementStatisticsCount‘, data:{ //req_date:$(‘#datetimepicker1‘).val(), new_start_time:new_start_time,//开始时间 new_end_time:new_end_time,//结束时间 req_game:$("#select_game1").select().val(), get_select_platform:$(‘#select_platform‘).val(), req_mode:search_mode}, type:‘post‘, cache:false, async:true, dataType:‘json‘, success:function(data) { if(data["req"] != "success"){ coverit(); }else{ hidden_coverit(); } $(".asset_table_tr").remove(); if(data["req"] == "success"){ var total_bet = 0; var total_charge=0; var total_revenue=0; var total_prizes=0; for(i = 0; i < data["data"].length; ++i){ //for循环遍历数据输出 var bet=Number(data["data"][i][‘total_bet‘]);//玩家总流水 var charge=Number(data["data"][i][‘total_tips‘]);//玩家总净损 var revenue=Number(data["data"][i][‘revenue‘]);//jackpot购买额 var prizes=Number(data["data"][i][‘prizes‘]);//jackpot中奖额 var date = data["data"][i]["_id"];//日期 var select_platform_name = data["data"][i]["select_platform_name"];//平台名称 var text = ‘<tr class="asset_table_tr"><td>‘+date + ‘</td>‘; total_bet += bet; total_charge +=charge; total_revenue +=revenue; total_prizes+=prizes; text += ‘<td>‘+ select_platform_name + ‘</td>‘; text += ‘<td>‘+ bet +‘</td>‘; text += ‘<td>‘+ bet + ‘</td>‘; text += ‘<td>‘+ revenue + ‘</td>‘; text += ‘<td>‘+ prizes + ‘</td>‘; text += ‘</tr>‘; $("#asset_table").append(text); } /*模板数据遍历结束之后追加数据显示*/ var text1; var str=‘合计‘; var str2=‘\‘; text1 += ‘<tr>‘; text1 += ‘<td>‘+ str + ‘</td>‘; text1 += ‘<td>‘+ str2 + ‘</td>‘; text1 += ‘<td>‘+ total_bet + ‘</td>‘; text1 += ‘<td>‘+ total_charge + ‘</td>‘; text1 += ‘<td>‘+ total_revenue + ‘</td>‘; text1 += ‘<td>‘+ total_prizes + ‘</td>‘; text1 += ‘</tr>‘; $("#asset_table").append(text1); }else{ var error_message=data[‘error_message‘]; alert(error_message); return false; } }, error : function() { } }); }
时间: 2024-10-10 00:06:02