This commit is contained in:
mkm 2023-09-02 10:14:30 +08:00
commit 9880ec5470
2 changed files with 15 additions and 4 deletions

View File

@ -275,6 +275,10 @@ class IndexController extends BaseApiController
VehicleContract::where('id',$id)->update(['signing_timer'=>2,'status'=>3]);
//更改租赁列表车辆状态
$vehicle = json_decode($contract['cars_info'],true);
//获取租赁车辆信息
$vehicleRentInfo = VehicleRent::where('car_id',$vehicle['id'])->find();
//更新原始合同类型
VehicleContract::where('id',$vehicleRentInfo['contract_id'])->update(['type'=>2]);
VehicleRent::where('car_id',$vehicle['id'])->update([
'status' => 3,
]);
@ -295,6 +299,9 @@ class IndexController extends BaseApiController
return $this->fail('请求方式错误');
}
$param = $this->request->post();
if(empty($param['contract_logistic_id'])){
return $this->fail('缺少必要参数');
}
$model = VehicleContract::where('contract_logistic_id',$param['contract_logistic_id'])->find();
if(empty($model)){
return $this->fail('数据不存在');

View File

@ -210,7 +210,7 @@ class VehicleController extends BaseApiController
return $this->fail('当前小组服务公司未签约');
}
//获取签约信息
$contract = VehicleContract::where('party_b',$this->userInfo['company_id'])->where('signing_timer',2)->find();
$contract = Contract::where('party_b',$this->userInfo['company_id'])->where('signing_timer',2)->find();
$party_a = Company::field('id,company_name,master_name,master_phone,master_email,is_contract,organization_code,company_type')->where('id',$contract['party_a'])->find();
if(empty($contract) || empty($party_a)){
return $this->fail('未找到签约镇街公司');
@ -222,7 +222,7 @@ class VehicleController extends BaseApiController
return $this->fail('当前镇街公司未签约');
}
//判断是否申请过
$vehicleContract = VehicleContract::where('company_b_id',$this->userInfo['company_id'])->where('status','<>',4)->find();
$vehicleContract = VehicleContract::where('company_b_id',$this->userInfo['company_id'])->where('type','<>',2)->where('status','<>',4)->find();
if(!empty($vehicleContract)){
return $this->fail('请勿重复申请');
}
@ -378,7 +378,10 @@ class VehicleController extends BaseApiController
//获取申请信息
$vehicleContract = VehicleContract::where('company_b_id',$company['id'])->order('id desc')->find();
if(empty($vehicleContract)){
return $this->success('没有数据,请申请');
return $this->success('没有数据,请申请',['status'=>-2]);
}
if($vehicleContract['type'] == 2){
return $this->success('合同已解除',['status'=>-3]);
}
if($vehicleContract['status'] == 3){
if(!empty($vehicleContract['cars_info'])){
@ -519,12 +522,13 @@ class VehicleController extends BaseApiController
}
public function townCompanyContractList() {
//获取公司信息
$company = Company::where('id',$this->userInfo['company_id'])->find();
if(empty($company)){
return $this->fail('请求错误');
}
if($company['company_type'] != 16){
return ['code'=>0,'msg'=>'非镇街公司不能访问'];
return $this->fail('非镇街公司不能访问');
}
$data = VehicleContract::field('id,contract_no,file,status,create_time,update_time')->where('contract_logistic_id','<>',0)->where('company_b_id',$company['id'])->select();
return $this->success('请求成功',$data->toArray());