<%@ 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" />
<link href="${ctx}/styles/lib/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${ctx}/scripts/lib/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="${ctx}/scripts/bootstrap.min.js"></script>
<script type="text/javascript" src="${ctx}/scripts/jquery/ajaxfileupload.js"></script>
<script type="text/javascript" src="${ctx}/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/product.js?ver=4.0"></script>
<style>
.btns input{float: left; margin-right: 10px; width: 80px; height: 30px}
.btns .filebtn {width: 140px;}
</style>
<script type="text/javascript">
//翻页
function goPage(pageNo){
	if(pageNo=="gopage"){
		$("#pageNo").val($("#gopage").val());
	}else{
		$("#pageNo").val(pageNo);
	}
	$("#conditionform").submit();
}
</script>
</head>
<body>
<img id="loading" src="${ctx}/scripts/kindeditor/themes/common/loading.gif" style="display:none;" />
	<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/queryProductList"
							id="conditionform" method="POST">
							<input type="hidden" value="${pageNo}" id="pageNo" name="pageNo"/>
							<div class="form-group">
								<label for="">省份</label> <input type="text" id="province" width="20px"
									name="province" value="${province}" placeholder="请输入省份查询" />
							</div>
							<div class="form-group">
								<label for="">运营商</label> <input type="text" id="carrieroperator" width="20px"
									name="carrieroperator" value="${carrieroperator}" placeholder="请输入运营商查询" />
							</div>
							<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> <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>
						</form>
					</div>
					<!-- 按钮组 -->
					<div class="btns" style="float: right;">
						<input type="button" id="btn-search" class="btn btn-info" value="查询" />
						<input type="file" id="fileUpload" name="fileUpload" class="filebtn" value="上传文件"/>
						
						<input type="button" value="上传" id="importProduct" />
					</div>
					<table class="table table-bordered table-hover">
						<thead>
							<tr>
							<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">
									${list.province}
								</td>
								<td nowrap="nowrap">${list.productName}</td>
								<td nowrap="nowrap">${list.carrieroperator}</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">${list.realPrice}</td>
								<td nowrap="nowrap">${list.productPrice}</td>
								<td nowrap="nowrap"><fmt:formatNumber type="number" value="${list.upDiscount*100}" pattern="0.00" maxFractionDigits="2"/>%</td>
								<td nowrap="nowrap"><fmt:formatNumber type="number" value="${list.discount*100}" pattern="0.00" maxFractionDigits="2"/>%</td>
								<td nowrap="nowrap">
									<c:if test="${list.checkPrice == null || list.checkPrice == ''}">暂无</c:if>
									<c:if test="${list.checkPrice != null && list.checkPrice != ''}"><fmt:formatNumber type="number" value="${list.checkPrice*100}" pattern="0.00" maxFractionDigits="2"/>%</c:if>
								</td>
								<td nowrap="nowrap">
									<c:if test="${list.code == null || list.code == ''}">暂无</c:if>
									<c:if test="${list.code != code && list.code != ''}">${list.code}</c:if>
								</td>
								<td nowrap="nowrap">
									<c:if test="${list.serviceCode == null || list.serviceCode == ''}">暂无</c:if>
									<c:if test="${list.serviceCode != code && list.serviceCode != ''}">${list.serviceCode}</c:if>
								</td>
								<td nowrap="nowrap"><c:if test="${list.isEnabled == 0}">维护</c:if><c:if test="${list.isEnabled == 1}">正常</c:if></td>
								<td nowrap="nowrap">${list.createTime}</td>
								<td nowrap="nowrap">
									<a href="javascript:findProduct('${list.id}')" class="btn-table btn-red" title="编辑">编辑</a>
									<c:if test="${list.isEnabled == 0}">
										<a href="javascript:available('${list.id}','1')" class="btn-table btn-red" title="上架">上架</a>
									</c:if>
									<c:if test="${list.isEnabled == 1}">
										<a href="javascript:available('${list.id}','0')" class="btn-table btn-red" title="下架">下架</a>
									</c:if>
								</td>
							</tr>
						</c:forEach>
					</tbody>
					</table>
					<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>
	
	<div class="modal fade"  id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog" style="width:500px;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						×
					</button>
					<h4 class="modal-title" id="myModalLabel">
					</h4>
				</div>
				<div class="modal-body">
				<label >维护情况:</label>
				<select id="all" name="all" onclick="allProduct()">
				 <option value="0">单个</option>
				 <option value="1">全部</option>
				 </select>
				<div class="">
			   <label id="l_province">省份/城市:</label>
			   <input id="u_province" name="u_province" type="text" readonly="readonly">
		        </div>
		        <div id="d_carrieroperator" style="display: none">
			   <label >运营商:</label>
			 <select id="u_carrieroperator" name="u_carrieroperator">
			 <option value="-1">全部</option>
			 <option value="移动">移动</option>
			 <option value="联通">联通</option>
			 <option value="电信">电信</option>
			 </select>
		      </div>
		      	<div class="" id="d_realPrice">
			   <label >出售价格:</label>
			   <input type="text" name="u_realPrice" id="u_realPrice" readonly="readonly">元
		        </div>
		      	<div class="" id="d_productPrice">
			   <label >产品价格:</label>
			   <input type="text" name="u_productPrice" id="u_productPrice">元
		        </div>
		      	<div class="" id="d_upDiscount">
			   <label >上浮折扣率:</label>
			   <input type="text" name="u_upDiscount" id="u_upDiscount" onblur="jisuan()"><sapn style="color:red">(只能输入小于1的数字例如0.XXXX)</sapn>
		        </div>
		      	<div class="" id="d_discount">
			   <label >运营商折扣:</label>
			   <input type="text" name="u_discount" id="u_discount"><sapn style="color:red">(只能输入小于1的数字例如0.XXXX)</sapn>
		        </div>
		          <div class="">
			   <label >启用状态:</label>
			 <select id="u_isEnabled" name="u_isEnabled">
				 <option value="0">维护</option>
				 <option value="1">正常</option>
			 </select>
		      </div>
				</div>
				<div >
				<input type="button" class="btn btn-default" value="保存提交" onclick="updateProduct()"/>
				<input type="button" class="btn btn-back" data-dismiss="modal" value="关闭" />
				</div>
			</div>
		</div>
		</div>
</body>
</html>