zhangdanlist.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. Page({
  2. data: {
  3. images: {
  4. background: '/static_file/background.png',
  5. water: '/static_file/water.png'
  6. },
  7. userInfo: {
  8. name: '王源',
  9. id: '320185452454104',
  10. address: '徐州市丰县****楼102室'
  11. },
  12. amount: 73.28, //应缴金额
  13. actualAmount: 73.28,
  14. balance: 0, // 余额
  15. quickAmounts: [10, 30, 50, 100, 200, 500],
  16. waterUsage: {
  17. lastReading: 2000,
  18. currentReading: 2050,
  19. nextReading: 3020,
  20. usage: 87
  21. },
  22. showKeyboard: false,
  23. selectedAmount: null,
  24. customAmount: '',
  25. inputFocus: false,
  26. billList: [
  27. {
  28. date: '2025/01/30',
  29. billNumber: '250201100235',
  30. usage: '87m³',
  31. startReading: '2000',
  32. endReading: '2025',
  33. paymentTime: '2025/01/31 14:39',
  34. amount: '73.28',
  35. status: '未缴费'
  36. },
  37. {
  38. date: '2024/12/30',
  39. billNumber: '2502011035211',
  40. usage: '121m³',
  41. startReading: '2000',
  42. endReading: '2025',
  43. paymentTime: '2025/01/03 09:51',
  44. amount: '127.28',
  45. status: '已缴费'
  46. },
  47. {
  48. date: '2024/11/30',
  49. billNumber: '2502011035211',
  50. usage: '121m³',
  51. startReading: '2000',
  52. endReading: '2025',
  53. paymentTime: '2024/12/03 09:51',
  54. amount: '127.28',
  55. status: '已缴费'
  56. }
  57. ]
  58. },
  59. onLoad() {
  60. // 确保图片资源正确加载
  61. this.setData({
  62. images: {
  63. background: '/static_file/background.png',
  64. water: '/static_file/water.png'
  65. }
  66. });
  67. // 获取账单列表数据
  68. this.getBillList();
  69. },
  70. // 返回上一页
  71. goBack: function() {
  72. wx.navigateBack({
  73. delta: 1
  74. });
  75. },
  76. // 从接口获取账单列表数据
  77. getBillList: function() {
  78. // 实际项目中,这里应该调用API获取数据
  79. wx.showLoading({
  80. title: '加载中',
  81. });
  82. // 模拟API请求完成后隐藏加载提示
  83. setTimeout(() => {
  84. wx.hideLoading();
  85. }, 500);
  86. },
  87. // 点击立即缴费按钮
  88. payNow: function(e) {
  89. const index = e.currentTarget.dataset.index;
  90. const bill = this.data.billList[index];
  91. wx.navigateTo({
  92. url: '/pages/lijijiaofei/lijijiaofei?billNumber=' + bill.billNumber + '&amount=' + bill.amount
  93. });
  94. },
  95. // 点击开发票按钮
  96. openInvoice: function(e) {
  97. const index = e.currentTarget.dataset.index;
  98. const bill = this.data.billList[index];
  99. wx.showToast({
  100. title: '开发票功能开发中',
  101. icon: 'none'
  102. });
  103. },
  104. // 切换到首页
  105. goToHome: function() {
  106. wx.switchTab({
  107. url: '/pages/homepage/homepage',
  108. });
  109. },
  110. // 切换到我的页面
  111. goToMine: function() {
  112. wx.switchTab({
  113. url: '/pages/mine/mine',
  114. });
  115. },
  116. navigateToHome() {
  117. wx.switchTab({
  118. url: '/pages/index/index'
  119. })
  120. },
  121. navigateToMine() {
  122. wx.switchTab({
  123. url: '/pages/mine/mine'
  124. })
  125. }
  126. })