mineOrderBeer.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // pages/mineOrderBeer/mineOrderBeer.js
  2. const request = require("../../utils/request.js");
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. tabStatus: 0,
  9. orderList: []
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad(options) {
  15. this.geOrderList()
  16. },
  17. /**
  18. * 生命周期函数--监听页面初次渲染完成
  19. */
  20. onReady() {
  21. },
  22. /**
  23. * 生命周期函数--监听页面显示
  24. */
  25. onShow() {
  26. },
  27. /**
  28. * 生命周期函数--监听页面隐藏
  29. */
  30. onHide() {
  31. },
  32. /**
  33. * 生命周期函数--监听页面卸载
  34. */
  35. onUnload() {
  36. },
  37. /**
  38. * 页面相关事件处理函数--监听用户下拉动作
  39. */
  40. onPullDownRefresh() {
  41. },
  42. /**
  43. * 页面上拉触底事件的处理函数
  44. */
  45. onReachBottom() {
  46. let that = this;
  47. let lastBeerBoxOrderId = Number(that.data.orderList[that.data.orderList.length-1].beerBoxOrderId);
  48. request.getData(
  49. 'app/box/order/list',{type: that.data.tabStatus, lastBeerBoxOrderId: lastBeerBoxOrderId},
  50. res => {
  51. if(res.data.data.length > 0) {
  52. let arr = res.data.data;
  53. that.setData({
  54. orderList: that.data.orderList.concat(arr)
  55. })
  56. }
  57. },
  58. res => {
  59. console.log(res)
  60. }
  61. )
  62. },
  63. /**
  64. * 用户点击右上角分享
  65. */
  66. onShareAppMessage() {
  67. },
  68. geOrderList() {
  69. let that = this;
  70. request.getData(
  71. 'app/box/order/list',{type: that.data.tabStatus},
  72. res => {
  73. that.setData({
  74. orderList: res.data.data
  75. })
  76. },
  77. res => {
  78. console.log(res)
  79. }
  80. )
  81. },
  82. swicthTab(event) {
  83. let tab = event.currentTarget.dataset.tab;
  84. this.setData({
  85. tabStatus: tab
  86. })
  87. this.geOrderList();
  88. },
  89. toBeerBox() {
  90. wx.navigateTo({
  91. url: '../beerBox/beerBox'
  92. })
  93. },
  94. toProgress(event) {
  95. let infolist = event.currentTarget.dataset.infolist;
  96. wx.navigateTo({
  97. url: '../mineOrderProgress/mineOrderProgress',
  98. success: function(res) {
  99. res.eventChannel.emit('getInfoList', { infolist })
  100. }
  101. })
  102. },
  103. })