<template>
	<view class="wrap">
		<view class="top">
			<view>
				<text>发起日期:</text>
				<text>{{firstData.createTime}}</text>
			</view>
			
			<view>
				<text>联系方式:</text>
				<text>{{firstData.phone||'-'}}</text>
			</view>
		</view>
		
		<view class="middle">
			<view class="middle-title">处理记录</view>
			<view class="step">
				<view class="step-list" v-for="(item,index) in detailList" :key="index">
					<view class="list-left">
						<view class="circle">
							<text v-if="index!=0"></text>
						</view>
						<view class="line" v-if="index!=detailList.length-1"></view>
					</view>
					
					<view class="list-right">
						<view class="right-title">
							<text>{{item.title}}</text>
							<text>{{item.time}}</text>
						</view>
						<view class="right-content">
							{{item.text}}
						</view>
						<view class="right-img">
							<image v-for="(item2,a) in item.imgList" :key="a" :src="item2.imgUrl"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	
</template>

<script>
export default{
  data(){
    return {
      batchId:'',//批次id
      detailList:[],//详情数据
      firstData:'',//第一条数据
    }
  },
  onLoad(option){
    this.batchId=option.batchId
    this.initDetail()
  },
  methods:{
    //---详情加载
    initDetail(){
		  let data={
		    batchId:this.batchId//批次Id
		  }
		  this.$request('comment/userComment/loadInfo',data).then((res)=>{
			  if(res.code=='00'){
		      let list=res.data||[]
          if(list.length>0){
            this.firstData=list[0]
            list.forEach(item=>{
						  if(item.commentText){
                //游客发起
                let imgList=[]
                item.commentImgList.forEach(item2=>{
                  if(item2.imgCommentType==0){
                    //游客发送的图片
                    imgList.push(item2)
                  }
                })
						    this.detailList.push({
						      title:'您发起建议',
						      text:item.commentText,
						      time:item.createTime,
                  imgList
						    })
						  }
						  if(item.commentReply){
                //商家回复
                let imgList=[]
                item.commentImgList.forEach(item2=>{
                  if(item2.imgCommentType==1){
                    //商家发送的图片
                    imgList.push(item2)
                  }
                })
						    this.detailList.push({
						      title:'商家回复',
						      text:item.commentReply,
						      time:item.updateTime,
                  imgList
						    })
						  }
            })
            this.detailList.reverse()
          }
			  }else{
			    uni.showToast({
			      title: res.message,
			      icon: 'none'
			    })
			  }
		  })
    }
  }
}
</script>

<style scoped lang="scss">
.top{
	padding: 24rpx 40rpx;
	background: #ffffff;
}
.top view:not(:first-child){
	margin-top: 20rpx;
}
.top view text:first-child{
	color: #999999;
	margin-right: 20rpx;
}
.middle{
	margin-top: 20rpx;
	background: #ffffff;
	padding: 30rpx 30rpx 150rpx 30rpx;
}
.middle-title{
	font-size: 32rpx;
	font-weight: 600;
}
.step{
	margin-top: 40rpx;
}
.step-list{
	display: flex;
}
.list-left{
	margin-right: 10rpx;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	padding-top: 6rpx;
}
.circle{
	width: 24rpx;
	height: 24rpx;
	border-radius: 50%;
	background: #FE6600;
	position: relative;
	text{
		width: 16rpx;
		height: 16rpx;
		border-radius: 50%;
		background: #ffffff;
		position: absolute;
		top: 4rpx;
		left: 4rpx;
	}
}
.line{
	width: 4rpx;
	flex: 1;
	background: #FFEDD6;
	position: relative;
	left: 10rpx;
}
.list-right{
	flex: 1;
	padding-bottom: 40rpx;
}
.right-title{
	text:first-child{
		font-size: 32rpx;
		font-weight: 600;
		margin-right: 20rpx;
	}
	text:last-child{
		color: #999999;
	}
}
.right-content{
	margin-top: 12rpx;
	font-size: 24rpx;
}
.right-img{
	margin-top: 20rpx;
	image{
		width: 92rpx;
		height: 92rpx;
		margin-right: 20rpx;
	}
}
</style>