调整后台订单
parent
9d998b4183
commit
24d2bf4b3a
|
|
@ -6,12 +6,14 @@ use App\Admin\Actions\Grid\DealerOrderPaid;
|
|||
use App\Admin\Actions\Grid\DealerOrderShipping;
|
||||
use App\Admin\Repositories\DealerOrder;
|
||||
use App\Enums\DealerOrderStatus;
|
||||
use App\Models\DealerOrderProduct;
|
||||
use Dcat\Admin\Admin;
|
||||
use Dcat\Admin\Form;
|
||||
use Dcat\Admin\Grid;
|
||||
use Dcat\Admin\Http\Controllers\AdminController;
|
||||
use Dcat\Admin\Layout\Row;
|
||||
use Dcat\Admin\Show;
|
||||
use Dcat\Admin\Show\Row;
|
||||
use Dcat\Admin\Widgets\Box;
|
||||
|
||||
class DealerOrderController extends AdminController
|
||||
{
|
||||
|
|
@ -52,10 +54,13 @@ class DealerOrderController extends AdminController
|
|||
// $grid->column('shipping_time');
|
||||
// $grid->column('shippinged_time');
|
||||
$grid->column('created_at')->sortable();
|
||||
|
||||
$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')) {
|
||||
$actions->disableView(false);
|
||||
$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')) {
|
||||
$actions->append(new DealerOrderPaid());
|
||||
|
|
@ -82,6 +87,46 @@ class DealerOrderController extends AdminController
|
|||
{
|
||||
return function (Row $row) use ($id) {
|
||||
$row->column(5, function ($column) use ($id) {
|
||||
$builder = DealerOrder::with(['user', 'consignor']);
|
||||
$column->row(Show::make($id, $builder, function (Show $show) {
|
||||
$show->field('sn');
|
||||
$show->field('order_status')->as(function ($v) {
|
||||
return $this->order_status;
|
||||
})->using(DealerOrderStatus::texts())->dot([
|
||||
DealerOrderStatus::Pending->value => 'primary',
|
||||
DealerOrderStatus::Paying->value => 'danger',
|
||||
DealerOrderStatus::Confirming->value => 'warning',
|
||||
DealerOrderStatus::Paid->value => 'danger',
|
||||
DealerOrderStatus::Shipped->value => 'warning',
|
||||
DealerOrderStatus::Completed->value => 'success',
|
||||
DealerOrderStatus::Cancelled->value => '#b3b9bf',
|
||||
]);
|
||||
$show->divider();
|
||||
$show->field('consignee_name');
|
||||
$show->field('consignee_telephone');
|
||||
$show->field('consignee', '收货地址')->as(function () {
|
||||
return $this->consignee_zone . ' '. $this->consignee_address;
|
||||
});
|
||||
$show->panel()
|
||||
->tools(function (Show\Tools $tools) use ($show) {
|
||||
$tools->disableEdit();
|
||||
$tools->disableDelete();
|
||||
});
|
||||
}));
|
||||
});
|
||||
$row->column(7, function ($column) use ($id) {
|
||||
$builder = DealerOrderProduct::where('order_id', $id);
|
||||
$productGrid = Grid::make($builder, function (Grid $grid) {
|
||||
$grid->column('name');
|
||||
$grid->column('cover', '封面')->image(50, 50);
|
||||
$grid->column('price', '标价')->prepend('¥');
|
||||
$grid->column('sale_price', '实际售价')->prepend('¥');
|
||||
$grid->column('qty', '数量');
|
||||
$grid->disableActions();
|
||||
$grid->disablePagination();
|
||||
$grid->disableRefreshButton();
|
||||
});
|
||||
$column->row(Box::make('订单商品', $productGrid));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
return [
|
||||
'labels' => [
|
||||
'DealerOrder' => 'DealerOrder',
|
||||
'dealer-order' => 'DealerOrder',
|
||||
'DealerOrder' => '订单管理',
|
||||
'dealer-orders' => '订单管理',
|
||||
],
|
||||
'fields' => [
|
||||
'sn' => '订单编号',
|
||||
|
|
|
|||
Loading…
Reference in New Issue