123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- {template 'common/header'}
- <style>
- .account-stat-num > div{width:25%; float:left; font-size:16px; text-align:center;}
- .account-stat-num > div span{display:block; font-size:30px; font-weight:bold;}
- </style>
- <ul class="nav nav-tabs">
- <li {if $do == 'index'}class="active"{/if}><a href="{php echo url('stat/cash')}">消费日志</a></li>
- <li {if $do == 'chart'}class="active"{/if}><a href="{php echo url('stat/cash/chart')}">消费统计</a></li>
- </ul>
- {if $do == 'chart'}
- <div class="panel panel-default">
- <div class="panel-heading">
- 现金统计
- </div>
- <div class="panel-body">
- <div class="account-stat-num row">
- <div style="width:50%">今日消费总额<span>{php echo abs($today_consume);}</span></div>
- <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>
- </div>
- </div>
- </div>
-
- <div class="panel panel-default">
- <div class="panel-heading">
- 现金统计
- </div>
- <div class="panel-body" id="scroll">
- <div class="pull-left">
- <form action="" id="form1">
- <input name="c" value="stat" type="hidden" />
- <input name="a" value="cash" type="hidden" />
- <input name="do" value="chart" type="hidden" />
- {php echo tpl_form_field_daterange('time', array('start' => date('Y-m-d', $starttime),'end' => date('Y-m-d', $endtime)), '')}
- <input type="hidden" value="" name="scroll">
- </form>
- </div>
- <div class="pull-right">
- <div class="checkbox">
- <label style="color:rgba(203,48,48,1)"><input checked type="checkbox"> 消费统计</label>
- </div>
- </div>
- <div style="margin-top:20px">
- <canvas id="myChart" width="1200" height="300"></canvas>
- </div>
- </div>
- </div>
- <script>
- require(['chart', 'daterangepicker'], function(c) {
- $('.daterange').on('apply.daterangepicker', function(ev, picker) {
- $('#form1')[0].submit();
- });
- var chart = null;
- var chartDatasets = null;
- var templates = {
- consume: {
- label: '消费',
- fillColor : "rgba(203,48,48,0.1)",
- strokeColor : "rgba(203,48,48,1)",
- pointColor : "rgba(203,48,48,1)",
- pointStrokeColor : "#fff",
- pointHighlightFill : "#fff",
- pointHighlightStroke : "rgba(203,48,48,1)"
- },
- recharge: {
- label: '充值',
- fillColor : "rgba(149,192,0,0.1)",
- strokeColor : "rgba(149,192,0,1)",
- pointColor : "rgba(149,192,0,1)",
- pointStrokeColor : "#fff",
- pointHighlightFill : "#fff",
- pointHighlightStroke : "rgba(149,192,0,1)"
- }
- };
-
- function refreshData() {
- if(!chart || !chartDatasets) {
- return;
- }
- var visables = [];
- var i = 0;
- $('.checkbox input[type="checkbox"]').each(function(){
- if($(this).attr('checked')) {
- visables.push(i);
- }
- i++;
- });
- var ds = [];
- $.each(visables, function(){
- var o = chartDatasets[this];
- ds.push(o);
- });
- chart.datasets = ds;
- chart.update();
- }
-
- var url = location.href + '&#aaaa';
- $.post(url, function(data){
- var data = $.parseJSON(data)
- var datasets = data.datasets;
-
- if(!chart) {
- var label = data.label;
- var ds = $.extend(true, {}, templates);
- ds.consume.data = datasets.consume;
- ds.recharge.data = datasets.recharge;
- var lineChartData = {
- labels : label,
- datasets : [ds.consume, ds.recharge]
- };
-
- var ctx = document.getElementById("myChart").getContext("2d");
- chart = new Chart(ctx).Line(lineChartData, {
- responsive: true
- });
- chartDatasets = $.extend(true, {}, chart.datasets);
- }
- refreshData();
- });
-
- $('.checkbox input[type="checkbox"]').on('click', function(){
- $(this).attr('checked', !$(this).attr('checked'))
- refreshData();
- });
- });
- </script>
- {else}
- <div class="panel panel-info">
- <div class="panel-heading">筛选</div>
- <div class="panel-body">
- <form action="./index.php" method="get" class="form-horizontal" role="form">
- <input type="hidden" name="c" value="stat">
- <input type="hidden" name="a" value="cash">
- <input type="hidden" name="do" value="index">
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费时间</label>
- <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
- {php echo tpl_form_field_daterange('time', array('starttime' => date('Y-m-d', $starttime), 'endtime' => date('Y-m-d', $endtime),));}
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">姓名/手机号码/UID</label>
- <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
- <input type="text" class="form-control" name="user" value="{$_GPC['uid']}" />
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">操作人</label>
- <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
- {if $_W['user']['clerk_type'] == 3}
- <input type="text" class="form-control" value="{$clerks[$_W['user']['clerk_id']]['name']}" disabled/>
- {else}
- <select class="form-control" name="clerk_id">
- <option value="">不限</option>
- {loop $clerks $clerk}
- <option value="{$clerk['id']}" {if $_GPC['clerk_id'] == $clerk['id']}selected{/if}>{$clerk['name']}</option>
- {/loop}
- </select>
- {/if}
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">消费门店</label>
- <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
- <select class="form-control" name="store_id">
- <option value="">不限</option>
- {loop $stores $store}
- <option value="{$store['id']}" {if $_GPC['store_id'] == $store['id']}selected{/if}>{$store['business_name']}</option>
- {/loop}
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label">积分/金额/实收</label>
- <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
- <div class="input-group">
- <input type="text" class="form-control" name="min" value="{$_GPC['min']}" />
- <span class="input-group-addon">至</span>
- <input type="text" class="form-control" name="max" value="{$_GPC['max']}" />
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
- <div class="col-xs-12 col-sm-3 col-md-2 col-lg-2">
- <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
- <button name="export" value="export" class="btn btn-default"><i class="fa fa-download"></i> 导出数据</button>
- <input type="hidden" name="token" value="{$_W['token']}"/>
- </div>
- </div>
- </form>
- </div>
- </div>
- <form method="post" class="form-horizontal" id="form1">
- <div class="panel panel-default ">
- <div class="table-responsive panel-body">
- <table class="table table-hover">
- <thead>
- <tr>
- <th style="width:80px;">会员编号</th>
- <th>姓名</th>
- <th>手机</th>
- <th>消费金额</th>
- <th>实收金额</th>
- <th>余额支付</th>
- <th>积分抵消</th>
- <th>实收现金</th>
- <th>消费门店</th>
- <th>操作人</th>
- <th width="150">操作时间</th>
- </tr>
- </thead>
- <tbody>
- {loop $data $row}
- <tr title="点击查看详情" onclick="$(this).next().toggle();" style="cursor:pointer">
- <td><i class="fa fa-caret-down"></i> {$row['uid']}</td>
- <td>{$users[$row['uid']]['realname']}</td>
- <td>{$users[$row['uid']]['mobile']}</td>
- <td>{$row['fee']}</td>
- <td>{$row['final_fee']}</td>
- <td>{$row['credit2']}</td>
- <td>{$row['credit1_fee']}</td>
- <td>{$row['final_cash']}</td>
- <td>{$row['store_cn']}</td>
- <td>{$row['clerk_cn']}</td>
- <td>{php echo date('Y-m-d H:i', $row['createtime'])}</td>
- </tr>
- <tr style="display:none">
- <td colspan="11"><strong>{$row['remark']}</strong></td>
- </tr>
- {/loop}
- </tbody>
- </table>
- </div>
- </div>
- {$pager}
- </form>
- {/if}
- {template 'common/footer'}
|