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.

124 lines
3.1 KiB

  1. var app = getApp();
  2. const config = require('../../../config/config.js')
  3. const util = require('../../../utils/util.js')
  4. const Http = require('../../../utils/http.js')
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. array: ['美国', '中国', '巴西', '日本'],
  11. billTypesObj: {
  12. name: '',
  13. id: ''
  14. },
  15. billScalesObj: {
  16. name: '',
  17. id: ''
  18. },
  19. billtypes: [
  20. {id: "1", name: "租金"},
  21. {id: "2", name: "物业费"},
  22. {id: "3", name: "日常(水电空调)费"},
  23. {id: "4", name: "其他费用"},
  24. {id: "5", name: "其他押金"},
  25. {id: "11", name: "商业管理费"},
  26. {id: "12", name: "运营管理费"},
  27. {id: "13", name: "租赁押金"},
  28. {id: "21", name: "物业押金"}
  29. ],
  30. statustypes: [],
  31. date: '',
  32. date2: '',
  33. list: []
  34. },
  35. onLoad: function (options) {
  36. // let date = new Date;
  37. // let year = date.getFullYear();
  38. // let month = date.getMonth() + 1;
  39. // this.setData({
  40. // date: year + '-' + month,
  41. // date2: year + '-' + month,
  42. // })
  43. this.getData()
  44. this.search()
  45. },
  46. bindDateChange1: function (e) {
  47. this.setData({
  48. date: e.detail.value,
  49. })
  50. },
  51. bindDateChange2: function (e) {
  52. this.setData({
  53. date2: e.detail.value
  54. })
  55. },
  56. bindPickerChange: function(e) {
  57. this.setData({
  58. billTypesObj: this.data.billtypes[e.detail.value]
  59. })
  60. },
  61. bindPickerChange2: function(e) {
  62. this.setData({
  63. billScalesObj: this.data.billScales[e.detail.value]
  64. })
  65. },
  66. getData() {
  67. Http.getRequest(config.api.billScales, app.globalData.token, '', {}, (res) => {
  68. let arr = []
  69. for (let key in res.data) {
  70. let val = res.data[key];
  71. arr.push({id: key, name: val})
  72. }
  73. this.setData({
  74. billScales: arr
  75. })
  76. })
  77. Http.getRequest(config.api.billTypes, app.globalData.token, '', {}, (res) => {
  78. let arr = []
  79. for (let key in res.data) {
  80. let val = res.data[key];
  81. arr.push({id: key, name: val})
  82. }
  83. this.setData({
  84. billTypes: arr
  85. })
  86. })
  87. },
  88. search() {
  89. Http.getRequest(config.api.listBill, app.globalData.token, '', {
  90. billTypeValue: this.data.billTypesObj.id,
  91. starttime: this.data.date,
  92. endtime: this.data.date2,
  93. onlyOweOrNear: this.data.billScalesObj.id,
  94. pageNum: 1,
  95. pageSize: 1000,
  96. }, (res) => {
  97. if(res.code === 200) {
  98. res.data.forEach(file => {
  99. file.starttime = file.starttime ? util.formatTime(Number(file.starttime), "yyyy.MM.dd ") : '';
  100. file.endtime = file.starttime ? util.formatTime(Number(file.endtime), "yyyy.MM.dd ") : '';
  101. })
  102. this.setData({
  103. list: res.data
  104. })
  105. }
  106. })
  107. },
  108. /**
  109. * gotolook点击查看
  110. */
  111. gotolook: function (e) {
  112. var billTypeValue = e.currentTarget.dataset.data.billType;
  113. let billId = e.currentTarget.dataset.data.billId;
  114. wx.navigateTo({
  115. url: `/pages/bill/billdetail/index?billTypeValue=${billTypeValue}&billId=${billId}`,
  116. })
  117. },
  118. goBack(){
  119. wx.navigateBack({
  120. delta: 1
  121. })
  122. }
  123. })