<template>
	<view class="box">
		<view class="reservation_img">
			<image :src="info.photo" mode="" />
		</view>

		<view class="Tit">{{info.title}}</view>
		<view class="money">
			￥
			<view>{{info.price}}</view>
			<text>/ {{info.unit}}</text>
		</view>

		<view class="row">
			<view class="row_tit">服务类别</view>
			<view class="row_con">{{info.type_name}}</view>
		</view>
		<view class="row">
			<view class="row_tit">营业时间</view>
			<view class="row_con">{{info.biz_time}}</view>
		</view>
		<view class="row none">
			<view class="row_tit">联系人</view>
			<view class="row_con">{{info.user_name}}</view>
		</view>



		<view class="gray"></view>

		<view class="Tit2">商家信息</view>
		<view class="row">
			<view class="row_tit">提供商家</view>
			<view class="row_con">{{info.shop_name}}</view>
		</view>
		<view class="row">
			<view class="row_tit">联系电话</view>
			<view class="row_con" @click="call">{{info.user_mobile}}</view>
		</view>
		<view class="row none">
			<view class="row_tit">商家地址</view>
			<view class="row_con">{{info.shop_addr}}</view>
		</view>
		<view class="gray"></view>
		<view class="Tit2">服务详情</view>
		<view class="server">
			{{info.intro}}
		</view>

		<view class="btn" @click="reservation">
			立即预约
		</view>

	</view>
</template>

<script>
	import {
		apiArr
	} from '../../../api/communityService';
	import {
		NavgateTo,
		picUrl,
		request
	} from '../../../utils';

	export default {
		data() {
			return {
				id: "",
				info: "",
			}
		},
		methods: {

			async init(id) {
				const res = await request(apiArr.serverInfo, 'POST', {
					appoint_id: Number(id)
				});
				const newRes = {
					...res,
					photo: picUrl + res.photo,
				}

				uni.setNavigationBarTitle({
					title: res.title,
				})
				this.info = newRes;
			},

			// 拨打电话
			call() {
				let that = this
				uni.makePhoneCall({
					phoneNumber: this.info.user_mobile,
					fail(err) {
						console.log('取消拨打', err)
					}
				})
			},

			reservation() {
				NavgateTo(`/packages/communityService/reservationApply/index?id=${this.id}`);
			},
		},
		onLoad(options) {
			this.id = options.id;
			this.init(options.id);
		}
	}
</script>

<style>
	@import url("./index.css");
</style>