链街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.

139 lines
3.5 KiB

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