From 9d998b418383b4e49086a611df5ef225481975ce Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 17 Jan 2022 13:26:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DealerOrderController.php | 29 +++++-------------- app/Admin/routes.php | 2 +- .../Controllers/Dealer/ProductController.php | 2 +- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/app/Admin/Controllers/DealerOrderController.php b/app/Admin/Controllers/DealerOrderController.php index 42f359bf..0fd9fdd1 100644 --- a/app/Admin/Controllers/DealerOrderController.php +++ b/app/Admin/Controllers/DealerOrderController.php @@ -11,6 +11,7 @@ use Dcat\Admin\Form; use Dcat\Admin\Grid; use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Show; +use Dcat\Admin\Show\Row; class DealerOrderController extends AdminController { @@ -53,6 +54,9 @@ class DealerOrderController extends AdminController $grid->column('created_at')->sortable(); // $grid->column('updated_at')->sortable(); $grid->actions(function (Grid\Displayers\Actions $actions) { + if (Admin::user()->can('dcat.admin.orders.show')) { + $actions->disableView(false); + } if ($actions->row->status == DealerOrderStatus::Confirming && Admin::user()->can('dcat.admin.dealers_orders.paid')) { $actions->append(new DealerOrderPaid()); } @@ -76,27 +80,10 @@ class DealerOrderController extends AdminController */ protected function detail($id) { - return Show::make($id, new DealerOrder(), function (Show $show) { - $show->field('id'); - $show->field('sn'); - $show->field('user_id'); - $show->field('consignor_id'); - $show->field('total_amount'); - $show->field('status'); - $show->field('settle_state'); - $show->field('consignee_name'); - $show->field('consignee_telephone'); - $show->field('consignee_zone'); - $show->field('consignee_address'); - $show->field('pay_info'); - $show->field('pay_image'); - $show->field('pay_time'); - $show->field('paied_time'); - $show->field('shipping_time'); - $show->field('shippinged_time'); - $show->field('created_at'); - $show->field('updated_at'); - }); + return function (Row $row) use ($id) { + $row->column(5, function ($column) use ($id) { + }); + }; } /** diff --git a/app/Admin/routes.php b/app/Admin/routes.php index ddcf6fd3..a0a4bee8 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -165,7 +165,7 @@ Route::group([ //经销商 $router->resource('dealer-products', 'DealerProductController')->names('dealer_products'); $router->resource('dealer-orders', 'DealerOrderController')->only([ - 'index', 'edit', 'update', + 'index', 'show', 'edit', 'update', ])->names('dealer_orders'); $router->resource('dealer-users', 'DealerController')->only([ 'index', diff --git a/app/Endpoint/Api/Http/Controllers/Dealer/ProductController.php b/app/Endpoint/Api/Http/Controllers/Dealer/ProductController.php index 4275f950..fd96da94 100644 --- a/app/Endpoint/Api/Http/Controllers/Dealer/ProductController.php +++ b/app/Endpoint/Api/Http/Controllers/Dealer/ProductController.php @@ -27,7 +27,7 @@ class ProductController extends Controller public function show($id, Request $request) { - $product = DealerProduct::with(['saleRules'])->online()->findOrFail($id); + $product = DealerProduct::with(['saleRules', 'lvlRules'])->online()->findOrFail($id); return ProductResource::make($product); } }