index.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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="customer_order"><i
  69. class="layui-icon layui-icon-add-circle"></i>预约量房
  70. </button>
  71. <button class="layui-btn" id="btn_list"><i
  72. class="layui-icon layui-icon-download-circle"></i>导出
  73. </button>
  74. </div>
  75. <form class="layui-form" lay-filter="query-form-element">
  76. <div class="seach_items">
  77. <button class="layui-btn" lay-submit lay-filter="query-form-element"><i
  78. class="layui-icon layui-icon-search"></i>查询
  79. </button>
  80. </div>
  81. <div class="seach_items">
  82. <input type="text" name="tel" autocomplete="off" class="layui-input"
  83. placeholder="电话"/>
  84. </div>
  85. <div class="seach_items">
  86. <input type="text" name="name" autocomplete="off" class="layui-input"
  87. placeholder="姓名"/>
  88. </div>
  89. </form>
  90. <div style="clear: both;"></div>
  91. </div>
  92. <div class="tableContent">
  93. <div style="width: 375px">
  94. <table class="layui-hide" id="customer_log" lay-filter="customer-operate-log"></table>
  95. </div>
  96. <div style="width: calc(100% - 390px)">
  97. <table class="layui-hide" id="customer_datagrid" lay-filter="customer-operate"></table>
  98. </div>
  99. </div>
  100. <script type="text/html" id="customer-operate-bar">
  101. <div class="layui-btn-group">
  102. <a class="layui-btn layui-btn-xs" lay-event="customer_search"
  103. >查看</a>
  104. </div>
  105. <div class="layui-btn-group">
  106. <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="add_review"
  107. data-permission="customer.view_new_customer"
  108. >跟踪报告</a>
  109. </div>
  110. </script>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <script src="../../layuiadmin/layui/layui.js?t=1"></script>
  117. <script>
  118. layui.config({
  119. base: '../../../layuiadmin/' //静态资源所在路径
  120. }).extend({
  121. index: 'lib/index' //主入口模块
  122. }).use(['index', 'table', 'form',], function () {
  123. var $ = layui.$;
  124. var table = layui.table
  125. , form = layui.form
  126. , admin = layui.admin;
  127. table.render({
  128. elem: '#customer_log'
  129. , url: '/customer/stage_count/'
  130. , cols: [[
  131. {field: 'stage', title: '阶段', width: 100}
  132. , {field: 'total_count', title: "总人数", width: 90, sort: true}
  133. , {field: 'today_count', title: '今日', width: 90, sort: true}
  134. , {field: 'overdue_count', title: '逾期', width: 90, sort: true}
  135. ]]
  136. });
  137. table.render({
  138. elem: '#customer_datagrid'
  139. , url: '/customer/new_customer/'
  140. , title: '潜客跟踪'
  141. , cols: [[
  142. {field: 'name', title: '姓名', width: 110}
  143. , {field: 'gender_text', title: "性别", width: 70}
  144. , {field: 'tel', title: '电话', width: 130}
  145. , {field: 'village', title: '小区', width: 150}
  146. , {field: 'address', title: '地址', width: 200}
  147. , {field: 'source_text', title: '来源', width: 100}
  148. , {field: 'project_text', title: '项目', width: 100}
  149. , {field: 'stage_progress_text', title: '阶段进度', width: 100}
  150. , {field: 'potential_level_text', title: '客户级别', width: 100}
  151. , {field: 'status_text', title: '状态', width: 60}
  152. , {field: 'track_user_text', title: '跟踪人', width: 120}
  153. , {field: 'end_time_f', title: '最后跟踪时间', width: 150}
  154. , {field: 'last_review', title: '最后跟踪情况', width: 200}
  155. , {field: 'next_time_f', title: '下次跟踪时间', width: 120}
  156. , {field: 'follow_count', title: '跟踪次数', width: 100}
  157. , {field: 'enter_count', title: '进店次数', width: 100}
  158. , {field: 'last_enter_time', title: '最后进店时间', width: 150}
  159. , {field: 'create_time_f', title: '建档时间', width: 150}
  160. , {field: 'create_user_text', title: '建档人', width: 100}
  161. , {field: 'notes', title: '备注', width: 200}
  162. , {width: 170, align: 'center', fixed: 'right', toolbar: '#customer-operate-bar'}
  163. ]]
  164. , page: true
  165. , height: 'full-108'
  166. });
  167. function createFollowReport(customer_id, stage_progress_sort) {
  168. layer.open({
  169. type: 2,
  170. title: '添加跟踪报告',
  171. area: ['45%', '70%'],
  172. btn: ['保存', '取消'],
  173. yes: function (index, dom) {
  174. layui.onSubmitChild = function (res) {
  175. if (res.code === 0) {
  176. layer.msg('添加成功!', {icon: 1})
  177. }
  178. layer.close(index);
  179. table.reload('customer_datagrid', {});
  180. };
  181. layui.submitChild();
  182. },
  183. btn2: function (index, layero) {
  184. layer.close(index);//关闭当前按钮
  185. },
  186. content: 'add_report.html?customer_id=' + customer_id + '&stage_progress_sort=' + stage_progress_sort
  187. });
  188. };
  189. //监听工具条
  190. table.on('tool(customer-operate)', function (obj) {
  191. var data = obj.data;
  192. if (obj.event === 'customer_search') {
  193. table.editdata = data;
  194. layer.open({
  195. skin: 'demo-class',
  196. type: 2,
  197. title: '查看客户详情',
  198. area: ['45%', '90%'],
  199. btn: ['跟踪报告', '更新进度', '取消'],
  200. yes: function (index, dom) {
  201. //添加跟踪报告
  202. createFollowReport(data.id, data.stage_progress_sort)
  203. },
  204. btn2: function (index, layero) {
  205. //更新进度
  206. layer.close(index);//关闭当前按钮
  207. },
  208. btn3: function (index, layero) {
  209. //取消
  210. layer.close(index);//关闭当前按钮
  211. },
  212. content: 'detail.html?customer=' + data.id
  213. });
  214. } else if (obj.event === 'add_review') {
  215. //添加跟踪报告
  216. createFollowReport(data.id, data.stage_progress_sort)
  217. }
  218. });
  219. table.on('row(customer-operate-log)', function (obj) {
  220. var data = obj.data;
  221. table.reload('customer_datagrid', {
  222. where: {stage_progress: data.stage_id}
  223. , page: {curr: 1}
  224. });
  225. //标注选中样式
  226. obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
  227. });
  228. var _params = {};
  229. form.on('submit(query-form-element)', function (data) {
  230. _params = data.field;
  231. table.reload('customer_datagrid', {
  232. where: data.field
  233. , page: {curr: 1}
  234. });
  235. layer.closeAll();
  236. return false
  237. });
  238. //导出列表
  239. $('#btn_list').on('click', function () {
  240. $.get({
  241. url: '/customer/new_customer/?export=true',
  242. dataType: 'json',
  243. data: _params,
  244. success: function (res) {
  245. if (res.code === 1) {
  246. layer.msg(res.msg);
  247. return;
  248. }
  249. table.exportFile('customer_datagrid', res,)
  250. }
  251. })
  252. });
  253. $('#customer_order').on('click', function () {
  254. layer.open({
  255. type: 2,
  256. title: '预约量房',
  257. area: ['45%', '65%'],
  258. btn: ['保存', '取消'],
  259. yes: function (index, dom) {
  260. layui.onSubmitChild = function (res) {
  261. if (res.code === 0) {
  262. layer.msg('添加成功!', {icon: 1})
  263. }
  264. layer.close(index);
  265. table.reload('customer_datagrid', {});
  266. };
  267. layui.submitChild();
  268. },
  269. btn2: function (index, layero) {
  270. layer.close(index);//关闭当前按钮
  271. },
  272. content: 'order.html'
  273. });
  274. });
  275. });
  276. </script>
  277. </body>
  278. </html>