Commit 52cfe3c8 authored by agping's avatar agping

后台 约带看记录 全部

parent 1511a1c8
......@@ -11,7 +11,7 @@ namespace app\index\controller;
use app\index\extend\Basic;
class InspectionRecord extends Basic
class InspectionRecordAll extends Basic
{
public function inspectionRecordListAll()
{
......
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="inspectionRecord" />
<input type="hidden" class="page-load" id="inspectionRecordAll" />
<style>
.modal-body {
/*height: 600px;*/
......
define(['doT', 'text!temp/inspectionRecordAll_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);
});
_doc.on('click', 'a[href="#modal-report"]', function(e) { //提交成交报告弹出框
var _packdata = $(this).closest('tr').attr('data-data');
e.preventDefault();
e.stopPropagation();
$('.iframe-submit-report').attr('src', '/app_broker/submit_report_pc?packdata=' + _packdata);
});
$("#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.create_time_start = $('#create_time_start').val();
params.create_time_end = $('#create_time_end').val();
params.report_agent_name = $('#user_name').val();
params.report_agent_phone = $('#user_phone').val();
params.house_title = $('#house_title').val();
params.user_phone = $('#report_agent_phone').val();
// 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;
params.page_no = record.pageNo;
params.page_size = record.pageSize;
$.ajax({
type: 'GET',
url: '/broker/reportListForPc', //约带看记录 对接接口(2.9.6 有权限的人 才能看到)
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('inspectionRecordAll_list_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.result));
/*分页代码*/
console.log(data.data.total);
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
<script id="inspectionRecordAll_list_tpl" type="text/template">
[% if(it&&it.length!=0) { %]
[% for(var item in it){ %]
<tr class="text-center" data-data="[%= encodeURIComponent(JSON.stringify(it[item])) %]">
<!--对接接口-->
<td>[%= it[item]['order_id'] %]</td>
<td>[%= it[item]['user_name'] %]</td>
<td>[%= hideTel(it[item]['user_phone']) %]</td>
<td>[%= it[item]['create_time'] %]</td>
<td>[%= it[item]['report_agent_name'] %]</td>
<td>[%= it[item]['house_title'] %]</td>
<td>[%= it[item]['predict_see_time'] %]</td>
<td>
<a class="btn1 btn-success timeline" href="#modal-time" data-toggle="modal" data-id='[%= it[item]["order_id"] %]'>时间轴</a>
[% if(check_auth('broker/bargain')) { %]
<a class="btn1 btn-success submit-report" href="#modal-report" data-toggle="modal" data-id='[%= it[item]["order_id"] %]'>提交成交报告</a>
[% } %]
</td>
</tr>
[% } %]
[% }else{ %]
<tr>
<td colspan="8" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
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