<%@ 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>
	<!-- 修改排序-->
	<div class="layui-layer layui-anim layui-layer-iframe" id="layui-remark" times="4" showtime="0" contype="string" style="display:none;z-index: 19891018; width: 400px; height: 260px; position: absolute; top: 100px; left: 379px;">
		<form action="" method="post" class="form form-horizontal" id="form-admin-remark">
		<div class="layui-layer-title" id="sendOrderDivTitle" style="cursor: move;" move="ok">商品排序</div>
		<br>
		<div class="row cl">
			<label class="form-label col-3"><span class="c-red">*</span>&nbsp;&nbsp;序号：</label>
			<div class="formControls col-5">
				<input type="text" class="input-text" value="" placeholder="请输入商品序号" id="goodSortingId" name="goodSortingId" datatype="*2-16" nullmsg="序号不能为空">(不超过9个字符)
			</div>
			<div class="col-4"> </div>
		</div>
		<br>
		<input type="hidden" id="goodsInfoId" name="goodsInfoId">
		  <div class="col-9 col-offset-3">
	        <input class="btn btn-primary radius" type="button" onclick="remrakSumbit()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
	      </div>
	    </form>
		<span class="layui-layer-setwin">
			<a class="layui-layer-ico layui-layer-close layui-layer-close1" onclick="exitWindowsDiv(this)" href="javascript:;"></a>
		</span>
	</div>
	
	<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/toSelectGoods" method="post">
			<input name="status" value="3" type="hidden">
			<input name="goodsInfoGoodname" id="goodsInfoGoodname" value="${Goodname }" placeholder="商品名称/商品简介" style="width: 300px" class="input-text" type="text">
			价格区间：<input name="minMoney" value="${minMoney }" id="minMoney" style="width: 100px" class="input-text" type="text"> 元 - 
					<input name="maxMoney" value="${maxMoney }" id="maxMoney" style="width: 100px" class="input-text" type="text"> 元&nbsp;&nbsp;
			日期范围： <input  id="beginDate" value="${beginDate }" name="beginDate" class="input-text Wdate" style="width: 120px;" type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'endDate\')||\'%y-%M-%d\'}'})" readonly>
				 - <input  id="endDate" value="${endDate }" name="endDate" class="input-text Wdate" style="width: 120px;" type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'beginDate\')||\'%y-%M-%d\'}'})" readonly>
			<button name="" id="submitBtn" onclick="return dataCheck();" class="btn btn-success" type="submit">
				<i class="Hui-iconfont"></i> 搜索
			</button>
		</form>
	<form id="goodsform" >
		<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 goodinfoInfo) }">
					<c:forEach items="${goodinfoInfo }" var="infolist">
						<tr class="text-c">
						<td><input type="checkbox" value="${infolist.goodsInfoId }" name="goodsInfoId"></td>
							<td>${infolist.goodsInfoGoodname }</td>
							<td><img src="${pageContext.request.contextPath }${infolist.goodsInfoDescImage }" width="50" height="50"></img></td>
							<td>${infolist.goodsInfoSalesnum}</td>
							
							<td>${infolist.goodsInfoPrice }</td>
							<td>${infolist.goodsInfoGoodstatus==1?'在售':''}${infolist.goodsInfoGoodstatus==2?'停止销售':''}${infolist.goodsInfoGoodstatus==3?'删除':''}</td>
							<td><c:forEach items="${typeNameList }" var="typeInfolist">${infolist.goodsInfoTId == typeInfolist.goodTypeId?typeInfolist.goodTypename : ''}</c:forEach></td>
							<td>${infolist.goodsInfoDescname }</td>
							<td class="td-manage">
							<a title="修改排名" href="javascript:;" onclick="return orderAction(this,${infolist.goodsInfoId })" 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">
	// 修改序号操作
	function orderAction(_this,goodsInfoId) {
			var $a = $(_this);
			$("#goodsInfoId").val(goodsInfoId);
			orderid = $a.attr("lang");
			$("#layui-remark").show();
			return false;
	}
	// 修改序号
	function remrakSumbit() {
		var goodSortingId = $("#goodSortingId").val();
		var goodsInfoId = $("#goodsInfoId").val();
		//序号数据验证
		if(!commonLengthJdg('goodSortingId',1,9,null,true)){
			layer.msg("序号长度为1-9位",{icon: 2,time:2000});
			return false;
		}
		if(!commonTypeJdg('goodSortingId','money',null,true)){
			layer.msg("序号不能为空或格式错误",{icon: 2,time:2000});
			return false;
		}
			$.ajax({
				   type: "POST",
				   url: '${pageContext.request.contextPath }/admin/goods/updateGoodsSorting',
				   data: $("#form-admin-remark").serialize(),
				   dataType: "json",
				   error:function(){
				      	  layer.msg(data.status,{icon: 5,time:2000});
				        },
				   success: function(data){
					   layer.msg(data.status,{icon: 1,time:1000});
					   window.location.href = '${pageContext.request.contextPath }/admin/goods/goodsSorting';
				   }
			});
	}
	
	// 关闭窗口
	function exitWindowsDiv(_this) {
		$(_this).parent().parent().hide();
	}
	/* $(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;
			}
		}
	}


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