<template>
	<view>
		<customNav :shownav="true" xinzeng="1" :title="$t('order.lianxikef')" titledetl="" v-on:Enavbarsel="navbarsel"></customNav>
		<view style="margin-top: 40rpx;">
			<view class="contentColumn content" style="margin-top: 20rpx;background-color: white;" v-for="(item,index) in MsgList">
				<text style="margin: 12rpx;font-size: 30rpx;font-weight:bold;">{{item.nickName}}: </text>
				<text class="pinglun">{{item.content}}</text>
				<view class="item_list" style="margin-top: 20rpx;margin-bottom: 30rpx;">
					<view class="item_content" v-for="(itemi,indexi) in imageList(item.imgs)" @click="imagesel(itemi)">
						<netImage v-if="itemi!=''" width="210" height="210" bradius="4" :mysrc="itemi" mymode="scaleToFill" ></netImage>
					</view>
				</view>
				<view v-for="(citem,index) in getchecks(item.feedBack)">
					<view class="contentInRowL" style="align-items: center;">
						<uni-icons custom-prefix="custom-icon" color="#386EF5" type="checkbox-filled" size="26"></uni-icons>
						<text style="font-size: 30rpx;">{{getcheckValue(citem)}}</text>
					</view>
				</view>
				<view class="contentInRowL" style="margin-left: 8rpx;margin-bottom: 10rpx;">
					<text v-if="item.useCase==0" style="font-size: 30rpx;color: crimson;">{{$t('kefu.weishiyong')}}</text>
					<text v-if="item.useCase==1" style="font-size: 30rpx;color: crimson;">{{$t('kefu.yishiyong')}}</text>
				</view>
			</view>
		</view>
		<view style="height: 40rpx;"></view>
		<view v-if="MsgList.length==0" class="contentColumnC">
			<text class="textfontB2">{{$t('order.haimeixinxi')}}</text>
		</view>
	</view>
</template>

<script>
	import api from "@/pages/api/api.js"
	export default {
		data() {
			return {
				annexList:['1','2','3','4','5'],
				MsgList:[],
				ddId:'',
				userInfo:'',
				language:'',
				feedlist:[]
			}
		},
		onLoad(option) {
			this.ddId= option.ddId;
			this.userInfo = uni.getStorageSync('userInfo');
			console.log(this.userInfo);
			this.getfeedlist();
		},
		onShow() {
			this.getMsgList();
		},
		methods: {
			getfeedlist(){
				api('getfeedlist',{},res=>{
					console.log('getfeedlist',res)
					if(res.data.code==200){
						var temp=res.data.data;
						this.feedlist=res.data.data;
					}
				},failc=>{
					
				})
			},
			getchecks(str){
				if(str==null||str==''||str==undefined){
					return [];
				}
				return JSON.parse(str);
			},
			getcheckValue(id){
				for(var i=0;i<this.feedlist.length;i++){
					if(id==this.feedlist[i].id){
						var obj = this.feedlist[i];
						if(this.language=='zh-Hans'){
							return obj.contentCh;
						}
						if(this.language=='zh-Hant'){
							return obj.contentTw;
						}
						if(this.language=='yuenan'){
							return obj.contentVi;
						}
						return obj.contentCh;
					}
				}
				
			},
			retunStr(type){
				if(type==0){//用户留言
					return this.$t('order.yonghuly')
				}
				if(type==2){//用户留言
					return this.$t('order.qishouly')
				}
				return this.$t('order.kefuliuy')
			},
			imagesel(mysrc){
				uni.navigateTo({
					url:'/pages/index/BigimageView?mysrc='+mysrc
				})
			},
			navbarsel(state){
				console.log(state)
				if(state==5){
					uni.navigateTo({
						url:'/pages/kehufuwu/updataKefuMsg?ddId='+this.ddId
					})
				}
			},
			getMsgList(){
				api('kefuMsgList',{
					ddId:this.ddId,
					userType:this.userInfo.userType
				},res=>{
					console.log('setorderuzt',res)
					if(res.data.code==200){
						this.MsgList=res.data.data;
					}
					else{
						uni.showToast({
							title:res.data.msg,
							icon:"none"
						})
					}
				},failc=>{
					//console.log('getadvertis----',failc)
				})
			},
			imageList(str){
				if(str==''){
					return [];
				}
				var ret = str.split(',');
				return ret;
			},
		}
	}
</script>

<style lang="scss">
	
page{
	background-color:whitesmoke;
}
.item_list{
	padding: 0 10rpx;
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	.item_content{
		width:210rpx;
		height:210rpx;
		margin: 10rpx;
		box-sizing: border-box;
	}
}
.upimagV{
	width: 210rpx;
	height:210rpx;
}
.pinglun{
	padding: 12rpx;
	width:96%;
	font-size: 28rpx;
	overflow-wrap: break-word;
}

</style>
