index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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, '工单');
  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. label: "客诉大类",
  68. index: null,
  69. showName: "value", //显示字段
  70. valueKey: "class2", //返回Key
  71. selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
  72. value: "", //选中值
  73. list: await _Http.getTypes('customerclass', _Http)
  74. }, {
  75. label: "是否外包",
  76. index: null,
  77. showName: "value", //显示字段
  78. valueKey: "isout", //返回Key
  79. selectKey: "id", //传参 代表选着字段 不传参返回整个选择对象
  80. value: "", //选中值
  81. list: [{
  82. id: 1,
  83. value: '是'
  84. }, {
  85. id: 0,
  86. value: '否'
  87. }]
  88. }]
  89. this.setData({
  90. filtratelist
  91. })
  92. },
  93. getList(init = false) {
  94. _Http.init(this.data.content, init).then(content => {
  95. _Http.basic({
  96. id: this.data.id,
  97. content
  98. }).then(res => {
  99. console.log("工单列表", res)
  100. this.selectComponent('#ListBox').RefreshToComplete();
  101. if (res.code != '1') return wx.showToast({
  102. title: res.msg,
  103. icon: "none"
  104. })
  105. this.setData({
  106. content: _Http.paging(content, res),
  107. list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
  108. })
  109. })
  110. })
  111. },
  112. onSearch({
  113. detail
  114. }) {
  115. this.data.content.where.condition = detail;
  116. this.getList(true)
  117. },
  118. onChangeTab({
  119. detail
  120. }) {
  121. let value = [detail.title];
  122. delete this.data.content.where.isconfirmation;
  123. if (detail.title == '已确认') {
  124. value = []
  125. this.data.content.where.isconfirmation = 1;
  126. }
  127. this.setData({
  128. 'content.where.status': value,
  129. })
  130. this.getList(true)
  131. },
  132. handleFilter({
  133. detail
  134. }) {
  135. detail.condition = this.data.content.where.condition;
  136. detail.status = this.data.content.where.status;
  137. detail.begindate = detail.startdate;
  138. detail.enddate = detail.enddate;
  139. detail.begindate2 = detail.startdate;
  140. detail.enddate2 = detail.enddate;
  141. delete detail.startdate;
  142. delete detail.enddate;
  143. delete detail.periodstart;
  144. delete detail.periodend;
  145. this.data.content.where = detail;
  146. this.getList(true);
  147. },
  148. })