<%@ 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 prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<!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 class="form form-horizontal" id="form-addGoods">
	<input name="systemRuleId" type="hidden" value="${goodsSystemRuleinfo.systemRuleId }">
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>奖励数量：</label>
			<div class="formControls col-2">
				<input id="systemRuleNum" name="systemRuleNum" value="${goodsSystemRuleinfo.systemRuleNum }" 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">
				<textarea id="" name="systemRuleDesc" class="textarea-text" placeholder="" style="width:200px;height:60px;">${goodsSystemRuleinfo.systemRuleDesc }</textarea>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>奖励类型：</label>
			<div class="formControls col-3"> 
				<span class="select-box">
					<select id="systemRuleType" name="systemRuleType" class="select">
						<option value="1" ${goodsSystemRuleinfo.systemRuleType==1?'selected':''}>完善信息后奖励</option>
						<option value="2" ${goodsSystemRuleinfo.systemRuleType==2?'selected':''}>每天签到奖励</option>
						<option value="3" ${goodsSystemRuleinfo.systemRuleType==3?'selected':''}>购物后奖励%比,所以为小数</option>
						<option value="4" ${goodsSystemRuleinfo.systemRuleType==4?'selected':''}>分享推广奖励</option>
						<option value="5" ${goodsSystemRuleinfo.systemRuleType==5?'selected':''}>下线购物时，对上线奖励</option>
						<option value="6" ${goodsSystemRuleinfo.systemRuleType==6?'selected':''}>用户首次关注公众号奖励</option>
						<option value="7" ${goodsSystemRuleinfo.systemRuleType==7?'selected':''}>有上线的用户消费时，优惠比例</option>
						<option value="8" ${goodsSystemRuleinfo.systemRuleType==8?'selected':''}>每日分享奖励次数</option>
						<option value="9" ${goodsSystemRuleinfo.systemRuleType==9?'selected':''}>用户提现的积分下限</option>
						<option value="10" ${goodsSystemRuleinfo.systemRuleType==10?'selected':''}>包邮的额度，满M元包邮</option>
						<option value="11" ${goodsSystemRuleinfo.systemRuleType==11?'selected':''}>邮费，未满M元，需要的邮费</option>
						<option value="12" ${goodsSystemRuleinfo.systemRuleType==12?'selected':''}>可以退换货的天数</option>
						<option value="13" ${goodsSystemRuleinfo.systemRuleType==13?'selected':''}>一个积分抵扣多少人民币</option>
					</select>
				</span> 
			</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="systemRuleStatus" name="systemRuleStatus" class="select">
				<option value="1" ${goodsSystemRuleinfo.systemRuleStatus==1?'selected':''}>是</option>
				<option value="2" ${goodsSystemRuleinfo.systemRuleStatus==2?'selected':''}>否</option>
				</select>
				</span> 
			</div>
		</div>
		<div class="row cl">
			<div class="col-10 col-offset-2">
				<button id="submit" onClick="systemRule_update();" class="btn btn-primary radius" type="button"><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">

/*数据验证*/
function systemRule_update(){
		//奖励数量数据验证-
		if(!commonTypeJdg('systemRuleNum','money',null,true)){
			layer.msg("奖励数量须为金钱格式",{icon: 2,time:2000});
			return false;
		}
		if(!commonLengthJdg('systemRuleNum',1,9,null,true)){
			layer.msg("奖励数量长度为1-9位",{icon: 2,time:2000});
			return false;
		}
		$.ajax({
			url : '${pageContext.request.contextPath }/admin/goodsSystemRule/updateSystemRule',
			type : "POST",
			dataType : "json",
			data : $("#form-addGoods").serialize(),
			beforeSubmit: function (data) {
            	  $("#submit").attr("disabled","disabled");
              },
			success : function(data) {
				layer.msg(data.status,{icon: 1,time:2000},function(){
					$("#submit").attr("disabled","");
	            	returnSuperior();
				});
			},
			error : function(data) {
				layer.msg(data.status,{icon: 5,time:2000});
			}
		});
}
//返回查看页面
function returnSuperior(){
	window.location.href = '${pageContext.request.contextPath }/admin/goodsSystemRule/tolistSystemRuleUI';
}
</script>
</body>
</html>