<template>
  <view class="common-details-container" v-if="driverInfo?.title">
    <view class="common-header-wrapper">
      <image :src="pathPre + content.image" mode="aspectFill" />
    </view>
    <view class="common-content-wrapper">
      <view class="common-card">
        <view class="common-card-title">{{ driverInfo?.title }}</view>
        <view class="common-sub-title">营业时间:{{ driverInfo?.businessAt }}</view>
        <view class="common-sub-title">客服电话:{{ driverInfo?.mobile }}</view>
      </view>
      <view class="common-card">
        <view class="common-card-title u-margin-bottom-20">基本介绍</view>
        <view class="common-card-content">
          <u-parse :html="content.intro" />
        </view>
        <view class="common-card-title u-margin-top-45">设施配置</view>
        <view class="u-flex u-col-center u-margin-top-24">
          <HyTag v-for="(item, index) in content.facilities" :key="index" :text="item.name" :imgUrl="pathPre + item.img" />
        </view>
      </view>
    </view>
  </view>
  <view class="no-data-container" v-else>
    <u-empty />
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getParkServiceDriver } from '@/api/home'
import { useGlobal } from '@/composables/index'

const { pathPre } = useGlobal()

const driverInfo = ref<any>({})
const content = ref<any>({})
onLoad(async () => {
  const parkId = uni.getStorageSync('parkId')
  const res = await getParkServiceDriver(parkId)
  if (res.code === 200) {
    if (res.data) {
      driverInfo.value = res.data
      content.value = JSON.parse(driverInfo.value?.content)
    }
  }
})
</script>

<style lang="scss" scoepd>
@import '../base.scss';
</style>
