index.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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',], function () {
  127. var $ = layui.$;
  128. var table = layui.table
  129. , form = layui.form
  130. , admin = layui.admin;
  131. table.render({
  132. elem: '#customer_log'
  133. , url: '/api/customer.json'
  134. , cols: [[
  135. {field: 'stage', title: '阶段', width: 100}
  136. , {field: 'total_count', title: "总人数", width: 100, sort: true}
  137. , {field: 'today_count', title: '今日', width: 100, sort: true}
  138. , {field: 'exceed_count', title: '逾期', width: 100, sort: true}
  139. ]]
  140. });
  141. table.render({
  142. elem: '#customer_datagrid'
  143. , url: '/api/dataTable.json'
  144. , cols: [[
  145. {field: 'name', title: '姓名', width: 110}
  146. , {field: 'gender_text', title: "性别", width: 70}
  147. , {field: 'tel', title: '电话', width: 120}
  148. , {field: 'village', title: '小区', width: 150}
  149. , {field: 'address', title: '地址', width: 200}
  150. , {field: 'source_text', title: '来源', width: 100}
  151. , {field: 'notes', title: '备注', width: 200}
  152. , {field: 'follow_user', title: '跟踪人', width: 100}
  153. , {field: 'last_follow', title: '最后跟踪', width: 150}
  154. , {field: 'follow_status', title: '跟踪情况', width: 200}
  155. , {field: 'follow_count', title: '跟踪次数', width: 100}
  156. , {field: 'enter_count', title: '进店次数', width: 100}
  157. , {field: 'last_enter', title: '最后进店时间', width: 150}
  158. , {field: 'rank', title: '级别', width: 100}
  159. , {field: 'status', title: '状态', width: 100}
  160. , {field: 'create_time', title: '建档时间', width: 150}
  161. , {field: 'create_user', title: '建档人', width: 150}
  162. , {width: 80, align: 'center', fixed: 'right', toolbar: '#customer-operate-bar'}
  163. ]]
  164. , page: true
  165. , height: 'full-108'
  166. });
  167. function createFollowReport(){
  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'
  187. });
  188. };
  189. admin.req({
  190. url: '/customer/dict/',
  191. done: function (res) {
  192. var data = res.data.source;
  193. var source_node = $('#id_source');
  194. for (var i in data) {
  195. var pid = data[i].id;
  196. var name = data[i].name;
  197. source_node.append("<option value='" + pid + "'>" + name + "</option>");
  198. }
  199. form.render('select');
  200. }
  201. });
  202. $('#btn_download').on('click', function () {
  203. layui.view.download("/static/xls/设备信息导入模板.xlsx");
  204. });
  205. //导出列表
  206. var _params1 = {};
  207. $('#btn_list').on('click', function () {
  208. $.get({
  209. url: '/order/?export=true',
  210. dataType: 'json',
  211. data: _params1,
  212. success: function (res) {
  213. if (res.code === 1) {
  214. layer.msg(res.msg);
  215. return;
  216. }
  217. table.exportFile('datagrid', res,)
  218. }
  219. })
  220. });
  221. //导出明细
  222. var _params2 = {};
  223. $('#btn_detail').on('click', function () {
  224. $.get({
  225. url: '/order/?export=true',
  226. dataType: 'json',
  227. data: _params2,
  228. success: function (res) {
  229. if (res.code === 1) {
  230. layer.msg(res.msg);
  231. return;
  232. }
  233. table.exportFile('datagrid', res,)
  234. }
  235. })
  236. });
  237. //监听工具条
  238. table.on('tool(customer-operate)', function (obj) {
  239. var data = obj.data;
  240. if (obj.event === 'customer_search') {
  241. table.editdata = data;
  242. layer.open({
  243. skin: 'demo-class',
  244. type: 2,
  245. title: '查看客户详情',
  246. area: ['45%', '90%'],
  247. btn: ['跟踪报告', '更新进度', '取消'],
  248. yes: function (index, dom) {
  249. //添加跟踪报告
  250. createFollowReport()
  251. },
  252. btn2: function (index, layero) {
  253. //更新进度
  254. layer.close(index);//关闭当前按钮
  255. },
  256. btn3: function (index, layero) {
  257. //取消
  258. layer.close(index);//关闭当前按钮
  259. },
  260. content: 'detail.html'
  261. });
  262. }
  263. });
  264. form.on('submit(query-form-element)', function (data) {
  265. table.reload('customer_datagrid', {
  266. where: data.field
  267. , page: {curr: 1}
  268. });
  269. layer.closeAll();
  270. return false
  271. });
  272. //添加跟踪报告
  273. $('#customer_add').on('click', function () {
  274. createFollowReport()
  275. });
  276. $('#customer_order').on('click', function () {
  277. layer.open({
  278. type: 2,
  279. title: '预约量房',
  280. area: ['45%', '65%'],
  281. btn: ['保存', '取消'],
  282. yes: function (index, dom) {
  283. layui.onSubmitChild = function (res) {
  284. if(res.code === 0){
  285. layer.msg('添加成功!', {icon: 1})
  286. }
  287. layer.close(index);
  288. table.reload('customer_datagrid', {});
  289. };
  290. layui.submitChild();
  291. },
  292. btn2: function (index, layero) {
  293. layer.close(index);//关闭当前按钮
  294. },
  295. content: 'order.html'
  296. });
  297. });
  298. });
  299. </script>
  300. </body>
  301. </html>