index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // pages/home/index.js
  2. const imageCdn = 'https://tdesign.gtimg.com/miniprogram/images/';
  3. const swiperList = [
  4. `${imageCdn}/swiper1.png`,
  5. `${imageCdn}/swiper2.png`,
  6. `${imageCdn}/swiper3.png`,
  7. `${imageCdn}/swiper4.png`,
  8. `${imageCdn}/swiper5.png`,
  9. ];
  10. const app = getApp()
  11. import api from '../api/api'
  12. Page({
  13. /**
  14. * 页面的初始数据
  15. */
  16. data: {
  17. current: 0,
  18. autoplay: false,
  19. duration: 500,
  20. interval: 5000,
  21. swiperList,
  22. list: [],
  23. pageNumber: 1,
  24. pageSize: 20,
  25. status: '待接单',
  26. statistics: {}
  27. },
  28. /* 去详情 */
  29. toDetail(e) {
  30. console.log(e)
  31. const {
  32. item
  33. } = e.currentTarget.dataset;
  34. wx.navigateTo({
  35. url: (item.team.some(v => v.userid == wx.getStorageSync('userMsg').userid) ? '/Eservice/workOrderDetail/index' : '/Eservice/workerLeader/editworkOrderDetail/index') + '?id=' + item.sa_workorderid,
  36. })
  37. },
  38. async listData() {
  39. const res = await api._post({
  40. "id": "20230208140203",
  41. "version": 1,
  42. "content": {
  43. "pageNumber": this.data.pageNumber,
  44. "pageSize": this.data.pageSize,
  45. "where": {
  46. "status": this.data.status,
  47. "condition": ""
  48. }
  49. }
  50. })
  51. this.setData({
  52. statistics: res.data[0].rows_total[0]
  53. })
  54. if (!res.data[0].billno) return false;
  55. this.setData({
  56. list: this.data.list.concat(res.data)
  57. })
  58. console.log(this.data.statistics)
  59. },
  60. onTabsChange(e) {
  61. this.data.status = e.detail.value;
  62. this.onPullDownRefresh()
  63. },
  64. onLoad(options) {
  65. this.listData()
  66. },
  67. onShow() {
  68. this.setData({
  69. pageNumber: 1,
  70. })
  71. this.listData()
  72. },
  73. onPullDownRefresh() {
  74. this.setData({
  75. pageNumber: 1,
  76. list: []
  77. })
  78. this.listData()
  79. },
  80. onReachBottom() {
  81. this.data.pageNumber++
  82. this.setData({
  83. pageNumber: this.data.pageNumber,
  84. })
  85. this.listData()
  86. },
  87. })