From 1f2fb55c25eba9c4143e47145c97a06af2a756ad Mon Sep 17 00:00:00 2001 From: lanzu_qsy <334039090@qq.com> Date: Tue, 11 Aug 2020 09:13:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=82=E5=9C=BA=E7=BB=8F?= =?UTF-8?q?=E7=90=86=E9=9D=A2=E6=9D=BF,=20=E6=98=BE=E7=A4=BA=E5=B8=82?= =?UTF-8?q?=E5=9C=BA=E7=BB=8F=E7=90=86=E6=8F=90=E7=8E=B0=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LanzuMmWithdrawController.php | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/app/Admin/Controllers/LanzuMmWithdrawController.php b/app/Admin/Controllers/LanzuMmWithdrawController.php index 5cfe71b..36accda 100644 --- a/app/Admin/Controllers/LanzuMmWithdrawController.php +++ b/app/Admin/Controllers/LanzuMmWithdrawController.php @@ -25,6 +25,7 @@ class LanzuMmWithdrawController extends AdminController { $user = Admin::user(); $buider = new LanzuMmWithdraw(); + //服务商只能看到自己的市场经理提现 $mp_info = mpInfo::where('admin_user_id', $user->id)->first(); if ($mp_info) { $mk = ImsCjdcMarket::where('mp_id', $mp_info->id)->get()->pluck('id'); @@ -35,7 +36,15 @@ class LanzuMmWithdrawController extends AdminController $ids = LanzuMmInfo::whereIn('market_id', $mk_ids)->pluck('id'); $buider = MmWithdraw::with('mmInfo')->whereIn('mm_id', $ids); } - return Grid::make($buider, function (Grid $grid) use ($mp_info) { + + //市场经理只能看到自己的提现 + $mm_id = LanzuMmInfo::where('admin_user_id', $user->id)->pluck('id')->first(); + if ($mm_id){ + $buider = MmWithdraw::where('mm_id',$mm_id); + + } + + return Grid::make($buider, function (Grid $grid) use ($mp_info,$mm_id) { $grid->actions(function (Grid\Displayers\Actions $actions) use ($grid) { if ($actions->row->status != 0) { @@ -63,6 +72,11 @@ class LanzuMmWithdrawController extends AdminController $filter->equal('id'); }); + if ($mm_id){ + //如果是市场经理登陆,禁用编辑操作 + $grid->disableEditButton(); + $grid->disableDeleteButton(); + } }); } @@ -92,8 +106,10 @@ class LanzuMmWithdrawController extends AdminController */ protected function form() { + + $current_user = Admin::user(); $mmId = $this->getMmId(Admin::user()->id); - return Form::make(new LanzuMmWithdraw(), function (Form $form) use ($mmId) { + return Form::make(new LanzuMmWithdraw(), function (Form $form) use ($mmId,$current_user) { $form->display('id'); $form->hidden('mm_id')->value($mmId); $form->display('可提现金额')->value($this->getBalance(Admin::user()->id)); @@ -128,7 +144,12 @@ class LanzuMmWithdrawController extends AdminController } } }); - $form->text('money')->required(); + if ($current_user->isRole('lanzu_mm')){ + $form->text('money')->required(); + }else{ + $form->text('money')->required()->disable(); + } + } }); }