赛亿提成统计系统

index.html 10KB

    <!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="/static/css/base.css"> <link rel="stylesheet" href="/static/css/bootstrap.min.css"> <link rel="stylesheet" href="/static/css/index.css"> <script src="/static/js/jquery.min.js"></script> <script src="/static/js/bootstrap.min.js"></script> <title>销售单位管理</title> </head> <body> <div class="wrap container"> <div class="header"> <a href="/"><span><img src="/img/logo.jpg" alt=""></span></a> <span>北京赛亿科技有限公司</span> </div> <div class="aside"> <div class="col-md-12 lin-height text_center"><a href="/index">提成汇总</a></div> <div class="col-md-12 lin-height text_center"><a href="/index/commission">计提数据录入</a></div> <div class="col-md-12 lin-height text_center"><a href="/index/seller">销售员管理</a></div> <div class="col-md-12 lin-height text_center"><a href="/index/company">销售单位管理</a></div> </div> <div class="content"> <div class="row"> <div class="col-md-3"> </div> <div class="col-md-3 text_center"> <h4>销售单位管理</h4> </div> </div> <div class="row"> <form action="/index/company/index" method="get"> <div class="col-md-1"> </div> <div class="col-md-4"> <input type="text" class="form-control" name="key" id="key" value="<?php echo isset($key) ? $key: '';?>" placeholder="请输入公司名称"> </div> <div class="col-md-3" style="text-align:left;"> <div class="btn-group "> <button type="submit" class="btn btn-success">搜索</button> </div> <div class="btn-group "> <button type="button" class="btn btn-danger ml-10" onclick="window.location.href='/index/company/index'">清除</button> </div> </div> </form> <div class="col-md-3" style="text-align:right;"> <div class="btn-group "> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">新增</button> </div> </div> </div> <div class="col-md-12" style="margin-top: 20px;"> <table class=" table table-hover table-bordered"> <thead> <tr> <th class="text-center">序 号</th> <th class="text-center">公司名称</th> <th class="text-center">余额初期值</th> <th class="text-center">操作</th> </tr> </thead> <tbody> <?php foreach ($data['list'] as $value) { ?> <tr> <td class="text-center"><?php echo $value['id'] ?></td> <td class="text-center"><?php echo $value['name'] ?></td> <td class="text-center"><?php echo $value['initial_balance'] ?></td> <td class="text-center"> <button class="btn btn-primary radius btn-xs" type="button" onClick="modify(<?php echo $value['id']; ?>,'<?php echo $value['name']; ?>','<?php echo $value['initial_balance']; ?>')">修改</button> <button class="btn btn-danger radius btn-xs" type="button" onClick="del(<?php echo $value['id']; ?>, this)">删除</button></td> </tr> <?php } ?> </tbody> </table> </div> </div> <div> <nav aria-label="Page navigation" class="page_navigation"> <ul class="pagination"> <li> <a href="?page=1<?php echo isset($key) ? '&key='.$key : '';?>"> <span aria-hidden="true">首页</span> </a> </li> <?php $total = $data['total']; $page = $data['page']; $limit = $data['limit']; $pages = intval($total/$limit) + 1; ?> <li> <a href="?page=<?php echo ($page-1)==0 ? 1 : $page-1; ?><?php echo isset($key) ? '&key='.$key : '';?>" aria-label="Previous"> <span aria-hidden="true">&laquo;</span> </a> </li> <?php $li = (($pages - $page) >= 5 ? 4 : $pages - $page) + 1; for ($i=0;$i<$li;$i++) { ?> <li><a href="?page=<?php echo $i + $page; ?><?php echo isset($key) ? '&key='.$key : '';?>"><?php echo $i + $page; ?></a></li> <?php } ?> <li> <a href="?page=<?php echo ($page+1)>=$pages ? $pages : $page+1; ?><?php echo isset($key) ? '&key='.$key : '';?>" aria-label="Next"> <span aria-hidden="true">&raquo;</span> </a> </li> <li> <a href="?page=<?php echo $pages;?><?php echo isset($key) ? '&key='.$key : '';?>"> <span aria-hidden="true">尾页</span> </a> </li> </ul> </nav> </div> </div> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog" style="width: 800px;"> <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"> 新增销售单位 </h4> </div> <div class="modal-body"> <form role="form" id="company-form"> <input type="hidden" name="id" id="id" value="0"> <div class="row"> <div class="col-md-2"> <div class="form-group" style="text-align:right;line-height:40px;"> <label form-label for="name">公司名称:</label> </div> </div> <div class="col-md-4"> <div class="form-group"> <input type="text" class="form-control" name="name" id="name" value="" placeholder="公司名称"> </div> </div> <span style='color:red;' id="error_msg"></span> </div> <div class="row"> <div class="col-md-2"> <div class="form-group" style="text-align:right;line-height:40px;"> <label form-label for="department">初期余额:</label> </div> </div> <div class="col-md-4"> <div class="form-group"> <input type="number" class="form-control" name="initial_balance" id="initial_balance" value="" placeholder="初期余额"> </div> </div> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" onclick="closeModel()">关闭</button> <button type="button" class="btn btn-primary" onclick="save()">保存</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal --> </div> <script> function closeModel() { $("#error_msg").html(''); $("#company-form")[0].reset(); $('#myModal').modal('hide'); } function modify(id, name, initial_balance) { $("#id").val(id); $("#name").val(name); $("#initial_balance").val(initial_balance); $('#myModal').modal('show'); } function del(id, obj) { $.post('/index/company/delete', { 'id': id, }, function(res) { if (res.code == 0) { $(obj).parents('tr').remove(); // window.location.reload(); } else { alert(res.msg); } return false; }, 'json'); return false; } function save(params) { var id = $("#id").val(); var name = $("#name").val(); var initial_balance = Number($("#initial_balance").val()); $.post('/index/company/save', { 'id': id, 'name': name, 'initial_balance': initial_balance }, function(res) { if (res.code == 0) { alert('保存成功'); $('#myModal').modal('hide'); $("#company-form")[0].reset(); window.location.reload(); } else { // $("#company-form").children('div:first').append("<span style='color:red;'>" + res.msg + "</span>"); $("#error_msg").html(res.msg); } return false; }, 'json'); return false; } </script> </body> </html>