index.html 18 KB

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