index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. "id": 20230208140203,
  5. "content": {
  6. "nocache": true,
  7. "pageNumber": 1,
  8. "pageSize": 20,
  9. "where": {
  10. "status": ['待接单'], //工单状态,可多选
  11. "type": "", //工单类型
  12. "servicetype": "", //服务类型
  13. "begindate": "", //创建时间
  14. "enddate": "" //创建时间
  15. },
  16. },
  17. tabColorS: {
  18. 售前: {
  19. bgColor: "#E1EAFE",
  20. color: "#3874F6"
  21. },
  22. 售中: {
  23. bgColor: "#FEF0E1",
  24. color: "#F69E38"
  25. },
  26. 售后: {
  27. bgColor: "#FCE4E4",
  28. color: "#ED4949"
  29. },
  30. 紧急: {
  31. bgColor: "#FCE4E4",
  32. color: "#ED4949"
  33. },
  34. 历史售后: {
  35. bgColor: "#eeeeee",
  36. color: "#888888"
  37. }
  38. },
  39. filtratelist: []
  40. },
  41. async onLoad(options) {
  42. this.getList()
  43. getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
  44. let filtratelist = [{
  45. label: "工单类型",
  46. index: null,
  47. showName: "value", //显示字段
  48. valueKey: "type", //返回Key
  49. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  50. value: "", //选中值
  51. list: await _Http.getTypes('serviceworktype', _Http)
  52. }, {
  53. label: "服务类型",
  54. index: null,
  55. showName: "value", //显示字段
  56. valueKey: "servicetype", //返回Key
  57. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  58. value: "", //选中值
  59. list: await _Http.basic({
  60. id: 20230206112003,
  61. "content": {},
  62. }).then(res => {
  63. console.log("获取服务类型", res)
  64. return res.code == 1 ? res.data : []
  65. })
  66. }]
  67. this.setData({
  68. filtratelist
  69. })
  70. },
  71. getList(init = false) {
  72. _Http.init(this.data.content, init).then(content => {
  73. _Http.basic({
  74. id: this.data.id,
  75. content
  76. }).then(res => {
  77. console.log("工单列表", res)
  78. this.selectComponent('#ListBox').RefreshToComplete();
  79. if (res.code != '1') return wx.showToast({
  80. title: res.msg,
  81. icon: "none"
  82. })
  83. this.setData({
  84. content: _Http.paging(content, res),
  85. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  86. })
  87. })
  88. })
  89. },
  90. onSearch({
  91. detail
  92. }) {
  93. this.data.content.where.condition = detail;
  94. this.getList(true)
  95. },
  96. onChangeTab({
  97. detail
  98. }) {
  99. let value = [detail.title];
  100. delete this.data.content.where.isconfirmation;
  101. if (detail.title == '已确认') {
  102. value = []
  103. this.data.content.where.isconfirmation = 1;
  104. }
  105. this.setData({
  106. 'content.where.status': value,
  107. })
  108. this.getList(true)
  109. },
  110. handleFilter({
  111. detail
  112. }) {
  113. detail.condition = this.data.content.where.condition;
  114. detail.status = this.data.content.where.status;
  115. detail.begindate = detail.startdate;
  116. detail.enddate = detail.enddate;
  117. delete detail.startdate;
  118. delete detail.enddate;
  119. this.data.content.where = detail;
  120. this.getList(true);
  121. },
  122. })