3 changed files with 116 additions and 1 deletions
-
99app/Admin/Controllers/IndustryOrderController.php
-
16app/Admin/Repositories/IndustryOrder.php
-
2app/Admin/routes.php
@ -0,0 +1,99 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Admin\Controllers; |
||||
|
|
||||
|
use App\Admin\Extensions\Grid\IndustryOrderStatus; |
||||
|
use App\Admin\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,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.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()); |
||||
|
$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('操作禁止'); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Admin\Repositories; |
||||
|
|
||||
|
use App\Models\IndustryOrder as Model; |
||||
|
use Dcat\Admin\Repositories\EloquentRepository; |
||||
|
|
||||
|
class IndustryOrder extends EloquentRepository |
||||
|
{ |
||||
|
/** |
||||
|
* Model. |
||||
|
* |
||||
|
* @var string |
||||
|
*/ |
||||
|
protected $eloquentClass = Model::class; |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue