<template>
	<view class="formbox">
		<homebar titlenav="消息"></homebar>
		<scroll-view :style="{height:`calc( 100vh - ${safeAreaInsetsTop}px)`}" scroll-y="true"
			refresher-enabled="true" :refresher-triggered='triggered' @refresherpulling="onPulling"
			@refresherrefresh="onRefresh" @refresherrestore="onRestore" @refresherabort="onAbort">
			<view class="item_class" @click="todeil('/pages_loader/pages/work/deilorder')" v-for="(item,index) in list" :key="index">
				<view style="display: flex;justify-content: space-between">
					<view class="" style="display: flex;align-items: center;font-size: 14px;line-height: 30rpx;">
						<u-avatar :src="avatarsrc" size="40"></u-avatar>
						<view class="" style="margin-left: 20rpx;">
							<view>张先生</view>
							<view>25岁 本科 3年</view>
						</view>
					</view>
					<view>
						<text v-if="item.type==1" style="color: greenyellow;">已沟通</text>
						<text v-if="item.type==2" style="color: orange;">待接受</text>
						<text v-if="item.type==3" style="color: indigo;">已接受</text>
						<text v-if="item.type==4" style="color: #f9ae3d;">已完成</text>
						<text v-if="item.type==5" style="color: #f9ae3d;">已评价</text>
					</view>
				</view>
				<view style="display: flex;justify-content: space-between;align-items: center;">
					<view>
						百易信息技术  ·  JAVA开发工程师
					</view>
					<view style="display: flex;" v-if="item.type==1">
						<u-button text="邀约" shape="circle" plain size="mini" type="success"></u-button>
					</view>
					<view style="display: flex;" v-if="item.type==2">
						<u-button text="再次邀约" color="orange" shape="circle" plain size="mini"></u-button>
					</view>
					<view style="display: flex;" v-if="item.type==3">
						<u-button text="完成" size="mini" color="indigo" shape="circle" plain></u-button>
					</view>
					<view style="display: flex;" v-if="item.type==4">
						<u-button text="评价" size="mini" type="warning" shape="circle" plain></u-button>
					</view>
				</view>
			</view>
		</scroll-view>
		<tabBar :value='1' :identity='1'></tabBar>
	</view>
</template>

<script>
	import tabBar from "@/components/tabbar.vue"
	import config from '@/config.js'
	export default {
		components: {
			tabBar
		},
		data() {
			return {
				triggered: false,
				safeAreaInsetsTop: 0,
				avatarsrc:'/static/nav.png',
				list:[
					{
						type:1,
					},
					{
						type:2,
					},
					{
						type:3,
					},
					{
						type:4,
					},
					{
						type:5,
					}
				]
			};
		},
		onShow() {
			this.safeAreaInsetsTop = uni.getSystemInfoSync().safeAreaInsets.top + 50 + 44;
		},
		methods: {
			todeil(url){
				uni.navigateTo({
					url:url
				})
			},
			getlist() {
				this.triggered = false
			},
			//下拉刷新
			onRefresh() {
				this.triggered = true
				this.getlist();
			},
			//开始结束下拉的函数
			onRestore() {
				this.triggered = 'restore'; // 关闭动画
			},
			//下拉过程的函数
			onPulling() {

			},
			onAbort() {

			},
		},
	}
</script>

<style lang="scss" scoped>
	.formbox {
		height: 100vh;
	}

	.item_class {
		margin: 40rpx 20rpx;
		padding: 20rpx;
		border-radius: 10rpx;
		line-height: 60rpx;
		background-color: #ffffff;
		box-shadow: 0px 0px 8px rgba(38, 38, 38, 0.08);
	}
</style>