<!-- 称重登记 -->
<template>
	<view class="weighingRegistration">
		<scroll-view scroll-y @scrolltolower="scrollGet" class="for-max-box">
			<view class="for-max-big-box" v-for="(item,index) in dataList" :key="index">
				<view class="for-top-title-box">
					<view>{{item.subName}}{{item.roomNum?'('+item.roomNum+')':''}}</view>
					<view>{{item.deptName}}{{item.deptName&&item.buildName?'/':''}}{{item.buildName}}{{item.buildName&&item.floorName?'/':''}}{{item.floorName}}</view>
				</view>
				<view class="for-big-box" @click="goPage(minItem)"
				v-for="(minItem,minIndex) in item.wasteOrderSubItemVos" :key="minIndex">
					<view class="for-title-box">
						<view>报备单编号：</view>
						<view>{{minItem.reportNo}}</view>
						<view :class="minItem.status==1?'colorA':'colorB'">{{minItem.status==1?'已回收':'已报备待回收'}}</view>
					</view>
					<view class="for-content-box">
						<view>上门回收日期：</view>
						<view>{{minItem.expectTime}}({{minItem.expectWeek}})</view>
					</view>
					<view class="for-content-box">
						<view style="width:160rpx;">废物种类：</view>
						<view>{{minItem.typeNum}}</view>
					</view>
					<view class="for-content-box">
						<view style="width:160rpx;">报备人：</view>
						<view>{{minItem.reportName}}({{minItem.reportAccount}})</view>
					</view>
					<view class="for-content-box">
						<view style="width:160rpx;">报备时间：</view>
						<view>{{minItem.reportTime}}</view>
					</view>
					<img class="fop-position-p" v-if="minItem.status!=1" :src="imagesUrl('commonality/icon_04.png')">
					<!-- <view class="fop-position-p" v-if="minItem.status!=1">》</view> -->
				</view>
			</view>
			<view class="for-null-p"></view>
			<view class="get-null-box" v-if="getDataType">暂无更多数据</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		parseTime
	} from '@/component/public.js'
	import {
		hwmsAppWasteOrderWasteList,
	} from '@/pages_hazardousWasteRecycling/api/index.js'
	export default {
		data() {
			return {
				// 查询参数
				getDataType: false,
				queryParams: {
					page: 1,
					pageSize: 10,
				},
				total: 0,
				dataList: [],
			}
		},
		onLoad(option) {
			
		},
		onShow() {
			this.getList();
		},
		mounted() {
		},
		methods: {
			//点击跳转
			goPage(minItem){
				if(minItem.listNewData1 != 1){
					uni.navigateTo({
						url: "/pages_hazardousWasteRecycling/views/weighingRegistration/addPage?id="+minItem.id,
					});
				}
			},
			//滚动加载事件
			scrollGet() {
				let self = this;
				if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
					this.$set(this, 'getDataType', true);
				} else {
					this.queryParams.page += 1;
					this.$nextTick(() => {
						this.getList();
					})
				}
			},
			//获取实验室列表
			async getList() {
				let self = this;
				let obj = JSON.parse(JSON.stringify(this.queryParams));
				const {
					data
				} = await hwmsAppWasteOrderWasteList(obj);
				if (data.code == 200) {
					for(let i=0;i<data.data.records.length;i++){
						for(let o=0;o<data.data.records[i].wasteOrderSubItemVos.length;o++){
							data.data.records[i].wasteOrderSubItemVos[o].reportTime = parseTime(data.data.records[i].wasteOrderSubItemVos[o].reportTime, "{y}-{m}-{d} {h}:{i}:{s}")
						}
					}
					if(self.queryParams.page == 1){
						this.$set(this, 'dataList', data.data.records);
						this.$set(this, 'total', data.data.total);
						if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
							this.$set(this, 'getDataType', true);
						}
					}else{
						this.$set(this, 'dataList', [...this.dataList, ...data.data.records]);
						this.$set(this, 'total', data.data.total);
						if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
							this.$set(this, 'getDataType', true);
						}
					}
				}
			},
		},
	}
</script>

<style lang="stylus" scoped>
	.weighingRegistration{
		height: 100%;
		display flex;
		flex-direction column;
		background-color: #fff;
		.get-null-box {
			height: 100rpx;
			line-height: 100rpx;
			color: #999;
			text-align center;
		}
		.for-max-box{
			flex: 1;
			overflow-y scroll;
			.for-null-p{
				height:60rpx;
			}
			.for-max-big-box{
				.for-top-title-box{
					// height:100rpx;
					padding:30rpx 20rpx 0;
					// display: flex
					view{
						flex:1;
					}
					view:nth-child(1){
						color:#0183FA;
						font-size:34rpx;
						line-height:40rpx;
					}
					view:nth-child(2){
						margin-top:20rpx;
						color:#666;
						line-height:30rpx;
						font-size:28rpx;
					}
				}
				.for-big-box{
					width:670rpx;
					margin:40rpx 40rpx 0;
					box-shadow: 0 0 8rpx 6rpx rgba(0, 0, 0, 0.1);
					border-radius: 10rpx;
					position: relative;
					padding-bottom:30rpx;
					.for-title-box{
						display: flex;
						line-height:40rpx;
						padding:30rpx 30rpx 0;
						view:nth-child(2){
							flex:1;
						}
						view:nth-child(3){
							font-size:24rpx;
						}
						.colorA{
							color:#00EE76;
						}
						.colorB{
							color:#FF6A6A;
						}
					}
					.for-content-box{
						display: flex;
						line-height:40rpx;
						padding:20rpx 30rpx 0;
					}
					.fop-position-p{
						width:14rpx;
						height:32rpx;
						position: absolute;
						top:150rpx;
						right:20rpx;
						color:#999;
					}
				}
			}
		}
	}
</style>