index.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. </style>
  59. </head>
  60. <body>
  61. <div class="layui-fluid">
  62. <div class="layui-card">
  63. <div class="layui-card-body" pad15>
  64. <div class="layui-row layui-col-space15">
  65. <div class="layui-col-md12">
  66. <div class="LAY-btns" style="margin-bottom: 10px;">
  67. <div style="float: left">
  68. <button class="layui-btn" id="btn_list"><i
  69. class="layui-icon layui-icon-download-circle"></i>导出
  70. </button>
  71. </div>
  72. <form class="layui-form" lay-filter="query-form-element">
  73. <div class="seach_items">
  74. <button class="layui-btn" lay-submit lay-filter="query-form-element"><i
  75. class="layui-icon layui-icon-search"></i>查询
  76. </button>
  77. </div>
  78. <div class="seach_items">
  79. <input type="text" name="tel" autocomplete="off" class="layui-input"
  80. placeholder="电话"/>
  81. </div>
  82. <div class="seach_items">
  83. <input type="text" name="name" autocomplete="off" class="layui-input"
  84. placeholder="姓名"/>
  85. </div>
  86. <div class="seach_items">
  87. <select name="source" id="id_source" style="width: 40px;">
  88. <option value="">请选择来源</option>
  89. </select>
  90. </div>
  91. <div class="seach_items">
  92. <select name="project" id="id_project" style="width: 40px;">
  93. <option value="">请选择项目</option>
  94. </select>
  95. </div>
  96. </form>
  97. <div style="clear: both;"></div>
  98. </div>
  99. <div class="tableContent">
  100. <div style="width: 345px">
  101. <table class="layui-hide" id="customer_log" lay-filter="customer-operate-log"></table>
  102. </div>
  103. <div style="width: calc(100% - 360px)">
  104. <table class="layui-hide" id="customer_datagrid" lay-filter="customer-operate"></table>
  105. </div>
  106. </div>
  107. <script type="text/html" id="customer-operate-bar">
  108. <div class="layui-btn-group">
  109. <a class="layui-btn layui-btn-xs" lay-event="customer_search"
  110. >查看</a>
  111. </div>
  112. <div class="layui-btn-group">
  113. <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="add_review"
  114. data-permission="customer.view_new_customer"
  115. >跟踪报告</a>
  116. </div>
  117. </script>
  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',], function () {
  130. var $ = layui.$;
  131. var table = layui.table
  132. , form = layui.form
  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. table.render({
  165. elem: '#customer_datagrid'
  166. , url: '/customer/new_customer/'
  167. , title: '潜客跟踪'
  168. , cols: [[
  169. {field: 'name', title: '姓名', width: 110}
  170. , {field: 'gender_text', title: "性别", width: 70}
  171. , {field: 'tel', title: '电话', width: 130}
  172. , {field: 'village', title: '小区', width: 150}
  173. , {field: 'address', title: '地址', width: 200}
  174. , {field: 'source_text', title: '来源', width: 100}
  175. , {field: 'project_text', title: '项目', width: 100}
  176. , {field: 'stage_progress_text', title: '阶段进度', width: 100}
  177. , {field: 'potential_level_text', title: '客户级别', width: 100}
  178. , {field: 'status_text', title: '状态', width: 60}
  179. , {field: 'track_user_text', title: '跟踪人', width: 120}
  180. , {field: 'end_time_f', title: '最后跟踪时间', width: 150}
  181. , {field: 'last_review', title: '最后跟踪情况', width: 200}
  182. , {field: 'next_time_f', title: '下次跟踪时间', width: 120}
  183. , {field: 'follow_count', title: '跟踪次数', width: 100}
  184. , {field: 'enter_count', title: '进店次数', width: 100}
  185. , {field: 'last_enter_time', title: '最后进店时间', width: 150}
  186. , {field: 'create_time_f', title: '建档时间', width: 150}
  187. , {field: 'create_user_text', title: '建档人', width: 100}
  188. , {field: 'notes', title: '备注', width: 200}
  189. , {width: 140, align: 'center', fixed: 'right', toolbar: '#customer-operate-bar'}
  190. ]]
  191. , page: true
  192. , height: 'full-108'
  193. });
  194. function createFollowReport(customer_id, stage_progress_sort) {
  195. layer.open({
  196. type: 2,
  197. title: '添加跟踪报告',
  198. area: ['45%', '70%'],
  199. btn: ['保存', '取消'],
  200. yes: function (index, dom) {
  201. layui.onSubmitChild = function (res) {
  202. if (res.code === 0) {
  203. layer.msg('添加成功!', {icon: 1})
  204. }
  205. layer.close(index);
  206. //刷新表格
  207. table.reload('customer_log', {});
  208. table.reload('customer_datagrid', {});
  209. };
  210. layui.submitChild();
  211. },
  212. btn2: function (index, layero) {
  213. layer.close(index);//关闭当前按钮
  214. },
  215. content: 'add_report.html?customer_id=' + customer_id + '&stage_progress_sort=' + stage_progress_sort
  216. });
  217. };
  218. //监听工具条
  219. table.on('tool(customer-operate)', function (obj) {
  220. var data = obj.data;
  221. if (obj.event === 'customer_search') {
  222. table.editdata = data;
  223. layer.open({
  224. skin: 'demo-class',
  225. type: 2,
  226. title: '查看客户详情',
  227. area: ['55%', '90%'],
  228. btn: ['跟踪报告', '更新进度', '取消'],
  229. yes: function (index, dom) {
  230. //添加跟踪报告
  231. createFollowReport(data.id, data.stage_progress_sort)
  232. },
  233. btn2: function (index, layero) {
  234. //更新进度
  235. layer.open({
  236. type: 2,
  237. title: '更新进度',
  238. area: ['45%', '70%'],
  239. btn: ['保存', '取消'],
  240. yes: function (index, dom) {
  241. layui.onSubmitChild = function (res) {
  242. if (res.code === 0) {
  243. layer.msg('更新成功!', {icon: 1})
  244. }
  245. layer.close(index);
  246. table.reload('customer_datagrid', {});
  247. };
  248. layui.submitChild();
  249. },
  250. btn2: function (index, layero) {
  251. layer.close(index);//关闭当前按钮
  252. },
  253. content: '../order/update_process.html?customer_id=' + data.id
  254. });
  255. },
  256. btn3: function (index, layero) {
  257. //取消
  258. layer.close(index);//关闭当前按钮
  259. },
  260. content: 'detail.html?customer=' + data.id
  261. });
  262. } else if (obj.event === 'add_review') {
  263. //添加跟踪报告
  264. createFollowReport(data.id, data.stage_progress_sort)
  265. }
  266. });
  267. table.on('row(customer-operate-log)', function (obj) {
  268. var data = obj.data;
  269. table.reload('customer_datagrid', {
  270. where: {stage_progress: data.stage_id}
  271. , page: {curr: 1}
  272. });
  273. //标注选中样式
  274. obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
  275. });
  276. var _params = {};
  277. form.on('submit(query-form-element)', function (data) {
  278. _params = data.field;
  279. table.reload('customer_datagrid', {
  280. where: data.field
  281. , page: {curr: 1}
  282. });
  283. layer.closeAll();
  284. return false
  285. });
  286. //导出列表
  287. $('#btn_list').on('click', function () {
  288. $.get({
  289. url: '/customer/new_customer/?export=true',
  290. dataType: 'json',
  291. data: _params,
  292. success: function (res) {
  293. if (res.code === 1) {
  294. layer.msg(res.msg);
  295. return;
  296. }
  297. table.exportFile('customer_datagrid', res,)
  298. }
  299. })
  300. });
  301. $('#customer_order').on('click', function () {
  302. layer.open({
  303. type: 2,
  304. title: '预约量房',
  305. area: ['45%', '65%'],
  306. btn: ['保存', '取消'],
  307. yes: function (index, dom) {
  308. layui.onSubmitChild = function (res) {
  309. if (res.code === 0) {
  310. layer.msg('添加成功!', {icon: 1})
  311. }
  312. layer.close(index);
  313. table.reload('customer_datagrid', {});
  314. };
  315. layui.submitChild();
  316. },
  317. btn2: function (index, layero) {
  318. layer.close(index);//关闭当前按钮
  319. },
  320. content: 'order.html'
  321. });
  322. });
  323. });
  324. </script>
  325. </body>
  326. </html>