source_data.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. {extend name="public/layout" /}
  2. {block name="title"}客户来源渠道统计{/block}
  3. {block name="head"}
  4. {include file="public/head"}
  5. <style>
  6. .layui-table th:last-child {
  7. border-right: none;
  8. }
  9. .layui-table-view .layui-table {
  10. /* width:100% */
  11. }
  12. .layui-table thead tr,
  13. .layui-table-header {
  14. background-color: #D8E6F1 !important;
  15. }
  16. .line-middle {
  17. width: 10px;
  18. height: 100%;
  19. margin: 0px 10px;
  20. }
  21. .line {
  22. width: 10px;
  23. height: 2px;
  24. background-color: #999999;
  25. }
  26. .flex-row {
  27. display: flex;
  28. align-items: center;
  29. }
  30. .mb0 {
  31. margin-bottom: 0px;
  32. }
  33. .row {
  34. display: flex;
  35. }
  36. .layui-btn {
  37. background-color: #fff;
  38. color: #555;
  39. border: 1px solid #c9c9c9
  40. }
  41. .layui-btn:hover {
  42. background-color: #fff;
  43. color: #555;
  44. border: 1px solid #249efb;
  45. }
  46. .layui-btn-primary,.sBtn {
  47. background-color: #249efb;
  48. color: #fff;
  49. border: 1px solid #249efb;
  50. }
  51. .layui-btn-primary:hover {
  52. background-color: #249efb;
  53. color: #fff;
  54. border: 1px solid #249efb;
  55. }
  56. .sBtn:hover {
  57. background-color: #249efb;
  58. color: #fff;
  59. border: 1px solid #249efb;
  60. }
  61. .ml10 {
  62. margin-left: 10px;
  63. }
  64. .justify-between {
  65. justify-content: space-between;
  66. }
  67. .ptlr {
  68. padding: 20px 20px 0px;
  69. }
  70. </style>
  71. {/block}
  72. {block name="body"}
  73. <div class="layui-fluid">
  74. <div class="layui-card">
  75. <div class="search-form layui-form flex-row justify-between ptlr">
  76. <div class="flex-row">
  77. <div class="layui-form-item mb0">
  78. <div class="layui-input-block" style="margin: 0px;">
  79. <select name="channel">
  80. <option value="">全部来源渠道</option>
  81. <option value="0">郑州</option>
  82. <option value="1">上海</option>
  83. <option value="2">广州</option>
  84. <option value="3">深圳</option>
  85. <option value="4">杭州</option>
  86. </select>
  87. </div>
  88. </div>
  89. <div class="layui-inline row ml10" id="timeBtn">
  90. <input type="button" class="layui-btn" value="今日"/>
  91. <input type="button" class="layui-btn" value="3天"/>
  92. <input type="button" class="layui-btn" value="7天"/>
  93. <input type="button" class="layui-btn" value="1个月"/>
  94. </div>
  95. <div class="layui-inline ml10"> <!-- 注意:这一层元素并不是必须的 -->
  96. <input type="text" class="layui-input" id="sDate" name="start_date" placeholder="选择开始日期">
  97. </div>
  98. <div class="line-middle">
  99. <div class="line"></div>
  100. </div>
  101. <div class="layui-inline"> <!-- 注意:这一层元素并不是必须的 -->
  102. <input type="text" class="layui-input" id="eDate" name="end_date" placeholder="选择结束日期">
  103. </div>
  104. </div>
  105. <div>
  106. <button class="layui-btn sBtn ml10" lay-submit lay-filter="table-search">筛选</button>
  107. </div>
  108. </div>
  109. <div class="layui-card-body">
  110. <table lay-filter="datalist" id="list"></table>
  111. </div>
  112. </div>
  113. </div>
  114. {/block}
  115. {block name="js"}
  116. <script>
  117. layui.use(['table', 'form','laydate'], function () {
  118. let table = layui.table,
  119. form = layui.form,
  120. laydate = layui.laydate,
  121. $ = layui.$;
  122. $('body').attr('layadmin-themealias', 'default');
  123. //执行一个laydate实例
  124. laydate.render({
  125. elem: '#sDate' //指定元素
  126. });
  127. laydate.render({
  128. elem: '#eDate' //指定元素
  129. });
  130. let cols1 = [[
  131. { field: 'id', title: '部门名称',width: 100, align: 'center', 'fixed': true },
  132. { field: 'id', title: '人效',width: 80, align: 'center' },
  133. { field: 'id', title: '待确认',width: 90, align: 'center' },
  134. { field: 'id', title: '量房数',width: 90, align: 'center' },
  135. { field: 'id', title: '到店数',width: 90, align: 'center' },
  136. { field: 'id', title: '见面数',width: 90, align: 'center' },
  137. { field: 'id', title: '见面率',width: 90, align: 'center' },
  138. { field: 'id', title: '订金数',width: 90, align: 'center' },
  139. { field: 'id', title: '收定率',width: 90, align: 'center' },
  140. { field: 'id', title: '收定金额',width: 100, align: 'center' },
  141. { field: 'id', title: '合同数',width: 90, align: 'center' },
  142. { field: 'id', title: '合同率',width: 90, align: 'center' },
  143. { field: 'id', title: '合同金额',width: 100, align: 'center' },
  144. { field: 'id', title: '均单值',width: 90, align: 'center' },
  145. { field: 'id', title: '线索量',width: 90, align: 'center' },
  146. { field: 'id', title: '有效线索量',width: 90, align: 'center' },
  147. { field: 'id', title: '有效率',width: 90, align: 'center' }
  148. ]];
  149. let cols2 = [[
  150. { field: 'id', title: '员工名称',width: 100, align: 'center', 'fixed': true },
  151. { field: 'id', title: '部门名称',width: 100, align: 'center' },
  152. { field: 'id', title: '待确认',width: 90, align: 'center' },
  153. { field: 'id', title: '量房数',width: 90, align: 'center' },
  154. { field: 'id', title: '到店数',width: 90, align: 'center' },
  155. { field: 'id', title: '见面数',width: 90, align: 'center' },
  156. { field: 'id', title: '见面率',width: 90, align: 'center' },
  157. { field: 'id', title: '订金数',width: 90, align: 'center' },
  158. { field: 'id', title: '收定率',width: 90, align: 'center' },
  159. { field: 'id', title: '收定金额',width: 100, align: 'center' },
  160. { field: 'id', title: '合同数',width: 90, align: 'center' },
  161. { field: 'id', title: '合同率',width: 90, align: 'center' },
  162. { field: 'id', title: '合同金额',width: 100, align: 'center' },
  163. { field: 'id', title: '均单值',width: 90, align: 'center' },
  164. { field: 'id', title: '线索量',width: 90, align: 'center' },
  165. { field: 'id', title: '有效线索量',width: 90, align: 'center' },
  166. { field: 'id', title: '有效率',width: 90, align: 'center' }
  167. ]];
  168. table.render({
  169. elem: '#list'
  170. , url: '{:url("statistics/customer")}'
  171. , page: true
  172. , height: 'full-100'
  173. , cols: cols1
  174. , id: 'tablelist'
  175. });
  176. function setYMD(time) {
  177. let dateTime = new Date(time);
  178. let year = dateTime.getFullYear();
  179. let Month = dateTime.getMonth() + 1;
  180. let days = dateTime.getDate();
  181. return `${year}-${Month > 9 ? Month : '0' + Month}-${days > 9 ? days : '0' + days}`;
  182. }
  183. var dateArr = {};
  184. var today = new Date().getTime();
  185. var oneTime = 24 * 60 * 60 * 1000;
  186. var threeDay1 = today - 3 * oneTime;
  187. var sevenDay1 = today - 6 * oneTime;
  188. var oneMonth = today - 30 * oneTime;
  189. dateArr = {
  190. nowS: setYMD(today),
  191. nowE: setYMD(today),
  192. threeDayS: setYMD(threeDay1),
  193. threeDayE: setYMD(today),
  194. sevenDayS: setYMD(sevenDay1),
  195. sevenDayE: setYMD(today),
  196. oneMonthS: setYMD(oneMonth),
  197. oneMonthE: setYMD(today),
  198. }
  199. $('#timeBtn').on('click',function(e){
  200. if (!!(e.target.localName != 'input')) return;
  201. let o = document.querySelector('#timeBtn').children;
  202. if (e.target.classList.contains('layui-btn-primary') == true) {
  203. for (var i = 0; i < o.length; i++) {
  204. o[i].className = 'layui-btn';
  205. }
  206. $('#sDate').val('');
  207. $('#eDate').val('');
  208. return;
  209. } else {
  210. for (var i = 0; i < o.length; i++) {
  211. o[i].className = 'layui-btn';
  212. }
  213. e.target.className = 'layui-btn layui-btn-primary';
  214. if (!!(e.target.className.indexOf('layui-btn-primary') > 0)) {
  215. if (e.target.value == '今日') {
  216. $('#sDate').val(dateArr.nowS);
  217. $('#eDate').val(dateArr.nowE);
  218. } else if (e.target.value == '3天') {
  219. $('#sDate').val(dateArr.threeDayS);
  220. $('#eDate').val(dateArr.threeDayE);
  221. } else if (e.target.value == '7天') {
  222. $('#sDate').val(dateArr.sevenDayS);
  223. $('#eDate').val(dateArr.sevenDayE);
  224. } else {
  225. $('#sDate').val(dateArr.oneMonthS);
  226. $('#eDate').val(dateArr.oneMonthE);
  227. }
  228. }
  229. }
  230. })
  231. form.on('submit(table-search)', function (data) {
  232. let field = data.field;
  233. let element = $('.layui-btn-primary');
  234. if (element && element[0]) {
  235. let el = element[0].value;
  236. console.log(el);
  237. }
  238. let option = {
  239. where: field
  240. , page: {
  241. curr: 1
  242. }
  243. };
  244. if (field.type == 1) {
  245. option.cols = [[
  246. { type: 'numbers', field: 'id', title: '序号', align: 'center' }
  247. ]]
  248. } else {
  249. option.cols = [[
  250. { type: 'numbers', field: 'id', title: '序号', align: 'center' }
  251. ]]
  252. }
  253. //执行重载
  254. table.reload('tablelist', option);
  255. });
  256. })
  257. </script>
  258. {/block}