statpaycenter.html
11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
{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 $op == 'index'}class="active"{/if}><a href="{php echo $this->createWeburl('statpaycenter', array('op' => 'index'))}">收款记录</a></li>
<li {if $op == 'chart'}class="active"{/if}><a href="{php echo $this->createWeburl('statpaycenter', array('op' => 'chart'))}">收款统计</a></li>
</ul>
{if $op == 'index'}
<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="site">
<input type="hidden" name="a" value="entry">
<input type="hidden" name="do" value="statpaycenter">
<input type="hidden" name="op" value="index">
<input type="hidden" name="m" value="we7_coupon">
<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="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>
</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-xs-12 col-sm-3 col-md-2 col-lg-2">
<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
<input type="hidden" name="token" value="{$_W['token']}"/>
</div>
</div>
</form>
</div>
</div>
<div class="clearfix">
<div class="panel panel-default">
<div class="panel-body">
<table class="table table-hover table-center table-responsive">
<thead>
<tr>
<th style="text-align:left">编号</th>
<th>付款人</th>
<th>付款理由</th>
<th>应付金额(元)</th>
<th>实付金额(元)</th>
<th>操作人</th>
<th>消费门店</th>
<th>付款时间</th>
<th>操作</th>
</tr>
</thead>
{if !empty($orders)}
{loop $orders $order}
<tr>
<td style="text-align:left">{$order['id']}</td>
<td>{if !empty($order['nickname'])}{$order['nickname']}{else}{$order['openid']}{/if}</td>
<td>{$order['body']}</td>
<td>{$order['fee']}</td>
<td>{$order['final_fee']}</td>
<td>{$order['clerk_cn']}</td>
<td>{$order['store_cn']}</td>
<td>{php echo date('Y-m-d H:i', $order['paytime']);}</td>
<td>
<a href="javascript:;" class="btn btn-success btn-sm pay-info" data-id="{$order['id']}">支付详情</a>
</td>
</tr>
{/loop}
{/if}
</table>
</div>
</div>
{$pager}
</div>
{/if}
{if $op == 'chart'}
<div class="panel panel-default">
<div class="panel-heading">
收款统计
</div>
<div class="panel-body">
<div class="account-stat-num row">
<div>昨日收款总额<span>{$yesterday_fee}</span></div>
<div>今日收款总额<span>{$today_fee}</span></div>
<div>本月收款总额<span>{$month_fee}</span></div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
商家支付数据统计
</div>
<div class="panel-body">
<div class="clearfix">
<div id="date" class="pull-left">
{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)), '')}
</div>
</div>
<h4>总收入: ¥<span class="text-success" id="date-total">0.00</span></h4>
<div style="margin-top:20px" id="canvas-date">
<canvas id="dateChart" width="1200" height="300"></canvas>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
商家支付数据统计(月份统计)
</div>
<div class="panel-body">
<div class="clearfix">
<div id="month" class="pull-left">
<div class="input-group" style="width:300px;">
<input type="text" class="form-control datetime" readonly name="time[start]" value="{php echo date('Y-m', strtotime('-6months'));}">
<span class="input-group-addon">到</span>
<input type="text" class="form-control datetime" readonly name="time[end]" value="{php echo date('Y-m');}">
<div class="input-group-btn">
<button class="btn btn-primary" id="search">查询</button>
</div>
</div>
</div>
</div>
<h4>总收入: ¥<span class="text-success" id="month-total">0.00</span></h4>
<div style="margin-top:20px" id="canvas-month">
<canvas id="monthChart" width="1200" height="300"></canvas>
</div>
</div>
</div>
<script>
require(['chart', 'daterangepicker', 'datetimepicker'], function(c) {
$(".datetime").each(function(){
var option = {
lang : "zh",
step : "10",
timepicker : false,
closeOnDateSelect : true,
format : "Y-m"
};
$(this).datetimepicker(option);
});
var chart = null;
var templates = {
flow1: {
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 GetChartData(type) {
var start = $('#' + type + ' input[name="time[start]"]').val();
var end = $('#' + type + ' input[name="time[end]"]').val();
var params = {
type: type,
start: start,
end: end
};
if(type == 'date') {
$('#canvas-date').html('<canvas height="100" id="dateChart"></canvas>');
$.post("{php echo $this->createWeburl('statpaycenter', array('type' => 'date', 'op' => 'chart'));}", params, function(data){
var data = $.parseJSON(data);
var ds = $.extend(true, {}, templates);
ds.flow1.data = data.datasets.flow1;
var lineChartData = {
labels : data.label,
datasets : [ds.flow1]
};
var ctx = document.getElementById("dateChart").getContext("2d");
chart = new Chart(ctx).Line(lineChartData, {
responsive: true
});
$('#date-total').html(data.total);
});
} else {
$('#canvas-month').html('<canvas height="100" id="monthChart"></canvas>');
$.post("{php echo $this->createWeburl('statpaycenter', array('type' => 'month', 'op' => 'chart'));}", params, function(data){
var data = $.parseJSON(data);
var ds = $.extend(true, {}, templates);
ds.flow1.data = data.datasets.flow1;
var lineChartData = {
labels : data.label,
datasets : [ds.flow1]
};
var ctx = document.getElementById("monthChart").getContext("2d");
chart = new Chart(ctx).Line(lineChartData, {
responsive: true
});
$('#month-total').html(data.total);
});
}
}
GetChartData('date');
GetChartData('month');
$('.daterange').on('apply.daterangepicker', function(ev, picker) {
GetChartData('date');
});
$('#search').click(function(){
GetChartData('month');
});
});
</script>
{/if}
<div class="modal fade" id="payinfo-modal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h3 class="modal-title">支付详情</h3>
</div>
<div class="modal-body">
<div class="panel panel-default">
<div class="panel-heading">订单信息</div>
<div class="panel-body">
<table class="table table-hover table-none-border">
<tbody>
<tr>
<th width="145">商品名称:</th>
<td class="js-order-body"></td>
</tr>
<tr>
<th>订单编号:</th>
<td class="js-order-uniontid"></td>
</tr>
<tr>
<th>支付方式:</th>
<td class="js-order-tradetype"></td>
</tr>
<tr>
<th>第三方支付订单id:</th>
<td class="js-order-transaction-id"></td>
</tr>
<tr>
<th>支付者:</th>
<td class="js-order-nickname"></td>
</tr>
<tr>
<th>支付者openid:</th>
<td class="js-order-openid"></td>
</tr>
</tbody>
</table>
</div>
</div>
<table class="table table-hover table-bordered table-center">
<thead>
<tr>
<th>支付金额(元)</th>
<th>支付人</th>
<th width="180">支付时间</th>
<th>状态</th>
</tr>
</thead>
<tr>
<td class="js-order-fee"></td>
<td class="js-order-nickname"></td>
<td class="js-order-paytime"></td>
<td><span class="js-order-status"></span></td>
</tr>
<tr>
<td colspan="4" style="text-align:right">
应收总价:<span class="text-success js-order-fee"></span>
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<script>
require(['jquery.qrcode'], function(){
$('.pay-info').click(function(){
var id = $(this).data('id');
if(!id) {
util.message('订单编号错误', '', 'error');
return false;
}
$.post("{php echo $this->createWeburl('statpaycenter', array('op' => 'detail'));}", {id: id}, function(data) {
var data = $.parseJSON(data);
console.dir(data);
if(data.message.errno == -1) {
util.message(data.message.message, '', 'error');
return false;
} else {
$('.js-order-body').html(data.message.message.order.body);
$('.js-order-uniontid').html(data.message.message.order.uniontid);
if (data.message.message.order.type == 'credit') {
tradetype = data.message.message.types.credit;
} else if (data.message.message.order.type == 'alipay') {
tradetype = data.message.message.types.alipay;
} else if (data.message.message.order.type == 'baifubao') {
tradetype = data.message.message.types.baifubao;
} else if (data.message.message.order.type == 'wechat') {
tradetype = data.message.message.types.wechat;
}
if (data.message.message.order.trade_type == 'jsapi') {
tradetype = tradetype + '-' + data.message.message.trade_types.jsapi + 'jsapi';
} else if (data.message.message.order.trade_type == 'micropay') {
tradetype = tradetype + '-' + data.message.message.trade_types.micropay + 'micropay';
} else if (data.message.message.order.trade_type == 'native') {
tradetype = tradetype + '-' + data.message.message.trade_types.native + 'native';
}
$('.js-order-tradetype').html(tradetype);
if (data.message.message.order.status == '0') {
status_class = 'text-danger';
status_text = '未支付';
} else if (data.message.message.order.status == '1') {
status_class = 'text-success';
status_text = '已支付';
} else if (data.message.message.order.status == '2') {
status_class = 'text-default';
status_text = '已支付,退款中...';
}
$('.js-order-status').addClass(status_class);
$('.js-order-status').html(status_text);
$('.js-order-paytime').html(data.message.message.order.paytime_text);
$('.js-order-transaction-id').html(data.message.message.order.transaction_id);
$('.js-order-nickname').html(data.message.message.order.nickname);
$('.js-order-openid').html(data.message.message.order.openid);
$('.js-order-fee').html('¥ ' + data.message.message.order.fee);
$('#payinfo-modal').modal('show');
return false;
}
});
});
});
</script>
{template 'common/footer'}