index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const app = getApp();
  2. const util = require("../../util/util.js")
  3. Page({
  4. data: {
  5. StatusBar: app.globalData.StatusBar,
  6. CustomBar: app.globalData.CustomBar,
  7. nd:{
  8. year:"2021年",
  9. count:1,
  10. fee:100
  11. },
  12. index: 0,
  13. year:0,
  14. month:0,
  15. picker: {},
  16. },
  17. DateChange: function( e ){
  18. console.log( e)
  19. },
  20. gotoLog(e){
  21. let {month, year} = e.currentTarget.dataset;
  22. let monthStr = month <10?(year+'-0'+month):(year+'-'+month);
  23. wx.navigateTo({
  24. url: `/pages/log/log?month=${monthStr}`,
  25. })
  26. },
  27. loadData(){
  28. let nd = this.data.nd
  29. util.http("/wx/incomeInfo", {}, (err, res) =>{
  30. if( err == 0){
  31. nd = Object.assign( nd, res )
  32. this.setData({ nd })
  33. }
  34. });
  35. },
  36. onShow: function(){
  37. this.loadData()
  38. },
  39. onLoad: function (options) {
  40. var date = new Date();
  41. let year=date.getFullYear();
  42. let month=date.getMonth()+1;
  43. let picker ={};
  44. for( let i=1;i<= month;i++){
  45. picker[year+'-'+month+'01'] = year+'年'+i+'月';
  46. }
  47. this.setData({submit:false,picker,year, month})
  48. this.loadData()
  49. }
  50. })