<template>
	<view class="container">
		<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.applyName}}
					<!-- 服务类别 40保洁 41维修 43 带房42 改价 45 成交合同 46 定金合同 -->
					<template v-if="item.serviceType==40">(保洁)</template>
					<template v-if="item.serviceType==41">(维修)</template>
					<template v-if="item.serviceType==42">(改价)</template>
					<template v-if="item.serviceType==43">(带房)</template>
					<template v-if="item.serviceType==45">(成交合同)</template>
					<template v-if="item.serviceType==46">(定金合同)</template>
				</view>
				<view class="time">{{item.createTime}}</view>
			</view>
			<view class="bot">{{item.address}}</view>
			<view class="status-box">
				<view class="left"><image class="icon" src="/static/myapply/passed.png" mode="" />已申请</view>
				<!-- 审批状态0未审核 1通过 2 拒绝 -->
				<view class="right">
					<view class="right-cont" v-for="(subitem,i) in item.reviewName" :key="i">
						<view class="subitem" v-if="i==0">
							<image class="icon" v-if="subitem.firstApplyStatus==1" src="/static/myapply/passed.png" mode="" />
							<image class="icon" v-else src="/static/myapply/not_pass.png" mode="" />
							{{subitem.firstReview}}{{subitem.firstApplyStatus==1?'已通过':subitem.firstApplyStatus==2?'未通过':'未审核'}}</view>
						<view class="subitem" v-if="i==1" style="margin-left:30rpx">
							<image class="icon" v-if="subitem.firstApplyStatus==1" src="/static/myapply/passed.png" mode="" />
							<image class="icon" v-else src="/static/myapply/not_pass.png" mode="" />
							{{subitem.secondReview}}{{subitem.secondApplyStatus==1?'已通过':subitem.secondApplyStatus==2?'未通过':'未审核'}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="loading" v-if="loading">
				<u-loading size="40" :show="loading"/>
				正在加载中
			</view>
		<view class="empty-box" v-if="listData.length==0&&!loading">
			<image class="img" src="http://images.2weisou.com/20221031114904TSF6jF4S.png" mode=""/>
			<view class="no-data">暂无数据</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				listData: [],
				pageNo: 1,
				pageSize: 10,
				loadDone: false,
				loading: false,
			};
		},
		onLoad(options) {
			this.getList()
		},
		onShow() {
		
		},
		onReachBottom() {
			this.getList();
		},
		methods: {
			getList(){
				if (this.loadDone) return;
				this.loading = true;
				let body = {
					pageNo:this.pageNo,
					pageSize:this.pageSize,
					applyStatus: '',
					createTimeBegin: '',
					createTimeEnd:''
				}
				this.$u.api.cleanRepairHistory({body:body}).then((res)=>{
					// console.log(res)
					this.loading = false;
					if(res.result&&res.result.length){
						if(this.pageNo==1){
							this.listData = res.result
						}else{
							this.listData = [...this.listData, ...res.result];
						}
						if(res.result.length<this.pageSize){
							this.loadDone = true;
							return ;
						}
						this.pageNo += 1;
						this.loadDone = false
					}else{
						this.loadDone = true;
						if(this.pageNo==1){
							this.listData = []
						}
					}
				})
			},
		},
	};
</script>

<style lang="scss" scoped>
.container{
	width: 750rpx;
	min-height: 100vh;
	background: #F8F8F8;
	padding-top: 20rpx;
	.list-item{
		background: #fff;
		margin-bottom: 20rpx;
		padding: 30rpx 30rpx 0;
		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: #666666;
				line-height: 42rpx;
			}
		}
		.bot{
			height: 42rpx;
			font-size: 30rpx;
			font-weight: 400;
			color: #333333;
			line-height: 42rpx;
			margin-top: 20rpx;
		}
		.status-box{
			margin-top: 30rpx;
			border-top: 1px solid #e0e0e0;
			height: 96rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.left{
				width: 160rpx;
				height: 42rpx;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;
				display: flex;
				align-items: center;
				.icon{
					width: 36rpx;
					height: 36rpx;
					margin-right: 8rpx;
				}
			}
			.right{
				display: flex;
				justify-content: space-between;
				align-items: center;
				.right-cont{
					.subitem{
						display: flex;
						align-items: center;
						font-size: 28rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #333333;
						.icon{
							width: 36rpx;
							height: 36rpx;
							margin-right: 8rpx;
						}
					}
				}
			}
		}
	}
}
</style>
