cashList.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. var util = require('../../../utils/jmsUtil.js');
  2. const api = require('../../../api/jms.js');
  3. Page({
  4. data: {
  5. list: [],
  6. page: 1,
  7. limit: 10,
  8. totalPages: 1
  9. },
  10. onLoad: function (options) {
  11. this.getList();
  12. },
  13. onPullDownRefresh() {
  14. this.getList();
  15. wx.stopPullDownRefresh() //停止下拉刷新
  16. },
  17. getList: function () {
  18. wx.showLoading({
  19. title: '加载中',
  20. });
  21. setTimeout(function () {
  22. wx.hideLoading()
  23. }, 2000);
  24. let that = this;
  25. util.request(api.getApplyList, {}).then(function (res) {
  26. if (res.errno === 0) {
  27. console.log(res.data);
  28. that.setData({
  29. list: that.data.list.concat(res.data.list),
  30. totalPages: res.data.pages
  31. });
  32. }
  33. wx.hideLoading();
  34. });
  35. },
  36. onReady: function () {
  37. // 页面渲染完成
  38. },
  39. onShow: function () {
  40. // 页面显示
  41. },
  42. onHide: function () {
  43. // 页面隐藏
  44. },
  45. onUnload: function () {
  46. // 页面关闭
  47. },
  48. onReachBottom: function () {
  49. if (this.data.totalPages > this.data.page) {
  50. this.setData({
  51. page: this.data.page + 1
  52. });
  53. this.getList();
  54. } else {
  55. wx.showToast({
  56. title: '没有更多提现申请了',
  57. icon: 'none',
  58. duration: 2000
  59. });
  60. return false;
  61. }
  62. }
  63. })