cellDetail.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view>
  3. <view>
  4. <view class="item ddflex">
  5. <view class="label">所属门店</view>
  6. <view class="item-input fflex ddflex">
  7. <view>{{info.storeName}}</view>
  8. <!-- <view class="state">在线</view> -->
  9. </view>
  10. </view>
  11. <view class="item ddflex">
  12. <!-- <view class="label">机柜名称</view> -->
  13. <view class="label">设备名称</view>
  14. <view class="item-input fflex">
  15. {{info.name}}
  16. </view>
  17. </view>
  18. <view class="item ddflex">
  19. <view class="label">电池编号</view>
  20. <view class="item-input fflex">
  21. {{info.batteryId}}
  22. </view>
  23. </view>
  24. <!-- <view class="item ddflex">
  25. <view class="label">租赁用户</view>
  26. <view class="item-input fflex">
  27. 王鸿 15700317367
  28. </view>
  29. </view> -->
  30. <!-- <view class="item ddflex">
  31. <view class="label">品牌</view>
  32. <view class="item-input fflex">
  33. 乐享换电
  34. </view>
  35. </view> -->
  36. <view class="item ddflex">
  37. <view class="label">型号</view>
  38. <view class="item-input fflex">
  39. {{info.model}}
  40. </view>
  41. </view>
  42. <view class="item ddflex">
  43. <view class="label">设备类型</view>
  44. <view class="item-input fflex">
  45. {{info.macName}}
  46. </view>
  47. </view>
  48. <view class="item ddflex">
  49. <view class="label">电芯</view>
  50. <view class="item-input fflex">
  51. {{info.type}}
  52. </view>
  53. </view>
  54. <!-- <view class="item ddflex">
  55. <view class="label">BMS保护板</view>
  56. <view class="item-input fflex">
  57. V1.2
  58. </view>
  59. </view> -->
  60. <!-- <view class="item ddflex">
  61. <view class="label">软件版本</view>
  62. <view class="item-input fflex">
  63. 百维
  64. </view>
  65. </view> -->
  66. <view class="item ddflex">
  67. <view class="label">押金</view>
  68. <view class="item-input fflex">
  69. {{info.deposit}}
  70. </view>
  71. </view>
  72. <view class="item ddflex">
  73. <view class="label">单价</view>
  74. <view class="item-input fflex">
  75. {{info.price}}
  76. </view>
  77. </view>
  78. <!-- <view class="item ddflex">
  79. <view class="label">起租时间</view>
  80. <view class="item-input fflex">
  81. 2022-07-0314:07:15
  82. </view>
  83. </view> -->
  84. <view class="item ddflex">
  85. <view class="label">到期时间</view>
  86. <view class="item-input fflex">
  87. {{info.blockDate}}
  88. </view>
  89. </view>
  90. <!-- <view class="item ddflex">
  91. <view class="label">备注</view>
  92. <view class="item-input fflex">
  93. 2.18更换新品头
  94. </view>
  95. </view> -->
  96. </view>
  97. <!-- 保存按钮 -->
  98. <view style="height: 165rpx;" class="savepadding"></view>
  99. <view class="bottom-btns savepadding">
  100. <view class="ddflex" style="margin: 30rpx;justify-content: space-between;">
  101. <view class="btn1 fflex" @click="switchChange(!DHON)">{{DHON?'断电':'通电'}}</view>
  102. <!-- <view class="btn1" @click="jumpUrl('/machineAndCell/machineDetail/machineDetail')">通电</view>
  103. <view class="btn2">解绑</view>
  104. <view class="btn3">保存</view> -->
  105. </view>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. const app = getApp();
  111. const req = require("../../utils/request.js");
  112. export default {
  113. components: {
  114. },
  115. props: {},
  116. data() {
  117. return {
  118. id:null,
  119. info:{},
  120. DHON:false
  121. }
  122. },
  123. onLoad(options) {
  124. this.id = options.id
  125. this.getData()
  126. },
  127. onShow() {
  128. },
  129. methods: {
  130. jumpUrl(url) {
  131. if (req.isLogins(true)) {
  132. uni.navigateTo({
  133. url: url
  134. })
  135. }
  136. },
  137. getData(){
  138. uni.showLoading({
  139. title:'加载中'
  140. })
  141. req.getRequest('/admin/v2/battery/'+this.id,{},res=>{
  142. this.info = res
  143. uni.hideLoading()
  144. })
  145. req.getRequest('/admin/v2/battery/bmsData',{batteryId:this.id},res=>{
  146. this.DHON = JSON.parse(res[0].Seting).DHON==1?true:false
  147. })
  148. },
  149. switchChange(value){
  150. uni.showModal({
  151. title:'提示',
  152. content:value?'确定开启放电开关?':'确定关闭放电开关?',
  153. success: (r) => {
  154. if(r.confirm){
  155. uni.showLoading({
  156. title:value?'开启中':'关闭中',
  157. })
  158. req.postRequest('/admin/v2/battery/bmsSend',{batteryId:this.id,type:value},res=>{
  159. uni.hideLoading()
  160. if(res){
  161. // req.msg(event.detail.value?'开启成功':'关闭成功')
  162. uni.showModal({
  163. title:'提示',
  164. content:'操作成功,该操作会有延迟,请稍候查看最新状态',
  165. showCancel:false,
  166. success:() =>{
  167. this.DHON = value
  168. this.getData()
  169. }
  170. })
  171. }else {
  172. req.msg(value?'开启失败':'关闭失败')
  173. }
  174. })
  175. }else{
  176. }
  177. }
  178. })
  179. },
  180. },
  181. mounted() {
  182. },
  183. onPageScroll: function(e) {
  184. }
  185. }
  186. </script>
  187. <style>
  188. @import "./cellDetail.css";
  189. </style>