补充调整
parent
32ece21276
commit
758972213b
|
|
@ -23,7 +23,7 @@ class DealerBonds extends RowAction
|
|||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.dealer.bonds');
|
||||
return $user->can('dcat.admin.dealers.bonds');
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class DealerOrderPaid extends RowAction
|
|||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.dealer.paid');
|
||||
return $user->can('dcat.admin.dealers.paid');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class DealerOrderShipping extends RowAction
|
|||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.dealer.shipping');
|
||||
return $user->can('dcat.admin.dealers.shipping');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -114,8 +114,8 @@ class AppVersionController extends AdminController
|
|||
->saveFullUrl()
|
||||
->removable(false)
|
||||
->autoSave(false)
|
||||
->autoUpload()->rules('required_if:cate,2', ['required_if'=>'安卓平台需要上传应用包'])->customFormat(function ($v) {
|
||||
if ($this->model()->cate == 2) {
|
||||
->autoUpload()->rules('required_if:cate,2,3', ['required_if'=>'安卓平台需要上传应用包'])->customFormat(function ($v) {
|
||||
if (in_array($this->model()->cate, [2, 3])) {
|
||||
$v = $this->model()->apk_link;
|
||||
}
|
||||
return $v;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use App\Admin\Actions\Grid\DealerOrderAllocate;
|
||||
use App\Admin\Actions\Grid\DealerOrderPaid;
|
||||
use App\Admin\Actions\Grid\DealerOrderShipping;
|
||||
use App\Admin\Repositories\DealerOrder;
|
||||
|
|
@ -66,14 +67,17 @@ class DealerOrderController extends AdminController
|
|||
$grid->model()->orderBy('created_at', 'desc');
|
||||
// $grid->column('updated_at')->sortable();
|
||||
$grid->actions(function (Grid\Displayers\Actions $actions) {
|
||||
if (Admin::user()->can('dcat.admin.orders.show')) {
|
||||
if (Admin::user()->can('dcat.admin.dealer_orders.show')) {
|
||||
$actions->append('<a style="cursor: pointer;" target="_blank" href="'.admin_route('dealer_orders.show', ['dealer_order'=>$actions->row]).'"><i class="feather icon-eye"></i> 显示 </a>');
|
||||
// $actions->disableView(false);
|
||||
}
|
||||
if ($actions->row->status == DealerOrderStatus::Confirming && Admin::user()->can('dcat.admin.dealers_orders.paid')) {
|
||||
if (!(empty($actions->row->consignor) || $actions->row->consignor_id == 1) && $actions->row->status == DealerOrderStatus::Pending && Admin::user()->can('dcat.admin.dealer_orders.allocate')) {
|
||||
$actions->append(new DealerOrderAllocate());
|
||||
}
|
||||
if ($actions->row->status == DealerOrderStatus::Confirming && Admin::user()->can('dcat.admin.dealer_orders.paid')) {
|
||||
$actions->append(new DealerOrderPaid());
|
||||
}
|
||||
if ((empty($actions->row->consignor) || $actions->row->consignor_id == 1) && $actions->row->status == DealerOrderStatus::Paid && Admin::user()->can('dcat.admin.dealers_orders.shipping')) {
|
||||
if ((empty($actions->row->consignor) || $actions->row->consignor_id == 1) && $actions->row->status == DealerOrderStatus::Paid && Admin::user()->can('dcat.admin.dealer_orders.shipping')) {
|
||||
$actions->append(new DealerOrderShipping());
|
||||
}
|
||||
});
|
||||
|
|
@ -81,6 +85,7 @@ class DealerOrderController extends AdminController
|
|||
$filter->panel();
|
||||
$filter->equal('user.phone')->width(3);
|
||||
$filter->equal('consignor.phone')->width(3);
|
||||
$filter->equal('sn')->width(3);
|
||||
// $filter->equal('id');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ class SettingController extends AdminController
|
|||
case 'unipush':
|
||||
$tab->addLink('系统配置', admin_route('settings.index', ['type'=>'app']));
|
||||
$tab->addLink('会员奖励配置', admin_route('settings.index', ['type'=>'distribution']));
|
||||
$tab->addLink('经销商配置', admin_route('settings.index', ['type'=>'dealer']));
|
||||
$tab->addLink('提现配置', admin_route('settings.index', ['type'=>'withdraw']));
|
||||
$tab->addLink('Ios配置', admin_route('settings.index', ['type'=>'ios']));
|
||||
$tab->addLink('Android配置', admin_route('settings.index', ['type'=>'android']));
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class DealerBonds extends Form implements LazyRenderable
|
|||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.dealer.bonds');
|
||||
return $user->can('dcat.admin.dealers.bonds');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Actions\Grid;
|
||||
|
||||
use App\Models\DealerOrder;
|
||||
use App\Services\Dealer\OrderService;
|
||||
use Dcat\Admin\Grid\RowAction;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
||||
class DealerOrderAllocate extends RowAction
|
||||
{
|
||||
public function title()
|
||||
{
|
||||
if ($this->title) {
|
||||
return $this->title;
|
||||
}
|
||||
return '<i class="feather icon-stop-circle grid-action-icon"></i> 分配订单 ';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model|Authenticatable|HasPermissions|null $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize($user): bool
|
||||
{
|
||||
return $user->can('dcat.admin.dealer_orders.allocate');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the action request.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function handle(Request $request)
|
||||
{
|
||||
$order = DealerOrder::findOrFail($this->getKey());
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
(new OrderService())->updateOrderConsignor($order);
|
||||
DB::commit();
|
||||
} catch (Throwable $th) {
|
||||
DB::rollBack();
|
||||
report($th);
|
||||
return $this->response()->error('操作失败,'.$th->getMessage())->refresh();
|
||||
}
|
||||
|
||||
return $this->response()->success('操作成功')->refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|array|void
|
||||
*/
|
||||
public function confirm()
|
||||
{
|
||||
return ['确认自动分配当前订单接单人?', '确认后将无法逆操作'];
|
||||
}
|
||||
}
|
||||
|
|
@ -50,7 +50,10 @@ class EarningController extends Controller
|
|||
*/
|
||||
public function show($id, Request $request)
|
||||
{
|
||||
$earning = $request->user()->dealerEarnings()->with('earningable')->findOrFail($id);
|
||||
$user = $request->user();
|
||||
$earning = DealerEarning::where(function ($q) use ($user) {
|
||||
return $q->where('user_id', $user->id)->orWhere('payer_id', $user->id);
|
||||
})->with('earningable')->findOrFail($id);
|
||||
return DealerEarningResource::make($earning);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -305,6 +305,7 @@ class AdminPermissionSeeder extends Seeder
|
|||
'children' =>[
|
||||
'paid'=>['name' =>'确认收款'],
|
||||
'shipping'=>['name' =>'确认发货'],
|
||||
'allocate'=>['name' =>'自动分配'],
|
||||
],
|
||||
],
|
||||
'dealer-earnings'=>[
|
||||
|
|
|
|||
Loading…
Reference in New Issue