Commit 64fc256c authored by hujun's avatar hujun

门店列表显示

parent 3aada6e8
......@@ -131,6 +131,33 @@
text-align: center;
display: none;
}
.modal-body1{
height: 600px;
overflow-y: auto;
padding-bottom: 60px;
}
.user-ul{
width: 100%;
height: auto;
padding-bottom: 15px;
float: left;
padding-left: 163px;
}
.user-ul li{
list-style: none;
line-height: 30px;
}
.user-ul2{
width: 100%;
height: auto;
padding-bottom: 15px;
float: left;
}
.user-ul2 li{
list-style: none;
line-height: 30px;
}
</style>
<div id="page-content-wrapper">
<div class="container">
......@@ -142,7 +169,7 @@
<div class="pull-right">
<ul class="bread_btn">
<li>
<a href="#" data-toggle="modal" class="btn btn-default"><i class="icon-plus"></i>
<a data-toggle="modal" href="#modal-edit" class="btn btn-default add"><i class="icon-plus"></i>
新增门店</a>
</li>
</ul>
......@@ -180,27 +207,6 @@
</tr>
</thead>
<tbody class="text-center" id="store_list">
<!--<tr>-->
<!--<td>212</td>-->
<!--<td>商场</td>-->
<!--<td>长兴</td>-->
<!--<td>1000</td>-->
<!--<td>是</td>-->
<!--<td>2018-01-16 17:02:00</td>-->
<!--<td>已租</td>-->
<!--<td>张娜张-->
<!--<a data-toggle="modal" data-id="77" href="#modal-watch" class="btn1 btn-danger add_applies">修改</a>-->
<!--</td>-->
<!--<td>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">编辑</a>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">推荐至首页</a>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">设置案场权限人</a>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">是否独家</a>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">操作记录</a>-->
<!--<a data-toggle="modal" data-id="77" href="#modal-watch" class="btn1 btn-danger add_applies" onclick="delete_house(4720)">删除</a>-->
<!--</td>-->
<!--</tr>-->
</table>
</div>
<!-- /#page-content-wrapper -->
......@@ -223,12 +229,12 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title">
编辑信息
<h4 class="modal-title" id="modal-title">
新增门店
</h4>
</div>
<div class="modal-body">
<form class="form-horizontal">
<form class="form-horizontal" id="form_id">
<div class="form-group">
<label class="col-sm-3 control-label">对内地址</label>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg" id="position_btn">选择地址定位</button>
......@@ -275,11 +281,16 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">店长:</label>
<input type="text" value="" name="store-name" class="form-control btn6" placeholder="请输入店长">
<input type="text" value="" name="store-name" class="form-control btn6" placeholder="请输入店长" id="set_father_id3">
<ul class="user-ul">
</ul>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">所属部门:</label>
<input type="text" value="" name="ss-store" class="form-control btn6" placeholder="所属部门">
<!--<input type="text" value="" name="ss-store" class="form-control btn6" placeholder="所属部门">-->
<select name="ss-store" class="form-control btn6" id="ss-store">
</select>
</div>
</form>
......
......@@ -21,6 +21,7 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
store.getList();
store.event();
store.getRegionsDisc();
// store.getDistrict();
},
event: function() {
$("#search").click(function() {
......@@ -38,6 +39,7 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
$ (document).delegate (".edit", "click", function () {//点击编辑
store.house_id = $ (this).attr ("data-id");
$("#modal-title").html("编辑门店信息");
store.Edit();
});
......@@ -49,7 +51,31 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
store.house_id = $ (this).attr ("data-id");
store.Mend();
});
$ (document).on ("input","#cus_fang", function () {//手机号搜索客方2
if($("#cus_fang").val()==''){
$(".user-ul2").html('');
}else{
store.search_phone2();
}
});
$ (document).on ("input","#set_father_id3", function () {//手机号搜索客方
if($("#set_father_id3").val()==''){
$(".user-ul").html('');
}else{
store.search_phone();
}
});
$ (document).delegate (".addphone", "click", function () {//list消失
store.addphone(this);
});
$ (document).delegate (".addphone2", "click", function () {//list2消失
store.addphone2(this);
});
$ (document).delegate (".add", "click", function () {//list2消失
document.getElementById('form_id').reset();
store.getDistrict();
});
/************************************************百度地址定位相关*************************************************************/
var _doc = $(document),
......@@ -71,7 +97,6 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
//搜索地址的回调
LocalSearch.setSearchCompleteCallback(function(data) {
if(LocalSearch.getStatus() == BMAP_STATUS_SUCCESS) {
console.log(data);
var _html = "";
for(var i = 0; i < data.getCurrentNumPois(); i++) {
_html += '<li data-city="{2}" data-lat="{3}" data-lng="{4}" data-dismiss="modal"><p>{0}</p><p>{1}</p></li>'.stringFormatObj({
......@@ -120,7 +145,6 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
_lat = Number(_this.data('lat')); //纬度
getDistrict(_lng, _lat, function(data) {
console.log(data);
if(data['city']) {
_provinceInternalObj.val(data['province']);
_cityInternalObj.val(data['city']);
......@@ -161,7 +185,6 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
function getDistrict(str1, str2, fn) {
myGeo.getLocation(new BMap.Point(str1, str2), function(result) {
if(result) {
console.log(result);
fn(result['addressComponents']);
}
});
......@@ -204,7 +227,7 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
$("input[name = name]").val(data.data.store_name);//门店名
$("#pid-select").val(data.data.scale)//规模
$("input[name=store-name]").val(data.data.agents_name);//店长
$("input[name=ss-store]").val(data.data.district_name);//所属部门
// $("input[name=ss-store]").val(data.data.district_name);//所属部门
$("#province_internal").val(data.data.province)//地址1
$("#city_internal").val(data.data.city)//地址1
$("#disc_internal").val(data.data.district)//地址1
......@@ -213,7 +236,7 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
store.agents_id=data.data.agents_id;//经纪人id
store.district_id=data.data.district_id;//部门id
store.getDistrict(data.data.district_name);
}
else {
alert('获取失败!');
......@@ -286,7 +309,6 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
data: params,
dataType: 'json',
success: function(data) {
console.log(data.data);
var temp = document.getElementById('store_list_tpl').innerHTML;
var doTtmpl = doT.template(temp);
$("#store_list").html(doTtmpl(data.data.list));
......@@ -302,7 +324,85 @@ define(['doT', 'text!temp/store_template_tpl.html', 'css!style/home.css', 'ckfin
});
}
});
}
},
addphone:function(obj){
var user_ht=$(obj).html();
$("#set_father_id3").val(user_ht);
$(".user-ul").html('');
store.agent_id = $ (obj).attr ("data-id");
},
search_phone:function(){//手机号
$.ajax ({
url: '/index/select_by_phone',
type: 'POST',
async: true,
data: {
"phone":$("#set_father_id3").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.realname+'-'+item.phone+'</li>';
});
$(".user-ul").html(user_ul);
} else {
alert(data.msg);
}
}
});
},
search_phone2:function(){//手机号
$.ajax ({
url: '/index/select_by_phone',
type: 'POST',
async: true,
data: {
"phone":$("#cus_fang").val()
},
dataType: 'json',
success: function (data) {
if (data.code == 200) {
var user_ul2 = "";
$.each(data.data, function(i,item) {
user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.realname+'-'+item.phone+'</li>';
});
$(".user-ul2").html(user_ul2);
} else {
alert(data.msg);
}
}
});
},
getDistrict: function(name) {
$.ajax({
url: '/index/getDistrictListByName',
type: 'GET',
async: true,
data: {"pageSize":50},
dataType: 'json',
success: function(data) {
if(data.code == 200) {
var _html = '';
$.each(data.data, function(i, n) {
if (n.district_name == name && (typeof name != undefined)) {
_html += '<option selected="selected" value="' + n.id + '">' + n.district_name + '</option>';
} else {
_html += '<option value="' + n.id + '">' + n.district_name + '</option>';
}
});
$("#ss-store").html(_html);
} else {
alert('获取部门信息失败');
}
}
});
}
};
return store;
});
\ No newline at end of file
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