diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 353428f..5d85d1a 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -42,6 +42,33 @@ Component({ console.log('修正后路径:', url) + // 当点击"估"字时,判断partnerstatus是否为approved + if (key === 'evaluate') { + const app = getApp() + const userInfo = app.globalData.userInfo || wx.getStorageSync('userInfo') || {} + const partnerstatus = userInfo.partnerstatus + + console.log('用户partnerstatus:', partnerstatus) + + // 如果partnerstatus不是approved,提示用户并跳转到入驻页面 + if (partnerstatus !== 'approved') { + wx.showToast({ + title: '该功能需要入驻之后才能使用', + icon: 'none', + duration: 5000 + }) + + // 5秒后自动跳转到入驻页面 + setTimeout(() => { + wx.navigateTo({ + url: '/pages/settlement/index' + }) + }, 5000) + + return + } + } + // 更新全局数据 - 先更新全局状态,确保状态一致性 const app = getApp() if (app && app.globalData) { @@ -179,6 +206,32 @@ Component({ // 跳转到估价页面 goToEvaluatePage() { console.log('点击了估价按钮,跳转到evaluate2/one页面') + + // 判断partnerstatus是否为approved + const app = getApp() + const userInfo = app.globalData.userInfo || wx.getStorageSync('userInfo') || {} + const partnerstatus = userInfo.partnerstatus + + console.log('用户partnerstatus:', partnerstatus) + + // 如果partnerstatus不是approved,提示用户并跳转到入驻页面 + if (partnerstatus !== 'approved') { + wx.showToast({ + title: '该功能需要入驻之后才能使用', + icon: 'none', + duration: 5000 + }) + + // 5秒后自动跳转到入驻页面 + setTimeout(() => { + wx.navigateTo({ + url: '/pages/settlement/index' + }) + }, 5000) + + return + } + wx.switchTab({ url: '/pages/evaluate2/one', success: (res) => {