<template>
	<view>
		<view v-if='datalist.length>0'>
			<view class='wrap' v-for='item in datalist' @click='lookdetails(item)'>
				<view style='display:flex;justify-content: space-between;'>
					<view class='title'>
						{{item.businessType}}
					</view>
					<view v-if='item.approveStatus' style='color:#FD714F;'>
						{{item.approveStatus?item.approveStatus:item.status}}
					</view>
					<view v-if='item.status=="已驳回"' style='color:#FF4E4E;'>
						{{item.approveStatus?item.approveStatus:item.status}}
					</view>
					<view v-if='item.status=="已通过"' style='color:#22C572;'>
						{{item.approveStatus?item.approveStatus:item.status}}
					</view>
				</view>
				<view>{{item.createDate}}</view>
			</view>
		</view>
		<view v-if='show' style='text-align:center;background:#F2F6FA;'>暂无更多数据</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				datalist:[],
				currentPage:1,
				show:false,
				pageSize:10
			}
		},
		onShow(){
			this.getList()
		},
		computed: {
			...mapState(['hasLogin', 'userInfo','clientId']),
		},
		onReachBottom() { //上拉触底函数
			// if (this.statusFlag == 3) {
				if (!this.isLoadMore) { //此处判断，上锁，防止重复请求
					this.pageSize += 1
					this.currentPage += 1
					this.getList()
				}
			// }
		},
		methods: {
			lookdetails(row){
				uni.navigateTo({
					url:'/pages/universalityAudit/look?id='+row.id
				})
			},
			onNavigationBarButtonTap() {
			    uni.navigateTo({
			    	url:'/pages/universalityAudit/addaduit'
			    })
			  },
			getList(){
				uni.showLoading({
					title: "正在加载"
				})
				this.$api.doRequest('get', '/generalAuditInfo/selectGeneralAuditInfo', {
					startDate: '',
					endDate: '',
					searchKeyWord: '',
					currentPage: this.currentPage,
					pageSize:this.pageSize,
					searchType: '',
					businessType: '',
					createUserId:this.userInfo.id
				}).then(res => {
					if(res.data.code==200){
						uni.hideLoading()
						if(res.data.data.records.length>0){
							this.show=false
							if(this.currentPage==1){
								this.datalist=res.data.data.records
							}else{
								this.datalist=this.datalist.concat(res.data.data.records)
							}
						}else{
							this.show=true
							if(this.currentPage==1){
								this.datalist=[]
							}
						}
					}else{
						uni.hideLoading()
						uni.showToast({
							title: "系统异常，请联系管理员",
							icon: 'none',
							duration: 2000
						})
					}
					
				})
			}
		}
	}
</script>

<style lang="scss" scoped>

.wrap{
	background:#fff;
	margin:10px;
	padding:20px;
	border-radius:10px;
	font-size:28rpx;
	line-height:36rpx;
	.title{
		font-size:36rpx;
		margin-bottom:10rpx;
	}
}
</style>
