chargeMap.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <script setup lang="ts">
  2. import chargeSearch from '../components/search.vue'
  3. import chargeFooter from '../components/charge-tab.vue'
  4. import router from '@/router'
  5. import { StaticUrl } from '@/config'
  6. const { Location } = storeToRefs(useAddressStore())
  7. const { statusBarHeight, MenuButtonHeight } = storeToRefs(useSysStore())
  8. definePage({
  9. name: 'charge-map',
  10. islogin: false,
  11. style: {
  12. navigationBarTitleText: '地图模式',
  13. navigationStyle: 'custom',
  14. },
  15. })
  16. onMounted(() => {
  17. getStationInfoMapList()
  18. })
  19. const markersData = ref<any[]>([])
  20. const markerMapList = ref<any[]>([])
  21. async function getStationInfoMapList() {
  22. const res = await Apis.charge.stationInfoMapList({ data: { longitude: Location.value.longitude, latitude: Location.value.latitude } })
  23. markerMapList.value = res.data
  24. res.data.forEach((item: any) => {
  25. markersData.value.push({
  26. id: item.stationId,
  27. latitude: item.latitude,
  28. longitude: item.longitude,
  29. iconPath: `${StaticUrl}/marker-tag.png`,
  30. width: 30,
  31. height: 34,
  32. })
  33. })
  34. }
  35. const markerShow = ref(false)
  36. const selectData = ref<any>({})
  37. function openMarkerTap(item: any) {
  38. const selected = markerMapList.value.find((station: any) => station.stationId === item.detail.markerId)
  39. if (selected) {
  40. selectData.value = selected
  41. markerShow.value = true
  42. }
  43. }
  44. </script>
  45. <template>
  46. <view class="map-page min-h-screen bg-#F6FAFF">
  47. <wd-navbar
  48. title="" custom-style="background:linear-gradient( 180deg, #E2FF91 0%, rgba(158,214,5,0) 100%)"
  49. :bordered="false" :z-index="99" safe-area-inset-top fixed
  50. >
  51. <template #left>
  52. <view class="flex items-center">
  53. <!-- <wd-icon name="arrow-left" size="22px" color="#000" /> -->
  54. <view class="relative z-10 h62rpx w-full w180rpx opacity-100">
  55. <image class="absolute left-0 top-0 h62rpx w180rpx" :src="`${StaticUrl}/charge-logo.png`" />
  56. </view>
  57. </view>
  58. </template>
  59. </wd-navbar>
  60. <view class="relative">
  61. <view
  62. class="absolute z-1 box-border px24rpx"
  63. :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }"
  64. >
  65. <charge-search
  66. map-mode-text-value="列表模式" :map-mode-icon="`${StaticUrl}/charge-list.png`"
  67. @map-mode-click="router.push({ name: 'charge-index' })"
  68. />
  69. </view>
  70. <view class="absolute left-0 top-0 z-0 h-full w-full">
  71. <map
  72. style="width: 100%;height: 100vh;" :longitude="Location.longitude || 113.264435"
  73. :latitude="Location.latitude || 23.129163" :markers="markersData" @markertap.stop="openMarkerTap"
  74. />
  75. </view>
  76. <transition name="slide-up">
  77. <view v-if="markerShow" class="absolute top-960rpx px-24rpx">
  78. <view class="h-432rpx w-660rpx rounded-32rpx bg-#FFF p-24rpx" @click="router.push({ name: 'charge-site-detail', params: { stationId: String(selectData.stationId) } })">
  79. <view class="" @click.stop="markerShow = false">
  80. <wd-icon name="close" size="16px" color="#9ED605" />
  81. </view>
  82. <view class="flex items-center justify-between">
  83. <view class="text-32rpx font-800">
  84. {{ selectData.stationName }}
  85. </view>
  86. <view
  87. class="ml-150rpx h-44rpx w-148rpx flex items-center border-2rpx border-#9ED605 rounded-34rpx border-solid line-height-[44rpx]"
  88. >
  89. <view class="w-44rpx rounded-[34rpx_0rpx_0rpx_34rpx] bg-#9ED605 text-center">
  90. <wd-icon name="location" size="16px" color="#FFF" />
  91. </view>
  92. <view class="text-24rpx text-#9ED605">
  93. {{ selectData.distance }}km
  94. </view>
  95. </view>
  96. </view>
  97. <view class="mt-20rpx text-24rpx text-#AAA">
  98. {{ selectData.address }}
  99. </view>
  100. <view class="mt-20rpx flex items-center justify-between">
  101. <view class="h-120rpx w-204rpx flex flex-col items-center justify-center rounded-8rpx bg-[linear-gradient(180deg,#45E67D_0%,rgba(218,249,229,0)_100%)]">
  102. <view class="mt-16rpx h-40rpx w-100rpx rounded-8rpx bg-[linear-gradient(180deg,#4FEF86_0%,#00AA3A_100%)] text-center text-24rpx text-#FFF font-bold line-height-[40rpx]">
  103. 快充
  104. </view>
  105. <view class="mt-10rpx text-32rpx font-bold">
  106. {{ selectData.fastCharging }}
  107. </view>
  108. </view>
  109. <view class="h-120rpx w-204rpx flex flex-col items-center justify-center rounded-8rpx bg-[linear-gradient(180deg,#BED2FF_0%,rgba(62,82,128,0)_100%)]">
  110. <view class="mt-16rpx h-40rpx w-100rpx rounded-8rpx bg-[linear-gradient(180deg,#8EB1FF_0%,#3071FF_100%)] text-center text-24rpx text-#FFF font-bold line-height-[40rpx]">
  111. 慢充
  112. </view>
  113. <view class="mt-10rpx text-32rpx font-bold">
  114. {{ selectData.slowCharging }}
  115. </view>
  116. </view>
  117. </view>
  118. <view class="mt-20rpx h-72rpx w-654rpx flex items-center justify-between bg-#F6FAFF">
  119. <view>
  120. <text class="text-48rpx text-#FF6464 font-800">
  121. {{ selectData.platformPrice }}
  122. </text>
  123. <text class="text-24rpx">
  124. 元/度
  125. </text>
  126. </view>
  127. <view class="28rpx">
  128. {{ selectData.peakValue }}:{{ selectData.peakTime }}
  129. </view>
  130. </view>
  131. <view class="mt-20rpx flex items-center gap-16rpx">
  132. <view class="h-30rpx w-30rpx rounded-4rpx bg-#5BE7FF text-center text-24rpx text-#FFF line-height-[30rpx]">
  133. P
  134. </view>
  135. <view class="text-24rpx text-#AAA">
  136. {{ selectData.tips }}
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. </transition>
  142. </view>
  143. <chargeFooter />
  144. </view>
  145. </template>
  146. <style lang="scss" scoped>
  147. .slide-up-enter-active, .slide-up-leave-active {
  148. transition: transform 0.3s ease;
  149. }
  150. .slide-up-enter-from {
  151. transform: translateY(100%);
  152. }
  153. .slide-up-enter-to {
  154. transform: translateY(0%);
  155. }
  156. .slide-up-leave-from {
  157. transform: translateY(0%);
  158. }
  159. .slide-up-leave-to {
  160. transform: translateY(100%);
  161. }
  162. </style>