<template>
	<view class="deliverLog">
		<scroll-view scroll-y class="list" @scrolltolower="loadMore">
			<view class="list-item" v-for="item in list" @click="toDetail(item)">
				<view class="list-title f_b">
					<view class="f_s">
						{{ item.name }}
					</view>
					<view class="money">{{item.salaryMin}}~{{item.salaryMax}}</view>
				</view>
				<view class="f_s">
					<view class="tag">{{item.recruitType}}</view>
					<view class="tag">{{ item.qualification }}</view>
					<view class="tag">{{ item.experience }}</view>
				</view>
				<view class="company f_s">
					<u--image
					    :src="item.org.logo"
					    width="80rpx"
					    height="80rpx"
						radius="4"
					/>
					<text style="padding: 0 10px;font-weight: 300;font-size: 28rpx;">{{ item.orgName }}</text>
				</view>
				<view class="f_b occupational">
					<view>{{item.industryName}}</view>
					<view>{{item.org.city != '市辖区' ? item.org.city : item.org.province}}</view>
				</view>
			</view>
			<u-loadmore
				v-if="list.length"
				:status="status" 
				:loading-text="loadingText" 
				:loadmore-text="loadmoreText" 
				:nomore-text="nomoreText" 
			/>
			<u-loadmore
				v-else
				status="nomore" 
				nomore-text="没有投递记录" 
			/>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageNum: 1,
				pageSize: 10,
				list: [],
				status: 'nomore',
				loadingText: '努力加载中',
				loadmoreText: '轻轻上拉',
				nomoreText: '没有了',
			}
		},
		onLoad() {
			this.load()
		},
		onPullDownRefresh() {
			this.pageNum = 1
		    this.load('sx')
		},
		onShow() {

		},
		methods: {
			loadMore() {
				if (this.status == 'loadmore') {
					this.pageNum = this.pageNum + 1
					this.load()
				}
			},
			load(type) {
				this.status = 'loading'
				this.$http.get('/signRecord/l', {
					pageNum: this.pageNum,
					pageSize: this.pageSize,
				}).then(res => {
					this.list = this.pageNum == 1 ? res.data.list : [...this.list,...res.data.list],
					this.status = this.list.length >= res.data.total ? 'nomore' : 'loadmore'
					if (type == 'sx') {
						uni.stopPullDownRefresh();
						setTimeout(() => {
							uni.showToast({
								title: '刷新成功',
								icon: 'none'
							})
						},500)
					}
				})
			},
			toDetail(el = {}) {
				uni.navigateTo({
					url: `/pages/home/jobDetails?id=${el.id}&source=jyzp`
				})
			}
		}
	}
</script>

<style lang="scss">
.deliverLog{
	height: 100vh;
	overflow: hidden;
	.list{
		height: calc(100%);
		overflow: auto;
		padding: 30rpx;
		box-sizing: border-box;
		.list-item{
			background-color: #fff;
			border-radius: 20rpx;
			padding: 30rpx;
			.list-title{
				font-weight: bold;
				font-size: 36rpx;
				margin-bottom: 20rpx;
				.t{
					background-color: #EFF7FE;
					color: #33A1CA;
					margin-left: 20rpx;
					font-weight: normal;
				}
				.money{
					color: #647BEB;
				}
			}
			.company{
				margin: 20rpx 0;
				color: #666;
				font-size: 30rpx;
			}
			.occupational{
				color: #666;
				font-size: 26rpx;
				font-weight: 300;
			}
		}
		.list-item + .list-item{
			margin-top: 30rpx;
		}
	}
}
</style>
