rechargeDetails.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. '前台充值',
  14. '',
  15. '余额支付',
  16. '订单退款',
  17. '后台充值',
  18. '商品退款',
  19. '',
  20. '后台扣除',
  21. '分销提现至余额',
  22. '团长提现至余额',
  23. '拼团佣金提现至余额',
  24. '配送佣金提现到余额',
  25. '',
  26. '',
  27. '',
  28. '',
  29. '',
  30. '',
  31. '',
  32. '礼品卡兑换',
  33. '拼团返利'
  34. ]
  35. },
  36. page: 1,
  37. no_data: 0,
  38. /**
  39. * 生命周期函数--监听页面加载
  40. */
  41. onLoad: function (options) {
  42. util.check_login() ? this.setData({ is_login: true }) : this.setData({ is_login: false });
  43. this.getData();
  44. },
  45. /**
  46. * 授权成功回调
  47. */
  48. authSuccess: function () {
  49. wx.reLaunch({
  50. url: '/lionfish_comshop/pages/user/rechargeDetails',
  51. })
  52. },
  53. getData: function(){
  54. var token = wx.getStorageSync('token');
  55. let that = this;
  56. wx.showLoading();
  57. this.setData({ isHideLoadMore: false })
  58. app.util.request({
  59. 'url': 'entry/wxapp/index',
  60. 'data': {
  61. controller: 'user.get_user_charge_flow',
  62. token: token,
  63. page: that.page
  64. },
  65. dataType: 'json',
  66. success: function (res) {
  67. wx.hideLoading();
  68. if(res.data.code==0){
  69. var list = that.data.list;
  70. list = list.concat(res.data.data);
  71. that.setData({ list, isHideLoadMore: true })
  72. } else if (res.data.code == 1) {
  73. if (that.data.list.length == 0 && that.page == 1) that.setData({ showData: 0});
  74. that.no_data = 1;
  75. that.setData({ isHideLoadMore: true })
  76. return false;
  77. } else if (res.data.code == 2) {
  78. that.setData({ is_login: false })
  79. }
  80. },
  81. fail: (error)=>{
  82. console.log(error)
  83. wx.showLoading();
  84. }
  85. })
  86. },
  87. /**
  88. * 页面上拉触底事件的处理函数
  89. */
  90. onReachBottom: function () {
  91. if (this.no_data == 1) return false;
  92. this.page += 1;
  93. this.getData();
  94. this.setData({
  95. isHideLoadMore: false
  96. })
  97. }
  98. })