对接生活缴费支付

This commit is contained in:
zhouyanli
2026-09-07 14:27:32 +08:00
parent 1efccef465
commit 4fd383bce4
5 changed files with 25 additions and 7 deletions

View File

@@ -70,7 +70,7 @@
<script setup>
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { onLoad, onShow, onPullDownRefresh } from '@dcloudio/uni-app'
import { getTopUpDetailsByMonth } from '/pageSubPack/api/apiSub.js'
const loading = ref(false)
@@ -85,10 +85,26 @@ const loadingMore = ref(false)
const cacheItem = uni.getStorageSync('arrearsPayment') || {}
const billResidentId = ref(cacheItem.billResidentId || cacheItem.id || '')
const isFirstShow = ref(true)
onLoad(() => {
fetchBills()
})
onShow(() => {
// 首次进入由 onLoad 拉取,避免重复请求
if (isFirstShow.value) {
isFirstShow.value = false
return
}
// 返回列表时刷新(例如从支付小程序返回后)
fetchBills()
})
onPullDownRefresh(() => {
fetchBills()
})
// 拉取按月汇总账单
const fetchBills = async (isLoadMore = false) => {
if (!billResidentId.value) return
@@ -144,6 +160,7 @@ const fetchBills = async (isLoadMore = false) => {
} finally {
loading.value = false
loadingMore.value = false
uni.stopPullDownRefresh()
}
}