Commit e43c6dde authored by agping's avatar agping

edit

parent 46e39441
define(['doT', 'text!temp/get_collection_template_tpl.html', 'css!style/home.css', 'ckfinder', 'ckfinderStart', 'pagination', 'bootstrapJs'], function(doT, template) {
follow = {
pageNo: 1,
/*第几页*/
pageSize: 10,
/*每页显示多少条*/
id: '',
house_id: '',
type: '',
valueCurrent: '',
ajaxObj: '',
stopstatus: true,
boxphoto: '',
init: function() {
//初始化dot
$(document.body).append(template);
follow.getList(0);
follow.event();
// alert(5)
},
event: function() {
$("#search").click(function() {
follow.getList(1);
});
$("#reset").click(function() { //重置
document.getElementById("form_search").reset();
});
// $ (document).delegate (".caozuo", "click", function () {//点击操作跟进详情
// follow.house_id = $ (this).attr ("data-id");
// follow.Caozuo();
// });
// $ (document).delegate (".submit_edit", "click", function () {//提交
// follow.house_id = $ (this).attr ("data-id");
// follow.Submit_follow();
// });
// $ (document).on ("input","#cus_fang", function () {//手机号搜索客方2
// if($("#cus_fang").val()==''){
// $(".user-ul2").html('');
// }else{
// follow.search_phone2();
// }
// });
// $ (document).delegate (".addphone2", "click", function () {//list2消失
// follow.addphone2(this);
// });
},
// addphone2:function(obj){
// var user_ht=$(obj).html();
// $("#cus_fang").val(user_ht);
// $(".user-ul2").html('');
// follow.agent_id = $ (obj).attr ("data-id");
// },
// search_phone2:function(){//手机号
// $.ajax ({
// url: '/index/select_by_phone',
// type: 'POST',
// async: true,
// data: {
// "phone":$("#cus_fang").val()
// },
// dataType: 'json',
// success: function (data) {
// if (data.code == 200) {
// var user_ul2 = "";
// $.each(data.data, function(i,item) {
// user_ul2+='<li class="addphone2" data-id="'+item.id+'">'+item.id+'-'+item.realname+'-'+item.phone+'</li>';
// });
// $(".user-ul2").html(user_ul2);
// } else {
// alert(data.msg);
// }
// }
// });
// },
// Caozuo:function(){//获取跟进详情的数据
// $.ajax({
// 'type': 'GET',
// 'url' : '/index/useraction_search',
// data: {"user_id":follow.house_id},
// dataType: "json",
// success: function(data){
// if(data.code == 200){
// if (data.data) {
// $("#cus_id").html(data.data.user_info.user_id);//客户编号
// $("#cus_name").val(data.data.user_info.user_nick);//姓名
// $("#sex").val(data.data.user_info.sex);//性别
// $("#cus_phone").html(data.data.user_info.user_phone);//电话
// $("#cus_date").html(data.data.user_info.create_time);//上传时间
// $("#cus_fang").val(data.data.user_info.agentinfo);//客方
// var caozuo_table="";
// $.each(data['data']['user_date'], function(i, item) {
// console.log(item)
// caozuo_table +='<tr><td>'+item.content+'</td><td>'+item.agentinfo+'</td><td>'+item.create_time+'</td></tr>';
// });
// $("#caozuo_table").html(caozuo_table);
// }
// } else {
// alert('获取失败!');
// }
// }
// });
// },
// Submit_follow: function() { //提交
// $.ajax({
// 'type': 'POST',
// 'url': '/index/pcEditClient',
// data: {
// "id": follow.house_id,
// "user_nick": $("#cus_name").val(),
// "user_phone": $("#cus_phone").html(),
// "agent_id":follow.agent_id,//客方
// "sex": $("#sex").val()
// },
// dataType: "json",
// success: function(data) {
// if(data.code == 200) {
// if(data.data) {
// }
// } else {
// }
// }
// });
// },
//
getList: function(pageNo) {
follow.pageNo = pageNo;
var _startDateObj = $('#start_date'),
_endDateObj = $('#end_date'),
_customerNameObj = $('#customer_name'),
_customerPhoneObj = $('#customer_phone'),
_followContentObj = $('#follow_content');
var params = {
'pageNo': follow.pageNo,
'pageSize': follow.pageSize
};
_startDateObj.val() != '' && (params.start_date = _startDateObj.val());
_endDateObj.val() != '' && (params.end_date = _endDateObj.val());
$.trim(_customerNameObj.val()) != '' && (params.customer = $.trim(_customerNameObj.val()));
$.trim(_customerPhoneObj.val()) != '' && (params.phone = $.trim(_customerPhoneObj.val()));
$.trim(_followContentObj.val()) != '' && (params.content = $.trim(_followContentObj.val()));
console.log(params);
$.ajax({
type: 'GET',
// url: '/index/RemarkFollowList',
url: '/index/getCollection',
data: params,
timeout: 30000,
dataType: 'json',
beforeSend: function() {},
success: function(data) {
console.log(data);
if(typeof data === 'object') {
if (!data.code) {
// var doTtmpl = doT.template(document.getElementById('get_collection_tpl').innerHTML);
var doTtmpl = doT.template(document.getElementById('get_collection_tpl').innerHTML);
$("#follow_list").html(doTtmpl(data.data.list));
/*分页代码*/
$("#pagediv").pagination({
length: data.data.total,
current: pageNo,
every: follow.pageSize,
onClick: function(el) {
follow.getList(el.num.current);
}
});
}else {
alert(data['msg']);
};
}else{
alert('数据错误');
};
},
error: function() {
alert('error');
},
complete: function(xhr, textStatus){
if(textStatus === 'timeout'){
alert('请求超时');
};
}
});
}
};
return follow;
});
\ No newline at end of file
<script id="get_collection_tpl" type="text/template">
[% if(it) { %]
[% for(var item in it){ %]
<tr class="text-center">
<td>[%= it[item]['start_time'] %]</td>
<td>
[% if(it[item]['label_name']) { %]
[%= it[item]['label_name'] %]
[% }else{ %]
【】
[% } %]
[%= it[item]['content'] %]
</td>
<td>[%= it[item]['end_time'] %]</td>
<td>[%= it[item]['internal_title'] %]</td>
<td>[%= it[item]['user_name'] %]</td>
<td>[%= it[item]['user_phone'] %]</td>
<td>[%= it[item]['id'] %]</td>
<td>[%= it[item]['store_name'] %]</td>
<td>[%= it[item]['report_phone'] %]</td>
<!-- <td>
<a class="btn1 btn-success caozuo" href="#modal-record" data-toggle="modal" data-id='[%= it[item]["id"] %]'>详细信息</a>
</td> -->
</tr>
[% } %]
[% }else{ %]
<tr>
<td colspan="8" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
<!-- start_time 开始时间
end_time 开始时间
internal_title 楼盘名
user_name 客户姓名
user_phone 客户手机号
id false 商铺id
store_name 门店名
report_phone 报备人手机号
report_name 报备人姓名 -->
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