截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

member.html 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. {layout name="layout1" /}
  2. <div class="wrapper">
  3. <div class="layui-form" lay-filter="">
  4. <div class="layui-card" >
  5. <div class="layui-card-body">
  6. <div class="layui-inline">
  7. <label class="layui-form-label">汇总时间:</label>
  8. <div class="layui-input-inline">
  9. <div class="layui-input-inline">
  10. <input type="text" name="start_time" class="layui-input" id="start_time"
  11. placeholder="" autocomplete="off">
  12. </div>
  13. </div>
  14. <div class="layui-input-inline" style="margin-right: 5px;width: 20px;">
  15. <label class="layui-form-mid">至</label>
  16. </div>
  17. <div class="layui-input-inline">
  18. <input type="text" name="end_time" class="layui-input" id="end_time"
  19. placeholder="" autocomplete="off">
  20. </div>
  21. </div>
  22. <div class="layui-inline">
  23. <button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit
  24. lay-filter="menber-search">查询
  25. </button>
  26. <button class="layui-btn layui-btn-sm layuiadmin-btn-ad layui-btn-primary " lay-submit
  27. lay-filter="menber-clear-search">重置
  28. </button>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="layui-row layui-col-space15">
  33. <div class="layui-col-sm6 layui-col-md3">
  34. <div class="layui-card">
  35. <div class="layui-card-header">
  36. 会员数量(人)
  37. </div>
  38. <div class="layui-card-body layuiadmin-card-list">
  39. <p class="layuiadmin-big-font" id="user_num">0</p>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="layui-col-sm6 layui-col-md3" >
  44. <div class="layui-card" >
  45. <div class="layui-card-header" >
  46. 新增会员数量(人)
  47. </div>
  48. <div class="layui-card-body layuiadmin-card-list" >
  49. <p class="layuiadmin-big-font" id="user_add">0</p>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <!--新增会员数量分析图-->
  55. <div class="layui-card" style="margin-top:20px">
  56. <div class="layui-card-body">
  57. <div class="layui-form-item">
  58. <div class="layui-input-inline layui-card-header" style="">近15天新增会员数量(人)</div>
  59. </div>
  60. <div class="layui-form-item">
  61. <div id="memberCharts" style="width: 100%;height: 80vh;"></div>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. <script>
  68. layui.config({
  69. version:"{$front_version}",
  70. base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
  71. }).extend({
  72. index: 'lib/index' //主入口模块
  73. }).use(['index','table','like','echarts','form'], function(){
  74. var $ = layui.$
  75. ,form = layui.form
  76. ,like = layui.like
  77. ,echarts = layui.echarts
  78. ,laydate = layui.laydate;
  79. //日期时间范围
  80. laydate.render({
  81. elem: '#start_time'
  82. , type: 'datetime'
  83. });
  84. laydate.render({
  85. elem: '#end_time'
  86. , type: 'datetime'
  87. });
  88. //监听搜索
  89. form.on('submit(menber-search)', function (data) {
  90. graphData();
  91. });
  92. //清空查询
  93. form.on('submit(menber-clear-search)', function () {
  94. $('#start_time').val('');
  95. $('#end_time').val('');
  96. graphData();
  97. });
  98. const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'];
  99. graphData();
  100. function graphData(){
  101. var start_time = $('#start_time').val();
  102. var end_time = $('#end_time').val();
  103. like.ajax({
  104. url:'{:url("statistics/member")}',
  105. data: {'start_time':start_time,'end_time':end_time},
  106. type: "post",
  107. success: function (res) {
  108. $('#user_num').text(res.data.user_num);
  109. $('#user_add').text(res.data.user_add);
  110. // 默认选中七天内时间
  111. $('#start_time').val(res.data.start_time);
  112. $('#end_time').val(res.data.end_time);
  113. start_time = res.data.start_time;
  114. end_time = res.data.end_time;
  115. var memberNum = res.data.echarts_count;
  116. var newMember = res.data.echarts_add;
  117. var xData = res.data.days;
  118. var option = setOption(memberNum, newMember, xData);
  119. let chart = document.getElementById('memberCharts');
  120. let memberChart = echarts.init(chart);
  121. memberChart.setOption(option, true);
  122. window.addEventListener('resize', function () {
  123. memberChart.resize()
  124. });
  125. }
  126. });
  127. }
  128. //新增会员数量-图标设置
  129. function setOption(memberNum, newMember, xData) {
  130. option = {
  131. backgroundColor: '#fff',
  132. legend: {
  133. icon: 'circle',
  134. top: '5%',
  135. right: '5%',
  136. itemWidth: 6,
  137. itemGap: 20,
  138. textStyle: {
  139. color: '#556677'
  140. }
  141. },
  142. tooltip: {
  143. trigger: 'axis',
  144. backgroundColor: '#fff',
  145. textStyle: {
  146. color: '#5c6c7c'
  147. },
  148. padding: [10, 10],
  149. extraCssText: 'box-shadow: 1px 0 2px 0 rgba(163,163,163,0.5)'
  150. },
  151. grid: {
  152. top: '15%'
  153. },
  154. xAxis: [{
  155. type: 'category',
  156. name: '(日期)',
  157. data: xData,
  158. axisLine: {
  159. lineStyle: {
  160. color: 'rgba(107,107,107,0.37)', //x轴颜色
  161. }
  162. },
  163. axisTick: {
  164. show: false
  165. },
  166. axisLabel: {
  167. interval: 0,
  168. textStyle: {
  169. color: '#999' //坐标轴字颜色
  170. },
  171. margin: 15
  172. },
  173. axisPointer: {
  174. label: {
  175. padding: [11, 5, 7],
  176. backgroundColor: {
  177. type: 'linear',
  178. x: 0,
  179. y: 0,
  180. x2: 0,
  181. y2: 1,
  182. colorStops: [{
  183. offset: 0,
  184. color: '#fff' // 0% 处的颜色
  185. }, {
  186. offset: 0.9,
  187. color: '#fff' // 0% 处的颜色
  188. }, {
  189. offset: 0.9,
  190. color: '#33c0cd' // 0% 处的颜色
  191. }, {
  192. offset: 1,
  193. color: '#33c0cd' // 100% 处的颜色
  194. }],
  195. global: false // 缺省为 false
  196. }
  197. }
  198. },
  199. boundaryGap: false
  200. }],
  201. yAxis: [{
  202. type: 'value',
  203. name: '(人)',
  204. axisTick: {
  205. show: false
  206. },
  207. axisLine: {
  208. show: true,
  209. lineStyle: {
  210. color: 'rgba(107,107,107,0.37)', //y轴颜色
  211. }
  212. },
  213. axisLabel: {
  214. textStyle: {
  215. color: '#999'
  216. }
  217. },
  218. splitLine: {
  219. show: false
  220. }
  221. }],
  222. series: [{
  223. name: '新增会员数量',
  224. type: 'line',
  225. data: newMember,
  226. symbolSize: 1,
  227. symbol: 'circle',
  228. smooth: true,
  229. yAxisIndex: 0,
  230. showSymbol: false,
  231. lineStyle: {
  232. width: 5,
  233. color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
  234. offset: 0,
  235. color: '#73DD39'
  236. },
  237. {
  238. offset: 1,
  239. color: '#73DDFF'
  240. }
  241. ]),
  242. shadowColor: 'rgba(115,221,255, 0.3)',
  243. shadowBlur: 10,
  244. shadowOffsetY: 20
  245. },
  246. itemStyle: {
  247. normal: {
  248. color: colorList[1],
  249. borderColor: colorList[1]
  250. }
  251. }
  252. }]
  253. };
  254. return option;
  255. }
  256. });
  257. </script>
  258. <script type="text/javascript">
  259. (function(){
  260. var tab_tit = document.getElementById('think_page_trace_tab_tit').getElementsByTagName('span');
  261. var tab_cont = document.getElementById('think_page_trace_tab_cont').getElementsByTagName('div');
  262. var open = document.getElementById('think_page_trace_open');
  263. var close = document.getElementById('think_page_trace_close').children[0];
  264. var trace = document.getElementById('think_page_trace_tab');
  265. var cookie = document.cookie.match(/thinkphp_show_page_trace=(\d\|\d)/);
  266. var history = (cookie && typeof cookie[1] != 'undefined' && cookie[1].split('|')) || [0,0];
  267. open.onclick = function(){
  268. trace.style.display = 'block';
  269. this.style.display = 'none';
  270. close.parentNode.style.display = 'block';
  271. history[0] = 1;
  272. document.cookie = 'thinkphp_show_page_trace='+history.join('|')
  273. }
  274. close.onclick = function(){
  275. trace.style.display = 'none';
  276. this.parentNode.style.display = 'none';
  277. open.style.display = 'block';
  278. history[0] = 0;
  279. document.cookie = 'thinkphp_show_page_trace='+history.join('|')
  280. }
  281. for(var i = 0; i < tab_tit.length; i++){
  282. tab_tit[i].onclick = (function(i){
  283. return function(){
  284. for(var j = 0; j < tab_cont.length; j++){
  285. tab_cont[j].style.display = 'none';
  286. tab_tit[j].style.color = '#999';
  287. }
  288. tab_cont[i].style.display = 'block';
  289. tab_tit[i].style.color = '#000';
  290. history[1] = i;
  291. document.cookie = 'thinkphp_show_page_trace='+history.join('|')
  292. }
  293. })(i)
  294. }
  295. parseInt(history[0]) && open.click();
  296. tab_tit[history[1]].click();
  297. })();
  298. </script>
  299. </body>
  300. </html>