Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

index.js 2.9KB

před 1 rokem
před 1 rokem
před 1 rokem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. const reqInterface = require("../../../api/models");
  2. import {
  3. toLink
  4. } from '../../../utils/nav';
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. tabs: [{
  11. title: '全部',
  12. icon: '/icons/all.png'
  13. }, {
  14. title: '待审核',
  15. icon: '/icons/daishenhe.png'
  16. }, {
  17. title: '已审核',
  18. icon: '/icons/yishenhe.png'
  19. }, {
  20. title: '已公示',
  21. icon: '/icons/yigongshi.png'
  22. }, {
  23. title: '已发放',
  24. icon: '/icons/yifafang.png'
  25. }],
  26. applyForList: [],
  27. active: 0,
  28. isRefreshing: false,
  29. searchParams: {
  30. current: 1,
  31. size: 9,
  32. status: '',
  33. },
  34. },
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */
  38. onLoad(options) {
  39. },
  40. /**
  41. * 生命周期函数--监听页面初次渲染完成
  42. */
  43. onReady() {
  44. },
  45. /**
  46. * 生命周期函数--监听页面显示
  47. */
  48. onShow() {
  49. let self = this;
  50. self.setData({
  51. applyForList: []
  52. })
  53. self.getApplyForList(self.data.searchParams);
  54. },
  55. getApplyForList(val) {
  56. let self = this;
  57. reqInterface.GetConsumerinfoDetail(val).then(res => {
  58. if (!res.records || res.records.length == 0) {
  59. wx.showToast({
  60. title: '没有更多数据',
  61. icon: 'none'
  62. })
  63. }
  64. self.setData({
  65. applyForList: res.records ? self.data.applyForList.concat(res.records) : self.data.applyForList.concat([]),
  66. isRefreshing: false
  67. })
  68. }).catch(err => {
  69. self.setData({
  70. isRefreshing: false
  71. })
  72. })
  73. },
  74. changeTab(e) {
  75. let self = this;
  76. if (e.currentTarget.dataset.idx == 0) {
  77. self.setData({
  78. applyForList: [],
  79. searchParams: {
  80. current: 1,
  81. size: 9,
  82. status: '',
  83. },
  84. active: e.currentTarget.dataset.idx
  85. })
  86. } else {
  87. self.setData({
  88. searchParams: {
  89. current: 1,
  90. size: 9,
  91. status: e.currentTarget.dataset.idx,
  92. },
  93. applyForList: [],
  94. active: e.currentTarget.dataset.idx
  95. })
  96. }
  97. self.getApplyForList(self.data.searchParams)
  98. },
  99. toApplyFor(e) {
  100. toLink('/pages/info/index/index', {
  101. id: e.currentTarget.dataset.id
  102. })
  103. },
  104. // 加载更多
  105. onLoadMore() {
  106. let self = this;
  107. let page = self.data.searchParams.current + 1; //获取当前页数并+1
  108. self.setData({
  109. 'searchParams.current': page, //更新当前页数
  110. })
  111. self.getApplyForList(self.data.searchParams); //重新调用请求获取下一页数据
  112. },
  113. // 下拉刷新
  114. onRefresherPulling(e) {
  115. this.setData({
  116. isRefreshing: true
  117. });
  118. },
  119. onRefresherRefresh(e) {
  120. this.getRefresh()
  121. },
  122. getRefresh() {
  123. let self = this;
  124. self.setData({
  125. applyForList: [],
  126. searchParams: {
  127. current: 1,
  128. status: self.data.searchParams.status,
  129. size: 9
  130. },
  131. active: self.data.active
  132. })
  133. self.getApplyForList(this.data.searchParams);
  134. },
  135. })