<template>
	<view class="refuelDetail">
		<zs-header :background="background"></zs-header>
		<image class="banner" src="http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/657c35e3cae1326607ea9ed2/ext/SHOP_INFO/1977.jpg_wh300.jpg/7.jpg" mode=""></image>
		<view class="content">
			<view class="title">
				中国石化富源加油站
			</view>
			<view class="time">
				营业时间 周一至周日 00：00-24：00
			</view>
			<view class="distance">
				距离您5.6公里 驾车24分钟
			</view>
			<view class="address-box">
				<view class="address">
					毓秀路街道延安中路13号(喷水池地
					铁站K出口旁)
				</view>
				
				<view class="btn-box">
					<view class="btn" @click="handleNavigation">
						导航
					</view>
					<view class="btn" @click="handleCall">
						电话
					</view>
				</view>
			</view>
			
			<view class="price-box">
				<view class="price">
					优惠加油 ¥7.89/L
				</view>
				<view class="old-price">
					国标价¥7.89/L
				</view>
			</view>
			
			<view class="choose-box">
				<view class="item" @click="hanleChoose">
					请选择油号
					<image class="icon" src="../static/shop-desc.png" mode=""></image>
				</view>
				<view class="item" @click="hanleChoose">
					请选择油枪
					<image class="icon" src="../static/shop-desc.png" mode=""></image>
				</view>
			</view>
			
		</view>
		<view class="buy-box">
			<button class="buy-btn" type="default" @click="">立即支付</button>
		</view>
		
		<u-popup :show="show" round="16rpx" mode="bottom" @close="close">
			<view class="popup-title">
				选择油号/油枪
			</view>
			<view class="item-box">
				<view class="sub-title">
					选择油号
				</view>
				<view class="box">
					<view class="item">
						92#
					</view>
					<view class="item active">
						95#
					</view>
					<view class="item">
						98#
					</view>
				</view>
			</view>
			
			<view class="item-box">
				<view class="sub-title">
					选择油枪
				</view>
				<view class="box">
					<view class="item active">
						1
					</view>
					<view class="item">
						2
					</view>
					<view class="item">
						3
					</view>
					<view class="item m0">
						4
					</view>
					<view class="item">
						5
					</view>
				</view>
			</view>
			
		</u-popup>
		
		<map class="map" id="map"></map>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				background:false,
				map:null,
				show:false,
			}
		},
		methods: {
			handleNavigation() {
				this.map.openMapApp({
					longitude:104.117262,
					latitude:30.598726,
					destination:'目的地',
					success(res){
						
					}
				}) 
			},
			handleCall() {
				uni.makePhoneCall({
					phoneNumber: '10086' //仅为示例
				});
			},
			hanleChoose(){
				this.show = true
			},
			close(){
				this.show = false
			}
		},
		onPageScroll(e) {
				if (e.scrollTop >= 50) {
					this.background = true
				} else {
					this.background = false
				}
		},
		onReady() {
			this.map = uni.createMapContext("map", this);
		}
	}
</script>

<style lang="scss" >
.refuelDetail{
	.banner{
		width: 100%;
		height: 382rpx;
	}
	.content{
		margin-top: -20rpx;
		min-height: 500rpx;
		border-radius: 16rpx 16rpx 0 0;
		position: relative;
		z-index: 2;
		background: #fff;
		padding: 28rpx 24rpx;
		.title{
			font-weight: 600;
			font-size: 32rpx;
			color: #222222;
		}
		.time{
			font-weight: 300;
			font-size: 24rpx;
			color: #AAAAAA;
			padding: 20rpx 0;
			border-bottom: 1rpx solid #F0F0F0;
		}
		.distance{
			font-weight: 300;
			font-size: 24rpx;
			color: #AAAAAA;
			padding: 20rpx 0;
		}
		.address-box{
			display: flex;
			align-items: center;
			justify-content: space-between;
			width: 702rpx;
			height: 140rpx;
			background-image: url('@/static/white-map.png');
			background-repeat: repeat;
			background-size: 100% 140rpx;
			box-sizing: border-box;
			padding: 36rpx 24rpx;
			.address{
				font-weight: 600;
				font-size: 24rpx;
				color: #222222;
				line-height: 40rpx;
				overflow: hidden;
				padding-right: 20rpx;
				text-overflow: ellipsis;
				/* 弹性伸缩盒子模型显示 */
				display: -webkit-box;
				/* 限制在一个块元素显示的文本的行数 */
				-webkit-line-clamp: 2;
				/* 设置或检索伸缩盒对象的子元素的排列方式 */
				-webkit-box-orient: vertical;
			}
			.btn-box{
				display: flex;
				.btn+.btn{
					margin-left: 16rpx;
				}
				.btn{
					width: 120rpx;
					height: 52rpx;
					line-height: 52rpx;
					text-align: center;
					background: #E2ECFF;
					border-radius: 26rpx 26rpx 26rpx 26rpx;
					font-weight: 300;
					font-size: 28rpx;
					color: #3879F9;
				}
			}
		}
		.price-box{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx 0;
			.price{
				font-weight: 600;
				font-size: 28rpx;
				color: #222222;
			}
			.old-price{
				font-weight: 300;
				font-size: 24rpx;
				color: #AAAAAA;
			}
		}
		.choose-box{
			display: flex;
			justify-content: space-between;
			.item{
				width: 340rpx;
				height: 80rpx;
				line-height: 80rpx;
				text-align: center;
				background: #F0F0F0;
				border-radius: 8rpx;
				font-weight: 600;
				font-size: 28rpx;
				color: #222222;
				position: relative;
				.icon{
					width: 32rpx;
					height: 32rpx;
					position: absolute;
					top: 50%;
					right: 24rpx;
					transform: translateY(-50%);
				}
			}
			.item.active{
				background: #FFF6F5;
				color: #FF4D3A;
			}
		}
		
	}
	.buy-box{
		position: fixed;
		bottom: 0%;
		left: 0%;
		width: 100%;
		background: #fff;
		padding: 10rpx 24rpx env(safe-area-inset-bottom);
		border-top: 1rpx solid #EEEEEE;
		box-sizing: border-box;
		.buy-btn{
			width: 702rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			background: $uni-color-primary;
			border-radius: 40rpx;
			font-weight: 600;
			font-size: 28rpx;
			color: #FFFFFF;
		}
		
	}
	
	.map{
		position: absolute;
		top: -9999rpx;
		left: -9999rpx;
	}
	
	.u-popup__content{
		padding: 28rpx 24rpx;
		background: #F9F9F9 !important;
		.popup-title{
			font-weight: 600;
			font-size: 32rpx;
			color: #222222;
		}
		.item-box{
			width: 100%;
			background: #FFFFFF;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin-top: 20rpx;
			padding: 24rpx;
			box-sizing: border-box;
			.sub-title{
				font-weight: 600;
				font-size: 28rpx;
				color: #222222;
				margin-bottom: 20rpx;
			}
			.box{
				display: flex;
				flex-wrap: wrap;
				.item{
					width: 148rpx;
					height: 52rpx;
					line-height: 52rpx;
					text-align: center;
					background: #F0F0F0;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
					font-weight: 400;
					font-size: 28rpx;
					color: #222222;
					margin-bottom: 20rpx;
					margin-right: 20rpx;
				}
				.item.active{
					background: #FFF6F5;
					color: #EE4320;
				}
				.item.m0{
					margin-right: 0!important;
				}
			}
		}
	}
}
</style>