<template>
	<view>
		<!-- 有车辆 -->
		<view v-if="1">
			<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">
						<!-- <u--input placeholder="请选择日期" suffixIcon="clock" class="ipt" border="surround"
							v-model="queryData" @focus='fousFn'></u--input> -->
						<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.}} --> --></text>
							</view>
							<view class="cards_content">
								<view class="right">
									<view class="li">
										<text>行驶总里程: </text>
										<text> <!-- {{datas.}} --></text>
									</view>
									<view class="li">
										<text>本公司签约时间: </text>
										<text><!-- {{datas.}} --></text>
									</view>
									<view class="li">
										<text>承租公司: </text>
										<text><!-- {{datas.}} --> </text>
									</view>
									<view class="li">
										<text>负责人: </text>
										<text><!-- {{datas.}} --> </text>
									</view>
									<view class="li">
										<text>联系方式: </text>
										<text> <!-- {{datas.}} --> </text>
									</view>
									<view class="li">
										<text>所属区域: </text>
										<text> <!-- {{datas.}} --></text>
									</view>
									<view class="li">
										<text>签约时间: </text>
										<text><!-- {{datas.}} --> </text>
									</view>
									<view class="li">
										<text>到期时间: </text>
										<text> <!-- {{datas.}} --> </text>
									</view>
								</view>
							</view>
						</view>
					</view>


				</view>
			</view>
			<u-calendar @close='showDate=false' color="#0122C7" :show="showDate" @confirm="dateFn"></u-calendar>
		</view>



		<!-- 没有车辆 -->
		<!-- <view class="" v-else>
			<view class="" v-if="!isMycar">
				<view class="empty_car">
					<view>
						您还没有所属车辆哦,请等待镇公司发放车辆或使用自有车辆并绑定系统
					</view>
					<u-button @click="showPop=true" type="primary" class="btn_cls">
						上传自有车辆</u-button>
				</view>
				<view class="">
					<u-modal :show="showPop" @close="showPop=false" @confirm="confirm" :closeOnClickOverlay="true"
						title="请输入车牌号">
						<view class="slot-content">
							<u--input placeholder="请输入内容" v-model="myCarnum"></u--input>
						</view>
					</u-modal>
				</view>
			</view>
			<view style="text-align: center;margin-top: 100rpx;" v-if="isMycar">
				您上传自有车两,系统正在审核中,请耐心等待
			</view>

		</view>
 -->


	</view>

</template>

<script>
	import mybtn from "@/components/mybtn/mybtn.vue"
	import {
		getvehicleDetail,
		locusApi
	} from "@/api/property.js"
	import {
		Toast
	} from "../../libs/uniApi";
	export default {
		components: {
			mybtn
		},
		data() {
			return {
				allMap: false,
				showDate: false,
				// isMycar: false,
				showPop: false,
				datas: {},
				queryData: "请选择时间",
				// myCarnum: "",
				mapClass: 'custom-map',
				scale: 17,
				markers: [
					// 目的地
					{
						id: 1,
						latitude: 28.8733,
						longitude: 105.445717,
						iconPath: '../../static/img/logistics/WZ.png', //显示的图标        
					},
					// 当前所在位置
					{
						id: 2,
						latitude: 28.8733,
						longitude: 105.444828,
						iconPath: '../../static/img/logistics/QS.png', //显示的图标        
					}
				],
				polyline: [],


			}
		},
		onLoad(options) {
			// getvehicleDetail().then(res => {
			// this.datas = res
			// })

		},
		methods: {

			dateFn(e) {
				// console.log(e)
				this.queryData = e[0]
				this.showDate = false
			},
			// confirm() {
			// 	if (this.myCarnum) {
			// 		console.log(this.myCarnum)
			// 		this.showPop = false
			// 		this.isMycar = true
			// 	}
			// },
			showPloyline() {
				// console.log(this.queryData)
				// this.queryData
				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() {
			// this.getOrderList();
			// this.getIndexList()
			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>