index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // pages/agent/serviceBillList/index.js
  2. import api from '../../api/api'
  3. const app = getApp()
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. list:[],
  10. param:{
  11. "id": "20230206091703",
  12. "version":1,
  13. "content": {
  14. "pageSize":20,
  15. "pageNumber":1,
  16. "isadmin":true,
  17. "where":{
  18. "condition":"",
  19. "status":'待指派'
  20. }
  21. }
  22. }
  23. },
  24. async listData () {
  25. const res = await api._post(this.data.param)
  26. if (res.data.length > 0) {
  27. this.setData({
  28. list:this.data.list.concat(res.data)
  29. })
  30. } else {
  31. wx.showToast({
  32. title: '没有更多了!',
  33. duration: 2000,
  34. icon: 'none'
  35. })
  36. }
  37. },
  38. handleClick () {
  39. wx.navigateTo({
  40. url: '/pages/workerLeader/addServiceBill/index',
  41. })
  42. },
  43. onTabsChange (data) {
  44. this.data.param.content.where.status = data.detail.value
  45. this.data.param.content.pageNumber = 1
  46. this.data.list = []
  47. this.setData({
  48. param:this.data.param,
  49. list:[]
  50. })
  51. this.listData()
  52. },
  53. /**
  54. * 生命周期函数--监听页面加载
  55. */
  56. onLoad(options) {
  57. // this.listData()
  58. },
  59. /**
  60. * 生命周期函数--监听页面初次渲染完成
  61. */
  62. onReady() {
  63. },
  64. /**
  65. * 生命周期函数--监听页面显示
  66. */
  67. onShow() {
  68. this.data.param.content.pageNumber = 1
  69. this.data.list = []
  70. this.listData()
  71. },
  72. /**
  73. * 生命周期函数--监听页面隐藏
  74. */
  75. onHide() {
  76. },
  77. /**
  78. * 生命周期函数--监听页面卸载
  79. */
  80. onUnload() {
  81. },
  82. /**
  83. * 页面相关事件处理函数--监听用户下拉动作
  84. */
  85. onPullDownRefresh() {
  86. this.data.param.content.pageNumber = 1
  87. this.data.list = []
  88. this.listData()
  89. },
  90. /**
  91. * 页面上拉触底事件的处理函数
  92. */
  93. onReachBottom() {
  94. this.data.param.content.pageNumber ++
  95. this.listData()
  96. },
  97. /**
  98. * 用户点击右上角分享
  99. */
  100. onShareAppMessage() {
  101. }
  102. })