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

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