index.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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="LAY-btns" style="margin-bottom: 10px;">
  77. <div style="float: left">
  78. <button class="layui-btn" id="btn_list"><i
  79. class="layui-icon layui-icon-download-circle"></i>导出
  80. </button>
  81. </div>
  82. <form class="layui-form" lay-filter="query-form-element">
  83. <div class="seach_items">
  84. <button class="layui-btn" lay-submit lay-filter="query-form-element"><i
  85. class="layui-icon layui-icon-search"></i>查询
  86. </button>
  87. </div>
  88. <div class="seach_items">
  89. <input type="text" name="tel" autocomplete="off" class="layui-input"
  90. placeholder="电话"/>
  91. </div>
  92. <div class="seach_items">
  93. <input type="text" name="name" autocomplete="off" class="layui-input"
  94. placeholder="姓名"/>
  95. </div>
  96. <div class="seach_items">
  97. <select name="source" id="id_source" style="width: 40px;">
  98. <option value="">请选择来源</option>
  99. </select>
  100. </div>
  101. <div class="seach_items">
  102. <select name="project" id="id_project" style="width: 40px;">
  103. <option value="">请选择项目</option>
  104. </select>
  105. </div>
  106. </form>
  107. <div style="clear: both;"></div>
  108. </div>
  109. <div class="tableContent">
  110. <div style="width: 345px">
  111. <div class="treeContent demo-tree" id="text"></div>
  112. <table id="customer_log" lay-filter="customer-operate-log"></table>
  113. </div>
  114. <div style="width: calc(100% - 360px)">
  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 src="../../layuiadmin/layui/layui.js?t=1"></script>
  124. <script>
  125. layui.config({
  126. base: '../../../layuiadmin/' //静态资源所在路径
  127. }).extend({
  128. index: 'lib/index' //主入口模块
  129. }).use(['index', 'table', 'form', 'tree'], function () {
  130. var $ = layui.$;
  131. var table = layui.table
  132. , form = layui.form
  133. , tree = layui.tree
  134. , admin = layui.admin;
  135. admin.req({
  136. url: '/customer/dict/',
  137. done: function (res) {
  138. var data = res.data.source;
  139. var source_node = $('#id_source');
  140. for (var i in data) {
  141. var pid = data[i].id;
  142. var name = data[i].name;
  143. source_node.append("<option value='" + pid + "'>" + name + "</option>");
  144. }
  145. var project_data = res.data.project;
  146. var project_node = $('#id_project');
  147. for (var i in project_data) {
  148. var pid1 = project_data[i].id;
  149. var name1 = project_data[i].name;
  150. project_node.append("<option value='" + pid1 + "'>" + name1 + "</option>");
  151. }
  152. form.render('select');
  153. }
  154. });
  155. table.render({
  156. elem: '#customer_log'
  157. , url: '/customer/stage_count/'
  158. , cols: [[
  159. {field: 'stage', title: '阶段', event: 'stage', width: 100}
  160. , {field: 'total_count', title: "总数", event: 'total', width: 80, sort: true}
  161. , {field: 'today_count', title: '今日', event: 'today', width: 80, sort: true}
  162. , {field: 'overdue_count', title: '逾期', event: 'overdue', width: 80, sort: true}
  163. ]]
  164. });
  165. //操作栏的模板字符串
  166. var templateToolbar = `<div class="layui-btn-group">
  167. <a class="layui-btn layui-btn-xs" lay-event="customer_search"
  168. >查看</a>
  169. <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="add_review"
  170. >跟踪报告</a>
  171. <a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="internal_trace"
  172. >内部跟踪</a>
  173. </div>`;
  174. //判断内部跟踪权限
  175. var permissions = layui.data(layui.setter.tableName)['permissions'];
  176. var is_has = permissions.indexOf('inner_review') !== -1;
  177. if (!is_has) {
  178. templateToolbar = `<div class="layui-btn-group">
  179. <a class="layui-btn layui-btn-xs" lay-event="customer_search"
  180. >查看</a>
  181. <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="add_review"
  182. >跟踪报告</a>
  183. </div>`;
  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: 100}
  197. , {field: 'stage_progress_text', title: '阶段进度', width: 100}
  198. , {field: 'potential_level_text', title: '客户级别', width: 100}
  199. , {field: 'status_text', title: '状态', width: 60}
  200. , {field: 'track_user_text', title: '跟踪人', width: 120}
  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: 'follow_count', title: '跟踪次数', width: 100}
  205. , {field: 'enter_count', title: '进店次数', width: 100}
  206. , {field: 'last_enter_time', title: '最后进店时间', width: 150}
  207. , {field: 'create_time_f', title: '建档时间', width: 150}
  208. , {field: 'create_user_text', title: '建档人', width: 100}
  209. , {field: 'notes', title: '备注', width: 200}
  210. , {width: is_has ? 220 : 160, align: 'center', fixed: 'right', toolbar: templateToolbar}
  211. ]]
  212. , page: true
  213. , height: 'full-108'
  214. });
  215. admin.req({
  216. url: '/account/store/tree/?id=' + 43
  217. , done: function (res) {
  218. tree.render({
  219. elem: '#text' //绑定元素
  220. ,onlyIconControl: true
  221. ,data: res.data
  222. //点击菜单时触发
  223. ,click: function(obj) {
  224. console.log(obj.data, "oppppppp")
  225. }
  226. });
  227. }
  228. });
  229. function createFollowReport(customer_id, stage_progress_sort) {
  230. layer.open({
  231. type: 2,
  232. title: '添加跟踪报告',
  233. area: ['45%', '70%'],
  234. btn: ['保存', '取消'],
  235. yes: function (index, dom) {
  236. layui.onSubmitChild = function (res) {
  237. if (res.code === 0) {
  238. layer.msg('添加成功!', {icon: 1})
  239. }
  240. layer.close(index);
  241. //刷新表格
  242. table.reload('customer_log', {});
  243. table.reload('customer_datagrid', {});
  244. };
  245. layui.submitChild();
  246. },
  247. btn2: function (index, layero) {
  248. layer.close(index);//关闭当前按钮
  249. },
  250. content: 'add_report.html?customer_id=' + customer_id + '&stage_progress_sort=' + stage_progress_sort
  251. });
  252. };
  253. //监听工具条
  254. table.on('tool(customer-operate)', function (obj) {
  255. var data = obj.data;
  256. if (obj.event === 'customer_search') {
  257. table.editdata = data;
  258. layer.open({
  259. skin: 'demo-class',
  260. type: 2,
  261. title: '查看客户详情',
  262. area: ['55%', '90%'],
  263. btn: ['跟踪报告', '更新进度', '取消'],
  264. yes: function (index, dom) {
  265. //添加跟踪报告
  266. createFollowReport(data.id, data.stage_progress_sort)
  267. },
  268. btn2: function (index, layero) {
  269. //更新进度
  270. layer.open({
  271. type: 2,
  272. title: '更新进度',
  273. area: ['45%', '70%'],
  274. btn: ['保存', '取消'],
  275. yes: function (index, dom) {
  276. layui.onSubmitChild = function (res) {
  277. if (res.code === 0) {
  278. layer.msg('更新成功!', {icon: 1})
  279. }
  280. layer.close(index);
  281. table.reload('customer_datagrid', {});
  282. };
  283. layui.submitChild();
  284. },
  285. btn2: function (index, layero) {
  286. layer.close(index);//关闭当前按钮
  287. },
  288. content: '../order/update_process.html?customer_id=' + data.id
  289. });
  290. },
  291. btn3: function (index, layero) {
  292. //取消
  293. layer.close(index);//关闭当前按钮
  294. },
  295. content: 'detail.html?customer=' + data.id
  296. });
  297. } else if (obj.event === 'add_review') {
  298. //添加跟踪报告
  299. createFollowReport(data.id, data.stage_progress_sort)
  300. }else if(obj.event === 'internal_trace'){
  301. layer.open({
  302. type: 2,
  303. title: '内部跟踪',
  304. area: ['35%', '50%'],
  305. btn: ['保存', '取消'],
  306. yes: function (index, dom) {
  307. layui.onSubmitChild = function (res) {
  308. if (res.code === 0) {
  309. layer.msg('添加成功!', {icon: 1})
  310. }
  311. layer.close(index);
  312. //刷新表格
  313. table.reload('customer_log', {});
  314. table.reload('customer_datagrid', {});
  315. };
  316. layui.submitChild();
  317. },
  318. btn2: function (index, layero) {
  319. layer.close(index);//关闭当前按钮
  320. },
  321. content: 'internal_trace.html?customer_id=' + data.id + '&stage_progress_sort=' + data.stage_progress_sort
  322. });
  323. }
  324. });
  325. // 点击表格触发
  326. table.on('tool(customer-operate-log)', function(obj){
  327. var data = obj.data;
  328. let tool_event = obj.event;
  329. let params = {};
  330. params['stage_progress'] = data.stage_id;
  331. if(tool_event === 'today'){
  332. params['today'] = 'today';
  333. }else if(tool_event === 'overdue'){
  334. params['overdue'] = 'overdue';
  335. };
  336. table.reload('customer_datagrid', {
  337. where: params
  338. , page: {curr: 1}
  339. });
  340. });
  341. var _params = {};
  342. form.on('submit(query-form-element)', function (data) {
  343. _params = data.field;
  344. table.reload('customer_datagrid', {
  345. where: data.field
  346. , page: {curr: 1}
  347. });
  348. layer.closeAll();
  349. return false
  350. });
  351. //导出列表
  352. $('#btn_list').on('click', function () {
  353. $.get({
  354. url: '/customer/new_customer/?export=true',
  355. dataType: 'json',
  356. data: _params,
  357. success: function (res) {
  358. if (res.code === 1) {
  359. layer.msg(res.msg);
  360. return;
  361. }
  362. table.exportFile('customer_datagrid', res,)
  363. }
  364. })
  365. });
  366. $('#customer_order').on('click', function () {
  367. layer.open({
  368. type: 2,
  369. title: '预约量房',
  370. area: ['45%', '65%'],
  371. btn: ['保存', '取消'],
  372. yes: function (index, dom) {
  373. layui.onSubmitChild = function (res) {
  374. if (res.code === 0) {
  375. layer.msg('添加成功!', {icon: 1})
  376. }
  377. layer.close(index);
  378. table.reload('customer_datagrid', {});
  379. };
  380. layui.submitChild();
  381. },
  382. btn2: function (index, layero) {
  383. layer.close(index);//关闭当前按钮
  384. },
  385. content: 'order.html'
  386. });
  387. });
  388. });
  389. </script>
  390. </body>
  391. </html>