From d1a424776bfedabc4a41837840f7f1b9f15109e3 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Tue, 25 Jan 2022 10:15:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=B9=E9=9B=B6=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=98=BE=E7=A4=BA=E6=B8=A0=E9=81=93=E8=A1=A5=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DealerOrderController.php | 22 +++++++++++++++++++ app/Models/DealerChannelSubsidyLog.php | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/app/Admin/Controllers/DealerOrderController.php b/app/Admin/Controllers/DealerOrderController.php index 7cad5bf6..1b58c166 100644 --- a/app/Admin/Controllers/DealerOrderController.php +++ b/app/Admin/Controllers/DealerOrderController.php @@ -8,6 +8,7 @@ use App\Admin\Actions\Grid\DealerOrderShipping; use App\Admin\Actions\Show\DealerOrderRemark; use App\Admin\Repositories\DealerOrder; use App\Enums\DealerOrderStatus; +use App\Models\DealerChannelSubsidyLog; use App\Models\DealerOrderProduct; use Dcat\Admin\Admin; use Dcat\Admin\Form; @@ -205,6 +206,27 @@ class DealerOrderController extends AdminController $grid->disableRefreshButton(); }); $column->row(Box::make('订单商品', $productGrid)); + //显示渠道补贴明细 + // $channelSubsidy = ''; + $builder = DealerChannelSubsidyLog::with(['user', 'earning'])->where('order_id', $id); + $channelSubsidy = Grid::make($builder, function (Grid $grid) { + $grid->column('user.phone', '手机号'); + $grid->column('lvl', '等级')->display(function () { + return $this->lvl->text(); + // return $this->lvl_text; + }); + $grid->column('total_amount', '补贴金额'); + $grid->column('remark', '备注'); + $grid->column('earning.id', '操作')->display(function () { + return '查看'; + })->link(function ($value) { + return admin_route('dealer_earnings.show', ['dealer_earning'=>$this->earning->id]); + }); + $grid->disableActions(); + $grid->disablePagination(); + $grid->disableRefreshButton(); + }); + $column->row(Box::make('渠道补贴', $channelSubsidy)); }); }; } diff --git a/app/Models/DealerChannelSubsidyLog.php b/app/Models/DealerChannelSubsidyLog.php index 64905fc3..822d30c5 100644 --- a/app/Models/DealerChannelSubsidyLog.php +++ b/app/Models/DealerChannelSubsidyLog.php @@ -25,4 +25,9 @@ class DealerChannelSubsidyLog extends Model { return $this->morphOne(DealerEarning::class, 'earningable'); } + + public function user() + { + return $this->belongsTo(User::class, 'user_id'); + } }