<template>
	<view>
		<view class="listbox" v-for="(item,index) in postPushList" :key="index" @click="gotoInfo(item.postPushId)">
			<view class="flex align-center justify-between">
				<view class="text-xl text-bold" style="color: #6696FF;">{{item.postDetails?item.postDetails.postName:'未知'}}</view>
				<view class="text-lg text-bold" style="color: #FF4A28;">{{item.postDetails?item.postDetails.postPrice:'0'}}</view>
			</view>
			<view class="flex align-center margin-top-sm">
				<view class="argrtn" v-for="(ite,index) in item.postPush?item.postPush.projectType.split(','):[]" :key="index">{{ite}}</view>
			</view>
			<view class="flex align-center justify-between margin-top" style="margin-top: 60rpx;">
				<view class="" style="color: #666666;">{{item.postPush.projectName}}</view>
				<view>{{item.postPush.address}}</view>
			</view>
			<view class="bnlogo" v-if="item.status==2">
				<image src="../static/bmSuccess.png" style="width: 145upx;height: 115upx;"></image>
			</view>
			<view class="bnlogo" v-if="item.status==1">
				<image src="../static/bmS.png" style="width: 145upx;height: 115upx;"></image>
			</view>
			<view class="bnlogo" v-if="item.status==3">
				<image src="../static/bmShibai.png" style="width: 145upx;height: 115upx;"></image>
			</view>
		</view>
		<empty v-if="postPushList.length==0" />
	</view>
</template>

<script>
	import empty from '@/components/empty.vue'
	export default {
		components:{
			empty
		},
		data() {
			return {
				postPushList:[],
				page:1,
				limit:10,
				cont:'',
			}
		},
		onLoad() {
			this.getBaomingList();
		},
		onReachBottom() {
			if(this.page == this.cont){
				uni.showToast({
					title:'已经到底了',
					icon:"none"
				})
			}else{
				this.page += 1
				this.getBaomingList();
			}
		},
		onPullDownRefresh() {
			this.page = 1
			this.getBaomingList();
		},
		methods: {
			//项目详情
			gotoInfo(postPushId){
				uni.navigateTo({
					url:'/pages/index/game/order?postPushId='+postPushId
				})
			},
			//报名列表
			getBaomingList(){
				let data = {
					page:this.page,
					limit:this.limit,
					classify:1
				}
				this.$Request.get('/app/postPush/selectResumesPushList', data).then(res => {
					if (res.code == 0) {
						this.cont = res.data.totalPage
						let arr = res.data.list
						arr.map(item=>{
							if(item.postPush && item.postPush.address.indexOf('北京市')!=-1){
								item.postPush.address = '北京市'
							}else if(item.postPush && item.postPush.address.indexOf('重庆市')!=-1){
								item.postPush.address = '重庆市'
							}else if(item.postPush && item.postPush.address.indexOf('天津市')!=-1){
								item.postPush.address = '天津市'
							}else if(item.postPush && item.postPush.address.indexOf('上海市')!=-1){
								item.postPush.address = '上海市'
							}
						})
						if(this.page==1){
							this.postPushList = arr
						}else{
							this.postPushList = [...this.postPushList,...arr]
						}
						uni.stopPullDownRefresh()
					}
				})
			},
		},
	}
</script>

<style lang="less">
	page {
		background: #F2F2F7;
	}

	.listbox {
		background: #FFFFFF;
		border-radius: 24upx;
		margin: 20upx 30upx;
		padding: 30upx;
		position: relative;
	}
.bnlogo{
	position: absolute;
	top: 70upx;
	right: 30upx;
	z-index: 99;
}
	.argrtn {
		background: #F6F6F6;
		color: #666666;
		font-size: 24upx;
		border-radius: 8upx;
		padding: 5upx 20upx;
		margin-right: 20upx;
	}
</style>
