setResource('dealer-earnings'); $grid->column('id')->sortable(); $grid->column('user.phone'); $grid->column('type_name')->display(function () { return $this->type_name; })->label()->filter(Grid\Column\Filter\In::make([ (new DealerManagerSubsidy())->getMorphClass() =>'管理者补贴', (new DealerManageSubsidy())->getMorphClass() =>'管理补贴', (new DealerChannelSubsidyLog())->getMorphClass() =>'渠道补贴', (new DealerPurchaseSubsidy())->getMorphClass() =>'进货补贴', ])->setColumnName('earningable_type')); // $grid->column('earningable_type'); // $grid->column('earningable_id'); $grid->column('lvl')->display(function () { return $this->lvl_text; }); $grid->column('is_manager')->bool(); $grid->column('total_amount')->prepend('¥'); $grid->column('fee_rate')->append('%'); $grid->column('fee')->prepend('¥'); $grid->column('total_earnings')->prepend('¥'); $grid->column('payer_id'); // $grid->column('pay_info'); $grid->column('pay_at'); $grid->column('settle_at'); $grid->column('status_format')->display(function ($value) { return $this->status_format; })->using([ -1=> '待结算', 0 => '待打款', 1 => '待收款', 2 => '已完成', ])->dot(); $grid->column('remark'); // $grid->column('pay_image'); $grid->column('created_at')->sortable(); $grid->actions(function (Grid\Displayers\Actions $actions) { //如果不是渠道补贴添加详情显示 if ($actions->row->earningable_type != (new DealerChannelSubsidyLog())->getMorphClass()) { $actions->append(' 显示   '); } //如果打款人为空,且待打款,则系统打款 }); $grid->filter(function (Grid\Filter $filter) { $filter->panel(); $filter->equal('user.phone')->width(3); }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return function (Row $row) use ($id) { $row->column(5, function ($column) use ($id) { $builder = DealerEarning::with(['user', 'payer']); $column->row(Show::make($id, $builder, function (Show $show) { $show->field('id'); $show->field('user.phone'); // $show->field('earningable_type'); // $show->field('earningable_id'); $show->field('lvl'); $show->field('is_manager'); $show->field('total_amount'); $show->field('total_earnings'); $show->field('fee'); $show->field('fee_rate'); $show->field('payer_id'); // $show->field('pay_info'); $show->field('pay_at'); $show->field('settle_at'); // $show->field('status'); $show->field('remark'); $show->field('pay_image'); $show->field('created_at'); // $show->field('updated_at'); $show->panel() ->tools(function (Show\Tools $tools) use ($show) { $tools->disableEdit(); $tools->disableDelete(); }); })); }); $row->column(7, function ($column) use ($id) { $column->row(Box::make('明细记录', '')); }); }; } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new DealerEarning(), function (Form $form) { $form->display('id'); $form->text('user_id'); $form->text('earningable_type'); $form->text('earningable_id'); $form->text('lvl'); $form->text('is_manager'); $form->text('total_amount'); $form->text('total_earnings'); $form->text('fee'); $form->text('fee_rate'); $form->text('payer_id'); $form->text('pay_info'); $form->text('pay_at'); $form->text('settle_at'); $form->text('status'); $form->text('remark'); $form->text('pay_image'); $form->display('created_at'); $form->display('updated_at'); }); } }