<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/html5.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>优惠卷管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 优惠卷管理 <span class="c-gray en">&gt;</span> 优惠券列表 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="pd-20">
	<div class="text-c">
	<form action="${pageContext.request.contextPath }/admin/couponItem/getAllCouponItem" method="post" id="searchForm">
		<input type="hidden" name="orderStatus" value="${orderStatusStr }" />
			<input type="text" name="text" id="text" value="${text }" placeholder="优惠券名称/优惠券使用人" style="width: 300px" class="input-text">
			<%--截止日期：
			<input type="text" readonly="readonly" onfocus="WdatePicker({maxDate:'2050-10-01', dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="beginDate" value="${beginDate }" name="beginDate" class="input-text Wdate" style="width: 120px;">--%>
			<button name="" id="submitBtn" class="btn btn-success" type="submit">
				<i class="Hui-iconfont">&#xe665;</i> 搜索
			</button>
		<div class="mt-20">
			<table class="table table-border table-bordered table-hover table-bg">
				<thead>
					<tr class="text-c">
						<th width="150">优惠券名称</th>
						<th width="50">优惠券使用人</th>
						<th width="50">优惠券截止时间</th>
						<th width="50">领取优惠券时间</th>
						<th width="100">使用状态</th>
						<th width="100">使用时间</th>
						<th width="40">优惠券备注</th>
						<th width="100">操作</th>
					</tr>
				</thead>
				
				<tbody>
					<c:if test="${!empty couponItemList }">
						<c:forEach items="${couponItemList }" var="cpuponItem">
						<tr class="text-c">
							<td>${cpuponItem.couponName }</td>
							<td>${cpuponItem.userName }</td>
							<td><fmt:formatDate value="${cpuponItem.couponUseEndDate }" pattern="YYYY-MM-dd HH:MM:ss"/></td>
							<td><fmt:formatDate value="${cpuponItem.couponReceiveDate }" pattern="YYYY-MM-dd HH:MM:ss"/></td>
							<td>
								<c:if test="${cpuponItem.couponUseStatus == 1}">未使用</c:if>
								<c:if test="${cpuponItem.couponUseStatus == 2}">已使用</c:if>
								<c:if test="${cpuponItem.couponUseStatus == 3}">停用</c:if>
								<c:if test="${cpuponItem.couponUseStatus == 4}">过期</c:if>
								<c:if test="${cpuponItem.couponUseStatus == 7}">正在使用中</c:if>
							</td>
							<td><fmt:formatDate value="${cpuponItem.couponUseDate }" pattern="YYYY-MM-dd HH:MM:ss"/></td>
							<td>${cpuponItem.couponItemRemark }</td>
							<td class="td-manage">
								<c:if test="${cpuponItem.couponUseStatus != 7 && cpuponItem.couponUseStatus != 2}">
									<input id="through" class="btn btn-primary radius upload-btn" onclick="updateCType('修改优惠券使用详情','${pageContext.request.contextPath }/admin/couponItem/updateCouponItem?couponItemId=${cpuponItem.couponItemId }','','700');" type="button" value="修改" />&nbsp;
								</c:if>
							</td>
						</tr>
						</c:forEach>
					</c:if>
					<c:if test="${empty couponItemList }">
						<tr class="text-c">
							<td colspan="9">没有查询到数据</td>
						</tr>
					</c:if>
				</tbody>
			</table>
		</div>
	</form>
	</div>
</div>
<div align="right">
	<%@include file="/common/other/paper/pager.jsp"%>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/laypage/1.2/laypage.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script> 
<script type="text/javascript">
$(function() {
	$("#searchButton").click(function() {
		var action = $("#searchForm").attr("action");
		$("#searchForm").attr("action", action).submit();
	});
})
/*用户-编辑*/
function updateCType(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*用户-删除*/
function deleteCType(obj,id){
	//alert("-----------");
	layer.confirm('确认要删除吗？',function(){
		$.ajax({
			url: '${pageContext.request.contextPath }/admin/couponType/deleteType/'+id,
			//data:{ "couponId":id },
			dataType:'json',//服务器返回json格式数据
			type:'post',	//HTTP请求类型
			error:function(data){
				//alert("-----error:function----->>" + data);
	      	  	layer.msg("删除失败!",{icon: 5,time:2000});
	        },
	        success:  function(data){
	        	//alert("----success------>>" + data);
	      	  	//layer.msg(data.status,{icon: 1,time:2000});
	      	  	if(data.status){
					$(obj).parents("tr").remove();
					layer.msg('已删除!',{icon:1,time:3000});
	      	  	}else{
	      	  		layer.msg(data.message,{icon:1,time:3000});
	      	  	}
	        }
		});
	});
}
</script> 
</body>
</html>