73 lines
2.5 KiB
HTML
73 lines
2.5 KiB
HTML
<div class="pb-3">
|
|
<button class="layui-btn layui-btn-sm add-trace">+ 新建跟进记录</button>
|
|
</div>
|
|
<div>
|
|
<table class="layui-hide" id="trace" lay-filter="trace"></table>
|
|
</div>
|
|
<script>
|
|
function trace(){
|
|
if($('#customerTab').find('li').eq(0).data('load') =='true'){
|
|
return false;
|
|
}
|
|
$('#customerTab').find('li').eq(0).data('load','true');
|
|
let tool = layui.tool, table = layui.table;
|
|
//项目任务
|
|
parent.layui.traceTable = table.render({
|
|
elem: '#trace',
|
|
title: '跟进记录列表',
|
|
cellMinWidth:80,
|
|
url: "/customer/api/get_trace",
|
|
where:{'customer_id':customer_id},
|
|
page: true, //开启分页
|
|
limit: 20,
|
|
cols: [[
|
|
{field: 'id', title: '编号', width: 80, align: 'center'}
|
|
,{field:'admin_name',title: '跟进人',align:'center',width: 80}
|
|
,{field:'follow_time',title: '跟进时间',align:'center',width: 132}
|
|
, { field: 'stage_name', title: '当前阶段', width: 80, align: 'center'}
|
|
,{field:'type_name',title: '跟进方式',width: 80, align: 'center',templet:function(d){
|
|
var html = '<span class="layui-color-'+d.type+'">'+d.type_name+'</span>';
|
|
return html;
|
|
}}
|
|
,{field:'content',title: '沟通内容'}
|
|
,{field:'next_time',title: '下次跟进时间', align:'center',width: 132}
|
|
,{fixed:'right',width:132,title: '操作', align:'center',templet: function(d){
|
|
var html = '<div class="layui-btn-group">';
|
|
var btn='<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>';
|
|
var btn1='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详情</a>';
|
|
var btn2='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>';
|
|
return html+btn+btn1+btn2+'</div>';
|
|
}}
|
|
]]
|
|
});
|
|
$('.add-trace').on('click',function(){
|
|
parent.layui.tool.side('/customer/api/add_trace?cid='+customer_id);
|
|
});
|
|
|
|
table.on('tool(trace)', function(obj){
|
|
var data = obj.data; //获得当前行数据
|
|
var layEvent = obj.event;
|
|
if(layEvent === 'edit'){ //编辑
|
|
let url = '/customer/api/add_trace/id/'+data.id;
|
|
parent.layui.tool.side(url);
|
|
}
|
|
if(layEvent === 'view'){ //查看
|
|
let url = '/customer/api/view_trace/id/'+data.id;
|
|
parent.layui.tool.side(url);
|
|
}
|
|
if(layEvent === 'del'){ //删除
|
|
layer.confirm('确定要删除该跟进记录吗?', {icon: 3, title:'提示'}, function(index){
|
|
let callback = function (e) {
|
|
layer.msg(e.msg);
|
|
if (e.code == 0) {
|
|
parent.layui.traceTable.reload();
|
|
}
|
|
}
|
|
tool.delete("/customer/api/delete_trace",{"id":data.id},callback);
|
|
layer.close(index);
|
|
});
|
|
}
|
|
return false;
|
|
})
|
|
}
|
|
</script> |