<template>
	<view>
		<view class=" mart10 marb20 alijus">
			<view class="font16 fcor333 paddtop5 paddbotm5  margle20  marRight40" v-for="(item,index) in reviewStatus"
				@click="switchid(item)" :class="[rviewtyid == item.id ? 'fcor089 borbtom fontwig6' : '']" :key="index">
				{{item.title}}
			</view>
		</view>
		<view v-if="rviewList == ''" class="mart60 fotct font14 fcor666">
			<image mode="widthFix" style="width: 70vw;" src="../../../static/img/noorder.png"></image>
		</view>

		<view class="mart20 width100">
			<view class="width94 backcorfff border-r mart15" v-for="(item,index) in rviewList" :key="index"
				@click="jumpRviewSettdetails(item)">
				<view class="notes" style="padding-bottom: 0px;">
					<!-- <image src="../../../static/img/merchantstu.png" mode="widthFix" class="iconw40"></image> -->
					<view class="width80p">
						<view class="font15 fcor333">{{item.auditObjectName}}</view>
						<view class="font14 fcor999 mart5">审核类型: {{item.vocationalWorkTypeName}}</view>
						<view class="font14 fcor999 ">
							提交时间: {{item.createTime | timeFormat('yyyy-mm-dd hh:mm:ss')}}
						</view>
					</view>
				</view>
				<view class="notes">
					<view class="width30 fcor999 font14">提交人</view>
					<view class="width30 fcor999 font14">{{item.opUserName}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getAuditList
	} from '../../../Utils/Api.js'
	export default {
		data() {
			return {
				reviewStatus: [{
						id: 1,
						title: '待审核'
					},
					{
						id: 2,
						title: '审核通过'
					},
					{
						id: 3,
						title: '审核驳回'
					},
				], //状态
				rviewtyid: 1, //状态
				rviewList: '', //审核列表
				pageNum: 1,
				pagesize: 15,
				isLoadMore: false, //是否加载中
			}
		},
		onShow() {
			this.pageNum = 1;
			this.rviewList = [];
			this.getAuditList();
		},
		onReachBottom() { //上拉触底函数
			if (!this.isLoadMore) { //此处判断，上锁，防止重复请求
				this.isLoadMore = true
				this.pageNum += 1
				this.rviewList = [];
				this.getAuditList();
			}
		},
		methods: {
			//切换id
			switchid(item) {
				this.rviewtyid = item.id;
				this.pageNum = 1;
				this.rviewList = [];
				this.getAuditList();
			},
			//查询列表
			getAuditList() {
				uni.showLoading({
					title: '加载中'
				})
				let datas = {
					pageNum: this.pageNum,
					pageSize: this.pagesize,
					status: this.rviewtyid
				}
				getAuditList(datas).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000' && res.return_data.list != '') {
						this.rviewList = this.rviewList.concat(res.return_data.list);
						if (res.return_data.pages == this.pageNum) {
							this.isLoadMore = true;
						} else {
							this.isLoadMore = false
						}
					} else {
						this.rviewList = [];
					}
				});
			},
			//跳转详情
			jumpRviewSettdetails(item) {
				if (item.vocationalWorkType == 1) {
					uni.navigateTo({
						url: '/pages/index/settlement_details/settlement_details?id=' + item.auditNo
					})
				}
				if (item.vocationalWorkType == 2) {
					uni.navigateTo({
						url: '/pages/index/rateReview/rateReview?id=' + item.auditObjectId + '&auditid=' + item
							.auditNo
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.borbtom {
		border-bottom: 3px solid #089bf5;
	}

	page {
		background-color: #f6f6f6;
	}

	.notes {
		width: calc(100% - 40upx);
		display: flex;
		align-items: center;
		padding: 20upx 0 20upx 20upx;
	}
</style>