<!DOCTYPE html>
<html>
<head>{template head}
<script src="{JS_PATH}jquery-1.11.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="{JS_PATH}DateTimePicker.css" />
<script type="text/javascript" src="{JS_PATH}DateTimePicker.js"></script>
<style>
.dtpicker-comp input[type="text"]{
	background:none;
	padding:0;
}
</style>
</head>
<body>
	{template header}
		{template here}
		<div class="signin-form">
			<blockquote class="layui-elem-quote layui-quote-nm txt-lt f08e">
			<i class="layui-icon">&#xe60b;</i> 请设置好奖品名称及中奖数量;<br/>
			<i class="layui-icon">&#xe60b;</i> 中奖概率为奖品数量值，奖品数量越少，中奖概率越低，如为0，则不会中奖;<br/>
			<i class="layui-icon">&#xe60b;</i> 如果设置无空奖，请将奖品总数量与奖券数量保持一致，否则奖品领完后依然会出现空奖;
			</blockquote>
			<div class="login-form post_li">
				<form method="post" action="post.php" id="InputsWrapper">				
					<ul>
						{loop $custom $item}
						<li><h4>{$item[cusname]}</h4>{$item[html]}</li>
						{/loop}
						<div class="clear"></div>
						<li class="pad_1"><h4>抽奖券数量</h4><input name="nums" type="number" required="" value="" lay-verify="number" autocomplete="off"></li>
						{if ($catinfo[pay]==1)}
						<li class="pad_1"><h4>购券价格</h4><input name="money" type="number" value="" placeholder="如免费领取则无需填写" lay-verify="numbers" step="0.01" autocomplete="off"></li>
						{/if}
						{if ($catinfo[minipay]==1)}
						<li class="pad_1"><h4>最低消费金额</h4><input name="dx" type="number" value="" placeholder="满多少元可用，不填为不限" lay-verify="numbers" step="0.01" autocomplete="off"></li>
						{/if}
						<li class="pad_1"><h4>空奖状态</h4>
						<div class="box_input pad_1">
							<p><input type="checkbox" name="jiangnull" value="1" id="jiangnull"><label for="jiangnull"> 无空奖</label></p>
						</div><div class="clear"></div>
						</li>
						<div id="adds"></div>
						<li class="pad_1"><div class="txt-center"><a href="javascript:void(0)" id="add" class="layui-btn  layui-btn-primary"><i class="layui-icon">&#xe654;</i> 添加奖品和对应中奖数量</a></div></li>
						<li><h4>领券截止日期</h4><input name="enddate" type="text" required="" value="" data-field="date" readonly></li>
						<li class="pad_1"><h4>领券后有效天</h4><input name="userdate" placeholder="领券后几天有效,空则默认{$CFG['myjuan_day']}天" type="number" value="" lay-verify="number" autocomplete="off"></li>
						<li class="pad_1"><h4>可领取次数</h4><input name="usernum" type="number" required="" value="" lay-verify="number" autocomplete="off"></li>
						<li class="pad_1"><h4>抽奖限制</h4>
						<select name="foruser">
							<option value="0">全部会员可抽奖</option>
							<option value="1">仅本店核销过会员可抽奖</option>
						</select>
						</li>
						<li class="pad_1"><h4>抽奖券说明</h4><textarea name="jinfo" rows="1" placeholder="选填"></textarea></li>
						<div id="dtBox"></div>
						<input type="hidden" name="catid" value="{$catid}" />
						<input type="hidden" name="jid" value="1" />
						<input type="hidden" name="act" value="postmsg">
						<input type="submit" value="发布" class="layui-btn layui-btn-big layui-btn-normal" name="submit">
					</ul>
					<div class="clear h_1"> </div>
				</form>
			</div>
		</div>
		<!--//signin-form-->

<script type="text/javascript">
$(document).ready(function(){
	$("#dtBox").DateTimePicker();
	i = 1;
	document.getElementById("add").onclick=function(){
		if(i<={$CFG['jiang_jp_num']}){
		document.getElementById("adds").innerHTML+='<div id="div_'+i+'"><li><h4><a onclick="dels(\''+i+'\')"/><i class="layui-icon">&#x1007;</i></a> 奖品名称</h4><input name="jiangnum'+i+'" type="text" required="" placeholder="奖品名称" value="" /></li><li class="pad_1"><h4>奖品数量</h4><input name="jiangnum_'+i+'" placeholder="奖品数量" type="number" required="" value="" lay-verify="number" autocomplete="off" /></li></div>';
		i++;
		}else{
			alert('不能在添加了~~');
			return false;
		}
	}
});
function dels(o){
	 document.getElementById("adds").removeChild(document.getElementById("div_"+o));
	 i=i-1;
}
</script>
<script>
layui.use(['form','element'], function(){
  var form = layui.form();
  var element = layui.element();
});
</script>
</body>
</html>