index.html 11 KB

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