From 93de43267e1663031fe5dc2f5ae40d128a182a76 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 18 六月 2026 17:24:51 +0800
Subject: [PATCH] 新增智能电表、空调管理

---
 h5/pages/customer/conditioner/recharge.vue |   39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/h5/pages/customer/conditioner/recharge.vue b/h5/pages/customer/conditioner/recharge.vue
index 9c06412..9b3bea9 100644
--- a/h5/pages/customer/conditioner/recharge.vue
+++ b/h5/pages/customer/conditioner/recharge.vue
@@ -1,14 +1,10 @@
 <template>
-  <view class="cu-page cu-page--with-footer">
-    <view class="cu-device-summary" v-if="device">
-      <view class="cu-row cu-row--between">
-        <text class="cu-name">{{ device.deviceName }}</text>
-        <text class="cu-status cu-status--ok">{{ device.statusText }}</text>
-      </view>
-      <view class="cu-line">鎴块棿锛歿{ device.roomInfo }}</view>
+  <view class="cu-page cu-page--with-footer cu-page--with-fab">
+    <view class="cu-device-summary">
+      <view class="cu-device-summary__title">鍟嗘埛绌鸿皟缁熶竴璐︽埛</view>
       <view class="cu-device-summary__balance">
-        <view class="cu-device-summary__balance-label">褰撳墠璐︽埛浣欓</view>
-        <view class="cu-device-summary__balance-value">{{ device.balance }}</view>
+        <view class="cu-device-summary__balance-label">褰撳墠绌鸿皟鐢佃垂浣欓</view>
+        <view :class="['cu-device-summary__balance-value', balanceTone ? 'cu-device-summary__balance-value--' + balanceTone : '']">{{ balanceText }}</view>
       </view>
     </view>
 
@@ -35,26 +31,41 @@
     <view class="cu-page-footer">
       <view class="cu-btn cu-btn--primary" @click="submit">纭鍏呭�納{ amount ? ' 楼' + amount : '' }}</view>
     </view>
+    <cu-workbench-fab />
   </view>
 </template>
 
 <script>
-import { customerDeviceDetail, customerPayCreate } from '@/api'
+import { customerHome, customerPayCreate } from '@/api'
 import { invokeWxPay } from '@/utils/wxpay.js'
+import { getBalanceTone } from '@/utils/utils.js'
+
 export default {
   data () {
     return {
-      deviceId: null,
-      device: null,
+      gsBalance: null,
       amount: '',
       remark: '',
       quickAmounts: [50, 100, 200, 500]
     }
   },
-  onLoad (q) { this.deviceId = q.id; this.load() },
+  computed: {
+    balanceText () {
+      if (this.gsBalance === null || this.gsBalance === undefined || this.gsBalance === '') return '-'
+      const n = Number(this.gsBalance)
+      return Number.isNaN(n) ? this.gsBalance : n.toFixed(2)
+    },
+    balanceTone () {
+      return getBalanceTone(this.gsBalance)
+    }
+  },
+  onShow () { this.load() },
   methods: {
     load () {
-      customerDeviceDetail({ deviceType: 1, deviceId: this.deviceId }).then(res => { this.device = res.data })
+      customerHome().then(res => {
+        const gs = res.data && res.data.gsConfig
+        this.gsBalance = gs ? gs.leftMoney : null
+      })
     },
     submit () {
       if (!this.amount) return uni.showToast({ title: '璇疯緭鍏ラ噾棰�', icon: 'none' })

--
Gitblit v1.9.3