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:'1', }, selectVisible:false, columns:[], selectType:1, statusList:[ { text:'全部', value:'0' }, { text:'待审核', value:'1' }, { text:'审核通过', value:'2' }, { text:'审核未通过', value:'4' }, { text:'退款成功', value:'3' }, ], statusDesc: { 0: "", 1: "待审核", 2: "审核通过", 3: "退款成功", 4: "审核未通过", 5:"退款失败" }, typeTag: ["", "primary","success","success", "warning", "warning"], 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; let orderId=e.currentTarget.dataset.orderid; let info=e.currentTarget.dataset.info; app.globalData.refundDetail=info; wx.navigateTo({ url: '/pages/refund/refundDetail/refundDetail?id='+id+"&orderId="+orderId }); }, /** * 生命周期函数--监听页面初次渲染完成 */ 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; } }, onChange(e){ this.setData({ 'listQuery.status':e.detail.name, 'listQuery.page':1, ticketList:[] }); this.getTicketList(); }, getTicketList(){ util.request(api.GetAfterSaleList, { pageNo: this.data.page, pageSize: 10, status:this.data.listQuery.status, }, 'POST').then(res=>{ if (res.errno == 0) { this.setData({ totalPages:Math.ceil(res.data.total/10), ticketList:this.data.ticketList.concat(res.data.list) }); }else{ wx.showToast({ title: res.errmsg, icon:'none' }) } }); }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, })