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',], 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. //导出列表
  203. var _params1 = {};
  204. $('#btn_list').on('click', function () {
  205. $.get({
  206. url: '/order/?export=true',
  207. dataType: 'json',
  208. data: _params1,
  209. success: function (res) {
  210. if (res.code === 1) {
  211. layer.msg(res.msg);
  212. return;
  213. }
  214. table.exportFile('datagrid', res,)
  215. }
  216. })
  217. });
  218. //导出明细
  219. var _params2 = {};
  220. $('#btn_detail').on('click', function () {
  221. $.get({
  222. url: '/order/?export=true',
  223. dataType: 'json',
  224. data: _params2,
  225. success: function (res) {
  226. if (res.code === 1) {
  227. layer.msg(res.msg);
  228. return;
  229. }
  230. table.exportFile('datagrid', res,)
  231. }
  232. })
  233. });
  234. //监听工具条
  235. table.on('tool(customer-operate)', function (obj) {
  236. var data = obj.data;
  237. if (obj.event === 'customer_search') {
  238. table.editdata = data;
  239. layer.open({
  240. skin: 'demo-class',
  241. type: 2,
  242. title: '查看客户详情',
  243. area: ['45%', '90%'],
  244. btn: ['跟踪报告', '更新进度', '取消'],
  245. yes: function (index, dom) {
  246. //添加跟踪报告
  247. createFollowReport()
  248. },
  249. btn2: function (index, layero) {
  250. //更新进度
  251. layer.close(index);//关闭当前按钮
  252. },
  253. btn3: function (index, layero) {
  254. //取消
  255. layer.close(index);//关闭当前按钮
  256. },
  257. content: 'detail.html'
  258. });
  259. }
  260. });
  261. form.on('submit(query-form-element)', function (data) {
  262. table.reload('customer_datagrid', {
  263. where: data.field
  264. , page: {curr: 1}
  265. });
  266. layer.closeAll();
  267. return false
  268. });
  269. //添加跟踪报告
  270. $('#customer_add').on('click', function () {
  271. createFollowReport()
  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>