lineRecord.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. var app = getApp()
  2. Page({
  3. data: {
  4. lineRecord:[],
  5. page:1,
  6. bike_id:'',
  7. },
  8. onLoad: function (options) {
  9. this.setData({
  10. bike_id: options.id
  11. })
  12. var data = {
  13. bike_id:options.id
  14. }
  15. app.request('bike/bikeOnLineLog',data,'POST').then(res=>{
  16. console.log(res)
  17. this.setData({
  18. lineRecord:res.data.data
  19. })
  20. })
  21. },
  22. onReady: function () {
  23. },
  24. onShow: function () {
  25. },
  26. onHide: function () {
  27. },
  28. onUnload: function () {
  29. },
  30. onPullDownRefresh: function () {
  31. },
  32. onReachBottom: function () {
  33. wx.showLoading({
  34. title: '加载中',
  35. })
  36. var that = this;
  37. var page = that.data.page + 1;
  38. var data = {
  39. bike_id: that.data.bike_id,
  40. page: page
  41. }
  42. app.request('bike/bikeOnLineLog', data, 'POST').then(res => {
  43. console.log(res)
  44. wx.hideLoading()
  45. if (res.statusCode == 200) {
  46. if (res.data.data.length > 0) {
  47. this.setData({ lineRecord: that.data.lineRecord.concat(res.data.data) ,page})
  48. } else {
  49. wx.showToast({
  50. title: '没有更多了~',
  51. icon: 'none'
  52. })
  53. }
  54. }
  55. })
  56. },
  57. onShareAppMessage: function () {
  58. }
  59. })