detailsShop.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view class="common-details-container">
  3. <view class="common-header-wrapper">
  4. <image :src="pathPre + content.image" mode="aspectFill" />
  5. </view>
  6. <view class="common-content-wrapper">
  7. <view class="common-card">
  8. <view class="common-card-title">{{ details.title }}</view>
  9. <view class="common-card-rate">
  10. <uni-rate allow-half :value="content.rate || 0" disabled disabledColor="#ff5702" color="#ddd" activeColor="#ff5702" />
  11. <text>{{ (Number(content.rate) || 0).toFixed(1) }}</text>
  12. </view>
  13. <view class="common-sub-title">营业时间: {{ details.businessAt }}</view>
  14. </view>
  15. <view class="common-card">
  16. <view class="common-card-title">店铺简介</view>
  17. <view class="common-card-content" v-if="content?.intro">
  18. <u-parse :html="content?.intro" />
  19. </view>
  20. <view class="common-card-content" v-else>
  21. <u-empty text="暂无简介" />
  22. </view>
  23. <view class="common-card-title u-margin-top-30">精品推荐</view>
  24. <view class="common-card-list" v-if="content.facilities?.length > 0">
  25. <view class="card-list-item" v-for="(item, index) in content.facilities" :key="index">
  26. <view class="item-img-wrap">
  27. <image :src="pathPre + item.img" mode="aspectFill" />
  28. </view>
  29. <view class="list-text">{{ item.name }}</view>
  30. </view>
  31. </view>
  32. <view class="common-empty" v-else>
  33. <u-empty text="暂无推荐" />
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script lang="ts" setup>
  40. import { ref } from 'vue'
  41. import { onLoad } from '@dcloudio/uni-app'
  42. import { getParkServiceShopDetail } from '@/api/home'
  43. import { useGlobal } from '@/composables/index'
  44. const { pathPre } = useGlobal()
  45. const id = ref<string>('')
  46. const details = ref<any>({})
  47. const content = ref<any>({})
  48. onLoad(async (options) => {
  49. id.value = options?.id || ''
  50. const parkId = uni.getStorageSync('parkId')
  51. const res = await getParkServiceShopDetail(id.value, parkId)
  52. if (res.code === 200) {
  53. if (res.data) {
  54. details.value = res.data
  55. content.value = JSON.parse(details.value?.content || '{}')
  56. }
  57. }
  58. })
  59. </script>
  60. <style lang="scss" scoepd>
  61. @import '../base.scss';
  62. :deep(.list-paddingleft-2) {
  63. width: 100% !important;
  64. }
  65. </style>