BatteryStatus.vue 4.8 KB

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