<template>
	<view style="padding-bottom: 20rpx;">
		<view class="padding-tb-sm margin-lr u-border-bottom" v-for="(item, index) in EvaluateList" :key='index'>
			<view class="flex justify-between align-center" @click="gotoShop(item.shopId)">
				<view class="flex align-center">
					<u-avatar :src="item.shopCover" size="65"></u-avatar>
					<view class=" margin-left-sm" style="line-height: 46upx;">{{item.shopName?item.shopName:'匿名'}}
					</view>
					<view class="flex margin-left-sm">
						<u-icon v-for="ite in item.score" :key='ite' color="#FCD202" name="star-fill">
						</u-icon>
					</view>
				</view>
				<view>{{item.createTime}}</view>
			</view>
			<view style="display: flex;">
				<view class="margin-top-sm" :style="!item.shopReplyMessage ? 'width: 90%;' : ''">{{item.evaluateMessage}}</view>
				<view class="flex padding-top-sm margin-right" @tap="goShow(index)" v-if="!item.shopReplyMessage">
					<!-- <image src="../../static/images/order/pinglun.png" style="width: 20px;height: 20px;"></image> -->
				</view>
			</view>
			<view class="margin-top-sm" v-if="item.shopReplyMessage">
				<view class="flex align-center">
					<view class=" flex align-center text-df" style="color: #999999;">
						<view class="text-df">商家回复:</view>{{item.shopReplyMessage}}
					</view>
				</view>
				<!-- <view class="text-lg padding-left margin-left-xl">{{dataDet.shopReplyMessage}}</view> -->
			</view>
			<view class="flex" style="width: 100%;margin-top: 20rpx;flex-wrap: wrap;" v-if="item.pictures">
				<image @click="lookImgs(ind,item.pictures)" :src="ite" v-for="(ite,ind) in item.pictures" :key="ind" style="width: 200rpx;height: 200rpx;margin-right: 10rpx;margin-bottom: 10rpx;" mode=""></image>
			</view>
			<view class="flex justify-end" style="width: 100%;color: #999999;" @click="deletePj(item)">
				删除
			</view>
		</view>
		<empty v-if="EvaluateList.length<=0"></empty>
	</view>
</template>

<script>
	import empty from '../../components/empty.vue'
	export default {
		components:{
			empty
		},
		data() {
			return {
				pinglun: '',
				count: 0,
				show: false,
				customStyle: {
					color: '#333333',
					background: '#FCD202',
					marginRight: '20rpx',
					border: 0
				},
				customStyle1: {
					color: '#333333',
					background: '#F2F2F2',
					marginRight: '20rpx',
					border: 0
				},
				cashDeposit: [],
				EvaluateData: {},
				EvaluateList: [],
				grade: '',
				page: 1,
				size: 10,
				isShow: false,
				oneData: [],
				titleData: [],
				shopDet: {}
			}
		},
		onShow() {
			this.getList()
		},
		onPullDownRefresh() {
			this.page = 1
			this.getList()
		},
		onReachBottom: function() {
			this.page = this.page + 1;
			this.getList()
		},
		methods: {
			deletepjrequest(id){
				let data = {
					id:id
				}
				this.$Request.getT("/app/order/deleteEvaluateById", data).then(res => {
					uni.hideLoading()
					if (res.code == 0) {
						uni.showToast({
							title:'删除成功'
						})
						this.page = 1
						this.getList()
					}else{
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
					}
				});
			},
			//删除评价
			deletePj(item){
				let that = this
				uni.showModal({
					title:'提示',
					content:'确定删除此评价?',
					complete(ret) {
						if(ret.confirm){
							//删除评价的接口
							that.deletepjrequest(item.id)
						}
					}
				})
			},
			//去商铺
			gotoShop(shopId){
				uni.navigateTo({
					url:'/pages/index/shop/index?shopId='+shopId
				})
			},
			//预览图片
			lookImgs(index,imgs){
				uni.previewImage({
					current:index,
					urls:imgs
				})
			},
			goShow(index){
				this.orderNumber = this.EvaluateList[index].orderNumber;
				this.show = true;
			},
			sel(e) {
				this.grade = e
				this.count = e
				this.page = 1
				this.getList()
			},
			open(data) {
				console.log(data);
				this.oneData = data;
				this.titleData = data.goods
				this.isShow = true;
			},
			close() {
				this.isShow = false;
			},
			// 获取评价列表
			getList() {
				let data = {
					page: this.page,
					limit: this.size,
				}
				this.$Request.getT("/app/order/getEvaluateList", data).then(res => {
					if (res.code == 0 && res.data) {
						// this.EvaluateData = res.data
						res.data.records.map(item=>{
							if(item.pictures){
								item.pictures = item.pictures.split(',')
							}else{
								item.pictures = []
							}
						})
						if (this.page == 1) {
							this.EvaluateList = res.data.records
						} else {
							this.EvaluateList = [...this.EvaluateList, ...res.data.records]
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
	}

	.box1 {
		position: absolute;
		background: #000000;
		width: 750rpx;
		height: 100vh;
		opacity: 0.4;
	}

	.moudes {
		width: 650rpx;
		position: absolute;
		background: #FFFFFF;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		margin: auto;
		height: 700rpx;
		border-radius: 10rpx;

		.bt {
			font-size: 30rpx;
			font-weight: bold;
		}

		.pjImg {
			width: 200rpx;
			height: 200rpx;
		}

		.navBox {
			.avtiter {
				width: 80rpx;
				height: 80rpx;
				border-radius: 40rpx;
				margin-right: 15rpx
			}

			padding-left: 30rpx;
			padding-top: 30rpx;
			display: flex;
			align-items: center;

			.userName {
				font-size: 28rpx;
				font-weight: bold;
			}

		}


	}

	.nrTxt {
		display: inline-block;
		width: 500rpx;
	}

	.navList {
		text-align: center;
		margin-top: 30rpx;
		padding-left: 30rpx;
		padding-right: 30rpx;
		display: flex;
		justify-content: center;

		.xq {
			font-size: 30rpx;
			font-weight: bolder;
			text-align: center;
		}



	}

	.contentTxt {

		view {
			margin-bottom: 30rpx;

			display: flex;
			align-items: center;
		}

		.title {
			font-size: 30rpx;
			font-weight: bold;
			color: #000000;
			margin-right: 15rpx;
		}

		.imgRsc {
			width: 100rpx;
			height: 100rpx;
			border-radius: 10rpx;
		}
	}

	.list_1 {
		position: absolute;
	}

	.btn {
		width: 690upx;
		height: 88upx;
		margin: 30upx auto;
		background: #FCD202;
		box-shadow: 0px 10upx 20upx 0upx #FFD9B3;
		border-radius: 16upx;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #000000;

	}

	.one {
		background: #FFFFFF;
		margin-top: 20rpx;
		display: flex;
		justify-content: space-between;
		padding: 20rpx;

		.imgSrc {
			width: 100rpx;
			height: 100rpx;
			vertical-align: middle;
			margin-right: 20rpx;
			border-radius: 10rpx;
		}

		.name {
			margin-top: 10rpx;
			margin-bottom: 20rpx;
			font-size: 24rpx;
			color: #000000;
		}

		.timer {
			font-size: 20rpx;
			color: #b3b3c4;
		}

		.contentTxt {

			font-size: 24rpx;
			color: #000000;
		}

	}
</style>
