<template>
	<view class="container">
		<view class="shop_name">
			<text class="t">{{shopUser.name}}</text>
		</view>
		<view class="btn-wrap" @click="makePhoneCall(shopInfo.account)">
			<!-- <navigator class="btn" hover-class="none" url="/pages/make/list">在线预约</navigator> -->
			<view class="btn">在线预约</view>
			<view class="btn">电话预约</view>
		</view>
		<view class="intro-wrap">
			<view class="item">
				<text class="t">营业时间：{{shopInfo.businessTime || '无'}}</text>
			</view>
			<view class="item" @click="goMap">
				<text class="t" style="margin-right: 12upx">门店地址：{{shopInfo.address || '无'}}</text>
				<!-- <u-icon :name="require('@/static/icon_address.png')"></u-icon> -->
			</view>
			<!-- <view class="item">
				<text class="t undline">点击查看近期预约</text>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shopUser: {},
				userInfo: {},
				shopInfo:{}
			};
		},
		onLoad() {

		},
		onShow() {
			if (uni.cache.get('token')) {
				this.loginwxuserInfo()
			}

		},
		methods: {
			goMap() {
				if (this.shopInfo.lat != null && this.shopInfo.lng != null) {
					// 打开内置地图
					uni.openLocation({
						latitude: Number(this.shopInfo.lat),
						longitude: Number(this.shopInfo.lng),
						scale: 18,
						name: this.shopInfo.shopName,
						address: this.shopInfo.address
					})
				} else {
					this.$refs.uToast.show({
						title: '该单位未维护地址',
						type: 'warning'
					})
				}

			},
			async loginwxuserInfo() {
				let res = await this.api.loginwxuserInfo({
					userId: uni.cache.get('userInfo').id
				})
				if (res.code == 0) {
					uni.cache.set('userInfo', res.data);
					this.userInfo = uni.cache.get('userInfo')
				}
			},
			makePhoneCall(e) {
				uni.makePhoneCall({
					phoneNumber: e //仅为示例
				});
			},
		}
	};
</script>

<style scoped lang="scss">
	.container {
		padding: 0 40upx;
	}

	.shop_name {
		padding: 100upx 0;
		display: flex;
		justify-content: center;

		.t {
			font-size: 48upx;
			font-weight: bold;
		}
	}

	.btn-wrap {
		display: flex;

		.btn {
			flex: 1;
			padding: 20upx 0;
			background-color: $color-priamry;
			border-radius: 12upx;
			display: flex;
			justify-content: center;

			&:last-child {
				margin-left: 40upx;
			}
		}
	}

	.intro-wrap {
		padding: $paddingSize 0;

		.item {
			padding-top: $paddingSize;
			display: flex;
			justify-content: center;

			.t {
				color: #999;

				&.undline {
					text-decoration: underline;
				}
			}
		}
	}
</style>