index.html 11 KB

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