Page({ data: { images: { background: '/static_file/background.png', water: '/static_file/water.png' }, userInfo: { name: '王源', id: '320185452454104', address: '徐州市丰县****楼102室' }, amount: 73.28, //应缴金额 actualAmount: 73.28, balance: 0, // 余额 quickAmounts: [10, 30, 50, 100, 200, 500], waterUsage: { lastReading: 2000, currentReading: 2050, nextReading: 3020, usage: 87 }, showKeyboard: false, selectedAmount: null, customAmount: '', inputFocus: false, billList: [ { date: '2025/01/30', billNumber: '250201100235', usage: '87m³', startReading: '2000', endReading: '2025', paymentTime: '2025/01/31 14:39', amount: '73.28', status: '未缴费' }, { date: '2024/12/30', billNumber: '2502011035211', usage: '121m³', startReading: '2000', endReading: '2025', paymentTime: '2025/01/03 09:51', amount: '127.28', status: '已缴费' }, { date: '2024/11/30', billNumber: '2502011035211', usage: '121m³', startReading: '2000', endReading: '2025', paymentTime: '2024/12/03 09:51', amount: '127.28', status: '已缴费' } ] }, onLoad() { // 确保图片资源正确加载 this.setData({ images: { background: '/static_file/background.png', water: '/static_file/water.png' } }); // 获取账单列表数据 this.getBillList(); }, // 返回上一页 goBack: function() { wx.navigateBack({ delta: 1 }); }, // 从接口获取账单列表数据 getBillList: function() { // 实际项目中,这里应该调用API获取数据 wx.showLoading({ title: '加载中', }); // 模拟API请求完成后隐藏加载提示 setTimeout(() => { wx.hideLoading(); }, 500); }, // 点击立即缴费按钮 payNow: function(e) { const index = e.currentTarget.dataset.index; const bill = this.data.billList[index]; wx.navigateTo({ url: '/pages/lijijiaofei/lijijiaofei?billNumber=' + bill.billNumber + '&amount=' + bill.amount }); }, // 点击开发票按钮 openInvoice: function(e) { const index = e.currentTarget.dataset.index; const bill = this.data.billList[index]; wx.showToast({ title: '开发票功能开发中', icon: 'none' }); }, // 切换到首页 goToHome: function() { wx.switchTab({ url: '/pages/homepage/homepage', }); }, // 切换到我的页面 goToMine: function() { wx.switchTab({ url: '/pages/mine/mine', }); }, navigateToHome() { wx.switchTab({ url: '/pages/index/index' }) }, navigateToMine() { wx.switchTab({ url: '/pages/mine/mine' }) } })