BatteryStatus.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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>预计 <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'],
  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. :last-child {
  92. color: white;
  93. padding-left: 10px;
  94. font-size: 14px;
  95. font-weight: 600;
  96. }
  97. }
  98. .percent {
  99. margin-top: 10px;
  100. display: flex;
  101. view:first-child {
  102. background-color: #181e2a;
  103. width: 90%;
  104. border-radius: 5px;
  105. height: 10px;
  106. text {
  107. color: white;
  108. font-weight: 600;
  109. font-size: 16px;
  110. position: relative;
  111. bottom: 5px;
  112. }
  113. }
  114. :last-child {
  115. position: relative;
  116. bottom: 4px;
  117. width: 30px;
  118. text-align: right;
  119. font-weight: 500;
  120. }
  121. }
  122. .line {
  123. display: flex;
  124. :first-child {
  125. width: 1%;
  126. background-color: white;
  127. height: 2px;
  128. }
  129. :last-child {
  130. height: 2px;
  131. width: 97%;
  132. background-color: #14172a;
  133. margin-left: 5px;
  134. }
  135. }
  136. .power {
  137. display: flex;
  138. flex-direction: column;
  139. margin-top: 10px;
  140. .power-percent {
  141. width: 100%;
  142. display: flex;
  143. text {
  144. background-color: #1e2535;
  145. height: 6px;
  146. width: 2px;
  147. margin-right: 1px;
  148. }
  149. }
  150. .power-text {
  151. display: flex;
  152. width: 100%;
  153. margin-top: 12px;
  154. justify-content: space-between;
  155. em {
  156. color: #87edab;
  157. font-weight: 500;
  158. font-style: normal;
  159. }
  160. }
  161. }
  162. </style>