Commit 2b6c71ee authored by 刘丹's avatar 刘丹

总监列表

parent 6ec4a57c
......@@ -7,7 +7,16 @@
<div class="col-lg-10 col-lg-offset-0">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">总监列表</a></li>
<li><a href="#">部门列表</a></li>
<li class="active">新增</li>
<div class="pull-right">
<ul class="bread_btn">
<li>
<a href="#modal-edit" data-toggle="modal" class="btn btn-default edit_add"><i class="icon-plus"></i>
新增</a>
</li>
</ul>
</div>
</div>
<div class="panel-body">
......@@ -36,10 +45,11 @@
</tr>
<tr>
<th class="text-center">注册时间</th>
<th class="text-center">用户ID</th>
<th class="text-center">姓名</th>
<th class="text-center">手机号</th>
<th class="text-center">绑定小组/门店</th>
<th class="text-center">部门ID</th>
<th class="text-center">部门名称</th>
<th class="text-center">总监</th>
<th class="text-center">门店</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody id="district_list">
......@@ -56,4 +66,78 @@
</div>
</div>
</div>
<!--编辑-->
<div class="modal fade" id="modal-edit" 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">
×
</button>
<h4 class="modal-title">
编辑部门
</h4>
</div>
<div class="modal-body">
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">部门名称:</label>
<input type="text" value="" name="title" class="form-control btn6" placeholder="部门名称">
</div>
<div class="form-group">
<label class="col-sm-3 control-label">部门总监:</label>
<input type="text" value="" name="agents_id" class="form-control btn6 phone_mend" placeholder="部门总监">
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<ul class="mend_list">
<li form-control btn6>
<span class="phone_name">11</span>
<span class="phone_span">123</span>
</li>
</ul>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<button type="button" class="btn btn-primary submit_edit" data-dismiss="modal">
提交
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<!--门店列表-->
<div class="modal fade" id="modal-record" 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">
×
</button>
<h4 class="modal-title">
门店列表
</h4>
</div>
<div class="modal-body">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th class="text-center">注册时间</th>
<th class="text-center">门店ID</th>
<th class="text-center">门店名称</th>
<th class="text-center">店长</th>
<th class="text-center">业务员</th>
</tr>
</thead>
<tbody class="text-center" id="mend_table">
</table>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
......@@ -209,4 +209,14 @@ body{
}
.margin-top-ld{
margin-top: 15px;
}
.mend_list {
list-style: none;
float: left;
width: 56%;
margin-left: -42px;
}
.mend_list li{
border-bottom: 1px solid #cccccc;
width: 100%;
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
district = {
pageNo: 1, /*第几页*/
pageSize: 10, /*每页显示多少条*/
pageNum:10,
init: function () {
//初始化dot
$ ("body").append (template);
......@@ -12,7 +13,123 @@ define (['doT', 'text!temp/district_template_tpl.html', 'css!style/home.css','pa
$ (document).delegate ("#search", "click", function () {//点击搜索
district.getList(1);
});
$ (document).delegate (".edit", "click", function () {//点击编辑
district.house_id = $ (this).attr ("data-id");
district.Edit();
});
$ (document).delegate (".submit_edit", "click", function () {//提交编辑
district.Submit_edit();
district.getList();
});
$ (document).delegate (".mend", "click", function () {//点击门店列表
district.house_id = $ (this).attr ("data-id");
district.Mend();
});
$(document).on('input','.phone_mend', function(e) {//搜索手机号码
e.preventDefault();
e.stopPropagation();
var _this = $(this);
valueCurrent = _this.val();
if(valueCurrent != ''){
district.loadMain(valueCurrent);
console.log(_this.next());
}else{
district.ldHtml.html('');
return false;
}
});
},
Edit:function(){//获取
$.ajax({
'type': 'GET',
'url' : '/index/adddistrict',//获取编辑数据
data: {"id":district.house_id},
dataType: "json",
success: function(data){
if (data.data) {
$("input[name = agents_id]").val(data.data.name);
$("input[name = title]").val(data.data.district_name);
}
else {
alert('获取失败!');
}
}
});
},
Submit_edit:function(){//提交编辑的信息
var par={};
par.id= district.house_id;
par.department_name=$("input[name =title]").val();
par.agents_id=$("input[name =agents_id]").val();
$.ajax({
'type': 'POST',
'url' : '/index/adddistrict',
data:par,
dataType: "json",
success: function(data){
if(data.code==200){
}else{
alert(data.msg);
}
}
});
},
Mend:function(){//获取门店的信息
var mend_table="";
$.ajax({
'type': 'GET',
'url' : '/index/getDistrictStoreList',//门店
data: {"id":district.house_id},
dataType: "json",
success: function(data){
if(data.code == 200){
if (data.data) {
$.each(data.data,function(i,item){
mend_table+='<tr><td>'+item.create_time+'</td> <td>'+item.id+'</td> <td>'+item.store_name+'</td><td>'+item.agents_name+'</td> <td>'+item.agents_total+'</td></tr>'
})
$("#mend_table").html(mend_table);
}
} else {
alert('获取失败!');
}
}
});
},
loadMain:function(phone) {//手机号
district.ajaxObj=$.ajax({
type: "GET",
url: '/index/getBroker_new' ,
data: {
'phone': phone,
"level":"10,20"
},
timeout: 10000,
dataType: "json",
beforeSend: function() {
},
success: function(data) {
if(data.code === 200){
var _html = '';
$.each(data.data, function(i,data) {
_html += '<li class="addphone"><span class="phone_name">'+data['name']+'</span><span class="phone_span">-</span><span class="phone-phone">'+data['phone']+'</span> </li>';
});
obj.html(_html);
}
},
error: function() {
},
complete: function(xhr, textStatus) {
if(textStatus === "timeout") {
//处理超时的逻辑
alert("请求超时");
}
}
});
},
getList: function (pageNo) {
district.pageNo = pageNo;
......
......@@ -3,10 +3,13 @@
[% for(var item in it){ %]
<tr>
<td>[%= it[item]["create_time"] %]</td>
<td>[%= it[item]["id"] %]</td>
<td>[%= it[item]["district_id"] %]</td>
<td>[%= it[item]["district_name"] %]</td>
<td>[%= it[item]["name"] %]</td>
<td>[%= it[item]["phone"] %]</td>
<td>[%= it[item]["store_name"] %]</td>
<td><a href="#modal-record" class="mend" data-toggle="modal" data-id='[%= it[item]["district_id"] %]'>[%= it[item]["store_num"] %]</a></td>
<td>
<a class="btn1 btn-success edit" href="#modal-edit" data-toggle="modal" data-id='[%= it[item]["district_id"] %]'>编辑</a>
</td>
</tr>
[% } %]
[% }else{ %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment