list.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. var util = require('../../../../utils/util.js');
  2. var api = require('../../../../api/api.js');
  3. var app = getApp();
  4. Page({
  5. data: {
  6. list: [],
  7. page: 1,
  8. limit: 10,
  9. totalPages: 1,
  10. },
  11. getList() {
  12. let that = this;
  13. util.request(api.ParterCashoutList, {
  14. page: that.data.page,
  15. limit: that.data.limit
  16. }).then(function (res) {
  17. if (res.errno === 0) {
  18. that.setData({
  19. list: that.data.list.concat(res.data.list),
  20. totalPages: res.data.pages
  21. });
  22. }
  23. });
  24. },
  25. /**
  26. * 生命周期函数--监听页面加载
  27. */
  28. onLoad: function (options) {
  29. this.getList();
  30. },
  31. /**
  32. * 生命周期函数--监听页面初次渲染完成
  33. */
  34. onReady: function () {
  35. },
  36. /**
  37. * 生命周期函数--监听页面显示
  38. */
  39. onShow: function () {
  40. },
  41. /**
  42. * 生命周期函数--监听页面隐藏
  43. */
  44. onHide: function () {
  45. },
  46. /**
  47. * 生命周期函数--监听页面卸载
  48. */
  49. onUnload: function () {
  50. },
  51. /**
  52. * 页面相关事件处理函数--监听用户下拉动作
  53. */
  54. onPullDownRefresh: function () {
  55. },
  56. /**
  57. * 页面上拉触底事件的处理函数
  58. */
  59. onReachBottom: function () {
  60. if (this.data.totalPages > this.data.page) {
  61. this.setData({
  62. page: this.data.page + 1
  63. });
  64. this.getList();
  65. } else {
  66. wx.showToast({
  67. title: '没有更多记录了',
  68. icon: 'none',
  69. duration: 2000
  70. });
  71. return false;
  72. }
  73. },
  74. showPicker() {
  75. this.setData({
  76. showPicker: true
  77. });
  78. },
  79. onCancel: function () {
  80. this.setData({
  81. showPicker: false,
  82. });
  83. },
  84. onConfirm: function (event) {
  85. this.setData({
  86. type: this.data.statusList[event.detail.index],
  87. statusType: event.detail.value,
  88. showPicker: false,
  89. });
  90. this.setData({
  91. page: 1,
  92. list: []
  93. });
  94. this.getList();
  95. },
  96. /**
  97. * 用户点击右上角分享
  98. */
  99. onShareAppMessage: function () {
  100. }
  101. })