优化访问
This commit is contained in:
@@ -5,7 +5,6 @@ namespace App\Admin\Controllers\Finance;
|
||||
use App\Admin\Actions\Coupon\Batch;
|
||||
use App\Admin\Actions\Coupon\BatchProfit;
|
||||
use App\Admin\Actions\Coupon\BatchProfits;
|
||||
use App\Admin\Exporters\CouponPassExport;
|
||||
use App\Models\Coupon;
|
||||
use App\Models\User;
|
||||
use Encore\Admin\Controllers\AdminController;
|
||||
@@ -25,7 +24,7 @@ class IndexController extends AdminController
|
||||
protected function grid()
|
||||
{
|
||||
$grid = new Grid(new Coupon);
|
||||
$grid->model()->where('profit', '>', 0);
|
||||
$grid->model()->with(['outlet', 'user', 'user.info'])->where('profit', '>', 0);
|
||||
$grid->disableCreateButton();
|
||||
$grid->disableBatchActions(false);
|
||||
|
||||
@@ -63,7 +62,7 @@ class IndexController extends AdminController
|
||||
->where('type', 'pingan')
|
||||
->get()
|
||||
->pluck('nickname', 'id');
|
||||
|
||||
|
||||
$filter->equal('user_id', '渠道')->select($users);
|
||||
});
|
||||
$filter->column(1 / 2, function ($filter) {
|
||||
@@ -124,16 +123,17 @@ class IndexController extends AdminController
|
||||
$grid->column('created_at', '核销时间');
|
||||
|
||||
$grid->footer(function ($query) {
|
||||
$all = $query->get();
|
||||
$pass = $query->where('status', 2)->get();
|
||||
$reject = $query->where('status', 3)->get();
|
||||
$total = $query->count();
|
||||
$success = $query->where('status', 2)->count();
|
||||
$faield = $total - $success;
|
||||
|
||||
return '<label class="label label-success">全部:' . $all->count() . '张</label> '
|
||||
. '<label class="label label-success">核销金额:' . $pass->sum('price') . '元</label> '
|
||||
. '<label class="label label-success">资金通道结算:' . $pass->sum('profit') . '元</label> '
|
||||
. '<label class="label label-success">打款金额:' . $pass->where('is_profit', 1)
|
||||
->sum('profit') . '元</label> ';
|
||||
return '<label class="label label-success">全部:' . $total . '张</label> '
|
||||
. '<label class="label label-success">核销金额:' . $query->sum('price') . '元</label> '
|
||||
. '<label class="label label-success">资金通道结算:' . $query->sum('profit') . '元</label> '
|
||||
. '<label class="label label-success">打款金额:' . $query->where('is_profit', 1)
|
||||
->sum('profit') . '元</label> ';
|
||||
});
|
||||
|
||||
$grid->disableExport(false);
|
||||
|
||||
$grid->export(function ($export) {
|
||||
|
||||
Reference in New Issue
Block a user