<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: 150px;
	}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">微信管理</a></li>
		<li><a href="#">图书馆销售订单管理</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/order/vipOrderList.html}" method="post">
	  <input type="hidden" name="reportType" id="reportType" />
	<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>
			 <label>订单编号</label>
			  <input name="order_no" type="text" class="scinput" th:value="${search.get('order_no')}"/>
		    </li>
			<li>
				<label>订单模式</label>
					<select class="scinput select_width"  name="libtype"   style="width: 160px;" >
						<option value=""   >全部</option>
						<option value="1">家庭图书馆</option>
						<option value="2">共享图书馆A</option>
						<option value="3">共享图书馆B</option>
						<option value="4">共享图书馆C</option>
					</select>
			</li>
			<li>
				<label>图书馆</label>
					<select class="scinput select_width"  name="libId"   style="width: 220px;" >
						<option value=""   >全部</option>
						<option th:each="item:${libList}"  th:value="${item.id}"  th:selected="${ search.get('libId') eq item.id }"  th:text="${item.leagueName}"></option>
					</select>
			</li>
			
		<li>
			<input type="button" class="scbtn" value="查询" />
		</li>
		
		
	</ul>
	<ul class="seachform" style="margin-left:60px;">
	  <li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">
			<input type="button" id="button" style="width: 100px;" class="scbtnbution" value="订单明细" />
		</li>
		<!-- <li th:if="${ #httpSession.getAttribute('admin') !=null  &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW') }">
			<input type="button" id="detailbutton" style="width: 120px;" class="scbtnbution" value="各馆月度销售" />
		</li> -->
		<li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">
			<input type="button" id="ybbutton" style="width: 120px;" class="scbtnbution" value="财务月报" />
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">
			<input type="button" id="gxbuttonA" style="width: 120px;" class="scbtnbution" value="共享模式A" />
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null   &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW')  }">
			<input type="button" id="gxbuttonB" style="width: 120px;" class="scbtnbution" value="共享模式B" />
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null    &&  #lists.contains(#httpSession.getAttribute('admin').orgcodeList,'SSJ-SSJ-CW') }">
			<input type="button" id="zbbutton" style="width: 120px;" class="scbtnbution" value="人员月度销售" />
		</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>
		        <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('order_no')}"></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=" ${#strings.contains(item.get('price'),'.00')} ?  ${#numbers.formatDecimal(item.get('price'),1,0)} :  ${#numbers.formatDecimal(item.get('price'),1,2)} " 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="3" 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" style="color:#750000;">共享图书馆B</span>
						<span th:case="4" style="color:#750000;">共享图书馆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/order/vipOrderList.html";
});
$("#zbbutton").on('click',function(){
	if($('#endDate').val()==''){
		layer.msg("请选择结束时间",{icon:11});
		return false;
	}
	if($('#beginDate').val()==''){
		layer.msg("请选择开始时间",{icon:11});
		return false;
	}
	$('#reportType').val(6);
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/report/exportReport";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/order/vipOrderList.html";
});
$("#ybbutton").on('click',function(){
	if($('#endDate').val()==''){
		layer.msg("请选择结束时间",{icon:11});
		return false;
	}
	if($('#beginDate').val()==''){
		layer.msg("请选择开始时间",{icon:11});
		return false;
	}
	$('#reportType').val(5);
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/report/exportReport";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/order/vipOrderList.html";
});
$("#gxbuttonA").on('click',function(){
	$('#reportType').val(7);
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/report/exportReport";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/order/vipOrderList.html";
});
$("#gxbuttonB").on('click',function(){
	$('#reportType').val(8);
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/report/exportReport";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/order/vipOrderList.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/order/vipOrderList.html";
});

</script>

</html>