<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> 
</head>
<style>
	.tablelink{margin-right:10px;}
	.stylecss{
	      color: red;
	}
	.select_width{
	     width: 70px;
	}
	.date_width{
	     width: 100px;
	}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">图书馆管理</a></li>
		<li><a th:href="@{/sys/lib/libVipList.html}">会员卡管理</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/lib/libVipList.html}" method="post">
	<ul class="seachform">
		<li>
			<label>持有人</label>
			<input name="name" type="text" class="scinput" th:value="${search.get('name')} == null  ? '': ${search.get('name')}"/>
		</li>
		<li>
			<label>卡号</label>
			<input name="flow_id" type="text" class="scinput" th:value="${search.get('flow_id')} == null  ? '': ${search.get('flow_id')}"/>
		</li>
		<li>
			<label>激活时间</label>
			<input name="activeTime" type="text" class="scinput" autocomplete="off" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" th:value="${search.get('activeTime')} == null  ? '': ${search.get('activeTime')}"/>
		</li>
		<li>
		<label>状态</label>
					<select class="scinput select_width" name="stat" >
					    <option value=""  th:selected="${ search.get('stat') eq '' }"  >全部</option>
						<option value="1" th:selected="${ search.get('stat') eq '1' }" >有效</option>
						<option value="2" th:selected="${ search.get('stat') eq '2' }" >无效</option>
						
					</select>
		</li>
		<li>
			<label>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null  && #httpSession.getAttribute('admin').loginName eq 'admin'  } " >
				<ul class="toolbar"  onclick="libVipAdd()">
					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增</li>
				</ul>
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null  && #httpSession.getAttribute('admin').loginName eq 'admin'  } " >
			<label>&nbsp;</label>
			<input type="button" id="adminbution" style="width: 120px;" class="scbtnbution" value="导出所有会员卡" />
		</li>
		<li th:if="${ #httpSession.getAttribute('admin') !=null  && #httpSession.getAttribute('admin').loginName eq 'admin'  }" >
				<ul class="toolbar" >
					<a th:href="@{/sys/lib/zipList.html(type='2')}"   >
					<li class="click"><span><img th:src="@{/static/sys/images/t01.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>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
				<td th:text="${itemStat.count}" ></td>
					<td th:text="${#calendars.format(item.get('create_time'),'yyyy-MM-dd HH:mm:ss')}" ></td>
					<td th:text="${item.get('child_name')}" ></td>
					<td th:text="${#calendars.format(item.get('activate_time'),'yyyy-MM-dd HH:mm:ss')}" ></td>
					<td th:switch="${item.get('stat')}" >
					    <span th:case="1" style="color: red;" >有效</span>
					    <span th:case="2" >无效</span>
				   </td>
				   <td th:text="${item.get('flow_id')}" ></td>
					<td  class="imgtd">
							<img  th:if="${item.get('qrcode_url') !=null && item.get('qrcode_url') !='' }" th:src="${imgUrl}+''+${item.get('qrcode_url')}" style="width: 50px;height: 50px;" />
					</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>

<script type="text/javascript">




function libVipAdd(){
	parent.layer.open({
	    type: 2,
	    title: "添加会员卡",
	    closeBtn: 1, //不显示关闭按钮
	    shift: 0.8,
	    //offset: '100px',
	    area: ['40%', '50%'],
	    content: '[[${sysUrl}]]/sys/lib/libVipAdd.html'
	});
}

$("#adminbution").on('click',function(){
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/lib/ajaxVipQrCodeAdmin";
	$("#seachform").submit();
	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/lib/libVipList.html";
});
</script>
</html>