<!-- 评价列表 -->

<template>
	<view style="padding: 10upx 0 30upx;">
		<view class="loading_text" v-if="loading">加载中...</view>
		<view class="main_width" v-else>
			<view style="border-bottom: 4upx solid #eeeeee;padding: 20upx 0;" :key="index" v-for="(item,index) in data"
				class="item">
				<trailerStars allowTap="0" :innerScore="item.result_level">
				</trailerStars>
				<navigator v-if="type!=1" :url="'../order/detail?detailType=1&id='+item.biz_recruitid"
					style="margin-top: 12upx;color: #2bb59e;font-weight: bold;" class="main_text">招聘信息：{{item.btr_title}}
				</navigator>
				<view style="margin-top: 6upx;" class="main_text">
					{{type>=4?'被评价者':'评价者'}}：{{type>=4?item.apaee_name:item.apaer_name}}</view>
				<view style="margin-top: 6upx;" class="main_text">{{item.result_desc||'系统默认好评!'}}</view>
				<view style="margin-top: 4upx;color: #8E97AE;">{{item.createtime}}</view>
			</view>
		</view>
		<view class="loading_text" v-if="data.length==0&&!loading">暂无数据</view>
	</view>
</template>

<script>
	import commonData from '../../commonData.js'
	import commonFun from '../../commonFun.js'
	import trailerStars from '../../components/starts/index.vue'

	export default {
		data() {
			return {
				user_info: {},
				sys_role: commonData.sys_role, //角色
				data: [],
				id: uni.getStorageSync('USER_INFO')['id'],
				loading: true,
				type: '',

			}
		},
		methods: {
			// 获取数据
			get_data() {
				this.loading = true
				uni.showLoading({
					title: '加载中...',
					mask: true
				})

				let params = {
					bizCatalog: 'AppraisalEntity',
					handleMode: 'fetchall',
					pageIndex: 1,
					pageSize: 1000,
					query: commonData.appraisal_query_arr(this.id)[this.type],
				}
				console.log('评价列表请求参数')
				console.log(params)
				commonFun.requestUrl('&WsAjaxBiz=Trader&WsAjaxAction=fetchPageData', params, res => {
					if (res.status) {
						this.data = res.data.Result.pageData
						console.log('评价列表获取数据')
						console.log(this.data)
					}
					this.loading = false
					uni.hideLoading()
					uni.stopPullDownRefresh()
				})
			},
			onPullDownRefresh() {
				this.get_data()
			},
		},
		components: {
			trailerStars
		},
		onLoad(e) {
			if (e.id) {
				this.id = e.id
			}
			this.type = e.type ? e.type : (this.sys_role == 0 ? 4 : 5)
			this.get_data()
			uni.setNavigationBarTitle({
				title: commonData.appraisal_query_arr(this.id)[this.type]['title_show']
			})
		},
	};
</script>

<style>
</style>
