<%@ 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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<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" />
<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" />

<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">
		<form action="${pageContext.request.contextPath }/admin/goods/fuzzySelectGoodsType" method="post">
<div class="row cl">
<label id="rebateType" class="form-label col-1">是否返利：</label>
	<div class="formControls col-2"> 
		<span class="select-box">
					<select id="goodIsRebate" name="goodIsRebate" class="select">
						<option ${goodIsRebate==1?'selected':'' } value="1">不支持返利</option>
						<option ${goodIsRebate==2?'selected':'' } value="2">支持返利</option>
					</select>
		</span> 
	</div>
	<label class="form-label col-1"></label>
	<div id="" class="formControls col-2">
			<input name="goodsTypename" id="goodsTypename" value="${typename }" placeholder="商品类型名称/商品类型简介" style="width: 300px" class="input-text" type="text">
	</div>
	<label id="rebateType" class="form-label col-1"></label>
		<div id="" class="formControls col-2">
			<button name="" id="submitBtn" onclick="return dataCheck();" class="btn btn-success" type="submit">
				<i class="Hui-iconfont"></i> 搜索
			</button>
			</div>
</div>
			
		</form>
	<form id="goodsform" >
		<div class="cl pd-5 bg-1 bk-gray mt-20">
		    <span class="l"><a href="javascript:;" onclick="datadelGoodsType()"
				class="btn btn-danger radius">删除选中商品</a>&nbsp; <a href="javascript:;"
				onclick="goodsType_add('${pageContext.request.contextPath }/admin/goods/toaddGoodsType')"
				class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>添加商品类型</a>
		    </span>
		</div>
		<table class="table table-border table-bordered table-bg">
			<thead>
				<tr>
					<th scope="col" colspan="9">商品列表</th>
				</tr>
				<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
					<th width="150">类型名称</th>
					<th width="90">类型介绍</th>
					<th width="150">返利类型</th>
					<th width="130">返利数量</th>
					<th width="100">类型是否返利</th>
					<th width="100">创建时间</th>
					<th width="100">修改时间</th>
					<th width="100">操作</th>
				</tr>
			</thead>
			<tbody>
				<c:if test="${! (empty goodsGoodtype) }">
					<c:forEach items="${goodsGoodtype }" var="infolist">
						<tr class="text-c">
						<td><input type="checkbox" value="${infolist.goodTypeId }" name="goodsTypeId"></td>
							<td>${infolist.goodTypename }</td>
							<td>${infolist.goodDesc }</td>
							<td>${infolist.goodRebateType==1?'返商品销售价':'返利数量'}</td>
							<td>${infolist.goodRebateNum }</td>
							<td>${infolist.goodIsRebate==1?'不支持返利':'支持返利'}</td>
							<td><fmt:formatDate value="${infolist.goodCreateDate }" pattern="yyyy-MM-dd"/></td>
							<td><fmt:formatDate value="${infolist.goodUpdateDate }" pattern="yyyy-MM-dd"/></td>
							<td class="td-manage">
							<a title="编辑" href="javascript:;" onclick="goodsType_update('${pageContext.request.contextPath }/admin/goods/toUpdateGoodsType/${infolist.goodTypeId }')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
							<a title="删除" href="javascript:;" onclick="goodsType_del(this,'${infolist.goodTypeId }')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</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">
	/*模糊查找数据验证*/
	function dataCheck(){
		 //类型名称或简介数据验证
		 if(!commonLengthJdg('goodsTypename',1,30,null,true)){
				layer.msg("查询类型名称或简介长度为1-15位",{icon: 2,time:3000});
				return false;
			}
	}
	/*商品类型-全部删除*/
	function datadelGoodsType(){
		layer.confirm('确认要全部删除吗？',function(index){
		$.ajax({
	        url: '${pageContext.request.contextPath }/admin/goods/deleteGoodsType',
	        type: "POST",
	        dataType: "json",
	        data: $("#goodsform").serialize(),
	        error:function(){
	      	  layer.msg(data.status,{icon: 5,time:2000});
	        },
	        success:  function(data){
	      	  layer.msg(data.status,{icon: 1,time:2000},function(){
	      		window.location.href = '${pageContext.request.contextPath }/admin/goods/listGoodsType';
	      	  });
	      		
	        }
	    });
	});
	}
	
	/*商品类型-删除*/
	function goodsType_del(obj,id){
		layer.confirm('确认要删除吗？',function(index){
			//此处请求后台程序，下方是成功后的前台处理……
			$.ajax({
	              url: '${pageContext.request.contextPath }/admin/goods/deleteGoodsType',
	              type: "POST",
	              dataType: "json",
	              data: {objVal:id},
	              error:function(){
	            	  layer.msg(data.status,{icon: 5,time:3000});
	              },
	              success:  function(data){
	            	  layer.msg(data.status,{icon: 1,time:3000});
	            	  $(obj).parents("tr").remove();
	              }
	          });
		});
	}
	/*商品类型-增加*/
	function goodsType_add(url){
		window.location.href = url;
	}
	/*商品类型-修改*/
	function goodsType_update(url){
		window.location.href = url;
	}
	
	</script>
</body>

</html>