<template>
	<view class="info_detail">
		<view class="info_item">
			<view class="basic_head">
				<view class="iconfont icon-arrows_right"></view>
				<view>基本信息</view>
			</view>
			<form-item v-for="(item,index) in baseForm" :key="index" :objInfo="item" :isEdit="false"></form-item>
		</view>
		<view class="info_item">
			<view class="basic_head">
				<view class="iconfont icon-arrows_right"></view>
				<view>附加信息</view>
			</view>
			<form-item v-for="(item,index) in otherForm" :key="index" :objInfo="item" :isEdit="false"></form-item>
		</view>
	</view>
</template>

<script>
	import formItem from '@/components/form/formitem.vue'
	import { netSetForm } from '@/api/index.js'
	export default {
		props:{
			info:{
				type:Object,
				default:{}
			}
		},
		components:{
			formItem
		},
		created() {
			this.getForm()
		},
		data() {
			return {
				otherForm:[],
				baseForm:[]
			}
		},
		methods: {
			getForm() {
				netSetForm({type:'contacts'}).then(res=>{
					res = res.data.data
					res.forEach(ele=>{
						ele.value = this.info[ele.id]?this.info[ele.id]:''
						if(ele.id.indexOf('other') != -1) {
							this.otherForm.push(ele)
						}else{
							this.baseForm.push(ele)
						}
					})
				})
			}
		}
	}
</script>

<style lang="scss">
.info_detail {
	margin-bottom: 100rpx;
	.basic_head {
		display: flex;
		padding: 30rpx 24rpx 30rpx;
		:last-child {
			font-weight: 700;
			margin-left: 8rpx;
		}
	}
	.basic_main {
		display: flex;
		justify-content: space-between;
		padding: 0 32rpx;
		background-color: #fff;
		height: 90rpx;
		line-height: 90rpx;
		border-bottom: 1rpx solid #EAEAEA;
		:first-child {
			color: #999;
		}
	}
}

</style>
