<template>
	<view class="container">
		<headers title="地图详情"></headers>
		<view class="c-top">
			<image :src="imgs" mode=""></image>
			<!-- p -->
			<view class="c-box">
				<!-- 上 -->
				<view class="cor-top">
					<view class="c-title">{{arr.title}}</view>
					<view class="biaoq">
						<view class="">{{arr.time}}</view>
					</view>
				</view>
				<!-- 下 -->
				<view class="xia">
					<view class="x-top">
						<view class="c-tzi">{{arr.address}}</view>
						<view class="hui">{{arr.tel}}</view>
					</view>
					<view class="x-right" @click="gotel(arr.tel)">
						<view class="ddh">
							<image src="../../static/ddh.png" mode=""></image>
						</view>
						<view class="" style="margin-top: 10rpx;">打电话</view>
					</view>
				</view>
			</view>
		</view>
		<view style="width: 100%; height: 250rpx; "></view>
		<view class="details">
			<view class="det-top">
				<view class="det-left">
					<view>详细介绍</view>
				</view>
			</view>
			<view class="det-box">
				{{arr.desc}}
			</view>
		</view>
		<view class="xanniu" @click="sbphp()">
			<view class="">开始导航</view>
		</view>
		<view style="width: 100%; height: 80rpx;"></view>

	</view>

</template>

<script>
	import headers from '../../components/headers/headers.vue'
	import {
		request
	} from "@/request/index.js"
	export default {
		data() {
			return {
				id: '',
				arr: {},
				imgs: ''
			}
		},
		onLoad(option) {
			this.id = option.id
			this.GetMapItem()
		},
		onShow() {
			this.huo()
		},
		components: {
			headers
		},
		methods: {
			huo() {
				uni.getLocation({
					type: 'wgs84',
					success: function(res) {
						console.log('当前位置的经度：' + res.longitude);
						console.log('当前位置的纬度：' + res.latitude);
					}
				});
			},
			async GetMapItem() {
				const res = await request({
					url: 'GetMapItem',
					data: {
						id: this.id
					}
				})
				console.log('详情', res);
				this.arr = res.data
				this.imgs = res.data.imgs[0]
			},
			sbphp() {
				wx.openLocation({
					latitude: Number(this.arr.lat),
					longitude: Number(this.arr.lng),
					name: this.arr.title,
					address: this.arr.address,
					scale: 28
				})
			},
			gotel(e) {
				uni.makePhoneCall({
					phoneNumber: e //仅为示例
				});
			}

		}


	}
</script>

<style scoped lang="scss">
	.container {
		width: 100%;
		height: calc(100vh);
		background: #f3f6fd;

	}

	.c-top {
		width: 100%;
		height: 468rpx;

		position: relative;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.c-box {
		bottom: -230rpx;
		position: absolute;
		z-index: 99;
		width: 95%;
		height: 278rpx;
		background: white;
		border-radius: 16rpx;
		left: 50%;
		transform: translateX(-50%);
		box-sizing: border-box;
		padding: 30rpx;

	}

	.c-title {
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
		display: -webkit-box;
		overflow: hidden;
		text-overflow: ellipsis;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}

	.biaoq {
		// width: 136rpx;
		
		height: 40rpx;
		background: #E5EEF5;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		color: #2B92F3;
		background: #E5EEF5;
		font-size: 24rpx;
		font-weight: 400;
		
		margin: 20rpx 0rpx;
		padding: 5px 20px;
		display: inline-block;

	}

	.cor-top {
		border-bottom: 2rpx solid #EEEEEE;
	}

	.c-tzi {
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
		line-height: 28rpx;
		display: -webkit-box;
		overflow: hidden;
		text-overflow: ellipsis;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.hui {
		margin-top: 20rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #999999;
	}

	.xia {
		box-sizing: border-box;
		padding: 20rpx 0rpx;
		display: flex;
		justify-content: space-between;
	}

	.x-right {
		width: 15%;
		border-left: 2rpx solid #EEEEEE;
		font-size: 24rpx;
		font-weight: 400;
		color: #333333;
		text-align: center;
	}

	.details {
		width: 95%;
		margin: 0 auto;
		border-radius: 16rpx;
		box-sizing: border-box;
		overflow: hidden;
	}

	.det-top {
		overflow: hidden;
		height: 72rpx;
		background: #D2E7FB;

		.det-left {
			width: 188rpx;
			height: 100%;
			background: linear-gradient(180deg, #55AAFA 0%, #2E89DE 100%);
			color: white;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}

	.det-box {
		box-sizing: border-box;
		padding: 30rpx;
		background-color: white;
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
		line-height: 50rpx;
	}

	.xanniu {
		width: 95%;
		height: 92rpx;
		background: #2B92F3;
		border-radius: 46rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		color: white;
		font-size: 32rpx;
		color: white;
		margin: 20rpx auto;
		margin-bottom: 40rpx;

	}

	.ddh {
		margin: 0 auto;

		// overflow: hidden;

		image {
			width: 33rpx;
			height: 44rpx;
		}
	}
</style>