123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- 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,
- address: '',
- billList: []
- },
-
- onLoad: function(options) {
- // 确保图片资源正确加载
- this.setData({
- images: {
- background: '/static_file/background.png',
- water: '/static_file/water.png'
- }
- });
-
- // 获取地址信息
- if (options.address) {
- this.setData({
- address: options.address
- });
- }
-
- // 获取账单列表
- this.getBillList();
- },
-
- // 返回上一页
- goBack: function() {
- wx.navigateBack({
- delta: 1
- });
- },
-
- // 从接口获取账单列表数据
- getBillList: function() {
- // 这里应该是从API获取数据,这里用模拟数据
- const mockData = [
- {
- billDate: '2025/01/30',
- billNumber: '250201100235',
- amount: '73.28',
- usage: '87',
- meterReading: '2000-2025',
- paymentTime: '2025/01/31 14:39',
- isPaid: false,
- currentDate: '2025/01/30',
- currentReading: '2025',
- lastDate: '2024/12/30',
- lastReading: '2000',
- totalAmount: '85.62',
- discount: '12.34',
- lateFee: '0',
- payableAmount: '73.28'
- },
- {
- billDate: '2024/12/30',
- billNumber: '250201103521',
- amount: '127.28',
- usage: '121',
- meterReading: '2000-2025',
- paymentTime: '2025/01/03 09:51',
- isPaid: true,
- currentDate: '2024/12/30',
- currentReading: '2000',
- lastDate: '2024/11/30',
- lastReading: '1975',
- totalAmount: '137.28',
- discount: '10.00',
- lateFee: '0',
- payableAmount: '127.28'
- },
- {
- billDate: '2024/11/30',
- billNumber: '250201103521',
- amount: '127.28',
- usage: '121',
- meterReading: '2000-2025',
- paymentTime: '2024/12/03 09:51',
- isPaid: true,
- currentDate: '2024/11/30',
- currentReading: '1975',
- lastDate: '2024/10/31',
- lastReading: '1950',
- totalAmount: '137.28',
- discount: '10.00',
- lateFee: '0',
- payableAmount: '127.28'
- },
- {
- billDate: '2024/11/30',
- billNumber: '250201103521',
- amount: '127.28',
- usage: '121',
- meterReading: '2000-2025',
- paymentTime: '2024/12/03 09:51',
- isPaid: true,
- currentDate: '2024/11/30',
- currentReading: '1950',
- lastDate: '2024/10/31',
- lastReading: '1925',
- totalAmount: '137.28',
- discount: '10.00',
- lateFee: '0',
- payableAmount: '127.28'
- },
- {
- billDate: '2024/11/30',
- billNumber: '250201103521',
- amount: '127.28',
- usage: '121',
- meterReading: '2000-2025',
- paymentTime: '2024/12/03 09:51',
- isPaid: true,
- currentDate: '2024/11/30',
- currentReading: '1925',
- lastDate: '2024/10/31',
- lastReading: '1900',
- totalAmount: '137.28',
- discount: '10.00',
- lateFee: '0',
- payableAmount: '127.28'
- },
- {
- billDate: '2024/11/30',
- billNumber: '250201103521',
- amount: '127.28',
- usage: '121',
- meterReading: '2000-2025',
- paymentTime: '2024/12/03 09:51',
- isPaid: true,
- currentDate: '2024/11/30',
- currentReading: '1900',
- lastDate: '2024/10/31',
- lastReading: '1875',
- totalAmount: '137.28',
- discount: '10.00',
- lateFee: '0',
- payableAmount: '127.28'
- }
- ];
-
- this.setData({
- billList: mockData
- });
- },
-
- // 点击开发票按钮
- 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'
- })
- },
- // 跳转到账单详情页面
- goToBillDetail: function(e) {
- const bill = e.currentTarget.dataset.bill;
- wx.navigateTo({
- url: '/pages/zhangdanxiangqing/zdxiangqing?billInfo=' + JSON.stringify(bill)
- });
- },
-
- // 获取发票
- getInvoice: function(e) {
- // 阻止事件冒泡,避免触发goToBillDetail
- e.stopPropagation();
- const bill = e.currentTarget.dataset.bill;
- wx.navigateTo({
- url: '/pages/invoice/invoice?billInfo=' + JSON.stringify(bill)
- });
- }
- })
|