<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>充值管理</title>
<meta
	content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'
	name='viewport'>
<!-- bootstrap 3.0.2 -->
<link href="<c:url value='/styles/lib/bootstrap.min.css'/>" rel="stylesheet" type="text/css" />
<!-- font Awesome -->
<link href="<c:url value='/styles/lib/font-awesome.min.css'/>" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href='<c:url value='/styles/lib/ionicons.min.css' />' rel="stylesheet" type="text/css" />
<!-- DATA TABLES -->
<link href="<c:url value='/styles/lib/datatables/dataTables.bootstrap.css' />" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="${ctx}/plugin/layer/mobile/need/layer.css" />
<script type="text/javascript" src="${ctx}/scripts/bootstrap.min.js/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/My97DatePicker/WdatePicker.js'/>" ></script>
<script type="text/javascript" src="${ctx}/plugin/layer/layer.js"></script>
<script type="text/javascript" src="${ctx}/scripts/admin/product/recharge.js"></script>
<script type="text/javascript">
//翻页
function goPage(pageNo){
	if(pageNo=="gopage"){
		$("#pageNo").val($("#gopage").val());
	}else{
		$("#pageNo").val(pageNo);
	}
	$("#conditionform").submit();
}
</script>
</head>
<body>
	<section class="content">
		<div class="row">
			<div class="col-xs-12">
				<div class="boxlist">
					<!-- /.box-header -->
					<div class="box-body table-responsive">
						<!-- 查询条件 -->
						<form class="query_frame form-inline" role="form" action="../recharge/queryRechargeList"
							id="conditionform" method="POST">
							<input type="hidden" value="${pageNo}" id="pageNo" name="pageNo"/>
							<div class="form-group">
								<label for="">类型</label> <select id="type" name="type"><option value="">--请选择--</option>
									<option value="0" <c:if test="${type == '0'}">selected="selected"</c:if>>流量</option>
									<option value="1" <c:if test="${type == '1'}">selected="selected"</c:if>>话费</option>
									<option value="MGTV" <c:if test="${type == 'MGTV'}">selected="selected"</c:if>>芒果会员</option>
									<option value="AIQIYI" <c:if test="${type == 'AIQIYI'}">selected="selected"</c:if>>爱奇艺会员</option>
									<option value="YOUKU" <c:if test="${type == 'YOUKU'}">selected="selected"</c:if>>优酷会员</option>
									<option value="QQTV" <c:if test="${type == 'QQTV'}">selected="selected"</c:if>>腾讯vip会员</option>
									<option value="PPTV" <c:if test="${type == 'PPTV'}">selected="selected"</c:if>>PPTV聚力会员</option>
									<option value="SOHU" <c:if test="${type == 'SOHU'}">selected="selected"</c:if>>搜狐黄金会员</option>
									<option value="LETV" <c:if test="${type == 'LETV'}">selected="selected"</c:if>>乐视影视会员</option>
									<option value="SINOPEC" <c:if test="${type == 'SINOPEC'}">selected="selected"</c:if>>中石化</option>
								</select>
							</div>
							<div class="form-group">
								<label for="">充值状态</label> <select id="status" name="status"><option value="">--请选择--</option>
									<option value="-1" <c:if test="${status == '-1'}">selected="selected"</c:if>>未支付</option>
									<option value="0" <c:if test="${status == '0'}">selected="selected"</c:if>>充值中</option>
									<option value="1" <c:if test="${status == '1'}">selected="selected"</c:if>>充值成功</option>
									<option value="2" <c:if test="${status == '2'}">selected="selected"</c:if>>充值失败</option>
								</select>
							</div>
							<div class="form-group">
								<label for="">支付状态</label> <select id="payStatus" name="payStatus"><option value="">--请选择--</option>
									<option value="-1" <c:if test="${payStatus == '-1'}">selected="selected"</c:if>>未支付</option>
									<option value="0" <c:if test="${payStatus == '0'}">selected="selected"</c:if>>支付成功</option>
									<option value="1" <c:if test="${payStatus == '1'}">selected="selected"</c:if>>支付失败</option>
								</select>
							</div>
							<div class="form-group">
								<label for="">开始时间</label> <input name="startTime"
									id="startTime" value="${startTime}" type="text"
									onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
									class="Wdate2 {required:true}"
									style="width: 120px; height: 35px;" />
							</div>
							--
							<div class="form-group">
								<input name="endTime" id="endTime" value="${endTime}"
									type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
									class="Wdate2 {required:true}"
									style="width: 120px; height: 35px;" />
							</div>
							<div class="form-group">
				                <label for="">关键字</label> <input type="text" id="mobile" width="60px"
									name="mobile" value="${mobile}" placeholder="充值号码/产品名称/充值订单号/微信支付订单号" />
				            </div> 
						</form>
					</div>
					<!-- 按钮组 -->
					<div class="btns" style="float: right;">
						<input type="button" id="btn-search" class="btn btn-info"
							value="查询" />
						<input type="button" id="recharegeAll" class="btn btn-info"
							value="充值" />
						<input type="button" id="drawbackAll" class="btn btn-info"
							value="退款" />
						<input type="button" onclick="exportRecharge()" class="btn btn-info"
							value="导出" />
					</div>
					<div style="width: 100%; overflow: auto;">
						<table class="table table-bordered table-hover">
						<thead>
							<tr>
							<th><input name="all" id="all" type="checkbox" value="" /></th>
							<th nowrap="nowrap">产品</th>
							<th nowrap="nowrap">充值号码</th>
							<th nowrap="nowrap">产品类型</th>
							<th nowrap="nowrap">充值状态</th>
							<th nowrap="nowrap">价格</th>
							<th nowrap="nowrap">支付状态</th>
							<th nowrap="nowrap">购买份数</th>
							<th nowrap="nowrap">充值订单号</th>
							<th nowrap="nowrap">微信支付订单号</th>
							<th nowrap="nowrap">订单创建时间</th>
							<th nowrap="nowrap">充值成功时间</th>
							<th nowrap="nowrap">退款状态</th>
							<th nowrap="nowrap">退款时间</th>
							<th nowrap="nowrap">所属校区</th>
							<th nowrap="nowrap">所属企业</th>
							<th nowrap="nowrap">操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${page.items}" var="list" varStatus="status">
							<tr>
								<td nowrap="nowrap">
									<c:choose>
										<c:when test="${(list.status=='0'||list.status=='2')&&list.payStatus=='0'&&list.refundStatus!='1' }">
											<input id="cbIds"+${list.outTradeNo} type="checkbox" value="${list.outTradeNo}" name="cbIds" productId="${list.productId}" />
										</c:when>
									</c:choose>
								</td>
								<td nowrap="nowrap">${list.productName}</td>
								<td nowrap="nowrap" title="运营商：${list.carrieroperator}，归属地：${list.province}，产品价格：${list.productPrice}">${list.mobile}</td>
								<td nowrap="nowrap">
									<c:if test="${list.type == '0'}">流量</c:if>
									<c:if test="${list.type == '1'}">话费</c:if>
									<c:if test="${list.type == 'MGTV'}">芒果会员</c:if>
									<c:if test="${list.type == 'AIQIYI'}">爱奇艺会员</c:if>
									<c:if test="${list.type == 'YOUKU'}">优酷会员</c:if>
									<c:if test="${list.type == 'QQTV'}">腾讯vip会员</c:if>
									<c:if test="${list.type == 'PPTV'}">PPTV聚力会员</c:if>
									<c:if test="${list.type == 'SOHU'}">搜狐黄金会员</c:if>
									<c:if test="${list.type == 'LETV'}">乐视影视会员</c:if>
									<c:if test="${list.type == 'SINOPEC'}">中石化</c:if>
								</td>
								<td nowrap="nowrap">
									<c:if test="${list.status == -1}">初始</c:if>
									<c:if test="${list.status == 0}">充值中</c:if>
									<c:if test="${list.status == 1}">充值成功</c:if>
									<c:if test="${list.status == 2}">充值失败</c:if>
								</td>
								<td nowrap="nowrap">${list.price}</td>
								<td nowrap="nowrap">
									<c:if test="${list.payStatus == -1}">未支付</c:if>
									<c:if test="${list.payStatus == 0}">支付成功</c:if>
									<c:if test="${list.payStatus == 1}">支付失败</c:if>
								</td>
								<td nowrap="nowrap">
									<c:if test="${list.amount == null || list.amount == ''}">1</c:if>
									<c:if test="${list.amount != null && list.amount != ''}">${list.amount}</c:if>
								</td>
								<td>${list.outTradeNo}</td>
								<td nowrap="nowrap">${list.transactionId}</td>
								<td nowrap="nowrap">${list.createTime}</td>
								<td nowrap="nowrap">
									<c:if test="${list.recharTime == null || list.recharTime == ''}">--</c:if>
									<c:if test="${list.recharTime != '' && list.recharTime != null}">${list.recharTime}</c:if>
								</td>
								<td nowrap="nowrap">
									<c:if test="${list.refundStatus == null || list.refundStatus == ''}">--</c:if>
									<c:if test="${list.refundStatus == 1}">退款成功</c:if>
									<c:if test="${list.refundStatus == 2}">退款失败</c:if>
								</td>
								<td nowrap="nowrap">
									<c:if test="${list.refundTime == null || list.refundTime == ''}">--</c:if>
									<c:if test="${list.refundTime != null && list.refundTime != ''}">${list.refundTime}</c:if>
								</td>
								<td nowrap="nowrap">
									<c:if test="${list.oname == null || list.oname == ''}">--</c:if>
									<c:if test="${list.oname != null && list.oname != ''}">${list.oname}</c:if>
								</td>
								<td nowrap="nowrap">
									<c:if test="${list.vname == null || list.vname == ''}">--</c:if>
									<c:if test="${list.vname != null && list.vname != ''}">${list.vname}</c:if>
								</td>
								<td nowrap="nowrap">
									<c:choose>
										<c:when test="${(list.status=='0'||list.status=='2')&&list.payStatus=='0'&&list.refundStatus!='1' }">
											<a href="javascript:recharege('${list.outTradeNo}','${list.productId}')" class="btn-table btn-red" title="手动充值">手动充值</a>
											<a href="javascript:drawback('${list.outTradeNo}','${list.transactionId}')" class="btn-table btn-red" title="退款">手动退款</a>
										</c:when>
										<c:otherwise>
											<a href="javascript:void(0)" class="btn-table btn-red" title="无法操作">--</a>
										</c:otherwise>
									</c:choose>
								</td>
							</tr>
						</c:forEach>
					</tbody>
					</table>
					</div>
					
					<div class="btn-page">
		                    <!-- 页码 -->
		                    <div align="center" class="pages clearfix">
		                           <c:forEach items="${page.iterPages }" var="pageNo">
									<c:choose>
										<c:when test="${pageNo == page.currentPage }">
											<span class='current'>${pageNo }</span>
										</c:when>
										<c:when test="${pageNo != null}">
											<a href="javascript:void(0);" onclick='goPage(${pageNo});'>${pageNo}</a>
										</c:when>
										<c:otherwise>
											<em>...</em>
										</c:otherwise>
									</c:choose>
								</c:forEach>
								<strong>共<span style="color:black;font-weight:bold;font-size:16px;">${page.totalCount}</span>条</strong>
								<strong>跳转到第</strong><input type="text" id="gopage" style="width: 40px;" onkeyup="this.value=this.value.replace(/\D/g,'')" onkeypress="this.value=this.value.replace(/\D/g,'')"/><strong>页</strong>
								<a class="btn-sm btn-success" href="javascript:goPage('gopage');" id='bindBtn'>确定</a>
		                	</div>
			            </div>
				</div>
				<!-- /.box-body -->
			</div>
		</div>
	</section>
</body>
</html>