链街Dcat后台
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.

124 lines
3.5 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Extensions\CheckRow;
  4. use App\Admin\Extensions\CouponTieEdit;
  5. use App\Admin\Extensions\OrderDetail;
  6. use App\Admin\Extensions\OrderPrint;
  7. use App\Admin\Extensions\OrderStateHandle;
  8. use App\Admin\Forms\CouponTieForm;
  9. use App\Admin\Repositories\ImsCjdcOrderMain;
  10. use Dcat\Admin\Admin;
  11. use Dcat\Admin\Form;
  12. use Dcat\Admin\Grid;
  13. use Dcat\Admin\Show;
  14. use Dcat\Admin\Controllers\AdminController;;
  15. class ImsCjdcOrderMainController extends AdminController
  16. {
  17. /**
  18. * Make a grid builder.
  19. *
  20. * @return Grid
  21. */
  22. protected function grid()
  23. {
  24. return Grid::make(new ImsCjdcOrderMain(), function (Grid $grid) {
  25. //>>1.只展示线上订单打√
  26. //>>2.不同服务站只能看到自己的市场订单
  27. //>>3.订单不允许有添加,编辑,删除
  28. //>>4.订单状态变更√
  29. //>>5.打印功能
  30. //>6.退款
  31. $grid->paginate(10);//每页展示数据10条
  32. //$grid->id;
  33. //$grid->user_id('用户信息');
  34. $grid->column('nick_name','用户信息');
  35. $grid->order_num;
  36. $grid->state('订单状态')
  37. ->using(config('order.state'))
  38. ->label([1=>'dark',2=>'danger',3=>'indigo',4=>'success']);
  39. $grid->money;
  40. $grid->column('market.name','所属市场');
  41. $grid->pay_time('支付时间')->display(function (){
  42. return date('Y-m-d H:i:s');
  43. });
  44. $grid->created_at('下单时间')->display(function (){
  45. return date('Y-m-d H:i:s');
  46. });
  47. $grid->actions(function (Grid\Displayers\Actions $actions) use ($grid){
  48. $state = $actions->row->state;
  49. if ($state==2){
  50. $actions->append(new OrderStateHandle('接单',3));
  51. }elseif ($state==311){
  52. $actions->append(new OrderStateHandle('完成',4));
  53. }elseif ($state==3){
  54. $actions->append(new OrderPrint('打印'));
  55. $actions->append(new CheckRow($actions->row->id,'自送'));
  56. }
  57. $actions->append(new OrderDetail('详情'));
  58. });
  59. $grid->filter(function (Grid\Filter $filter) {
  60. $filter->equal('id');
  61. });
  62. $grid->disableViewButton();
  63. $grid->disableEditButton();
  64. $grid->disableDeleteButton();
  65. });
  66. }
  67. /**
  68. * Make a show builder.
  69. *
  70. * @param mixed $id
  71. *
  72. * @return Show
  73. */
  74. protected function detail($id)
  75. {
  76. return Show::make($id, new ImsCjdcOrderMain(), function (Show $show) {
  77. $show->id;
  78. $show->user_id;
  79. $show->order_num;
  80. $show->state;
  81. $show->time;
  82. $show->pay_time;
  83. $show->money;
  84. $show->tools(function (Show\Tools $tools) {
  85. $tools->append(new \App\Admin\Actions\Show\OrderDetail());
  86. });
  87. });
  88. }
  89. /**
  90. * Make a form builder.
  91. *
  92. * @return Form
  93. */
  94. protected function form()
  95. {
  96. return Form::make(new ImsCjdcOrderMain(), function (Form $form) {
  97. $form->display('id');
  98. $form->text('user_id');
  99. $form->text('order_num');
  100. $form->text('state');
  101. $form->text('time');
  102. $form->text('pay_time');
  103. $form->text('money');
  104. });
  105. }
  106. public function orderDetail()
  107. {
  108. echo 111;
  109. }
  110. }