| xqd
@@ -4,6 +4,8 @@ namespace App\Admin\Controllers\OrdersManagement;
|
|
|
|
|
|
use App\Admin\Actions\backstage\Refund\RefundCompleteAction;
|
|
|
use App\Admin\Actions\backstage\Refund\RefundPartCompleteAction;
|
|
|
+use App\Models\Order;
|
|
|
+use App\Models\OrderPatient;
|
|
|
use App\Models\Organization;
|
|
|
use App\Models\Patient;
|
|
|
use App\Models\RefundApplication;
|
| xqd
@@ -38,17 +40,48 @@ class RefundApplicationController extends AdminController
|
|
|
$actions->disableView();
|
|
|
$actions->disableEdit();
|
|
|
$actions->disableDelete();
|
|
|
- if ($actions->row->status == 1)
|
|
|
+ //获取取消时间
|
|
|
+ $cancel_time = Order::where('id',$actions->row->order_id)->value('cancel_time');
|
|
|
+ //获取预约时间
|
|
|
+ $appoint_start_time = OrderPatient::where('order_id',$actions->row->order_id)->value('appoint_start_time');
|
|
|
+ //获取预约前一小时的时间
|
|
|
+ $before_appoint_start_time = $appoint_start_time-60*60;
|
|
|
+ //获取订单备注
|
|
|
+ $notice = Order::where('id',$actions->row->order_id)->value('order_notes');
|
|
|
+ //获取订单类型
|
|
|
+ $order_type = Order::where('id',$actions->row->order_id)->value('product_type');
|
|
|
+ if ($actions->row->status == 1)
|
|
|
{
|
|
|
if (\Admin::user()->isRole('financial_staff')){
|
|
|
- $actions->add(new RefundCompleteAction());
|
|
|
- $actions->add(new RefundPartCompleteAction());
|
|
|
+ if ($order_type == 3)
|
|
|
+ {
|
|
|
+ $actions->add(new RefundCompleteAction());
|
|
|
+ }
|
|
|
+ // 3. 儿保 大于一个小时和小于一个小时
|
|
|
+ //根据时间预约时间进行区分
|
|
|
+ if ($order_type == 5 && $notice != "医生拒绝接单")
|
|
|
+ {
|
|
|
+ if ($before_appoint_start_time>$cancel_time)
|
|
|
+ {
|
|
|
+ $actions->add(new RefundCompleteAction());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $actions->add(new RefundPartCompleteAction());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 4. 儿保 医生取消订单
|
|
|
+ if ($order_type ==5 && $notice == "医生拒绝接单")
|
|
|
+ {
|
|
|
+ $actions->add(new RefundCompleteAction());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
$grid->column('id', __('id'));
|
|
|
$grid->column('order_id', __('订单id'));
|
|
|
$grid->column('orders.order_sn', __('订单号'));
|
|
|
+ $grid->column('orders.product_type','产品类型')->using([1=>'电话咨询',2=>'图文咨询',3=>'门诊预约',4=>'疫苗接种预约',5=>'儿保预约',6=>'服务包',7=>'充值',8=>'快速预约']);
|
|
|
$grid->column('orders.user_id', __('用户名'))->display(function ($id){
|
|
|
$name = User::where('id',$id)->value('nickname');
|
|
|
return $name;
|
| xqd
@@ -57,10 +90,9 @@ class RefundApplicationController extends AdminController
|
|
|
$name = Patient::where('id',$id)->value('name');
|
|
|
return $name;
|
|
|
});
|
|
|
- $grid->column('orders.product_type','产品类型')->using([1=>'电话咨询',2=>'图文咨询',3=>'门诊预约',4=>'疫苗接种预约',5=>'儿保预约',6=>'服务包',7=>'充值',8=>'快速预约']);
|
|
|
- $grid->column('orders.order_notes','取消备注');
|
|
|
- $grid->column('orders.order_status','订单状态')->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
|
|
|
- $grid->column('status', __('退款状态'))->using([1=>'退款中',2=>'已退款']);
|
|
|
+ $grid->column('orders.order_status','订单状态')->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消',6=>'已超时',7=>'已预约']);
|
|
|
+ $grid->column('orders.payment_status','支付状态')->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款',5=>'待退款']);
|
|
|
+ $grid->column('orders.order_notes','订单备注');
|
|
|
$grid->column('orders.payment_amount', __('订单金额'))->display(function ($money){
|
|
|
return $money/100;
|
|
|
});
|