charge-machine.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view
  3. :class="['charge-point', 'flex-align-center', 'mt-20', 'pressable']"
  4. hover-class="pressed"
  5. hover-stay-time="80"
  6. v-for="(item, index) in list"
  7. :key="index"
  8. @click="toOrdering(index)"
  9. >
  10. <view
  11. :class="[
  12. 'charge-point_icon',
  13. 'flex-center',
  14. `charge-point_icon-${item.status}`,
  15. ]"
  16. >
  17. <image
  18. class="width-28"
  19. src="../../static/charge-status-icon.png"
  20. mode="widthFix"
  21. ></image>
  22. </view>
  23. <view class="charge-point_title ml-16">
  24. <view class="flex-align-center">
  25. <view class="fs-32 fw-600 color-000 lh-32">{{ title }}</view>
  26. <view
  27. :class="[
  28. 'tag',
  29. 'fs-24',
  30. 'flex-center',
  31. 'ml-8',
  32. `tag-${item.status}`,
  33. ]"
  34. >{{ (statusMap as any)[item.status] }}</view
  35. >
  36. </view>
  37. <view class="mt-10 flex-align-center">
  38. <view class="fs-24 color-666"
  39. >{{ item.connectorType === 1 ? "直流" : "交流"
  40. }}{{ item.power }}kw</view
  41. >
  42. <view class="fs-24 color-666 mr-6 ml-6">|</view>
  43. <view class="fs-24 color-666">车位号{{ parkingNo }}</view>
  44. </view>
  45. </view>
  46. <view class="ml-auto" v-if="price">
  47. <view
  48. class="lh-32 color-warning flex-end "
  49. style="text-align: right; margin-top: -8rpx"
  50. >
  51. <text class="fs-22 mr-4">¥</text>
  52. <text class="fs-32">{{ price }}</text>
  53. <text class="fs-22 ml-4" style="vertical-align: text-top">元</text>
  54. </view>
  55. <view class="fs-24 lh-24 color-999 mt-10">当前时段</view>
  56. </view>
  57. <view class="ml-auto height-60 flex-align-end" v-if="time">
  58. <view class="fs-24 lh-24 color-999">{{ time }}</view>
  59. </view>
  60. </view>
  61. </template>
  62. <script lang="ts">
  63. export default {
  64. props: {
  65. title: String,
  66. price: [String, Number],
  67. time: String,
  68. list: Array<any>,
  69. parkingNo: String,
  70. },
  71. data() {
  72. return {
  73. statusMap: {
  74. 255: "故障",
  75. 0: "离网",
  76. 1: "空闲",
  77. 2: "占用中",
  78. 3: "充电中",
  79. 4: "已预约",
  80. },
  81. };
  82. },
  83. methods: {
  84. toOrdering(index: number) {
  85. const { list } = this;
  86. if (
  87. list &&
  88. list[index] &&
  89. list[index].status &&
  90. (list[index].status === 1 ||
  91. list[index].status === 2)
  92. ) {
  93. uni.showActionSheet({
  94. itemList: ["去充电"],
  95. success: (res) => {
  96. if (res.tapIndex === 0) {
  97. uni.navigateTo({
  98. url: `/pages-charge/appointment/appointment?connectorId=${list[index].connectorId}&sn=${list[index].shortId}&stationId=${list[index].stationId}`,
  99. });
  100. }
  101. },
  102. });
  103. }
  104. },
  105. },
  106. };
  107. </script>
  108. <style lang="scss">
  109. @use "../../../styles/layout.scss";
  110. @use "../../../styles/font.scss";
  111. @use "../../../styles/flex.scss";
  112. .charge-point {
  113. background-color: #fff;
  114. border-radius: 20rpx;
  115. overflow: hidden;
  116. padding: 30rpx;
  117. &_icon {
  118. height: 56rpx;
  119. width: 56rpx;
  120. border-radius: 50%;
  121. &-255 {
  122. background: var(--color-error);
  123. }
  124. &-0 {
  125. background-color: #b7c2c0;
  126. }
  127. &-1 {
  128. background: var(--color-primary);
  129. }
  130. &-2,
  131. &-3,
  132. &-4 {
  133. background: #9daaa8;
  134. }
  135. }
  136. .tag {
  137. height: 38rpx;
  138. padding: 0rpx 10rpx;
  139. box-sizing: border-box;
  140. border-radius: 12rpx;
  141. font-size: 24rpx;
  142. }
  143. .tag-255 {
  144. color: var(--color-error);
  145. background: rgba(244, 54, 54, 0.08);
  146. }
  147. .tag-0 {
  148. color: #8c9997;
  149. background: rgba(28, 43, 41, 0.06);
  150. }
  151. .tag-1 {
  152. color: var(--color-primary);
  153. background: var(--color-primary-tint);
  154. }
  155. .tag-2,
  156. .tag-3,
  157. .tag-4 {
  158. color: #8c9997;
  159. background: rgba(28, 43, 41, 0.06);
  160. }
  161. }
  162. </style>