price-desc.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="dialog flex-align-end">
  3. <view class="desc-dialog">
  4. <view class="desc-dialog_head flex-center">
  5. <view class="fw-500 color-000" style="font-size: 16px"
  6. >充电费用说明</view
  7. >
  8. <view class="close" @click="close">
  9. <uni-icons type="closeempty" size="24" color="#2D284B"></uni-icons>
  10. </view>
  11. </view>
  12. <view class="desc-dialog_body">
  13. <view class="table">
  14. <view class="tr flex">
  15. <view class="th flex-center fs-28">时间</view>
  16. <view class="th flex-center flex-column">
  17. <view>电费</view>
  18. <view class="fs-24 lh-24" style="color: rgba(0, 0, 0, 0.5)"
  19. >(元/kwh)</view
  20. >
  21. </view>
  22. <view class="th flex-center flex-column">
  23. <view>服务费</view>
  24. <view class="fs-24 lh-24" style="color: rgba(0, 0, 0, 0.5)"
  25. >(元/kwh)</view
  26. >
  27. </view>
  28. </view>
  29. <view
  30. class="tr flex"
  31. v-for="(item, index) in _desc"
  32. :key="index"
  33. :style="{
  34. 'border-top': `1rpx solid ${
  35. index === 0 ? 'transparent' : '#E5E5E5'
  36. }`,
  37. }"
  38. >
  39. <view class="td flex-center">
  40. <text style="width: 158rpx; text-align: center">{{
  41. item.startTimeFormat
  42. }}</text>
  43. <text
  44. class="ml-16 width-38 height-38 br-round fs-24 flex-center"
  45. v-if="item.iconIndex >= 0"
  46. :style="{
  47. color: iconColor[item.iconIndex],
  48. backgroundColor: iconBgColor[item.iconIndex],
  49. }"
  50. >{{ item.pricePeriod }}</text
  51. ></view
  52. >
  53. <view class="td flex-center">{{ item.elecPrice }}</view>
  54. <view class="td flex-center">{{ item.servicePrice }}</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script lang="ts">
  62. import { defineComponent } from "vue";
  63. export default defineComponent({
  64. props: {
  65. desc: Array<any>,
  66. },
  67. data() {
  68. return {
  69. _desc: [],
  70. iconText: ["谷", "平", "峰", "尖"],
  71. iconBgColor: [
  72. "rgba(0, 218, 179, 0.20)",
  73. "rgba(52, 125, 255, 0.20)",
  74. "rgba(255, 153, 0, 0.20)",
  75. "rgba(255, 46, 0, 0.20)",
  76. ],
  77. iconColor: ["#00DAB3", "#347DFF", "#FF9900", "#FF2E00"],
  78. };
  79. },
  80. mounted() {
  81. console.log(this.desc);
  82. if (this.desc && this.desc.length) {
  83. this._desc = this.desc.map((item) => {
  84. return {
  85. ...item,
  86. iconIndex: this.iconText.findIndex(
  87. (text) => item.pricePeriod === text
  88. ),
  89. };
  90. });
  91. }
  92. },
  93. methods: {
  94. close() {
  95. this.$emit("close");
  96. },
  97. },
  98. });
  99. </script>
  100. <style lang="scss">
  101. @import "../../../styles/font.scss";
  102. @import "../../../styles/flex.scss";
  103. @import "../../../styles/layout.scss";
  104. @import "../../../styles/dialog.scss";
  105. .desc-dialog {
  106. background-color: transparent;
  107. width: 100%;
  108. overflow: hidden;
  109. border-radius: 20rpx 20rpx 0px 0px;
  110. &_head {
  111. padding: 24rpx 0px;
  112. position: relative;
  113. background-color: #fff;
  114. .close {
  115. position: absolute;
  116. right: 30rpx;
  117. top: 50%;
  118. transform: translateY(-50%);
  119. }
  120. }
  121. &_body {
  122. box-sizing: border-box;
  123. padding: 0rpx 30rpx 80rpx 30rpx;
  124. background-color: #fff;
  125. .table {
  126. border: 1rpx solid #e5e5e5;
  127. border-radius: 10rpx;
  128. overflow: hidden;
  129. }
  130. .tr {
  131. width: 100%;
  132. & > view:nth-child(1) {
  133. width: 254rpx;
  134. flex-shrink: 0;
  135. border-right: 1rpx solid #e5e5e5;
  136. }
  137. & > view:nth-child(2) {
  138. width: 200rpx;
  139. flex-shrink: 0;
  140. border-right: 1rpx solid #e5e5e5;
  141. }
  142. & > view:nth-child(3) {
  143. flex-grow: 1;
  144. }
  145. }
  146. .tr:nth-child(2n) {
  147. background-color: #fbfcff;
  148. }
  149. .th {
  150. border-bottom: 1rpx solid #e5e5e5;
  151. background-color: #f1f6ff;
  152. height: 92rpx;
  153. color: rgba(0, 0, 0, 0.7);
  154. font-size: 28rpx;
  155. view {
  156. color: rgba(0, 0, 0, 0.7);
  157. font-size: 28rpx;
  158. }
  159. }
  160. .td {
  161. color: #000;
  162. font-size: 26rpx;
  163. height: 76rpx;
  164. }
  165. }
  166. }
  167. </style>