<!-- 称重登记 -->
<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.data1}}{{item.data2?'('+item.data2+')':''}}</view>
					<view>{{item.data3}}{{item.data3&&item.data4?'/':''}}{{item.data4}}{{item.data4&&item.data5?'/':''}}{{item.data5}}</view>
				</view>
				<view class="for-big-box" @click="goPage(minItem)"
				v-for="(minItem,minIndex) in item.listData" :key="minIndex">
					<view class="for-title-box">
						<view>报备单编号：</view>
						<view>{{minItem.listNewData2}}</view>
						<view :class="minItem.listNewData1==1?'colorA':'colorB'">{{minItem.listNewData1==1?'已回收':'待回收'}}</view>
					</view>
					<view class="for-content-box">
						<view>上门回收日期：</view>
						<view>{{minItem.listNewData3}}</view>
					</view>
					<view class="for-content-box">
						<view style="width:160rpx;">废物种类：</view>
						<view>{{minItem.listNewData4}}</view>
					</view>
					<view class="for-content-box">
						<view style="width:160rpx;">报备人：</view>
						<view>{{minItem.listNewData5}}</view>
					</view>
					<view class="for-content-box">
						<view style="width:160rpx;">报备时间：</view>
						<view>{{minItem.listNewData6}}</view>
					</view>
					<view class="fop-position-p" v-if="minItem.listNewData1!=1">》</view>
				</view>
			</view>
			<view class="for-null-p"></view>
		</scroll-view>
	</view>
</template>

<script>
	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() {
		},
		mounted() {
			this.getList();
			this.$set(this,'dataList',[{
				data1:'植物营养实验室',
				data2:'A201',
				data3:'资源环境学院',
				data4:'理科楼',
				data5:'3楼',
				listData:[
					{
						listNewData1:'1',
						listNewData2:'HW202510400001',
						listNewData3:'2025-11-05（星期四）',
						listNewData4:'4',
						listNewData5:'王二小（2020110010）',
						listNewData6:'2025-11-04 10:10:09',
					},
					{
						listNewData1:'1',
						listNewData2:'HW202510400001',
						listNewData3:'2025-11-05（星期四）',
						listNewData4:'4',
						listNewData5:'王二小（2020110010）',
						listNewData6:'2025-11-04 10:10:09',
					},
					{
						listNewData1:'1',
						listNewData2:'HW202510400001',
						listNewData3:'2025-11-05（星期四）',
						listNewData4:'4',
						listNewData5:'王二小（2020110010）',
						listNewData6:'2025-11-04 10:10:09',
					},
					{
						listNewData1:'2',
						listNewData2:'HW202510400001',
						listNewData3:'2025-11-05（星期四）',
						listNewData4:'4',
						listNewData5:'王二小（2020110010）',
						listNewData6:'2025-11-04 10:10:09',
					},
					{
						listNewData1:'2',
						listNewData2:'HW202510400001',
						listNewData3:'2025-11-05（星期四）',
						listNewData4:'4',
						listNewData5:'王二小（2020110010）',
						listNewData6:'2025-11-04 10:10:09',
					},
				],
			}]);
		},
		methods: {
			//点击跳转
			goPage(minItem){
				console.log(minItem)
				if(minItem.listNewData1 != 1){
					uni.navigateTo({
						url: "/pages_hazardousWasteRecycling/views/weighingRegistration/addPage",
					});
				}
			},
			//滚动加载事件
			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) {
					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;
		.for-max-box{
			flex: 1;
			overflow-y scroll;
			.for-null-p{
				height:60rpx;
			}
			.for-max-big-box{
				.for-top-title-box{
					height:100rpx;
					padding:0 20rpx;
					line-height:rpx;
					display: flex
					view{
						flex:1;
					}
					view:nth-child(1){
						color:#0183FA;
						font-size:34rpx;
						line-height:100rpx;
					}
					view:nth-child(2){
						color:#666;
						text-align: right;
						line-height:104rpx;
						font-size:28rpx;
					}
				}
				.for-big-box{
					width:670rpx;
					margin:0 40rpx 40rpx;
					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;
						}
						.colorA{
							color:#00EE76;
						}
						.colorB{
							color:#FF6A6A;
						}
					}
					.for-content-box{
						display: flex;
						line-height:40rpx;
						padding:20rpx 30rpx 0;
					}
					.fop-position-p{
						position: absolute;
						top:150rpx;
						right:20rpx;
						color:#999;
					}
				}
			}
		}
	}
</style>