diff --git a/apis/commonApi.js b/apis/commonApi.js index f65ec0f..8f44412 100644 --- a/apis/commonApi.js +++ b/apis/commonApi.js @@ -28,11 +28,20 @@ let baseInfo = null function syncStore(res) { if (res.enterpriseList && res.enterpriseList.length > 0) { let supplierInfo = res.enterpriseList[0] + let vipExpireTime = supplierInfo.supplier.vipExpireTime + let isVip = false + if (vipExpireTime) { + let now = new Date().getTime() + if (now < new Date(vipExpireTime).getTime()) { + isVip = true + } + } store.commit('setSupplierInfo', { id: supplierInfo.id, name: supplierInfo.name, fddEnterpriseStatus: supplierInfo.fddEnterpriseStatus, - supplierId: supplierInfo.supplier.id + supplierId: supplierInfo.supplier.id, + isVip }) store.commit('setUserInfo', { name: supplierInfo.employeeName, userId: res.userId, mobile: res.mobile, avatar: null }) } diff --git a/pages/mine/index.vue b/pages/mine/index.vue index f86e802..a3ac149 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -275,7 +275,7 @@ export default { onShow() { getBaseInfo({}, true).then((res) => { if (res) { - this.companyNum = res.enterpriseList.length + this.companyNum = res.enterpriseList?.length || 1 } }) }, diff --git a/store/index.js b/store/index.js index bcb384a..a8b0258 100644 --- a/store/index.js +++ b/store/index.js @@ -15,11 +15,12 @@ let qnToken = null, * @value supplierId 供应商id * @value name 企业名称 * @value fddEnterpriseStatus 法大大认证状态 。1未认证,2认证进行中,3认证成功,4认证失败 + * @value isVip 是否是vip企业 */ supplierInfo = null, uecToken = null, searchHistory = null -const supplierInfoParams = ['id', 'name', 'fddEnterpriseStatus', 'supplierId'] +const supplierInfoParams = ['id', 'name', 'fddEnterpriseStatus', 'supplierId', 'isVip'] const userInfoParams = ['name', 'userId', 'mobile', 'avatar'] try { uecToken = uni.getStorageSync('uecToken')