<template>
	<view>
		<view class="main">
			<view class="title">{{ item.title }}</view>
			<view class="price" v-if="item.type == 0">{{ item.salary == '面议' ? item.salary : item.salary + '/月' }}</view>
			<view class="desc">{{ item.experience }} · {{ item.positionName }} · {{ item.type == 0 ? '全职' : '兼职' }}</view>
		</view>
		<view class="bos">
			<view class="ms" style="margin-top: 0px">
				<view class="mtitle">职位描述</view>
				<u-parse :content="item.contents" class="item"></u-parse>
			</view>
			<!--企业信息-->
			<view v-if="item.type == 0">
				<view class="ms" @click="go('/pages/job/enterprise/detail?id=' + enterprise.id)">
					<view class="icon gs">&#xe646;</view>
					<view class="con">
						<view class="mti">{{ enterprise.name }}</view>
						<view class="address omit">{{ enterprise.address }}</view>
					</view>
					<text class="icon more">&#xe62b;</text>
				</view>
				<map :latitude="item.latitude" :longitude="item.longitude" :markers="covers"></map>
			</view>
		</view>
		<view class="mfooter">
			<view class="cn">
				<view class="tob">
					<text class="icon">&#xe637;</text>
					<view class="mtt">分享</view>
				</view>
				<view class="tob">
					<text class="icon">&#xe626;</text>
					<view class="mtt">收藏</view>
				</view>
				<button class="btn" @click="send()">
					<text class="icon">&#xe652;</text>
					<text>投递简历</text>
				</button>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			item: {},
			enterprise: {},
			covers: []
		};
	},
	onLoad(e) {
		this.http.request({
			url: '/app/position/detail/' + e.id,
			success: (res) => {
				this.item = res.data.data.position;
				this.enterprise = res.data.data.enterprise;
				this.covers.push({ latitude: this.item.latitude, longitude: this.item.longitude });
			}
		});
	},
	methods: {
		go(url) {
			uni.navigateTo({ url: url });
		},
		//投递简历
		send() {
			this.http.request({
				url: '/app/deliver/send/' + this.item.id,
				success: (res) => {
					uni.showModal({content: '投递成功，等待企业回应',showCancel: false});
				}
			});
		}
	}
};
</script>

<style lang="scss">
.title {
	font-weight: bold;
}
.price {
	padding-top: 5px;
	font-size: 15px;
	font-weight: bold;
	color: #ff5722;
}
.desc {
	padding-top: 5px;
	font-size: 14px;
}
.bos {
	background-color: white;
	padding: 20px;
	border-radius: 25px;
	.ms {
		margin-top: 20px;
		overflow: hidden;
		.mtitle {
			font-weight: bold;
			margin-bottom: 10px;
		}
		.item {
			font-size: 14px;
			padding-top: 7px;
		}
		.gs {
			float: left;
			width: 50px;
			height: 50px;
			border-radius: 50%;
			background-color: #f1f1f1;
			text-align: center;
			font-size: 30px;
			line-height: 47px;
		}
		.con {
			float: left;
			padding-left: 10px;
			width: 70%;
			.mti {
				font-weight: bold;
				padding-bottom: 5px;
			}
			.address {
				font-size: 13px;
			}
		}
		.more {
			float: right;
			margin-top: 14px;
		}
	}
	map {
		border-radius: 8px;
		overflow: hidden;
		margin-top: 15px;
		width: 100%;
		height: 150px;
	}
}
.mfooter {
	background-color: white;
	bottom: 0px;
	border-top: 1px solid $line;
	.cn {
		padding: 10px 10px 18px 10px;
		overflow: hidden;
		.tob {
			margin-right: 15px;
			float: left;
			color: $font-c;
			.icon {
				font-size: 28px;
			}
			.mtt {
				font-size: 14px;
			}
		}
		.btn {
			float: right;
			margin-top: 5px;
		}
	}
}
</style>
