<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 v-model="calendarShow" :min-date="mindate" :max-date="maxdate" mode="date" @change="changeDate"></u-calendar>
		</view>
		<view class="report-tab">
			<u-tabs :list="tabList" bar-width="60" bar-height="6" active-color="#FF6D25" inactive-color="#666666" font-size="30" :is-scroll="false" :current="current" @change="change"></u-tabs>
		</view>
		<view class="list-item" v-for="(item,index) in listData" :key="index">
			<view class="top">
				<view class="top-left">
					<image class="icon" src="/static/kehu/person_gray.png" mode="" />{{item.name}}
				</view>
				<view class="tel">{{item.tel}}</view>
			</view>
			<view class="status-box">
				<view class="left">维修项目费用：<view class="money">{{item.money||0}}元</view></view>
				<view class="btn success-btn" v-if="item.status==1">已审核</view>
				<view class="btn todo-btn" v-else>待审核</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				type: 0,// 默认是开始时间
				starDate: '',
				endDate: '',
				mindate: '',
				maxdate: '2099-12-31',
				calendarShow: false,
				current: 0,
				tabList: [{
					name: '全部'
				}, {
					name: '已审核'
				}, {
					name: '待审核'
				}],
				listData: [{
					name:'测试一下：测试一',money: 180,
					status: 0,tel:'17552999012'
				},{name:'测试一下：测试一',money: 180,
					status: 1,tel:'17552999012'},
					{name:'张晨',money: 180,
					status: 1,tel:'17552999012'},
					{name:'张晨',money: 180,
					status: 0,tel:'17552999012'}]
			};
		},
		onLoad(options) {
		},
		onShow() {
		
		},
		methods: {
			change(index){
				this.current = index
			},
			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;
	padding-top: 20rpx;
	.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;
			}
		}
	}
	.report-tab{
		border-bottom: 1px solid rgba(224,224,224,0.5);
	}
	.list-item{
		height: 168rpx;
		background: #fff;
		margin-bottom: 20rpx;
		padding: 30rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		.top{
			display: flex;
			justify-content: space-between;
			align-items: center;
			.top-left{
				display: flex;
				align-items: center;
				font-size: 30rpx;
				font-weight: 400;
				color: #333333;
				.icon{
					width: 28rpx;
					height: 30rpx;
					margin-right: 12rpx;
				}
			}
			.time{
				height: 42rpx;
				font-size: 30rpx;
				font-weight: 400;
				color: #333;
				line-height: 42rpx;
			}
		}
		.status-box{
			height: 96rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.left{
				height: 42rpx;
				font-size: 30rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;
				line-height: 42rpx;
				display: flex;
				align-items: center;
				.money{
					font-weight: 600;
				}
			}
			.btn{
				width: 100rpx;
				height: 42rpx;
				font-size: 30rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
			}
			.success-btn{
				color: #07B79D;	
			}
			.todo-btn{
				color: #FEA017;
			}
		}
	}
}
</style>
