index.html 12 KB

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