feat: 支持角色身份自定义名称全链路配置与动态展示

这个提交包含在:
chen
2026-09-17 15:40:47 +08:00
父节点 06e98c57e0
当前提交 f8179706b3
共有 24 个文件被更改,包括 508 次插入 和 110 次删除

查看文件

@@ -18,10 +18,10 @@
mode="aspectFill"
>
</image>
<text class="tag-title">{{ agentInfo.level_info?.name }}</text>
<text class="tag-title">{{ levelTitle }}</text>
</view>
<view v-if="agentInfo.is_venue || agentInfo.identities?.includes('venue')" class="mini-tag">酒道馆</view>
<view v-if="agentInfo.is_county || agentInfo.identities?.includes('county')" class="mini-tag">区县</view>
<view v-if="agentInfo.is_venue || agentInfo.identities?.includes('venue')" class="mini-tag">{{ roleNames.venue || '酒道馆' }}</view>
<view v-if="agentInfo.is_county || agentInfo.identities?.includes('county')" class="mini-tag">{{ roleNames.county || '区县' }}</view>
<view class="ss-iconfont uicon-arrow-right" style="color: #fff; font-size: 28rpx">
</view>
</view>
@@ -39,6 +39,29 @@
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/commission/background.png');
const roleNames = computed(() => {
return (
userInfo.value?.custom_role_names ||
userInfo.value?.role_names ||
agentInfo.value?.custom_role_names ||
agentInfo.value?.role_names ||
{}
);
});
const levelTitle = computed(() => {
if (userInfo.value?.maker_level_name) return userInfo.value.maker_level_name;
if (agentInfo.value?.maker_level_name) return agentInfo.value.maker_level_name;
const rawName = agentInfo.value?.level_info?.name;
if (rawName && roleNames.value.maker && rawName.includes('创客')) {
return rawName.replace('创客', roleNames.value.maker);
}
if (rawName && roleNames.value.taster && rawName.includes('品酒师')) {
return rawName.replace('品酒师', roleNames.value.taster);
}
return rawName || '';
});
const state = reactive({
showMoney: false,
});

查看文件

