cashList.js 2.2 KB

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