<template>
	<view class="container">
		<view class="calendar">
			<view class="date" @click="openCalendar(0)">
				 <view v-if="starDate">{{starDate}}</view>
				 <view v-else class="desc">起始日期</view>
			</view>
			<view class="date" @click="openCalendar(1)">
				<view v-if="endDate">{{endDate}}</view>
				<view v-else class="desc">结束日期</view>
			</view>
			<u-calendar :min-date="mindate" :max-date="maxdate" v-model="calendarShow" mode="date" @change="changeDate"></u-calendar>
		</view>
		<view class="list-item" v-for="(item,index) in listData" :key="index">
			<view class="top">
				<view class="name">刘506</view>
				<view>应收日期：2024.01.31</view>
				<view class="mark">未收</view>
			</view>
			<view class="bot">
				<view>租客：赵彩云</view>
				<view>租金6001</view>
				<view class="tel"><image class="tel-icon" src="/static/my/tel.png" mode="" /> 18322783146</view>
				</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				starDate: '',
				endDate: '',
				type: 0,// 默认是开始时间
				calendarShow: false,
				mindate: '',
				maxdate: '2099-12-31',
				listData: [{},{},{},{}]
			};
		},
		onLoad(options) {
		},
		onShow() {
		
		},
		methods: {
			openCalendar(type){
				if(type==0){
					this.type = 0
					this.mindate = ''
					this.maxdate = this.endDate
				}else{
					this.type = 1
					this.mindate = this.starDate
					this.maxdate = '2099-12-31'
				}
				this.calendarShow = true;
			},
			changeDate(e){
				// console.log(e)
				if(this.type==0){
					this.starDate = e.result
				}else{
					this.endDate = e.result
				}
			}

		},

	};
</script>

<style lang="scss" scoped>
.container{
	width: 750rpx;
	min-height: 100vh;
	background: #F8F8F8;
	.search{
		width: 100%;
		height: 110rpx;
		padding: 16rpx 30rpx;
		background: #fff;
	}
	.calendar{
		width: 750rpx;
		height: 92rpx;
		background: #FFFFFF;
		margin-bottom: 20rpx;
		display: flex;
		align-items: center;
		justify-content: space-around;
		font-size: 26rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		padding: 0 40rpx;
		.date{
			flex:1;
			color: #333333;
			position: relative;
			text-align: center;
			&::after{
				position: absolute;
				content: "";
				top: 16rpx;
				right: 60rpx;
				border-color: #FF6D25;
				border: 8rpx solid transparent;
				border-top: 8rpx solid #FF6D25;
			}
			.desc{
				color: #999999;
			}
		}
	}
	.list-item{
		margin-bottom: 20rpx;
		padding: 0 30rpx;
		background: #fff;
		.top{
			height: 96rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 30rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #333333;
			.name{
				width: 250rpx;
				color: #333333;
			}
			.mark{
				color: #fff;
				margin-left: 26rpx;
				width: 116rpx;
				height: 52rpx;
				text-align: center;
				line-height: 52rpx;
				background: #FF6D25;
				border-radius: 0px 20rpx 0px 20rpx;
			}
		}
		.bot{
			height: 96rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 30rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #505050;
			border-top: 1px solid #e0e0e0;
			.tel{
				display: flex;
				align-items: center;
				.tel-icon{
					width: 30rpx;
					height: 30rpx;
					margin-right: 12rpx;
				}
			}
		}
	}
}
</style>
