<%@ 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 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.login.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/style.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" />
<title>添加商品</title>
</head>
<body>
<div class="pd-20">
	<form action="${pageContext.request.contextPath }/admin/goods/addGoodsUI" class="form form-horizontal" id="form-addGoods" method="POST" enctype="multipart/form-data">
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>商品名称：</label>
			<div class="formControls col-10">
				<input id="goodsInfoGoodname" name="goodsInfoGoodname" type="text" class="input-text" value="" placeholder="" >
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">商品简称：</label>
			<div class="formControls col-10">
				<input id="goodsInfoDescname" name="goodsInfoDescname" type="text" class="input-text" value="" placeholder="">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>商品类型：</label>
			<div class="formControls col-2"> <span class="select-box">
				<select id="goodstype" name="goodsInfoType" class="select" onchange="showHidden();">
						<option value="1">销售产品</option>
						<option value="2">积分产品</option>
				</select>
				</span> 
			</div>
			<label id="integralLabel" class="form-label col-2" style="display: none">所需积分：</label>
			<div id="integralDiv" class="formControls col-2" style="display: none">
				<input id="integral" name="goodsInfoIntegralNum" type="text" class="input-text" value="" placeholder="" >
			</div>
		</div>
		<div class="row cl">
		<label class="form-label col-2"><span class="c-red">*</span>所属分类：</label>
			<div class="formControls col-2"> <span class="select-box">
				<select id="goodsInfoTId" name="goodsInfoTId" class="select" >
				<c:forEach items="${typeNameList }" var="infolist">
					<option value="${infolist.goodTypeId }">${infolist.goodTypename }</option>
				</c:forEach>
				</select>
				</span> 
			</div>
			<label class="form-label col-2">商品重量：</label>
			<div class="formControls col-4">
				<input id="goodsInfoWeight"  type="text" name="goodsInfoWeight" placeholder="" value="" class="input-text" style="width:90%"></div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">商品原价：</label>
			<div class="formControls col-2">
				<input id="goodsInfoPrice" type="text" name="goodsInfoPrice" id="" placeholder="" value="" class="input-text" style="width:90%">元</div>
			<label class="form-label col-2">商品优惠价：</label>
			<div class="formControls col-2">
				<input id="goodsInfoDiscount" type="text" name="goodsInfoDiscount" id="" placeholder="" value="" class="input-text" style="width:90%">元</div>
		</div>
		<div class="row cl">
			<label id="integralLabel" class="form-label col-2">品牌：</label>
			<div id="integralDiv" class="formControls col-2">
				<input id="goodsInfoBrand" name="goodsInfoBrand" type="text" class="input-text" value="" placeholder="">
			</div>
			<label id="integralLabel" class="form-label col-2">商品原料：</label>
			<div id="integralDiv" class="formControls col-2">
				<input id="goodsInfoIngredients" name="goodsInfoIngredients" type="text" class="input-text" value="" placeholder="">
			</div>
		</div>
		<div class="row cl">
			<label id="integralLabel" class="form-label col-2">是否推荐上首页：</label>
			<div class="formControls col-2"> <span class="select-box">
				<select id="goodsInfoIndex" name="goodsInfoIndex" class="select">
						<option value="1">推荐到首页</option>
						<option value="2">不推荐到首页</option>
				</select>
				</span> 
			</div>
			<label class="form-label col-2">产地：</label>
			<div  class="formControls col-2">
				<input id="goodsInfoOrigin" name="goodsInfoOrigin" type="text" class="input-text" value="" placeholder="">
			</div>
		</div>
		<div class="row cl">
			<label id="integralLabel" class="form-label col-2">保质期：</label>
			<div id="integralDiv" class="formControls col-2">
				<input id="goodsInfoShelf" name="goodsInfoShelf" type="text" class="input-text" value="" placeholder="" style="width:90%">天</div>
			<label id="integralLabel" class="form-label col-2">备注：</label>
			<div id="integralDiv" class="formControls col-2">
				<textarea id="" name="goodsInfoNote" class="textarea-text" placeholder="" style="width:200px;height:60px;"></textarea>
			</div>
		</div>
		<div class="row cl">
		<label class="form-label col-2"><span class="c-red">*</span>包装类型：</label>
			<div id="integralDiv" class="formControls col-2">
				<input id="goodsInfoPackagingType" name="goodsInfoPackagingType" type="text" class="input-text" value="" placeholder="">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">商品介绍：</label>
			<div class="formControls col-5"> 
				<textarea id="goodsInfoGooddesc" name="goodsInfoGooddesc" cols="" rows="" class="textarea"></textarea>
			</div>
		</div>
		<div class="row cl">
		<label class="form-label col-2">商品封面图：</label>
			<div class="col-10 ">
				<input type="file" name="file" size="50">
			</div>
		</div>
		<div class="row cl">
		<label class="form-label col-2">商品介绍图：</label>
			<input name="goodsimages" class="urlClass1" type="text" id="url1" value="" /> <i class="Hui-iconfont">&#xe642;</i> <input type="button" class="addImagesClass btn btn-primary radius upload-btn" id="imageFile1" value="选择图片" />
		</div>
		<div id="spots" class="row cl">
		<label class="form-label col-2"></label> 
			<input id="addimages" class="btn btn-primary radius upload-btn" type="button" value="新增介绍图" />
		</div>
		<div class="row cl">
			<div class="col-10 col-offset-2">
				<button onClick="return admin_addGoods();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
			</div>
		</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/js/ueditor.all.min.js"></script> 
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/ueditor.config.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/js/utils/tools.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/js/utils/jquery-1.9.1.min.js"></script>
<script charset="utf-8" src="/ratfw/common/other/kingedit/kindeditor-min.js"></script>
<script charset="utf-8" src="/ratfw/common/other/kingedit/lang/zh_CN.js"></script> 	
<!-- 注册文本编辑器 -->
<script type="text/javascript">
	KindEditor.ready(function(K) {
        window.editor = K.create('#goodsInfoGooddesc',{
        	fileManagerJson : '/ratfw/common/other/kingedit/jsp/file_manager_json.jsp',
            uploadJson : '/ratfw/common/other/kingedit/jsp/upload_json.jsp',
             allowFileManager : true,
             width : '920px'
         });
	});
