<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;
	}
	
	.tablelist th,td{
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
	}
	
	
</style>
<body>

<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/problem/areaMerchantList.html}" method="post">
	<input type="hidden" name="pageSize" id="pageSize" value="10" />
	<ul class="seachform">
			<input type="hidden" th:value="${search.get('schoolAreaId')}" id="schoolAreaId" name="schoolAreaId"/>
			<li>
			 <label>商户名称</label>
			  <input name=orgCode type="hidden" class="scinput" th:value="${search.get('LIKE_orgCode')}"/>
			  <input name="unitName" type="text" class="scinput" th:value="${search.get('LIKE_unitName')}"/>
		    </li>
		    
		    <li>
			 <label>商户帐号</label>
			  <input name="posCode" type="text" class="scinput" th:value="${search.get('LIKE_posCode')}"/>
		    </li>
			
		<li>
			<input type="button" class="scbtn" value="查询" />
		</li>
		<li>
			<ul class="toolbar">
				<a href="javascript:;" th:onclick="'addMerchant(\''+${search.get('schoolAreaId')}+'\')'"><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 >商户帐号</th>
		    	<th >单位名称 </th>
		    	<th style="width: 60px;">商户级别</th>
		    	<th  >关联机构 </th>
		    	<th style="width: 60px;">端口数量</th>
		    	<th style="width: 60px;">机构塾币</th>
		    	<th style="width: 60px;">平台塾币</th>
		    	<th style="max-width: 160px;" >签约时间</th>
		        <th  >状态</th>
		        <th  >创建时间</th> 
		        <th  >操作</th> 
		    </tr> 
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
		
					<td th:title="${item.posCode}" th:text="${item.posCode}"></td>
					<td th:title="${item.unitName}" th:text="${item.unitName}"></td>
					<td  th:switch="${item.level}">
					   <span th:case="1" style="color:red">市代</span>
					   <span th:case="2" style="color:red">区代</span>
					   <span th:case="3" style="color:red">学校独家</span>
					   <span th:case="4" style="color:red">普通</span>
					   <span th:case="*" >--</span>
					</td>
					
					<td  th:title="${item.leagueName!=null ? item.leagueName : '' }"   th:text="${item.leagueName}"></td>
					<td  th:text="${item.portNum}"></td>
					<td  th:text="${item.libService}"></td>
					<td  th:text="${item.platformService}"></td>
					
					<td th:title="${item.signTime!=null ?  #dates.format(item.signTime, 'yyyy-MM-dd')+'~'+#dates.format(item.endSignTime, 'yyyy-MM-dd') : '' }"  th:text="${item.signTime!=null ?  #dates.format(item.signTime, 'yyyy-MM-dd')+'~'+#dates.format(item.endSignTime, 'yyyy-MM-dd') : '' }"></td>
					
					<td  th:switch="${item.status}">
					   <span th:case="1">待签</span>
					   <span th:case="2">已签待交付</span>
					   <span th:case="3">已签已交付</span>
					   <span th:case="4">无效</span>
					</td>

					<td  th:text="${#calendars.format(item.createTime,'yyyy-MM-dd')}" ></td>
					<td  >
						<a href="javascript:;"  th:onclick="'delArea(\''+${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 () {

})








function delArea(id){
	var areaId = $("#schoolAreaId").val();
	parent.layer.confirm("确定操作删除？", {
		icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
	}, function(){
		$.ajax({
			url : "[[${sysUrl}]]/sys/problem/delArea",
			type : "post",
			data : {id:id,areaId:areaId},
			dataType : "json",
			success : function(data) {
				if(data.meta.success){
					parent.layer.msg("操作成功",{icon:1});
					setTimeout(function(){
						location.reload();
					},1000);
				}else{
					alert("操作异常，请刷新后重试...")
				}
			}
		});
	});
}

function addMerchant(id){
	var   title ='关联商户';
	layer.open({
		type: 2,
		title: title,
		closeBtn: 1, //不显示关闭按钮
		shift: 0.8,
		//offset: '100px',
		area: ['80%', '80%'],
		content: '[[${sysUrl}]]/sys/problem/merchantList.html?schoolAreaId='+id
	});
}

</script>




</html>