<template>
	<view>
		<view  v-for="(item,index) in assesslist" :key="index" class="uni-padding-wrap" style="border-bottom: 1px solid #EEEEEE;padding-bottom: 10upx;">
			<view class="uni-comment">
				<view class="uni-comment-list">
					<view class="uni-comment-face"><image style="width: 100%;height: 100%;" :src="item.member_avatar"></image></view>
					<view class="uni-comment-body">
						<view class="uni-comment-top">
							<text style="font-size: 28upx;color: #303133">{{item.member_truename}}</text>
						    <uniIcon type="star" size="16"></uniIcon>
						</view>
						<view class="uni-comment-date">
							<text style="color: #909399;font-size: 20upx;">{{item.geval_addtime}}</text>
						</view>
					</view>
					<view>
						<van-rate
						  :value="item.geval_scores"
						  void-icon="star"
						  void-color="#eee"
						  color="#ee0a24"
						  readonly='true'
						/>
					</view>
				</view>
				<view style="color: #303133;font-size: 28upx;" class="uni-comment-content">{{item.geval_content}}</view>
				<view>
					<image  v-for="(items, indexs) in item.images" @click="shoupicture(item.images)"  :key="indexs" :src="items" 
					style="width: 100upx;height: 100upx;float:left;padding-right: 20upx;"></image>
				</view>
			</view>
		</view>
		<view style="text-align: center;" v-if="assesslist.length == 0">
			暂无评价
		</view>
		<unipopup :images="images"  :show="ishow"/>
	</view>
</template>

<script>
	import assess from '@/component/assess.vue'  // 评价列表
	import unipopup from '@/component/openpictrue.vue'
	export default{
		components: {
			assess,
			unipopup
		},
		data(){
			return {
				goodId: 0,
				ishow: false,
				images: '',
				assesslist:[],
				store_id: 0
			}
		},
		onLoad(options) {
			this.goodId = options.goodId;  // 商品Id
			this.store_id =  options.store_id;
			this.getassess();
			uni.$on('changshow', (e) => {
				this.changeshow();			
			})
			// changshow
		},
		methods: {
			shoupicture(e) {
				uni.previewImage({
					urls: e,
					longPressActions: {
						itemList: ['发送给朋友', '保存图片', '收藏'],
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
				// this.ishow = true;
			},
			changeshow() {
				this.ishow = false;
			},
			getassess() {
				this.request({
					url: '/api/index.php?do=getevaluategoods',
					method: 'post',
					data: {
						goodsid: this.goodId
					},
					success: (res) => {
						res.data.forEach(item => {
							item.images = item.geval_image.split(',');
						})
						this.assesslist = res.data;
					}
				})
			}
		}
	}
</script>

<style>
</style>
