charge-machine.vue 3.7 KB

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