index.js 1.8 KB

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