OfficeApp/subpkg/property/vehicle_a.vue
2023-08-31 10:44:45 +08:00

319 lines
6.4 KiB
Vue

<template>
<view>
<view class="content">
<view :class="allMap?'map1':'map2'" style="position: relative;">
<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">
<view class="right">
<view class="li">
<text>行驶总里程: {{datas.mileage}}</text>
</view>
<view class="li">
<text>承租公司: </text>
<text>{{datas.company.company_name}} </text>
</view>
<view class="li">
<text>负责人: </text>
<text>{{datas.company.master_name}} </text>
</view>
<view class="li">
<text>联系方式: </text>
<text> {{datas.company.master_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">
<text>到期时间: </text>
<text> {{datas.rent_time}} </text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<u-calendar @close='showDate=false' :minDate="minDate" :maxDate="maxDate" color="#0122C7" :show="showDate"
@confirm="dateFn"></u-calendar>
</view>
</template>
<script>
import mybtn from "@/components/mybtn/mybtn.vue"
import {
getvehicleDetailApi,
locusApi,
villageCompanyApi
} from "@/api/property.js"
import {
Toast
} from "../../libs/uniApi";
const d = new Date()
const year = d.getFullYear()
let month = d.getMonth() + 1
month = month < 10 ? `0${month}` : month
const date = d.getDate()
export default {
components: {
mybtn
},
data() {
return {
minDate: `${year}-${month}-${date -30}`,
maxDate: `${year}-${month}-${date }`,
allMap: false,
showDate: false,
showPop: false,
datas: {},
queryData: "请选择时间",
mapClass: 'custom-map',
scale: 17,
markers: [{
id: 2,
latitude: 28.8733,
longitude: 105.444828,
iconPath: '../../static/img/logistics/QS.png', //显示的图标
}],
polyline: [],
}
},
onLoad(options) {
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
}).then(res => {
this.datas = res.data
console.log()
})
},
methods: {
dateFn(e) {
// console.log(e)
this.queryData = e[0]
this.showDate = false
},
showPloyline() {
console.log(this.queryData)
return
// this.queryData
locusApi({
// car_id: 7,
// start_time: `${this.queryData} 00:00:00`,
// end_time: `${this.queryData} 23:59:59`,
car_id: 7,
end_time: '2023-08-29 23:59:59',
start_time: '2023-08-29 00:00:00',
}).then(res => {
console.log(res)
})
let points = [{
latitude: 28.916722,
longitude: 105.443274,
},
{
latitude: 28.916762,
longitude: 105.443132,
},
]
// locusApi().then(res => {
// points=res
// })
this.polyline = [{
points: points,
color: "#0091ff",
dottedLine: true,
width: 30,
}]
},
},
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;
}
}
.personnel_list {
padding: 28rpx 0;
margin-bottom: 130rpx;
.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: 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;
}
// background-color: red;
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: 30vh;
border-radius: 2vw;
overflow: hidden;
}
</style>