<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>
<link href="sys/css/jquery.searchableSelect.css" th:href="@{/static/sys/css/jquery.searchableSelect.css}" rel="stylesheet"/>
<script src="js/layer/layer.js" th:src="@{/static/sys/js/jquery.searchableSelect.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="#">配送审核管理</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/award/examine/list.html}" method="post">
	<ul class="seachform">
	
		<li>
			<label>我的商户</label>
			<select class="scinput select_width"  id="merchantId" name="merchantId"   style="width: 100px;" >
				<option value="">全部</option>
				<option th:each="item:${subMerchants}"  th:selected="${search.get('merchantId') eq item.id ? true : false}" th:value="${item.id}">[[${item.unitName}]]</option>
			</select>
		</li>
		
		<li>
			<label>审核状态</label>
			<select class="scinput select_width"  id="status" name="status"   style="width: 80px;" >
				<option value="">全部</option>
				<option value="0" th:selected="${search.get('status')+'' eq '0' ? 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>
			</select>
		</li>
		
		<li>
			<label>活动主题：</label>
			<input style="width: 100px;" type="text" id="title" name="title" autocomplete="off"  th:value="${search.get('title')}"  class="scinput date_width" placeholder="活动主题">
		</li>
		
		<li>
			<label>钉钉单号：</label>
			<input style="width: 100px;" type="text" id="dingNumber" name="dingNumber" autocomplete="off"  th:value="${search.get('dingNumber')}"  class="scinput date_width" placeholder="钉钉单号">
		</li>
		
		<li>
			<label>快递单号：</label>
			<input style="width: 100px;" type="text" id="emsNumber" name="emsNumber" autocomplete="off"  th:value="${search.get('emsNumber')}"  class="scinput date_width" placeholder="快递单号">
		</li>
		
		<li>
			<label>备注：</label>
			<input style="width: 100px;" type="text" id="remarks" name="remarks" autocomplete="off"  th:value="${search.get('remarks')}"  class="scinput date_width" placeholder="备注">
		</li>
		
		<li>
			<label>开始时间</label>
			<input style="width: 100px;" type="text" id="startTime" name="startTime" autocomplete="off" onclick="WdatePicker()" th:value="${search.get('startTime')}"   class="scinput date_width " placeholder="开始时间">
		</li>
		<li>
			<label>结束时间</label>
			<input style="width: 100px;" type="text" id="endTime" name="endTime" autocomplete="off"  onclick="WdatePicker()"  th:value="${search.get('endTime')}" class="scinput date_width " placeholder="结束时间">
		</li>
		
		<li>
			<input type="button" class="scbtn" value="查询" />
		</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>
		    	<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="${item.get('fm_unit_name')}"></td>
					<td th:text="${item.get('tm_unit_name')}"></td>
					<td th:text="${item.get('tm_port_num')}"></td>
<!-- 					<td  th:switch="${item.type}"> -->
<!-- 					   <span th:case="1" style="color:red">发放</span> -->
<!-- 					   <span th:case="2" style="color:red">接收</span> -->
<!-- 					</td> -->
					<td th:text="${ item.get('level1_material_name')!=null ? (item.get('level1_material_name')+' / '+item.get('level1_num')+'个'  ) : '无'  }"></td>
					<td th:text="${ item.get('level2_material_name')!=null ? (item.get('level2_material_name')+' / '+item.get('level2_num')+'个'  ) : '无'  }"></td>
					<td th:text="${ item.get('level3_material_name')!=null ? (item.get('level3_material_name')+' / '+item.get('level3_num')+'个'  ) : '无'  } "></td>
					<td th:text="${item.get('create_time')}"></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>
					</td>
					
					<td th:text="${item.get('ding_number')}"></td>
					<td th:text="${item.get('ems_number')}"></td>
					<td th:text="${item.get('people')}"></td>
					<td th:text="${item.get('telephone')}"></td>
					<td th:text="${item.get('address')}"></td>
					<td th:text="${item.get('remarks')}"></td>
					<td >
						<img style="height: 40px;"  th:if="${item.get('img')!=null && item.get('img')!=''}" th:src="${imgUrl+item.get('img')}">
					</td>
					<td> 
						<div th:if="${item.status==2}">
							<a href="javascript:;" th:onclick="'statusCardActivity(\''+${item.id}+'\',\'1\',\''+${item.tm_unit_name}+'\')'" class="tablelink">通过</a> 
							<a href="javascript:;" th:onclick="'statusCardActivity(\''+${item.id}+'\',\'3\',\''+${item.tm_unit_name}+'\')'" class="tablelink">拒绝</a> 
						</div>
					</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(){
		$('#merchantId').searchableSelect();
	});

	function statusCardActivity(id,status,name){
		var title="";
		if(status==1){
			title="确定通过【"+name+"】配送审核?";
		}else if(status==3){
			title="确定拒绝【"+name+"】配送审核?";
		}else{
			
		}
		parent.layer.confirm(title, {
			icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
		}, function(){
			var url="[[${sysUrl}]]/sys/award/examine/status";
			var params ={
			 	'id' : id,
	            'status' :status
	        };
			$.post(url,params,function(data){
				if(data.meta.success){
					parent.layer.msg("操作成功",{icon:1});
					parent.location.reload();
					parent.layer.close(parent.layer.getFrameIndex(window.name));
				}else{
					parent.layer.msg(data.meta.message,{icon:11});
				}
			});
		});
	}
	
	$("#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);
	});
</script>


</html>