<template>
	<view style="background-color: #fff;">
		<z-nav-bar title="我的评价"></z-nav-bar>
		<view class="container">
			<view class="" v-if="commentsList && commentsList.length > 0">
			<view class="pingjiaBox" v-for="(item, index) in commentsList" :key="index">
				<view class="flexbox">
					<!-- <view class="touxiang">
						<image :src="item.avatar" mode="aspectFit"></image>
						<text class="username nowrap ">{{item.name}}</text>
					</view> -->
					<view class="contentBox">
						<view class="content">{{ item.content }}<br/></view>
						<text class="time">订单编号：{{ item.orderSn }}</text>
						<text class="time">发布时间：{{ item.createDate }}</text>
					</view>
				</view>
			</view>
			</view>
			<view class="quesheng" v-else>
				<text>暂无评价~</text>
			</view>
		</view>
		<z-navigation></z-navigation>
	</view>
</template>

<script>
	import $http from '@/config/requestConfig.js';
	import {
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				commentsList:[]
			}
		},
		created() {
			this.getComments()
		},
		computed:{
			...mapState(['userInfo']),
		},
		methods: {
			// 获取评价列表
			getComments(){				
					$http.request({
						url: "buy/record/Allevaluations",
						method: "POST", // POST、GET、PUT、DELETE，具体说明查看官方文档
						data: {
						'userid': this.userInfo.id
					},
						header: { //默认 无 说明：请求头
							'Content-Type': 'application/json'
						},
					})
					.then(res => {
						console.log(res,'评价')
						if(res.code == 0){
							this.commentsList = res.Allevaluations
						}
					})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.quesheng{text-align: center; margin-top: 100rpx; color: #8b8a91;}
	.container{margin-top: 10rpx; background-color: #fff; padding:20rpx; border-top:#f1f1f1 1px solid ;}

	.contentBox{ overflow: hidden; margin-bottom: 30rpx; padding-bottom: 30rpx; border-bottom: 1px solid #f1f1f1; margin-top: 30rpx;
		.content{font-size: 28rpx; line-height: 40rpx;}
		.time{font-size: 24rpx; color: #999; margin-top: 6rpx;  display: block; width: 100%; text-align:right}
	}

</style>
