Merge pull request '后台车辆租赁合同详情修复' (#115) from zhangwei into dev

Reviewed-on: #115
This commit is contained in:
weiz 2023-10-18 15:41:54 +08:00
commit 674c057b1f

View File

@ -273,14 +273,32 @@ class VehicleContractController extends BaseAdminController
}
if(!empty($cars)){
foreach ($cars as $k=>$v) {
if($data['type'] == 0 || $data['type'] == 2){
if($data['type'] == 0){
$cars[$k]['type'] = 0;
}
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){
$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'];
}