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