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.
130 lines
3.9 KiB
130 lines
3.9 KiB
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\Admin\Extensions\CheckRow;
|
|
use App\Admin\Extensions\CouponTieEdit;
|
|
use App\Admin\Extensions\OrderDetail;
|
|
use App\Admin\Extensions\OrderPrint;
|
|
use App\Admin\Extensions\OrderRefund;
|
|
use App\Admin\Extensions\OrderStateHandle;
|
|
use App\Admin\Forms\CouponTieForm;
|
|
use App\Admin\Repositories\ImsCjdcOrderMain;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Show;
|
|
use Dcat\Admin\Controllers\AdminController;;
|
|
|
|
class ImsCjdcOrderMainController extends AdminController
|
|
{
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
return Grid::make(new ImsCjdcOrderMain(), function (Grid $grid) {
|
|
//>>1.只展示线上订单打√
|
|
//>>2.不同服务站只能看到自己的市场订单
|
|
//>>3.订单不允许有添加,编辑,删除
|
|
//>>4.订单状态变更√
|
|
//>>5.打印功能
|
|
//>6.退款
|
|
$grid->paginate(10);//每页展示数据10条
|
|
//$grid->id;
|
|
//$grid->user_id('用户信息');
|
|
$grid->column('nick_name','用户信息');
|
|
$grid->order_num;
|
|
|
|
$grid->state('订单状态')
|
|
->using(config('order.state'))
|
|
->label([1=>'dark',2=>'danger',3=>'indigo',4=>'success']);
|
|
$grid->money;
|
|
$grid->column('market.name','所属市场');
|
|
$grid->pay_time('支付时间')->display(function (){
|
|
return date('Y-m-d H:i:s');
|
|
});
|
|
$grid->created_at('下单时间')->display(function (){
|
|
return date('Y-m-d H:i:s');
|
|
});
|
|
|
|
$grid->actions(function (Grid\Displayers\Actions $actions) use ($grid){
|
|
|
|
$state = $actions->row->state;
|
|
if ($state==2){
|
|
$actions->append(new OrderStateHandle('接单',3));
|
|
}elseif ($state==311){
|
|
$actions->append(new OrderStateHandle('完成',4));
|
|
$actions->append(new OrderPrint('打印'));
|
|
}elseif ($state==3){
|
|
$actions->append(new OrderPrint('打印'));
|
|
$actions->append(new CheckRow($actions->row->id,$grid->model()->getCurrentPage(),'自送'));
|
|
}elseif ($state==8){
|
|
$actions->append(new OrderStateHandle('同意退款',9));
|
|
$actions->append(new OrderRefund($actions->row->id,$grid->model()->getCurrentPage(),'拒绝退款'));
|
|
}
|
|
$actions->append(new OrderDetail('详情'));
|
|
});
|
|
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->equal('id');
|
|
|
|
});
|
|
|
|
$grid->disableViewButton();
|
|
$grid->disableEditButton();
|
|
$grid->disableDeleteButton();
|
|
|
|
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
*
|
|
* @param mixed $id
|
|
*
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
return Show::make($id, new ImsCjdcOrderMain(), function (Show $show) {
|
|
$show->id;
|
|
$show->user_id;
|
|
$show->order_num;
|
|
$show->state;
|
|
$show->time;
|
|
$show->pay_time;
|
|
$show->money;
|
|
$show->tools(function (Show\Tools $tools) {
|
|
$tools->append(new \App\Admin\Actions\Show\OrderDetail());
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a form builder.
|
|
*
|
|
* @return Form
|
|
*/
|
|
protected function form()
|
|
{
|
|
return Form::make(new ImsCjdcOrderMain(), function (Form $form) {
|
|
$form->display('id');
|
|
$form->text('user_id');
|
|
$form->text('order_num');
|
|
$form->text('state');
|
|
$form->text('time');
|
|
$form->text('pay_time');
|
|
$form->text('money');
|
|
});
|
|
}
|
|
|
|
|
|
public function orderDetail()
|
|
{
|
|
echo 111;
|
|
}
|
|
}
|