<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/sales/libBorrowedServiceList.html}">总部销售卡服务配置</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/sales/libBorrowedServiceList.html}" method="post">
	<ul class="seachform">
		<li>
		<label>销售卡种类</label>
					<select class="scinput" style="width: 100px;" name="EQ_species"   >
					    <option value=""  th:selected="${ search.get('EQ_species') eq '' }"  >全部</option>
						<option th:value="${sort.code}" th:each="sort:${species}" th:selected="${ search.get('EQ_type') eq sort.code }" >[[${sort.name}]]</option>
					</select>
		</li>
		<li>
		<label>销售卡类型</label>
					<select class="scinput" style="width: 200px;" name="EQ_type"   >
					    <option value=""  th:selected="${ search.get('EQ_type') eq '' }"  >全部</option>
						<option th:value="${sort.code}" th:each="sort:${cardType}" th:selected="${ search.get('EQ_type') eq sort.code }" >[[${sort.name}]]</option>
					</select>
		</li>
		<li>
			<label>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li   >
				<ul class="toolbar">
					<a th:href="@{/sys/sales/libBorrowedServiceAdd.html}"><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: 80px;">序号</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>
				       <span th:each="sort:${species}" th:if="${sort.code eq item.species}" th:text="${sort.name}"></span>
				    </td>
					<td>
				       <span th:each="sort:${cardType}" th:if="${sort.code eq item.type}" th:text="${sort.name}"></span>
				    </td>
					<td th:text="${item.deposit}" ></td>
					<td th:text="${item.borrowNum}" ></td>
					<td th:text="${item.borrowDay}" ></td>
					<td th:text="${item.outMoney}" ></td>
					<td  th:text="${#calendars.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}" ></td>
					<td >
					    <a th:href="@{/sys/sales/libBorrowedServiceAdd.html(id=${item.id})}"  class="tablelink" >修改</a>
						<a href="javascript:;" th:onclick="'deleteById(\''+${item.id}+'\')'"  class="tablelink" >删除</a>
				    </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">
function deleteById(id){
	layer.confirm("确定删除该卡服务吗？",
			{icon: 4, btn: ['确定','取消']
	}, function(){
		$.ajax({
			url: '[[${sysUrl}]]/sys/sales/libSalesPriceDelete',
			type: "post",
			data:{
				'id': id
			},
			dataType: "json",
			success:function(data){
					
					if(data.meta.success){
						layer.msg("删除成功",{icon:1});
				    	setTimeout(function(){
				    		location.reload();
						},1000);
					}else{
						layer.msg(data.meta.message,{icon:11});
					}
			}
		});
	});
}
</script>
</html>