<template>
	<view>
		<view class="box">
			<view class="top">
				<text class="title">车辆消杀</text>
			</view>
			<view class="add" @click="addFn">+添加</view>
		</view>
		<view>
			<uni-list>
				<uni-list-item v-for="(item,index) in list" :title="item.carNo"
				 :note="item.adminConfirmInput==1?'已确认':'未确认'" :rightText="item.createTime" clickable @click="toDetail(item)"/>
			</uni-list>
		</view>
		<noData v-if="list.length==0"></noData>
		<u-loadmore style="margin: 30rpx;" :status="status" />
	</view>

</template>

<script>
	export default {
		data() {
			return {
				status: 'loadmore',
				list: [],
				p: {
					pageNo: 1,
					pageSize: 10,
					dataCount: 0,
					adminConfirmInput: -1,
				}
			}
		},
		onLoad() {
			this.getCarDisinFect();
		},
		methods: {
			toDetail(data){
				this.$common.to('/pages/onely-disinfect/disinfect-Index?json='+JSON.stringify(data))
			},
			addFn() {
				this.$common.to('/pages/onely-disinfect/disinfect-Index')
			},
			getCarDisinFect() {
				this.$api.getCarDisinFect(this.p).then(resp => {
					this.list = resp.data;
					this.p.dataCount=resp.dataCount;
					this.p.pageNo=resp.pageNo;
					this.p.pageSize=resp.pageSize
				})
			}

		},
		//上拉加载更多，分页模拟数据
		onReachBottom() {
			if (parseInt(this.p.dataCount) > parseInt(this.p.pageSize) * parseInt(this.p.pageNo)) {
				this.status = 'loading';
				this.p.pageSize += 5;
				this.getCarDisinFect();
			} else {
				this.status = 'nomore';
			}
		}

	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}

	.add {
		position: absolute;
		right: 40rpx;
		top: -60rpx;
		z-index: 999;
		border: 1rpx solid #359aff;
		border-radius: 8rpx;
		color: #c8e4ff;
		padding: 10rpx 20rpx;
		font-size: 28rpx;
	}

	@import '@/common/common.scss'
</style>
