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

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