|
|
@@ -1,13 +1,13 @@
|
|
|
<script setup lang="ts">
|
|
|
+import wlpProgress from '../components/wlp-progress-new/wlp-progress-new.vue'
|
|
|
import router from '@/router'
|
|
|
import { StaticUrl } from '@/config'
|
|
|
|
|
|
-const time = ref<number>(30 * 60 * 60 * 1000)
|
|
|
const stopCharge = ref(false)
|
|
|
const current = ref(0)
|
|
|
const isLongPressing = ref(false)
|
|
|
const longPressTimer = ref< NodeJS.Timeout>()
|
|
|
-const longPressDuration = 3000 // 3秒
|
|
|
+const longPressDuration = 2000 // 3秒
|
|
|
|
|
|
const { statusBarHeight, MenuButtonHeight, opcity } = storeToRefs(useSysStore())
|
|
|
definePage({
|
|
|
@@ -19,6 +19,7 @@ definePage({
|
|
|
},
|
|
|
})
|
|
|
onMounted(() => {
|
|
|
+ getChargeingCost()
|
|
|
opcity.value = 0
|
|
|
})
|
|
|
|
|
|
@@ -27,6 +28,16 @@ onPageScroll((e) => {
|
|
|
opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
|
|
|
})
|
|
|
|
|
|
+const chargeingDetail = ref<Api.chargeingCostList>()
|
|
|
+
|
|
|
+// const { pause } = useIntervalFn(async () => {
|
|
|
+// await getChargeingCost()
|
|
|
+// }, 5000)
|
|
|
+async function getChargeingCost() {
|
|
|
+ const res = await Apis.charge.chargeingCost({ data: { orderNo: '' } })
|
|
|
+ chargeingDetail.value = res.data
|
|
|
+}
|
|
|
+
|
|
|
function onTouchStart() {
|
|
|
isLongPressing.value = true
|
|
|
current.value = 0
|
|
|
@@ -37,11 +48,8 @@ function onTouchStart() {
|
|
|
current.value = Math.round(Math.min(100, (elapsed / longPressDuration) * 100))
|
|
|
if (elapsed >= longPressDuration) {
|
|
|
current.value = 100
|
|
|
- clearInterval(longPressTimer.value)
|
|
|
- // 执行停止充电逻辑,这里可以调用API或设置状态
|
|
|
console.log('停止充电')
|
|
|
- stopCharge.value = false // 关闭弹窗
|
|
|
- current.value = 0
|
|
|
+ initiatedStopCharge()
|
|
|
}
|
|
|
}
|
|
|
}, 50) // 减少频率到50ms,避免抖动
|
|
|
@@ -55,6 +63,25 @@ function onTouchEnd() {
|
|
|
clearInterval(longPressTimer.value)
|
|
|
}
|
|
|
|
|
|
+async function initiatedStopCharge() {
|
|
|
+ useGlobalLoading().loading({})
|
|
|
+ const res: any = await Apis.charge.stopCharge({ data: { chargeOrderNo: chargeingDetail.value?.chargeOrderNo } })
|
|
|
+ if (res.code === '00000') {
|
|
|
+ // pause()
|
|
|
+ clearInterval(longPressTimer.value)
|
|
|
+ useGlobalToast().success('停止充电成功')
|
|
|
+ stopCharge.value = false // 关闭弹窗
|
|
|
+ current.value = 0
|
|
|
+ router.push({ name: 'smqjh-order' })
|
|
|
+ }
|
|
|
+ useGlobalLoading().close()
|
|
|
+}
|
|
|
+
|
|
|
+function closeOverlay() {
|
|
|
+ stopCharge.value = false
|
|
|
+ current.value = 0
|
|
|
+}
|
|
|
+
|
|
|
onUnmounted(() => {
|
|
|
clearInterval(longPressTimer.value)
|
|
|
})
|
|
|
@@ -63,59 +90,34 @@ onUnmounted(() => {
|
|
|
<template>
|
|
|
<view class="chargeing-page min-h-screen bg-[linear-gradient(180deg,#F5FEDD_0%,#FCFFF3_22.46%,#FAFCFB_27.26%,#FBFDFC_45.2%,#FBFCFB_68.94%,#FBFCFB_100%)]">
|
|
|
<wd-navbar
|
|
|
- title="正在充电" :custom-style="`background-color: rgba(226, 255, 145, ${opcity})`" :bordered="false"
|
|
|
+ :title="!chargeingDetail ? '启动中' : '正在充电'" :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 :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }" />
|
|
|
- <!-- <view>
|
|
|
- <charge-loading />
|
|
|
+ <!-- <view v-if="!chargeingDetail">
|
|
|
+ <charge-loading />
|
|
|
</view> -->
|
|
|
- <view>
|
|
|
+ <view v-if="chargeingDetail?.status == '1'">
|
|
|
<view class="flex items-center justify-center">
|
|
|
- <l-progress-circle
|
|
|
- :percent="80" bg-color="#E1FF8E" dot-color="#9ED605" :progress-color="{
|
|
|
- type: 'radial',
|
|
|
- colors: [
|
|
|
- { offset: 0, color: '#9ED605' },
|
|
|
- { offset: 1, color: '#CCF35F' },
|
|
|
- ],
|
|
|
- }" width="300rpx" height="194rpx"
|
|
|
- >
|
|
|
- <view>
|
|
|
- <view class="flex items-center justify-center gap-8rpx">
|
|
|
- <text class="text-60rpx font-800">
|
|
|
- 80
|
|
|
- </text>
|
|
|
- <text class="text-28rpx">
|
|
|
- %
|
|
|
- </text>
|
|
|
- </view>
|
|
|
- <view>
|
|
|
- <text class="text-24rpx font-800">
|
|
|
- 充电枪正在
|
|
|
- </text>
|
|
|
- <text class="text-24rpx text-#9ED605 font-800">
|
|
|
- 充电中
|
|
|
- </text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </l-progress-circle>
|
|
|
+ <wlpProgress
|
|
|
+ :percent="75"
|
|
|
+ bg-color="#ebffb2"
|
|
|
+ progress-color="#CCF35F"
|
|
|
+ gradual-color="#9ED605"
|
|
|
+ title="充电枪正在充电中"
|
|
|
+ />
|
|
|
</view>
|
|
|
- <view class="h-486rpx w-648rpx">
|
|
|
+ <view class="h-320rpx w-750rpx">
|
|
|
<image
|
|
|
class="h-full w-full"
|
|
|
- :src="`${StaticUrl}/start-charge.png`"
|
|
|
+ :src="`${StaticUrl}/chargeing-in-progress.gif`"
|
|
|
/>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="mt-64rpx text-center">
|
|
|
- <wd-count-down :time="time">
|
|
|
- <template #default="{ current }">
|
|
|
- <text class="text-60rpx text-#9ED605 font-600">
|
|
|
- {{ current.hours }}:{{ current.minutes }}:{{ current.seconds }}
|
|
|
- </text>
|
|
|
- </template>
|
|
|
- </wd-count-down>
|
|
|
+ <view class="text-60rpx text-#9ED605 font-bold">
|
|
|
+ {{ chargeingDetail?.chargingDurationDesc || '00:00:00' }}
|
|
|
+ </view>
|
|
|
<view class="mt-16rpx text-32rpx font-bold">
|
|
|
充电时间
|
|
|
</view>
|
|
|
@@ -126,7 +128,11 @@ onUnmounted(() => {
|
|
|
电流
|
|
|
</view>
|
|
|
<view class="mt-20rpx">
|
|
|
+ <text v-if="chargeingDetail?.current" class="text-32rpx font-800">
|
|
|
+ {{ chargeingDetail?.current }}
|
|
|
+ </text>
|
|
|
<image
|
|
|
+ v-else
|
|
|
class="h-40rpx w-40rpx"
|
|
|
:src="`${StaticUrl}/charge-loading.png`"
|
|
|
/>
|
|
|
@@ -138,7 +144,11 @@ onUnmounted(() => {
|
|
|
功率KW
|
|
|
</view>
|
|
|
<view class="mt-20rpx">
|
|
|
+ <text v-if="chargeingDetail?.power" class="text-32rpx font-800">
|
|
|
+ {{ chargeingDetail?.power }}
|
|
|
+ </text>
|
|
|
<image
|
|
|
+ v-else
|
|
|
class="h-40rpx w-40rpx"
|
|
|
:src="`${StaticUrl}/charge-loading.png`"
|
|
|
/>
|
|
|
@@ -150,7 +160,11 @@ onUnmounted(() => {
|
|
|
电量/度
|
|
|
</view>
|
|
|
<view class="mt-20rpx">
|
|
|
+ <text v-if="chargeingDetail?.totalPower" class="text-32rpx font-800">
|
|
|
+ {{ chargeingDetail?.totalPower }}
|
|
|
+ </text>
|
|
|
<image
|
|
|
+ v-else
|
|
|
class="h-40rpx w-40rpx"
|
|
|
:src="`${StaticUrl}/charge-loading.png`"
|
|
|
/>
|
|
|
@@ -162,19 +176,21 @@ onUnmounted(() => {
|
|
|
费用/元
|
|
|
</view>
|
|
|
<view class="mt-20rpx">
|
|
|
- <!-- <image
|
|
|
+ <text v-if="chargeingDetail?.totalMoney" class="text-32rpx font-800">
|
|
|
+ {{ chargeingDetail?.totalMoney }}
|
|
|
+ </text>
|
|
|
+ <image
|
|
|
+ v-else
|
|
|
class="h-40rpx w-40rpx"
|
|
|
:src="`${StaticUrl}/charge-loading.png`"
|
|
|
- /> -->
|
|
|
- <text class="text-32rpx font-800">
|
|
|
- 0.14
|
|
|
- </text>
|
|
|
+ />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="mt-30rpx flex items-center justify-center">
|
|
|
<view class="h-76rpx w-192rpx rounded-16rpx bg-#9ED605 text-center text-28rpx text-#FFF font-800 line-height-[76rpx]" @click="stopCharge = true">
|
|
|
- 结束充电
|
|
|
+ <wd-loading v-if="!chargeingDetail" color="#FFF" :size="16" />
|
|
|
+ {{ !chargeingDetail ? '启动中' : '结束充电' }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="mt-56rpx box-border px24rpx">
|
|
|
@@ -183,7 +199,7 @@ onUnmounted(() => {
|
|
|
订单编号
|
|
|
</view>
|
|
|
<view class="text-28rpx text-#AAA">
|
|
|
- 46476465456464156486
|
|
|
+ {{ chargeingDetail?.chargeOrderNo || '--' }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="mt-28rpx flex items-center justify-between">
|
|
|
@@ -191,7 +207,7 @@ onUnmounted(() => {
|
|
|
终端编号
|
|
|
</view>
|
|
|
<view class="text-28rpx text-#AAA">
|
|
|
- 46476465456464156486
|
|
|
+ {{ chargeingDetail?.connectorCode || '--' }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="mt-28rpx flex items-center justify-between">
|
|
|
@@ -199,7 +215,7 @@ onUnmounted(() => {
|
|
|
充电电站
|
|
|
</view>
|
|
|
<view class="text-28rpx text-#AAA">
|
|
|
- 贵阳国际会展中心充电站
|
|
|
+ {{ chargeingDetail?.stationName || '--' }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="mt-28rpx flex items-center justify-between">
|
|
|
@@ -207,18 +223,22 @@ onUnmounted(() => {
|
|
|
充电终端
|
|
|
</view>
|
|
|
<view class="text-28rpx text-#AAA">
|
|
|
- 46476465456464156486
|
|
|
+ {{ chargeingDetail?.connectorName || '--' }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="mt-28rpx text-24rpx text-#AAA">
|
|
|
账单信息可能会有所延迟,具体以实际结算为准
|
|
|
</view>
|
|
|
</view>
|
|
|
- <wd-popup v-model="stopCharge" position="center" custom-style="border-radius:32rpx;background-color:rgba(255,255,255,0.1);">
|
|
|
- <view class="h-200rpx w-200rpx" @touchstart="onTouchStart" @touchend="onTouchEnd">
|
|
|
- <wd-circle v-model="current" color="#9ED605" text="长按停止" />
|
|
|
+ <wd-overlay :show="stopCharge" :z-index="9999" @click="closeOverlay">
|
|
|
+ <view class="h-full w-full flex items-center justify-center" @touchstart="onTouchStart" @touchend="onTouchEnd">
|
|
|
+ <wd-circle v-model="current" color="#9ED605" :stroke-width="20" :size="160" layer-color="#FFF">
|
|
|
+ <view class="text-center text-28rpx text-#FFF line-height-[290rpx]">
|
|
|
+ 长按停止充电
|
|
|
+ </view>
|
|
|
+ </wd-circle>
|
|
|
</view>
|
|
|
- </wd-popup>
|
|
|
+ </wd-overlay>
|
|
|
</view>
|
|
|
</template>
|
|
|
|