<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/html5.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="${pageContext.request.contextPath }/common/css/bootstrap.min-3.3.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->

<style>
#datainit{
 margin-left:5px;
}

</style>
<title>用户管理</title>
</head>
<body>
<nav class="breadcrumb" style="height:45px;padding-top:5px;padding-bottom:5px"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 分销管理 <span class="c-gray en">&gt;</span>分销提现管理 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
	<form action="${pageContext.request.contextPath }/admin/member/listUI" method="post" id="form-admin-add" name="form1">
	<input type="hidden" id="pageNo" value=1 />
	<div > 
		
		<%-- 日期范围：<input readonly="readonly" type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')||\'2020-10-01\'}'})" id="beginDate" name="beginDate" value="${beginDate }" class="input-text Wdate" style="width: 120px;">
		- <input readonly="readonly" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'2020-10-01'})" id="endDate" name="endDate" value="${endDate }" class="input-text Wdate" style="width: 120px;">
		 --%>
		<div class="formControls col-3"><label >申请结果：</label> <span class="select-box" style="width:180px;">
				<select class="select" id="applyStatus" name="status" size="1">
				    <option value=0 class="optionclass" id="optionclass0">请选择</option>
					<option value=1 class="optionclass" id="optionclass1">申请中</option>
					<option value=2 class="optionclass" id="optionclass2">申请成功</option>
					<option value=3 class="optionclass" id="optionclass3">申请失败</option>
				</select>
		 </span>
		</div>
		<input type="text" class="input-text" style="width:200px" placeholder="输入分销商" id="name" name="name">
		日期范围： 
			<input type="text" readonly="readonly" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')||\'2020-10-01\'}'})" id="beginDate"  name="beginDate" class="input-text Wdate" style="width: 120px;">
			- <input type="text" readonly="readonly" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'2020-10-01'})" id="endDate" name="endDate" class="input-text Wdate" style="width: 120px;">
		<input class="btn btn-success round" type="button"   onclick="searchInfo()" value="搜索">
		<button name="" id="submitBtn" onclick="excel()" class="btn btn-success" type="submit">
				<i class="Hui-iconfont"></i>导出Excel
			</button>
	</div>
	</form>
	<!-- <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> <a href="javascript:;" onclick="member_add('添加用户','member-add.html','','510')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加用户</a></span> <span class="r">共有数据：<strong>88</strong> 条</span> </div> -->
	<div class="mt-20">
	<table class="table table-border table-bordered table-hover table-bg table-sort" id="example">
		<thead>
			<tr class="text-c">
			    <th width="100">序号</th>
			    <th width="100">序号</th>
				<th width="100">分销商</th>
				<th width="100">角色</th>
				<th width="100">金额</th>
				<th width="100">收款人</th>
				<th width="100">收款人联系方式</th>
				<th width="100">申请状态</th>
				<th width="130">创建时间</th>
				<th width="50">操作</th>
			</tr>
		</thead>
		<tbody>
			
		</tbody>
	</table>
	</div>
</div>
<div align="right" style="margin-right:20px;margin-top:-40px">
	<ul class="pagination" id="pagination2"></ul>
</div>  

<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/laypage/1.2/laypage.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/js/page/jqPaginator.js"></script>
<script type="text/javascript">
var gobaltable;

