<?php include_once(mvc::$cfg['PATH_TPL'].'public/topSeller.php');?>
<div class="maintb">
	<?php include_once(mvc::$cfg['PATH_TPL'].'seller/leftMenu.php');?>
	<!-- 中间 -->
	<div id="promotion-main-middle" class="main_middle">
		<div class="navrow">
			<ul class="navrow_ul">
				<li class="active">
					<a href="javascript:;">满减优惠</a>
				</li>
				<li>
					<a href="/seller/shopBaoyou">店铺包邮</a>
				</li>
				<li>
					<a href="/seller/shopComMember">企业会员设置</a>
				</li>
			</ul>
		</div>
		<div class="table-content">
			<button class="btn btn-default add-manjianguize-btn" data-toggle="modal" data-target="#myModal">
				添加满减规则
			</button>
			<?php if(!empty($manjianDataNow)){ ?>
			<?php foreach($manjianDataNow as $key =>$value){ ?>
			<table class="table tableManjian_<?php echo $value['man_id'];?>" style="margin-bottom: 20px;">
				<input type="hidden" value="<?php echo date('Y-m-d H:i:s',$value['man_btime']);?>" name='BTIME'>
				<input type="hidden" value="<?php echo date('Y-m-d H:i:s',$value['man_etime']);?>" name='ETIME'>
				<thead>
					<tr >
						<th class="working-th" colspan="3">
							<span style="float: left;">&nbsp;<span class="glyphicon glyphicon-tag"  aria-hidden="true"></span>&nbsp;&nbsp;优惠中</span>
							<?php echo $value['man_name'];?>
							<span id="promotion-main-middle-right-top" style="float: right;"><span class="glyphicon glyphicon-tasks" title="编辑" onclick="editThisManjianRecord('<?php echo $value['man_name'];?>',<?php echo $value['man_id'];?>,<?php echo $value['man_full_money'];?>,<?php echo $value['man_cut_money'];?>)"  aria-hidden="true"></span>
							&nbsp;&nbsp;
							<span onclick="MESSAGE.confirm('确定删除该条满减规则吗？','delThisManjianRecord(<?php echo $value['man_id'];?>)')" class="glyphicon glyphicon-trash" title="删除" aria-hidden="true"></span>&nbsp;&nbsp;
						</span></th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td style="width: 150px;">&nbsp;<span class="glyphicon glyphicon-gift" aria-hidden="true"></span>&nbsp;&nbsp;满减规则</td>
						<td colspan="2">
							满<span style="color: red"><?php echo sprintf("%.2f",$value['man_full_money']);?></span>
							减价<span style="color: red"><?php echo sprintf("%.2f",$value['man_cut_money']);?></span>！
						</td>
					</tr>
					<tr>
						<td style="width: 150px;">&nbsp;<span class="glyphicon glyphicon-time" aria-hidden="true"></span>&nbsp;&nbsp;时间</td>
						<td colspan="2"><?php echo date('Y-m-d H:i:s',$value['man_btime']);?> 到 <?php echo date('Y-m-d H:i:s',$value['man_etime']);?></td>
					</tr>
				</tbody>
			</table>
			<?php } ?>
			<?php } ?>
			<?php if(!empty($manjianDataFuture)){ ?>
			<?php foreach($manjianDataFuture as $key =>$value){ ?>
			<table class="table tableManjian_<?php echo $value['man_id'];?>" style="margin-bottom: 20px;">
				<input type="hidden" value="<?php echo date('Y-m-d H:i:s',$value['man_btime']);?>" name='BTIME'>
				<input type="hidden" value="<?php echo date('Y-m-d H:i:s',$value['man_etime']);?>" name='ETIME'>
				<thead>
					<tr class="success">
						<th  style="text-align: center;" colspan="3">
							<span style="float: left;">&nbsp;<span class="glyphicon glyphicon-tag"  aria-hidden="true"></span>&nbsp;&nbsp;未生效</span>
							<?php echo $value['man_name'];?>
							<span id="promotion-main-middle-right-top" style="float: right;"><span class="glyphicon glyphicon-tasks" title="编辑" onclick="editThisManjianRecord('<?php echo $value['man_name'];?>',<?php echo $value['man_id'];?>,<?php echo $value['man_full_money'];?>,<?php echo $value['man_cut_money'];?>)"  aria-hidden="true"></span>
							&nbsp;&nbsp;
							<span onclick="MESSAGE.confirm('确定删除该条满减规则吗？','delThisManjianRecord(<?php echo $value['man_id'];?>)')" class="glyphicon glyphicon-trash" title="删除" aria-hidden="true"></span>&nbsp;&nbsp;
						</span></th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td style="width: 150px;">&nbsp;<span class="glyphicon glyphicon-gift" aria-hidden="true"></span>&nbsp;&nbsp;满减规则</td>
						<td colspan="2">满<span style="color: red"><?php echo sprintf("%.2f",$value['man_full_money']);?></span>
										减价<span style="color: red"><?php echo sprintf("%.2f",$value['man_cut_money']);?></span>！
						</td>
					</tr>
					<tr>
						<td style="width: 150px;">&nbsp;<span class="glyphicon glyphicon-time" aria-hidden="true"></span>&nbsp;&nbsp;时间</td>
						<td colspan="2"><?php echo date('Y-m-d H:i:s',$value['man_btime']);?> 到 <?php echo date('Y-m-d H:i:s',$value['man_etime']);?></td>
					</tr>
				</tbody>
			</table>
			<?php } ?>
			<?php } ?>
			<?php if(!empty($manjianDataPre)){ ?>
			<?php foreach($manjianDataPre as $key =>$value){ ?>
			<table class="table gray2 tableManjian_<?php echo $value['man_id'];?>" style="margin-bottom: 20px;">
				<input type="hidden" value="<?php echo date('Y-m-d H:i:s',$value['man_btime']);?>" name='BTIME'>
				<input type="hidden" value="<?php echo date('Y-m-d H:i:s',$value['man_etime']);?>" name='ETIME'>
				<thead>
					<tr>
						<th  style="text-align: center;" colspan="3">
							<span style="float: left;">&nbsp;<span class="glyphicon glyphicon-tag"  aria-hidden="true"></span>&nbsp;&nbsp;已失效</span>
							<?php echo $value['man_name'];?>
							<span id="promotion-main-middle-right-top" style="float: right;"><span class="glyphicon glyphicon-tasks" title="编辑" onclick="editThisManjianRecord('<?php echo $value['man_name'];?>',<?php echo $value['man_id'];?>,<?php echo $value['man_full_money'];?>,<?php echo $value['man_cut_money'];?>)" aria-hidden="true"></span>
							&nbsp;&nbsp;
							<span onclick="MESSAGE.confirm('确定删除该条满减规则吗？','delThisManjianRecord(<?php echo $value['man_id'];?>)')" class="glyphicon glyphicon-trash" title="删除" aria-hidden="true"></span>&nbsp;&nbsp;
						</span></th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td style="width: 150px;">&nbsp;<span class="glyphicon glyphicon-gift" aria-hidden="true"></span>&nbsp;&nbsp;满减规则</td>
						<td colspan="2">满<span style="color: red"><?php echo sprintf("%.2f",$value['man_full_money']);?></span>减价<span style="color: red"><?php echo sprintf("%.2f",$value['man_cut_money']);?></span>！</td>
					</tr>
					<tr>
						<td style="width: 150px;">&nbsp;<span class="glyphicon glyphicon-time" aria-hidden="true"></span>&nbsp;&nbsp;时间</td>
						<td colspan="2"><?php echo date('Y-m-d H:i:s',$value['man_btime']);?> 到 <?php echo date('Y-m-d H:i:s',$value['man_etime']);?></td>
					</tr>
				</tbody>
			</table>
			<?php } ?>
			<?php } ?>

			<!-- 添加满减规则模态框 -->
			<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								&times;
							</button>
							<h4 class="modal-title" id="myModalLabel">
								添加满减规则
								<button class="btn btn-danger number-rule">请输入大于零的数字！</button>
							</h4>
						</div>
						<form id="add-manjianguize-from" method="POST"  >
							<div class="modal-body">
								<i class="required">*</i>优惠名称：
								<input  id="man_name" type="text" class="form-control" name="man_name"><br/><br/>
								<i class="required">*</i>优惠内容：
								<span>满</span>
								<input  id="FULL_MONEY" type="text" class="form-control" name="FULL_MONEY"><br/><br/>
								<span class="jianzi">减</span>
								<input  id="CUT_MONEY" type="text" class="form-control" name="CUT_MONEY"><br/><br/>
								<i class="required">*</i>开始时间：
								<input type="text" readonly  id="MANJIAN_BTIME" class="form-control" value="" name="MANJIAN_BTIME"><br/><br/>
								<i class="required">*</i>结束时间：
								<input type="text" readonly  id="MANJIAN_ETIME" class="form-control" value="" name="MANJIAN_ETIME">
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-default" data-dismiss="modal">
									关闭
								</button>
								<button id="add-manjianguize-from-btns" type="button" class="btn btn-primary">
									保存
								</button>
							</div>
						</form>
					</div>
				</div>
			</div>
			<!-- 编辑满减规则模态框 -->
			<div class="modal fade" id="myModaltwo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								&times;
							</button>
							<h4 class="modal-title" id="myModalLabel">
								编辑满减规则
								<button class="btn btn-danger number-rule">请输入大于零的数字！</button>
							</h4>
						</div>
						<form id="validaFormEditManjian" method="POST">
							<div class="modal-body">
								<input  id="man_id_EDIT" type="hidden" class="form-control" name="man_id_EDIT">
								<i class="required">*</i>优惠名称：
								<input  id="man_name_EDIT" type="text" class="form-control" name="man_name_EDIT"><br/><br/>
								<i class="required">*</i>优惠内容：
								满<input  id="FULL_MONEY_EDIT" type="text" class="form-control" name="FULL_MONEY_EDIT"><br/><br/>
								<span  class="jianzi">减</span><input id="CUT_MONEY_EDIT" type="text" class="form-control" name="CUT_MONEY_EDIT"><br/><br/>
								<i class="required">*</i>开始时间：
								<input type="text" readonly  id="MANJIAN_BTIME_EDIT" class="form-control" value="" name="MANJIAN_BTIME_EDIT"><br/><br/>
								<i class="required">*</i>结束时间：
								<input type="text" readonly  id="MANJIAN_ETIME_EDIT" class="form-control" value="" name="MANJIAN_ETIME_EDIT">
							</div>
						</form>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">关闭
							</button>
							<button id="savenewManjianedit" type="button" class="btn btn-primary">
								保存
							</button>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="clear"></div>
	</div>
	<?php include_once(mvc::$cfg['PATH_TPL'].'public/footAll.php');?>
<script type="text/javascript">
	var dateTime='<?php echo date('Y-m-d H:i:s',time());?>';
	
</script>

<script type="text/javascript">
$(document).ready(function(){
	promotionInit();
});
</script>