573 lines
13 KiB
Vue
Raw Normal View History

2023-08-22 16:01:58 +08:00
<template>
2023-09-01 21:40:33 +08:00
<view class="">
<view v-if='showLoading'>
2023-08-31 10:44:45 +08:00
<u-loading-page :loading="showLoading"></u-loading-page>
</view>
<view class="" v-else>
<!-- 小组公司 -->
<view class="noCar" v-if='company_type==18'>
<!-- 申请 -->
<view class="" v-if="step==999">
<view class="">
你还没有所属车辆哦,请向镇公司申请用车或使用自有车辆并绑定系统
</view>
<view class="" style="margin: 20rpx 0;">
<u-button @tap="applycarFn" type="primary" style="background-color: #0122C7;border: none;"
class="btn">
申请用车</u-button>
</view>
<view class="">
<u-button @tap="show=true" type="primary" style="background-color: #0122C7;border: none;"
class="btn">
上传自有车辆</u-button>
</view>
<u-modal :show="show" @close="show=false" :showCancelButton="true" @confirm="upCarFn"
:closeOnClickOverlay="true" @cancel="show=false" title="车辆上传">
<view class="slot-content">
<u--input placeholder="请输入您的车牌号" v-model="carLicense"></u--input>
</view>
</u-modal>
2023-08-29 11:11:19 +08:00
</view>
2023-09-01 21:40:33 +08:00
2023-08-31 10:44:45 +08:00
<!-- 等待 -->
2023-09-01 21:40:33 +08:00
<view class="" v-if='[-1,0,1,2].includes(step)'>
2023-08-31 10:44:45 +08:00
<!-- 上传自有车辆 -->
<view v-if="0">
<view class="loading">
<span>您已上传自用车辆,系统正在审核中,请耐心等待</span>
<span class="dots">...</span>
</view>
</view>
<!-- 申请用车 -->
<view v-else>
2023-09-01 21:40:33 +08:00
<view class="loading" v-if="datas.type !=2">
2023-08-31 10:44:45 +08:00
<span>你已提交用车申请后台正在加快处理中请耐心等待哦</span>
<span class="dots">...</span>
</view>
2023-09-01 21:40:33 +08:00
<view class="loading" v-else>
<span>你已提交解除申请</span>
<span class="dots">...</span>
</view>
2023-08-30 11:28:35 +08:00
</view>
2023-08-29 11:11:19 +08:00
</view>
2023-08-31 10:44:45 +08:00
<!-- 审核结束 -->
<view class="" v-if="step==4">
2023-08-30 11:28:35 +08:00
<view class="">
2023-09-01 21:40:33 +08:00
你的申请于{{datas.update_time}}被驳回
2023-08-30 11:28:35 +08:00
</view>
2023-08-31 10:44:45 +08:00
<view class="">
2023-09-01 21:40:33 +08:00
驳回理由: {{datas.reject_message}}
2023-08-29 11:11:19 +08:00
</view>
2023-08-31 10:44:45 +08:00
<view class="">
请修改相应内容重新提交哦
2023-08-29 11:11:19 +08:00
</view>
2023-08-31 10:44:45 +08:00
<view class="">
<view class="" style="margin: 20rpx 0;">
<u-button @tap="applycarFn" type="primary" style="background-color: #0122C7;border: none;"
class="btn">
申请用车</u-button>
</view>
<view class="">
<u-button @tap="show=true" type="primary" style="background-color: #0122C7;border: none;"
class="btn">
上传自有车辆</u-button>
</view>
<u-modal :show="show" @close="show=false" @confirm="upCarFn" :closeOnClickOverlay="true"
title="车辆上传">
<view class="slot-content">
<u--input placeholder="请输入您的车牌号" v-model="carLicense"></u--input>
</view>
</u-modal>
2023-08-29 11:11:19 +08:00
</view>
</view>
2023-09-01 21:40:33 +08:00
<!-- 车辆到期 -->
<!-- 申请 -->
<view class="" v-if="0">
<view class="">
你的车辆已到期,请重新签约
</view>
<view class="" style="margin: 20rpx 0;">
<u-button @tap="applycarFn" type="primary" style="background-color: #0122C7;border: none;"
class="btn">
申请用车</u-button>
</view>
</view>
2023-08-31 10:44:45 +08:00
</view>
<!-- 镇街公司 -->
<view v-if='company_type==16'>
<view class="info">
<text>可监管车辆数量 {{datas.monitor_num}}</text>
<view @click="showPop=true" class="not_leased">
<view class="">
2023-09-01 21:40:33 +08:00
租赁 {{datas.rent_num}}<text v-if="datas.apply_num">(待审核:{{datas.apply_num}})</text>
2023-08-30 11:28:35 +08:00
</view>
2023-08-31 10:44:45 +08:00
<view class="triangle-up" v-if="datas.can_rent_num">
2023-08-30 11:28:35 +08:00
</view>
2023-08-31 10:44:45 +08:00
<view class="message_bottom" v-if="datas.can_rent_num">
可再租赁车辆:{{datas.can_rent_num}}
2023-08-30 11:28:35 +08:00
</view>
</view>
2023-09-01 21:40:33 +08:00
<text v-if="datas.self_num">自有车辆 {{datas.self_num}}</text>
2023-08-30 11:28:35 +08:00
</view>
2023-08-31 10:44:45 +08:00
<!-- 公告栏 -->
2023-09-01 21:40:33 +08:00
<view class="application_tit" v-if="applicationList.length">
<!-- <view class="application_tit" v-if="1"> -->
2023-08-31 10:44:45 +08:00
<view class="head" @click="navgo('/subpkg/property/agencyList')">
<text>签约申请</text>
2023-09-01 21:40:33 +08:00
<view style="display: flex;" v-if="applicationList.length>3">
2023-08-31 10:44:45 +08:00
<text>更多 </text>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
<view class="content">
<view class="li" @click="navgo(`/subpkg/property/chosseCompany?id=${item.id}`)"
v-for="item,index in applicationList">
<view class="date">
{{item.create_time.slice(0, 10)}}
</view>
<view class="text">
2023-09-01 21:40:33 +08:00
{{item.company_b_name}}提出租赁车辆一台
2023-08-31 10:44:45 +08:00
</view>
<view class="detail">
<u-icon name="arrow-right"></u-icon>
</view>
2023-08-30 11:28:35 +08:00
</view>
2023-08-31 10:44:45 +08:00
</view>
</view>
<view class="personnel_list">
<view>
2023-09-01 21:40:33 +08:00
<view class="cards" v-for="item,index in dataList" :key="index">
2023-08-31 10:44:45 +08:00
<view class="cards_head">
<text>{{item.car_license}}</text>
</view>
<view class="cards_content">
<view class="right">
<!-- 已出租 -->
2023-09-01 21:40:33 +08:00
<view v-if="item.status==2"
@click="navgo(`/subpkg/property/vehicle_a?id=${item.car_id}`)">
2023-08-31 10:44:45 +08:00
<view class="li">
<text>使用人: </text>
2023-09-01 21:40:33 +08:00
<text> {{item.rent_user.user_name}}</text>
2023-08-31 10:44:45 +08:00
<view style="float: right;">
<text style="color: green;" v-if="item.type==1">自有车辆</text>
<text style="color: orange;" v-else>租赁车辆</text>
</view>
</view>
<view class="li">
<text>联系方式: </text>
2023-09-01 21:40:33 +08:00
<text>{{item.rent_user.user_phone}}</text>
2023-08-31 10:44:45 +08:00
</view>
<view class="li">
<text>所属公司: </text>
2023-09-01 21:40:33 +08:00
<text> {{item.rent_user.company_name}} </text>
2023-08-31 10:44:45 +08:00
</view>
<view class="li">
<text>签约时间: </text>
<text> {{item.rent_time}} </text>
2023-08-30 11:28:35 +08:00
</view>
</view>
2023-08-31 10:44:45 +08:00
<!-- 未出租 -->
<view class="" v-else>
<view class="li">
<text>车牌号: </text>
<text> {{item.car_license}}</text>
<view style="float: right;">
<text style="color: green;" v-if="item.type==1">自有车辆</text>
<text style="color: orange;" v-else>租赁车辆</text>
</view>
</view>
2023-09-01 21:40:33 +08:00
2023-08-30 11:28:35 +08:00
</view>
2023-08-29 11:11:19 +08:00
</view>
2023-08-22 16:01:58 +08:00
</view>
</view>
2023-08-23 11:35:09 +08:00
</view>
</view>
2023-09-01 21:40:33 +08:00
<view style="text-align: center;" v-if="!dataList.length">
<u-empty v-if="!datas.monitor_num" text="你还没有可监管的车辆哦~" icon="../../static/img/empty/data.png">
</u-empty>
<u-empty v-else text="你还没有车辆哦,快去向平台申请用车吧" icon="../../static/img/empty/data.png"> </u-empty>
<!-- 你还没有车辆哦快去向平台申请用车吧 -->
</view>
2023-08-31 10:44:45 +08:00
<u-modal :show="showPop" @close="showPop=false" @confirm="confirm" :closeOnClickOverlay="true"
:title="`请输入您需要租赁的车辆数量(上限为${datas.can_rent_num})`">
<view class="slot-content">
<u--input placeholder="请输入内容" type="number" v-model="newCarNum"></u--input>
2023-08-22 16:01:58 +08:00
</view>
2023-08-31 10:44:45 +08:00
</u-modal>
2023-08-22 16:01:58 +08:00
</view>
2023-08-24 18:32:34 +08:00
</view>
2023-09-01 21:40:33 +08:00
<mytn text='合同列表' v-if="datas.rent_num" @click="navgo('/subpkg/property/contractList')"></mytn>
2023-08-22 16:01:58 +08:00
</view>
</template>
<script>
2023-08-29 11:11:19 +08:00
import {
2023-08-30 11:28:35 +08:00
getvehicleListApi,
getAgencyListApi,
leaseApi,
2023-08-31 10:44:45 +08:00
upVehicleApi,
getAgencyDetailApi,
getvehicleDetailApi,
villageCompanyApi
2023-08-29 11:11:19 +08:00
} from "@/api/property.js"
2023-08-31 10:44:45 +08:00
import Cache from '@/utils/cache';
2023-08-29 11:11:19 +08:00
// import mybtn from "@/components/mybtn/mybtn.vue"
2023-08-23 11:35:09 +08:00
import {
Toast
} from "../../libs/uniApi";
2023-09-01 21:40:33 +08:00
import mytn from "@/components/mybtn/mybtn.vue"
2023-08-23 11:35:09 +08:00
// Toast("请至少选择一辆车")
2023-08-22 16:01:58 +08:00
export default {
components: {
2023-09-01 21:40:33 +08:00
mytn
2023-08-22 16:01:58 +08:00
},
name: "vehicle",
data() {
return {
2023-08-31 10:44:45 +08:00
showLoading: true,
company_type: "",
// 1上传2审核3审核结束
2023-08-30 11:28:35 +08:00
step: 1,
2023-08-31 10:44:45 +08:00
applicationList: [1],
2023-08-30 11:28:35 +08:00
show: false,
carLicense: "",
2023-08-24 18:32:34 +08:00
showPop: false,
2023-08-31 10:44:45 +08:00
datas: {},
2023-08-30 11:28:35 +08:00
dataList: [],
2023-08-24 18:32:34 +08:00
newCarNum: "",
2023-09-01 21:40:33 +08:00
newcarTit: "",
2023-08-22 16:01:58 +08:00
};
},
2023-09-01 21:40:33 +08:00
2023-08-29 11:11:19 +08:00
onLoad() {
2023-08-31 10:44:45 +08:00
let type = (JSON.parse(Cache.get("USER_INFO")).company.company_type)
this.company_type = type
// 小组公司
if (type == 18) {
// getvehicleDetailApi().then(res => {})
villageCompanyApi().then(res => {
2023-09-01 21:40:33 +08:00
if (!res.data?.id) {
this.showLoading = false
this.step = 999
return
}
2023-08-31 10:44:45 +08:00
this.showLoading = false
2023-09-01 21:40:33 +08:00
this.datas = res.data
this.step = res.data.status
2023-08-31 10:44:45 +08:00
switch (this.step) {
case 3:
2023-09-01 21:40:33 +08:00
uni.redirectTo({
url: `/subpkg/property/vehicle_a?id=${res.data.cars_info.id}`
2023-08-31 10:44:45 +08:00
})
// this.step =
break;
default:
break;
}
})
}
// 镇街公司
else {
getvehicleListApi().then(res => {
this.datas = res.data
2023-09-01 21:40:33 +08:00
2023-08-31 10:44:45 +08:00
res.data.apply.length >= 2 ? this.applicationList = res.data.apply : this.applicationList = res
.data.apply.slice(0, 2)
2023-09-01 21:40:33 +08:00
// this.applicationList = res.data.apply
2023-08-31 10:44:45 +08:00
this.dataList = res.data.car_list
this.showLoading = false
})
// getAgencyListApi().then(res => {
// this.applicationList = res.data
// })
}
// if (true) {
// uni.navigateTo({
// url: '/subpkg/property/vehicle_a'
// })
// }
// getvehicleListApi().then(res => {
// console.log(res)
// // this.getvehicleList = res
// })
// getAgencyListApi().then(res => {
// // this.applicationList=res
// })
2023-08-29 11:11:19 +08:00
},
2023-08-22 16:01:58 +08:00
methods: {
2023-08-31 10:44:45 +08:00
// 申请车辆
2023-08-30 11:28:35 +08:00
applycarFn() {
2023-08-31 10:44:45 +08:00
upVehicleApi().then(res => {
Toast(res.msg)
2023-09-01 21:40:33 +08:00
this.step = 2
2023-08-31 10:44:45 +08:00
})
2023-08-30 11:28:35 +08:00
},
2023-08-31 10:44:45 +08:00
// 自有车辆
2023-08-30 11:28:35 +08:00
upCarFn() {
upVehicleApi({
license: this.carLicense
}).then(res => {
2023-09-01 21:40:33 +08:00
// this.show = false
2023-08-31 10:44:45 +08:00
this.step = 2
2023-08-30 11:28:35 +08:00
})
2023-08-31 10:44:45 +08:00
// upVehicleApi({
// license: this.carLicense
// }).then(res => {
// this.show = false
// })
2023-09-01 21:40:33 +08:00
this.show = false
2023-08-30 11:28:35 +08:00
},
2023-08-22 16:01:58 +08:00
signFn() {
2023-08-29 11:11:19 +08:00
this.toDetail("/subpkg/property/chosseCompany")
2023-08-22 16:01:58 +08:00
},
2023-08-24 18:32:34 +08:00
confirm() {
if (!this.newCarNum) return
2023-08-30 11:28:35 +08:00
leaseApi({
num: Number(this.newCarNum)
}).then(res => {
this.newCarNum = ""
Toast(res.msg)
})
2023-08-24 18:32:34 +08:00
this.showPop = false
},
2023-08-29 11:11:19 +08:00
navgo(url) {
2023-08-22 16:01:58 +08:00
uni.navigateTo({
url
})
},
2023-08-31 10:44:45 +08:00
2023-08-22 16:01:58 +08:00
}
}
</script>
<style lang="scss">
2023-08-31 10:44:45 +08:00
.dots {
animation: loadingDots 1s infinite;
}
@keyframes loadingDots {
0% {
opacity: 0;
}
25% {
opacity: 0;
}
50% {
opacity: 1;
}
75% {
opacity: 1;
}
100% {
opacity: 0;
}
2023-08-22 16:01:58 +08:00
}
2023-08-30 11:28:35 +08:00
.noCar {
2023-09-01 21:40:33 +08:00
padding: 100rpx;
2023-08-31 10:44:45 +08:00
margin-top: 30vh;
2023-09-01 21:40:33 +08:00
word-wrap: break-word;
overflow-wrap: break-word;
2023-08-31 10:44:45 +08:00
// position: absolute;
// width: 80vw;
// height: auto;
// position: absolute;
// top: 40vh;
// left: 50vw;
// transform: translate(-50%, -50%);
2023-08-30 11:28:35 +08:00
}
2023-08-29 11:11:19 +08:00
.info {
display: flex;
justify-content: space-around;
margin: 10rpx 0 0 0;
.not_leased {
display: flex;
align-items: center;
// background-color: red;
flex-direction: column;
}
.triangle-up {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 10px solid rgba(0, 0, 0, .5);
}
.message_bottom {
background-color: rgba(0, 0, 0, .5);
color: white;
// transform: translateX();
padding: 20rpx;
border-radius: 30rpx;
}
}
.application_tit {
background-color: white;
padding: 20rpx;
width: 694rpx;
border-radius: 20rpx;
margin: 20rpx auto 0;
.head {
display: flex;
justify-content: space-between;
}
.content {
.li {
margin: 10rpx 0;
display: flex;
justify-content: space-between;
.date {
background-color: #FF7C32;
color: white;
padding: 0 10rpx;
2023-08-31 10:44:45 +08:00
border-radius: 15rpx // width: 170rpx;
2023-08-29 11:11:19 +08:00
}
.text {
// background-color: lightyellow;
2023-08-31 10:44:45 +08:00
max-width: 400rpx;
2023-08-29 11:11:19 +08:00
white-space: nowrap;
/* 让文本不换行 */
overflow: hidden;
/* 隐藏溢出的文本 */
text-overflow: ellipsis;
}
.detail {
// background-color: black;
// width: 50rpx;
}
}
}
2023-08-24 18:32:34 +08:00
}
2023-08-29 11:11:19 +08:00
2023-08-22 16:01:58 +08:00
.personnel_list {
padding: 28rpx 0;
margin-bottom: 130rpx;
2023-08-23 11:35:09 +08:00
.empty {
2023-08-24 18:32:34 +08:00
padding-top: 200rpx;
2023-08-23 11:35:09 +08:00
text-align: center;
.btn {
width: 30vw;
margin-top: 10rpx;
2023-08-24 18:32:34 +08:00
margin: 10rpx auto;
2023-08-23 11:35:09 +08:00
}
// height: 80vh;
// background-color: red;
}
2023-08-22 16:01:58 +08:00
.cards {
margin: 0 auto;
margin-bottom: 28rpx;
width: 694rpx;
background: #ffffff;
border-radius: 30rpx;
opacity: 1;
overflow: hidden;
// box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
.cards_head {
padding: 28rpx;
background-color: $theme-oa-color;
color: white;
height: 100rpx;
display: flex;
justify-content: space-between;
}
.cards_content {
padding: 10rpx 28rpx;
display: flex;
justify-content: space-between;
.left {
text-align: center;
// padding: 15rpx 25rpx;
padding-top: 20rpx;
width: 160rpx;
background-color: $theme-oa-color;
color: white;
border-radius: 40rpx;
.cir {
width: 120rpx;
height: 120rpx;
background-color: #ffffff;
margin-left: 25rpx;
border-radius: 120rpx;
position: relative;
}
}
.right {
display: flex;
flex-direction: column;
justify-content: space-between;
.li {
margin: 10rpx 0;
width: 85vw;
.check_box {
// background-color: #ff0000;
// color: red;
}
2023-08-29 11:11:19 +08:00
2023-08-22 16:01:58 +08:00
text:nth-child(1) {
margin-right: 20rpx;
}
}
}
}
}
}
</style>