riding_card.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. var app = getApp()
  2. Page({
  3. data: {
  4. arr:[],
  5. arr1:[],
  6. page:1,
  7. show:false,
  8. img:app.globalData.imgUrl,
  9. setting:{}
  10. },
  11. onLoad: function (options) {
  12. var that = this;
  13. wx.showLoading({
  14. title: '加载中...',
  15. mask:true
  16. })
  17. this.setData({
  18. setting: wx.getStorageSync('setting')
  19. })
  20. app.request("/card_riding/user_history_orders", '', "GET").then(res => {
  21. console.log(res)
  22. wx.hideLoading({
  23. complete: (res) => {},
  24. })
  25. if (res.data.data == '') {
  26. return;
  27. }
  28. that.setData({ arr: res.data.data })
  29. }).catch(err => {
  30. console.log(err)
  31. })
  32. },
  33. show(){
  34. this.setData({show:true})
  35. },
  36. hide() {
  37. this.setData({ show: false })
  38. },
  39. onReady: function () {
  40. },
  41. onShow: function () {
  42. var that = this;
  43. app.request("/card_riding/user_card", '', "GET").then(res => {
  44. console.log(res)
  45. if (res.data.user_card == '') {
  46. return;
  47. }
  48. that.setData({ arr1: res.data.user_card })
  49. }).catch(err => {
  50. console.log(err)
  51. })
  52. },
  53. goBuy(){
  54. wx.navigateTo({
  55. url: '/pages/recharge/recharge',
  56. })
  57. },
  58. onHide: function () {
  59. },
  60. onUnload: function () {
  61. },
  62. onPullDownRefresh: function () {
  63. },
  64. onReachBottom: function () {
  65. console.log('1')
  66. var that = this;
  67. var page = that.data.page+1;
  68. app.request("/card_riding/user_history_orders?page="+page, '', "GET").then(res => {
  69. console.log(res)
  70. if (res.data.data == '') {
  71. wx.showToast({
  72. title: '没有更多了',
  73. icon:'none'
  74. })
  75. return;
  76. }
  77. that.setData({ arr: that.data.arr.concat(res.data.data),page })
  78. }).catch(err => {
  79. console.log(err)
  80. })
  81. },
  82. onShareAppMessage: function () {
  83. }
  84. })