index.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. const imageCdn = 'https://tdesign.gtimg.com/miniprogram/images/';
  2. const swiperList = [
  3. `${imageCdn}/swiper1.png`,
  4. `${imageCdn}/swiper2.png`,
  5. `${imageCdn}/swiper3.png`,
  6. `${imageCdn}/swiper4.png`,
  7. `${imageCdn}/swiper5.png`,
  8. ];
  9. const app = getApp()
  10. import api from '../api/api'
  11. Page({
  12. data: {
  13. current: 0,
  14. autoplay: false,
  15. duration: 500,
  16. interval: 5000,
  17. swiperList,
  18. list: [],
  19. pageNumber: 1,
  20. pageSize: 20,
  21. status: '待接单',
  22. statistics: {}
  23. },
  24. /* 去详情 */
  25. toDetail(e) {
  26. const {
  27. item
  28. } = e.currentTarget.dataset;
  29. console.log(item)
  30. api._post({
  31. "id": 2025062416033402,
  32. "content": {
  33. "userid": wx.getStorageSync('userMsg').userid,
  34. "sa_workorderid": item.sa_workorderid,
  35. },
  36. }).then(res => {
  37. console.log("查询权限", res)
  38. if (res.code == 1) {
  39. wx.navigateTo({
  40. url: (res.data.isteamleader || res.data.isworkleader ? '/Eservice/workerLeader/editworkOrderDetail/index' : '/Eservice/workOrderDetail/index') + '?id=' + item.sa_workorderid,
  41. })
  42. } else {
  43. wx.navigateTo({
  44. url: (item.isleader ? '/Eservice/workerLeader/editworkOrderDetail/index' : '/Eservice/workOrderDetail/index') + '?id=' + item.sa_workorderid,
  45. })
  46. }
  47. })
  48. },
  49. async listData() {
  50. const res = await api._post({
  51. "id": "20230208140203",
  52. "version": 1,
  53. "content": {
  54. "pageNumber": this.data.pageNumber,
  55. "pageSize": this.data.pageSize,
  56. "where": {
  57. "status": this.data.status,
  58. "condition": ""
  59. }
  60. }
  61. })
  62. console.log(res)
  63. this.setData({
  64. statistics: res.data[0].rows_total[0]
  65. })
  66. if (!res.data[0].billno) return false;
  67. this.setData({
  68. list: this.data.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  69. })
  70. console.log(this.data.statistics)
  71. },
  72. onTabsChange(e) {
  73. this.data.status = e.detail.value;
  74. this.onPullDownRefresh()
  75. },
  76. onLoad(options) {
  77. this.listData()
  78. this.setData({
  79. loadingTexts: ['下拉刷新', '松手刷新', '正在刷新', '刷新完成'].map(v => getApp().globalData.Language.getMapText(v))
  80. })
  81. getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
  82. },
  83. onShow() {
  84. this.setData({
  85. pageNumber: 1,
  86. })
  87. this.listData()
  88. },
  89. onPullDownRefresh() {
  90. this.setData({
  91. pageNumber: 1,
  92. list: []
  93. })
  94. this.listData()
  95. },
  96. onReachBottom() {
  97. this.data.pageNumber++
  98. this.setData({
  99. pageNumber: this.data.pageNumber,
  100. })
  101. this.listData()
  102. },
  103. })