<%@ 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" %>
<!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,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico">
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<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/skin/default/skin.css" rel="stylesheet" type="text/css" id="skin" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/style.css" rel="stylesheet" type="text/css" />

<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>产品列表</title>
</head>
<body>
<!-- 后台备注 -->
<div class="layui-layer layui-anim layui-layer-iframe" id="layui-remark" times="4" showtime="0" contype="string" style="display:none;z-index: 19891018; width: 400px; height: 260px; position: absolute; top: 100px; left: 379px;">
	<form action="" method="post" class="form form-horizontal" id="form-admin-remark">
		<div class="layui-layer-title" id="sendOrderDivTitle" style="cursor: move;" move="ok">订单备注</div>
		<br>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>&nbsp;&nbsp;备注：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="" placeholder="请输入备注信息" id="remarkInfoInput" name="postNum" datatype="*2-16" nullmsg="用户名不能为空">(不超过100字)
			</div>
			<div class="col-4"> </div>
		</div>
		<br>
		<div class="col-9 col-offset-3">
			<input type="hidden" value="" id="atId">
			<input type="hidden" value="" id="atStates">
			<input class="btn btn-primary radius" type="button" onclick="remrakSumbit()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
		</div>
	</form>
	<span class="layui-layer-setwin">
			<a class="layui-layer-ico layui-layer-close layui-layer-close1" onclick="exitWindowsDiv(this)" href="javascript:;"></a>
		</span>
</div>

	<nav class="breadcrumb">
		<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/atLogs/list" method="post">
			<input name="atName" id="atName" value="${atName }" placeholder="姓名" style="width: 150px" class="input-text" type="text">
			<input name="atTel" id="atTel" value="${atTel }" placeholder="电话" style="width: 150px" class="input-text" type="text">
			<select name="atState" id="atState" style="height: 29px;">
				<option value="">提现状态</option>

				<option value="1" <c:if test="${atState == 1}">selected</c:if>>提现申请中</option>
				<option value="2" <c:if test="${atState == 2}">selected</c:if>>提现通过</option>
				<option value="3" <c:if test="${atState == 3}">selected</c:if>>提现驳回</option>
			</select>
			<select name="atType" id="atType" style="height: 29px;">
				<option value="">提现方式</option>
				<option value="1" <c:if test="${atType == 1}">selected</c:if>>银行卡</option>
				<option value="2" <c:if test="${atType == 2}">selected</c:if>>支付宝</option>
			</select>
			<select name="atIsMoney" id="atIsMoney" style="height: 29px;">
				<option value="">打款状态</option>
				<option value="1" <c:if test="${atIsMoney == 1}">selected</c:if>>未打款</option>
				<option value="2" <c:if test="${atIsMoney == 2}">selected</c:if>>已打款</option>
			</select>
			<button name="" id="submitBtn"  class="btn btn-success" type="submit">
				<i class="Hui-iconfont"></i> 搜索
			</button>
		</form>
	<form id="goodsform" >
		<table class="table table-border table-bordered table-bg" id="example">
			<thead>
				<tr>
					<th scope="col" colspan="12">提现列表</th>
				</tr>
				<tr class="text-c">
					<th width="150">提现id</th>
					<th width="100">微信头像</th>

					<th width="130">微信昵称</th>
					<th width="150">客户可用余额</th>
					<th width="90">提现客户姓名</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>
				</tr>
			</thead>
			<tbody>
				<c:if test="${! (empty list) }">
					<c:forEach items="${list }" var="atLogs">
						<tr class="text-c">
							<td>${atLogs.atId }</td>
							<td><img src="${atLogs.userHead }" width="50" height="50"></img></td>
							
							<td>${atLogs.userNickname}</td>
							<td><fmt:formatNumber type="number" value="${atLogs.amonutUsable / 100} " pattern="0.00" maxFractionDigits="2"/></td>

							<td>${atLogs.atName } </td>
							<td>${atLogs.atTel }</td>
							<td>${atLogs.atType==1?'银行卡':''}${atLogs.atType==2?'支付宝':''}</td>
							<td>${atLogs.atType==1?atLogs.atCardNo:''}${atLogs.atType==2?atLogs.atZfb:''}</td>
							<td><fmt:formatNumber type="number" value="${atLogs.atAmonut / 100} " pattern="0.00" maxFractionDigits="2"/></td>
							<td>${atLogs.atState==1?'提现申请中':''}${atLogs.atState==2?'提现通过':''}${atLogs.atState==3?'提现驳回':''}</td>
							<td id=${atLogs.atId }+"td"><c:if test="${not empty atLogs.atIsMoney}">${atLogs.atIsMoney==1?'未打款':''}${atLogs.atIsMoney==2?'已打款':''}</c:if></td>
							<td class="td-manage">
								<c:if test="${atLogs.atState == 1}">
									<a href="#" onclick="toRemrak(${atLogs.atId },2)">审核通过</a><br>
									<a href="#" onclick="toRemrak(${atLogs.atId },3)">审核驳回</a><br>
								</c:if>
								<c:if test="${atLogs.atState == 2}">
									<c:if test="${empty atLogs.atIsMoney}">
										<a href="#" onclick="updateStatus(${atLogs.atId})">标记为已打款</a><br>
									</c:if>
									<a href="#" onclick="toRemrak(${atLogs.atId },3)">客户账户信息错误</a><br>
								</c:if>



							 
							</td>
					</c:forEach>
				</c:if>
			</tbody>
		</table>
		<div align="right" class="mt-10 mb-10 mr-10">
			<%@include file="/common/other/paper/pager.jsp"%>
  		</div>
  		</form>
	</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/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/admin/js/tips.js"></script> 
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/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/js/page/jqPaginator.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/goods/js/utils.js"></script>
	<script type="text/javascript">