$(document).ready(function() {
	gobaltable = $('#example').DataTable({
    /*  "ajax":{
            "url": "/iamberry/admin/drp/initTable",
            "data" : {
                "pageSize":4,
                "pageNumber":2
              },
            "type": "get",
            "error":function(){alert("服务器未正常响应，请重试");}
           
        },   */
        "fnServerData" : function(sSource, aoData, fnCallback) {
        	var json2 ={
                "pageSize":4,
                "pageNumber":parseInt($("#pageNo").val()),
                "condition":{
                	"name":$("#name").val(),
                	"status":$("#applyStatus").val(),
                	"placeId":$("#adminRemarkColor").val(),
                	"beginDate":$("#beginDate").val(),
                	"endDate":$("#endDate").val()
                }
              };
        	
        	//alert(JSON.stringify(json2));
            $.ajax({
              "type" : "post",
              "url" : "/iamberry/admin/drp/withdrawTable",
              "dataType" : "json",
              "contentType": "application/json; charset=utf-8",
              "data" :JSON.stringify(json2),
              "success" : function(resp) {
            	 fnCallback(resp);
            	 var showNo=parseInt(resp.page.pageCount)>5?5:parseInt(resp.page.pageCount);
            	 $("#allCount").html(resp.page.count);
            	 $('#pagination2').jqPaginator('option', {
            		    totalPages: parseInt(resp.page.pageCount),
            		    currentPage: resp.page.pageNumber,
            		    visiblePages: showNo,
            		});
            	 
              }
            });
      
          },
     "dom": "<'#mytool.col-md-2'>",//"<'row' <'col-md-3' ><'col-md-8' >r<'#mytool.col-md-1'> >" ,
     "fnRowCallback": function(nRow, aData, iDisplayIndex) {
    	 if (aData.status == 1) {
             $('td:eq(7)', nRow).html("申请中");
         } else if (aData.status == 2) {
             $('td:eq(7)', nRow).html("申请成功");
         } else {
             $('td:eq(7)', nRow).html("申请失败");
         } 
    	 $('td:eq(4)', nRow).html(aData.withDrawalsNum/100);//计算金额
    	 $('td:eq(0)', nRow).html(iDisplayIndex+1);
    	 
    	 if(aData.status != 1){
    		 $('td:eq(9)', nRow).empty();
    	 }
    	 return nRow;
     },
     "language": {
	        "sProcessing": ""
     },
	"order": [[ 3, "desc" ]],
	"bAutoWidth":false,
	"sPaginationType" : "full_numbers", // 分页，一共两种样式 另一种为two_button // 是datatables默认
    "bProcessing" : true,
    "bServerSide" : true,
	"aoColumns": [
	      {data: null, "title":"序号","defaultContent":"",className: "text-center",orderable:false},
	      { data: "id", "title":"序号","defaultContent":"",className: "text-center hidden"},
	      { data: "name", "title":"分销商","defaultContent":"",className: "text-center"},
	      { data: "roleName", "title":"角色","defaultContent":"",className: "text-center"},
	      { data: "withDrawalsNum", "title":"金额","defaultContent":"",className: "text-center"},
	      { data: "withDrawalsName", "title":"收款人","defaultContent":"",className: "text-center"},
	      { data: "tel", "title":"收款人联系方式","defaultContent":"",className: "text-center"},
	      { data: "status", "title":"申请状态","defaultContent":"",className: "text-center"},
	      { data: "createDate", "title":"创建时间","defaultContent":"",className: "text-center"},
	      { data: "null", "title":"操作","defaultContent":  "<a class=\"text-warning\" href=\"javascript:void(0)\" name=\"updateInfo\" title=\"处理\">处理</a>&nbsp;",
	    	  className: "text-center","sWidth":"120px","orderable":false}
	       ],
	 initComplete:function(){
		$("#mytool").append("<span>共有<label id='allCount'>300</label>条记录</span>");
	}, 
	"rowCallback":function(row,data,index){
		 $('td',row).eq(0).html(index+1);
		}
	});

});
function searchInfo(){
	gobaltable.ajax.reload();
	//alert($("#beginDate").val());
}


//弹出修改页面
$("table").on("click","[name='updateInfo']",function(){
	//alert($(this).parent().parent().children().eq(1).text());
	layer.open({
		  type: 2,
		  area: ['700px', '330px'],
		  fix: false, 
		  maxmin: true,
		  content: '/iamberry/admin/drp/withdrawPaper?id='+$(this).parent().parent().children().eq(1).text()
		});
});


$.jqPaginator('#pagination2', {
    totalPages: 5,
    visiblePages: 0,
    currentPage: 1,
    prev: '<li class="prev"><a href="javascript:;">上一页</a></li>',
    next: '<li class="next"><a href="javascript:;">下一页</a></li>',
    page: '<li class="page"><a href="javascript:;">{{page}}</a></li>',
    onPageChange: function (num, type) {
        $("#pageNo").val(num);
    	gobaltable.ajax.reload();
    }
});


function ajaxSend(url,data){
	$.ajax({
		  url: url,
		  data: data,
		  asyn:false,
		  success: function(data){
			  var obj=eval("("+data+")");
			  alert(obj.message);
			  gobaltable.ajax.reload();
		  },
		  error:function(data){
			  alert("操作失败，可能关联依赖出现问题！");
		  }
		});
	
}

//导出Excel
function excel(){
	document.form1.action='${pageContext.request.contextPath }/admin/drp/downLoadWithdraw';
	document.form1.submit();
}

</script> 
</body>
</html>