rechargeDetails.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. var app = getApp();
  2. var util = require('../../utils/util.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. list: [],
  9. showData: 1,
  10. loadText: '加载中',
  11. remark: ['', '前台充值', '', '余额支付', '余额退回', '后台充值', '', '', '后台扣除', '分销提现至余额', '团长提现至余额']
  12. },
  13. page: 1,
  14. no_data: 0,
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. util.check_login() ? this.setData({ is_login: true }) : this.setData({ is_login: false });
  20. this.getData();
  21. },
  22. /**
  23. * 授权成功回调
  24. */
  25. authSuccess: function () {
  26. wx.reLaunch({
  27. url: '/lionfish_comshop/pages/user/rechargeDetails',
  28. })
  29. },
  30. getData: function(){
  31. var token = wx.getStorageSync('token');
  32. let that = this;
  33. wx.showLoading();
  34. this.setData({ isHideLoadMore: false })
  35. app.util.request({
  36. 'url': 'entry/wxapp/index',
  37. 'data': {
  38. controller: 'user.get_user_charge_flow',
  39. token: token,
  40. page: that.page
  41. },
  42. dataType: 'json',
  43. success: function (res) {
  44. wx.hideLoading();
  45. if(res.data.code==0){
  46. var list = that.data.list;
  47. list = list.concat(res.data.data);
  48. that.setData({ list, isHideLoadMore: true })
  49. } else if (res.data.code == 1) {
  50. if (that.data.list.length == 0 && that.page == 1) that.setData({ showData: 0});
  51. that.no_data = 1;
  52. that.setData({ isHideLoadMore: true })
  53. return false;
  54. } else if (res.data.code == 2) {
  55. that.setData({ is_login: false })
  56. }
  57. },
  58. fail: (error)=>{
  59. console.log(error)
  60. wx.showLoading();
  61. }
  62. })
  63. },
  64. /**
  65. * 生命周期函数--监听页面显示
  66. */
  67. onShow: function () {
  68. },
  69. /**
  70. * 生命周期函数--监听页面隐藏
  71. */
  72. onHide: function () {
  73. },
  74. /**
  75. * 生命周期函数--监听页面卸载
  76. */
  77. onUnload: function () {
  78. },
  79. /**
  80. * 页面相关事件处理函数--监听用户下拉动作
  81. */
  82. onPullDownRefresh: function () {
  83. },
  84. /**
  85. * 页面上拉触底事件的处理函数
  86. */
  87. onReachBottom: function () {
  88. if (this.no_data == 1) return false;
  89. this.page += 1;
  90. this.getData();
  91. this.setData({
  92. isHideLoadMore: false
  93. })
  94. }
  95. })