Commit 0bc90380 authored by agping's avatar agping

修改

parent 66ffa346
......@@ -799,7 +799,8 @@
</div>-->
<div class="clear"></div>
<span class="fore-span ld-Marheight">预计到场时间:</span>
<input class="form-control btn5 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="look_shop_date" name=" " type="date">
<input class="form-control btn6 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="look_shop_date" name=" " type="datetime-local">
<!--datetime-local-->
<div class="clear"></div>
<div class="textarea-con ld-Marheight">
......
define(['doT', 'text!temp/followHouseUp_template_tpl.html', 'css!style/home.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template) {
house = {
pageNo: 1,
/*第几页*/
pageSize: 10,
/*每页显示多少条*/
id: '',
house_id: '',
type: '',
valueCurrent: '',
ajaxObj: '',
stopstatus: true,
boxphoto: '',
init: function() {
//初始化dot
$(document.body).append(template);
// house.getList(0);
house.event();
},
event: function() {
var _doc = $(document);
function  getPreMonth(date)  {            
var  arr  =  date.split('-');            
var  year  =  arr[0];             
var  month  =  arr[1];             
var  day  =  arr[2];             
var  days  =  new  Date(year,  month,  0);            
days  =  days.getDate();             
var  year2  =  year;            
var  month2  =  parseInt(month)  -  1;            
if (month2  ==  0)  {                
year2  =  parseInt(year2)  -  1;                
month2  =  12;            
}            
var  day2  =  day;            
var  days2  =  new  Date(year2,  month2,  0);            
days2  =  days2.getDate();            
if (day2  >  days2)  {                
day2  =  days2;            
}            
if (month2  <  10)  {                
month2  =  '0'  +  month2;            
}            
var  t2  =  year2  +  '-'  +  month2  +  '-'  +  day2;            
return  t2;        
}
//初始化时间
var myDate = new Date();
var y = myDate.getFullYear();
var m = myDate.getMonth() + 1;
var d = myDate.getDate();
var day_end = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
var day_start = getPreMonth(day_end);
$('#create_time_start').val(day_start);
$('#create_time_end').val(day_end);//商铺跟进 添加 默认时间 一个月
house.getList(0);//商铺跟进列表
// 部门 门店 二级联动
house.getDistrict(function() {
_doc.on('input', '#district_id, #district_id2', function() {
var _this = $(this);
var _id = _this.val();
_this.next().html(''); //先清空
if(_id && _id != '0') {
record.getDistrictStoreList(_id, function(_data) {
// var _str = '';
var _str = '<option value="0">全部</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.id + '">' + item.store_name + '</option>';
});
_this.next().html(_str);
});
} else {};
});
});
$("#search").click(function() { //搜索
house.getList(1);
});
$("#reset").click(function() { //重置
document.getElementById("form_search").reset();
$('#guest_stores').html('');
});
},
getList: function(pageNo) { //获取约带看记录列表
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
console.log(user_info_obj.AuthToken);
house.pageNo = pageNo;
var params = {};
var start_ = $('#create_time_start').val()+" 00:00:00";
date_start =new Date(Date.parse(start_.replace(/-/g, "/")));
params.start_time =date_start.getTime()*0.001;
console.log(params.start_time);
//结束时间
var end_ = $('#create_time_end').val()+" 23:59:59";
date_end =new Date(Date.parse(end_.replace(/-/g, "/")));
console.log(date_end);
params.end_time =date_end.getTime()*0.001;
//时间转化为时间戳
//var date="2014-05-08 00:22:11";
// date = new Date(Date.parse(date.replace(/-/g, "/")));
// date = date.getTime();
// params.district_id = $('#district_id').val() * 1;
// params.store_id = $('#guest_stores').val() * 1;
// params.user_name = $('#user_name').val();
params.name_or_phone = $('#user_phone').val();
// params.report_agent_phone = $('#report_agent_phone').val();
params.search_content = $('#follow_up_con').val();
params.pageNo = house.pageNo;
params.pageSize = house.pageSize;
params.AuthToken = user_info_obj.AuthToken;
if( !(params.end_time&&params.start_time)){
alert('请选择时间')
return;
}
$.ajax({
type: 'POST',
url: '/broker/houseFollowUpList', //商铺跟进 对接接口
data: params,
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(data) {
if(typeof data === 'object') {
if(data.code == 200) {
var doTtmpl = doT.template(document.getElementById('followHouseUp_list_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.result));
/*分页代码*/
add_page(data.data.total, pageNo, house.pageSize, house.getList);
} else {
alert(data['msg']);
};
} else {
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus) {
if(textStatus === 'timeout') {
alert('请求超时');
};
}
});
},
//调用部门 和 门店的接口
getDistrict: function(fn) {
$.ajax({
url: '/index/getDistrict',
type: 'GET',
async: true,
data: {
"pageSize": 1000
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
var str = '';
$.each(data.data, function(i, item) {
str += '<option value="' + item.id + '">' + item.district_name + '</option>';
});
$("#district_id").append(str);
$("#district_id2").append(str);
fn && fn();
}
}
});
},
getDistrictStoreList: function(id, fn) {
$.ajax({
url: '/index/getDistrictStoreList',
type: 'GET',
async: true,
data: {
'id': id,
"pageSize": 1000
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
fn && fn(data.data);
}
}
});
}
};
return house;
});
\ No newline at end of file
define(['doT', 'text!temp/inspectionRecord_list_template_tpl.html', 'css!style/home.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template) {
record = {
pageNo: 1,
/*第几页*/
pageSize: 10,
/*每页显示多少条*/
id: '',
record_id: '',
type: '',
valueCurrent: '',
ajaxObj: '',
stopstatus: true,
boxphoto: '',
init: function() {
//初始化dot
$(document.body).append(template);
record.event();
},
event: function() {
var _doc = $(document);
function  getPreMonth(date)  {            
var  arr  =  date.split('-');            
var  year  =  arr[0];             
var  month  =  arr[1];             
var  day  =  arr[2];             
var  days  =  new  Date(year,  month,  0);            
days  =  days.getDate();             
var  year2  =  year;            
var  month2  =  parseInt(month)  -  1;            
if (month2  ==  0)  {                
year2  =  parseInt(year2)  -  1;                
month2  =  12;            
}            
var  day2  =  day;            
var  days2  =  new  Date(year2,  month2,  0);            
days2  =  days2.getDate();            
if (day2  >  days2)  {                
day2  =  days2;            
}            
if (month2  <  10)  {                
month2  =  '0'  +  month2;            
}            
var  t2  =  year2  +  '-'  +  month2  +  '-'  +  day2;            
return  t2;        
}
//初始化时间
var myDate = new Date();
var y = myDate.getFullYear();
var m = myDate.getMonth() + 1;
var d = myDate.getDate();
var day_end = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
var day_start = getPreMonth(day_end);
$('#create_time_start').val(day_start);
$('#create_time_end').val(day_end);//商铺跟进 添加 默认时间 一个月
record.getList(0);
// 部门 门店 二级联动
record.getDistrict(function() {
_doc.on('input', '#district_id, #district_id2', function() {
var _this = $(this);
var _id = _this.val();
_this.next().html(''); //先清空
if(_id && _id != '0') {
record.getDistrictStoreList(_id, function(_data) {
// var _str = '';
var _str = '<option value="0">全部</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.id + '">' + item.store_name + '</option>';
});
_this.next().html(_str);
});
} else {};
});
});
_doc.on('click', 'a[href="#modal-time"]', function(e) { //获取时间轴
record.record_id = $(this).attr("data-id");
e.preventDefault();
e.stopPropagation();
$('.iframe-time-line').attr('src', '/app_broker/timeline_pc?order_id=' + record.record_id);
});
$("#search").click(function() { //搜索
record.getList(1);
});
$("#reset").click(function() { //重置
document.getElementById("form_search").reset();
$('#guest_stores').html('');
});
},
getList: function(pageNo) { //获取约带看记录列表
record.pageNo = pageNo;
var params = {};
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
console.log(user_info_obj);
console.log(user_info_obj.AuthToken);
// params.district_id = $('#district_id').val() * 1;
// params.store_id = $('#guest_stores').val() * 1;
// params.user_name = $('#user_name').val();
// params.user_phone = $('#user_phone').val();
// params.report_agent_phone = $('#report_agent_phone').val();
// params.house_title = $('#house_title').val();
params.pageNo = record.pageNo;
params.pageSize = record.pageSize;
// var start_ = $('#create_time_start').val()+" 00:00:00";
// date_start =new Date(Date.parse(start_.replace(/-/g, "/")));
// params.start_time =date_start.getTime()*0.001;
// console.log(params.start_time);
// 结束时间
// var end_ = $('#create_time_end').val()+" 23:59:59";
// date_end =new Date(Date.parse(end_.replace(/-/g, "/")));
// console.log(date_end);
// params.end_time =date_end.getTime()*0.001;
params.AuthToken = user_info_obj.AuthToken;
params.agent_id = user_info_obj.id;
params.type = 1;
$.ajax({
type: 'GET',
url: '/broker/reportList', //约带看记录 对接接口
data: params,
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(data) {
if(typeof data === 'object') {
if(data.code == 200) {
var doTtmpl = doT.template(document.getElementById('inspectionRecord_list_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data));
/*分页代码*/
add_page(data.data.total, pageNo, record.pageSize, record.getList);
$(".move-block").html(' ');
} else {
alert(data['msg']);
};
} else {
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus) {
if(textStatus === 'timeout') {
alert('请求超时');
};
}
});
},
//调用部门 和 门店的接口
getDistrict: function(fn) {
$.ajax({
url: '/index/getDistrict',
type: 'GET',
async: true,
data: {
"pageSize": 1000
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
var str = '';
$.each(data.data, function(i, item) {
str += '<option value="' + item.id + '">' + item.district_name + '</option>';
});
$("#district_id").append(str);
$("#district_id2").append(str);
fn && fn();
}
}
});
},
getDistrictStoreList: function(id, fn) {
$.ajax({
url: '/index/getDistrictStoreList',
type: 'GET',
async: true,
data: {
'id': id,
"pageSize": 1000
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
fn && fn(data.data);
}
}
});
}
};
return record;
});
\ No newline at end of file
......@@ -288,10 +288,10 @@ define(['doT', 'text!temp/user_template_tpl.html', 'ckfinder', 'ckfinderStart',
}
}
if(user_info_obj.id==1){
alert('当前用户没有权限提交约带看');
return false;
}
// if(user_info_obj.id==1){
// alert('当前用户没有权限提交约带看');
// return false;
// }
if(arr_look.length<0||arr_look.length==0){
alert('请选择约带看商铺');
......@@ -301,14 +301,13 @@ define(['doT', 'text!temp/user_template_tpl.html', 'ckfinder', 'ckfinderStart',
if($("#look_shop_date").val()==''){
alert('请选择预计到场时间');
return false;
}
console.log(arr_look);
var start_ = $("#look_shop_date").val()+" 00:00:00";
date_start =new Date(Date.parse(start_.replace(/-/g, "/")));
var start_ = $("#look_shop_date").val()+":00";
var start_a=start_.replace('T',' ');
console.log(start_a);
date_start =new Date(Date.parse(start_a.replace(/-/g, "/")));
var start_time =date_start.getTime()*0.001;
// 2018-07-14T09:06 00:00:00
if(!user.isAjaxSaving){
user.isAjaxSaving = true;
$.ajax({
......@@ -788,13 +787,25 @@ define(['doT', 'text!temp/user_template_tpl.html', 'ckfinder', 'ckfinderStart',
});
},
getGenjincon: function() {//获取客户动态
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
$.ajax({
url: '/index/useraction_search',
// url: '/index/useraction_search',
url: 'broker/useraction_search',
type: 'GET',
async: true,
data: {
"user_id": user.user_id
"AuthToken": user_info_obj.AuthToken,
"searchdate": 1,
"user_id": user.user_id,
"pagenum": 1,
"agent_id": user_info_obj.id
},
// AuthToken true string token
//user_id true int 客户的ID
//searchdate true int 动态关键字
//pagenum false int 页码:默认第一页
//agent_id true int 经纪人id
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
......
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