diff --git a/pages/user/index.vue b/pages/user/index.vue index 726353f..382a52a 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -13,7 +13,7 @@ - 未登录 + 未登录 @@ -61,23 +61,23 @@ - + 全部订单 - + 待付款 - + 待发货 - + 待收货 - + 已完成 @@ -135,11 +135,9 @@ getInfo(){ if(this.$store.state.token === '') return info().then(res => { - console.log(res) uni.setNavigationBarTitle({ title: res.nickname }) - this.userInfo = res }).catch(err => { uni.showToast({ @@ -150,57 +148,55 @@ }, // 开通会员 openVip(){ - if(this.$store.state.token === ''){ - this.Login() - return - } - uni.showActionSheet({ - itemList: ["我是新用户", "我是老用户"], - success: res=> { - switch (res.tapIndex){ - case 0: - uni.showModal({ - title: '开通提示', - content: '平台新用户完成手笔订单,即可获赠ZH健康会员', - showCancel:false, - cancelText: '去完成', - success: res => { - console.log(res) - this.$Router.pushTab({name: 'Store'}) - } - }) - break; - case 1: - uni.showToast({ - title: '老用户渠道暂未开放', - icon : 'none' - }) - break; + if(this.isLogin()){ + uni.showActionSheet({ + itemList: ["我是新用户", "我是老用户"], + success: res=> { + switch (res.tapIndex){ + case 0: + uni.showModal({ + title: '开通提示', + content: '平台新用户完成手笔订单,即可获赠ZH健康会员', + showCancel:false, + cancelText: '去完成', + success: res => { + console.log(res) + this.$Router.pushTab({name: 'Store'}) + } + }) + break; + case 1: + uni.showToast({ + title: '老用户渠道暂未开放', + icon : 'none' + }) + break; + } } - } - }) + }) + } }, // 开通钱包 onWallet(){ - if(this.$store.state.token === ''){ - this.Login() - return + if(this.isLogin()){ + if(this.userInfo.is_wallet) this.$Router.push({name: 'WalletProperty'}) + else this.$Router.push({name: 'WalletAdd'}) } - if(this.userInfo.is_wallet) this.$Router.push({name: 'WalletProperty'}) - else this.$Router.push({name: 'WalletAdd'}) }, // 按钮导航 onBtn(name, params){ - if(this.$store.state.token === ''){ - this.Login() - return + if(this.isLogin()){ + this.$Router.push({name, params}) } - this.$Router.push({name, params}) }, - // 登录 - Login(){ - const Auth = new userAuth() - Auth.Login() + // 检查登录 + isLogin(){ + if(this.$store.state.token === ''){ + const Auth = new userAuth() + Auth.Login() + return false + } + return true }, // 退出登录 logOut(){