123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>潜客跟踪</title>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport"
- content="width=customer-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
- <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
- <style type="text/css">
- .seach_items {
- float: right;
- margin-left: 10px;
- }
- </style>
- <style type="text/css">
- .LAY-btns .layui-nav {
- padding-left: 0;
- padding-right: 10px;
- top: -4px;
- margin: 0 10px;
- border: 0;
- background-color: #009688;
- }
- .LAY-btns .layui-nav .layui-nav-item {
- line-height: 40px;
- }
- .LAY-btns .layui-nav .layui-nav-child {
- top: 34px;
- }
- .LAY-btns .layui-nav .layui-nav-bar {
- display: none;
- }
- .LAY-btns .layui-nav .layui-nav-child dd.layui-this a {
- color: #333;
- background-color: #fff;
- }
- .LAY-btns .layui-nav .layui-nav-child dd.layui-this a:hover {
- background-color: #f2f2f2;
- color: #000;
- }
- .tableContent {
- width: 100%;
- display: flex;
- justify-content: space-between;
- flex-direction: row;
- }
- .demo-class .layui-layer-btn0 {
- background-color: #009688 !important;
- color: #fff;
- }
- .demo-class .layui-layer-btn1 {
- background-color: red;
- color: #fff;
- }
- .treeContent {
- height: 30vh;
- overflow-y: scroll;
- margin-bottom: 10px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- }
- /*隐藏滚动条*/
- .treeContent::-webkit-scrollbar {
- height: 0 !important;
- width: 0px !important;
- }
- </style>
- </head>
- <body>
- <div class="layui-fluid">
- <div class="layui-card">
- <div class="layui-card-body" pad15>
- <div class="layui-row layui-col-space15">
- <div class="layui-col-md12">
- <div class="tableContent">
- <div style="width: 345px">
- <div class="treeContent demo-tree" id="id_tree"></div>
- <table id="customer_log" lay-filter="customer-operate-log"></table>
- </div>
- <div style="width: calc(100% - 360px)">
- <div class="LAY-btns" style="margin-bottom: 10px;">
- <div style="float: left">
- <button class="layui-btn" id="btn_list"><i
- class="layui-icon layui-icon-download-circle"></i>导出
- </button>
- </div>
- <form class="layui-form" lay-filter="query-form-element">
- <div class="seach_items">
- <button class="layui-btn" lay-submit lay-filter="query-form-element"><i
- class="layui-icon layui-icon-search"></i>查询
- </button>
- </div>
- <div class="seach_items">
- <input type="text" name="tel" autocomplete="off" class="layui-input"
- placeholder="电话"/>
- </div>
- <div class="seach_items">
- <input type="text" name="name" autocomplete="off" class="layui-input"
- placeholder="姓名"/>
- </div>
- <div class="seach_items">
- <select name="source" id="id_source" style="width: 40px;">
- <option value="">请选择来源</option>
- </select>
- </div>
- <div class="seach_items">
- <select name="project" id="id_project" style="width: 40px;">
- <option value="">请选择项目</option>
- </select>
- </div>
- <div class="seach_items">
- <select name="status">
- <option value="">请选择状态</option>
- <option value="1" selected>正常</option>
- <option value="2">放弃</option>
- </select>
- </div>
- </form>
- <div style="clear: both;"></div>
- </div>
- <table id="customer_datagrid" lay-filter="customer-operate"></table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script type="text/html" id="customer_datagrid-operate-bar">
- <div class="layui-btn-group">
- <a class="layui-btn layui-btn-xs" lay-event="customer_search"
- >查看</a>
- <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit"
- >修改</a>
- <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="add_review"
- >跟踪报告</a>
- <a class="layui-btn layui-btn-xs" lay-event="add_project"
- >添加项目</a>
- <a class="layui-btn layui-btn-xs layui-btn-warm" data-permission="customer.inner_review"
- lay-event="internal_trace"
- >内部跟踪</a>
- <a class="layui-btn layui-btn-xs layui-btn-danger" data-permission="customer.again_dispatch"
- lay-event="again_dispatch"
- >重新分配</a>
- </div>
- </script>
- <script src="../../layuiadmin/layui/layui.js?t=1"></script>
- <script>
- layui.config({
- base: '../../../layuiadmin/' //静态资源所在路径
- }).extend({
- index: 'lib/index' //主入口模块
- }).use(['index', 'table', 'form', 'tree'], function () {
- var $ = layui.$;
- var table = layui.table
- , form = layui.form
- , tree = layui.tree
- , admin = layui.admin;
- var store_id, field;
- admin.req({
- url: '/customer/dict/',
- done: function (res) {
- var data = res.data.source;
- var source_node = $('#id_source');
- for (var i in data) {
- var pid = data[i].id;
- var name = data[i].name;
- source_node.append("<option value='" + pid + "'>" + name + "</option>");
- }
- var project_data = res.data.project;
- var project_node = $('#id_project');
- for (var i in project_data) {
- var pid1 = project_data[i].id;
- var name1 = project_data[i].name;
- project_node.append("<option value='" + pid1 + "'>" + name1 + "</option>");
- }
- form.render('select');
- }
- });
- table.render({
- elem: '#customer_log'
- , url: '/customer/stage_count/'
- , cols: [[
- {field: 'stage', title: '阶段', event: 'stage', width: 100}
- , {field: 'total_count', title: "总数", event: 'total', width: 80, sort: true}
- , {field: 'today_count', title: '今日', event: 'today', width: 80, sort: true}
- , {field: 'overdue_count', title: '逾期', event: 'overdue', width: 80, sort: true}
- ]]
- });
- var style = 'font-size:12px;'
- table.render({
- elem: '#customer_datagrid'
- , url: '/customer/new_customer/?status=1'
- , title: '潜客跟踪'
- , cols: [[
- {field: 'name', title: '姓名', width: 90}
- , {field: 'gender_text', title: "性别", width: 60}
- , {field: 'tel', title: '电话', width: 120}
- , {field: 'village', title: '小区', width: 150, style:style}
- , {field: 'address', title: '地址', width: 150, style:style}
- , {field: 'source_text', title: '来源', width: 100, style:style}
- , {field: 'project_text', title: '项目', width: 80, style:style}
- , {field: 'stage_progress_text', title: '阶段进度', width: 100, style:style}
- , {field: 'status_text', title: '状态', width: 60, style:style}
- , {field: 'track_user_text', title: '跟踪人', width: 120, style:style}
- , {field: 'store_text', title: '门店', width: 120, style:style}
- , {field: 'end_time_f', title: '最后跟踪时间', width: 130, style:style}
- , {field: 'last_review', title: '最后跟踪情况', width: 150, style:style}
- , {field: 'next_time_f', title: '下次跟踪', width: 100, style:style}
- , {field: 'enter_count', title: '进店次数', width: 90, style:style}
- , {field: 'last_enter_time', title: '最后进店时间', width: 130, style:style}
- , {field: 'create_time_f', title: '建档时间', width: 130, style:style}
- , {field: 'create_user_text', title: '建档人', width: 100, style:style}
- , {field: 'notes', title: '备注', width: 150, style:style}
- , {width: 350, align: 'center', fixed: 'right', toolbar: "#customer_datagrid-operate-bar"}
- ]]
- , page: true
- , height: 'full-108'
- , done: function () {
- layui.index.removeNoPermButtons();
- }
- });
- var manager_stores = layui.data(layui.setter.tableName)['manager_stores'];
- if (parseInt(manager_stores) !== 0) {
- admin.req({
- url: '/account/employee_tree/'
- , done: function (res) {
- tree.render({
- elem: '#id_tree' //绑定元素
- , onlyIconControl: true
- , data: res.data
- //点击菜单时触发
- , click: function (obj) {
- //节点高亮
- var nodes = document.getElementsByClassName("layui-tree-txt");
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].innerHTML === obj.data.title) {
- nodes[i].style.color = "#009688";
- nodes[i].style.fontWeight = "bold";
- } else {
- nodes[i].style.color = "#555";
- nodes[i].style.fontWeight = "normal";
- }
- }
- store_id = obj.data.id;
- field = obj.data.field;
- table.reload('customer_log', {
- where: {type: field, id: store_id}
- });
- }
- });
- }
- });
- } else {
- $('#id_tree').hide()
- }
- function createFollowReport(customer_id, stage_progress_sort) {
- layer.open({
- type: 2,
- title: '添加跟踪报告',
- area: ['45%', '70%'],
- btn: ['保存', '取消'],
- yes: function (index, dom) {
- layui.onSubmitChild = function (res) {
- if (res.code === 0) {
- layer.msg('添加成功!', {icon: 1})
- }
- layer.close(index);
- //刷新表格
- table.reload('customer_log', {});
- table.reload('customer_datagrid', {});
- };
- layui.submitChild();
- },
- btn2: function (index, layero) {
- layer.close(index);//关闭当前按钮
- },
- content: 'add_report.html?customer_id=' + customer_id + '&stage_progress_sort=' + stage_progress_sort
- });
- };
- //监听工具条
- table.on('tool(customer-operate)', function (obj) {
- var data = obj.data;
- table.editdata = data;
- if (obj.event === 'customer_search') {
- layer.open({
- skin: 'demo-class',
- type: 2,
- title: '查看客户详情',
- area: ['55%', '90%'],
- btn: ['跟踪报告', '更新进度', '取消'],
- yes: function (index, dom) {
- //添加跟踪报告
- createFollowReport(data.id, data.stage_progress_sort)
- },
- btn2: function (index, layero) {
- //更新进度
- layer.open({
- type: 2,
- title: '更新进度',
- area: ['45%', '70%'],
- btn: ['保存', '取消'],
- yes: function (index, dom) {
- layui.onSubmitChild = function (res) {
- parent.layui.getTipsData();
- layer.close(index);
- table.reload('customer_datagrid', {});
- };
- layui.submitChild();
- },
- btn2: function (index, layero) {
- layer.close(index);//关闭当前按钮
- },
- content: '../order/update_process.html?customer_id=' + data.id
- });
- },
- btn3: function (index, layero) {
- //取消
- layer.close(index);//关闭当前按钮
- },
- content: 'detail.html?customer=' + data.id
- });
- } else if (obj.event === 'edit') {
- layer.open({
- type: 2,
- title: '修改',
- shadeClose: false,
- area: ['45%', '80%'],
- btn: ['保存', '取消'],
- yes: function (index, dom) {
- layui.onSubmitChild = function (res) {
- layer.close(index);
- table.reload('customer_datagrid', {});
- };
- layui.submitChild();
- },
- btn2: function (index, layero) {
- layer.close(index);//关闭当前按钮
- },
- content: 'edit.html?id=' + data.id
- });
- }
- else if (obj.event === 'add_review') {
- //添加跟踪报告
- createFollowReport(data.id, data.stage_progress_sort)
- }
- else if (obj.event === 'add_project') {
- layer.open({
- type: 2,
- title: '添加项目',
- area: ['40%', '70%'],
- btn: ['保存', '取消'],
- yes: function (index, dom) {
- layui.onSubmitChild = function (res) {
- layer.close(index);
- //刷新表格
- table.reload('customer_datagrid', {});
- };
- layui.submitChild();
- },
- btn2: function (index, layero) {
- layer.close(index);//关闭当前按钮
- },
- content: 'add_project.html?customer_id=' + data.id
- });
- } else if (obj.event === 'internal_trace') {
- layer.open({
- type: 2,
- title: '内部跟踪',
- area: ['40%', '70%'],
- btn: ['保存', '取消'],
- yes: function (index, dom) {
- layui.onSubmitChild = function (res) {
- layer.close(index);
- //刷新表格
- table.reload('customer_log', {});
- table.reload('customer_datagrid', {});
- };
- layui.submitChild();
- },
- btn2: function (index, layero) {
- layer.close(index);//关闭当前按钮
- },
- content: 'internal_trace.html?customer_id=' + data.id + '&stage_progress_sort=' + data.stage_progress_sort
- });
- } else if (obj.event === 'again_dispatch') {
- layer.open({
- type: 2,
- title: '重新分配',
- area: ['40%', '40%'],
- btn: ['保存', '取消'],
- yes: function (index, dom) {
- layui.onSubmitChild = function (res) {
- if (res.code === 0) {
- layer.msg('重新分配成功!', {icon: 1})
- }
- layer.close(index);
- table.reload('customer_datagrid', {});
- };
- layui.submitChild();
- },
- btn2: function (index, layero) {
- layer.close(index);//关闭当前按钮
- },
- content: 'again_dispatch.html?id=' + data.id
- });
- }
- });
- // 点击表格触发
- table.on('tool(customer-operate-log)', function (obj) {
- var data = obj.data;
- let tool_event = obj.event;
- let params = {count_param: tool_event};
- params['stage_progress'] = data.stage_id;
- if (field && store_id) {
- params['param'] = field + '_' + store_id;
- }
- table.reload('customer_datagrid', {
- where: params
- , page: {curr: 1}
- });
- });
- var _params = {};
- form.on('submit(query-form-element)', function (data) {
- _params = data.field;
- table.reload('customer_datagrid', {
- where: data.field
- , page: {curr: 1}
- });
- layer.closeAll();
- return false
- });
- //导出列表
- $('#btn_list').on('click', function () {
- $.get({
- url: '/customer/new_customer/?export=true',
- dataType: 'json',
- data: _params,
- success: function (res) {
- if (res.code === 1) {
- layer.msg(res.msg);
- return;
- }
- table.exportFile('customer_datagrid', res,)
- }
- })
- });
- $('#customer_order').on('click', function () {
- layer.open({
- type: 2,
- title: '预约量房',
- area: ['45%', '65%'],
- btn: ['保存', '取消'],
- yes: function (index, dom) {
- layui.onSubmitChild = function (res) {
- if (res.code === 0) {
- layer.msg('添加成功!', {icon: 1})
- }
- layer.close(index);
- table.reload('customer_datagrid', {});
- };
- layui.submitChild();
- },
- btn2: function (index, layero) {
- layer.close(index);//关闭当前按钮
- },
- content: 'order.html'
- });
- });
- });
- </script>
- </body>
- </html>
|