Commit 0d3f31e4 authored by agping's avatar agping

解绑 新增门店

parent 067d01fe
...@@ -438,7 +438,7 @@ ...@@ -438,7 +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>
<a class="btn btn-info" href="#modal_addStore" data-toggle="modal">新增门店</a> <a class="btn btn-info newStore" href="#modal_addStore" data-toggle="modal">新增门店</a>
</div> </div>
</div> </div>
<!-- /.modal-content --> <!-- /.modal-content -->
...@@ -460,7 +460,7 @@ ...@@ -460,7 +460,7 @@
</div> </div>
<div class="modal-body modal-body-one"> <div class="modal-body modal-body-one">
<br> <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;"> <input class="form-control ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="comit_name" placeholder="请输入门店名称进行搜索" type="text" value="" style="width: 300px;">
<ul class="user-ul" style="display:none"></ul> <ul class="user-ul" style="display:none"></ul>
<br><br><br> <br><br><br>
...@@ -468,7 +468,7 @@ ...@@ -468,7 +468,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="addStore" data-dismiss="modal"> <button type="button" class="btn btn-primary" id="saveStore" data-dismiss="modal">
确定 确定
</button> </button>
</div> </div>
......
...@@ -6,6 +6,8 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding ...@@ -6,6 +6,8 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding
/*每页显示多少条*/ /*每页显示多少条*/
id: '', id: '',
isAdd: 0, isAdd: 0,
agent_id_phone:'',
store_id:'',
init: function() { init: function() {
//初始化dot //初始化dot
$(document.body).append(template+template1); $(document.body).append(template+template1);
...@@ -52,12 +54,28 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding ...@@ -52,12 +54,28 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding
cost.id = $(this).attr('data-id') cost.id = $(this).attr('data-id')
that.storeList(); that.storeList();
}); });
//点击li 列表消失
$(document).delegate(".addphone", "click", function() { //list消失新增客户 点击li事件 获取id ul消失 //点击新增门店 置空数据
that.addphone(this); $(document).delegate(".newStore", "click", function() {
cost.agent_id_phone = '';
$("#comit_name").val('');
});
//点击保存新增门店
$(document).delegate("#saveStore", "click", function() {
that.saveStore();
});
//解绑门店
$(document).delegate(".is_jiebang", "click", function() {
cost.store_id = $(this).attr('data-id');
that.delStore();
}); });
//分佣方 姓名下拉式 //点击li 门店列表消失
$(document).delegate(".addphone", "click", function() {
that.addphone(this);
});
//搜索门店名字
$(document).on("input", "#comit_name", function() { //手机号新增搜索客方 $(document).on("input", "#comit_name", function() { //手机号新增搜索客方
if($("#comit_name").val() == '') { if($("#comit_name").val() == '') {
that.agent_id_phone=''; that.agent_id_phone='';
...@@ -153,6 +171,47 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding ...@@ -153,6 +171,47 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding
} }
}) })
}, },
//新增门店
saveStore: function() {
var params = {};
params.store_id = cost.agent_id_phone;
params.office_id = cost.id;
$.ajax({
url: '/index/bindStore',
type: 'POST',
async: true,
data: params,
dataType: 'json',
success: function(data) {
if(data.code == 200){
// $('.modal').modal("hide");
cost.storeList();
}
alert(data.msg)
}
})
},
//解绑门店
delStore: function() {
var params = {};
params.store_id = cost.store_id;
params.office_id = 0;
$.ajax({
url: '/index/bindStore',
type: 'POST',
async: true,
data: params,
dataType: 'json',
success: function(data) {
if(data.code == 200){
// $('.modal').modal("hide");
cost.storeList();
}
alert(data.msg)
}
})
},
//获取列表 //获取列表
getList : function(no){ getList : function(no){
var that = cost; var that = cost;
...@@ -198,7 +257,7 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding ...@@ -198,7 +257,7 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding
if(data.code == 200) { if(data.code == 200) {
var user_ul = ""; var user_ul = "";
$.each(data.data, function(i, item) { $.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 += '<li class="addphone" data-id="' + item.id + '">' + item.store_name + ',门店ID:' + item.id + '</li>';
}); });
$(".user-ul").html(user_ul); $(".user-ul").html(user_ul);
$(".user-ul").show(); $(".user-ul").show();
...@@ -212,9 +271,8 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding ...@@ -212,9 +271,8 @@ define(['doT', 'text!temp/cost_office_template_tpl.html','text!temp/storeBinding
//将li里的值 赋给input(分佣方姓名) //将li里的值 赋给input(分佣方姓名)
addphone: function(obj) {//新增客户 input赋值 addphone: function(obj) {//新增客户 input赋值
var that = cost ; var that = cost ;
var user_ht = $(obj).html()+''; var user_ht = $(obj).html()
var user_ht_str=user_ht.substring(0,user_ht.length-3); $("#comit_name").val(user_ht);
$("#comit_name").val(user_ht_str);
$(".user-ul").html(''); $(".user-ul").html('');
$(".user-ul").hide(); $(".user-ul").hide();
that.agent_id_phone = $(obj).attr("data-id"); that.agent_id_phone = $(obj).attr("data-id");
......
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