const app = getApp() const util = require("../../../utils/jmsUtil.js"); const api = require('../../../api/jms.js'); Page({ noop() { }, data: { userInfo: { userName: '', headImg: '', fraName: '', }, serviceOrder: '', ticket: '', aftersale: '', wmsOrderCount: '', showFraWeekReportFlag: false, fraWeekReportId: null }, onPageScroll(e) { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let userInfo = wx.getStorageSync('userInfo'); console.log(userInfo); app.globalData.userInfo = userInfo; this.setData({ userInfo: userInfo }); }, getHomeInfo() { util.request(api.GetHomeInfo, {}, 'GET').then(res => { if (res.errno === 0) { this.setData({ serviceOrder: res.data.serviceOrder, ticket: res.data.ticket, aftersale: res.data.aftersale, wmsOrderCount: res.data.wmsOrderCount, showFraWeekReportFlag: res.data.showFraWeekReportFlag, fraWeekReportId: res.data.fraWeekReportId }) } else { wx.showToast({ title: res.errmsg, icon: 'none' }) } }); }, closePopup() { console.log('closePopup'); this.setData({ showFraWeekReportFlag: false }) }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getHomeInfo(); }, onHide: function () { console.log('onHide'); }, onUnload: function () { console.log('onunload'); }, /** * 页面相关事件处理函数--监听用户下拉动作 */ exitLogin: function () { wx.showModal({ title: '', confirmColor: '#b4282d', content: '退出登录?', success: function (res) { if (!res.confirm) { return; } // util.request(api.AuthLogout, {}, 'POST'); app.globalData.hasLogin = false; wx.removeStorageSync('token'); wx.removeStorageSync('userInfo'); // wx.redirectTo({ // url: '/pages/temp/login/login' // }); wx.redirectTo({ url: '/pages/index/index' }); } }) }, goService() { wx.navigateTo({ url: '/pages/temp/orderBoard/orderBoard' }); }, goTicket() { wx.navigateTo({ url: '/pages/ticket/ticketList/ticketList' }); }, goRefund() { wx.navigateTo({ url: '/pages/refund/refundList/refundList' }); }, goMall() { wx.navigateTo({ url: '/pages/mall/catalog/catalog' }); }, goOrder() { wx.navigateTo({ url: '/pages/mall/order/order' }); }, goWeekData(e) { let type=e.target.dataset.type if(type==2){ let params={dataId:this.data.fraWeekReportId} util.request(api.readWeekReport, params, 'get').then(res => { if (res.errno === 0) { } else { wx.showToast({ title: res.errmsg, icon: 'none' }) } }); } wx.navigateTo({ url: '/pages/temp/fraWeekReport/fraWeekReport?id=' + this.data.fraWeekReportId, }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, })