调试水电费支付

This commit is contained in:
zhouyanli
2026-09-08 11:39:26 +08:00
parent 4fd383bce4
commit 72c968cb39
5 changed files with 38 additions and 20 deletions

View File

@@ -29,15 +29,15 @@
<view class="info-item">
<text class="info-label">户号</text>
<text class="info-value">{{ paymentItem.deviceCode || '-' }}</text>
<text class="info-value">{{ paymentItem.deviceCode}}</text>
</view>
<view class="info-item">
<text class="info-label">户主</text>
<text class="info-value">{{ paymentItem.name || '-' }}</text>
<text class="info-value">{{ paymentItem.name}}</text>
</view>
<view class="info-item">
<text class="info-label">地址</text>
<text class="info-value">{{ paymentItem.fullAddress || '-' }}</text>
<text class="info-value">{{ paymentItem.fullAddress}}</text>
</view>
<!-- <view style="border-bottom: 2rpx solid #c7c7c7;padding-bottom:20rpx;"></view> -->
<!-- 缴费金额输入 -->
@@ -107,6 +107,7 @@
onShow,
onLoad
} from '@dcloudio/uni-app'
import {getSelectByDeviceCode} from '@/pageSubPack/api/apiSub.js'
// 响应式数据
@@ -122,7 +123,9 @@
initPaymentData()
})
onShow(() => {})
onShow(() => {
getBalance()
})
// 初始化缴费数据
const initPaymentData = () => {
@@ -133,6 +136,25 @@
}
}
// 查询单条余额(水电费通用),从小程序返回后刷新
const getBalance = () => {
if (!paymentItem.deviceCode) return
const deviceTypeMap = { '电费': '1', '水费': '2' }
getSelectByDeviceCode({
deviceCode: paymentItem.deviceCode,
type: deviceTypeMap[paymentItem.type]
}).then(res => {
const data = res.data
if (data && data.balance !== undefined && data.balance !== null) {
arrearsAmount.value = Math.abs(data.balance || 0).toFixed(2)
payAmount.value = Math.abs(data.balance || 0)
outstandingPayment.value = data.balance < 0
}
}).catch(err => {
console.log('查询余额失败', err)
})
}
// 返回
const goBack = () => {
@@ -218,9 +240,7 @@
// 返回缴费列表
const handleBackToList = () => {
uni.redirectTo({
url: '/pageSubPack/payment-list/paymentIndex'
});
uni.navigateBack();
}
// 类型码转中文名展示