You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.0 KiB
101 lines
3.0 KiB
<?php
|
|
|
|
namespace App\AdminSupplier\Controllers;
|
|
|
|
use App\AdminSupplier\Extensions\Grid\IndustryOrderStatus;
|
|
use App\AdminSupplier\Repositories\IndustryOrder;
|
|
use App\Common\OrderStatus;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Show;
|
|
use Dcat\Admin\Http\Controllers\AdminController;
|
|
|
|
class IndustryOrderController extends AdminController
|
|
{
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
return Grid::make(new IndustryOrder(['agent:id,company_name']), function (Grid $grid) {
|
|
$grid->disableCreateButton();
|
|
$grid->disableRowSelector();
|
|
$grid->disableActions();
|
|
|
|
$grid->model()->where('supplier_id', Admin::user()->id);
|
|
|
|
$grid->column('id')->sortable();
|
|
$grid->column('agent.company_name', '代理商名称');
|
|
$grid->column('order_no');
|
|
$grid->column('num');
|
|
$grid->column('price');
|
|
$grid->column('name');
|
|
$grid->column('mobile');
|
|
$grid->column('industry_product_id', '产品ID');
|
|
$grid->column('title');
|
|
$grid->column('picture')->image('', 60, 60);
|
|
$grid->column('status')
|
|
->using(OrderStatus::array())
|
|
->if(fn() => $this->status == OrderStatus::OFFLINE_UNPAID)
|
|
->action(new IndustryOrderStatus);
|
|
$grid->column('paid_at');
|
|
// $grid->column('timeout');
|
|
$grid->column('created_at');
|
|
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->equal('id')->width(2);
|
|
$filter->equal('order_no')->width(3);
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
*
|
|
* @param mixed $id
|
|
*
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
/*return Show::make($id, new IndustryOrder(), function (Show $show) {
|
|
$show->field('id');
|
|
$show->field('agent_id');
|
|
$show->field('supplier_id');
|
|
$show->field('order_no');
|
|
$show->field('industry_product_id');
|
|
$show->field('num');
|
|
$show->field('price');
|
|
$show->field('name');
|
|
$show->field('mobile');
|
|
$show->field('title');
|
|
$show->field('picture');
|
|
$show->field('status');
|
|
$show->field('paid_at');
|
|
$show->field('verify_code');
|
|
$show->field('timeout');
|
|
$show->field('created_at');
|
|
$show->field('updated_at');
|
|
});*/
|
|
}
|
|
|
|
/**
|
|
* Make a form builder.
|
|
*
|
|
* @return Form
|
|
*/
|
|
protected function form()
|
|
{
|
|
return Form::make(new IndustryOrder(), function (Form $form) {
|
|
$form->display('id');
|
|
// $form->select('status')->options([OrderStatus::OFFLINE_PAID => '已付款']);
|
|
})->saving(function(Form $form) {
|
|
return $form->response()->error('操作禁止');
|
|
})->deleting(function(Form $form) {
|
|
return $form->response()->error('操作禁止');
|
|
});
|
|
}
|
|
}
|