<template>
	<view class="list">
		<view class="item" v-for="(item,index) in list" :key="index">
			<view class="head">
				<view class="title">审批组织：{{ item.applyOrg }}</view>
				<view class="status" :class="'s' + item.applyStatus">
					{{ getStatus(item) }}
				</view>
			</view>
			<view class="main">
				<view class="date">资质申请时间：{{ item.applyTime }}</view>
				<view class="date">审批回复时间：{{ item.replyTime }}</view>
			</view>
			<view class="look" v-if="item.applyStatus == 2" @click="look(item)">查看审批</view>
		</view>
		<view class="placeholderBox" v-if="list.length == 0">
			<image src="@/static/noData.png" class="noDataImg"></image>
			<view class="text">
				暂无数据
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			};
		},
		onLoad() {
			this.getApply()
		},
		methods: {
			look(item){
				// 查看审批
				uni.navigateTo({
					url:"/pages/supplier/qualifications/approve?id=" + item.id
				})
			},
			getStatus(item) {
				switch (item.applyStatus) {
					case 1:
						return "待审批";
					case 2:
						return "已审批";
					case 3:
						return "已驳回";
					case 4:
						return "已撤销";
				}
			},
			getApply() {
				// 获取申请的资质
				this.sendRequest({
					url: "xmgl/xzSupplierQualificationApply/page",
					data: {
						applyUserId: uni.getStorageSync("userInfoObj").userId,
						pageNo: 1,
						pageSize: 999
					},
					method: "GET",
					success: (res) => {
						console.log(res);
						this.list = res.result.records;
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #fff;
	}
</style>
<style lang="scss" scoped>
	.list {
		padding: 30rpx;

		.item {
			padding: 25rpx;
			box-shadow: 0 6rpx 12rpx 1rpx #E8EDFC;
			border-radius: 15rpx;
			position: relative;
			margin-bottom: 30rpx;

			.look {
				position: absolute;
				right: 25rpx;
				bottom: 35rpx;
				color: #5382F6;
				font-size: 26rpx;
				z-index: 10;
			}

			.head {
				display: flex;
				align-items: center;
				overflow: hidden;

				.title {
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					flex: 1;
					font-size: 32rpx;
				}

				.status {
					padding: 5rpx 18rpx;
					border-radius: 50rpx;
					height: fit-content;
					// #5382F6 #E79538 #767B95
					color: #fff;
					font-size: 22rpx;

					&.s1 {
						background-color: #66A972;
					}

					&.s2 {
						background-color: #5F73CD;
					}

					&.s3 {
						background-color: #E14655;
					}

					&.s4 {
						background-color: #B8B8BA;
					}
				}
			}

			.main {
				margin-top: 20rpx;

				.date {
					padding: 10rpx 0;
					color: #999;
					font-size: 28rpx;
				}
			}
		}
	}
</style>