const app = getApp() const util = require("../../../utils/jmsUtil.js"); const api = require('../../../api/jms.js'); import moment from 'moment' Page({ data: { ticketList:[], totalPages:'', page:1, listQuery:{ status:'108', statusVal:'加盟商处理中', level:'', levelVal:'全部' }, selectVisible:false, columns:[], selectType:1, statusList:[ { text:'全部', value:'' }, { text:'待处理', value:'101' }, { text:'升级', value:'102' }, { text:'超时驳回', value:'103' }, { text:'重新打开', value:'104' }, { text:'等待客户上传图片', value:'106' }, { text:'客户已上传图片', value:'107' }, { text:'加盟商处理中', value:'108' }, { text:'加盟商已处理', value:'109' }, { text:'完成', value:'201' }, { text:'作废', value:'301' }, { text:'创建', value:'0' }, ], levelList:[ { text:'全部', value:'' }, { text:'无', value:'0' }, { text:'一般', value:'1' }, { text:'严重', value:'2' }, { text:'非常严重', value:'3' }, ], statusDesc: { 0: "创建", 1: "处理中", 2: "已完成", 3: "作废", }, substatusDesc: { 101: "待处理", 102: "升级", 103: "超时驳回", 104: "重新打开", 106: "等待客户上传图片", 107: "客户已上传图片", 108: "加盟商处理中", 109: "加盟商已处理", 201: "完成", 301: "作废", 0: "创建", }, typeTag: ["", "success", "warning", "danger"], levelMap: { 0: "无", 1: "一般", 2: "严重", 3: "非常严重", }, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getTicketList(); }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, showPicker(e){ let type=e.currentTarget.dataset.type; this.setData({ selectType:type, columns:type==1?this.data.statusList:this.data.levelList, selectVisible:true, }); }, onPickerConfirm(e){ console.log(e); if(this.data.selectType==1){ this.setData({ 'listQuery.statusVal':e.detail.value.text, 'listQuery.status':e.detail.value.value, }); }else{ this.setData({ 'listQuery.levelVal':e.detail.value.text, 'listQuery.level':e.detail.value.value, }); } this.setData({ selectVisible:false, page:1, ticketList:[] }); this.getTicketList(); }, onPickerCancel(){ this.setData({ selectVisible:false }); }, goDetail(e){ let id=e.currentTarget.dataset.id; wx.navigateTo({ url: '/pages/ticket/ticketDetail/ticketDetail?id='+id }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, onReachBottom() { if (this.data.totalPages > this.data.page) { this.setData({ page: this.data.page + 1 }); this.getTicketList(); } else if (this.data.ticketList.length > 0) { wx.showToast({ title: '没有更多工单了', icon: 'none', duration: 2000 }); return false; } }, getTicketList(){ util.request(api.TicketList, { page: this.data.page, limit: 10, substatus:this.data.listQuery.status, level:this.data.listQuery.level }, 'GET').then(res=>{ if (res.errno == 0) { this.setData({ totalPages:res.data.pages, ticketList:this.data.ticketList.concat(res.data.list) }); }else{ wx.showToast({ title: res.errmsg, icon:'none' }) } }); }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, })