Kaynağa Gözat

交易市场h5

xsh_1997 2 hafta önce
ebeveyn
işleme
19429267c4

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

@@ -21,7 +21,7 @@ import SupplierHomePanel from '@/components/supplier/home-panel.vue'
21 21
 import DistributorHomePanel from '@/components/distributor/home-panel.vue'
22 22
 import GuestView from '@/components/partner/guest-view.vue'
23 23
 import { useUserStore } from '@/store/user'
24
-import { isDistributorRole, isSupplierRole } from '@/utils/partnerRole'
24
+import { isEffectiveDistributorRole, isEffectiveSupplierRole } from '@/utils/partnerRole'
25 25
 import { refreshTabPanelOnShow } from '@/utils/tabPanel'
26 26
 
27 27
 export default {
@@ -55,8 +55,8 @@ export default {
55 55
       const userStore = useUserStore()
56 56
       const roles = userStore.state.roles
57 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 61
     goLogin() {
62 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 21
 import DistributorOrderPanel from '@/components/distributor/order-panel.vue'
22 22
 import GuestView from '@/components/partner/guest-view.vue'
23 23
 import { useUserStore } from '@/store/user'
24
-import { isDistributorRole, isSupplierRole } from '@/utils/partnerRole'
24
+import { isEffectiveDistributorRole, isEffectiveSupplierRole } from '@/utils/partnerRole'
25 25
 import { refreshTabPanelOnShow } from '@/utils/tabPanel'
26 26
 
27 27
 export default {
@@ -49,8 +49,8 @@ export default {
49 49
       const userStore = useUserStore()
50 50
       const roles = userStore.state.roles
51 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 55
     goLogin() {
56 56
       uni.navigateTo({ url: '/pages/login/index' })

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

@@ -51,7 +51,10 @@ export function shouldDenyPartnerLogin(roles) {
51 51
   return !hasPartnerRole(roles)
52 52
 }
53 53
 
54
-/** 当前登录用户的主身份:supplier | distributor | '' */
54
+/**
55
+ * 当前登录用户的主身份:supplier | distributor | ''
56
+ * 同时含 supplier 与 distributor 时固定为 supplier(界面与接口均走供应商)
57
+ */
55 58
 export function getPrimaryPartnerRole(roles) {
56 59
   const list = normalizeRoles(roles).map((r) => roleKey(r))
57 60
   if (list.includes('supplier')) {
@@ -63,6 +66,16 @@ export function getPrimaryPartnerRole(roles) {
63 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 80
 export function getPartnerIdentityLabel(roles) {
68 81
   const kind = getPrimaryPartnerRole(roles)