index.html 12 KB

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