人人商城

paycenter.html 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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/paycenter')}">收款记录</a></li>
  8. <li {if $do == 'chart'}class="active"{/if}><a href="{php echo url('stat/paycenter/chart')}">收款统计</a></li>
  9. </ul>
  10. {if $do == 'index'}
  11. <div class="panel panel-info">
  12. <div class="panel-heading">筛选</div>
  13. <div class="panel-body">
  14. <form action="./index.php" method="get" class="form-horizontal" role="form">
  15. <input type="hidden" name="c" value="stat">
  16. <input type="hidden" name="a" value="paycenter">
  17. <input type="hidden" name="do" value="index">
  18. <div class="form-group">
  19. <label class="col-xs-12 col-sm-3 col-md-2 control-label">操作人</label>
  20. <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
  21. <select class="form-control" name="clerk_id">
  22. <option value="">不限</option>
  23. {loop $clerks $clerk}
  24. <option value="{$clerk['id']}" {if $_GPC['clerk_id'] == $clerk['id']}selected{/if}>{$clerk['name']}</option>
  25. {/loop}
  26. </select>
  27. </div>
  28. </div>
  29. <div class="form-group">
  30. <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费门店</label>
  31. <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
  32. <select class="form-control" name="store_id">
  33. <option value="">不限</option>
  34. {loop $stores $store}
  35. <option value="{$store['id']}" {if $_GPC['store_id'] == $store['id']}selected{/if}>{$store['business_name']}</option>
  36. {/loop}
  37. </select>
  38. </div>
  39. </div>
  40. <div class="form-group">
  41. <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
  42. <div class="col-xs-12 col-sm-3 col-md-2 col-lg-2">
  43. <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>&nbsp;&nbsp;
  44. <input type="hidden" name="token" value="{$_W['token']}"/>
  45. </div>
  46. </div>
  47. </form>
  48. </div>
  49. </div>
  50. <div class="clearfix">
  51. <div class="panel panel-default">
  52. <div class="panel-body">
  53. <table class="table table-hover table-center table-responsive">
  54. <thead>
  55. <tr>
  56. <th style="text-align:left">编号</th>
  57. <th>付款人</th>
  58. <th>付款理由</th>
  59. <th>应付金额(元)</th>
  60. <th>实付金额(元)</th>
  61. <th>操作人</th>
  62. <th>消费门店</th>
  63. <th>付款时间</th>
  64. <th>操作</th>
  65. </tr>
  66. </thead>
  67. {if !empty($orders)}
  68. {loop $orders $order}
  69. <tr>
  70. <td style="text-align:left">{$order['id']}</td>
  71. <td>{if !empty($order['nickname'])}{$order['nickname']}{else}{$order['openid']}{/if}</td>
  72. <td>{$order['body']}</td>
  73. <td>{$order['fee']}</td>
  74. <td>{$order['final_fee']}</td>
  75. <td>{$order['clerk_cn']}</td>
  76. <td>{$order['store_cn']}</td>
  77. <td>{php echo date('Y-m-d H:i', $order['paytime']);}</td>
  78. <td>
  79. <a href="javascript:;" class="btn btn-success btn-sm pay-info" data-id="{$order['id']}">支付详情</a>
  80. </td>
  81. </tr>
  82. {/loop}
  83. {/if}
  84. </table>
  85. </div>
  86. </div>
  87. {$pager}
  88. </div>
  89. {/if}
  90. {if $do == 'chart'}
  91. <div class="panel panel-default">
  92. <div class="panel-heading">
  93. 收款统计
  94. </div>
  95. <div class="panel-body">
  96. <div class="account-stat-num row">
  97. <div>昨日收款总额<span>{$yesterday_fee}</span></div>
  98. <div>今日收款总额<span>{$today_fee}</span></div>
  99. <div>本月收款总额<span>{$month_fee}</span></div>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="panel panel-default">
  104. <div class="panel-heading">
  105. 商家支付数据统计
  106. </div>
  107. <div class="panel-body">
  108. <div class="clearfix">
  109. <div id="date" class="pull-left">
  110. {php echo tpl_form_field_daterange('time', array('start' => date('Y-m-d', strtotime(date('Y-m-d')) - 30*86400),'end' => date('Y-m-d', strtotime(date('Y-m-d')) + 86399)), '')}
  111. </div>
  112. </div>
  113. <h4>总收入: ¥<span class="text-success" id="date-total">0.00</span></h4>
  114. <div style="margin-top:20px" id="canvas-date">
  115. <canvas id="dateChart" width="1200" height="300"></canvas>
  116. </div>
  117. </div>
  118. </div>
  119. <div class="panel panel-default">
  120. <div class="panel-heading">
  121. 商家支付数据统计(月份统计)
  122. </div>
  123. <div class="panel-body">
  124. <div class="clearfix">
  125. <div id="month" class="pull-left">
  126. <div class="input-group" style="width:300px;">
  127. <input type="text" class="form-control datetime" readonly name="time[start]" value="{php echo date('Y-m', strtotime('-6months'));}">
  128. <span class="input-group-addon">到</span>
  129. <input type="text" class="form-control datetime" readonly name="time[end]" value="{php echo date('Y-m');}">
  130. <div class="input-group-btn">
  131. <button class="btn btn-primary" id="search">查询</button>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. <h4>总收入: ¥<span class="text-success" id="month-total">0.00</span></h4>
  137. <div style="margin-top:20px" id="canvas-month">
  138. <canvas id="monthChart" width="1200" height="300"></canvas>
  139. </div>
  140. </div>
  141. </div>
  142. <script>
  143. require(['chart', 'daterangepicker', 'datetimepicker'], function(c) {
  144. $(".datetime").each(function(){
  145. var option = {
  146. lang : "zh",
  147. step : "10",
  148. timepicker : false,
  149. closeOnDateSelect : true,
  150. format : "Y-m"
  151. };
  152. $(this).datetimepicker(option);
  153. });
  154. var chart = null;
  155. var templates = {
  156. flow1: {
  157. label: '总收入',
  158. fillColor : "rgba(149,192,0,0.1)",
  159. strokeColor : "rgba(149,192,0,1)",
  160. pointColor : "rgba(149,192,0,1)",
  161. pointStrokeColor : "#fff",
  162. pointHighlightFill : "#fff",
  163. pointHighlightStroke : "rgba(149,192,0,1)"
  164. }
  165. };
  166. function GetChartData(type) {
  167. var start = $('#' + type + ' input[name="time[start]"]').val();
  168. var end = $('#' + type + ' input[name="time[end]"]').val();
  169. var params = {
  170. type: type,
  171. start: start,
  172. end: end
  173. };
  174. if(type == 'date') {
  175. $('#canvas-date').html('<canvas height="100" id="dateChart"></canvas>');
  176. $.post("{php echo url('stat/paycenter/chart', array('type' => 'date'));}", params, function(data){
  177. var data = $.parseJSON(data);
  178. var ds = $.extend(true, {}, templates);
  179. ds.flow1.data = data.datasets.flow1;
  180. var lineChartData = {
  181. labels : data.label,
  182. datasets : [ds.flow1]
  183. };
  184. var ctx = document.getElementById("dateChart").getContext("2d");
  185. chart = new Chart(ctx).Line(lineChartData, {
  186. responsive: true
  187. });
  188. $('#date-total').html(data.total);
  189. });
  190. } else {
  191. $('#canvas-month').html('<canvas height="100" id="monthChart"></canvas>');
  192. $.post("{php echo url('stat/paycenter/chart', array('type' => 'month'));}", params, function(data){
  193. var data = $.parseJSON(data);
  194. var ds = $.extend(true, {}, templates);
  195. ds.flow1.data = data.datasets.flow1;
  196. var lineChartData = {
  197. labels : data.label,
  198. datasets : [ds.flow1]
  199. };
  200. var ctx = document.getElementById("monthChart").getContext("2d");
  201. chart = new Chart(ctx).Line(lineChartData, {
  202. responsive: true
  203. });
  204. $('#month-total').html(data.total);
  205. });
  206. }
  207. }
  208. GetChartData('date');
  209. GetChartData('month');
  210. $('.daterange').on('apply.daterangepicker', function(ev, picker) {
  211. GetChartData('date');
  212. });
  213. $('#search').click(function(){
  214. GetChartData('month');
  215. });
  216. });
  217. </script>
  218. {/if}
  219. <div class="modal fade" id="payinfo-modal">
  220. <div class="modal-dialog modal-lg">
  221. <div class="modal-content">
  222. <div class="modal-header">
  223. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  224. <h3 class="modal-title">支付详情</h3>
  225. </div>
  226. <div class="modal-body"></div>
  227. <div class="modal-footer">
  228. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. <script>
  234. require(['jquery.qrcode'], function(){
  235. $('.pay-info').click(function(){
  236. var id = $(this).data('id');
  237. if(!id) {
  238. util.message('订单编号错误', '', 'error');
  239. return false;
  240. }
  241. $.post("{php echo url('stat/paycenter/detail');}", {id: id}, function(data) {
  242. var data = $.parseJSON(data);
  243. if(data.message.errno == -1) {
  244. util.message(data.message.message, '', 'error');
  245. return false;
  246. } else {
  247. $('#payinfo-modal .modal-body').html(data.message.message);
  248. $('#payinfo-modal').modal('show');
  249. return false;
  250. }
  251. });
  252. });
  253. });
  254. </script>
  255. {template 'common/footer'}