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

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