//标记为已打款
function updateStatus(id){
	layer.confirm('确认要标记为已打款吗？',function(index){
	$.ajax({
        url: '${pageContext.request.contextPath }/admin/atLogs/update',
        type: "POST",
        dataType: "json",
        data: {atId : id,atIsMoney : 2},
        error:function(data){
      	  layer.msg("标记失败",{icon: 5,time:2000});
        },
        success:  function(data){
      	  layer.msg("标记成功",{icon: 1,time:2000});
      	  $("#"+id+"td").html("已打款");
        }
    });
	})

}
//审核通过/驳回
function toRemrak(atId,atState) {
    $("#layui-remark").show();
    $("#atId").val(atId);
    $("#atStates").val(atState);
}

    // 提交备注
    function remrakSumbit() {
        var atId = $("#atId").val();
        var atState = $("#atStates").val();
        var remarkInfoInput = $("#remarkInfoInput").val();
        if(remarkInfoInput === "" || remarkInfoInput == null){
            layer.msg("请输入备注",{icon:5,time:2000});
			return;
		}
        if (remarkInfoInput.length >= 0 && remarkInfoInput.length <= 100) {
            var args = {"atRemark" : remarkInfoInput, "atId" : atId, "atState" : atState};
            $.ajax({
                type: "POST",
                url: '${pageContext.request.contextPath }/admin/atLogs/update',
                data: args,
                dataType: "json",
                success: function(data){
                    if (data.status) {
                        $("#layui-remark").hide();
                        layer.msg("操作成功",{icon:1,time:2000},function () {
                            $("#remarkInfoInput").val("");
                            window.location.href = '${pageContext.request.contextPath }/admin/atLogs/list';
                        });

                    } else {
                        layer.msg("操作失败，请刷新重试",{icon:5,time:2000});
                        $("#remarkInfoInput").val("");
                    }
                }
            });
        }

    }

    // 关闭窗口
    function exitWindowsDiv(_this) {
        $(_this).parent().parent().hide();
    }

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