detailsList.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. // lionfish_comshop/pages/groupCenter/detailsList.js
  2. var app = getApp();
  3. var util = require('../../utils/util.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. loadText: "正在加载",
  10. LoadingComplete: true,
  11. currentTab: 1,
  12. no_order: 0,
  13. page: 1,
  14. hide_tip: true,
  15. order: [],
  16. tip: '正在加载',
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad: function (options) {
  22. var s_type = options.type;
  23. this.setData({
  24. currentTab: s_type
  25. })
  26. this.getData();
  27. },
  28. getData: function () {
  29. wx.showLoading({
  30. title: "加载中...",
  31. mask: true
  32. });
  33. this.setData({
  34. isHideLoadMore: true
  35. })
  36. this.data.no_order = 1
  37. let that = this;
  38. var chooseDate = this.data.chooseDate;
  39. var token = wx.getStorageSync('token');
  40. var currentTab = this.data.currentTab;
  41. var order_status = 1;
  42. if (currentTab == 1) {
  43. order_status = 1;
  44. } else if (currentTab == 2) {
  45. order_status = 2;
  46. }
  47. //currentTab
  48. app.util.request({
  49. 'url': 'entry/wxapp/index',
  50. 'data': {
  51. controller: 'community.headorderlist',
  52. token: token,
  53. page: that.data.page,
  54. order_status: order_status
  55. },
  56. method: 'post',
  57. dataType: 'json',
  58. success: function (res) {
  59. if (res.data.code == 0) {
  60. console.log(that.data.page);
  61. let rushList = that.data.order.concat(res.data.data);
  62. that.setData({
  63. order: rushList,
  64. hide_tip: true,
  65. 'no_order': 0
  66. });
  67. wx.hideLoading();
  68. } else {
  69. that.setData({
  70. isHideLoadMore: true
  71. })
  72. wx.hideLoading();
  73. return false;
  74. }
  75. }
  76. })
  77. },
  78. /**
  79. * 生命周期函数--监听页面初次渲染完成
  80. */
  81. onReady: function () {
  82. },
  83. /**
  84. * 生命周期函数--监听页面显示
  85. */
  86. onShow: function () {
  87. },
  88. /**
  89. * 导航切换
  90. */
  91. switchTab: function(e){
  92. let currentTab = e.currentTarget.dataset.type || 1;
  93. this.setData({
  94. currentTab: currentTab,
  95. page:1,
  96. order:[]
  97. })
  98. this.getData();
  99. },
  100. /**
  101. * 生命周期函数--监听页面隐藏
  102. */
  103. onHide: function () {
  104. },
  105. /**
  106. * 生命周期函数--监听页面卸载
  107. */
  108. onUnload: function () {
  109. },
  110. /**
  111. * 页面相关事件处理函数--监听用户下拉动作
  112. */
  113. onPullDownRefresh: function () {
  114. },
  115. /**
  116. * 页面上拉触底事件的处理函数
  117. */
  118. onReachBottom: function () {
  119. if (this.data.no_order == 1) return false;
  120. this.data.page += 1;
  121. this.getData();
  122. this.setData({
  123. isHideLoadMore: false
  124. })
  125. },
  126. /**
  127. * 用户点击右上角分享
  128. */
  129. onShareAppMessage: function () {
  130. }
  131. })