chargeStart.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <script setup lang="ts">
  2. import router from '@/router'
  3. import { StaticUrl } from '@/config'
  4. const { statusBarHeight, MenuButtonHeight, opcity } = storeToRefs(useSysStore())
  5. const { userInfo } = storeToRefs(useUserStore())
  6. definePage({
  7. name: 'charge-start',
  8. islogin: true,
  9. style: {
  10. navigationBarTitleText: '启动终端',
  11. navigationStyle: 'custom',
  12. },
  13. })
  14. const connectorCode = ref()
  15. onLoad((options: any) => {
  16. connectorCode.value = options.connectorCode
  17. })
  18. onMounted(() => {
  19. opcity.value = 0
  20. getConnectorDetail()
  21. })
  22. onPageScroll((e) => {
  23. const calculatedOpacity = e.scrollTop / 100
  24. opcity.value = Math.min(1, Math.max(0.1, calculatedOpacity))
  25. })
  26. const connectorDetailInfo = ref<Api.chargeConnectorDetail>()
  27. async function getConnectorDetail() {
  28. const res = await Apis.charge.connectorDetail({ data: { connectorCode: connectorCode.value } })
  29. connectorDetailInfo.value = res.data
  30. }
  31. const fromData = ref<Api.invokeChargeList>({
  32. equipmentId: 0,
  33. stationId: 0,
  34. connectorId: '',
  35. consigneeName: userInfo.value?.nickName,
  36. consigneeMobile: userInfo.value?.mobile,
  37. })
  38. async function launchCharge() {
  39. // router.push({ name: 'chargeing' })
  40. // return
  41. fromData.value.equipmentId = connectorDetailInfo.value?.equipmentId
  42. fromData.value.stationId = connectorDetailInfo.value?.stationId
  43. fromData.value.connectorId = connectorDetailInfo.value?.connectorCode
  44. const res = await Apis.charge.invokeCharge({ data: fromData.value })
  45. if (res.code === '00000') {
  46. router.push({ name: 'chargeing', params: { orderNo: res.data } })
  47. }
  48. }
  49. </script>
  50. <template>
  51. <view class="charge-start-page min-h-screen bg-[linear-gradient(180deg,#F5FEDD_0%,#FCFFF3_22.46%,#FAFCFB_27.26%,#FBFDFC_45.2%,#FBFCFB_68.94%,#FBFCFB_100%)]">
  52. <wd-navbar
  53. title="启动终端" :custom-style="`background-color: rgba(226, 255, 145, ${opcity})`" :bordered="false"
  54. :z-index="999" safe-area-inset-top left-arrow fixed @click-left="router.back()"
  55. />
  56. <view :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }" />
  57. <view>
  58. <view class="h-486rpx w-648rpx">
  59. <image
  60. class="h-full w-full"
  61. :src="`${StaticUrl}/start-charge.png`"
  62. />
  63. </view>
  64. <view class="mt-94rpx flex items-center justify-center">
  65. <view class="w-182rpx text-center">
  66. <view class="text-28rpx text-#AAA">
  67. 电流A
  68. </view>
  69. <view class="mt-24rpx text-32rpx font-800">
  70. {{ connectorDetailInfo?.current }}
  71. </view>
  72. </view>
  73. <view class="h-40rpx w-2rpx bg-#DEDEDE" />
  74. <view class="w-182rpx text-center">
  75. <view class="text-28rpx text-#AAA">
  76. 电压V
  77. </view>
  78. <view class="mt-24rpx text-32rpx font-800">
  79. {{ connectorDetailInfo?.currentVoltage || '0' }}
  80. </view>
  81. </view>
  82. <view class="h-40rpx w-2rpx bg-#DEDEDE" />
  83. <view class="w-182rpx text-center">
  84. <view class="text-28rpx text-#AAA">
  85. 功率KW
  86. </view>
  87. <view class="mt-24rpx text-32rpx font-800">
  88. {{ connectorDetailInfo?.power }}
  89. </view>
  90. </view>
  91. </view>
  92. <view class="mt-40rpx px24rpx">
  93. <view class="flex items-center justify-between">
  94. <view class="text-28rpx font-bold">
  95. 当前电价
  96. </view>
  97. <view class="flex items-center">
  98. <text class="text-30rpx text-#FC5A5A font-bold">
  99. {{ connectorDetailInfo?.currentPrice }}元
  100. </text>
  101. <text class="text-28rpx text-#AAA">
  102. /度
  103. </text>
  104. </view>
  105. </view>
  106. <view class="mt-20rpx flex items-center justify-between">
  107. <view class="text-28rpx font-bold">
  108. 当前时段
  109. </view>
  110. <view class="text-28rpx text-#AAA">
  111. {{ connectorDetailInfo?.currentPeriodDesc }}
  112. </view>
  113. </view>
  114. <view class="mt-20rpx flex items-center justify-between">
  115. <view class="text-28rpx font-bold">
  116. 停车参考
  117. </view>
  118. <view class="text-28rpx text-#AAA">
  119. {{ connectorDetailInfo?.parkingTips || '--' }}
  120. </view>
  121. </view>
  122. <view class="mt-28rpx text-24rpx text-#AAA">
  123. 账单信息可能会有所延迟,具体以实际结算为准
  124. </view>
  125. </view>
  126. </view>
  127. <view class="fixed bottom-66rpx left-24rpx h-100rpx w-702rpx rounded-16rpx bg-[linear-gradient(90deg,#DBFC81_0%,#9ED605_100%)] text-center text-28rpx font-800 line-height-[100rpx] shadow-[inset_0rpx_6rpx_20rpx_2rpx_#FFFFFF]" @click="launchCharge">
  128. 启动终端充电
  129. </view>
  130. </view>
  131. </template>
  132. <style lang="scss" scoped></style>