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.

133 lines
3.3 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. let that = this;
  44. that.setData({
  45. billScalesObj: {
  46. name: options.name,
  47. id: options.scale
  48. },
  49. date: options.date,
  50. date2: options.date2
  51. })
  52. this.getData()
  53. this.search()
  54. },
  55. bindDateChange1: function (e) {
  56. this.setData({
  57. date: e.detail.value,
  58. })
  59. },
  60. bindDateChange2: function (e) {
  61. this.setData({
  62. date2: e.detail.value
  63. })
  64. },
  65. bindPickerChange: function (e) {
  66. this.setData({
  67. billTypesObj: this.data.billtypes[e.detail.value]
  68. })
  69. },
  70. bindPickerChange2: function (e) {
  71. this.setData({
  72. billScalesObj: this.data.billScales[e.detail.value]
  73. })
  74. },
  75. getData() {
  76. Http.getRequest(config.api.billScales, app.globalData.token, '', {}, (res) => {
  77. let arr = []
  78. for (let key in res.data) {
  79. let val = res.data[key];
  80. arr.push({ id: key, name: val })
  81. }
  82. this.setData({
  83. billScales: arr
  84. })
  85. })
  86. Http.getRequest(config.api.billTypes, app.globalData.token, '', {}, (res) => {
  87. let arr = []
  88. for (let key in res.data) {
  89. let val = res.data[key];
  90. arr.push({ id: key, name: val })
  91. }
  92. this.setData({
  93. billTypes: arr
  94. })
  95. })
  96. },
  97. search() {
  98. Http.getRequest(config.api.mallListBill, app.globalData.token, '', {
  99. billTypeValue: this.data.billTypesObj.id,
  100. starttime: this.data.date,
  101. endtime: this.data.date2,
  102. onlyOweOrNear: this.data.billScalesObj.id,
  103. pageNum: 1,
  104. pageSize: 1000,
  105. }, (res) => {
  106. if (res.code === 200) {
  107. res.data.list.forEach(file => {
  108. file.starttime = file.starttime ? util.formatTime(Number(file.starttime), "yyyy.MM.dd ") : '';
  109. file.endtime = file.starttime ? util.formatTime(Number(file.endtime), "yyyy.MM.dd ") : '';
  110. })
  111. this.setData({
  112. list: res.data.list
  113. })
  114. }
  115. })
  116. },
  117. /**
  118. * gotolook点击查看
  119. */
  120. gotolook: function (e) {
  121. var billTypeValue = e.currentTarget.dataset.data.billType;
  122. let billId = e.currentTarget.dataset.data.id;
  123. wx.navigateTo({
  124. url: `/pages/bill/billdetail/index?billTypeValue=${billTypeValue}&billId=${billId}`,
  125. })
  126. },
  127. goBack() {
  128. wx.navigateBack({
  129. delta: 1
  130. })
  131. }
  132. })