438 lines
10 KiB
Vue
438 lines
10 KiB
Vue
<template>
|
|
<view>
|
|
<view class="content">
|
|
<view :class="allMap?'map1':'map2'" style="position: relative;" v-if="showMap">
|
|
<map :class="mapClass" id="map" :enable-zoom="true" :polyline="polyline" :markers='markers'
|
|
:scale="scale" style="width:100%;height: 100%;" :latitude="markers[0].latitude"
|
|
:enable-scroll="true" :longitude="markers[0].longitude" @tap="allMap=!allMap">
|
|
</map>
|
|
</view>
|
|
<view v-if="!allMap">
|
|
<view class="query">
|
|
<view class="ipt" @click="showDate=true">
|
|
<text>{{queryData}}</text>
|
|
<u-icon name="clock" size="24"></u-icon>
|
|
</view>
|
|
<u-button type="primary" class='poline_btn' @click="showPloyline" text="显示轨迹"></u-button>
|
|
</view>
|
|
<view class="personnel_list" @click="toDetail('/subpkg/property/vehicle')">
|
|
<view class="cards">
|
|
<view class="cards_head">
|
|
<text>{{datas.car_license}}</text>
|
|
</view>
|
|
<view class="cards_content" v-if="datas.company">
|
|
<view class="right">
|
|
<view class="li" style="display: flex;justify-content: space-between;">
|
|
<text>行驶总里程: {{datas.mileage}}</text>
|
|
<text v-if="datas.type==2" style="color: green;">购买车辆</text>
|
|
<text v-if="datas.type==0" style="color: green;">租赁车辆</text>
|
|
<text v-if="datas.type==1" style="color: green;">自有车辆</text>
|
|
</view>
|
|
<view class="li">
|
|
<text>承租公司: </text>
|
|
<text>{{datas.company.company_name}} </text>
|
|
</view>
|
|
<view class="li">
|
|
<text>负责人: </text>
|
|
<text>{{datas.company.user_name}} </text>
|
|
</view>
|
|
<view class="li">
|
|
<text>联系方式: </text>
|
|
<text> {{datas.company.user_phone}} </text>
|
|
</view>
|
|
<view class="li">
|
|
<text>所属区域: </text>
|
|
<text> {{datas.company.area_name}}</text>
|
|
</view>
|
|
<view class="li">
|
|
<text>签约时间: </text>
|
|
<text>{{datas.rent_time}} </text>
|
|
</view>
|
|
<view class="li" v-if="datas.type==1">
|
|
<text>到期时间: </text>
|
|
<text> {{overDateFn(datas.rent_time) }} </text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-button v-if="datas.type==1&&company_type==18" type="primary" class='poline_btn'
|
|
color="#FF7C32" @tap="cancelContractFn" text="解除合同"></u-button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="">
|
|
<!-- <u--image width="100rpx" height="100rpx" style="margin-right:20rpx"></u--image> -->
|
|
</view>
|
|
<!-- 合同 -->
|
|
<!-- {{datas.contract}} -->
|
|
<view class="card" v-if="showCont">
|
|
<view class="contract">
|
|
<view class="left">
|
|
<u--image :showLoading="true" src="../../static/img/contract/pdf.png" width="80px"
|
|
height="80px"></u--image>
|
|
<view class="text">
|
|
<view class="name" v-if="datas.type==0">《租赁合同》</view>
|
|
<view class="name" v-if="datas.type==1">《自有车辆合同》</view>
|
|
<view class="name" v-if="datas.type==2">《购车合同》</view>
|
|
<!-- <view class="name">《购买合同》</view> -->
|
|
<view>
|
|
<text>{{ datas.create_time}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="right" @click="navToContract(dataList.file)"> -->
|
|
<!-- <view class="right" @click="showContractFn(datas.contract.file)"> -->
|
|
<view class="right" @click="showContractFn(datas.contract.contract_url)">
|
|
<uni-icons type="paperclip" color="#3274F9"></uni-icons>
|
|
<view>查看</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<mybtn text="购买车辆"
|
|
@click="navTo2(`/subpkg/property/buyCar?license=${datas.car_license}&type=${datas.type}`)"
|
|
v-if="company_type==18"></mybtn>
|
|
|
|
</view>
|
|
|
|
<web-view style="height: 100vh;" :src="pdfUrl" v-if="showPDF"></web-view>
|
|
|
|
<!-- u_view组件 -->
|
|
<view class="">
|
|
<u-calendar @close='showDate=false' :minDate="minDate" :maxDate="maxDate" color="#0122C7" :show="showDate"
|
|
@confirm="dateFn"></u-calendar>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import mybtn from "@/components/mybtn/mybtn.vue"
|
|
import {
|
|
getvehicleDetailApi,
|
|
locusApi,
|
|
villageCompanyApi,
|
|
cancelContractApi
|
|
} from "@/api/property.js"
|
|
import {
|
|
Toast
|
|
} from "../../libs/uniApi";
|
|
import Cache from '@/utils/cache';
|
|
export default {
|
|
components: {
|
|
mybtn
|
|
},
|
|
data() {
|
|
return {
|
|
company_type: 0,
|
|
showMap: true,
|
|
pdfUrl: "",
|
|
showPDF: false,
|
|
minDate: '',
|
|
maxDate: '',
|
|
allMap: false,
|
|
showDate: false,
|
|
showPop: false,
|
|
datas: {},
|
|
queryData: "请选择时间",
|
|
mapClass: 'custom-map',
|
|
scale: 17,
|
|
showCont: false,
|
|
markers: [{
|
|
id: 2,
|
|
latitude: 28.8733,
|
|
longitude: 105.444828,
|
|
iconPath: '../../static/img/logistics/QS.png', //显示的图标
|
|
}],
|
|
polyline: [],
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.company_type = (JSON.parse(Cache.get("USER_INFO")).company.company_type)
|
|
// console.log(this.$route.query.id)
|
|
// if (this.$route.query.type) {
|
|
// villageCompanyApi().then(res => {
|
|
// this.datas = res.data
|
|
// })
|
|
// return
|
|
// }
|
|
// console.log(this.$route.query.id)
|
|
getvehicleDetailApi({
|
|
// car_id: this.$route.query.id
|
|
car_id: options.id
|
|
}).then(res => {
|
|
this.datas = res.data
|
|
this.markers[0].latitude = res.data.position?.lat
|
|
this.markers[0].longitude = res.data.position?.lon
|
|
if (this.datas.contract) {
|
|
this.showCont = true
|
|
}
|
|
})
|
|
this.minDateFn()
|
|
// console.log(this.datas)
|
|
|
|
// console.log(date - 7)
|
|
|
|
},
|
|
methods: {
|
|
navTo(url) {
|
|
uni.navigateTo({
|
|
url
|
|
})
|
|
},
|
|
navTo2(url) {
|
|
uni.redirectTo({
|
|
url
|
|
})
|
|
},
|
|
// 计算到期时间
|
|
overDateFn(date) {
|
|
var specifiedDate = new Date(date);
|
|
specifiedDate.setMonth(specifiedDate.getMonth() + 2);
|
|
return specifiedDate.toISOString().split('T')[0]
|
|
},
|
|
showContractFn(url) {
|
|
console.log(url)
|
|
uni.navigateTo({
|
|
url: `/subpkg/pdfView/pdfView?url=${url}`
|
|
})
|
|
},
|
|
cancelContractFn() {
|
|
cancelContractApi({
|
|
car_id: this.datas.car_id
|
|
}).then(res => {
|
|
Toast("解除成功")
|
|
setTimeout(() => {
|
|
uni.redirectTo({
|
|
url: '/subpkg/property/index'
|
|
})
|
|
}, 2000)
|
|
})
|
|
},
|
|
minDateFn() {
|
|
const today = new Date();
|
|
const sevenDaysAgo = new Date(today.getTime() - 7 * 24 * 60 * 60 * 1000);
|
|
const nowDate = new Date()
|
|
const year = sevenDaysAgo.getFullYear();
|
|
const month = String(sevenDaysAgo.getMonth() + 1).padStart(2, '0');
|
|
const day = String(sevenDaysAgo.getDate()).padStart(2, '0');
|
|
this.minDate = `${year}-${month}-${day}`
|
|
this.maxDate = `${nowDate.getFullYear()}-${nowDate.getMonth() + 1}-${nowDate.getDate()}`
|
|
},
|
|
dateFn(e) {
|
|
this.queryData = e[0]
|
|
this.showDate = false
|
|
},
|
|
showPloyline() {
|
|
let points = []
|
|
locusApi({
|
|
car_id: 7,
|
|
end_time: `${this.queryData} 23:59:59`,
|
|
start_time: `${this.queryData} 00:00:00`,
|
|
}).then(res => {
|
|
// console.log(res.data)
|
|
this.markers[0].latitude = res.data[0].latitude
|
|
this.markers[0].longitude = res.data[0].longitude
|
|
this.polyline = [{
|
|
points: res.data,
|
|
color: "#0091ff",
|
|
dottedLine: true,
|
|
width: 10,
|
|
}]
|
|
})
|
|
|
|
// locusApi().then(res => {
|
|
// points=res
|
|
// })
|
|
|
|
|
|
// console.log(this.polyline)
|
|
},
|
|
},
|
|
onPullDownRefresh() {
|
|
uni.stopPullDownRefresh();
|
|
},
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang='scss' scoped>
|
|
.empty_car {
|
|
padding: 200rpx 50rpx;
|
|
|
|
.btn_cls {
|
|
background-color: #0122C7;
|
|
border: none;
|
|
width: 40vw;
|
|
margin: 20rpx auto;
|
|
}
|
|
}
|
|
|
|
.query {
|
|
display: flex;
|
|
background-color: #F5F5F5;
|
|
margin: 20rpx 0 0 0;
|
|
|
|
.ipt {
|
|
background-color: white;
|
|
width: 60vw;
|
|
border-radius: 10rpx;
|
|
padding: 10rpx;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
line-height: 60rpx;
|
|
padding-left: 30rpx;
|
|
/* margin: 0 auto; */
|
|
/* line-height: auto; */
|
|
|
|
|
|
}
|
|
|
|
.poline_btn {
|
|
width: 20vw;
|
|
margin-left: 20rpx;
|
|
background-color: $theme-oa-color;
|
|
border: none;
|
|
/* color: black; */
|
|
}
|
|
}
|
|
|
|
.personnel_list {
|
|
padding: 28rpx 0;
|
|
|
|
|
|
.empty {
|
|
padding-top: 200rpx;
|
|
text-align: center;
|
|
|
|
.btn {
|
|
width: 30vw;
|
|
margin-top: 10rpx;
|
|
margin: 10rpx auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
// height: 80vh;
|
|
// background-color: red;
|
|
}
|
|
|
|
.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-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;
|
|
|
|
|
|
text:nth-child(1) {
|
|
margin-right: 20rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.custom-map /deep/ .polyline {
|
|
stroke-width: 20px;
|
|
}
|
|
|
|
.content {
|
|
padding: 2vh 3vw;
|
|
background-color: #F5F5F5;
|
|
height: 100vh;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.map1 {
|
|
height: 100vh;
|
|
width: 100vw;
|
|
border-radius: 2vw;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.map2 {
|
|
height: 20vh;
|
|
border-radius: 2vw;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.card {
|
|
background-color: white;
|
|
border-radius: 14rpx;
|
|
padding: 20rpx;
|
|
|
|
.contract {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
.left {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.text {
|
|
// background-color: red;
|
|
height: 80px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-around;
|
|
margin-left: 15rpx;
|
|
}
|
|
}
|
|
|
|
.right {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
</style> |