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'
var day_end = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
$('#start_date').val(day_end);
$('#end_date').val(day_end);//商铺跟进 添加 默认时间 一个月
//初始化城市 区域筛选
if($("#user_city_choose").val() == 310100){
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.initializationCityFunction();
user.getList();
user.event();
//时间控件初始化
......@@ -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() {
var _this = $(this);
var _id = _this.val();
user.setUpCityFunction(_id);
_this.next().html(''); //先清空
//新增 编辑
if(_id && _id != '0') {
......@@ -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) {
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'
$('#create_time_start').val(day_start);
$('#create_time_end').val(day_end);//商铺跟进 添加 默认时间 一个月
//初始化城市 区域筛选
if($("#user_city_choose").val() == 310100){
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.initializationCityFunction();
house.getList(0);//商铺跟进列表
// 部门 门店 二级联动
house.getDistrict(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'
house.getList();
var _this = $(this);
var _id = _this.val();
house.setUpCityFunction(_id);
_this.next().html(''); //先清空
//新增 编辑
var _objTemp = _this.parent().next().find('select');
......@@ -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) {
$.ajax({
......
......@@ -79,24 +79,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
// $('#start_date').val(day_start);
// $('#end_date').val(day_end);//去掉默认时间
//初始化城市 区域筛选
if($("#user_city_choose").val() == 310100){
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.initializationCityFunction();
business.getList(1);
business.event();
business.resetLoad();
......@@ -273,6 +256,7 @@ define(['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css', 'ckfin
business.getList();
var _this = $(this);
var _id = _this.val();
business.setUpCityFunction(_id);
$('#user_area_choose').html(''); //先清空
if(_id && _id != '0') {
business.getDistrictStoreList(_id, function(_data) {
......@@ -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() {
$.ajax({
url: '/index/houseDel',
......
......@@ -49,24 +49,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
//初始化dot
$("body").append(template);
//初始化城市 区域筛选
if($("#user_city_choose").val() == 310100){
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.initializationCityFunction();
//初始化时间
function  getPreMonth(date)  {            
var  arr  =  date.split('-');            
......@@ -231,6 +214,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'css!style/home.css', 'ckfind
user.getList();
var _this = $(this);
var _id = _this.val();
user.setUpCityFunction(_id);
$('#user_area_choose').html(''); //先清空
if(_id && _id != '0') {
user.getCityAreaList(_id, function(_data) {
......@@ -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) {//上一页 下一页 调用接口
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
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