|
<!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 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-10" 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 as $key => $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['department'] ?></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['department']; ?>')">修改</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>
<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">
×
</button>
<h4 class="modal-title" id="myModalLabel">
新增销售员
</h4>
</div>
<div class="modal-body">
<form role="form" id="form-seller">
<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">
<select name="department" id="department" class="form-control">
<option value="一部">一部</option>
<option value="二部">二部</option>
</select>
</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('');
$("#form-seller")[0].reset();
$('#myModal').modal('hide');
}
function save() {
var id = $("#id").val();
var name = $("#name").val();
var department = $("#department").val();
$.post('/index/seller/save', {
'id': id,
'name': name,
'department': department
}, function(res) {
if (res.code == 0) {
alert('保存成功');
$('#myModal').modal('hide');
$("#seller-form")[0].reset();
window.location.reload();
} else {
// $("#seller-form").children('div:first').append("<span style='color:red;'>" + res.msg + "</span");
$("#error_msg").html(res.msg);
}
return false;
}, 'json');
return false;
}
function modify(id, name, department) {
$("#id").val(id);
$("#name").val(name);
$("#department").val(department);
$('#myModal').modal('show');
}
function del(id, that){
$.post('/index/seller/delete', {
'id': id
}, function(res) {
if (res.code == 0) {
$(that).parents("tr").remove();
} else {
alert(res.msg);
}
}, 'json');
}
</script>
</body>
</html>
|