BatteryStatus.vue 3.9 KB

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