<template>
  <view class="common-details-container" v-if="carInfo?.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">{{ carInfo?.title }}</view>
        <view class="common-sub-title">营业时间:{{ carInfo?.businessAt }}</view>
        <view class="common-sub-title">客服电话:{{ carInfo?.mobile }}</view>
      </view>
      <view class="common-card">
        <view class="common-card-content">
          <u-parse :html="content?.intro" />
        </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 { getParkServiceCar } from '@/api/home'
import { useGlobal } from '@/composables/index'

const { pathPre } = useGlobal()

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

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