From 6f434e41bbf337375b24e93152dd1b8508dceb93 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Fri, 5 Jul 2024 10:56:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/oil-finance.js | 8 +++++++ pages/tabbar/home/home.vue | 49 ++++++++++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/api/oil-finance.js b/api/oil-finance.js index 2d32a6b..a4309b3 100644 --- a/api/oil-finance.js +++ b/api/oil-finance.js @@ -17,6 +17,14 @@ export default { method: 'GET', }) }, + // 返回当前油卡信息 + getInfoByParam(params) { + return request({ + url: '/oil-finance/oilCustomerCompanyAccount/getInfoByParam', + method: 'POST', + data:params + }) + }, //确认切换油卡 chooseCompanyCard(data) { return request({ diff --git a/pages/tabbar/home/home.vue b/pages/tabbar/home/home.vue index 15b15e9..d56fb77 100644 --- a/pages/tabbar/home/home.vue +++ b/pages/tabbar/home/home.vue @@ -170,6 +170,7 @@ import msgModels from '../../components/showModels.vue' import accountApi from '@/api/account.js' import Financial from '@/api/Financial.js' + import financeServe from '@/api/oil-finance.js' import threeSites from '@/components/three-sites.vue' import oilSiteApi from '@/api/oil-site.js' import siteItem from '@/components/site-item/site-item.vue' @@ -333,8 +334,8 @@ }, onReady() { - - + + let _that = this let IsOtherUser = _that.isOther if (IsOtherUser) { @@ -366,7 +367,7 @@ }, onLoad(e) { // uni.hideTabBar() - + let _that = this let IsOtherUser = _that.isOther @@ -410,6 +411,7 @@ const openid = uni.getStorageSync('openid') if (token && openid) { this.getAuthInfo() + this.refreshLocation() } else { uni.showToast({ @@ -425,6 +427,42 @@ }, methods: { + logOut() { + accountApi.logout('authSystem').then(res => { + if (res.code == '20000') { + uni.showToast({ + title: '该油卡已被禁用', + icon:'none' + }) + uni.clearStorageSync() + uni.setStorageSync('loginOut', true) + setTimeout(() => { + uni.reLaunch({ + url: '/BagAuth/pages/login/login' + }) + }, 2000) + } + }) + }, + getInfoByParam() { + let storage = uni.getStorageSync('companyCard') + if (storage) { + let cardInfo = JSON.parse(storage) + // console.log('cardInfo',cardInfo) + financeServe.getInfoByParam({ + companyId: cardInfo.companyId, + customerId: cardInfo.customerId + }).then(res => { + if (res.code === 20000) { + if(res.data.accountState == 0) { + this.logOut() + } + } + }) + } + + + }, swiperClick(item, index) { if (item?.JumpPage) { switch (item.JumpPage) { @@ -519,7 +557,8 @@ } this.getAmount() this.getSiteList() - // realStatus: 0 vehicleStatus: 0 + this.getInfoByParam() + if (this.showAuthFrzen <= new Date().getTime()) { this.showAuthFrror = res.data.realStatus && res.data.vehicleStatus ? false : true @@ -1040,4 +1079,4 @@ .my-icon-sm .text-sm { line-height: 1rem; } - + \ No newline at end of file