orders.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // pages/orders/orders.ts
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. tabList: [
  8. {
  9. id: 0,
  10. label: "全部",
  11. },
  12. {
  13. id: 1,
  14. label: "待付款",
  15. },
  16. {
  17. id: 2,
  18. label: "已使用",
  19. },
  20. {
  21. id: 3,
  22. label: "已完成",
  23. },
  24. {
  25. id: 4,
  26. label: "已取消",
  27. }
  28. ],
  29. tabIdx: 0, // 当前选中的tab索引
  30. page: 1,
  31. rows: 10,
  32. recordList: [],
  33. maxPage: 1, // 总分页数
  34. },
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */
  38. onLoad() {
  39. },
  40. /** 切换分类 */
  41. switchTab(e: { currentTarget: { dataset: { idx: any } } }) {
  42. const idx = e.currentTarget.dataset.idx;
  43. if (idx != this.data.tabIdx) {
  44. this.setData(
  45. {
  46. tabIdx: idx,
  47. page: 1,
  48. maxPage: 1,
  49. recordList: [],
  50. }
  51. );
  52. }
  53. // ,
  54. // () => {
  55. // this.queryRecords();
  56. // }
  57. },
  58. /** 加载更多 */
  59. loadMore() {
  60. wx.showLoading({
  61. mask: true,
  62. title: "加载中...",
  63. });
  64. setTimeout(() => {
  65. wx.hideLoading()
  66. }, 3000);
  67. },
  68. /**
  69. * 生命周期函数--监听页面初次渲染完成
  70. */
  71. onReady() {
  72. },
  73. /**
  74. * 生命周期函数--监听页面显示
  75. */
  76. onShow() {
  77. },
  78. /**
  79. * 生命周期函数--监听页面隐藏
  80. */
  81. onHide() {
  82. },
  83. /**
  84. * 生命周期函数--监听页面卸载
  85. */
  86. onUnload() {
  87. },
  88. /**
  89. * 页面相关事件处理函数--监听用户下拉动作
  90. */
  91. onPullDownRefresh() {
  92. },
  93. /**
  94. * 页面上拉触底事件的处理函数
  95. */
  96. onReachBottom() {
  97. },
  98. /**
  99. * 用户点击右上角分享
  100. */
  101. onShareAppMessage() {
  102. }
  103. })