退款数据

This commit is contained in:
hant 2025-05-25 23:02:23 +08:00
parent c6979b7129
commit feeae1c5b1
6 changed files with 449 additions and 5 deletions

View File

@ -0,0 +1,87 @@
<?php
namespace app\admin\controller\statistics;
use app\admin\model\Admin;
use app\admin\model\Order;
use app\common\controller\Backend;
use think\Model;
use function Symfony\Component\Clock\now;
/**
* 服务项目统计
*
* @icon fa fa-circle-o
*/
class Aftersale extends Backend
{
protected $relationSearch = true;
public function _initialize()
{
parent::_initialize();
}
public function index()
{
return $this->fetch('index');
}
public function list()
{
$build = new Order();
}
public function dispatch()
{
$build = new Admin();
$build->alias('a')
->join('order b','a.id = b.admin_id','right')
->join('aftersale c','b.id = c.admin_id','left')
->where('b.status',Order::STATUS_FINISHED);
$build->group('a.id');
$build->field(
[
'a.id',
'a.nickname',
'count(b.id) order_total',
'count(c.id) after_total',
]
);
$res = $build->paginate();
$total = $res->total();
$ress = $res->items();
// dd(Admin::getLastSql());
return [
'rows' => $ress,
'total' => $total
];
}
}

View File

@ -0,0 +1,212 @@
<style>
.sm-st {
background: #fff;
padding: 20px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
margin-bottom: 20px;
}
.sm-st-icon {
width: 60px;
height: 60px;
display: inline-block;
line-height: 60px;
text-align: center;
font-size: 30px;
background: #eee;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
float: left;
margin-right: 10px;
color: #fff;
}
.sm-st-info {
padding-top: 2px;
}
.sm-st-info span {
display: block;
font-size: 14px;
font-weight: 600;
}
.orange {
background: #fa8564 !important;
}
.tar {
background: #45cf95 !important;
}
.sm-st .green {
background: #86ba41 !important;
}
.pink {
background: #AC75F0 !important;
}
.yellow-b {
background: #fdd752 !important;
}
.stat-elem {
background-color: #fff;
padding: 18px;
border-radius: 40px;
}
.stat-info {
text-align: center;
background-color: #fff;
border-radius: 5px;
margin-top: -5px;
padding: 8px;
-webkit-box-shadow: 0 1px 0px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 0px rgba(0, 0, 0, 0.05);
font-style: italic;
}
.stat-icon {
text-align: center;
margin-bottom: 5px;
}
.st-red {
background-color: #F05050;
}
.st-green {
background-color: #27C24C;
}
.st-violet {
background-color: #7266ba;
}
.st-blue {
background-color: #23b7e5;
}
.stats .stat-icon {
color: #28bb9c;
display: inline-block;
font-size: 26px;
text-align: center;
vertical-align: middle;
width: 50px;
float: left;
}
.stat {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
}
.stat .value {
font-size: 20px;
line-height: 24px;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 500;
}
.stat .name {
overflow: hidden;
text-overflow: ellipsis;
margin: 5px 0;
}
.stat.lg .value {
font-size: 26px;
line-height: 28px;
}
.stat-col {
margin:0 0 10px 0;
}
.stat.lg .name {
font-size: 16px;
}
.stat-col .progress {
height: 2px;
}
.stat-col .progress-bar {
line-height: 2px;
height: 2px;
}
.item {
padding: 30px 0;
}
#statistics .panel {
min-height: 150px;
}
#statistics .panel h5 {
font-size: 14px;
}
</style>
<div class="panel panel-default panel-intro">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a data-val="first" href="#first" data-toggle="tab">派单员退款</a></li>
<li><a href="#second" data-val="second" data-toggle="tab">城市退款</a></li>
<li><a href="#third" data-val="third" data-toggle="tab">服务项目退款</a></li>
<li><a href="#fourth" data-val="fourth" data-toggle="tab">师傅退款</a></li>
<li><a href="#fiveth" data-val="fiveth" data-toggle="tab">全部退款订单</a></li>
</ul>
</div>
<div class="panel-body" style="height: 100%">
<div id="myTabContent" class="tab-content" style="height: 100%">
<div class="tab-pane fade active in" style="height: 100%" id="first">
<div id="chart-filter-table" style="margin-top:20px;margin-bottom: 30px;">
<div style="display: inline-block;width: 200px;position: relative">
<input type="text" class="form-control datetimerange" data-locale='{"format":"YYYY-MM-DD"}'
placeholder="指定日期" name="filter[daterange]" id="daterange-table" autocomplete="off" style="width: 180px;">
</div>
<!-- 查询按钮 -->
<button class="btn btn-default" id="first-search" style="margin-left: 15px;">查询</button>
</div>
<section class="connectedSortable" style="height: 100%">
<table id="table1" class="table table-striped table-bordered table-hover" width="100%">
</table>
</section>
</div>
<div class="tab-pane fade" id="second">
<table id="table2" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
<div class="tab-pane fade" id="third">
<table id="table3" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
<div class="tab-pane fade" id="fourth">
<table id="table4" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
<div class="tab-pane fade" id="fiveth">
<table id="table5" class="table table-striped table-bordered table-hover" width="100%">
</table>
</div>
</div>
</div>
</div>

