<template>
	<view class="warpbox">
		<view class="topbox">
			<image :src="info.staff && info.staff.img?info.staff.img:BASE_IMG_URL+'headImg.png'" class="staffimg"></image>
			<view class="ribox">
				<view class="ritop">
					<view class="staffname">{{info.staff && info.staff.name ?info.staff.name:''}}</view>
					<view class="time">{{info.createtime}}</view>
				</view>
				<view class="riaddress" @click="toLookLocation">{{info.location}}</view>
			</view>
		</view>
		<view class="con_text">
			<view class="label">拜访客户：</view>
			<view class="right_text" @click="toMore(info.customer.id)">
				{{info.customer && info.customer.name}}
			</view>
		</view>
		<form-item v-for="(item,index) in listForm" :key="index" :objInfo="item" :isEdit="false"></form-item>
	</view>
</template>

<script>
	import { netGetSignDetail, netSetForm  } from '@/api/index.js'
	import formItem from '@/components/form/formitem.vue'
	import { BASE_IMG_URL } from '@/util/api.js'
	
	export default{
		components:{
			formItem
		},
		data() {
			return{
				BASE_IMG_URL:BASE_IMG_URL,
				id:'',
				info:{},
				listForm:[]
			}
		},
		onLoad(options) {
			this.id = options.id
			//获取详情
			this.getDetail()
		},
		methods:{
			getForm() {
				netSetForm({type: 'signin'}).then(res => {
					let arr = res.data.data
					arr.forEach(ele=>{
						ele.value = this.info.other[ele.id]?this.info.other[ele.id]:''
					})
					this.listForm = arr
				})
			},
			getDetail(){
				netGetSignDetail({id:this.id}).then(res=>{
					this.info = res.data
					this.getForm()
				})
			},
			toPrevieimg(files,index) {
				uni.previewImage({
					current:index,
					urls: files
				})
			},
			toMore(id) {
				uni.navigateTo({
					url: '/pages/index/groupCompany/groupCompany?id='+id
				})
			},
			//查看详情
			toLookLocation() {
				uni.openLocation({
					latitude:Number(this.info.lat),
					longitude:Number(this.info.lng),
					name:this.info.location
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.warpbox{
		padding:24rpx 0;
		background:#fff;
		.topbox{
			padding:0 30rpx;
			display: flex;
			justify-content: flex-start;
			.staffimg{
				width:80rpx;
				height:80rpx;
				border-radius: 50%;
				margin-right:24rpx;
			}
			.ribox{
				flex-shrink: 0;
				flex:1;
				.ritop{
					display: flex;
					justify-content: space-between;
					align-items: center;
					.staffname{
						font-size:24rpx;
						color:#333;
					}
					.time{
						font-size:24rpx;
						color:#666;
					}
				}
				.riaddress{
					font-size:24rpx;
					color:$uni-text-color;
					margin-top:24rpx;
				}
			}
		}
	}
	.con_text{
		margin-top:24rpx;
		display: flex;
		justify-content: space-between;
		font-size:32rpx;
		padding:24rpx;
		border-bottom:1rpx solid #f5f5f5;
		border-top:1rpx solid #f5f5f5;
		color:#999;
		.label{
			font-size:32rpx;
		}
		.right_text{
			color:$uni-text-color;
		}
	}
</style>