index.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. // pages/weighingRecord/list.js
  2. const app = getApp()
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. str:' ',
  9. showModal: false,
  10. pageType: true,
  11. loginStatus: wx.getStorageSync('loginStatus') ? wx.getStorageSync('loginStatus') : false,
  12. roleCodeList: wx.getStorageSync('roleCodeList') ? wx.getStorageSync('roleCodeList') : '',
  13. activeIndex: '',
  14. //分页
  15. limit: 10,
  16. requestStatu: '加载中...',
  17. page: 1,
  18. totalPages: 1,
  19. more: false,
  20. nomore: '',
  21. searchVal: '', //筛选条件
  22. //筛选E
  23. resData: [],
  24. //审核
  25. approveType: '',
  26. depotOpApprovalState: '通过',
  27. show: false,
  28. index:0,
  29. },
  30. //展示子过磅记录
  31. showPopup(e) {
  32. this.setData({ show: true, index:e.currentTarget.dataset.index });
  33. },
  34. onClose() {
  35. this.setData({ show: false });
  36. },
  37. //去登录页面
  38. toLogin(e) {
  39. wx.navigateTo({
  40. url: '../login/index',
  41. })
  42. },
  43. //变动筛选条件时
  44. changeFilter: function (e) {
  45. let getFilterType = e.currentTarget.dataset.filtertype + 'Value'
  46. this.setData({
  47. [getFilterType]: e.detail
  48. })
  49. //重新请求
  50. this.getListFun();
  51. },
  52. /**
  53. * 生命周期函数--监听页面加载
  54. */
  55. onLoad: function (options) {
  56. },
  57. //点击选项卡变化
  58. changeTypeFun: function (e) {
  59. this.setData({
  60. activeIndex: Number(e.currentTarget.dataset.type)
  61. })
  62. this.getListFun();
  63. },
  64. /**
  65. * 生命周期函数--监听页面初次渲染完成
  66. */
  67. onReady: function () {
  68. },
  69. /**
  70. * 生命周期函数--监听页面显示
  71. */
  72. onShow: function () {
  73. const roleCodeList = wx.getStorageSync('roleCodeList')
  74. let loginStatus = wx.getStorageSync('loginStatus')
  75. this.setData({
  76. searchVal: '',
  77. roleCodeList: roleCodeList ? roleCodeList : '',
  78. loginStatus: loginStatus ? loginStatus : false
  79. })
  80. //动态tabbar
  81. // let selected = 1
  82. // if (roleCodeList == 'bizAdmin') {
  83. // this.getTabBar().setData({
  84. // list: app.globalData.allList[0].list2,
  85. // })
  86. // selected = 3
  87. // } else if(roleCodeList == 'send') {
  88. // this.getTabBar().setData({
  89. // list: app.globalData.allList[0].list3,
  90. // })
  91. // } else if(roleCodeList == 'sale') {
  92. // this.getTabBar().setData({
  93. // list: app.globalData.allList[0].list4,
  94. // })
  95. // }else if(roleCodeList == 'customer') {
  96. // this.getTabBar().setData({
  97. // list: app.globalData.allList[0].list5,
  98. // })
  99. // } else if (roleCodeList=='driver'||roleCodeList==''){
  100. // this.getTabBar().setData({
  101. // list: app.globalData.allList[0].list1,
  102. // })
  103. // }
  104. // if (typeof this.getTabBar === 'function' && this.getTabBar()) {
  105. // this.getTabBar().setData({
  106. // selected: selected
  107. // })
  108. // }
  109. if (wx.getStorageSync('loginStatus')) {
  110. this.getListFun();
  111. }
  112. },
  113. //搜索框请求S
  114. onChange(e) {
  115. this.setData({
  116. searchVal: e.detail,
  117. });
  118. },
  119. onSearch: function (event) {
  120. this.setData({
  121. searchVal: event.detail
  122. })
  123. this.getListFun();
  124. },
  125. onCancel: function () {
  126. this.setData({})
  127. },
  128. tocodeInfo:function(e){
  129. wx.navigateTo({
  130. url: e.currentTarget.dataset.url
  131. })
  132. },
  133. //列表
  134. getListFun: function () {
  135. this.setData({
  136. page: 1
  137. })
  138. let params = {
  139. current: this.data.page,
  140. size: this.data.limit,
  141. licensePlate:this.data.searchVal
  142. }
  143. app.request.pageFirst({
  144. url: app.API.recordList,
  145. page: this,
  146. params: params,
  147. })
  148. },
  149. //页面跳转
  150. toLink: function (e) {
  151. let { url } = e.currentTarget.dataset
  152. wx.navigateTo({
  153. url: url
  154. })
  155. },
  156. /**
  157. * 生命周期函数--监听页面隐藏
  158. */
  159. onHide: function () {
  160. },
  161. /**
  162. * 生命周期函数--监听页面卸载
  163. */
  164. onUnload: function () {
  165. },
  166. /**
  167. * 页面相关事件处理函数--监听用户下拉动作
  168. */
  169. onPullDownRefresh: function () {
  170. this.setData({
  171. searchVal: ''
  172. })
  173. if (wx.getStorageSync('loginStatus')) {
  174. this.getListFun();
  175. } else {
  176. wx.stopPullDownRefresh();
  177. }
  178. },
  179. /**
  180. * 页面上拉触底事件的处理函数
  181. */
  182. onReachBottom: function () {
  183. this.data.page++;
  184. let params = {
  185. current: this.data.page,
  186. size: this.data.limit,
  187. licensePlate:this.data.searchVal
  188. }
  189. app.request.pageOther({
  190. url: app.API.recordList,
  191. page: this,
  192. params: params,
  193. loadType: true //加载类型,是否是下拉加载
  194. });
  195. },
  196. /**
  197. * 用户点击右上角分享
  198. */
  199. onShareAppMessage: function () {
  200. }
  201. })