Commit ef1e12e9 authored by agping's avatar agping

办公楼跟进列表

parent 85a26866
{layout name="global/frame_two_tpl" /}
<input type="hidden" class="page-load" id="officeFollowUp" />
<style>
.modal-body {
/*height: 600px;*/
overflow-y: auto;
padding-bottom: 60px;
}
.user-ul2 {
width: 100%;
height: auto;
padding-bottom: 15px;
float: left;
}
.user-ul2 li {
list-style: none;
line-height: 30px;
}
.money_total_two {
font-weight: bold;
font-size: 15px;
}
#search {
float: left;
}
#reset {
float: left;
}
#district_id {
width: 16%!important;
}
#follow_up_con{
width: 32%!important;
}
.clear{
clear: both;
}
.btn-top-house{
margin-top: 20px;
text-align: center;
}
.ld-Marheight-city{
margin-top: 8px;
}
/*加载图标*/
#main_loading_pic {
position: fixed;
top: 50%;
left: 50%;
width: 100px;
height: 100px;
margin-left: 50px;
margin-top: -100px;
overflow: hidden;
display: none;
}
/*跟进人 下拉式搜索*/
.user-ul-liu{
height: auto;
float: left;
position: relative;
left: -40px;
}
.user-ul-liu li{
list-style: none;
line-height: 30px;
}
.left-phone-liu{
float: left;
margin-top: 7px;
margin-left: 10px;
}
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li>
<a href="javascript:;">办公楼跟进列表</a>
</li>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="10">
<form id="form_search">
<select class="form-control btn2 ld-Marheight" id="shop_area_id">
<option value="" selected="selected">区域筛选</option>
</select>
<span class="fore-span ld-Marheight">跟进时间:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time_start" name="start_date1" type="date">
<span class="fore-span ld-Marheight">-</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time_end" name="end_date1" type="date">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="houseID" placeholder="商铺ID" type="text" value="">
<input class="form-control btn4 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="follow_up_con" placeholder="跟进内容" type="text" value="">
<select class="form-control btn4 ld-Marheight input" name="" id="district_id">
<option value="">跟进人所在部门</option>
</select>
<select class="form-control btn4 ld-Marheight input" name="" id="guest_stores" value="">
</select>
<select class="form-control btn4 ld-Marheight input" name="" id="guest_stores_agent" value="">
</select>
<div class="left-phone-liu">
<input class="form-control" data-rule-phoneus="false" data-rule-required="false" id="partical_name" placeholder="跟进人姓名" type="text" value="">
<ul class="user-ul-liu"></ul>
</div>
<div class="clear">
</div>
<span class="btn btn-info btn3 ld-Marheight" id="search">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset">重置</span>
</form>
</td>
</tr>
<tr>
<th class="text-center">跟进时间</th>
<th class="text-center">跟进内容</th>
<th class="text-center">跟进人</th>
<th class="text-center">商铺ID</th>
<th class="text-center">商铺名称</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody class="text-center" id="follow_list">
</table>
</div>
<!-- /#page-content-wrapper -->
<div class="text-right" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- #查看-->
<div class="modal fade modal_followup" id="modal_shop_detail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-one">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
&times;
</button>
<h4 class="modal-title detail-modal-header-tab" >
<a href="javascript:;" class="btn btn-default">商铺跟进</a>
<a href="javascript:;" class="btn btn-info">查看商铺</a>
</h4>
</div>
<div class="modal-body modal-body-one">
<div class="detail-modal-body-sec">
<div class="followup-modal-list-area">
<table class="table table-striped table-bordered table-hover table-condensed">
<tbody class="" id="modal_followup_table_list">
<tr>
<td>电话跟进:测试测试测试测试测试测试测试测试测试测试测试测试</td>
<td>刘丹丹</td>
<td>2017-09-05 15:22:33</td>
</tr>
<tr>
<td colspan="3">2017-09-05 15:22:33</td>
</tr>
</tbody>
</table>
</div>
<div class="followup-modal-comment-area">
<textarea></textarea>
</div>
<div class="btn-top-house">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="modal_followup_submit_btn">提交</button>
</div>
</div>
<div class="detail-modal-body-sec">
<iframe class="iframe-shop-detail"></iframe>
</div>
</div>
</div>
</div>
</div>
<!--加载图标-->
<div id="main_loading_pic">
<img src="/resource/image/jz2.gif">
</div>
define(['doT', 'text!temp/follow_office_template_tpl.html', 'css!style/home.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template) {
house = {
pageNo: 1,
/*第几页*/
pageSize: 10,
AuthToken: '',
agent_id: 0,
agent_phone: '',
agent_name: '',
isFollowupSaving: false,
/*每页显示多少条*/
id: '',
house_id: '',
type: '',
valueCurrent: '',
ajaxObj: '',
stopstatus: true,
boxphoto: '',
detailTabIndex:0,//查看 弹出框 tab切换 初始化
agent_id_phone:'',//下拉跟进人id
init: function() {
//初始化dot
$(document.body).append(template);
// house.getList(0);
house.event();
},
event: function() {
var _doc = $(document);
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
house.AuthToken = user_info_obj.AuthToken;
house.agent_id = user_info_obj.id;
house.phone = user_info_obj.phone;
house.name = user_info_obj.name;
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_end);
$('#create_time_end').val(day_end);//商铺跟进 添加 默认时间 一个月
//初始化城市 区域筛选
house.initializationCityFunction();
// 部门 门店 二级联动
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') {
house.getDistrictStoreList(_id, function(_data) {
var _str = '<option value="">跟进人所在门店</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.id + '">' + item.store_name + '</option>';
});
_this.next().html(_str);
});
} else {};
});
});
//门店 经纪人联动
_doc.on('input', '#guest_stores', function() {
var _this = $(this);
var _id = _this.val();
_this.next().html(''); //先清空
if(_id && _id != '0') {
house.getStoreAgentList(_id, function(_data) {
var _str = '<option value="">选择跟进人</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.id + '">' +item.id + '-' + item.name + '-' + item.phone + '</option>';
});
_this.next().html(_str);
});
} else {};
});
$("#search").click(function() { //搜索
house.getList(1);
});
$("#reset").click(function() { //重置
document.getElementById("form_search").reset();
$('#guest_stores').html('');//重置门店
$('#guest_stores_agent').html('');//重置经纪人
house.agent_id_phone='';//重置经纪人id
});
//查看弹出框里的tab点击事件,查看商铺,商铺跟进
_doc.on('click', '.detail-modal-header-tab>a', function(e){
e.preventDefault();
e.stopPropagation();
var _this = $(this);
_this.removeClass('btn-default').addClass('btn-info').siblings().removeClass('btn-info').addClass('btn-default');
house.detailTabIndex = _this.index();
$('.detail-modal-body-sec:nth-of-type('+(house.detailTabIndex+1)+')').show().siblings().hide();
if(house.detailTabIndex == 1){
$('.iframe-shop-detail').attr('src', '/app_broker/office_detail_pc?shop_id='+house.id);
}else if(house.detailTabIndex == 0){
$('.followup-modal-comment-area>textarea').val('');//清空跟进框内容
house.getFollowupList();
}
});
//点击查看,触发定位事件
_doc.on('click', '[href="#modal_detail"]', function(){
var _this = $(this);
if(_this.hasClass('btn-success')){
_this.removeClass('btn-success').addClass('btn-warning');
};
});
//点击跟进,获取商铺跟进动态的接口
_doc.on('click', '[href="#modal_followup"]', function(){
house.id = $(this).attr("data-id");
$('.followup-modal-comment-area>textarea').val('');//清空跟进框内容
house.getFollowupList();
});
//跟进姓名 下拉式搜索
$(document).on("input", "#partical_name", function() { //手机号新增搜索客方
if($("#partical_name").val() == '') {
house.agent_id_phone='';
$(".user-ul-liu").html('');
} else {
house.search_phone_liu();
}
});
//点击li 列表消失
$(document).delegate(".addphoneliu", "click", function() { //list消失新增客户 点击li事件 获取id ul消失
house.addphoneliu(this);
});
//点击商铺跟进保存按钮,保存数据的接口
_doc.on('click', '#modal_followup_submit_btn', function(e){
e.preventDefault();
e.stopPropagation();
house.followupAdd();
});
//城市 区域 筛选
_doc.on('input', '#user_city_choose', function() {
$('#shop_area_id').val('');
house.getList();
var _this = $(this);
var _id = _this.val();
// house.setUpCityFunction(_id);
_this.next().html(''); //先清空
//新增 编辑
var _objTemp = _this.parent().next().find('select');
_objTemp.html(''); //先清空
if(_id && _id != '0') {
house.getCityAreaList(_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.fullName + '">' + item.fullName + '</option>';
});
_objTemp.html(_str);
$('#shop_area_id').html(_str);
});
} else {};
});
_doc.on('input', '#shop_area_id', function() {
house.getList();
});
//查看点击事件
_doc.on('click', 'a[href="#modal_shop_detail"]', function(e){
e.preventDefault();
e.stopPropagation();
var _this = $(this);
_this.removeClass('btn-success').addClass('btn-warning');
var _id = _this.attr('data-id');
house.id=_id;
console.log(_id);
$('.detail-modal-header-tab>a:nth-of-type(1)').removeClass('btn-default').addClass('btn-info').siblings().removeClass('btn-info').addClass('btn-default');
house.detailTabIndex = 0;
$('.detail-modal-body-sec:nth-of-type(1)').show().siblings().hide();
$('.followup-modal-comment-area>textarea').val('');//清空跟进框内容
house.getFollowupList();
});
},
getList: function(pageNo) { //商铺跟进列表
var user_info_obj = JSON.parse(decodeURIComponent(localStorage.getItem('pcUserInfo'))); //读取缓存
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;
//结束时间
var end_ = $('#create_time_end').val()+" 23:59:59";
date_end =new Date(Date.parse(end_.replace(/-/g, "/")));
params.end_time =date_end.getTime()*0.001;
//时间转化为时间戳
params.district_id = $('#district_id').val();//部门
params.store_id = $('#guest_stores').val();//门店
params.house_id = $('#houseID').val();//商铺 id
params.name_or_phone = $('#user_phone').val();
params.agent_id = house.agent_id_phone?house.agent_id_phone:$('#guest_stores_agent').val(); //下拉搜索 跟进人id
params.search_content = $('#follow_up_con').val();
params.pageNo = house.pageNo;
params.pageSize = house.pageSize;
params.AuthToken = user_info_obj.AuthToken;
params.disc = $('#shop_area_id').val(); //区域筛选
if( !(params.end_time&&params.start_time)){
alert('请选择时间')
return;
}
var cha_time=params.end_time*1000-params.start_time*1000;
if(cha_time > 2764800000){
alert("跟进时间搜索控制在30天以内");
return;
}
$.ajax({
type: 'POST',
url: '/broker/houseFollowUpList', //商铺跟进 对接接口
data: params,
timeout: 30000,
dataType: 'json',
beforeSend: function() {
$('#main_loading_pic').show();
},
success: function(data) {
if(typeof data === 'object') {
if(data.code == 200) {
var doTtmpl = doT.template(document.getElementById('follow_office_list_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.result));
/*分页代码*/
add_page(40000, pageNo, house.pageSize, house.getList);
$('.hide-total-info-liu').hide();
} else {
alert(data['msg']);
};
} else {
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function() {
$('#main_loading_pic').hide();
}
});
},
getFollowupList: function(){
$.ajax({
'type': 'get',
'url': '/office/getListByHouseId',
data: {
'house_id': house.id,
'AuthToken': house.AuthToken
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
if(data.data && Array.isArray(data.data) && data.data.length>0) {
var _htmlTemp = '';
$.each(data.data, function(i, v) {
_htmlTemp += '<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>'.stringFormatObj({
'0': dealPunctuation(v.step),
'1': v.agent_name,
'2': v.create_time
})
});
$('#modal_followup_table_list').html(_htmlTemp);
}else{
$('#modal_followup_table_list').html('<tr><td>暂无数据</td></tr>');
}
//判断用户是否有权限跟进
if(check_auth('office/addShopFollowUp')){
$('#modal_followup_submit_btn').show();
}else{
$('#modal_followup_submit_btn').hide();
}
} else {
alert('请登录!');
}
}
});
},
followupAdd: function(){
var _tareaObjVal = $('.followup-modal-comment-area>textarea').val();
if(_tareaObjVal == ''){
alert('内容不能为空');
return false;
};
if(!house.isFollowupSaving){
house.isFollowupSaving = true;
$.ajax({
'type': 'post',
'url': '/office/addShopFollowUp',
data: {
'house_id': house.id,
'AuthToken': house.AuthToken,
'agent_id': house.agent_id,
'agent_phone': house.agent_phone,
'agent_name': house.agent_name,
'follow_up_info': _tareaObjVal
},
dataType: "json",
success: function(data) {
if(data.code == 200) {
alert('添加成功');
house.isFollowupSaving = false;
$(".modal_followup").modal('hide');
} else {
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);
}
}
});
},
//获取门店的 经纪人
getStoreAgentList: function(id, fn) {
$.ajax({
url: '/index/getBroker_new',
type: 'GET',
async: true,
data: {
'store_id': id,
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
fn && fn(data.data);
}
}
});
},
//初始化 城市
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(1) {
house.getCityAreaList(city_id, function(_data) {
var _str = '<option value="">区域</option>';
$.each(_data, function(i, item) {
_str += '<option value="' + item.name + '">' + item.name + '</option>';
});
$("#shop_area_id").html(_str);
});
} else {};
house.getList(0);//商铺跟进列表
}
});
},
//设置 城市
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({
url: '/index/getAllDisc',
type: 'GET',
async: true,
data: {
// 'parent_code': id,
// "pageSize": 1000
},
dataType: 'json',
success: function(data) {
if(data.code == 200 && data.data != null) {
fn && fn(data.data);
}
}
});
},
//跟进人 姓名搜索
search_phone_liu: function() { //手机号新增客户
$.ajax({
url: '/index/getBroker_new',
type: 'GET',
async: true,
data: {
"phone": $("#partical_name").val(),
'all' : 1
},
dataType: 'json',
success: function(data) {
if(data.code == 200) {
var user_ul = "";
$.each(data.data, function(i, item) {
if(item.status == 0){
var status=' ';
};
if(item.status == 1){
var status='-长假';
};
if(item.status == 2){
var status='-离职';
};
if(item.status == 3){
var status='-转勤';
};
if(item.status == 4){
var status='-黑名单';
}
user_ul += '<li class="addphoneliu" data-id="' + item.id + '">' + item.id + '-' + item.name + '-' + item.phone + status + '</li>';
});
$(".user-ul-liu").html(user_ul);
} else {
alert(data.msg);
}
}
});
},
//将li里的值 赋给input(分佣方姓名)
addphoneliu: function(obj) {//新增客户 input赋值
var user_ht = $(obj).html()+'';
var user_ht_str=user_ht.substring(0,user_ht.length-3);
$("#partical_name").val(user_ht_str);
$(".user-ul-liu").html('');
house.agent_id_phone = $(obj).attr("data-id");
},
};
return house;
});
\ No newline at end of file
<script id="follow_office_list_tpl" type="text/template">
[% if(it&&it.length!=0) { %]
[% for(var item in it){ %]
<tr class="text-center">
<!--对接接口-->
<td>[%= it[item]['create_time'] %]</td>
<td width="47%" class="text-left follow-up-home">[%= dealPunctuation(it[item]['follow_up_info']) %]</td>
<td>[%= it[item]['name'] %]</td>
<td>[%= it[item]['house_id'] %]</td>
<td>
[% if(it[item]["internal_title"] != null) { %]
[%= it[item]['internal_title'] %]
[% } %]
</td>
<td>
<a class="btn1 [%= (it[item]['is_look'] && it[item]['auth_edit_house'] == 0)?'btn-warning':'btn-success' %]" href="#modal_shop_detail" data-id='[%= it[item]["house_id"] %]' data-toggle="modal">跟进/查看</a>
</td>
</tr>
[% } %]
[% }else{ %]
<tr>
<td colspan="8" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
<!--<td>[% if(it[item]["label_name"] != null) { %]
[%= it[item]["label_name"] %]
[% } %]
</td>-->
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