Commit 6856a4fa authored by agping's avatar agping

办公室列表

parent e5a6b7a6
...@@ -438,9 +438,7 @@ ...@@ -438,9 +438,7 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消 <button type="button" class="btn btn-default" data-dismiss="modal">取消
</button> </button>
<button type="button" class="btn btn-primary" id="confirm_delete" data-dismiss="modal"> <a class="btn btn-info" href="#modal_addStore" data-toggle="modal">新增门店</a>
删除
</button>
</div> </div>
</div> </div>
<!-- /.modal-content --> <!-- /.modal-content -->
...@@ -448,6 +446,35 @@ ...@@ -448,6 +446,35 @@
<!-- /.modal --> <!-- /.modal -->
</div> </div>
<!--新增门店-->
<div class="modal fade" id="modal_addStore" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-one" style="width: 500px;">
<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" >
新增门店
</h4>
</div>
<div class="modal-body modal-body-one">
<br>
<input class="form-control ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="comit_name" placeholder="请输入门店名称进行搜索" type="text" value="" style="width: 200px;">
<ul class="user-ul" style="display:none"></ul>
<br><br><br>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消
</button>
<button type="button" class="btn btn-primary" id="addStore" data-dismiss="modal">
确定
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<div id="img_mask_area" title="点击任意位置可关闭"> <div id="img_mask_area" title="点击任意位置可关闭">
<img /> <img />
</div> </div>
...@@ -69,6 +69,7 @@ define(['doT', 'text!temp/cost_check_template_tpl.html', 'css!style/home.css', ' ...@@ -69,6 +69,7 @@ define(['doT', 'text!temp/cost_check_template_tpl.html', 'css!style/home.css', '
}); });
//费用类型切换 //费用类型切换
$("#cost_type").change(function() { $("#cost_type").change(function() {
$("#fee_item").val('');//置空费用项目
if($('#cost_type').val() == 0 ){ if($('#cost_type').val() == 0 ){
$('.choose_office').show(); $('.choose_office').show();
$('.choose_total').hide(); $('.choose_total').hide();
...@@ -343,7 +344,11 @@ define(['doT', 'text!temp/cost_check_template_tpl.html', 'css!style/home.css', ' ...@@ -343,7 +344,11 @@ define(['doT', 'text!temp/cost_check_template_tpl.html', 'css!style/home.css', '
//费用报销 导出 //费用报销 导出
exportExcel: function() { exportExcel: function() {
var _url = '/index/costListExcel?'; if(cost.buildSearchParams(1)){//是否要&符号
var _url = cost.url + "?excel=1&";
}else{
var _url = cost.url + "?excel=1";
}
window.open(_url + cost.buildSearchParams(1)); window.open(_url + cost.buildSearchParams(1));
}, },
/** /**
......
...@@ -5,14 +5,7 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding ...@@ -5,14 +5,7 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding
pageSize: 10, pageSize: 10,
/*每页显示多少条*/ /*每页显示多少条*/
id: '', id: '',
house_id: '', isAdd: 0,
house_fatherid: '',
collection_del_id:'',
listData :"",
moneyTotal : "" ,
agent_id_phone : '',
check_status : 1 ,
deleteRefundId:'',
init: function() { init: function() {
//初始化dot //初始化dot
$(document.body).append(template+template1); $(document.body).append(template+template1);
...@@ -32,41 +25,119 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding ...@@ -32,41 +25,119 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding
$(document).on('click','#reset',function(e){ $(document).on('click','#reset',function(e){
that.resetAll(); that.resetAll();
}); });
//获取办公室详情(点击编辑)
//编辑办公室 $(document).on('click','.edit_office',function(e){
cost.id = $(this).attr('data-id')
cost.isAdd = 0;
that.officeDetail();
});
//点击新增 置空数据
$(document).on('click','.add-office',function(e){
$("#choose_city").val('');
$(".officeName").val('');
$(".officeAddr").val('');
$(".officeRent").val('');
cost.isAdd = 1;
});
//新增 编辑办公室
$(document).on('click','.save_office',function(e){ $(document).on('click','.save_office',function(e){
that.editOffice(); if(cost.isAdd == 1){
that.addOffice();
}else{
that.editOffice();
}
}); });
//编辑门店 //点击编辑门店 获取办公室id
$(document).on('click','.edit_store',function(e){ $(document).on('click','.edit_store',function(e){
that.editStore(); cost.id = $(this).attr('data-id')
that.storeList();
});
//点击li 列表消失
$(document).delegate(".addphone", "click", function() { //list消失新增客户 点击li事件 获取id ul消失
that.addphone(this);
});
//分佣方 姓名下拉式
$(document).on("input", "#comit_name", function() { //手机号新增搜索客方
if($("#comit_name").val() == '') {
that.agent_id_phone='';
$(".user-ul").html('');
} else {
that.search_person();
}
}); });
}, },
//编辑门店 //获取门店列表
editStore: function() { storeList: function() {
var params = {}; var params = {};
params.agent_id = 6576; params.id = cost.id;
$.ajax({ $.ajax({
url: '/index/deviceList', url: '/index/getStoreList',
type: 'GET', type: 'POST',
async: true, async: true,
data: params, data: params,
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
var temp = document.getElementById('store_binding_tpl').innerHTML; var temp = document.getElementById('store_binding_tpl').innerHTML;
var doTempl = doT.template(temp); var doTempl = doT.template(temp);
$("#agent_phone_binding").html(doTempl(data.data)); $("#agent_phone_binding").html(doTempl(data.data.list));
/*分页代码*/ /*分页代码*/
} }
}) })
}, },
//编辑办公室
//获取办公室详情
officeDetail: function() {
var params = {};
params.id = cost.id;
$.ajax({
url: '/index/getOfficeInfo',
type: 'POST',
async: true,
data: params,
dataType: 'json',
success: function(data) {
if(data.code == 200) {
$("#choose_city").val(data.data.list.site_id);
$(".officeName").val(data.data.list.office_name);
$(".officeAddr").val(data.data.list.office_address);
$(".officeRent").val(data.data.list.rent);
}
}
})
},
//编辑办公室
editOffice: function() { editOffice: function() {
var params = {}; var params = {};
params.agent_id = 6576; params.id = cost.id;
params.site_id = $("#choose_city").val();
params.office_name = $(".officeName").val();
params.office_address = $(".officeAddr").val();
params.rent = $(".officeRent").val();
$.ajax({
url: '/index/editOffice',
type: 'POST',
async: true,
data: params,
dataType: 'json',
success: function(data) {
if(data.code == 200){
$('.modal').modal("hide");
cost.getList(cost.pageNo)
}
alert(data.msg);
}
})
},
//新增办公室
addOffice: function() {
var params = {};
params.site_id = $("#choose_city").val();
params.office_name = $(".officeName").val();
params.office_address = $(".officeAddr").val();
params.rent = $(".officeRent").val();
$.ajax({ $.ajax({
url: '/index/addOffice', url: '/index/addOffice',
type: 'POST', type: 'POST',
...@@ -74,10 +145,11 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding ...@@ -74,10 +145,11 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding
data: params, data: params,
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
var temp = document.getElementById('store_binding_tpl').innerHTML; if(data.code == 200){
var doTempl = doT.template(temp); $('.modal').modal("hide");
$("#agent_phone_binding").html(doTempl(data.data)); cost.getList(cost.pageNo)
/*分页代码*/ }
alert(data.msg)
} }
}) })
}, },
...@@ -113,7 +185,40 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding ...@@ -113,7 +185,40 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding
}; };
},'json'); },'json');
}, },
search_person: function() { //手机号新增客户
$.ajax({
url: '/index/selectStore',
type: 'GET',
async: true,
data: {
"store_name": $("#comit_name").val(),
},
dataType: 'json',
success: function(data) {
if(data.code == 200) {
var user_ul = "";
$.each(data.data, function(i, item) {
user_ul += '<li class="addphone" data-id="' + item.id + '">' + item.id + '-' + item.name + '-' + item.phone + status + '</li>';
});
$(".user-ul").html(user_ul);
$(".user-ul").show();
} else {
// alert(data.msg);
}
}
});
},
//将li里的值 赋给input(分佣方姓名)
addphone: function(obj) {//新增客户 input赋值
var that = cost ;
var user_ht = $(obj).html()+'';
var user_ht_str=user_ht.substring(0,user_ht.length-3);
$("#comit_name").val(user_ht_str);
$(".user-ul").html('');
$(".user-ul").hide();
that.agent_id_phone = $(obj).attr("data-id");
},
/** /**
* 重置查询条件 * 重置查询条件
*/ */
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<td>[%= it[item]['id'] %]</td> <td>[%= it[item]['id'] %]</td>
<td>[%= it[item]['office_name'] %]</td> <td>[%= it[item]['office_name'] %]</td>
<td>[%= it[item]['office_address'] %]</td> <td>[%= it[item]['office_address'] %]</td>
<td>[%= it[item]['pay_log_id'] %]</td> <td>[%= it[item]['rent'] %]</td>
<td>[%= it[item]['store_num'] %]</td> <td>[%= it[item]['store_num'] %]</td>
<td> <td>
......
...@@ -2,28 +2,13 @@ ...@@ -2,28 +2,13 @@
[% if(it) { %] [% if(it) { %]
[% for(var item in it){ %] [% for(var item in it){ %]
<tr class="text-center"> <tr class="text-center">
<td>[% if(it[item]["is_pc"] == 1) { %] <td>[%= it[item]["id"] %]</td>
电脑端 <td>[%= it[item]["store_name"] %]</td>
[% }else if(it[item]["is_pc"] == 0) { %] <td>[%= it[item]["people_num"] %]</td>
手机端 <td>[%= it[item]["people_list"] %]</td>
[% }else if(it[item]["is_pc"] == 2){ %]
Windows客户端
[% }else{%]
其他
[%} %]
</td>
<td>[%= it[item]["model"] %]</td>
<td>[%= it[item]["create_time"] %]</td>
<td>[%= it[item]["create_time"] %]</td>
<td> <td>
[% if(it[item]["is_forbidden"] == 0) { %] <a class="btn1 btn-info is_jiebang" data-toggle="modal" data-id='[%= it[item]["id"] %]'>解绑</a>
<a class="btn1 btn-default is_show2" data-toggle="modal" data-id='[%= it[item]["id"] %]'>解绑</a>
[% }else if(it[item]["is_forbidden"] == 1) { %]
<a class="btn1 btn-info is_show2" data-toggle="modal" data-id='[%= it[item]["id"] %]'>允许</a>
[% }else{ %]
<a class="btn1 btn-default" data-toggle="modal" data-id='[%= it[item]["id"] %]'>离职</a>
[% } %]
<!--<a class="btn1 btn-info review-images" href="#modal-time" data-toggle="modal" data-img='[%= it[item]["scene_photo"] %]'>允许</a>-->
</td> </td>
</tr> </tr>
[% } %] [% } %]
......
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