<template>
<!-- 商务合作详情 -->
  <view class="page">
	<view class="page-info">
	  	<view class="banner">
	  		<view class="title">{{tableData.title}}</view>
			<view class="banner-info-top">
				<view class="times">{{tableData.createTime}}</view>
				<view><u-icon name="eye"></u-icon>{{tableData.viewsNumber || 0}}人</view>
			</view>
	  		<view class="banner-info-item">
	  			<u-parse :html="tableData.content"></u-parse>
	  		</view>
	  	</view>
		<view class="info-box banner good-item" v-if="tableData.cereBasicInformationVenue.venueName">
			<view class="img">
				<u-image width="100%" height="100%" borderRadius="10" :src="imgurl+tableData.cereBasicInformationVenue.displayImage"></u-image>
			</view>
			<view class="info" @click="gomapApp(latitude,longitude)">
				<view class="title" style="margin-bottom: 28px;">{{tableData.cereBasicInformationVenue.venueName}}</view>
				<view>所属区域：{{tableData.cereBasicInformationVenue.district}}</view>
				<!-- <view class="info-item">
					<image  :src="$imgUrl('/kefu.png')" style="margin-top: 8px;"></image>
					<map style="width: 100%; height: 70rpx;" longitude="104.06730651855469" latitude="30.65681556429287"  >
					<text>{{tableData.cereBasicInformationVenue.district}}</text>
							</map>
				</view> -->
			</view>
		</view>
		<view class="info-box banner">
			<view class="title">场地往期活动回顾</view>
			<u-row gutter="16">
				<u-col span="4" v-for="(item,index) in tableData.previousEvents">
					<image :src="imgurl+item" mode="heightFix" style="height:90px; border-radius: 10rpx;" ></image>
				</u-col>
			</u-row>
		</view>
		<view class="info-box banner">
			<view class="title">联系我们</view>
			<view class="info-item">合作类型：{{tableData.cooperationType}}</view>
			<view class="info-item">联系人：{{tableData.contactPerson}}</view>
			<view class="info-item">联系方式：{{tableData.contactPhone}}</view>
			<view class="info-item">邮箱：{{tableData.email}}</view>
		</view>
	</view>
  </view>
</template>

<script>

export default {
  data() {
    return {
		tableData:{},
		imgurl:'',
		latitude: null,
		longitude: null,
    };
  },
  onLoad(option){
	  
	   this.imgurl = this.$img
	   let ce = decodeURIComponent(option.item)
  	  this.tableData = JSON.parse(ce)
	  if (typeof this.tableData.previousEvents === 'string') {
	            this.tableData.previousEvents = this.tableData.previousEvents.split(',');
	  }
  	  console.log(this.tableData)
if (this.tableData.cereBasicInformationVenue.mapMarker&& this.tableData.cereBasicInformationVenue.mapMarker!='') {
	
	  	this.latitude = parseFloat(this.tableData.cereBasicInformationVenue.mapMarker.split(',')[0])
	  	this.longitude = parseFloat(this.tableData.cereBasicInformationVenue.mapMarker.split(',')[1])
	  }
	  let obj ={
		  id:this.tableData.id,
		  viewsNumber:Number(this.tableData.viewsNumber) +1 
	  }
	  this.$http.sendRequest('/cereBusinessCooperation/edit', 'POST', obj,1).then(res => {
	  	
	  })
  },
  methods: {
		leaseAdd(){
			uni.navigateTo({
				url: '/pages/leaseAdd/leaseAdd'
			})
		},
		// 打开的点击事件，传经纬度和地点名
		gomapApp(latitude, longitude ) {
			console.log(latitude, longitude);
			let url = "";
			uni.openLocation({
				latitude: latitude,
				longitude: longitude,
				success: function() {
					console.log('success');
				}
			});
		},
  }
};
</script>

<style scoped lang="scss">
@import 'businessDetail.scss';
</style>
