detailinfo.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // pages/detailInfo/detailinfo.js
  2. import http from '../../utils/http'
  3. import util from '../../utils/util'
  4. import api from '../../utils/api'
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. min_date: "",
  11. max_date: "",
  12. date: 0,
  13. all: 0,
  14. selectIndex: 2,
  15. list: [{
  16. name: "全部",
  17. value: 2
  18. },
  19. {
  20. name: "已解决",
  21. value: 1
  22. },
  23. {
  24. name: "未解决",
  25. value: 0
  26. }
  27. ],
  28. years: [],
  29. project_id: "",
  30. project_list: []
  31. },
  32. /**
  33. * 生命周期函数--监听页面加载
  34. */
  35. onLoad: function (options) {
  36. // this.getDateInfo()
  37. this.setData({
  38. project_id: options.id - 0
  39. })
  40. this.getYears()
  41. },
  42. /**
  43. * 生命周期函数--监听页面初次渲染完成
  44. */
  45. onReady: function () {
  46. },
  47. // getDateInfo() {
  48. // var that = this
  49. // http({
  50. // url: 'data/getDateInfo',
  51. // data: {},
  52. // success: function (res) {
  53. // if (res.code == 0) {
  54. // that.setData(res.data)
  55. // }
  56. // }
  57. // })
  58. // },
  59. detailDatainfo(e) {
  60. let date = this.data.project_list[e.currentTarget.dataset.index].date
  61. let dates = this.data.project_list[e.currentTarget.dataset.index].dates
  62. wx.navigateTo({
  63. url: '../detailInfo/detailData?id=' + this.data.project_id + '&date=' + date + '&dates=' + dates,
  64. })
  65. },
  66. onstatusChange(e) {
  67. this.setData({
  68. all: e.detail.value,
  69. selectIndex: this.data.list[e.detail.value].value,
  70. project_list: []
  71. })
  72. this.getMonthData()
  73. },
  74. onChange(e) {
  75. this.setData({
  76. date: e.detail.value,
  77. project_list: []
  78. })
  79. this.getMonthData()
  80. },
  81. getMonthData() {
  82. http({
  83. url: 'orders/getOrderview',
  84. data: {
  85. year: this.data.years[this.data.date],
  86. status: this.data.selectIndex,
  87. project_id: this.data.project_id
  88. },
  89. success: (res) => {
  90. if (res.code == 0) {
  91. this.setData({
  92. project_list: res.data
  93. })
  94. }
  95. }
  96. })
  97. },
  98. getYears() {
  99. http({
  100. url: 'orders/getYears',
  101. data: {},
  102. success: (res) => {
  103. if (res.code == 0) {
  104. this.setData({
  105. years: res.data
  106. })
  107. this.getMonthData()
  108. }
  109. }
  110. })
  111. },
  112. /**
  113. * 生命周期函数--监听页面显示
  114. */
  115. onShow: function () {
  116. },
  117. /**
  118. * 生命周期函数--监听页面隐藏
  119. */
  120. onHide: function () {
  121. },
  122. /**
  123. * 生命周期函数--监听页面卸载
  124. */
  125. onUnload: function () {
  126. },
  127. /**
  128. * 页面相关事件处理函数--监听用户下拉动作
  129. */
  130. onPullDownRefresh: function () {
  131. },
  132. /**
  133. * 页面上拉触底事件的处理函数
  134. */
  135. onReachBottom: function () {
  136. },
  137. /**
  138. * 用户点击右上角分享
  139. */
  140. onShareAppMessage: function () {
  141. }
  142. })