人人商城

cash.html 7.8KB

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