var type="0";
var tempPage=1;
var pageCount=10;
var pageSum=1;
$(document).ready(function(){
	load()
});
function load(){
	tempPage=1;
	getTxSum();
	getTxInfo();
}
//查询总记录数
function getTxSum(){
	$.ajax({
		url:'././fztxManageAction.do?action=getTxSum&uName='+userName+'&pwd='+pwd+'&type='+type+'&r='+Math.random(),
		type:'POST',
		error:function(){alert('系统错误！！！')},
		success:function(w_list){
			var item=eval("("+w_list+")");
			var items=item.items;
			pageSum=Math.ceil(items[0].pageSum/3);
			$('#num_id').text(items[0].pageSum);
			$('#pageSum').text(pageSum);
		}
		
	});
}
//查询记录
function getTxInfo(){
	$.ajax({
		url:'././fztxManageAction.do?action=getTxInfo&uName='+userName+'&pwd='+pwd+'&type='+type+'&pageNum='+tempPage+'&pageCount='+pageCount+'&r='+Math.random(),
		type:'POST',
		error:function(){alert('系统错误！！！')},
		success:function(w_list){
			var item=eval("("+w_list+")");
			var items=item.items;
			$('.contexts').empty();
			for(var i=0;i<items.length;i++){
				var values=items[i].userId+","+items[i].bets+","+items[i].serialNo+","+items[i].applyId+","+items[i].status;
				var tr="<tr><td align='center' class='tab_content'>"+items[i].userNickName+"&nbsp;</td>"+
					"<td align='center' class='tab_content'>"+items[i].accountName+"&nbsp;</td>"+
					"<td align='center' class='tab_content'>"+items[i].bank+"&nbsp;</td>"+
					"<td align='center' class='tab_content'>"+items[i].cardAccount+"&nbsp;</td>"+
					"<td align='center' class='tab_content'>"+items[i].userTel+"&nbsp;</td>"+
					"<td align='center' class='tab_content'>"+items[i].userMob+"&nbsp;</td>"+
					"<td align='center' class='tab_content'>"+items[i].balance+"&nbsp;</td>"+
					"<td align='center' class='tab_content'>"+items[i].applyTime+"&nbsp;</td>"+
					"<td align='center' class='tab_content'>"+items[i].bets+"&nbsp;</td>"+
					"<td align='center' class='tab_content'>"+
					"<a href='javascript:void(0)' onClick='javascript:txCheck(this)' id="+values+" >提现</a>"+
					"</td></tr>";
					$(tr).appendTo($('.contexts'));
			}
		}
		
	});
}
//页数操作
function checkPage(_this){
	if($(_this).attr('id')=='begin'){
		tempPage=1;
	}else if($(_this).attr('id')=='last'){
		tempPage=pageSum;
	}else if($(_this).attr('id')=='back'){
		tempPage=tempPage-1;
	}else{
		tempPage=tempPage+1;
	}
	if(tempPage<=0){
		tempPage=1
		return;
	}
	if(tempPage>=(pageSum+1)){
		tempPage=pageSum;
		return;
	}
	$('#page').text(tempPage);
	getTxInfo();
}
//提现处理
function txCheck(_this){
	if(!confirm("确定提现处理！！！")){
		return;
	}
	var str=$(_this).attr('id').split(",");
	var userId=str[0];
	var bets=str[1];
	var serialNo=str[2];
	var applyId=str[3];
	var status=str[4];
	$.ajax({
		url:'././fztxManageAction.do?action=txCheck&uName='+userName+'&pwd='+pwd+'&userId='+userId+'&bets='+bets+'&serialNo='+serialNo+'&applyId='+applyId+'&status='+status+'&r='+Math.random(),
		type:'POST',
		error:function(){alert('系统错误！！！')},
		success:function(w_list){
			load();
		}
		
	});
}