index.html 16 KB

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