index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. // pages/logisticsOrderMan/index.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. loginStatus: wx.getStorageSync('loginStatus') ? wx.getStorageSync('loginStatus') : false,
  9. roleCodeList: wx.getStorageSync('roleCodeList') ? wx.getStorageSync('roleCodeList') : '',
  10. searchVal: '',
  11. //分页
  12. limit: 10,
  13. requestStatu: '加载中...',
  14. page: 1,
  15. totalPages: 1,
  16. more: false,
  17. nomore: '',
  18. resData:[],
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad(options) {
  24. },
  25. /**
  26. * 生命周期函数--监听页面初次渲染完成
  27. */
  28. onReady() {
  29. },
  30. /**
  31. * 生命周期函数--监听页面显示
  32. */
  33. onShow() {
  34. const roleCodeList = wx.getStorageSync('roleCodeList')
  35. let loginStatus = wx.getStorageSync('loginStatus')
  36. this.setData({
  37. searchVal: '',
  38. roleCodeList: roleCodeList ? roleCodeList : '',
  39. loginStatus: loginStatus ? loginStatus : false
  40. })
  41. //动态tabbar
  42. // if (roleCodeList == 'bizAdmin') {
  43. // this.getTabBar().setData({
  44. // list: app.globalData.allList[0].list2,
  45. // })
  46. // } else if(roleCodeList == 'send') {
  47. // this.getTabBar().setData({
  48. // list: app.globalData.allList[0].list3,
  49. // })
  50. // } else if(roleCodeList == 'sale') {
  51. // this.getTabBar().setData({
  52. // list: app.globalData.allList[0].list4,
  53. // })
  54. // } else if(roleCodeList == 'customer') {
  55. // this.getTabBar().setData({
  56. // list: app.globalData.allList[0].list5,
  57. // })
  58. // } else if (roleCodeList=='driver'||roleCodeList==''){
  59. // this.getTabBar().setData({
  60. // list: app.globalData.allList[0].list1,
  61. // })
  62. // }
  63. // if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  64. // this.getTabBar().setData({
  65. // selected: roleCodeList=='bizAdmin' ? 2 : 1
  66. // })
  67. // }
  68. if(wx.getStorageSync('loginStatus')){
  69. this.getListFun();
  70. }
  71. },
  72. //搜索框请求S
  73. onChange(e) {
  74. this.setData({
  75. searchVal: e.detail,
  76. });
  77. },
  78. onSearch: function (event) {
  79. this.setData({
  80. searchVal: event.detail
  81. })
  82. this.getListFun();
  83. },
  84. onCancel: function () {
  85. this.setData({})
  86. },
  87. toSearch: function (event) {
  88. this.getListFun();
  89. },
  90. //列表
  91. getListFun: function () {
  92. this.setData({
  93. page: 1
  94. })
  95. let params = {
  96. current: this.data.page,
  97. size: this.data.limit,
  98. searchKey:this.data.searchVal,
  99. weighingStage:1
  100. }
  101. app.request.pageFirst({
  102. url: app.API.driverRecordList,
  103. page: this,
  104. params: params,
  105. })
  106. },
  107. /**
  108. * 生命周期函数--监听页面隐藏
  109. */
  110. onHide() {
  111. },
  112. /**
  113. * 生命周期函数--监听页面卸载
  114. */
  115. onUnload() {
  116. },
  117. /**
  118. * 页面相关事件处理函数--监听用户下拉动作
  119. */
  120. onPullDownRefresh: function () {
  121. this.setData({
  122. searchVal: ''
  123. })
  124. if (wx.getStorageSync('loginStatus')) {
  125. this.getListFun();
  126. } else {
  127. wx.stopPullDownRefresh();
  128. }
  129. },
  130. /**
  131. * 页面上拉触底事件的处理函数
  132. */
  133. onReachBottom: function () {
  134. this.data.page++;
  135. let params = {
  136. current: this.data.page,
  137. size: this.data.limit,
  138. searchKey:this.data.searchVal,
  139. weighingStage:1
  140. }
  141. app.request.pageOther({
  142. url: app.API.driverRecordList,
  143. page: this,
  144. params: params,
  145. loadType: true //加载类型,是否是下拉加载
  146. });
  147. },
  148. /**
  149. * 用户点击右上角分享
  150. */
  151. onShareAppMessage() {
  152. }
  153. })