<template>
	<view>
		<view class="consult">
			<dHeader :title="$lang.lang.complaintAdd.complaint"></dHeader>
		</view>
		<view class="start-bar"></view>
		<view class="consultAdd">
			<view class="consult-item">
				<view class="consult-item-label">
					<image src="../../static/img/consulta-1.png" mode=""></image>
					<text>{{$lang.lang.complaintAdd.title}}</text>
				</view>
				<view class="consult-item-put">
					<view style="overflow: auto;height: 100%">{{params.title}}</view>
				</view>
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<image src="../../static/img/consulta-1.png" mode=""></image>
					<text>{{$lang.lang.complaintAdd.type}}</text>
				</view>
				<view class="consult-item-put">
					{{getType(params.type)}}
				</view>
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<image src="../../static/img/consulta-3.png" mode=""></image>
					<text>{{$lang.lang.complaintAdd.name}}</text>
				</view>
				<view class="consult-item-put">
					{{params.contacter}}
				</view>
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<image src="../../static/img/consulta-4.png" mode=""></image>
					<text>{{$lang.lang.complaintAdd.phone}}</text>
				</view>
				<view class="consult-item-put">
					{{params.contactPhone}}
				</view>
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<image src="../../static/img/consulta-5.png" mode=""></image>
					<text>{{$lang.lang.complaintAdd.orderNo}}</text>
				</view>
				<view class="consult-item-put">
					{{params.orderId}}
				</view>
			</view>
			<view class="consult-item-2">
				<view class="consult-item-label-2">
					<image src="../../static/img/consulta-6.png" mode=""></image>
					<text>{{$lang.lang.complaintAdd.content}}</text>
				</view>
				<view class="consult-item-put-2">
					<text>{{params.content}}</text>
				</view>
			</view>
		</view>
		<view class="footer">
			<view class="apply_content" v-if="params.status&&params.status==3">
				<text>{{$lang.lang.complaintAdd.status}} : {{getStaus(params.status)}}</text>
				<text>{{$lang.lang.complaintAdd.disposeTime}}：{{$request.getLocalTime(params.handleAt)}}</text>
				<text>{{$lang.lang.boxException.result}}：{{params.result}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import dHeader from '../../components/dHeader/index.vue'
	export default {
		components: {
			dHeader
		},
		data() {
			return {
				typeData: [],
				params: {

				},
				statusData:[],
			}
		},
		onLoad (op) {
			if(op.id){
				this.getData(op.id)
			}
			this.getStatusData()
			this.getTypeData()
		},
		methods: {
			getTypeData(){
				this.$request.getConfig('customer_complaint_type').then(res => {
					if(res.code==0&&res.data&&res.data.list.length > 0){
						this.typeData = res.data.list
					}
				})
			},
			getStatusData(){
				this.$request.getConfig('customer_complaint_status').then(res => {
					if(res.code==0&&res.data&&res.data.list.length > 0){
						this.statusData = res.data.list
					}
				})
			},
			getData(id){
				this.$request.get('/app-api/ecw/customer-complaint/get',{id:id}).then(res => {
					if(res.code==0&&res.data){
						this.params = res.data
					}
				})
			},
			getType(value){
				var arr = this.typeData.find(itme=>itme.value==value)
				if(arr){
          arr[this.$lang.label]
				}else{
					return ''
				}
			},
			getStaus(value){
				var arr = this.statusData.find(itme=>itme.value==value)
				if(arr){
          arr[this.$lang.label]
				}else{
					return ''
				}
			},
		}
	}
</script>

<style>
	@import url("../../static/css/consult_add.css");
</style>
