<template>
	<view class="fullHeight">
		<levitatedsphere :x="100" :y="80"></levitatedsphere>
		<headers :showBack="true" class="fixedHeaderBox">
			<view class="headerName">
				浇筑令管理
			</view>
		</headers>
		<!-- <view class="searchBox" :style="{ 'padding-top': (statusBarHeight+52) + 'px' }">
			<input type="text" v-model="searchForm.eduCourseName" confirm-type="search" class="input" placeholder-style="color:rgba(72, 141, 236, 0.5)" placeholder="按培训主题查找" @confirm="list=[];loadData()" />
		</view> -->
		<view class="listBox" :style="{ 'padding-top': (statusBarHeight+52) + 'px' }">
			<view class="listItem" v-for="item in list" :key="item.id" @click="goAdd(item.id)">
				<view class="title">
					混泥土标号：{{item.concreteTab}}
				</view>
				<view class="bottom">
					{{item.buildName}}>{{item.floorName}}层
				</view>
				<view class="bottom">
					浇筑日期：{{item.pourTime}}
				</view>
				<image src="/static/icon-right.png" class="icon-right"></image>
			</view>
			<view class="placeholderBox" v-show="list.length==0">
				<image src="/static/noData.png" class="noDataImg"></image>
				<view class="text">
					暂无数据
				</view>
			</view>
		</view>
		<view class="loadMoreBox" v-if="isLoadMore">
			<uni-load-more :status="loadStatus" iconType="auto"></uni-load-more>
		</view>
		<view style="height: 60px;">
			
		</view>
		<view class="bigOperateBtn" @click="goAdd('')">
			新增电子浇筑令
		</view>
	</view>
</template>

<script>
	// import headers from "../../../components/headers/headers.vue"
	// import uniLoadMore from "../../../../components/uni-load-more/uni-load-more.vue"
	export default {
		data() {
			return {
				searchForm:{
					pageNo: 1,
					pageSize: 10,
					projectSn: ""
				},
				projectDetail:{},
				list:[],
				statusBarHeight:0,
				loadStatus:'more',
				isLoadMore:false
			};
		},
		onLoad() {
			this.statusBarHeight=uni.getStorageSync('systemInfo').statusBarHeight
			this.projectDetail=JSON.parse(uni.getStorageSync('projectDetail'))
			this.searchForm.projectSn=this.projectDetail.projectSn
			
		},
		onShow() {
			this.searchForm.pageNo=1
			this.list=[]
			this.loadData()
			// uni.removeStorageSync('person')
		},
		onReachBottom() {
			if(!this.isLoadMore){  //此处判断，上锁，防止重复请求
				this.isLoadMore=true
				this.searchForm.pageNo+=1
				this.loadData()
			}
		},
		onPullDownRefresh() {
			this.searchForm.pageNo=1
			this.list=[]
			this.loadData()
		},
		methods:{
			loadData(){
				var that = this
				this.sendRequest({
					url: 'xmgl/electronPourOrder/list',
					data: this.searchForm,
					method: "POST",
					success(res){
						that.list=that.list.concat(res.result.records)
						if(res.result.records.length<that.searchForm.pageSize){  //判断接口返回数据量小于请求数据量，则表示此为最后一页
							  that.isLoadMore=true                                             
							  that.loadStatus='nomore'
						}else{
							  that.isLoadMore=false
							  // that.loadStatus='more'
						}
						uni.stopPullDownRefresh()
						console.log('that.isLoadMore',that.isLoadMore)
					}
				})
			},
			goAdd(id){
				uni.navigateTo({
					url:'./addPouringOrder?id='+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.searchBox{
	background-color: #2b8df3;
	padding: 0 15px 5px;
	position: fixed;
	left: 0;
	width: calc(100% - 30px);
	top: 0;
	z-index: 1;
	.input{
		border-radius: 18px;
		height: 35px;
		text-align: center;
		background-color: white;
	}
}
.bigOperateBtn{
	position: fixed;
	bottom: 15px;
	left: 15px;
	width: calc(100% - 30px);
	background: #488DEC;
	box-shadow: 0px 4px 8px 0px rgba(43, 141, 243, 0.42);
	border-radius: 25px;
	height: 50px;
	line-height: 50px;
	color: white;
	font-size: 20px;
	text-align: center;
}
.listBox{
	margin: 15px;
}
.listItem{
	box-shadow: 0px 4px 13px 0px rgba(212, 220, 236, 0.53);
	position: relative;
	margin-bottom: 5px;
	padding: 15px;
	border-radius: 8px;
	.title{
		font-size: 15px;
		font-weight: bold;
		margin-bottom: 10px;
	}
	.bottom{
		color: rgba(55, 45, 102, 0.5);
		font-size: 12px;
	}
	.tags{
		background-color: rgba(197, 117, 229, 1);
		border-radius: 4px;
		padding: 1px 3px;
		margin-right: 8px;
		color: white;
	}
	.time{
		margin-right: 12px;
	}
}
.icon-right{
	position: absolute;
	width: 8px;
	height: 14px;
	right: 15px;
	top: calc(50% - 7px);
}
</style>
