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

126 lines
3.6 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 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. $actions->append(new OrderPrint('打印'));
  54. }elseif ($state==3){
  55. $actions->append(new OrderPrint('打印'));
  56. $actions->append(new CheckRow($actions->row->id,$grid->model()->getCurrentPage(),'自送'));
  57. }
  58. $actions->append(new OrderDetail('详情'));
  59. });
  60. $grid->filter(function (Grid\Filter $filter) {
  61. $filter->equal('id');
  62. });
  63. $grid->disableViewButton();
  64. $grid->disableEditButton();
  65. $grid->disableDeleteButton();
  66. });
  67. }
  68. /**
  69. * Make a show builder.
  70. *
  71. * @param mixed $id
  72. *
  73. * @return Show
  74. */
  75. protected function detail($id)
  76. {
  77. return Show::make($id, new ImsCjdcOrderMain(), function (Show $show) {
  78. $show->id;
  79. $show->user_id;
  80. $show->order_num;
  81. $show->state;
  82. $show->time;
  83. $show->pay_time;
  84. $show->money;
  85. $show->tools(function (Show\Tools $tools) {
  86. $tools->append(new \App\Admin\Actions\Show\OrderDetail());
  87. });
  88. });
  89. }
  90. /**
  91. * Make a form builder.
  92. *
  93. * @return Form
  94. */
  95. protected function form()
  96. {
  97. return Form::make(new ImsCjdcOrderMain(), function (Form $form) {
  98. $form->display('id');
  99. $form->text('user_id');
  100. $form->text('order_num');
  101. $form->text('state');
  102. $form->text('time');
  103. $form->text('pay_time');
  104. $form->text('money');
  105. });
  106. }
  107. public function orderDetail()
  108. {
  109. echo 111;
  110. }
  111. }