<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: 100px;
	}
</style>
<body>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/problem/updateviplist.html}" method="post">
	<input type="hidden" id="ids" name="ids" th:value="${search.get('ids')}">
	<ul class="seachform">
		<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>&nbsp;</label>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
				<ul class="toolbar" id="select">
					<li class="click"><span><img style="width: 24px;height: 24px" th:src="@{/static/sys/images/select.png}" /></span>选择</li>
				</ul>
		</li>
	</ul>
	</form>
	<table class="tablelist">
		<thead>
		    <tr>
		        <th><input type="checkbox"></th>
		        <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><input name="selectlist" type="radio" th:data-id="${item.get('id')}"th:checked="checked" /></td>
				    <td th:text="${itemStat.count}" ></td>
				    <td th:text="${item.get('parent_name')}"></td>
					<td th:text="${item.get('child_name')}"></td>
					<td th:text="${item.get('flow_id')}"></td>
					<td th:text="${#calendars.format(item.get('activate_time'),'yyyy-MM-dd HH:mm:ss')}" ></td>
					<td  class="imgtd">
							<img  th:if="${item.get('img_url') !=null && item.get('img_url') !='' }" th:src="${imgUrl}+''+${item.get('img_url')}" style="width: 50px;height: 50px;" />
					</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>
</body>
<script type="text/javascript">
$(function(){
	 
	$('#select li.click').click(function () {
		$('[name=selectlist]:radio:checked').each(function() {
				 var id = $(this).attr('data-id');
				 console.log(id);
				 showIndex(id);
		  });	 
		 });		
	   });
	  



function showIndex(id){
	var content ="您确定要更换吗?";
	parent.layer.confirm(content, {
		icon: 4, btn: ['确定','关闭'] //按钮
	}, function(){
		var url="[[${sysUrl}]]/sys/problem/updateLibVip";
		var ids= $("#ids").val();
		var params ={
			     	'id' : id,
		            'ids' : ids
		         };
		$.post(url,params,function(data){
			if(data.meta.success){
				parent.layer.msg("添加成功",{icon:1});
				closeWin();
			}else{
				parent.layer.msg(data.meta.message,{icon:11});
				closeWin();
			}
		});
	});
}

function closeWin(){
	parent.location.reload();
	parent.layer.close(parent.layer.getFrameIndex(window.name));
}

</script>
</html>