微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

finance.js 4.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // pages/handle/liist.js
  2. import * as UTIL from '../../utils/util.js';
  3. import * as API from '../../utils/API.js';
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. isIPX: app.globalData.isIPX,
  11. pageNums:1,
  12. scrollHeight:"",
  13. financeList:[],
  14. index:0,
  15. array:["收支明细公开"],
  16. userInfoObj:[],
  17. date: UTIL.formatDates(new Date),
  18. data:{}
  19. },
  20. onConfirmReviewTime(e){
  21. let data = e.detail.value;
  22. this.setData({
  23. 'date':data,
  24. 'pageNums':1});
  25. this.getList();
  26. },
  27. paging(){
  28. this.setData({
  29. pageNums:this.data.pageNums+1,
  30. })
  31. this.getList();
  32. },
  33. getList:function(){
  34. let params = {
  35. pageNum:this.data.pageNums,
  36. pageSize:10,
  37. startNY:this.data.date,
  38. all:false
  39. }
  40. UTIL.httpRequest(API.URL_GET_FINANCIALLIST,params,{
  41. success: (res) => {
  42. if(res.code == 200){
  43. res.summary.syjc=Number(res.summary.syjc ).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  44. return $1 + ","; }).replace(/\.$/, "")
  45. res.summary.dai=Number(res.summary.dai ).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  46. return $1 + ","; }).replace(/\.$/, "")
  47. res.summary.jie=Number(res.summary.jie ).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  48. return $1 + ","; }).replace(/\.$/, "")
  49. res.summary.byjc=Number(res.summary.byjc ).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  50. return $1 + ","; }).replace(/\.$/, "")
  51. this.setData({'data':res.summary})
  52. if(this.data.pageNums!=1&&this.data.financeList.length<res.total){
  53. res.rows.map(rr => {
  54. rr.jieAmount = Number(rr.jieAmount ).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  55. return $1 + ","; }).replace(/\.$/, "")
  56. rr.daiAmount = Number(rr.daiAmount ).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  57. return $1 + ","; }).replace(/\.$/, "")
  58. })
  59. let lists = this.data.financeList.concat(res.rows)
  60. this.setData({financeList:lists})
  61. }else if(this.data.pageNums==1){
  62. res.rows.map(rr => {
  63. rr.jieAmount = Number(rr.jieAmount ).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  64. return $1 + ","; }).replace(/\.$/, "")
  65. rr.daiAmount = Number(rr.daiAmount ).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
  66. return $1 + ","; }).replace(/\.$/, "")
  67. })
  68. this.setData({financeList:res.rows})
  69. }
  70. }else{
  71. UTIL.showToastNoneIcon(res.msg);
  72. }
  73. }
  74. })
  75. },
  76. /**
  77. * 生命周期函数--监听页面加载
  78. */
  79. onLoad: function (options) {
  80. var that = this;
  81. let qu = wx.createSelectorQuery()
  82. qu.select("#top_view1").boundingClientRect()
  83. qu.select("#top_view2").boundingClientRect()
  84. qu.exec(res => {
  85. that.setData({
  86. scrollHeight:wx.getSystemInfoSync().windowHeight-res[0].height-res[0].top-res[1].height-res[1].left*2
  87. })
  88. })
  89. this.getList()
  90. },
  91. bindPickerChange:function(e){
  92. this.setData({index:e.detail.value});
  93. },
  94. switchTab:function(e){
  95. this.setData({
  96. active:e.currentTarget.dataset.gid
  97. })
  98. },
  99. back:function(){
  100. wx.navigateBack({
  101. delta: 1
  102. })
  103. },
  104. /**
  105. * 生命周期函数--监听页面初次渲染完成
  106. */
  107. onReady: function () {
  108. },
  109. /**
  110. * 生命周期函数--监听页面显示
  111. */
  112. onShow: function () {
  113. },
  114. /**
  115. * 生命周期函数--监听页面隐藏
  116. */
  117. onHide: function () {
  118. },
  119. /**
  120. * 生命周期函数--监听页面卸载
  121. */
  122. onUnload: function () {
  123. },
  124. /**
  125. * 页面相关事件处理函数--监听用户下拉动作
  126. */
  127. onPullDownRefresh: function () {
  128. },
  129. /**
  130. * 页面上拉触底事件的处理函数
  131. */
  132. onReachBottom: function () {
  133. },
  134. /**
  135. * 用户点击右上角分享
  136. */
  137. onShareAppMessage: function () {
  138. }
  139. })