瀏覽代碼

咨询订单

ChenWuJie 4 年之前
父節點
當前提交
454a7d34a8

+ 20 - 0
app/Admin/Actions/backstage/Orders/OrderDetails.php

xqd
@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Orders;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class OrderDetails extends RowAction
+{
+    public $name = '订单详情';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转订单详情成功')->redirect('/admin/consulting_orders_details?id='.$this->row->id.'');
+
+    }
+
+}

+ 135 - 0
app/Admin/Controllers/ConsultingOrdersController.php

xqd
@@ -0,0 +1,135 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Admin\Actions\backstage\Orders\OrderDetails;
+use App\Models\Order;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class ConsultingOrdersController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '咨询订单';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Order());
+        $grid->model()->wherein('product_type',[1,2]);
+        //筛选
+        $grid->filter(function ($filter){
+            $filter->disableIdFilter();
+            $filter->like('user.nickname','用户姓名');
+            $filter->like('docter.name','医生姓名');
+            $filter->like('orderPatient.name','患者姓名');
+            $filter->equal('user_id', '用户id');
+            $filter->equal('docter_id', '医生id');
+
+            $filter->equal('order_status','订单状态')->radio(
+                [
+                    ''=>'不限',
+                    1=>'未支付',
+                    2=>'待接单',
+                    3=>'进行中',
+                    4=>'已完成',
+                    5=>'已取消'
+                ]
+            );
+        });
+        //操作
+        $grid->actions(function ($actions) {
+            // 去掉删除
+            $actions->disableDelete();
+            // 去掉编辑
+            $actions->disableEdit();
+            // 去掉查看
+            $actions->disableView();
+            $actions->add(new OrderDetails());
+        });
+        $grid->column('id', __('Id'))->sortable();
+        $grid->column('user_id', __('用户id'));
+        $grid->column('user.nickname', __('用户姓名'));
+        $grid->column('docter_id', __('医生id'));
+        $grid->column('docter.name', __('医生姓名'));
+        $grid->column('patient_id', __('患者id'));
+        $grid->column('orderPatient.name', __('患者姓名'));
+        $grid->column('orderPatient.symptoms', __('患者描述'));
+        $grid->column('product_type', __('产品类型'))->using([1=>'电话咨询',2=>'图文咨询']);
+        $grid->column('payment_type', __('支付方式'))->using([1=>'微信支付',2=>'余额支付']);
+        $grid->column('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
+        $grid->column('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Order::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('user_id', __('User id'));
+        $show->field('docter_id', __('Docter id'));
+        $show->field('patient_id', __('Patient id'));
+        $show->field('organization_id', __('Organization id'));
+        $show->field('order_sn', __('Order sn'));
+        $show->field('payment_type', __('Payment type'));
+        $show->field('product_type', __('Product type'));
+        $show->field('order_status', __('Order status'));
+        $show->field('payment_status', __('Payment status'));
+        $show->field('total_amount', __('Total amount'));
+        $show->field('payment_amount', __('Payment amount'));
+        $show->field('discount_amount', __('Discount amount'));
+        $show->field('payment_time', __('Payment time'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+        $show->field('outtime', __('Outtime'));
+        $show->field('receiving_time', __('Receiving time'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new Order());
+
+        $form->number('user_id', __('User id'));
+        $form->number('docter_id', __('Docter id'));
+        $form->number('patient_id', __('Patient id'));
+        $form->number('organization_id', __('Organization id'));
+        $form->text('order_sn', __('Order sn'));
+        $form->switch('payment_type', __('Payment type'))->default(1);
+        $form->switch('product_type', __('Product type'))->default(1);
+        $form->switch('order_status', __('Order status'))->default(1);
+        $form->switch('payment_status', __('Payment status'))->default(1);
+        $form->number('total_amount', __('Total amount'));
+        $form->number('payment_amount', __('Payment amount'));
+        $form->number('discount_amount', __('Discount amount'));
+        $form->number('payment_time', __('Payment time'));
+        $form->number('outtime', __('Outtime'));
+        $form->number('receiving_time', __('Receiving time'));
+
+        return $form;
+    }
+}

+ 116 - 0
app/Admin/Controllers/ConsultingOrdersDetailsController.php

xqd
@@ -0,0 +1,116 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Models\Order;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class ConsultingOrdersDetailsController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '订单详情';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Order());
+        $grid->disableActions();
+        $grid->column('id', __('Id'));
+        $grid->column('product_type', __('产品类型'))->using([1=>'电话咨询',2=>'图文咨询']);
+        $grid->column('payment_type', __('支付方式'))->using([1=>'微信支付',2=>'余额支付']);
+        $grid->column('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
+        $grid->column('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
+        $grid->column('payment_time', __('支付时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('receiving_time', __('接单时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('end_time', __('订单完成时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('total_amount', __('订单总金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('payment_amount', __('用户实际支付的金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('discount_amount', __('折扣金额'))->display(function ($money){
+            return $money/100;
+        });
+
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Order::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('user_id', __('User id'));
+        $show->field('docter_id', __('Docter id'));
+        $show->field('patient_id', __('Patient id'));
+        $show->field('organization_id', __('Organization id'));
+        $show->field('order_sn', __('Order sn'));
+        $show->field('payment_type', __('Payment type'));
+        $show->field('product_type', __('Product type'));
+        $show->field('order_status', __('Order status'));
+        $show->field('payment_status', __('Payment status'));
+        $show->field('total_amount', __('Total amount'));
+        $show->field('payment_amount', __('Payment amount'));
+        $show->field('discount_amount', __('Discount amount'));
+        $show->field('payment_time', __('Payment time'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+        $show->field('outtime', __('Outtime'));
+        $show->field('receiving_time', __('Receiving time'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new Order());
+
+        $form->number('user_id', __('User id'));
+        $form->number('docter_id', __('Docter id'));
+        $form->number('patient_id', __('Patient id'));
+        $form->number('organization_id', __('Organization id'));
+        $form->text('order_sn', __('Order sn'));
+        $form->switch('payment_type', __('Payment type'))->default(1);
+        $form->switch('product_type', __('Product type'))->default(1);
+        $form->switch('order_status', __('Order status'))->default(1);
+        $form->switch('payment_status', __('Payment status'))->default(1);
+        $form->number('total_amount', __('Total amount'));
+        $form->number('payment_amount', __('Payment amount'));
+        $form->number('discount_amount', __('Discount amount'));
+        $form->number('payment_time', __('Payment time'));
+        $form->number('outtime', __('Outtime'));
+        $form->number('receiving_time', __('Receiving time'));
+
+        return $form;
+    }
+}

+ 11 - 11
app/Admin/Controllers/UserListController.php

xqd
@@ -31,17 +31,17 @@ class UserListController extends AdminController
     {
         $grid = new Grid(new User());
         $grid->actions(function ($actions) {
-            // 去掉删除
-            $actions->disableDelete();
-            // 去掉编辑
-            $actions->disableEdit();
-            // 去掉查看
-            $actions->disableView();
-            $actions->add(new archives());
-            $actions->add(new BalanceLog());
-            $actions->add(new BlackList());
-            $actions->add(new coupons());
-        });
+        // 去掉删除
+        $actions->disableDelete();
+        // 去掉编辑
+        $actions->disableEdit();
+        // 去掉查看
+        $actions->disableView();
+        $actions->add(new archives());
+        $actions->add(new BalanceLog());
+        $actions->add(new BlackList());
+        $actions->add(new coupons());
+    });
         //筛选
         $grid->filter(function ($filter){
             $filter->disableIdFilter();