<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="#">奖品码管理-[[${ '奖品编号：'+search.get('awardMaterialId')}]]</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/award/sncode/list.html}" method="post">
	
		<input type="hidden" id="awardMaterialId" name="awardMaterialId" autocomplete="off"  th:value="${search.get('awardMaterialId')}"  class="scinput date_width">
		
		<ul class="seachform">
			<li>
				<label>奖品码：</label>
				<input type="text" id="snCode" name="snCode" autocomplete="off"  th:value="${search.get('snCode')}"  class="scinput date_width" placeholder="奖品码">
			</li>
			
<!-- 			<li> -->
<!-- 				<label>奖品等奖</label> -->
<!-- 				<select class="scinput select_width"  id="level" name="level"   style="width: 150px;" > -->
<!-- 					<option value="">全部</option> -->
<!-- 					<option value="1" th:selected="${search.get('level')+'' eq '1' ? true : false}">一等奖</option> -->
<!-- 					<option value="2" th:selected="${search.get('level')+'' eq '2' ? true : false}">二等奖</option> -->
<!-- 					<option value="3" th:selected="${search.get('level')+'' eq '3' ? true : false}">三等奖</option> -->
<!-- 				</select> -->
<!-- 			</li> -->
		
			
			<li>
				<label>中奖人：</label>
				<input type="text" id="name" name="name" autocomplete="off"  th:value="${search.get('name')}"  class="scinput date_width" placeholder="中奖人">
			</li>
			<li>
				<label>奖品状态：</label>
				<select class="scinput select_width"  id="status" name="status"   style="width: 150px;" >
					<option value="" >全部</option>
					<option value="0" th:selected="${search.get('status')+'' eq '0' ? true : false}" >未使用</option>
					<option value="1;2;3;4" th:selected="${search.get('status')+'' eq '1;2;3;4' ? true : false}" >已使用</option>
					<option value="1" th:selected="${search.get('status')+'' eq '1' ? true : false}" >中奖未领取</option>
					<option value="2" th:selected="${search.get('status')+'' eq '2' ? true : false}" >中奖已领取</option>
					<option value="3" th:selected="${search.get('status')+'' eq '3' ? true : false}" >兑奖未核销</option>
					<option value="4" th:selected="${search.get('status')+'' eq '4' ? true : false}" >兑奖已核销</option>
				</select>
			</li> 
			
			<li>
				<label>物流状态：</label>
				<select class="scinput select_width"  id="emsstatus" name="emsstatus"   style="width: 150px;" >
					<option value="" >全部</option>
					<option value="0" th:selected="${search.get('emsstatus')+'' eq '0' ? true : false}" >未发贷</option>
					<option value="1" th:selected="${search.get('emsstatus')+'' eq '1' ? true : false}" >已发贷</option>
				</select>
			</li> 
			
			<li>
				<label>排序条件：</label>
				<select class="scinput select_width"  id="order" name="order"   style="width: 150px;" >
					<option value="create_time" th:selected="${search.get('order')+'' eq 'create_time' ? true : false}">生成时间</option>
					<option value="draw_time" th:selected="${search.get('order')+'' eq 'draw_time' ? true : false}" >未发贷</option>
					<option value="closure_time" th:selected="${search.get('order')+'' eq 'closure_time' ? true : false}" >已发贷</option>
					<option value="ems_time" th:selected="${search.get('order')+'' eq 'ems_time' ? true : false}" >已发贷</option>
				</select>
			</li> 
				
			<li>
				<input type="button" class="scbtn" value="查询" />
			</li>
			
			<li>
				<ul class="toolbar">
					<a th:href="@{/sys/award/material/list.html}" >
							<li class="click">&nbsp;&nbsp;<< 返回&nbsp;&nbsp;</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>
				<th>中奖机构</th>
		    	<th>中奖时间</th>
		    	<th>核销时间</th>
		    	<th>物流状态</th>
		    	<th>物流时间</th>
		    </tr>
		</thead>
		<tbody>
			<tr th:each="item:${list}" >
					<td th:text="${itemStat.count+((page.pageNo-1)*page.pageSize) }"></td>
					<td th:text="${item.get('sn_code')}"></td>
					<td th:text="${item.get('name')}"></td>
					<td  th:switch="${item.level}">
					   <span th:case="1" >一等奖</span>
					   <span th:case="2" >二等奖</span>
					   <span th:case="3" >三等奖</span>
					   <span th:case="4" >四等奖</span>
					</td>
					<td  th:switch="${item.status}">
					   <span th:case="0" style="color:red">未使用</span>
					   <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="5" style="color:red">取消活动无效</span>
					</td>
					<td th:text="${item.get('create_time')}"></td>
					<td th:text="${item.get('child_name')}"></td>
					<td th:text="${item.get('league_name')}"></td>
					<td th:text="${item.get('draw_time')}"></td>
					<td th:text="${item.get('closure_time')}"></td>
					<td> 
						<div th:if="${item.status==1 || item.status==2 || item.status==3 || item.status==4}">
							<a th:if="${item.get('ems_time')==null }" style="color: red" href="javascript:;" th:onclick="'emsCardMaterial(\''+${item.id}+'\',\'1\')'" class="tablelink">添加物流</a> 
							<a th:if="${item.get('ems_time')!=null }" href="javascript:;" th:onclick="'emsCardMaterial(\''+${item.id}+'\',\'2\')'" class="tablelink">查看物流</a> 
						</div>
					</td>
					<td th:text="${item.get('ems_time')}"></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(){
		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/award/material/list";
		$("#seachform").submit();
		window.setTimeout(function(){
			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/award/material/list.html";
		},3000);
	});
	
	
	function emsCardMaterial(id,type){
		var title="添加物流";
		if(type==2){
			title="查看物流";
		}
		parent.layer.open({
		    type: 2,
		    title: title,
		    closeBtn: 1, //不显示关闭按钮
		    shift: 0.8,
		    offset: '100px',
		    area: ['40%', '70%'],
		    content: '[[${sysUrl}]]/sys/award/sncode/ems.html?id='+id+"&type="+type
		});
	}
	
	
</script>


</html>