人人商城

credit1.html 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. {template 'common/header'}
  2. <style>
  3. .account-stat-num > div{width:25%; 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 {if $do == 'index'}class="active"{/if}><a href="{php echo url('stat/credit1')}">积分日志</a></li>
  8. <li {if $do == 'chart'}class="active"{/if}><a href="{php echo url('stat/credit1/chart')}">积分统计</a></li>
  9. </ul>
  10. {if $do == 'chart'}
  11. <div class="panel panel-default">
  12. <div class="panel-heading">
  13. 积分统计
  14. </div>
  15. <div class="panel-body">
  16. <div class="account-stat-num row">
  17. <div>今日充值总额<span>{$today_recharge}</span></div>
  18. <div>今日消费总额<span>{php echo abs($today_consume);}</span></div>
  19. <div>{php echo date('Y-m-d', $starttime);}~{php echo date('Y-m-d', $endtime);}<br>充值总额<span>{$total_recharge}</span></div>
  20. <div>{php echo date('Y-m-d', $starttime);}~{php echo date('Y-m-d', $endtime);}<br>消费总额<span>{php echo abs($total_consume)}</span></div>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="panel panel-default">
  25. <div class="panel-heading">
  26. 积分统计
  27. </div>
  28. <div class="panel-body" id="scroll">
  29. <div class="pull-left">
  30. <form action="" id="form1">
  31. <input name="c" value="stat" type="hidden" />
  32. <input name="a" value="credit1" type="hidden" />
  33. <input name="do" value="chart" type="hidden" />
  34. {php echo tpl_form_field_daterange('time', array('start' => date('Y-m-d', $starttime),'end' => date('Y-m-d', $endtime)), '')}
  35. <input type="hidden" value="" name="scroll">
  36. </form>
  37. </div>
  38. <div class="pull-right">
  39. <div class="checkbox">
  40. <label style="color:rgba(149,192,0,1);;"><input checked type="checkbox"> 充值统计</label>&nbsp;
  41. <label style="color:rgba(203,48,48,1)"><input checked type="checkbox"> 消费统计</label>&nbsp;
  42. </div>
  43. </div>
  44. <div style="margin-top:20px">
  45. <canvas id="myChart" width="1200" height="300"></canvas>
  46. </div>
  47. </div>
  48. </div>
  49. <script>
  50. require(['chart', 'daterangepicker'], function(c) {
  51. $('.daterange').on('apply.daterangepicker', function(ev, picker) {
  52. $('#form1')[0].submit();
  53. });
  54. var chart = null;
  55. var chartDatasets = null;
  56. var templates = {
  57. consume: {
  58. label: '消费',
  59. fillColor : "rgba(203,48,48,0.1)",
  60. strokeColor : "rgba(203,48,48,1)",
  61. pointColor : "rgba(203,48,48,1)",
  62. pointStrokeColor : "#fff",
  63. pointHighlightFill : "#fff",
  64. pointHighlightStroke : "rgba(203,48,48,1)"
  65. },
  66. recharge: {
  67. label: '充值',
  68. fillColor : "rgba(149,192,0,0.1)",
  69. strokeColor : "rgba(149,192,0,1)",
  70. pointColor : "rgba(149,192,0,1)",
  71. pointStrokeColor : "#fff",
  72. pointHighlightFill : "#fff",
  73. pointHighlightStroke : "rgba(149,192,0,1)"
  74. }
  75. };
  76. function refreshData() {
  77. if(!chart || !chartDatasets) {
  78. return;
  79. }
  80. var visables = [];
  81. var i = 0;
  82. $('.checkbox input[type="checkbox"]').each(function(){
  83. if($(this).attr('checked')) {
  84. visables.push(i);
  85. }
  86. i++;
  87. });
  88. var ds = [];
  89. $.each(visables, function(){
  90. var o = chartDatasets[this];
  91. ds.push(o);
  92. });
  93. chart.datasets = ds;
  94. chart.update();
  95. }
  96. var url = location.href + '&#aaaa';
  97. $.post(url, function(data){
  98. var data = $.parseJSON(data)
  99. var datasets = data.datasets;
  100. if(!chart) {
  101. var label = data.label;
  102. var ds = $.extend(true, {}, templates);
  103. ds.consume.data = datasets.consume;
  104. ds.recharge.data = datasets.recharge;
  105. var lineChartData = {
  106. labels : label,
  107. datasets : [ds.consume, ds.recharge]
  108. };
  109. var ctx = document.getElementById("myChart").getContext("2d");
  110. chart = new Chart(ctx).Line(lineChartData, {
  111. responsive: true
  112. });
  113. chartDatasets = $.extend(true, {}, chart.datasets);
  114. }
  115. refreshData();
  116. });
  117. $('.checkbox input[type="checkbox"]').on('click', function(){
  118. $(this).attr('checked', !$(this).attr('checked'))
  119. refreshData();
  120. });
  121. });
  122. </script>
  123. {else}
  124. <div class="panel panel-info">
  125. <div class="panel-heading">筛选</div>
  126. <div class="panel-body">
  127. <form action="./index.php" method="get" class="form-horizontal" role="form">
  128. <input type="hidden" name="c" value="stat">
  129. <input type="hidden" name="a" value="credit1">
  130. <input type="hidden" name="do" value="index">
  131. <input type="hidden" name="num" value="{$num}">
  132. <div class="form-group">
  133. <label class="col-xs-12 col-sm-3 col-md-2 control-label">类型</label>
  134. <div class="col-sm-8 col-lg-9 col-xs-12">
  135. <div class="btn-group">
  136. <a href="{php echo filter_url('num:0');}" class="btn {if !$_GPC['num']}btn-primary{else}btn-default{/if}">不限</a>
  137. <a href="{php echo filter_url('num:1');}" class="btn {if $_GPC['num'] == 1}btn-primary{else}btn-default{/if}">充值</a>
  138. <a href="{php echo filter_url('num:2');}" class="btn {if $_GPC['num'] == 2}btn-primary{else}btn-default{/if}">消费</a>
  139. </div>
  140. </div>
  141. </div>
  142. <div class="form-group">
  143. <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费时间</label>
  144. <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
  145. {php echo tpl_form_field_daterange('time', array('starttime' => date('Y-m-d', $starttime), 'endtime' => date('Y-m-d', $endtime),));}
  146. </div>
  147. </div>
  148. <div class="form-group">
  149. <label class="col-xs-12 col-sm-3 col-md-2 control-label">姓名/手机号码/UID</label>
  150. <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
  151. <input type="text" class="form-control" name="user" value="{$_GPC['uid']}" />
  152. </div>
  153. </div>
  154. <div class="form-group">
  155. <label class="col-xs-12 col-sm-3 col-md-2 control-label">积分</label>
  156. <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
  157. <div class="input-group">
  158. <input type="text" class="form-control" name="min" value="{$_GPC['min']}" />
  159. <span class="input-group-addon">至</span>
  160. <input type="text" class="form-control" name="max" value="{$_GPC['max']}" />
  161. </div>
  162. </div>
  163. </div>
  164. <div class="form-group">
  165. <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
  166. <div class="col-xs-12 col-sm-3 col-md-2 col-lg-2">
  167. <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>&nbsp;&nbsp;
  168. <button name="export" value="export" class="btn btn-default"><i class="fa fa-download"></i> 导出数据</button>
  169. <input type="hidden" name="token" value="{$_W['token']}"/>
  170. </div>
  171. </div>
  172. </form>
  173. </div>
  174. </div>
  175. <form method="post" class="form-horizontal" id="form1">
  176. <div class="panel panel-default ">
  177. <div class="table-responsive panel-body">
  178. <table class="table table-hover">
  179. <thead>
  180. <tr>
  181. <th style="width:80px;">会员编号</th>
  182. <th>姓名</th>
  183. <th>手机</th>
  184. <th>类型</th>
  185. <th>数量</th>
  186. <th>操作时间</th>
  187. <th width="400">备注</th>
  188. </tr>
  189. </thead>
  190. <tbody>
  191. {loop $data $row}
  192. <tr>
  193. <td>{$row['uid']}</td>
  194. <td>{$users[$row['uid']]['realname']}</td>
  195. <td>{$users[$row['uid']]['mobile']}</td>
  196. <td>
  197. {if $row['num'] > 0}
  198. <span class="label label-success">充值</span>
  199. {else}
  200. <span class="label label-danger">消费</span>
  201. {/if}
  202. </td>
  203. <td>{php echo abs($row['num']);}</td>
  204. <td>{php echo date('Y-m-d H:i', $row['createtime'])}</td>
  205. <td style="cursor: pointer"><span data-toggle="popover" data-placement="top" data-trigger="hover" data-content="{$row['remark']}">{php echo cutstr($row['remark'], 30, '...');}</span></td>
  206. </tr>
  207. {/loop}
  208. </tbody>
  209. </table>
  210. </div>
  211. </div>
  212. {$pager}
  213. </form>
  214. <script>
  215. require(['bootstrap'],function($){
  216. $('[data-toggle="popover"]').popover()
  217. });
  218. </script>
  219. {/if}
  220. {template 'common/footer'}