<template>
	<view class="resume">
		<view class="row">
			<!--个人信息-->
			<view class="top">
				<view class="sm6">
					<view class="name">
						<text>{{ item.name || '' }}</text>
					</view>
					<view class="item">年龄：{{ item.age || '' }}</view>
					<view class="item">性别：{{ item.sex || '' }}</view>
					<view class="item">手机号码：{{ item.phone || '' }}</view>
					<view class="item">电子邮箱：{{ item.email || '' }}</view>
				</view>
				<image :src="item.avatar ? ip + item.avatar : '../../../static/ls.jpg'" mode="widthFix" class="tx" v-if="item.avatar"></image>
			</view>
		</view>
		<!--求职期望-->
		<view class="row">
			<view class="label">
				<text class="title">求职期望</text>
			</view>
			<view class="item">意向工作：{{ item.positionName || '' }}</view>
		</view>
		<button class="btn" @click="add()">
			<text class="icon">&#xe6a3;</text>
			<text>邀请对方兼职</text>
		</button>
		<button class="btn" @click="call()">
			<text class="icon">&#xe644;</text>
			<text>拨打电话</text>
		</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			ip: this.http.ip,
			resumeDeliverId: 0,
			item: {}
		};
	},
	onLoad(e) {
		this.resumeDeliverId = e.id;
		this.http.request({
			url: '/app/deliver/detail/' + e.id,
			success: (res) => {
				this.item = res.data.data;
			}
		});
	},
	methods: {
		add() {
			uni.showModal({
				title: '提示',
				content: '确定发送兼职邀请',
				success: (res) => {
					if (res.confirm) {
						this.http.request({
							url: '/app/deliver/agreeApplication/' + this.resumeDeliverId,
							success: (res) => {
								//通知模板订阅消息
								uni.requestSubscribeMessage({
									tmplIds: ['bxOGj5FbyGHSevmWf9yzwpSZDjlFZPnGBeqGgIj9w_o', 'pyUsW2HqOcXmFETHFUDjuH-ekf05QVc29k0tRaY9wP8'],
									complete: (c) => {
										uni.showModal({
											title: '提示',
											content: '发送成功，等待对方同意',
											showCancel: false,
											success: (res) => {
												uni.$emit('agreeApplication');
												uni.navigateBack();
											}
										});
									}
								});
							}
						});
					}
				}
			});
		},
		call() {
			uni.makePhoneCall({
				phoneNumber: this.item.phone
			});
		}
	}
};
</script>
<style lang="scss"></style>
