mineOrderBeer.js 2.2 KB

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