|
|
@@ -2,9 +2,15 @@
|
|
|
import router from '@/router'
|
|
|
import { StaticUrl } from '@/config'
|
|
|
|
|
|
-const swiperList = ['https://www.keaitupian.cn/cjpic/frombd/2/253/1659552792/3869332496.jpg']
|
|
|
-
|
|
|
+// const swiperList = ['https://www.keaitupian.cn/cjpic/frombd/2/253/1659552792/3869332496.jpg']
|
|
|
+const { statusBarHeight, MenuButtonHeight } = storeToRefs(useSysStore())
|
|
|
+const { Location } = storeToRefs(useAddressStore())
|
|
|
const { opcity } = storeToRefs(useSysStore())
|
|
|
+const stationId = ref()
|
|
|
+onLoad((options: any) => {
|
|
|
+ console.log(options)
|
|
|
+ stationId.value = Number(options.stationId)
|
|
|
+})
|
|
|
definePage({
|
|
|
name: 'charge-site-detail',
|
|
|
islogin: true,
|
|
|
@@ -14,24 +20,88 @@ definePage({
|
|
|
},
|
|
|
})
|
|
|
const activeFilter = ref('0')
|
|
|
-const filterOptions = [
|
|
|
- { key: '0', label: '空闲(10)' },
|
|
|
- { key: '1', label: '占用(8)' },
|
|
|
- { key: '2', label: '离线(5)' },
|
|
|
-]
|
|
|
-// 处理筛选项点击的方法
|
|
|
-function handleFilterClick(filterKey: string) {
|
|
|
- activeFilter.value = filterKey
|
|
|
- console.log(`选择了: ${filterKey}`)
|
|
|
-}
|
|
|
onMounted(() => {
|
|
|
+ getStationDetail()
|
|
|
opcity.value = 0
|
|
|
})
|
|
|
+/**
|
|
|
+ * 获取电站详情
|
|
|
+ */
|
|
|
+const stationDetail = ref<Api.chargeStationDetail>()
|
|
|
+async function getStationDetail() {
|
|
|
+ useGlobalLoading().loading({})
|
|
|
+ const res = await Apis.charge.detail({ data: { stationId: stationId.value, latitude: Location.value.latitude, longitude: Location.value.longitude } })
|
|
|
+ stationDetail.value = res.data
|
|
|
+ useGlobalLoading().close()
|
|
|
+}
|
|
|
+// 使用计算属性动态计算筛选选项
|
|
|
+const filterOptions = computed(() => {
|
|
|
+ const counts = {
|
|
|
+ 0: 0, // 离线
|
|
|
+ 1: 0, // 空闲
|
|
|
+ 2: 0, // 占用
|
|
|
+ }
|
|
|
+
|
|
|
+ // 遍历充电站连接器列表,统计各状态数量
|
|
|
+ if (stationDetail.value?.connectorList) {
|
|
|
+ stationDetail.value.connectorList.forEach((item) => {
|
|
|
+ // 检查status是否为有效键值
|
|
|
+ if (item.status === 0 || item.status === 1 || item.status === 2) {
|
|
|
+ counts[item.status as keyof typeof counts]++
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ return [
|
|
|
+ { key: '0', label: `离线(${counts['0']})` },
|
|
|
+ { key: '1', label: `空闲(${counts['1']})` },
|
|
|
+ { key: '2', label: `占用(${counts['2']})` },
|
|
|
+ ]
|
|
|
+})
|
|
|
+
|
|
|
+// 添加计算属性来过滤设备列表
|
|
|
+const filteredConnectors = computed(() => {
|
|
|
+ if (!stationDetail.value?.connectorList)
|
|
|
+ return []
|
|
|
+ // 根据当前选中的状态过滤设备,并限制为前3个
|
|
|
+ return stationDetail.value.connectorList.filter(
|
|
|
+ item => String(item.status) === activeFilter.value,
|
|
|
+ ).slice(0, 3)
|
|
|
+})
|
|
|
+/**
|
|
|
+ * 处理站点设备状态
|
|
|
+ *status 状态:0-离线 1-空闲 2-占用
|
|
|
+ */
|
|
|
+function getStatusImageByStatus(deviceStatus: number) {
|
|
|
+ switch (deviceStatus) {
|
|
|
+ case 1: // 空闲
|
|
|
+ return 'kx'
|
|
|
+ case 2: // 占用
|
|
|
+ return 'zy'
|
|
|
+ case 0: // 离线
|
|
|
+ return 'lx'
|
|
|
+ default:
|
|
|
+ return 'unknown'
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
onPageScroll((e) => {
|
|
|
const calculatedOpacity = e.scrollTop / 100
|
|
|
opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
|
|
|
})
|
|
|
+
|
|
|
+// 处理筛选项点击的方法
|
|
|
+function handleFilterClick(filterKey: string) {
|
|
|
+ activeFilter.value = filterKey
|
|
|
+ console.log(`选择了: ${filterKey}`)
|
|
|
+}
|
|
|
+
|
|
|
+function openMap() {
|
|
|
+ uni.openLocation({
|
|
|
+ latitude: Number(stationDetail.value?.latitude),
|
|
|
+ longitude: Number(stationDetail.value?.longitude),
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -40,38 +110,39 @@ onPageScroll((e) => {
|
|
|
title="站点详情" :custom-style="`background-color: rgba(226, 255, 145, ${opcity})`" :bordered="false"
|
|
|
:z-index="999" safe-area-inset-top left-arrow fixed @click-left="router.back()"
|
|
|
/>
|
|
|
- <view class="site-detail-content relative">
|
|
|
- <view>
|
|
|
+ <view :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }" />
|
|
|
+ <view class="site-detail-content">
|
|
|
+ <!-- <view>
|
|
|
<wd-swiper :list="swiperList" :height="260" :indicator="{ type: 'fraction' }" value-key="advertImg" />
|
|
|
- </view>
|
|
|
- <view class="absolute left-0 right-0 z-10 rounded-[32rpx_32rpx_0_0] bg-#FFF -bottom-100rpx">
|
|
|
+ </view> -->
|
|
|
+ <view class="bg-#FFF p-20rpx">
|
|
|
<view class="mt-28rpx box-border px24rpx">
|
|
|
<view class="text-32rpx font-800">
|
|
|
- 贵阳花果园购物中心充电站
|
|
|
+ {{ stationDetail?.stationName }}
|
|
|
</view>
|
|
|
<view class="mt-20rpx flex items-center gap-20rpx">
|
|
|
<view class="h-30rpx w-30rpx rounded-4rpx bg-#5BE7FF text-center text-24rpx text-#fff line-height-[30rpx]">
|
|
|
P
|
|
|
</view>
|
|
|
<view class="text-24rpx text-#AAA">
|
|
|
- 充电减免2小时停车费,超出部分按每小时3元计算
|
|
|
+ {{ stationDetail?.tips || '--' }}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="box-border px24rpx">
|
|
|
+ <view class="ml-10rpx">
|
|
|
<view
|
|
|
- class="cardBg-set mt-20rpx box-border h-138rpx w-702rpx flex items-center justify-between rounded-16rpx"
|
|
|
+ class="cardBg-set mt-20rpx box-border h-138rpx w-680rpx flex items-center justify-between rounded-16rpx"
|
|
|
:style="{ backgroundImage: `url(${StaticUrl}/site-detail-navBg.png)` }"
|
|
|
>
|
|
|
<view class="ml-24rpx">
|
|
|
<view class="text-28rpx text-#2B303A font-bold">
|
|
|
- 距离您1.3km
|
|
|
+ 距离您{{ stationDetail?.distance || '--' }}km
|
|
|
</view>
|
|
|
<view class="mt-8rpx w-408rpx overflow-hidden text-ellipsis whitespace-nowrap text-24rpx text-#AAA">
|
|
|
- 贵州省贵阳市观山湖区贵安新区群航贵州省贵阳市观山湖区贵
|
|
|
+ {{ stationDetail?.address }}
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="mr-24rpx">
|
|
|
+ <view class="mr-24rpx" @click="openMap">
|
|
|
<view>
|
|
|
<image class="h-40rpx w-40rpx" :src="`${StaticUrl}/site-detail-nav.png`" />
|
|
|
</view>
|
|
|
@@ -83,14 +154,13 @@ onPageScroll((e) => {
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="h-100rpx" />
|
|
|
<view class="mt20rpx box-border px24rpx">
|
|
|
<view class="rounded-24rpx bg-#FFF p-24rpx">
|
|
|
<view class="flex items-center justify-between">
|
|
|
<view class="text-32rpx font-bold">
|
|
|
费用信息
|
|
|
</view>
|
|
|
- <view class="flex items-center" @click="router.push({ name: 'charge-detail' })">
|
|
|
+ <view class="flex items-center" @click="router.push({ name: 'charge-detail', params: { stationId: String(stationDetail?.stationId), type: 'price' } })">
|
|
|
<view class="text-24rpx text-#AAA">
|
|
|
查看全部
|
|
|
</view>
|
|
|
@@ -110,7 +180,7 @@ onPageScroll((e) => {
|
|
|
<view>
|
|
|
<view class="flex items-center">
|
|
|
<text class="text-48rpx text-#FF6464 font-800">
|
|
|
- 1.2026
|
|
|
+ {{ stationDetail?.currentPrice }}
|
|
|
</text>
|
|
|
<text class="text-24rpx">
|
|
|
元/度
|
|
|
@@ -120,7 +190,7 @@ onPageScroll((e) => {
|
|
|
当前时段:
|
|
|
</view>
|
|
|
<view class="text-bold mt-16rpx text-28rpx">
|
|
|
- 平13:00-17:00
|
|
|
+ {{ stationDetail?.currentPeriod }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view>
|
|
|
@@ -134,7 +204,7 @@ onPageScroll((e) => {
|
|
|
<view class="text-32rpx font-bold">
|
|
|
充电终端
|
|
|
</view>
|
|
|
- <view class="flex items-center">
|
|
|
+ <view class="flex items-center" @click="router.push({ name: 'charge-detail', params: { stationId: String(stationDetail?.stationId), type: 'terminal' } })">
|
|
|
<view class="text-24rpx text-#AAA">
|
|
|
查看全部
|
|
|
</view>
|
|
|
@@ -143,35 +213,41 @@ onPageScroll((e) => {
|
|
|
</view>
|
|
|
<view class="mt-28rpx flex items-center gap-20rpx">
|
|
|
<view
|
|
|
- v-for="option in filterOptions" :key="option.key"
|
|
|
- class="select-item h-60rpx w-152rpx text-28rpx line-height-[60rpx]" :class="[{ 'select-item-active': activeFilter === option.key },
|
|
|
- ]" @click="handleFilterClick(option.key)"
|
|
|
+ v-for="item in filterOptions" :key="item.key"
|
|
|
+ class="select-item h-60rpx w-152rpx text-28rpx line-height-[60rpx]" :class="[{ 'select-item-active': activeFilter === item.key }]" @click="handleFilterClick(item.key)"
|
|
|
>
|
|
|
- {{ option.label }}
|
|
|
+ {{ item.label }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="mt-24rpx">
|
|
|
- <view class="mb-20rpx flex items-center gap-20rpx rounded-16rpx bg-#F6F6F6 p-20rpx" @click="router.push({ name: 'charge-start' })">
|
|
|
+ <view v-for="item in filteredConnectors" :key="item.connectorId" class="mb-20rpx flex items-center gap-20rpx rounded-16rpx bg-#F6F6F6 p-20rpx" @click="router.push({ name: 'charge-start', params: { connectorCode: item.connectorCode } })">
|
|
|
<view
|
|
|
- class="h-116rpx w-116rpx text-center line-height-[116rpx]"
|
|
|
- :style="{ backgroundImage: `url(${StaticUrl}/site-status-kx.png)`, backgroundSize: 'cover', backgroundPosition: 'center' }"
|
|
|
+ class="h-116rpx w-116rpx text-center"
|
|
|
+ :style="{ backgroundImage: `url(${StaticUrl}/site-status-${getStatusImageByStatus(item.status)}.png)`, backgroundSize: 'cover', backgroundPosition: 'center' }"
|
|
|
>
|
|
|
+ <image
|
|
|
+ class="mt-20rpx h-38rpx w-27.18rpx"
|
|
|
+ :src="`${StaticUrl}/terminal-icon.png`"
|
|
|
+ />
|
|
|
<view class="text-24rpx font-bold">
|
|
|
- 空闲
|
|
|
+ {{ item?.statusName }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view>
|
|
|
<view class="text-bold text-28rpx">
|
|
|
- 101号直流充电桩
|
|
|
+ {{ item.connectorName }}
|
|
|
</view>
|
|
|
<view class="mt-4rpx text-24rpx text-#AAA">
|
|
|
- 电类分类:直流设备
|
|
|
+ 电类分类:{{ item.equipmentType }}
|
|
|
</view>
|
|
|
- <view class="mt-4rpx text-24rpx text-#AAA">
|
|
|
- 终端编号:52155648615
|
|
|
+ <view class="mt-4rpx w-300rpx overflow-hidden truncate whitespace-nowrap text-24rpx text-#AAA">
|
|
|
+ 终端编号:{{ item.connectorCode }}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view v-if="filteredConnectors.length < 1" class="h-100rpx w-full text-center text-24rpx text-#AAA line-height-[100rpx]">
|
|
|
+ 暂无终端信息
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -187,7 +263,7 @@ onPageScroll((e) => {
|
|
|
¥
|
|
|
</text>
|
|
|
<text class="text-bold text-40rpx text-#F5531A">
|
|
|
- 1.2099
|
|
|
+ {{ stationDetail?.currentPrice }}
|
|
|
</text>
|
|
|
<text class="text-24rpx text-#AAA">
|
|
|
元/度
|
|
|
@@ -209,7 +285,7 @@ onPageScroll((e) => {
|
|
|
}
|
|
|
|
|
|
.select-item {
|
|
|
- background: #FFFFFF;
|
|
|
+ background: #f5f3f3;
|
|
|
border-radius: 16rpx;
|
|
|
color: #2B303A;
|
|
|
text-align: center;
|