ticketList.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. const app = getApp()
  2. const util = require("../../../utils/jmsUtil.js");
  3. const api = require('../../../api/jms.js');
  4. import moment from 'moment'
  5. Page({
  6. data: {
  7. ticketList:[],
  8. totalPages:'',
  9. page:1,
  10. listQuery:{
  11. status:'108',
  12. statusVal:'加盟商处理中',
  13. level:'',
  14. levelVal:'全部'
  15. },
  16. selectVisible:false,
  17. columns:[],
  18. selectType:1,
  19. statusList:[
  20. {
  21. text:'全部',
  22. value:''
  23. },
  24. {
  25. text:'待处理',
  26. value:'101'
  27. },
  28. {
  29. text:'升级',
  30. value:'102'
  31. },
  32. {
  33. text:'超时驳回',
  34. value:'103'
  35. },
  36. {
  37. text:'重新打开',
  38. value:'104'
  39. },
  40. {
  41. text:'等待客户上传图片',
  42. value:'106'
  43. },
  44. {
  45. text:'客户已上传图片',
  46. value:'107'
  47. },
  48. {
  49. text:'加盟商处理中',
  50. value:'108'
  51. },
  52. {
  53. text:'加盟商已处理',
  54. value:'109'
  55. },
  56. {
  57. text:'完成',
  58. value:'201'
  59. },
  60. {
  61. text:'作废',
  62. value:'301'
  63. },
  64. {
  65. text:'创建',
  66. value:'0'
  67. },
  68. ],
  69. levelList:[
  70. {
  71. text:'全部',
  72. value:''
  73. },
  74. {
  75. text:'无',
  76. value:'0'
  77. },
  78. {
  79. text:'一般',
  80. value:'1'
  81. },
  82. {
  83. text:'严重',
  84. value:'2'
  85. },
  86. {
  87. text:'非常严重',
  88. value:'3'
  89. },
  90. ],
  91. statusDesc: {
  92. 0: "创建",
  93. 1: "处理中",
  94. 2: "已完成",
  95. 3: "作废",
  96. },
  97. substatusDesc: {
  98. 101: "待处理",
  99. 102: "升级",
  100. 103: "超时驳回",
  101. 104: "重新打开",
  102. 106: "等待客户上传图片",
  103. 107: "客户已上传图片",
  104. 108: "加盟商处理中",
  105. 109: "加盟商已处理",
  106. 201: "完成",
  107. 301: "作废",
  108. 0: "创建",
  109. },
  110. typeTag: ["", "success", "warning", "danger"],
  111. levelMap: {
  112. 0: "无",
  113. 1: "一般",
  114. 2: "严重",
  115. 3: "非常严重",
  116. },
  117. },
  118. /**
  119. * 生命周期函数--监听页面加载
  120. */
  121. onLoad: function (options) {
  122. this.getTicketList();
  123. },
  124. /**
  125. * 生命周期函数--监听页面显示
  126. */
  127. onShow: function () {
  128. },
  129. showPicker(e){
  130. let type=e.currentTarget.dataset.type;
  131. this.setData({
  132. selectType:type,
  133. columns:type==1?this.data.statusList:this.data.levelList,
  134. selectVisible:true,
  135. });
  136. },
  137. onPickerConfirm(e){
  138. console.log(e);
  139. if(this.data.selectType==1){
  140. this.setData({
  141. 'listQuery.statusVal':e.detail.value.text,
  142. 'listQuery.status':e.detail.value.value,
  143. });
  144. }else{
  145. this.setData({
  146. 'listQuery.levelVal':e.detail.value.text,
  147. 'listQuery.level':e.detail.value.value,
  148. });
  149. }
  150. this.setData({
  151. selectVisible:false,
  152. page:1,
  153. ticketList:[]
  154. });
  155. this.getTicketList();
  156. },
  157. onPickerCancel(){
  158. this.setData({
  159. selectVisible:false
  160. });
  161. },
  162. goDetail(e){
  163. let id=e.currentTarget.dataset.id;
  164. wx.navigateTo({
  165. url: '/pages/ticket/ticketDetail/ticketDetail?id='+id
  166. });
  167. },
  168. /**
  169. * 生命周期函数--监听页面初次渲染完成
  170. */
  171. onReady: function () {
  172. },
  173. onReachBottom() {
  174. if (this.data.totalPages > this.data.page) {
  175. this.setData({
  176. page: this.data.page + 1
  177. });
  178. this.getTicketList();
  179. } else if (this.data.ticketList.length > 0) {
  180. wx.showToast({
  181. title: '没有更多工单了',
  182. icon: 'none',
  183. duration: 2000
  184. });
  185. return false;
  186. }
  187. },
  188. getTicketList(){
  189. util.request(api.TicketList, {
  190. page: this.data.page,
  191. limit: 10,
  192. substatus:this.data.listQuery.status,
  193. level:this.data.listQuery.level
  194. }, 'GET').then(res=>{
  195. if (res.errno == 0) {
  196. this.setData({
  197. totalPages:res.data.pages,
  198. ticketList:this.data.ticketList.concat(res.data.list)
  199. });
  200. }else{
  201. wx.showToast({
  202. title: res.errmsg,
  203. icon:'none'
  204. })
  205. }
  206. });
  207. },
  208. /**
  209. * 用户点击右上角分享
  210. */
  211. onShareAppMessage: function () {
  212. },
  213. })