zhangdanlist.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. address: '',
  27. billList: []
  28. },
  29. onLoad: function(options) {
  30. // 确保图片资源正确加载
  31. this.setData({
  32. images: {
  33. background: '/static_file/background.png',
  34. water: '/static_file/water.png'
  35. }
  36. });
  37. // 获取地址信息
  38. if (options.address) {
  39. this.setData({
  40. address: options.address
  41. });
  42. }
  43. // 获取账单列表
  44. this.getBillList();
  45. },
  46. // 返回上一页
  47. goBack: function() {
  48. wx.navigateBack({
  49. delta: 1
  50. });
  51. },
  52. // 从接口获取账单列表数据
  53. getBillList: function() {
  54. // 这里应该是从API获取数据,这里用模拟数据
  55. const mockData = [
  56. {
  57. billDate: '2025/01/30',
  58. billNumber: '250201100235',
  59. amount: '73.28',
  60. usage: '87',
  61. meterReading: '2000-2025',
  62. paymentTime: '2025/01/31 14:39',
  63. isPaid: false,
  64. currentDate: '2025/01/30',
  65. currentReading: '2025',
  66. lastDate: '2024/12/30',
  67. lastReading: '2000',
  68. totalAmount: '85.62',
  69. discount: '12.34',
  70. lateFee: '0',
  71. payableAmount: '73.28'
  72. },
  73. {
  74. billDate: '2024/12/30',
  75. billNumber: '250201103521',
  76. amount: '127.28',
  77. usage: '121',
  78. meterReading: '2000-2025',
  79. paymentTime: '2025/01/03 09:51',
  80. isPaid: true,
  81. currentDate: '2024/12/30',
  82. currentReading: '2000',
  83. lastDate: '2024/11/30',
  84. lastReading: '1975',
  85. totalAmount: '137.28',
  86. discount: '10.00',
  87. lateFee: '0',
  88. payableAmount: '127.28'
  89. },
  90. {
  91. billDate: '2024/11/30',
  92. billNumber: '250201103521',
  93. amount: '127.28',
  94. usage: '121',
  95. meterReading: '2000-2025',
  96. paymentTime: '2024/12/03 09:51',
  97. isPaid: true,
  98. currentDate: '2024/11/30',
  99. currentReading: '1975',
  100. lastDate: '2024/10/31',
  101. lastReading: '1950',
  102. totalAmount: '137.28',
  103. discount: '10.00',
  104. lateFee: '0',
  105. payableAmount: '127.28'
  106. },
  107. {
  108. billDate: '2024/11/30',
  109. billNumber: '250201103521',
  110. amount: '127.28',
  111. usage: '121',
  112. meterReading: '2000-2025',
  113. paymentTime: '2024/12/03 09:51',
  114. isPaid: true,
  115. currentDate: '2024/11/30',
  116. currentReading: '1950',
  117. lastDate: '2024/10/31',
  118. lastReading: '1925',
  119. totalAmount: '137.28',
  120. discount: '10.00',
  121. lateFee: '0',
  122. payableAmount: '127.28'
  123. },
  124. {
  125. billDate: '2024/11/30',
  126. billNumber: '250201103521',
  127. amount: '127.28',
  128. usage: '121',
  129. meterReading: '2000-2025',
  130. paymentTime: '2024/12/03 09:51',
  131. isPaid: true,
  132. currentDate: '2024/11/30',
  133. currentReading: '1925',
  134. lastDate: '2024/10/31',
  135. lastReading: '1900',
  136. totalAmount: '137.28',
  137. discount: '10.00',
  138. lateFee: '0',
  139. payableAmount: '127.28'
  140. },
  141. {
  142. billDate: '2024/11/30',
  143. billNumber: '250201103521',
  144. amount: '127.28',
  145. usage: '121',
  146. meterReading: '2000-2025',
  147. paymentTime: '2024/12/03 09:51',
  148. isPaid: true,
  149. currentDate: '2024/11/30',
  150. currentReading: '1900',
  151. lastDate: '2024/10/31',
  152. lastReading: '1875',
  153. totalAmount: '137.28',
  154. discount: '10.00',
  155. lateFee: '0',
  156. payableAmount: '127.28'
  157. }
  158. ];
  159. this.setData({
  160. billList: mockData
  161. });
  162. },
  163. // 点击开发票按钮
  164. openInvoice: function(e) {
  165. const index = e.currentTarget.dataset.index;
  166. const bill = this.data.billList[index];
  167. wx.showToast({
  168. title: '开发票功能开发中',
  169. icon: 'none'
  170. });
  171. },
  172. // 切换到首页
  173. goToHome: function() {
  174. wx.switchTab({
  175. url: '/pages/homepage/homepage',
  176. });
  177. },
  178. // 切换到我的页面
  179. goToMine: function() {
  180. wx.switchTab({
  181. url: '/pages/mine/mine',
  182. });
  183. },
  184. navigateToHome() {
  185. wx.switchTab({
  186. url: '/pages/index/index'
  187. })
  188. },
  189. navigateToMine() {
  190. wx.switchTab({
  191. url: '/pages/mine/mine'
  192. })
  193. },
  194. // 跳转到账单详情页面
  195. goToBillDetail: function(e) {
  196. const bill = e.currentTarget.dataset.bill;
  197. wx.navigateTo({
  198. url: '/pages/zhangdanxiangqing/zdxiangqing?billInfo=' + JSON.stringify(bill)
  199. });
  200. },
  201. // 获取发票
  202. getInvoice: function(e) {
  203. // 阻止事件冒泡,避免触发goToBillDetail
  204. e.stopPropagation();
  205. const bill = e.currentTarget.dataset.bill;
  206. wx.navigateTo({
  207. url: '/pages/invoice/invoice?billInfo=' + JSON.stringify(bill)
  208. });
  209. }
  210. })