From b2d1d204a1d49e19980d7c1424f96021019ca429 Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 6 Aug 2020 17:05:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=8D=E5=8A=A1=E5=95=86?= =?UTF-8?q?=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LanzuMpWithdrawController.php | 94 ++++++++++++++----- app/Models/LanzuMmWithdraw.php | 2 +- app/Models/LanzuMpWithdraw.php | 9 +- 3 files changed, 78 insertions(+), 27 deletions(-) diff --git a/app/Admin/Controllers/LanzuMpWithdrawController.php b/app/Admin/Controllers/LanzuMpWithdrawController.php index d825193..e0ebf19 100755 --- a/app/Admin/Controllers/LanzuMpWithdrawController.php +++ b/app/Admin/Controllers/LanzuMpWithdrawController.php @@ -18,18 +18,24 @@ class LanzuMpWithdrawController extends AdminController */ protected function grid() { - return Grid::make(new LanzuMpWithdraw(), function (Grid $grid) { + return Grid::make(new LanzuMpWithdraw(['mpInfo']), function (Grid $grid) { $grid->id->sortable(); - $grid->mp_id; + $grid->column('mpInfo.name','服务商名字'); $grid->money; - $grid->status; + $grid->status('提现状态')->using([-1=>'拒绝',0=>'审核中',1=>'通过']) + ->label([-1=>'danger',0=>'default',1=>'success']); $grid->created_at; - $grid->updated_at->sortable(); - $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); }); + + $grid->actions(function (Grid\Displayers\Actions $actions) { + $actions->disableDelete(); + // $actions->disableEdit(); + $actions->disableQuickEdit(); + $actions->disableView(); + }); }); } @@ -42,9 +48,10 @@ class LanzuMpWithdrawController extends AdminController */ protected function detail($id) { - return Show::make($id, new LanzuMpWithdraw(), function (Show $show) { + return Show::make($id, new LanzuMpWithdraw(['mpInfo']), function (Show $show) { $show->id; $show->mp_id; + $show->column('服务商名称','mpInfo.name'); $show->money; $show->status; $show->created_at; @@ -58,21 +65,74 @@ class LanzuMpWithdrawController extends AdminController * @return Form */ - public function mpForm(){ + protected function lanzu_bis_form(){ + //管理员或者lanzu_bis操作 + return Form::make(new LanzuMpWithdraw(['mpInfo']), function (Form $form) { + + $form->footer(function ($footer) { + // 去掉`查看`checkbox + $footer->disableViewCheck(); + // 去掉`继续编辑`checkbox + $footer->disableEditingCheck(); + // 去掉`继续创建`checkbox + $footer->disableCreatingCheck(); + }); + + + $form->tools(function (Form\Tools $tools) { + // 去掉跳转详情页按钮 + $tools->disableView(); + // 去掉删除按钮 + $tools->disableDelete(); + $tools->disableList(); + }); + + // dd($form->model()->mp_info['name']); + $mpName = $form->model()->mp_info['name']; + //dd( $mpName); + $form->display('id'); + $form->text('mp_id','服务商ID')->disable(); + $form->display('','服务商名')->value($mpName); + $form->text('money','提现金额')->disable()->required(); + $form->hidden('is_operated'); + $form->saving(function (Form $form) { + $form->is_operated = 1; + }); + + if($form->model()->is_operated){ + $status = ''; + if($form->model()->status==1){ + $status = '审核通过'; + } + if($form->model()->status==-1){ + $status = '拒绝'; + } + $form->display('','审核状态')->value($status); + $form->disableSubmitButton(); + $form->disableResetButton(); + }else{ + $form->radio('status')->options([1 => '通过审核', -1=> '拒绝'])->default(-1);; + } + + }); + } + + protected function form() + { $current_user = Admin::user(); + if(!$current_user->isRole('lanzu_mp')){ + return $this->lanzu_bis_form(); + } + //如果是服务商角色 $mp = MpBalance::where('user_id',$current_user->id) ->where('user_type',1)->first(); - $balance = 0; - if($mp){ $balance = $mp->balance; } - - return Form::make(new LanzuMpWithdraw(), function (Form $form) use($current_user,$balance) { $form->footer(function ($footer) { @@ -101,16 +161,4 @@ class LanzuMpWithdrawController extends AdminController //$form->text('status'); }); } - protected function form() - { - return Form::make(new LanzuMpWithdraw(), function (Form $form) { - $form->display('id'); - $form->text('mp_id'); - $form->text('money'); - $form->text('status'); - - $form->display('created_at'); - $form->display('updated_at'); - }); - } } diff --git a/app/Models/LanzuMmWithdraw.php b/app/Models/LanzuMmWithdraw.php index 85d7ead..a3b6322 100644 --- a/app/Models/LanzuMmWithdraw.php +++ b/app/Models/LanzuMmWithdraw.php @@ -15,7 +15,7 @@ class LanzuMmWithdraw extends Model public function mmInfo() { - return $this->hasOne('\App\Models\LanzuMpInfo','id','mm_id'); + return $this->hasOne('\App\Models\LanzuMmInfo','id','mm_id'); } } diff --git a/app/Models/LanzuMpWithdraw.php b/app/Models/LanzuMpWithdraw.php index 0227017..fa0cdb8 100755 --- a/app/Models/LanzuMpWithdraw.php +++ b/app/Models/LanzuMpWithdraw.php @@ -2,16 +2,19 @@ namespace App\Models; -use Dcat\Admin\Traits\HasDateTimeFormatter; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Model; class LanzuMpWithdraw extends Model { - use HasDateTimeFormatter; - use SoftDeletes; + use SoftDeletes; + protected $dateFormat = 'U'; protected $table = 'lanzu_mp_withdraw'; + public function mpInfo() + { + return $this->hasOne('\App\Models\LanzuMpInfo','id','mp_id'); + } }