xsh_1997 2 settimane fa
parent
commit
19429267c4

+ 3 - 3
ruoyi-jiaoyi/pages/home/index.vue

@@ -21,7 +21,7 @@ import SupplierHomePanel from '@/components/supplier/home-panel.vue'
21
 import DistributorHomePanel from '@/components/distributor/home-panel.vue'
21
 import DistributorHomePanel from '@/components/distributor/home-panel.vue'
22
 import GuestView from '@/components/partner/guest-view.vue'
22
 import GuestView from '@/components/partner/guest-view.vue'
23
 import { useUserStore } from '@/store/user'
23
 import { useUserStore } from '@/store/user'
24
-import { isDistributorRole, isSupplierRole } from '@/utils/partnerRole'
24
+import { isEffectiveDistributorRole, isEffectiveSupplierRole } from '@/utils/partnerRole'
25
 import { refreshTabPanelOnShow } from '@/utils/tabPanel'
25
 import { refreshTabPanelOnShow } from '@/utils/tabPanel'
26
 
26
 
27
 export default {
27
 export default {
@@ -55,8 +55,8 @@ export default {
55
       const userStore = useUserStore()
55
       const userStore = useUserStore()
56
       const roles = userStore.state.roles
56
       const roles = userStore.state.roles
57
       this.isLoggedIn = userStore.isLoggedIn()
57
       this.isLoggedIn = userStore.isLoggedIn()
58
-      this.isSupplier = isSupplierRole(roles)
59
-      this.isDistributor = isDistributorRole(roles)
58
+      this.isSupplier = isEffectiveSupplierRole(roles)
59
+      this.isDistributor = isEffectiveDistributorRole(roles)
60
     },
60
     },
61
     goLogin() {
61
     goLogin() {
62
       uni.navigateTo({ url: '/pages/login/index' })
62
       uni.navigateTo({ url: '/pages/login/index' })

+ 3 - 3
ruoyi-jiaoyi/pages/order/index.vue

@@ -21,7 +21,7 @@ import SupplierOrderPanel from '@/components/supplier/order-panel.vue'
21
 import DistributorOrderPanel from '@/components/distributor/order-panel.vue'
21
 import DistributorOrderPanel from '@/components/distributor/order-panel.vue'
22
 import GuestView from '@/components/partner/guest-view.vue'
22
 import GuestView from '@/components/partner/guest-view.vue'
23
 import { useUserStore } from '@/store/user'
23
 import { useUserStore } from '@/store/user'
24
-import { isDistributorRole, isSupplierRole } from '@/utils/partnerRole'
24
+import { isEffectiveDistributorRole, isEffectiveSupplierRole } from '@/utils/partnerRole'
25
 import { refreshTabPanelOnShow } from '@/utils/tabPanel'
25
 import { refreshTabPanelOnShow } from '@/utils/tabPanel'
26
 
26
 
27
 export default {
27
 export default {
@@ -49,8 +49,8 @@ export default {
49
       const userStore = useUserStore()
49
       const userStore = useUserStore()
50
       const roles = userStore.state.roles
50
       const roles = userStore.state.roles
51
       this.isLoggedIn = userStore.isLoggedIn()
51
       this.isLoggedIn = userStore.isLoggedIn()
52
-      this.isSupplier = isSupplierRole(roles)
53
-      this.isDistributor = isDistributorRole(roles)
52
+      this.isSupplier = isEffectiveSupplierRole(roles)
53
+      this.isDistributor = isEffectiveDistributorRole(roles)
54
     },
54
     },
55
     goLogin() {
55
     goLogin() {
56
       uni.navigateTo({ url: '/pages/login/index' })
56
       uni.navigateTo({ url: '/pages/login/index' })

+ 14 - 1
ruoyi-jiaoyi/utils/partnerRole.js

@@ -51,7 +51,10 @@ export function shouldDenyPartnerLogin(roles) {
51
   return !hasPartnerRole(roles)
51
   return !hasPartnerRole(roles)
52
 }
52
 }
53
 
53
 
54
-/** 当前登录用户的主身份:supplier | distributor | '' */
54
+/**
55
+ * 当前登录用户的主身份:supplier | distributor | ''
56
+ * 同时含 supplier 与 distributor 时固定为 supplier(界面与接口均走供应商)
57
+ */
55
 export function getPrimaryPartnerRole(roles) {
58
 export function getPrimaryPartnerRole(roles) {
56
   const list = normalizeRoles(roles).map((r) => roleKey(r))
59
   const list = normalizeRoles(roles).map((r) => roleKey(r))
57
   if (list.includes('supplier')) {
60
   if (list.includes('supplier')) {
@@ -63,6 +66,16 @@ export function getPrimaryPartnerRole(roles) {
63
   return ''
66
   return ''
64
 }
67
 }
65
 
68
 
69
+/** Tab 业务页是否展示供应商面板(双角色时不展示承销商) */
70
+export function isEffectiveSupplierRole(roles) {
71
+  return getPrimaryPartnerRole(roles) === 'supplier'
72
+}
73
+
74
+/** Tab 业务页是否展示承销商面板 */
75
+export function isEffectiveDistributorRole(roles) {
76
+  return getPrimaryPartnerRole(roles) === 'distributor'
77
+}
78
+
66
 /** 用户身份展示文案 */
79
 /** 用户身份展示文案 */
67
 export function getPartnerIdentityLabel(roles) {
80
 export function getPartnerIdentityLabel(roles) {
68
   const kind = getPrimaryPartnerRole(roles)
81
   const kind = getPrimaryPartnerRole(roles)