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

136 lines
4.0 KiB

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