index.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>潜客跟踪</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport"
  9. content="width=customer-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  10. <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  11. <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
  12. <style type="text/css">
  13. .seach_items {
  14. float: right;
  15. margin-left: 10px;
  16. }
  17. </style>
  18. <style type="text/css">
  19. .LAY-btns .layui-nav {
  20. padding-left: 0;
  21. padding-right: 10px;
  22. top: -4px;
  23. margin: 0 10px;
  24. border: 0;
  25. background-color: #009688;
  26. }
  27. .LAY-btns .layui-nav .layui-nav-item {
  28. line-height: 40px;
  29. }
  30. .LAY-btns .layui-nav .layui-nav-child {
  31. top: 34px;
  32. }
  33. .LAY-btns .layui-nav .layui-nav-bar {
  34. display: none;
  35. }
  36. .LAY-btns .layui-nav .layui-nav-child dd.layui-this a {
  37. color: #333;
  38. background-color: #fff;
  39. }
  40. .LAY-btns .layui-nav .layui-nav-child dd.layui-this a:hover {
  41. background-color: #f2f2f2;
  42. color: #000;
  43. }
  44. .tableContent {
  45. width: 100%;
  46. display: flex;
  47. justify-content: space-between;
  48. flex-direction: row;
  49. }
  50. .demo-class .layui-layer-btn0 {
  51. background-color: #009688 !important;
  52. color: #fff;
  53. }
  54. .demo-class .layui-layer-btn1 {
  55. background-color: red;
  56. color: #fff;
  57. }
  58. .treeContent{
  59. height: 30vh;
  60. overflow-y: scroll;
  61. margin-bottom: 10px;
  62. border: 1px solid rgba(0,0,0,0.1);
  63. }
  64. /*隐藏滚动条*/
  65. .treeContent::-webkit-scrollbar {
  66. height: 0 !important;width:0px !important;
  67. }
  68. </style>
  69. </head>
  70. <body>
  71. <div class="layui-fluid">
  72. <div class="layui-card">
  73. <div class="layui-card-body" pad15>
  74. <div class="layui-row layui-col-space15">
  75. <div class="layui-col-md12">
  76. <div class="tableContent">
  77. <div style="width: 345px">
  78. <div class="treeContent demo-tree" id="id_tree"></div>
  79. <table id="customer_log" lay-filter="customer-operate-log"></table>
  80. </div>
  81. <div style="width: calc(100% - 360px)">
  82. <div class="LAY-btns" style="margin-bottom: 10px;">
  83. <div style="float: left">
  84. <button class="layui-btn" id="btn_list"><i
  85. class="layui-icon layui-icon-download-circle"></i>导出
  86. </button>
  87. </div>
  88. <form class="layui-form" lay-filter="query-form-element">
  89. <div class="seach_items">
  90. <button class="layui-btn" lay-submit lay-filter="query-form-element"><i
  91. class="layui-icon layui-icon-search"></i>查询
  92. </button>
  93. </div>
  94. <div class="seach_items">
  95. <input type="text" name="tel" autocomplete="off" class="layui-input"
  96. placeholder="电话"/>
  97. </div>
  98. <div class="seach_items">
  99. <input type="text" name="name" autocomplete="off" class="layui-input"
  100. placeholder="姓名"/>
  101. </div>
  102. <div class="seach_items">
  103. <select name="source" id="id_source" style="width: 40px;">
  104. <option value="">请选择来源</option>
  105. </select>
  106. </div>
  107. <div class="seach_items">
  108. <select name="project" id="id_project" style="width: 40px;">
  109. <option value="">请选择项目</option>
  110. </select>
  111. </div>
  112. </form>
  113. <div style="clear: both;"></div>
  114. </div>
  115. <table id="customer_datagrid" lay-filter="customer-operate"></table>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. <script type="text/html" id="customer_datagrid-operate-bar">
  124. <div class="layui-btn-group">
  125. <a class="layui-btn layui-btn-xs" lay-event="customer_search"
  126. >查看</a>
  127. </div>
  128. <div class="layui-btn-group">
  129. <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="add_review"
  130. >跟踪报告</a>
  131. </div>
  132. <div class="layui-btn-group">
  133. <a class="layui-btn layui-btn-xs layui-btn-warm" data-permission="inner_review" lay-event="internal_trace"
  134. >内部跟踪</a>
  135. </div>
  136. </script>
  137. <script src="../../layuiadmin/layui/layui.js?t=1"></script>
  138. <script>
  139. layui.config({
  140. base: '../../../layuiadmin/' //静态资源所在路径
  141. }).extend({
  142. index: 'lib/index' //主入口模块
  143. }).use(['index', 'table', 'form', 'tree'], function () {
  144. var $ = layui.$;
  145. var table = layui.table
  146. , form = layui.form
  147. , tree = layui.tree
  148. , admin = layui.admin;
  149. var store_id, field;
  150. admin.req({
  151. url: '/customer/dict/',
  152. done: function (res) {
  153. var data = res.data.source;
  154. var source_node = $('#id_source');
  155. for (var i in data) {
  156. var pid = data[i].id;
  157. var name = data[i].name;
  158. source_node.append("<option value='" + pid + "'>" + name + "</option>");
  159. }
  160. var project_data = res.data.project;
  161. var project_node = $('#id_project');
  162. for (var i in project_data) {
  163. var pid1 = project_data[i].id;
  164. var name1 = project_data[i].name;
  165. project_node.append("<option value='" + pid1 + "'>" + name1 + "</option>");
  166. }
  167. form.render('select');
  168. }
  169. });
  170. table.render({
  171. elem: '#customer_log'
  172. , url: '/customer/stage_count/'
  173. , cols: [[
  174. {field: 'stage', title: '阶段', event: 'stage', width: 100}
  175. , {field: 'total_count', title: "总数", event: 'total', width: 80, sort: true}
  176. , {field: 'today_count', title: '今日', event: 'today', width: 80, sort: true}
  177. , {field: 'overdue_count', title: '逾期', event: 'overdue', width: 80, sort: true}
  178. ]]
  179. });
  180. table.render({
  181. elem: '#customer_datagrid'
  182. , url: '/customer/new_customer/'
  183. , title: '潜客跟踪'
  184. , cols: [[
  185. {field: 'name', title: '姓名', width: 110}
  186. , {field: 'gender_text', title: "性别", width: 70}
  187. , {field: 'tel', title: '电话', width: 130}
  188. , {field: 'village', title: '小区', width: 150}
  189. , {field: 'address', title: '地址', width: 200}
  190. , {field: 'source_text', title: '来源', width: 100}
  191. , {field: 'project_text', title: '项目', width: 100}
  192. , {field: 'stage_progress_text', title: '阶段进度', width: 100}
  193. , {field: 'potential_level_text', title: '客户级别', width: 100}
  194. , {field: 'status_text', title: '状态', width: 60}
  195. , {field: 'track_user_text', title: '跟踪人', width: 120}
  196. , {field: 'end_time_f', title: '最后跟踪时间', width: 150}
  197. , {field: 'last_review', title: '最后跟踪情况', width: 200}
  198. , {field: 'next_time_f', title: '下次跟踪时间', width: 120}
  199. , {field: 'follow_count', title: '跟踪次数', width: 100}
  200. , {field: 'enter_count', title: '进店次数', width: 100}
  201. , {field: 'last_enter_time', title: '最后进店时间', width: 150}
  202. , {field: 'create_time_f', title: '建档时间', width: 150}
  203. , {field: 'create_user_text', title: '建档人', width: 100}
  204. , {field: 'notes', title: '备注', width: 200}
  205. , {width: 220, align: 'center', fixed: 'right', toolbar: "#customer_datagrid-operate-bar"}
  206. ]]
  207. , page: true
  208. , height: 'full-108'
  209. , done: function () {
  210. layui.index.removeNoPermButtons();
  211. }
  212. });
  213. var manager_stores = layui.data(layui.setter.tableName)['manager_stores'];
  214. if(parseInt(manager_stores) !== 0){
  215. admin.req({
  216. url: '/account/employee_tree2/'
  217. , done: function (res) {
  218. tree.render({
  219. elem: '#id_tree' //绑定元素
  220. ,onlyIconControl: true
  221. ,data: res.data
  222. //点击菜单时触发
  223. ,click: function(obj) {
  224. //节点高亮
  225. var nodes = document.getElementsByClassName("layui-tree-txt");
  226. for(var i=0;i<nodes.length;i++){
  227. if(nodes[i].innerHTML === obj.data.title){
  228. nodes[i].style.color = "#009688";
  229. nodes[i].style.fontWeight= "bold";
  230. }else{
  231. nodes[i].style.color= "#555";
  232. nodes[i].style.fontWeight= "normal";
  233. }
  234. }
  235. store_id = obj.data.id;
  236. field = obj.data.field;
  237. }
  238. });
  239. }
  240. });
  241. }else{
  242. $('#id_tree').hide()
  243. }
  244. function createFollowReport(customer_id, stage_progress_sort) {
  245. layer.open({
  246. type: 2,
  247. title: '添加跟踪报告',
  248. area: ['45%', '70%'],
  249. btn: ['保存', '取消'],
  250. yes: function (index, dom) {
  251. layui.onSubmitChild = function (res) {
  252. if (res.code === 0) {
  253. layer.msg('添加成功!', {icon: 1})
  254. }
  255. layer.close(index);
  256. //刷新表格
  257. table.reload('customer_log', {});
  258. table.reload('customer_datagrid', {});
  259. };
  260. layui.submitChild();
  261. },
  262. btn2: function (index, layero) {
  263. layer.close(index);//关闭当前按钮
  264. },
  265. content: 'add_report.html?customer_id=' + customer_id + '&stage_progress_sort=' + stage_progress_sort
  266. });
  267. };
  268. //监听工具条
  269. table.on('tool(customer-operate)', function (obj) {
  270. var data = obj.data;
  271. if (obj.event === 'customer_search') {
  272. table.editdata = data;
  273. layer.open({
  274. skin: 'demo-class',
  275. type: 2,
  276. title: '查看客户详情',
  277. area: ['55%', '90%'],
  278. btn: ['跟踪报告', '更新进度', '取消'],
  279. yes: function (index, dom) {
  280. //添加跟踪报告
  281. createFollowReport(data.id, data.stage_progress_sort)
  282. },
  283. btn2: function (index, layero) {
  284. //更新进度
  285. layer.open({
  286. type: 2,
  287. title: '更新进度',
  288. area: ['45%', '70%'],
  289. btn: ['保存', '取消'],
  290. yes: function (index, dom) {
  291. layui.onSubmitChild = function (res) {
  292. if (res.code === 0) {
  293. layer.msg('更新成功!', {icon: 1})
  294. }
  295. layer.close(index);
  296. table.reload('customer_datagrid', {});
  297. };
  298. layui.submitChild();
  299. },
  300. btn2: function (index, layero) {
  301. layer.close(index);//关闭当前按钮
  302. },
  303. content: '../order/update_process.html?customer_id=' + data.id
  304. });
  305. },
  306. btn3: function (index, layero) {
  307. //取消
  308. layer.close(index);//关闭当前按钮
  309. },
  310. content: 'detail.html?customer=' + data.id
  311. });
  312. } else if (obj.event === 'add_review') {
  313. //添加跟踪报告
  314. createFollowReport(data.id, data.stage_progress_sort)
  315. }else if(obj.event === 'internal_trace'){
  316. layer.open({
  317. type: 2,
  318. title: '内部跟踪',
  319. area: ['35%', '50%'],
  320. btn: ['保存', '取消'],
  321. yes: function (index, dom) {
  322. layui.onSubmitChild = function (res) {
  323. if (res.code === 0) {
  324. layer.msg('添加成功!', {icon: 1})
  325. }
  326. layer.close(index);
  327. //刷新表格
  328. table.reload('customer_log', {});
  329. table.reload('customer_datagrid', {});
  330. };
  331. layui.submitChild();
  332. },
  333. btn2: function (index, layero) {
  334. layer.close(index);//关闭当前按钮
  335. },
  336. content: 'internal_trace.html?customer_id=' + data.id + '&stage_progress_sort=' + data.stage_progress_sort
  337. });
  338. }
  339. });
  340. // 点击表格触发
  341. table.on('tool(customer-operate-log)', function(obj){
  342. var data = obj.data;
  343. let tool_event = obj.event;
  344. let params = {};
  345. params['stage_progress'] = data.stage_id;
  346. let url = '/customer/new_customer/'
  347. if(field && store_id){
  348. url = `/customer/new_customer/?type=${field}&id=${store_id}`
  349. }
  350. if(tool_event === 'today'){
  351. params['today'] = 'today';
  352. }else if(tool_event === 'overdue'){
  353. params['overdue'] = 'overdue';
  354. };
  355. table.reload('customer_datagrid', {
  356. url
  357. , where: params
  358. , page: {curr: 1}
  359. });
  360. });
  361. var _params = {};
  362. form.on('submit(query-form-element)', function (data) {
  363. _params = data.field;
  364. table.reload('customer_datagrid', {
  365. where: data.field
  366. , page: {curr: 1}
  367. });
  368. layer.closeAll();
  369. return false
  370. });
  371. //导出列表
  372. $('#btn_list').on('click', function () {
  373. $.get({
  374. url: '/customer/new_customer/?export=true',
  375. dataType: 'json',
  376. data: _params,
  377. success: function (res) {
  378. if (res.code === 1) {
  379. layer.msg(res.msg);
  380. return;
  381. }
  382. table.exportFile('customer_datagrid', res,)
  383. }
  384. })
  385. });
  386. $('#customer_order').on('click', function () {
  387. layer.open({
  388. type: 2,
  389. title: '预约量房',
  390. area: ['45%', '65%'],
  391. btn: ['保存', '取消'],
  392. yes: function (index, dom) {
  393. layui.onSubmitChild = function (res) {
  394. if (res.code === 0) {
  395. layer.msg('添加成功!', {icon: 1})
  396. }
  397. layer.close(index);
  398. table.reload('customer_datagrid', {});
  399. };
  400. layui.submitChild();
  401. },
  402. btn2: function (index, layero) {
  403. layer.close(index);//关闭当前按钮
  404. },
  405. content: 'order.html'
  406. });
  407. });
  408. });
  409. </script>
  410. </body>
  411. </html>