source.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. {extend name="public/layout" /} {block name="title"}来源渠道报表{/block} {block
  2. name="body"}
  3. <link rel="stylesheet" href="__LAYUI__/layui/css/layui.css" media="all" />
  4. <link rel="stylesheet" href=" /static/css/common.css" />
  5. <script src="/static/js/jquery.min.js"></script>
  6. <script src="/static/layui/layui/lay/modules/xm-select.js"></script>
  7. <style>
  8. .cardheader {
  9. padding-left: 10px;
  10. }
  11. .layui-table thead tr,
  12. .layui-table-header {
  13. background-color: #f2f2f2 !important;
  14. }
  15. .layui-search {
  16. width: 100%;
  17. padding: 10px 0px 0px;
  18. height: 50px;
  19. }
  20. .layui-search-box {
  21. float: right;
  22. }
  23. #source {
  24. width: 300px;
  25. }
  26. .layui-table-box a {
  27. color: #249efb;
  28. }
  29. #select-org {
  30. display: inline-block;
  31. }
  32. </style>
  33. <body>
  34. <div class="layui-card">
  35. <div class="layui-card-body">
  36. <div class="layui-search">
  37. <div class="layui-form layui-search-box" lay-filter="search">
  38. <div id="select-org">
  39. </div>
  40. <div class="layui-inline" id="source"></div>
  41. <div class="layui-inline">
  42. <div class="layui-input-inline select-date">
  43. <input style="width: 180px" type="text" name="date" id="select_date" placeholder="开始时间 - 结束时间"
  44. autocomplete="off" class="layui-input" />
  45. </div>
  46. </div>
  47. <div class="layui-inline">
  48. <button class="layui-btn layuiadmin-btn-course searchBtn submitbtn" lay-submit
  49. lay-filter="LAY-user-front-search">
  50. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  51. </button>
  52. </div>
  53. </div>
  54. </div>
  55. <table id="operater" lay-filter="operater" style="margin-top: 15px"></table>
  56. </div>
  57. </div>
  58. {/block} {block name="js"}
  59. <script>
  60. layui
  61. .config({
  62. base: "__LAYUI__/",
  63. urlbase: "/sys",
  64. })
  65. .extend({
  66. index: "lib/index", //主入口模块
  67. })
  68. .use(["index", "table", "laydate"], function () {
  69. var $ = layui.$,
  70. table = layui.table,
  71. form = layui.form,
  72. laydate = layui.laydate;
  73. var org = JSON.parse('{:json_encode($org)}');
  74. var select_org = '';
  75. //日期范围
  76. laydate.render({
  77. elem: "#select_date",
  78. range: true,
  79. });
  80. //监听搜索
  81. form.on("submit(LAY-user-front-search)", function (data) {
  82. let field = data.field;
  83. //执行重载
  84. table.reload('operater', {
  85. where: { org_id: select_org, date: field.date, source: field.source }
  86. });
  87. });
  88. document.onkeydown = function (event) {
  89. var e = event || window.event || arguments.callee.caller.arguments[0];
  90. if (e && e.keyCode == 13) {
  91. $(".submitbtn").trigger("click");
  92. }
  93. };
  94. table.render({
  95. elem: "#operater",
  96. url: '{:url("statistics2/source")}',
  97. page: false,
  98. height: "full-120",
  99. cols: [
  100. [
  101. {
  102. field: "source",
  103. title: "渠道名称",
  104. templet: function (d) {
  105. if (d.detail == 1) {
  106. return '<a href="javascript:void(0)" data-id="' + d.id + '" class="source-detail">' + d.source + '<a>';
  107. }
  108. return d.source;
  109. }
  110. },
  111. {
  112. field: "money",
  113. title: "推广消费",
  114. },
  115. {
  116. field: "clue",
  117. title: "线索量",
  118. },
  119. {
  120. field: "clue_money",
  121. title: "线索单价",
  122. },
  123. {
  124. field: "valid",
  125. title: "有效线索",
  126. },
  127. {
  128. field: "valid_money",
  129. title: "有效单价",
  130. },
  131. {
  132. field: "valid_percen",
  133. title: "有效率",
  134. },
  135. {
  136. field: "meet",
  137. title: "见面量",
  138. },
  139. {
  140. field: "meet_percen",
  141. title: "见面率",
  142. },
  143. {
  144. field: "grant",
  145. title: "毛线索见面率",
  146. },
  147. {
  148. field: "meet_money",
  149. title: "见面单价",
  150. },
  151. {
  152. field: "deposit",
  153. title: "定金量",
  154. },
  155. {
  156. field: "deposit_percen",
  157. title: "成单率",
  158. },
  159. {
  160. field: "sign",
  161. title: "合同量",
  162. },
  163. {
  164. field: "sign_money",
  165. title: "业绩总额",
  166. },
  167. {
  168. field: "sign_agv_money",
  169. title: "均单值",
  170. },
  171. {
  172. field: "ROI",
  173. title: "ROI",
  174. },
  175. ],
  176. ],
  177. text: "对不起,加载出现异常!",
  178. });
  179. $(".layui-btn.layuiadmin-btn-admin").on("click", function () {
  180. var type = $(this).data("type");
  181. active[type] ? active[type].call(this) : "";
  182. });
  183. $('.layui-card-body').on('click', '.table-detail', function () {
  184. let url = $(this).data('href');
  185. layer.open({
  186. title: '有效线索详情',
  187. type: 2,
  188. content: url,
  189. area: ['860px', '400px'],
  190. shade: 0.3
  191. });
  192. })
  193. $('.layui-card').on('click', '.source-detail', function () {
  194. var id = $(this).data('id');
  195. var title = $(this).html();
  196. var data = form.val("search");
  197. var url = '{:url("statistics2/sourceDetail")}?id=' + id + '&date=' + data.date
  198. layer.open({
  199. title: title + '详情',
  200. type: 2,
  201. content: url,
  202. area: ['1200px', '500px']
  203. });
  204. })
  205. var orgInit = function (n, xin = false) {
  206. var html = '<div class="layui-inline"><select class="select-org">';
  207. html += '<option value="">部门</option>';
  208. let h = 0;
  209. for (i in org) {
  210. if (n == 0) n = org[i]['pid'];
  211. if (n != org[i]['pid']) continue;
  212. html += '<option value="' + org[i]['id'] + '">' + org[i]['name'] + '</option>';
  213. h++;
  214. }
  215. html += '</select></div>';
  216. if (h == 0) return;
  217. if (xin) return html;
  218. $('#select-org').html(html);
  219. form.render('select');
  220. }
  221. orgInit(0);
  222. form.on('select', function (data) {
  223. if (data.value == '') {
  224. select_org = '';
  225. return;
  226. }
  227. select_org = data.value
  228. let next = orgInit(data.value, true);
  229. let parent = $(data.elem).closest('.layui-inline');
  230. parent.nextAll().remove();
  231. $('#select-org').append(next);
  232. form.render('select');
  233. });
  234. });
  235. </script>
  236. <script>
  237. xmSelect.render({
  238. el: '#source',
  239. language: 'zn',
  240. tips: '渠道',
  241. name: 'source',
  242. data: JSON.parse('{:json_encode($source)}')
  243. })
  244. </script>
  245. {/block}
  246. </body>