<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>私塾家</title>
<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
<script th:include="sys/common/metaJS" th:remove="tag"></script> 
<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
</head>
<style>
	.tablelink{margin-right:10px;}
	.stylecss{
	      color: red;
	}
	.select_width{
	     width: 220px;
	}
	.date_width{
	     width: 83px;
	}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">后台系统管理</a></li>
		<li><a th:href="@{/sys/sales/orderList.html}">订单管理</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/sales/orderList.html}" method="post">
	  <input type="hidden" name="reportType" id="reportType" />
	  <input type="hidden" name="libId" id="libId" th:value="${search.get('libId')}"/>
	<ul class="seachform">
			<li>
				<label>开始时间</label>
				<input type="text" id="beginDate" name="beginDate"  onclick="WdatePicker({readOnly:true,maxDate:'#F{$dp.$D(\'endDate\')}'})" th:value="${search.beginDate }" class="scinput date_width " placeholder="开始时间">
			</li>
			
			
			<li>
				<label>结束时间</label>
				<input type="text" id="endDate" name="endDate"  onclick="WdatePicker({minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'%y-%M-%d'})" th:value="${search.endDate }" class="scinput date_width" placeholder="结束时间">
			</li>
			
			
		<li>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null  &&   #lists.size(#httpSession.getAttribute('admin').orgcodeList) gt 0 }">
			<input type="button" id="button" style="width: 100px;" class="scbtnbution" value="导出定单明细" />
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null  &&  #lists.size(#httpSession.getAttribute('admin').orgcodeList) gt 0 }">
			<input type="button" id="detailbutton" style="width: 120px;" class="scbtnbution" value="导出渠道统计明细" />
		</li>
		<li>
		<a th:href="@{/sys/sales/vipsellOrderList.html(EQ_libId=${search.get('libId')})}">
			<input type="button" class="scbtnbution"  value="历史订单(2017-04-01之前)" style="width: 190px;" /></a>
		</li>
		<li>
				<ul class="toolbar">
					<a th:href="@{/sys/lib/libJoinList.html}"><li class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/goto.png}" /></span>返回</li></a>
				</ul>
		</li>
	</ul>
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <th style="width: 50px;">序号</th>
		        <th>图书馆</th>
		        <th>家长姓名</th>
		        <th>宝宝姓名</th>
		        <th>产品类型</th>
		        <th>金额</th>
		        <th>购卡时间</th>
		        <th>销售人员</th>
		        <th>订单状态</th>
		        <th>订单类型</th>
		        <th>订单模式</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				<td th:text="${itemStat.count}" ></td>
					<td th:text="${item.get('league_name')}"></td>
					<td th:text="${item.get('parent_name')}"></td>
					<td th:text="${item.get('child_name')}"></td>
					<td th:text="${item.get('details')}"></td>
					<td th:text="${item.get('price')}" style="color:  red;"></td>
			        <td  th:text="${#calendars.format(item.get('create_time'),'yyyy-MM-dd HH:mm')}" ></td>
					<td th:text="${item.get('name')}"></td>
					<td  th:switch="${item.get('order_status')}">
					   <span th:case="1">已支付</span>
					   <span th:case="2" style="color:  red;">已退款</span>
					   <span th:case="*">其他</span>
					</td>
					<td  th:switch="${item.get('type')}">
					   <span th:case="1">新签</span>
					   <span th:case="2" style="color:  red;">续签</span>
					</td>
					<td  th:switch="${item.get('libtype')}">
					   <span th:case="1" style="color:red;">家庭图书馆</span>
					   <span th:case="2" style="color:blue;">共享图书馆A</span>
					   <span th:case="3">共享图书馆B</span>
						<span th:case="4">共享图书馆C</span>
					</td>
			</tr>
		</tbody>
	</table>
	<!-- 分页 -->
	<div class="pagin">
    	<div class="message">共<i class="blue">[[${page.rowCnt}]]</i>条记录，当前显示第&nbsp;<i class="blue">[[${page.pageNo }]]&nbsp;</i>页</div>
    	<div th:utext='${listNavigatHtml}' th:remove="tag" ></div>
   	</div>
</div>
</body>
<script type="text/javascript">
$("#button").on('click',function(){
	if($('#endDate').val()==''){
		layer.msg("请选择结束时间",{icon:11});
		return false;
	}
	if($('#beginDate').val()==''){
		layer.msg("请选择开始时间",{icon:11});
		return false;
	}
	$('#reportType').val(3);
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/report/exportReport";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/sales/orderList.html";
});
$("#detailbutton").on('click',function(){
	if($('#endDate').val()==''){
		layer.msg("请选择结束时间",{icon:11});
		return false;
	}
	if($('#beginDate').val()==''){
		layer.msg("请选择开始时间",{icon:11});
		return false;
	}
	$('#reportType').val(4);
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/report/exportReport";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/sales/orderList.html";
});

</script>

</html>