|
@@ -621,29 +621,26 @@ class ServiceWorkLogic extends BaseLogic
|
|
|
if((int)$serviceWorkInfo['user_confirm_status'] === 5 || (int)$serviceWorkInfo['service_status'] > 2){
|
|
if((int)$serviceWorkInfo['user_confirm_status'] === 5 || (int)$serviceWorkInfo['service_status'] > 2){
|
|
|
throw new \Exception('用户已完结该工单或已取消,已退款,不可执行取消');
|
|
throw new \Exception('用户已完结该工单或已取消,已退款,不可执行取消');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //工单如果存在费用情况,不允许取消
|
|
|
|
|
+ $paid_amount = RechargeOrder::where('work_id', $params['id'])->where('pay_status', 1)->value('paid_amount');
|
|
|
|
|
+ if($paid_amount > 0){
|
|
|
|
|
+ // 4=已上门,5=服务中,6=待结算, 即工程师已上门服务过
|
|
|
|
|
+ throw new Exception('工单存在费用情况,不允许取消,请走退费流程');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
ServiceWork::where('id', $params['id'])->update([
|
|
ServiceWork::where('id', $params['id'])->update([
|
|
|
//'work_status' => 9,
|
|
//'work_status' => 9,
|
|
|
'service_status' => 4,
|
|
'service_status' => 4,
|
|
|
'remark' => $params['remark']??''
|
|
'remark' => $params['remark']??''
|
|
|
]);
|
|
]);
|
|
|
- /*// 对应订单状态修改
|
|
|
|
|
- RechargeOrder::where('work_id', $params['id'])->update([
|
|
|
|
|
- 'pay_status' => 2
|
|
|
|
|
- ]);*/
|
|
|
|
|
|
|
+
|
|
|
ServiceWorkLog::create([
|
|
ServiceWorkLog::create([
|
|
|
'work_id' => $params['id'],
|
|
'work_id' => $params['id'],
|
|
|
'master_worker_id' => $serviceWorkInfo['master_worker_id'],
|
|
'master_worker_id' => $serviceWorkInfo['master_worker_id'],
|
|
|
'opera_log' => "工单:{$serviceWorkInfo['work_sn']}已取消"
|
|
'opera_log' => "工单:{$serviceWorkInfo['work_sn']}已取消"
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
- $paid_amount = RechargeOrder::where('work_id', $params['id'])->where('payment_type', 1)->where('order_type', 0)->where('pay_status', 1)->value('paid_amount');
|
|
|
|
|
- if($paid_amount > 0){
|
|
|
|
|
- // 4=已上门,5=服务中,6=待结算, 即工程师已上门服务过
|
|
|
|
|
- if(in_array((int)$serviceWorkInfo['work_status'], [4,5,6])){
|
|
|
|
|
- WorkerAccountLogLogic::addAccountLog($serviceWorkInfo,$paid_amount,WorkerAccountLogEnum::UM_INC_ADMIN,WorkerAccountLogEnum::INC,$params['remark']??'');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
Db::commit();
|
|
Db::commit();
|
|
|
Log::info('取消工单'.json_encode([$serviceWorkInfo]));
|
|
Log::info('取消工单'.json_encode([$serviceWorkInfo]));
|
|
|
return true;
|
|
return true;
|