wallet_details.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. var app = getApp()
  2. Page({
  3. data: {
  4. list:[],
  5. page:1
  6. },
  7. onLoad: function (options) {
  8. var that = this;
  9. // app.request("/user/wallerLogList?page=1", '', "GET").then(res => {
  10. // console.log(res)
  11. // if(res.data.data==''){
  12. // wx.showToast({
  13. // title: '暂无数据',
  14. // icon:'none'
  15. // })
  16. // }else{
  17. // that.setData({ list: res.data.data })
  18. // }
  19. // }).catch(err => {
  20. // console.log(err)
  21. // })
  22. wx.request({
  23. url: 'https://yutang.web.ximengnaikang.com/api/user/wallets',
  24. method: 'GET',
  25. header: {
  26. 'content-type': 'application/x-www-form-urlencoded',
  27. 'Authorization':wx.getStorageSync('token')
  28. },
  29. success: function (res) {
  30. console.log(res.data.data)
  31. if(res.statusCode==200){
  32. // that.setData({arr:res.data.data.data,link:res.data.data.next_page_url})
  33. }
  34. }
  35. })
  36. },
  37. onReady: function () {
  38. },
  39. onShow: function () {
  40. },
  41. onHide: function () {
  42. },
  43. onUnload: function () {
  44. },
  45. onPullDownRefresh: function () {
  46. },
  47. onReachBottom: function () {
  48. wx.showLoading({
  49. title: '加载中...',
  50. })
  51. var that = this;
  52. var page = that.data.page+1
  53. app.request("/user/wallerLogList?page="+page, '', "GET").then(res => {
  54. console.log(res)
  55. wx.hideLoading()
  56. if(res.data.data==''){
  57. wx.showToast({
  58. title: '暂无更多数据~',
  59. icon:'none'
  60. })
  61. }else{
  62. that.setData({ list: that.data.list.concat(res.data.data), page })
  63. }
  64. }).catch(err => {
  65. console.log(err)
  66. })
  67. },
  68. onShareAppMessage: function () {
  69. }
  70. })