人人商城

card.html 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {template 'common/header'}
  2. <style>
  3. .account-stat-num > div{width:33.333%; float:left; font-size:16px; text-align:center;}
  4. .account-stat-num > div span{display:block; font-size:30px; font-weight:bold;}
  5. </style>
  6. <ul class="nav nav-tabs">
  7. <li class="active"><a href="{php echo url('stat/card')}">会员卡领卡统计</a></li>
  8. </ul>
  9. <div class="panel panel-default">
  10. <div class="panel-heading">
  11. 会员卡统计
  12. </div>
  13. <div class="panel-body">
  14. <div class="account-stat-num row">
  15. <div>会员卡总数<span>{$total}</span></div>
  16. <div>今日领卡<span>{$today}</span></div>
  17. <div>昨日领卡<span>{$yesterday}</span></div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="panel panel-default">
  22. <div class="panel-heading">
  23. 会员卡统计
  24. </div>
  25. <div class="panel-body" id="scroll">
  26. <div class="pull-left">
  27. <form action="" id="form1">
  28. <input name="c" value="stat" type="hidden" />
  29. <input name="a" value="card" type="hidden" />
  30. {php echo tpl_form_field_daterange('time', array('start' => date('Y-m-d', $starttime),'end' => date('Y-m-d', $endtime)), '')}
  31. <input type="hidden" value="" name="scroll">
  32. </form>
  33. </div>
  34. <div style="margin-top:20px">
  35. <canvas id="myChart" width="1200" height="300"></canvas>
  36. </div>
  37. </div>
  38. </div>
  39. <script>
  40. require(['chart', 'daterangepicker'], function(c) {
  41. $('.daterange').on('apply.daterangepicker', function(ev, picker) {
  42. $('#form1')[0].submit();
  43. });
  44. var chart = null;
  45. var templates = {
  46. label: '领卡数',
  47. fillColor : "rgba(149,192,0,0.1)",
  48. strokeColor : "rgba(149,192,0,1)",
  49. pointColor : "rgba(149,192,0,1)",
  50. pointStrokeColor : "#fff",
  51. pointHighlightFill : "#fff",
  52. pointHighlightStroke : "rgba(149,192,0,1)"
  53. };
  54. var url = location.href + '&#aaaa';
  55. $.post(url, function(data){
  56. var data = $.parseJSON(data)
  57. var datasets = data.datasets;
  58. if(!chart) {
  59. var label = data.label;
  60. console.dir(label);
  61. templates.data = datasets;
  62. var lineChartData = {
  63. labels : label,
  64. datasets : [templates]
  65. };
  66. var ctx = document.getElementById("myChart").getContext("2d");
  67. chart = new Chart(ctx).Line(lineChartData, {
  68. responsive: true
  69. });
  70. }
  71. });
  72. });
  73. </script>
  74. {template 'common/footer'}