Commit 1b861860 authored by agping's avatar agping

修改 城市筛选

parent 98a114fd
...@@ -54,27 +54,8 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -54,27 +54,8 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
var day_end = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d); var day_end = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
$('#start_date').val(day_end); $('#start_date').val(day_end);
$('#end_date').val(day_end);//商铺跟进 添加 默认时间 一个月 $('#end_date').val(day_end);//商铺跟进 添加 默认时间 一个月
//初始化城市 区域筛选 //初始化城市 区域筛选
if($("#user_city_choose").val() == 310100){ user.initializationCityFunction();
var city_id=310100;
}
if($("#user_city_choose").val() == 330100){
var city_id=330100;
}
//区域 渲染
if(city_id) {
user.getCityAreaList(city_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.fullName + '">' + item.fullName + '</option>';
});
$("#user_area_choose").html(_str);
});
} else {
};
user.getList(); user.getList();
user.event(); user.event();
//时间控件初始化 //时间控件初始化
...@@ -154,6 +135,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -154,6 +135,7 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
_doc.on('input', '#user_city_add,#user_city_edit', function() { _doc.on('input', '#user_city_add,#user_city_edit', function() {
var _this = $(this); var _this = $(this);
var _id = _this.val(); var _id = _this.val();
user.setUpCityFunction(_id);
_this.next().html(''); //先清空 _this.next().html(''); //先清空
//新增 编辑 //新增 编辑
if(_id && _id != '0') { if(_id && _id != '0') {
...@@ -1634,6 +1616,53 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css' ...@@ -1634,6 +1616,53 @@ define(['doT', 'text!temp/remark_follow_template_tpl.html', 'css!style/home.css'
} }
} }
}); });
},
//初始化 城市
initializationCityFunction: function(params) {
$.ajax({
url: '/index/getCurrentCity',
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function(data) {
if(data.data.city == '上海市'){
$("#user_city_choose").val('310100');
};
if(data.data.city == '杭州市'){
$("#user_city_choose").val('330100');
};
var city_id=$("#user_city_choose").val();
if(city_id) {
user.getCityAreaList(city_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.fullName + '">' + item.fullName + '</option>';
});
$("#user_area_choose").html(_str);
});
} else {};
}
});
},
//设置 城市
setUpCityFunction: function(city) {
if(city == 310100){
city='上海市';
};
if(city == 330100){
city='杭州市';
};
$.ajax({
url: '/index/settingCity',
type: 'POST',
async: true,
data: {'city':city},
dataType: 'json',
success: function(data) {
}
});
}, },
getInfor: function(params) { getInfor: function(params) {
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存 var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
......
...@@ -67,27 +67,9 @@ define(['doT', 'text!temp/followHouseUp_template_tpl.html', 'css!style/home.css' ...@@ -67,27 +67,9 @@ define(['doT', 'text!temp/followHouseUp_template_tpl.html', 'css!style/home.css'
$('#create_time_start').val(day_start); $('#create_time_start').val(day_start);
$('#create_time_end').val(day_end);//商铺跟进 添加 默认时间 一个月 $('#create_time_end').val(day_end);//商铺跟进 添加 默认时间 一个月
//初始化城市 区域筛选 //初始化城市 区域筛选
if($("#user_city_choose").val() == 310100){ house.initializationCityFunction();
var city_id=310100;
}
if($("#user_city_choose").val() == 330100){
var city_id=330100;
}
//区域 渲染
if(city_id) {
house.getCityAreaList(city_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.fullName + '">' + item.fullName + '</option>';
});
$("#shop_area_id").html(_str);
});
} else {
};
house.getList(0);//商铺跟进列表 house.getList(0);//商铺跟进列表
// 部门 门店 二级联动 // 部门 门店 二级联动
house.getDistrict(function() { house.getDistrict(function() {
_doc.on('input', '#district_id, #district_id2', function() { _doc.on('input', '#district_id, #district_id2', function() {
...@@ -153,6 +135,7 @@ define(['doT', 'text!temp/followHouseUp_template_tpl.html', 'css!style/home.css' ...@@ -153,6 +135,7 @@ define(['doT', 'text!temp/followHouseUp_template_tpl.html', 'css!style/home.css'
house.getList(); house.getList();
var _this = $(this); var _this = $(this);
var _id = _this.val(); var _id = _this.val();
house.setUpCityFunction(_id);
_this.next().html(''); //先清空 _this.next().html(''); //先清空
//新增 编辑 //新增 编辑
var _objTemp = _this.parent().next().find('select'); var _objTemp = _this.parent().next().find('select');
...@@ -379,6 +362,53 @@ define(['doT', 'text!temp/followHouseUp_template_tpl.html', 'css!style/home.css' ...@@ -379,6 +362,53 @@ define(['doT', 'text!temp/followHouseUp_template_tpl.html', 'css!style/home.css'
} }
}); });
}, },
//初始化 城市
initializationCityFunction: function(params) {
$.ajax({
url: '/index/getCurrentCity',
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function(data) {
if(data.data.city == '上海市'){
$("#user_city_choose").val('310100');
};
if(data.data.city == '杭州市'){
$("#user_city_choose").val('330100');
};
var city_id=$("#user_city_choose").val();
if(city_id) {
house.getCityAreaList(city_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.fullName + '">' + item.fullName + '</option>';
});
$("#shop_area_id").html(_str);
});
} else {};
}
});
},
//设置 城市
setUpCityFunction: function(city) {
if(city == 310100){
city='上海市';
};
if(city == 330100){
city='杭州市';
};
$.ajax({
url: '/index/settingCity',
type: 'POST',
async: true,
data: {'city':city},
dataType: 'json',
success: function(data) {
}
});
},
//城市 区域 筛选 //城市 区域 筛选
getCityAreaList: function(id, fn) { getCityAreaList: function(id, fn) {
$.ajax({ $.ajax({
......
...@@ -79,24 +79,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -79,24 +79,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
// $('#start_date').val(day_start); // $('#start_date').val(day_start);
// $('#end_date').val(day_end);//去掉默认时间 // $('#end_date').val(day_end);//去掉默认时间
//初始化城市 区域筛选 //初始化城市 区域筛选
if($("#user_city_choose").val() == 310100){ business.initializationCityFunction();
var city_id=310100;
}
if($("#user_city_choose").val() == 330100){
var city_id=330100;
}
//区域 渲染
if(city_id) {
business.getDistrictStoreList(city_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.fullName + '">' + item.fullName + '</option>';
});
$("#shop_area_id").html(_str);
});
} else {
};
business.getList(1); business.getList(1);
business.event(); business.event();
business.resetLoad(); business.resetLoad();
...@@ -273,6 +256,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin ...@@ -273,6 +256,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
business.getList(); business.getList();
var _this = $(this); var _this = $(this);
var _id = _this.val(); var _id = _this.val();
business.setUpCityFunction(_id);
$('#user_area_choose').html(''); //先清空 $('#user_area_choose').html(''); //先清空
if(_id && _id != '0') { if(_id && _id != '0') {
business.getDistrictStoreList(_id, function(_data) { business.getDistrictStoreList(_id, function(_data) {
...@@ -1179,6 +1163,53 @@ if(data.code == 200) { ...@@ -1179,6 +1163,53 @@ if(data.code == 200) {
} }
}); });
}, },
//初始化 城市
initializationCityFunction: function(params) {
$.ajax({
url: '/index/getCurrentCity',
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function(data) {
if(data.data.city == '上海市'){
$("#user_city_choose").val('310100');
};
if(data.data.city == '杭州市'){
$("#user_city_choose").val('330100');
};
var city_id=$("#user_city_choose").val();
if(city_id) {
business.getDistrictStoreList(city_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.fullName + '">' + item.fullName + '</option>';
});
$("#shop_area_id").html(_str);
});
} else {};
}
});
},
//设置 城市
setUpCityFunction: function(city) {
if(city == 310100){
city='上海市';
};
if(city == 330100){
city='杭州市';
};
$.ajax({
url: '/index/settingCity',
type: 'POST',
async: true,
data: {'city':city},
dataType: 'json',
success: function(data) {
}
});
},
delBusiness: function() { delBusiness: function() {
$.ajax({ $.ajax({
url: '/index/houseDel', url: '/index/houseDel',
......
...@@ -49,24 +49,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -49,24 +49,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
//初始化dot //初始化dot
$("body").append(template); $("body").append(template);
//初始化城市 区域筛选 //初始化城市 区域筛选
if($("#user_city_choose").val() == 310100){ user.initializationCityFunction();
var city_id=310100;
}
if($("#user_city_choose").val() == 330100){
var city_id=330100;
}
//区域 渲染
if(city_id) {
user.getCityAreaList(city_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.fullName + '">' + item.fullName + '</option>';
});
$("#user_area_choose").html(_str);
});
} else {
};
//初始化时间 //初始化时间
function  getPreMonth(date)  {             function  getPreMonth(date)  {            
var  arr  =  date.split('-');             var  arr  =  date.split('-');            
...@@ -231,6 +214,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -231,6 +214,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
user.getList(); user.getList();
var _this = $(this); var _this = $(this);
var _id = _this.val(); var _id = _this.val();
user.setUpCityFunction(_id);
$('#user_area_choose').html(''); //先清空 $('#user_area_choose').html(''); //先清空
if(_id && _id != '0') { if(_id && _id != '0') {
user.getCityAreaList(_id, function(_data) { user.getCityAreaList(_id, function(_data) {
...@@ -1864,7 +1848,53 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind ...@@ -1864,7 +1848,53 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
} }
}); });
}, },
//初始化 城市
initializationCityFunction: function(params) {
$.ajax({
url: '/index/getCurrentCity',
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function(data) {
if(data.data.city == '上海市'){
$("#user_city_choose").val('310100');
};
if(data.data.city == '杭州市'){
$("#user_city_choose").val('330100');
};
var city_id=$("#user_city_choose").val();
if(city_id) {
user.getCityAreaList(city_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.fullName + '">' + item.fullName + '</option>';
});
$("#user_area_choose").html(_str);
});
} else {};
}
});
},
//设置 城市
setUpCityFunction: function(city) {
if(city == 310100){
city='上海市';
};
if(city == 330100){
city='杭州市';
};
$.ajax({
url: '/index/settingCity',
type: 'POST',
async: true,
data: {'city':city},
dataType: 'json',
success: function(data) {
}
});
},
getInfor: function(params) {//上一页 下一页 调用接口 getInfor: function(params) {//上一页 下一页 调用接口
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存 var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
var params={}; var params={};
......
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