| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- // pages/user/info/info.js
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- userInfo: wx.getStorageSync('userInfo') || {},
- company: wx.getStorageSync('company') || {},
- logout: wx.getStorageSync('logout') || app.globalData.logout || false,
- showChangeCompanyName: wx.getStorageSync('showChangeCompanyName'),
- menuList: [{
- name: "已发货",
- value: 3,
- icon: "icon-yifahuo2"
- },
- {
- name: "已签收",
- value: 4,
- icon: "icon-yiqianshou"
- },
- {
- name: "已取消",
- value: 5,
- icon: "icon-yiquxiao2"
- },
- {
- name: "全部订单",
- value: '',
- icon: "icon-quanbudingdan"
- },
- ]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- // if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- // let userInfo = wx.getStorageSync('userInfo');
- // if (userInfo && userInfo.userId) {
- // app.globalData.tabbar.list[0].show = false;
- // } else {
- // app.globalData.tabbar.list[0].show = true;
- // }
- // this.getTabBar().setData({
- // selectIndex: 4,
- // tabbar: app.globalData.tabbar
- // })
- // }
- },
- autoLogin1() {
- // app.globalData.changeCompanyName = true;
- app.globalData.innerShow = true;
- return;
- },
- async ok() {
- try {
- await app.autoLogin();
- await this.onShow();
- } catch (e) {
- console.error(e);
- wx.navigateTo({
- url: '/pages/login/login',
- })
- } finally {
- app.globalData.innerShow = false;
- }
- },
- async ok1() {
- try {
- await app.autoLogin();
- await this.onShow();
- } catch (e) {
- console.error(e);
- wx.navigateTo({
- url: '/pages/login/login',
- })
- } finally {
- app.globalData.innerShow = false;
- }
- },
- /**
- * 生命周期函数--监听页面显示
- */
- async onShow() {
- setTimeout(() => {
- wx.setNavigationBarTitle({
- title: app.globalData.tabbar.list[3].text,
- });
- }, 500);
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- // let userInfo = wx.getStorageSync('userInfo');
- // if (userInfo && userInfo.userId) {
- // app.globalData.tabbar.list[0].show = false;
- // } else {
- // app.globalData.tabbar.list[0].show = true;
- // }
- setTimeout(() => {
- this.getTabBar().setData({
- selectIndex: 3,
- tabbar: app.globalData.tabbar
- })
- }, 500);
- }
- // await app.autoLogin();
- // this.setData({
- // userInfo: wx.getStorageSync('userInfo'),
- // company: wx.getStorageSync('company'),
- // })
- let logout = wx.getStorageSync('logout') || app.globalData.logout || false;
- this.setData({
- userInfo: wx.getStorageSync('userInfo'),
- company: wx.getStorageSync('company'),
- companyName: wx.getStorageSync('companyName'),
- virtualInventoryName: wx.getStorageSync('virtualInventoryName'),
- showChangeCompanyName: wx.getStorageSync('showChangeCompanyName'),
- logout
- });
- if (logout) {
- return;
- }
- if (!wx.getStorageSync('userInfo')) {
- return;
- }
- await app.getUserInfo(this);
- this.setData({
- userInfo: wx.getStorageSync('userInfo'),
- company: wx.getStorageSync('company'),
- })
- },
- changeCompanyName() {
- app.globalData.changeCompanyName = true;
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|