后台车辆租赁合同详情修复

This commit is contained in:
unknown 2023-10-18 15:41:28 +08:00
parent 6e90abe2b3
commit 37dabba9a1

View File

@ -273,14 +273,32 @@ class VehicleContractController extends BaseAdminController
} }
if(!empty($cars)){ if(!empty($cars)){
foreach ($cars as $k=>$v) { foreach ($cars as $k=>$v) {
if($data['type'] == 0 || $data['type'] == 2){ if($data['type'] == 0){
$cars[$k]['type'] = 0; $cars[$k]['type'] = 0;
} }
if($data['type'] == 1){ if($data['type'] == 1){
$cars[$k]['type'] = 1; $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
if($rentInfo->isEmpty()){
$cars[$k]['type'] = 0;
}else{
$cars[$k]['type'] = $rentInfo['type'];
}
}
if($data['type'] == 2){
$rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
if($rentInfo->isEmpty()){
$cars[$k]['type'] = 0;
}else{
$cars[$k]['type'] = $rentInfo['type'];
}
} }
if($data['type'] == 3){ if($data['type'] == 3){
$cars[$k]['type'] = 2; $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
if($rentInfo->isEmpty()){
$cars[$k]['type'] = 2;
}else{
$cars[$k]['type'] = $rentInfo['type'];
}
} }
$cars[$k]['rent_time'] = $data['update_time']; $cars[$k]['rent_time'] = $data['update_time'];
} }