</script>
	
<script type="text/javascript">
function admin_addGoods(){
			 //商品名称数据验证
			if(!commonLengthJdg('goodsInfoGoodname',1,30,null,true)){
				layer.msg("商品名称长度为1-30位",{icon: 2,time:2000});
				return false;
			}
			 //商品简称数据验证
			if(!commonLengthJdg('goodsInfoDescname',1,10,null,true)){
				layer.msg("商品简称长度为1-10位",{icon: 2,time:2000});
				return false;
			}
			 //商品简称数据验证
			if(!commonLengthJdg('goodsInfoDescname',1,10,null,true)){
				layer.msg("商品简称长度为1-10位",{icon: 2,time:2000});
				return false;
			}
			if($("#goodstype").val() == 2){
				//所需积分数据验证
				if(!commonLengthJdg('integral',1,9,null,true)){
					layer.msg("所需积分长度为1-9位",{icon: 2,time:2000});
					return false;
				}
				if(!commonTypeJdg('integral','money',null,true)){
					layer.msg("积分不能为空或格式错误",{icon: 2,time:2000});
					return false;
				}
			}
			 //商品重量数据验证
			if(!commonLengthJdg('goodsInfoWeight',1,100,null,true)){
				layer.msg("商品重量长度为1-100位",{icon: 2,time:2000});
				return false;
			}
			 //商品原价数据验证
			if(!commonTypeJdg('goodsInfoPrice','money',null,true)){
				layer.msg("商品原价须为金钱格式",{icon: 2,time:2000});
				return false;
			}
			if(!commonLengthJdg('goodsInfoPrice',1,9,null,true)){
				layer.msg("商品原价长度为1-9位",{icon: 2,time:2000});
				return false;
			}
			 //商品优惠价数据验证
			if(!commonTypeJdg('goodsInfoDiscount','money',null,true)){
				layer.msg("商品优惠价须为金钱格式",{icon: 2,time:2000});
				return false;
			}
			if(!commonLengthJdg('goodsInfoDiscount',1,9,null,true)){
				layer.msg("商品优惠价长度为1-9位",{icon: 2,time:2000});
				return false;
			}
			 //品牌数据验证
			if(!commonLengthJdg('goodsInfoBrand',1,100,null,true)){
				layer.msg("品牌长度为1-50位",{icon: 2,time:2000});
				return false;
			}
			 //商品原料数据验证
			if(!commonLengthJdg('goodsInfoIngredients',1,500,null,true)){
				layer.msg("商品原料长度为1-250位",{icon: 2,time:2000});
				return false;
			}
			 //保质期数据验证
			if(!commonLengthJdg('goodsInfoShelf',1,10,null,true)){
				layer.msg("保质期长度为1-5位",{icon: 2,time:2000});
				return false;
			}
			//商品包装数据验证
			if(!commonLengthJdg('goodsInfoPackagingType',1,10,null,true)){
				layer.msg("商品包装长度为1-5位",{icon: 2,time:2000});
				return false;
			}
			//场地数据验证
			if(!commonLengthJdg('goodsInfoOrigin',1,10,null,true)){
				layer.msg("场地长度为1-5位",{icon: 2,time:2000});
				return false;
			}
			//安装方式数据验证
			if(!commonLengthJdg('goodsInfoInstallation',1,10,null,true)){
				layer.msg("安装方式长度为1-5位",{icon: 2,time:2000});
				return false;
			}
			//寿命数据验证
			if(!commonLengthJdg('goodsInfoLife',1,10,null,true)){
				layer.msg("寿命长度为1-5位",{icon: 2,time:2000});
				return false;
			}
}






</script>
</body>
</html>