zclb.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. // pages/zclb/zclb.js
  2. import {
  3. voPage
  4. } from "../../../pages/api/gzw-api"
  5. import {
  6. js_date_time
  7. } from "../../../utils/util"
  8. import {
  9. imgUrl
  10. } from "../../../pages/api/request"
  11. Page({
  12. /**
  13. * 页面的初始数据
  14. */
  15. data: {
  16. imgUrl,
  17. index: 1,
  18. totalPage: 0,
  19. visible: false,
  20. rentOut: [],
  21. gzwImgUrl: "http://219.152.50.209:81/api",
  22. type: 1,
  23. date: new Date().getTime(), // 支持时间戳传入
  24. dateText: '',
  25. start: '2017-01-01 00:00:00',
  26. end: '2047-12-30 00:00:00',
  27. // dateVisible:
  28. },
  29. /**
  30. * 生命周期函数--监听页面加载
  31. */
  32. onLoad(options) {
  33. let type = options.type
  34. if (type == 1) {
  35. wx.setNavigationBarTitle({
  36. title: '资产租赁'
  37. })
  38. } else {
  39. wx.setNavigationBarTitle({
  40. title: '资产处置'
  41. })
  42. }
  43. this.setData({
  44. type
  45. })
  46. let param = {
  47. displayState: 2,
  48. page: 1,
  49. size: 10,
  50. publishTimeSort: 1,
  51. type: this.data.type
  52. }
  53. this.loadData(param);
  54. },
  55. /**
  56. * 生命周期函数--监听页面初次渲染完成
  57. */
  58. onReady() {
  59. },
  60. /**
  61. * 生命周期函数--监听页面显示
  62. */
  63. onShow() {
  64. },
  65. /**
  66. * 生命周期函数--监听页面隐藏
  67. */
  68. onHide() {
  69. },
  70. /**
  71. * 生命周期函数--监听页面卸载
  72. */
  73. onUnload() {
  74. },
  75. /**
  76. * 页面相关事件处理函数--监听用户下拉动作
  77. */
  78. onPullDownRefresh() {
  79. },
  80. /**
  81. * 页面上拉触底事件的处理函数
  82. */
  83. onReachBottom() {
  84. },
  85. /**
  86. * 用户点击右上角分享
  87. */
  88. onShareAppMessage() {
  89. },
  90. show() {
  91. this.setData({
  92. visible: !this.data.visible
  93. })
  94. },
  95. onVisibleChange(e) {
  96. this.setData({
  97. visible: e.detail.visible,
  98. });
  99. },
  100. gotoInfo(e) {
  101. console.log(e);
  102. wx.navigateTo({
  103. url: '/pagesPublic/pages/zcinfo/zcinfo?id=' + e.currentTarget.dataset.id,
  104. })
  105. },
  106. loadData(param) {
  107. voPage(param).then(res => {
  108. if (res.success) {
  109. if (res.data.size > 0) {
  110. let records = res.data.records
  111. for (let i = 0; i < records.length; i++) {
  112. const element = records[i];
  113. const photoUrl = element.photoUrl.split(",")
  114. records[i].photoUrl = photoUrl;
  115. records[i].reviewTime = js_date_time(element.reviewTime);
  116. }
  117. console.log(records);
  118. let a = this.data.rentOut
  119. let b = [].concat(a, records)
  120. console.log(res.data.pages);
  121. this.setData({
  122. rentOut: [].concat(a, records),
  123. totalPage: res.data.pages
  124. })
  125. }
  126. }
  127. })
  128. },
  129. more() {
  130. this.setData({
  131. index: this.data.index + 1
  132. })
  133. let param = {
  134. displayState: 2,
  135. page: this.data.index,
  136. size: 10,
  137. publishTimeSort: 1,
  138. type: this.data.type
  139. }
  140. this.loadData(param)
  141. },
  142. onConfirm(e) {
  143. const { value } = e.detail;
  144. // console.log('confirm', value);
  145. // let a = new Date(value).getTime()
  146. // console.log(a);
  147. this.setData({
  148. index: 1,
  149. totalPage:0,
  150. rentOut:[]
  151. })
  152. let param = {
  153. displayState: 2,
  154. page: this.data.index,
  155. size: 10,
  156. publishTime:value,
  157. publishTimeSort: 1,
  158. type: this.data.type
  159. }
  160. this.loadData(param)
  161. this.show();
  162. }
  163. })