index.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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_add"><i
  69. class="layui-icon layui-icon-add-circle"></i>跟踪报告
  70. </button>
  71. <button class="layui-btn" id="customer_order"><i
  72. class="layui-icon layui-icon-add-circle"></i>预约量房
  73. </button>
  74. <button class="layui-nav">
  75. <div class="layui-nav-item">
  76. <a href="javascript:;" style="color:#fff;">导出</a>
  77. <dl class="layui-nav-child">
  78. <dd><a href="#" id="btn_list">列表</a></dd>
  79. <dd><a href="#" id="btn_detail">明细</a></dd>
  80. </dl>
  81. </div>
  82. </button>
  83. </div>
  84. <form class="layui-form" lay-filter="query-form-element">
  85. <div class="seach_items">
  86. <button class="layui-btn" lay-submit lay-filter="query-form-element"><i
  87. class="layui-icon layui-icon-search"></i>查询
  88. </button>
  89. </div>
  90. <div class="seach_items">
  91. <input type="text" name="tel" autocomplete="off" class="layui-input"
  92. placeholder="电话"/>
  93. </div>
  94. <div class="seach_items">
  95. <input type="text" name="name" autocomplete="off" class="layui-input"
  96. placeholder="姓名"/>
  97. </div>
  98. </form>
  99. <div style="clear: both;"></div>
  100. </div>
  101. <div class="tableContent">
  102. <div style="width: 405px">
  103. <table class="layui-hide" id="customer_log" lay-filter="customer-operate-log"></table>
  104. </div>
  105. <div style="width: calc(100% - 450px)">
  106. <table class="layui-hide" id="customer_datagrid" lay-filter="customer-operate"></table>
  107. </div>
  108. </div>
  109. <script type="text/html" id="customer-operate-bar">
  110. <div class="layui-btn-group">
  111. <a class="layui-btn layui-btn-xs" lay-event="customer_search"
  112. >查看</a>
  113. </div>
  114. </script>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <script src="../../layuiadmin/layui/layui.js?t=1"></script>
  121. <script>
  122. layui.config({
  123. base: '../../../layuiadmin/' //静态资源所在路径
  124. }).extend({
  125. index: 'lib/index' //主入口模块
  126. }).use(['index', 'table', 'form', 'upload'], function () {
  127. var $ = layui.$;
  128. var table = layui.table
  129. , form = layui.form
  130. , upload = layui.upload
  131. , admin = layui.admin;
  132. table.render({
  133. elem: '#customer_log'
  134. , url: '/api/customer.json'
  135. , cols: [[
  136. {field: 'stage', title: '阶段', width: 100}
  137. , {field: 'total_count', title: "总人数", width: 100, sort: true}
  138. , {field: 'today_count', title: '今日', width: 100, sort: true}
  139. , {field: 'exceed_count', title: '逾期', width: 100, sort: true}
  140. ]]
  141. });
  142. table.render({
  143. elem: '#customer_datagrid'
  144. , url: '/api/dataTable.json'
  145. , cols: [[
  146. {field: 'name', title: '姓名', width: 110}
  147. , {field: 'gender_text', title: "性别", width: 70}
  148. , {field: 'tel', title: '电话', width: 120}
  149. , {field: 'village', title: '小区', width: 150}
  150. , {field: 'address', title: '地址', width: 200}
  151. , {field: 'source_text', title: '来源', width: 100}
  152. , {field: 'notes', title: '备注', width: 200}
  153. , {field: 'follow_user', title: '跟踪人', width: 100}
  154. , {field: 'last_follow', title: '最后跟踪', width: 150}
  155. , {field: 'follow_status', title: '跟踪情况', width: 200}
  156. , {field: 'follow_count', title: '跟踪次数', width: 100}
  157. , {field: 'enter_count', title: '进店次数', width: 100}
  158. , {field: 'last_enter', title: '最后进店时间', width: 150}
  159. , {field: 'rank', title: '级别', width: 100}
  160. , {field: 'status', title: '状态', width: 100}
  161. , {field: 'create_time', title: '建档时间', width: 150}
  162. , {field: 'create_user', title: '建档人', width: 150}
  163. , {width: 80, align: 'center', fixed: 'right', toolbar: '#customer-operate-bar'}
  164. ]]
  165. , page: true
  166. , height: 'full-108'
  167. });
  168. admin.req({
  169. url: '/customer/dict/',
  170. done: function (res) {
  171. var data = res.data.source;
  172. var source_node = $('#id_source');
  173. for (var i in data) {
  174. var pid = data[i].id;
  175. var name = data[i].name;
  176. source_node.append("<option value='" + pid + "'>" + name + "</option>");
  177. }
  178. form.render('select');
  179. }
  180. });
  181. $('#btn_download').on('click', function () {
  182. layui.view.download("/static/xls/设备信息导入模板.xlsx");
  183. });
  184. //导出列表
  185. var _params1 = {};
  186. $('#btn_list').on('click', function () {
  187. $.get({
  188. url: '/order/?export=true',
  189. dataType: 'json',
  190. data: _params1,
  191. success: function (res) {
  192. if (res.code === 1) {
  193. layer.msg(res.msg);
  194. return;
  195. }
  196. table.exportFile('datagrid', res,)
  197. }
  198. })
  199. });
  200. //导出明细
  201. var _params2 = {};
  202. $('#btn_detail').on('click', function () {
  203. $.get({
  204. url: '/order/?export=true',
  205. dataType: 'json',
  206. data: _params2,
  207. success: function (res) {
  208. if (res.code === 1) {
  209. layer.msg(res.msg);
  210. return;
  211. }
  212. table.exportFile('datagrid', res,)
  213. }
  214. })
  215. });
  216. //监听工具条
  217. table.on('tool(customer-operate)', function (obj) {
  218. var data = obj.data;
  219. if (obj.event === 'customer_search') {
  220. table.editdata = data;
  221. layer.open({
  222. skin: 'demo-class',
  223. type: 2,
  224. title: '查看客户详情',
  225. area: ['45%', '90%'],
  226. btn: ['跟踪报告', '更新进度', '取消'],
  227. yes: function (index, dom) {
  228. //跟踪报告
  229. layer.close(index);
  230. },
  231. btn2: function (index, layero) {
  232. //更新进度
  233. layer.close(index);//关闭当前按钮
  234. },
  235. btn3: function (index, layero) {
  236. //取消
  237. layer.close(index);//关闭当前按钮
  238. },
  239. content: 'detail.html'
  240. });
  241. }
  242. });
  243. form.on('submit(query-form-element)', function (data) {
  244. table.reload('customer_datagrid', {
  245. where: data.field
  246. , page: {curr: 1}
  247. });
  248. layer.closeAll();
  249. return false
  250. });
  251. $('#customer_add').on('click', function () {
  252. layer.open({
  253. type: 2,
  254. title: '添加跟踪报告',
  255. area: ['45%', '70%'],
  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: 'add_report.html'
  271. });
  272. });
  273. $('#customer_order').on('click', function () {
  274. layer.open({
  275. type: 2,
  276. title: '预约量房',
  277. area: ['45%', '65%'],
  278. btn: ['保存', '取消'],
  279. yes: function (index, dom) {
  280. layui.onSubmitChild = function (res) {
  281. if(res.code === 0){
  282. layer.msg('添加成功!', {icon: 1})
  283. }
  284. layer.close(index);
  285. table.reload('customer_datagrid', {});
  286. };
  287. layui.submitChild();
  288. },
  289. btn2: function (index, layero) {
  290. layer.close(index);//关闭当前按钮
  291. },
  292. content: 'order.html'
  293. });
  294. });
  295. });
  296. </script>
  297. </body>
  298. </html>