@@ -96,21 +96,34 @@
</template>
<script setup>
import { reactive } from 'vue';
import { computed, reactive } from 'vue';
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
import sheep from '@/sheep';
import _ from 'lodash';
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/user/wallet_card_bg.png');
const tabMaps = [
const userInfo = computed(() => sheep.$store('user').userInfo);
const agentInfo = computed(() => sheep.$store('user').agentInfo);
const roleNames = computed(() => {
return (
userInfo.value?.custom_role_names ||
userInfo.value?.role_names ||
agentInfo.value?.custom_role_names ||
agentInfo.value?.role_names ||
{}
);
});
const tabMaps = computed(() => [
{ name: '全部', value: 'all' },
{ name: '开拓奖', value: 'push3' },
{ name: '创客', value: 'maker' },
{ name: '酒道馆', value: 'venue' },
{ name: '区县', value: 'county' },
{ name: roleNames.value.maker || '创客', value: 'maker' },
{ name: roleNames.value.venue || '酒道馆', value: 'venue' },
{ name: roleNames.value.county || '区县', value: 'county' },
{ name: '加权奖励', value: 'share' },
];
]);
const emptyPagination = {
data: [],

查看文件

@@ -221,13 +221,13 @@
v-if="item.agent?.is_venue || item.agent?.identities?.includes('venue')"
class="mini-tag tag-venue"
>
酒道馆
{{ roleNames.venue || '酒道馆' }}
</view>
<view
v-if="item.agent?.is_county || item.agent?.identities?.includes('county')"
class="mini-tag tag-county"
>
区县代理
{{ roleNames.county || '区县代理' }}
</view>
</view>
</view>
@@ -403,13 +403,13 @@
v-if="state.currentMember.agent?.is_venue || state.currentMember.agent?.identities?.includes('venue')"
class="id-pill mini-tag tag-venue ss-m-r-12 ss-m-b-10"
>
酒道馆
{{ roleNames.venue || '酒道馆' }}
</view>
<view
v-if="state.currentMember.agent?.is_county || state.currentMember.agent?.identities?.includes('county')"
class="id-pill mini-tag tag-county ss-m-r-12 ss-m-b-10"
>
区县代理
{{ roleNames.county || '区县代理' }}
</view>
</view>
</view>
@@ -516,6 +516,16 @@
const userInfo = computed(() => sheep.$store('user').userInfo);
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/user/withdraw_bg.png');
const roleNames = computed(() => {
return (
userInfo.value?.custom_role_names ||
userInfo.value?.role_names ||
agentInfo.value?.custom_role_names ||
agentInfo.value?.role_names ||
{}
);
});
// 控制吸顶及页面滚动
onPageScroll((e) => {
state.scrollTop = e.scrollTop > 100;
@@ -527,13 +537,13 @@
{ name: '二级间推', value: '2' },
];
const filterPills = [
const filterPills = computed(() => [
{ label: '全部', value: 'all' },
{ label: '合伙股东', value: 'partner' },
{ label: roleNames.value.partner || '合伙股东', value: 'partner' },
{ label: '正常活跃', value: 'active' },
{ label: '临期预警', value: 'expiring' },
{ label: '已暂停', value: 'inactive' },
];
]);
const sortOptions = [
{ label: '最新加入', value: 'createtime' },
@@ -581,12 +591,25 @@
}
function memberLevelName(item) {
return (
item?.agent?.level_info?.name ||
item?.agent?.maker_level_name ||
item?.agent?.identity_text ||
''
);
const rNames =
item?.agent?.custom_role_names ||
item?.agent?.role_names ||
roleNames.value ||
{};
if (item?.agent?.maker_level_name) {
return item.agent.maker_level_name;
}
const rawName = item?.agent?.level_info?.name;
if (rawName) {
if (rNames.maker && rawName.includes('创客')) {
return rawName.replace('创客', rNames.maker);
}
if (rNames.taster && rawName.includes('品酒师')) {
return rawName.replace('品酒师', rNames.taster);
}
return rawName;
}
return item?.agent?.identity_text || '';
}
function formatTime(timestamp) {

查看文件

@@ -24,11 +24,11 @@
class="identity-row ss-flex ss-col-center ss-flex-wrap"
@tap="onBadgeTap"
>
<view v-if="hasTaster" class="identity-tag taster-tag">品酒师</view>
<view v-if="hasTaster" class="identity-tag taster-tag">{{ roleNames.taster || '品酒师' }}</view>
<view v-if="makerLevelName" class="identity-tag maker-tag">{{ makerLevelName }}</view>
<view v-if="hasVenue" class="identity-tag venue-tag">酒道馆</view>
<view v-if="hasCounty" class="identity-tag county-tag">区县</view>
<view v-if="hasPartner" class="identity-tag partner-tag">合伙股东</view>
<view v-if="hasVenue" class="identity-tag venue-tag">{{ roleNames.venue || '酒道馆' }}</view>
<view v-if="hasCounty" class="identity-tag county-tag">{{ roleNames.county || '区县' }}</view>
<view v-if="hasPartner" class="identity-tag partner-tag">{{ roleNames.partner || '合伙股东' }}</view>
</view>
</view>
</view>
@@ -111,27 +111,42 @@
const identityText = computed(() => userInfo.value?.identity_text || '');
const roleNames = computed(() => {
return userInfo.value?.custom_role_names || userInfo.value?.role_names || {};
});
const makerLevelName = computed(() => userInfo.value?.maker_level_name || '');
const hasVenue = computed(
() => identities.value.includes('venue') || identityText.value.includes('酒道馆'),
() =>
identities.value.includes('venue') ||
identityText.value.includes('酒道馆') ||
(roleNames.value.venue && identityText.value.includes(roleNames.value.venue)),
);
const hasCounty = computed(
() => identities.value.includes('county') || identityText.value.includes('区县'),
() =>
identities.value.includes('county') ||
identityText.value.includes('区县') ||
(roleNames.value.county && identityText.value.includes(roleNames.value.county)),
);
const hasPartner = computed(() => {
return (
Boolean(userInfo.value?.is_partner) ||
identities.value.includes('partner') ||
identityText.value.includes('合伙股东')
identityText.value.includes('合伙股东') ||
(roleNames.value.partner && identityText.value.includes(roleNames.value.partner))
);
});
const hasTaster = computed(() => {
if (makerLevelName.value) return false;
return identities.value.includes('taster') || identityText.value.includes('品酒师');
return (
identities.value.includes('taster') ||
identityText.value.includes('品酒师') ||
(roleNames.value.taster && identityText.value.includes(roleNames.value.taster))
);
});
const showIdentityBadges = computed(