<%@ 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" %>
<!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,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico">
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="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/skin/default/skin.css" rel="stylesheet" type="text/css" id="skin" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/style.css" rel="stylesheet" type="text/css" />

<!--[if IE 6]>
<script type="text/javascript" src="lib/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-danger 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="cl pd-5 bg-1 bk-gray mt-20"> 
		<span class="l">
			<a href="${pageContext.request.contextPath }/admin/productType/toAdd" class="btn btn-danger">
				<i class="Hui-iconfont">&#xe600;</i> 添加产品类型
			</a>
		</span>
	</div>
	<form id="goodsform" >
		<table class="table table-border table-bordered table-bg" id="example">
			<thead>
				<tr>
					<th scope="col" colspan="11">类型列表</th>
				</tr>
				<tr class="text-c">
					<!-- <th width="25"><input type="checkbox" name="" value=""></th> -->
					<th width="150">类型名称</th>
					<th width="100">类型简介</th>

					<th width="130">创建时间</th>
					<th width="150">修改时间</th>
					<th width="90">状态</th>

					<th width="100">操作</th>
				</tr>
			</thead>
			<tbody>
				<c:if test="${! (empty list) }">
					<c:forEach items="${list }" var="type">
						<tr class="text-c">
							<input type="hidden" value="${type.typeId }" name="typeId">
							<td>${type.typeName }</td>
							<td>${type.typeDetilas }</td>
							<td><fmt:formatDate value="${type.typeCreateDate }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
							<td><fmt:formatDate value="${type.typeUpdateDate }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
							<td>${type.typeState==1?'正常':''}${type.typeState==2?'停用':''}${type.typeState==3?'删除':''}</td>
							
							<td class="td-manage">
							 

								<input id="productStatus" type="hidden" value="${type.typeState }">
								<select id="Goodstatus" name="" onchange="updateProductTypeState(this,${type.typeId })">
									<option value="1" ${type.typeState==1?'selected':''}>正常</option>
									<option value="2" ${type.typeState==2?'selected':''}>停用</option>
									<option value="3" ${type.typeState==3?'selected':''}>删除</option>
								</select>
								<a onclick="goods_edit('${pageContext.request.contextPath }/admin/productType/toUpdate?typeId=${type.typeId }')" 
								title="编辑" href="javascript:;"  class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
							 
							</td>
					</c:forEach>
				</c:if>
			</tbody>
		</table>
		<%-- <div align="right" class="mt-10 mb-10 mr-10">
			<%@include file="/common/other/paper/pager.jsp"%>
  		</div> --%>
  		</form>
	</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/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" src="${pageContext.request.contextPath }/common/admin/js/tips.js"></script> 
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/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/js/page/jqPaginator.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/goods/js/utils.js"></script>
	<script type="text/javascript">
	/* $(document).ready(function(){
		$('#beginDate').datepicker();//时间控件
        $('#endDate').datepicker();
	}); */
	
	function  dataCheck(){
		 //商品名称数据验证
		 if($("#goodsInfoGoodname").val()!= ""){
			if(!commonLengthJdg('goodsInfoGoodname',1,30,null,true)){
				layer.msg("商品名称长度为1-30位",{icon: 5,time:3000});
				return false;
			}
		 }
		//最小价格格式验证
		 if($("#minMoney").val()!= ""){
			if(!commonTypeJdg('minMoney','money',null,true)){
				layer.msg("最小价格须为金钱格式",{icon: 5,time:3000});
				return false;
			}
		 }
		//最大价格格式验证
		if($("#maxMoney").val()!= ""){
			if(!commonTypeJdg('maxMoney','money',null,true)){
				layer.msg("最大价格须为金钱格式",{icon: 5,time:3000});
				return false;
			}
		}
		return true;
	}
function updateProductTypeState(_this,id){
	var obj = $(_this);	
		layer.confirm('确认要修改状态吗？',function(index){
			$.ajax({
				url: '${pageContext.request.contextPath }/admin/productType/updateStatus',
				type: "POST",
				dataType: "json",
				data: {typeId : id,typeState : obj.val()},
				error:function(data){
				  layer.msg("修改失败</br>",{icon: 5,time:2000});
				},
				success:  function(data){
				  layer.msg("修改成功</br>",{icon: 1,time:2000});
				}
			});
		}, function () {
            window.location.reload(location.href);
        }
	);

}
/**
 * 打开修改商品界面
 */
function goods_edit(url){
	window.location.href = url;
}
</script>
</body>
</html>