BatteryStatus.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view>
  3. <!-- <view class="communication">
  4. <view><image class="cangwei" src="../../../static/equipment/cangwei.png" /><text class="storeCode_num">{{storeCode}}号仓位</text></view>
  5. </view> -->
  6. <view class="battery-number">
  7. <text>电池编号</text><text>{{sn ||'-'}}</text>
  8. </view>
  9. <view class="percent">
  10. <view><text>{{soc}}</text></view>
  11. <view>%</view>
  12. </view>
  13. <view class="line"><text></text><text></text></view>
  14. <view class="power">
  15. <view class="power-percent">
  16. <text v-for="item in 100" :key="item" :style="{'backgroundColor': soc >= item ? setcolor :''}"></text>
  17. </view>
  18. <view class="power-text">
  19. <text>电池电量</text>
  20. <text v-if="showCode ==0">预计 <em>{{chgEstimatedTime}}</em> 分钟后充满</text>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: "BatteryStatus",
  28. props:['storeCode','comState','sn','chgEstimatedTime','soc','showCode'],
  29. computed:{
  30. setcolor(){
  31. if(this.soc<=30 && this.soc > 0){
  32. return '#ce4545'
  33. }else if(this.soc > 30 && this.soc <= 70){
  34. return '#f8dc4b'
  35. }else if(this.soc > 70){
  36. return '#44ab41'
  37. }
  38. }
  39. }
  40. };
  41. </script>
  42. <style lang="scss" scoped>
  43. .communication {
  44. display: flex;
  45. justify-content: space-between;
  46. .cangwei{
  47. width: 20px;
  48. height: 20px;
  49. vertical-align: middle;
  50. margin-right: 5px;
  51. margin-top: -2px;
  52. }
  53. view {
  54. line-height: 32px;
  55. font-size: 16px;
  56. font-weight: 600;
  57. height: 32px;
  58. text-align: center;
  59. }
  60. view:first-child {
  61. background-color: #1b263a;
  62. border: #25334d solid 1px;
  63. color: white;
  64. line-height: 32px;
  65. text-align: left;
  66. padding: 0 10px 0 5px;
  67. // .image {
  68. // vertical-align: middle;
  69. // }
  70. }
  71. }
  72. .battery-number {
  73. margin-top: 10px;
  74. display: flex;
  75. color: #414A63;
  76. text:last-child {
  77. color: white;
  78. padding-right: 10px;
  79. font-size: 14px;
  80. font-weight: 600;
  81. margin-left: 10px;
  82. }
  83. }
  84. .percent {
  85. margin-top: 10px;
  86. display: flex;
  87. view:first-child {
  88. background-color: #181e2a;
  89. width: 90%;
  90. border-radius: 5px;
  91. height: 10px;
  92. text {
  93. color: white;
  94. font-weight: 600;
  95. font-size: 16px;
  96. position: relative;
  97. bottom: 5px;
  98. }
  99. }
  100. :last-child {
  101. position: relative;
  102. bottom: 4px;
  103. width: 30px;
  104. text-align: right;
  105. font-weight: 500;
  106. }
  107. }
  108. .line {
  109. display: flex;
  110. :first-child {
  111. width: 1%;
  112. background-color: white;
  113. height: 2px;
  114. }
  115. :last-child {
  116. height: 2px;
  117. width: 97%;
  118. background-color: #14172a;
  119. margin-left: 5px;
  120. }
  121. }
  122. .power {
  123. display: flex;
  124. flex-direction: column;
  125. margin-top: 10px;
  126. .power-percent {
  127. width: 100%;
  128. display: flex;
  129. text {
  130. background-color: #1e2535;
  131. height: 6px;
  132. width: 2px;
  133. margin-right: 1px;
  134. }
  135. }
  136. .power-text {
  137. display: flex;
  138. width: 100%;
  139. margin-top: 12px;
  140. justify-content: space-between;
  141. em {
  142. color: #87edab;
  143. font-weight: 500;
  144. font-style: normal;
  145. }
  146. }
  147. }
  148. </style>