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'); + } }