| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?php include Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . "viewc/admin/headAndLeftWrapper.php"; ?>
- <div class="mainWrapper container-fluid">
- <div class="page-header pageTop">
- <h3>代金券</h3>
- </div>
- <div class="tableContent">
- <div class="tab-content">
- <div class="tabMain">
- <div class="shopContent clearfix">
- <div class="sort" style="margin-right:20px;">
- <button class="btn btn-primary" data-toggle="modal" data-target="#addVoucher">添加代金券</button>
- </div>
- <div class="sort" style="margin-right:20px;">
- <select class="form-control" id="searchList">
- <option value="-1">全部状态</option>
- <option value="1" <?php if( isset($data['status']) && $data['status'] == 1 ): ?>selected<?php endif; ?>>进行中</option>
- <option value="2" <?php if( isset($data['status']) && $data['status'] == 2 ): ?>selected<?php endif; ?>>已结束</option>
- <option value="0" <?php if( isset($data['status']) && $data['status'] == 0 ): ?>selected<?php endif; ?>>未开始</option>
- </select>
- </div>
- </div>
- <div class="tableContent">
- <table class="table table-hover">
- <thead>
- <th width="300">活动名</th>
- <th width="100">领取码</th>
- <th width="100">金额</th>
- <th width="100">数量/领取</th>
- <th width="150">开始时间</th>
- <th width="150">结束时间</th>
- <th width="100">状态</th>
- <th width="100">操作</th>
- </thead>
- <tbody>
- <?php if( isset($data['voucherlist']) ): ?>
- <?php foreach($data['voucherlist'] as $k1=>$v1): ?>
- <tr>
- <td><?php echo $v1['vname']; ?></td>
- <td><?php echo $v1['vcode']; ?></td>
- <td>¥<?php echo $v1['vcost']; ?></td>
- <td <?php if( $v1['vcount'] != 0 && $v1['hadnum'] >= $v1['vcount'] ): ?>class="text-danger"<?php endif; ?>><?php if( $v1['vcount'] == 0 ): ?>不限/<?php echo $v1['hadnum']; ?><?php else: ?><?php echo $v1['vcount']; ?>/<?php echo $v1['hadnum']; ?><?php endif; ?></td>
- <td><?php echo formatDate($v1['vstarttime']); ?></td>
- <td <?php if( $data['thistime'] >= $v1['vendtime'] ): ?>class="text-danger"<?php endif; ?>><?php echo formatDate($v1['vendtime']); ?></td>
- <td><?php if( $v1['status'] == 0 ): ?><span class="text-warning">未开始</span><?php elseif( $v1['status'] == 1 ): ?><span class="text-success">进行中</span><?php elseif( $v1['status'] == 2 ): ?><span class="text-muted">已结束</span><?php endif; ?></td>
- <td><?php if( $v1['status'] == 0 ): ?><a href="/m/delvoucher/<?php echo $v1['id']; ?>" class="text-danger"><i class="glyphicon glyphicon-remove"></i> 删除</a><?php endif; ?></td>
- </tr>
- <?php endforeach; ?>
- <?php endif; ?>
- </tbody>
- </table>
- <nav style="margin: 30px 0">
- <?php echo $data['pager']; ?>
- </nav>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- mainWrapper end -->
- </div>
- <!-- 添加限期代金券开始 -->
- <div class="modal fade" id="addVoucher" tabindex="-1" role="dialog" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title" id="myModalLabel">添加代金券</h4>
- </div>
- <form role="form" action="/m/setvoucher" onsubmit="return checksubmit();" method="post">
- <div class="modal-body">
- <div class="form-group">
- <label>活动名称</label>
- <input type="text" name="vname" id="vname" class="form-control" placeholder="输入活动名称">
- </div>
- <div class="form-group">
- <label>单张代金券金额(限额20)</label>
- <input type="number" name="vcost" id="vcost" max="20" step="0.01" class="form-control" placeholder="输入单张代金券金额">
- </div>
- <div class="form-group">
- <label>发放数量(限额100)</label>
- <input type="number" name="vcount" max="100" class="form-control" placeholder="输入代金券数量">
- <p class="help-block text-danger">数量为空,则为不限量,代金券领取完毕,活动也将结束</p>
- </div>
- <div class="form-group">
- <div>
- <label>活动时间</label>
- <input type="date" name="starttime" id="starttime" class="form-control" value="<?php echo formatDateTime($data['starttime']); ?>">00:00:00
- <p class="text-center">至</p>
- <input type="date" name="endtime" id="endtime" class="form-control">23:59:59
- <p class="help-block text-danger">开始时间不能为活动添加当天</p>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
- <button type="submit" class="btn btn-primary">确定添加</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <script>
- $(function(){
- $('#searchList').change(function(){
- var html = '';
- if($(this).val() != -1){
- html += '/status/'+$(this).val();
- }
- window.location.href = '/m/voucher'+html;
- })
- });
- function checksubmit(){
- if($('#vname').val() == ''){
- alert('活动名不能为空');
- return false;
- }
- if($('#vcost').val() == ''){
- alert('金额不能为空');
- return false;
- }
- if($('#starttime').val() == ''){
- alert('请选择开始日期');
- return false;
- }
- if($('#endtime').val() == ''){
- alert('请选择结束日期');
- return false;
- }
- var time = new Date($('#starttime').val()+' 00:00:00');
- if(time.getTime()/1000 < <?php echo $data['starttime']; ?>){
- alert('开始时间不能小于或等于活动添加当天');
- return false;
- }
- if(new Date($('#endtime').val()+' 23:59:59').getTime()/1000 < time/1000){
- alert('结束时间不能小于开始时间');
- return false;
- }
- }
- </script>
- </body>
- </html>
|