View File

@ -1,8 +1,6 @@
define([], function () {
require([], function () {
//绑定data-toggle=addresspicker属性点击事件
console.log('111');
$(document).on('click', "[data-toggle='addresspicker']", function () {
var that = this;
var callback = $(that).data('callback');
@ -22,7 +20,6 @@ define([], function () {
if (city_code){
url += city_code ? "&city_code=" + city_code : "";
}
console.log(url);
Fast.api.open(url, '位置选择', {
callback: function (res) {
input_id && $("#" + input_id).val(res.address).trigger("change");

View File

@ -24,7 +24,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts','echarts-th
var params = {
'daterange': daterange
};
console.log(params);
Fast.api.ajax({
url: 'orderplan/data',

View File

@ -0,0 +1,149 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-theme', 'template', 'addtabs', 'moment','citypicker'], function ($, undefined, Backend, Table, Form, echarts, undefined, Template, Datatable, Moment) {
var Controller = {
index: function () {
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var $targetPanel = $($(this).attr("href"));
var tabVal = $(this).data('val');
if (tabVal === 'first') {
Controller.api.first();
}else if (tabVal === 'second') {
Controller.api.second();
}
});
Controller.api.first();
Controller.api.datepicker();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
},
first: function (){
Table.api.init();
// 表格2
var table = $("#table1");
table.bootstrapTable({
url: 'statistics/aftersale/dispatch',
sortName: 'id',
search: false,
commonSearch: false,
visible: false,
showToggle: false,
showColumns: false,
showExport: true,
searchFormVisible: true,
columns: [
[
{field: 'nickname', title: '项目类型', operate: false},
{field: 'order_total', title: '订单总数', operate: false},
{field: 'after_total', title: '退款订单数', operate: false},
{field: 'after_total', title: '退款率', operate: false},
]
]
});
// 为表格2绑定事件
Table.api.bindevent(table);
$('#first-search').on('click', function () {
const range = $('#daterange-table').val();
let data = '';
if (range !== ''){
data += 'range=' + range;
}
// data = encodeURIComponent(data);
$("#table1").bootstrapTable('refresh',{
url:'statistics/aftersale/dispatch?' + data,
});
});
},
second: function (){
Table.api.init();
// 表格2
var table = $("#table2");
table.bootstrapTable({
url: 'statistics/aftersale/dispatch',
sortName: 'id',
search: false,
commonSearch: false,
visible: false,
showToggle: false,
showColumns: false,
showExport: true,
searchFormVisible: true,
columns: [
[
{field: 'nickname', title: '项目类型', operate: false},
{field: 'order_total', title: '订单总数', operate: false},
{field: 'after_total', title: '退款订单数', operate: false},
{field: 'after_total', title: '退款率', operate: false},
]
]
});
// 为表格2绑定事件
Table.api.bindevent(table);
$('#first-search').on('click', function () {
const range = $('#daterange-table').val();
let data = '';
if (range !== ''){
data += 'range=' + range;
}
// data = encodeURIComponent(data);
$("#table1").bootstrapTable('refresh',{
url:'statistics/aftersale/dispatch?' + data,
});
});
},
datepicker: function () {
var ranges = {};
ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
ranges[__('今年')] = [Moment().startOf('year'), Moment().endOf('year')];
var options = {
timePicker: false,
autoUpdateInput: false,
timePickerSeconds: true,
timePicker24Hour: true,
autoApply: true,
locale: {
format: 'YYYY-MM-DD',
customRangeLabel: __("Custom Range"),
applyLabel: __("Apply"),
cancelLabel: __("Clear"),
},
ranges: ranges,
};
var callback = function (start, end) {
$(this.element).val(start.format(options.locale.format) + " - " + end.format(options.locale.format));
};
require(['bootstrap-daterangepicker'], function () {
$(".datetimerange").each(function () {
$(this).on('apply.daterangepicker', function (ev, picker) {
callback.call(picker, picker.startDate, picker.endDate);
var label = picker.chosenLabel;
$(picker.element).data('label', label).trigger("change");
});
$(this).on('cancel.daterangepicker', function (ev, picker) {
$(this).val('');
});
$(this).daterangepicker($.extend({}, options), callback);
});
});
},
}
};
return Controller;
});

View File

@ -80,7 +80,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
if (area_id !== ''){
data += 'area_id=' + area_id+'&';
}
if (area_id !== ''){
if (range !== ''){
data += 'range=' + range;
}
// data = encodeURIComponent(data);