<template>
	<view class="index">
		<scroll-view scroll-y="true" @scrolltolower="scrolltolower">
			<view class="list">
				<view class="item" @tap="toDetail(item)" v-for="item in tableData" :key="item.id">
					<view class="top">
						岗位名称:{{item.postName}}
						<DictType :types="qgzx_apply_status" :type="item.applyStatus" />
					</view>
					<view class="content">
						<view>学号：{{item.stuNo}}</view>
						<view>姓名：{{item.stuName}}</view>
						<view>岗位类型：{{item.postType}}</view>
						<view>结算月份：{{item.applyTime}}</view>
						<view>工作时长：{{ item.postType == "固定岗位A" ? item.totalTime + "天" : item.totalTime + "小时" }}</view>
					</view>
					<view class="status">
						<view class="bottom">
							<view class="edit" >
								<!-- compose -->
								<uni-icons color="#1890ff" type="compose" size="18"> 审批</uni-icons>
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>

	</view>
</template>

<script>
	import {
		doAudit,
		listDept as getList,
		manyAudit
	} from "@/api/workStudy/money";

	export default {
		data() {
			return {
				qgzx_apply_status: [],
				tableData: [],
				queryParams: {
					pageNum: 1,
					pageSize: 10,
					postName: null
				},
				totalPages: '',
			}
		},
		onLoad() {
			this.get_qgzx_apply_status()
			this.getList()
		},
		methods: {
			toDetail(item) {
				uni.navigateTo({
					url: "./detail?detailData=" + JSON.stringify(item)
				})
			},
			async get_qgzx_apply_status() {
				let res = await getDicts('qgzx_apply_status');
				this.qgzx_apply_status = res.data;
			},
			async getList() {
				let res = await getList(this.queryParams);
				this.loading = false;
				if (res.code == 200) {
					this.tableData = [...res.rows];
					this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
				}
			},
			scrolltolower() {
				if (this.queryParams.pageNum < this.totalPages) {
					this.queryParams.pageNum++;
					this.loading = true;
					setTimeout(() => {
						this.getList()
					}, 1000)
				} else {

				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.index {
		background-color: #F5F5F7;

		scroll-view {
			height: calc(100vh - 10px);

			.no-more {
				text-align: center;
				color: gray;
				padding-bottom: 10px;
			}

			.empty {
				display: flex;
				flex-direction: column;
				align-items: center;
				margin-top: 200rpx;
				color: #9E9E9E;
				font-size: 36rpx;

				image {
					width: 250rpx;
					margin-bottom: 50rpx;
				}
			}
		}

		.list {
			padding: 20rpx 40rpx 15rpx 40rpx;

			.item {
				background-color: white;
				margin-bottom: 20rpx;
				padding: 40rpx 40rpx 80rpx;
				border-radius: 16px;
				border-bottom-right-radius: 0;
				position: relative;

				.top {
					display: flex;
					justify-content: space-between;
					border-bottom: 1px solid #F5F5F7;
					padding-bottom: 20rpx;

					.uni-icons {
						opacity: 0.5;
					}
				}

				.content {
					padding-top: 20rpx;

					.level {
						display: flex;

					}

					&>view:not(:last-child) {
						margin-bottom: 15rpx;

						.progress {
							color: #1890FF;
						}
					}

					.status {
						position: absolute;
						bottom: 0;
						right: 0;
						color: white;

						.status-text {
							position: absolute;
							bottom: 15px;
							right: 8%;
							font-size: 35rpx;
						}

						.triangle-right {
							width: 0;
							height: 0;
							/* 上边框设置为透明 */
							border-left: 120px solid transparent;
						}

						&.submit {
							color: #202020;

							.triangle-right {
								/* 左边框设置为与文本相同的颜色 */
								border-bottom: 100px solid #D7D7D7;
							}
						}

						&.agree {
							.triangle-right {
								/* 左边框设置为与文本相同的颜色 */
								border-bottom: 100px solid #2FB15B;
							}
						}

						&.refuse {
							.triangle-right {
								/* 左边框设置为与文本相同的颜色 */
								border-bottom: 100px solid #FF759F;
							}
						}
					}
				}

				.bottom {
					position: absolute;
					right: 0;
					bottom: 10px;

					button {
						margin: 0;
						background-color: transparent;
						margin-right: 10px;
						padding: 0px 10px;
						height: 32px;
						line-height: 32px;
						font-size: 28rpx;
						width: 160rpx;
						border: 1px solid #007aff;
						color: #007aff;
					}
				}
			}
		}

	}

	.popup-content {
		align-items: center;
		padding: 15px;
		background-color: #fff;
	}
</style>