<template>
	<view class="page">
		<u-navbar title="租车" :border-bottom="false" :background="bgc" back-icon-color="#fff" title-color='#fff'
			title-size='36' height='36' id="navbar">
		</u-navbar>
        <image src="https://api.ccttiot.com/smartmeter/img/static/ufnKclY97rQBwg9AZbFF" mode="aspectFill" class="bj"></image>
        <view class="xinxi">
        	<view class="name">
        		云行租车（汇丰公寓）
        	</view>
			<view class="cen">
				<view class="lt">
					<view class="dizhi">
						天目山路148号
					</view>
					<view class="time">
						<text>营业时间</text> | 06:00 - 23:00
					</view>
				</view>
				<view class="rt">
					<view class="" @click="btndaohang">
						<image src="https://api.ccttiot.com/smartmeter/img/static/ua5VuL6pPrfDaXbNRTw1" mode=""></image>
						727m
					</view>
					<view class="" @click="btntel">
						<image src="https://api.ccttiot.com/smartmeter/img/static/uaL6QvBHUkZjRijXJfmH" mode=""></image>
						电话
					</view>
				</view>
			</view>
			<view class="zuche">
				<view class="kezu">
					3辆可租
				</view>
				<view class="songqu">
					免费送取车
				</view>
			</view>
			<image src="https://api.ccttiot.com/smartmeter/img/static/u9MSaynwitDShFyasI6W" class="img" mode=""></image>
        </view>
		<view class="xuanzetime">
			<view class="shaixuan">
				<view class="quche" @click="show = true">
					取车时间 <text>{{quchetime}}</text> <image src="https://api.ccttiot.com/smartmeter/img/static/uXNcZKPY1Crui2KHYVEd" mode=""></image>
				</view>
				<view class="zhouqi" @click="showzq = true">
					租车周期 <text>{{zuqi}}</text> <image src="https://api.ccttiot.com/smartmeter/img/static/uXNcZKPY1Crui2KHYVEd" mode=""></image>
				</view>
			</view>
		</view>
		<scroll-view class="zulist" @scrolltolower="handleScrollToLower" scroll-y>
			<view class="zulist_item" v-for="(item,index) in 20" :key="index" @click="btnlijizu">
				<view class="lt">
					<image src="https://api.ccttiot.com/smartmeter/img/static/uK5bAmrXLEHVxbH6FcFD" mode=""></image>
				</view>
				<view class="rt">
					<view class="one">
						<view class="name">
							全新车网红泡泡50KM...
						</view>
						<view class="sy">
							剩余
						</view>
					</view>
					<view class="two">
						<view class="name">
							手机开关锁 | 定位防盗
						</view>
						<view class="sy">
							 <text>9</text>辆
						</view>
					</view>
					<view class="thr">
						<view class="name">
							日租￥<text>69</text>
						</view>
						<view class="sy">
							立即租
						</view>
					</view>
				</view>
			</view>
			<view class="tongzhi">
				当前没有更多车子咯...
			</view>
		</scroll-view>
		<!-- 取车日期 -->
		<u-picker v-model="show" mode="time" :params="params" @confirm="confirm"></u-picker>
        <!-- 租车周期 -->
		<u-select v-model="showzq" :list="listzq" @confirm="confirmzq"></u-select>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				params: {
					year: false,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
                bgc: {
                	backgroundColor: "",
                },
				quchetime:'',
				showzq: false,
				listzq: [
					{
						value: '1',
						label: '时租'
					},{
						value: '2',
						label: '日租'
					},{
						value: '3',
						label: '月租'
					},{
						value: '4',
						label: '季租'
					}
				],
				zuqi:'时租'
			}
		},
		onLoad() {

		},
		onShow() {
			this.getCurrentDate()
		},
		methods: {
			// 点击立即租跳转到确认订单页
			btnlijizu(){
				uni.navigateTo({
					url:'/page_fenbao/storedlist/trueorder/index'
				})
			},
			// 滚动到底部分页请求
			handleScrollToLower() {
			   console.log(11)
			},
			// 点击确定取车时间
			confirm(e){
				this.quchetime = e.month + '月' + e.day + '日'
			},
			// 点击确定租期
			confirmzq(e){
			   this.zuqi = e[0].label
			},
			// 获取当前月和日
			getCurrentDate() {
			    const date = new Date(); // 获取当前时间
			    const month = date.getMonth() + 1; // 获取月份
			    const day = date.getDate(); // 获取日期
			    this.quchetime = (month < 10 ? `0${month}` : month) + '月' + (day < 10 ? `0${day}` : day) + '日'
			},
			// 点击进行导航
			btndaohang(){
				uni.openLocation({
					latitude: 11, //纬度-目的地/坐标点
					longitude: 11, //经度-目的地/坐标点
					name: 11, //地点名称
					address:11 //详细地点名称
				})
			},
			// 点击拨打电话
			btntel() {
				uni.makePhoneCall({
					phoneNumber: '18888888888',
					success: function(res) {
						console.log('拨打电话成功', res)
					},
					fail: function(err) {
						console.error('拨打电话失败', err)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #F7F7F7;
	}
	.zulist{
		margin-top: 16rpx;
		width: 100%;
		height: 60vh;
		overflow: scroll;
		.tongzhi{
			margin-top: 16rpx;
		    padding-bottom: 30rpx;
			box-sizing: border-box;
			width: 100%;
			text-align: center;
			color: #ccc;
		}
		.zulist_item{
			padding: 22rpx;
			box-sizing: border-box;
			margin: auto;
			width: 676rpx;
			height: 260rpx;
			background: #FFFFFF;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			display: flex;
			margin-bottom: 16rpx;
			.rt{
				width: 60%;
				.thr{
					display: flex;
					justify-content: space-between;
					align-items: center;
					margin-top: 38rpx;
					.name{
						font-size: 24rpx;
						color: #FF1C1C;
						text{
							font-size: 44rpx;
						}
					}
					.sy{
						width: 138rpx;
						height: 50rpx;
						background: #F14C4C;
						border-radius: 31rpx 31rpx 31rpx 31rpx;
						font-size: 24rpx;
						color: #FFFFFF;
						text-align: center;
						line-height: 50rpx;
					}
				}
				.two{
					margin-top: 16rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					.name{
						font-size: 24rpx;
						color: #3D3D3D;
					}
					.sy{
						font-size: 24rpx;
						color: #FF1C1C;
						text{
							font-size: 48rpx;
						}
					}
				}
				.one{
					display: flex;
					justify-content: space-between;
					.name{
						font-weight: 600;
						font-size: 28rpx;
						color: #3D3D3D;
					}
					.sy{
						font-size: 24rpx;
						color: #FF1C1C;
					}
				}
			}
			.lt{
				width: 216rpx;
				height: 216rpx;
				background: #EFEFEF;
				border-radius: 18rpx 18rpx 18rpx 18rpx;
				margin-right: 16rpx;
				text-align: center;
				padding-top: 42rpx;
				box-sizing: border-box;
				image{
					width: 172rpx;
					height: 132rpx;
				}
			}
		}
	}
	.xuanzetime{
		width: 750rpx;
		height: 118rpx;
		background: #FFFFFF;
		border-radius: 30rpx 30rpx 30rpx 30rpx;
		margin-top: 16rpx;
		padding-top: 22rpx;
		box-sizing: border-box;
		.shaixuan{
			width: 676rpx;
			height: 74rpx;
			background: #EFEFEF;
			border-radius: 39rpx 39rpx 39rpx 39rpx;
			margin: auto;
			display: flex;
			line-height: 74rpx;
			padding-left: 60rpx;
			box-sizing: border-box;
			font-size: 24rpx;
			color: #808080;
			.quche{
				margin-right: 40rpx;
				text{
					font-weight: 600;
					font-size: 28rpx;
					color: #3D3D3D;
					margin-left: 10rpx;
				}
				image{
					width: 40rpx;
					height: 22rpx;
				}
			}
			.zhouqi{
				text{
					font-weight: 600;
					font-size: 28rpx;
					color: #3D3D3D;
					display: inline-block;
					margin-left: 10rpx;
				}
				image{
					width: 40rpx;
					height: 22rpx;
				}
			}
		}
	}
	.xinxi{
		width: 750rpx;
		height: 266rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		margin-top: 62rpx;
		padding: 30rpx;
		box-sizing: border-box;
		position: relative;
		.zuche{
			display: flex;
			margin-top: 16rpx;
			.songqu{
				padding: 0 12rpx;
				box-sizing: border-box;
				height: 48rpx;
				line-height: 48rpx;
				font-size: 24rpx;
				color: #4297F3;
				background: #DCEDFF;
				border-radius: 6rpx 6rpx 6rpx 6rpx;
			}
			.kezu{
				padding: 0 12rpx;
				box-sizing: border-box;
				height: 48rpx;
				line-height: 48rpx;
				font-size: 24rpx;
				color: #FF8C1E;
				background: #FFE9D4;
				border-radius: 6rpx 6rpx 6rpx 6rpx;
				margin-right: 14rpx;
			}
		}
		.img{
			width: 166rpx;
			height: 166rpx;
			position: absolute;
			top: 34rpx;
			right:36rpx;
		}
		.cen{
			display: flex;
			justify-content: space-between;
			margin-top: 10rpx;
			width: 100%;
			font-size: 24rpx;
			color: #3D3D3D;
			.rt{
				display: flex;
				align-items: center;
				position: absolute;
				right: 26rpx;
				z-index: 1;
				view{
					text-align: center;
					width: 60rpx;
					margin-right: 30rpx;
					image{
						width: 58rpx;
						height: 58rpx;
					}
				}
			}
			.lt{
				.dizhi{
					font-size: 28rpx;
					color: #3D3D3D;
				}
				.time{
					font-size: 28rpx;
					color: #3D3D3D;
					margin-top: 8rpx;
					text{
						display: inline-block;
						font-weight: 600;
						margin-right: 10rpx;
					}
				}
			}
		}
		.name{
			font-weight: 600;
			font-size: 36rpx;
			color: #3D3D3D;
		}
	}
	.bj{
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 400rpx;
		z-index: -1;
	}

</style>