This commit is contained in:
2020-10-13 09:18:41 +08:00
parent d8cd8ae9a6
commit 59cf8a26c4
4 changed files with 32 additions and 31 deletions

View File

@@ -2,7 +2,6 @@
namespace App\Admin\Controllers\Activity;
use App\Admin\Renderable\Activity\Grants;
use App\Models\Activity;
use App\Models\ActivityGrant;
use App\Models\ActivityRule;
@@ -87,6 +86,7 @@ class IndexController extends AdminController
$query->where('identity_id', 1);
})->get()->pluck('nickname', 'id');
$filter->equal('user_id', '渠道')->select($users);
});
$filter->column(1 / 2, function ($filter) {
@@ -100,6 +100,10 @@ class IndexController extends AdminController
$grid->column('title', '活动名称');
$grid->column('code', '活动编号');
$grid->column('rule.code', '卡券规则');
$grid->column('所属')->display(function () {
return $this->user_id ? $this->user->nickname : '系统';
});
$grid->column('类型')->display(function () {
return $this->type_text;
});
@@ -107,20 +111,6 @@ class IndexController extends AdminController
$grid->column('days', '延期(天)');
$grid->column('rule.full', '满足金额');
$grid->column('rule.take', '扣除金额');
$grid->column('发券')
->display(function () {
return $this->grants->pluck('user_nickname');
})
->label()
->hide();
$grid->column('核券')
->display(function () {
return $this->verifications->pluck('user_nickname');
})
->label()
->hide();
$grid->column('开始时间')->display(function () {
return $this->type == Activity::TYPE_SCOPE ? $this->start_at->format('Y-m-d') : '---';
});

View File

@@ -13,7 +13,7 @@ use Encore\Admin\Grid;
class IndexController extends AdminController
{
protected $title = '渠道打款处理';
protected $title = '平安渠道打款处理';
/**
* Notes:
@@ -59,6 +59,7 @@ class IndexController extends AdminController
->whereHas('identity', function ($query) {
$query->where('identity_id', 1);
})
->where('type', 'pingan')
->get()
->pluck('nickname', 'id');

View File

@@ -33,10 +33,12 @@ class LogController extends AdminController
$grid->filter(function ($filter) {
$filter->column(1 / 2, function ($filter) {
$filter->between('paid_at', '打款时间')->datetime();
$users = User::whereHas('identity', function ($query) {
$query->where('identity_id', 1);
})->get()->pluck('nickname', 'id');
$users = User::query()
->whereHas('identity', function ($query) {
$query->where('identity_id', 1);
})
->get()
->pluck('nickname', 'id');
$filter->equal('user_id', '渠道')->select($users);
});
$filter->column(1 / 2, function ($filter) {

View File

@@ -17,40 +17,48 @@ class HomeController extends Controller
{
return $content
->title('数据看版1')
->title('数据看版2')
->row(function (Row $row) {
$row->column(2, function (Column $column) {
$column->append(new InfoBox('渠道商', 'users', 'yellow', '/admin/users?identity[identity_id]=1', User::whereHas('identity', function ($q) {$q->where('identity_id', 1);})->count()));
$column->append(new InfoBox('渠道商', 'users', 'yellow', '/admin/users?identity[identity_id]=1', User::whereHas('identity', function ($q) { $q->where('identity_id', 1); })
->count()));
});
})
->row(function (Row $row) {
$row->column(2, function (Column $column) {
$column->append(new InfoBox('核销卡券总数', '', 'blue', '/admin/coupons', Coupon::whereIn('status', [2, 3])->count()));
$column->append(new InfoBox('核销卡券总数', '', 'blue', '/admin/coupons', Coupon::whereIn('status', [2, 3])
->count()));
});
$row->column(2, function (Column $column) {
$column->append(new InfoBox('核销成功', '', 'blue', '/admin/coupons', Coupon::where('status', 2)->count()));
$column->append(new InfoBox('核销成功', '', 'blue', '/admin/coupons', Coupon::where('status', 2)
->count()));
});
$row->column(2, function (Column $column) {
$column->append(new InfoBox('核销失败', '', 'black', '/admin/coupons', Coupon::where('status', 3)->count()));
$column->append(new InfoBox('核销失败', '', 'black', '/admin/coupons', Coupon::where('status', 3)
->count()));
});
$row->column(2, function (Column $column) {
$column->append(new InfoBox('资金通道结算', '', 'red', '/admin/coupons', Coupon::where('status', 2)->sum('price')));
$column->append(new InfoBox('资金通道结算', '', 'red', '/admin/coupons', Coupon::where('status', 2)
->sum('price')));
});
$row->column(2, function (Column $column) {
$column->append(new InfoBox('应打款金额', '', 'green', '/admin/coupons', Coupon::where('status', 2)->sum('profit')));
$column->append(new InfoBox('应打款金额', '', 'green', '/admin/coupons', Coupon::where('status', 2)
->sum('profit')));
});
$row->column(2, function (Column $column) {
$column->append(new InfoBox('已打款金额', '', 'green', '/admin/coupons', Coupon::where('status', 2)->where('is_profit', 1)->sum('profit')));
$column->append(new InfoBox('已打款金额', '', 'green', '/admin/coupons', Coupon::where('status', 2)
->where('is_profit', 1)
->sum('profit')));
});
})
->row(function (Row $row) {
$coupons = Coupon::where('status', 2)
->whereDate('created_at', now()->format('Y-m-d'))
->get();
$lists = [
->whereDate('created_at', now()->format('Y-m-d'))
->get();
$lists = [
'ysd10' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-10')->count(),
'ysd25' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-25')->count(),
'ysd50' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-50')->count(),