cashList.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. var app = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. loadText: "正在加载",
  8. LoadingComplete: true,
  9. no_order: 0,
  10. page: 1,
  11. hide_tip: true,
  12. order: [],
  13. tip: '正在加载',
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. },
  20. /**
  21. * 生命周期函数--监听页面初次渲染完成
  22. */
  23. onReady: function () {
  24. },
  25. /**
  26. * 生命周期函数--监听页面显示
  27. */
  28. onShow: function () {
  29. this.setData({
  30. page:1,
  31. no_order:0,
  32. order:[],
  33. })
  34. this.getData();
  35. },
  36. /**
  37. * 获取数据
  38. */
  39. getData: function () {
  40. wx.showLoading({
  41. title: "加载中...",
  42. mask: true
  43. });
  44. this.setData({
  45. isHideLoadMore: true
  46. })
  47. this.data.no_order = 1
  48. let that = this;
  49. var token = wx.getStorageSync('token');
  50. app.util.request({
  51. 'url': 'entry/wxapp/index',
  52. 'data': {
  53. controller: 'community.cashlist',
  54. token: token,
  55. page: that.data.page
  56. },
  57. dataType: 'json',
  58. success: function (res) {
  59. if (res.data.code == 0) {
  60. console.log(that.data.page);
  61. let rushList = that.data.order.concat(res.data.data);
  62. that.setData({
  63. order: rushList,
  64. hide_tip: true,
  65. 'no_order': 0
  66. });
  67. wx.hideLoading();
  68. } else {
  69. that.setData({
  70. LoadingComplete:true,
  71. isHideLoadMore: true
  72. })
  73. wx.hideLoading();
  74. return false;
  75. }
  76. }
  77. })
  78. },
  79. /**
  80. * 生命周期函数--监听页面隐藏
  81. */
  82. onHide: function () {
  83. },
  84. /**
  85. * 生命周期函数--监听页面卸载
  86. */
  87. onUnload: function () {
  88. },
  89. /**
  90. * 页面相关事件处理函数--监听用户下拉动作
  91. */
  92. onPullDownRefresh: function () {
  93. },
  94. /**
  95. * 页面上拉触底事件的处理函数
  96. */
  97. onReachBottom: function () {
  98. if (this.data.no_order == 1) return false;
  99. this.data.page += 1;
  100. this.getData();
  101. this.setData({
  102. isHideLoadMore: false
  103. })
  104. },
  105. /**
  106. * 用户点击右上角分享
  107. */
  108. onShareAppMessage: function () {
  109. }
  110. })