<{import file="index/header_shop.html" title="促销活动"}>
<!--datapiker--> 
<link rel="stylesheet" type="text/css" href="<{$__PUBLIC__}>plug/laydate/need/laydate.css"> 
<link rel="stylesheet" type="text/css" href="<{$__PUBLIC__}>plug/laydate/skins/default/laydate.css"> 
<!--data end--->
<div class="tab_name"><a class="back" href="?m=goods_act&a=reduce">满减优惠</a></div> 
<div class="baseBox">
	<form id="form" method="post"> 
		<{if $row.id}><input type="hidden" name="id" id="id" value="<{$row.id}>"/><{/if}> 
		<table class="etable"> 
			<tr>
				<td width="120">减免名称： </td>
				<td><input type="text" name="name" size="40" id="name" value="<{$row.name}>"/></td>
			</tr>
			<tr>
				<td>开始时间： </td>
				<td>
					<span class="time"><input type="text" name="start_time" id="start_time" size="20" id="text" value="<{$row.start_time}>"/></span> 
					<span class="time"><i style="color:#666666;">结束时间：</i><input type="text" name="end_time" id="end_time" size="20" id="text" value="<{$row.end_time}>"/></span>
				</td>
			</tr> 
			<tr>
				<td>消费总金额：</td>
				<td><input type="text" name="total_price" size="15" id="total_price" value="<{$row.total_price}>"/></td>
			</tr>
			<tr>
				<td>减免的金额：</td>
				<td><input type="text" name="reduce_price" size="15" id="reduce_price" value="<{$row.reduce_price}>"/></td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td><input type="submit" name="submit" class="submit" value="保 存"/></td>
			</tr>  
		</table>
	</form> 
</div>
<{include file="index/footer.html"}>  
<script type="text/javascript" src="<{$__PUBLIC__}>plug/laydate/laydate.js"></script>
<script type="text/javascript"> 
var start = { 
	elem:'#start_time', format:'YYYY-MM-DD hh:mm:ss', min:laydate.now(), max:'2099-06-16 23:59:59',  istime:true, istoday:false, choose:function(datas){
		end.min = datas; 
		end.start = datas 
	}
};
var end = { 
	elem:'#end_time', format:'YYYY-MM-DD hh:mm:ss', min:laydate.now(), max:'2099-06-16 23:59:59', istime:true, istoday:false, choose:function(datas){
		start.max = datas; 
	}
};
laydate(start);
laydate(end);  

$(function(){ 
	$("form").submit(function(){
		var name = $("#name").val();
		if(name == ''){  $.alert('活动名称不能为空'); return false; }
		var start_time = $("#start_time").val();
		if(start_time == ''){  $.alert('开始时间不能为空');	 return false; }
		var end_time = $("#end_time").val();
		if(end_time == ''){ $.alert('结束时间不能为空'); return false;  } 
	 	$.ajax({
			type:'POST',
			url:'member.php?m=goods_act&a=reduce_save',
			data:$("#form").serialize(),
			success:function(result){ 
				var data = jQuery.parseJSON(result); 
				if(data.error == 0){
					$.alert('保存成功');
					location.reload();
				}else{ 
					$.alert(data.msg); 
				}
			},error:function(){
				$.alert('错误');
			}
		}); 
		return false;
 	}); 
	 
});
 
</script>