mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-09-20 11:52:02 +08:00
feat(distribution): 添加上级分销员信息展示与获取逻辑
- 新增上级分销员信息的显示,确保在满足条件时可见。 - 引入获取上级分销员信息的API,优化数据加载流程。 - 更新样式以提升上级信息的可读性和用户体验。
This commit is contained in:
@@ -25,6 +25,9 @@
|
||||
</view>
|
||||
<u-icon name="arrow-right" color="rgba(255,255,255,0.7)" size="16"></u-icon>
|
||||
</view>
|
||||
<view class="parent-row" v-if="parentDistributorVisible === true">
|
||||
<text class="parent-text">上级:{{ parentLabel }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 等级升级条 -->
|
||||
@@ -217,6 +220,7 @@ import {
|
||||
getDistributionCustomers,
|
||||
getDistributionInvitees,
|
||||
getDistributionOrders,
|
||||
getDistributionParent,
|
||||
getDistributionPerformance,
|
||||
} from '@/api/distribution'
|
||||
import { getUserInfo } from '@/api/members'
|
||||
@@ -237,6 +241,8 @@ const todayOrderCount = ref(0)
|
||||
const todayEarnings = ref(0)
|
||||
const todayCustomerCount = ref(0)
|
||||
const todayInviteCount = ref(0)
|
||||
const parentDistributorVisible = ref<boolean | undefined>(undefined)
|
||||
const parentNickname = ref('')
|
||||
|
||||
const userInfo = computed(() => store.state.userInfo || {})
|
||||
const displayName = computed(() => userInfo.value.nickName || distributionData.value.memberName || '分销员')
|
||||
@@ -265,6 +271,11 @@ const nextGrade = computed(() => {
|
||||
|
||||
const gradeVisible = computed(() => gradeList.value.length > 0)
|
||||
|
||||
const parentLabel = computed(() => {
|
||||
const name = (parentNickname.value || '').trim()
|
||||
return name || '暂无'
|
||||
})
|
||||
|
||||
const upgradeTip = computed(() => {
|
||||
if (!nextGrade.value) {
|
||||
return '当前已是最高等级,继续保持优秀业绩'
|
||||
@@ -292,10 +303,16 @@ function refreshUserInfo() {
|
||||
})
|
||||
}
|
||||
|
||||
function resetParentState() {
|
||||
parentDistributorVisible.value = undefined
|
||||
parentNickname.value = ''
|
||||
}
|
||||
|
||||
function loadPageData() {
|
||||
checking.value = true
|
||||
centerReady.value = false
|
||||
distributionData.value = {}
|
||||
resetParentState()
|
||||
fetchDistribution()
|
||||
.then((active) => {
|
||||
if (!active) {
|
||||
@@ -309,6 +326,7 @@ function loadPageData() {
|
||||
fetchTodayCustomers(),
|
||||
fetchTodayInvites(),
|
||||
fetchFeaturedGoods(),
|
||||
fetchParent(),
|
||||
])
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -381,6 +399,19 @@ function fetchFeaturedGoods() {
|
||||
})
|
||||
}
|
||||
|
||||
function fetchParent() {
|
||||
resetParentState()
|
||||
return getDistributionParent()
|
||||
.then((res) => {
|
||||
const result = res.data?.result
|
||||
parentDistributorVisible.value = result?.parentDistributorVisible
|
||||
parentNickname.value = result?.parentNickname || ''
|
||||
})
|
||||
.catch(() => {
|
||||
resetParentState()
|
||||
})
|
||||
}
|
||||
|
||||
function formatMoney(val: number | string) {
|
||||
const num = Number(val || 0)
|
||||
return num.toFixed(2)
|
||||
@@ -580,6 +611,16 @@ function goOrder() {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.parent-row {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.parent-text {
|
||||
color: rgba(255, 255, 255, 0.72);
|
||||
font-size: 24rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.level-bar {
|
||||
margin: -24rpx 24rpx 0;
|
||||
position: relative;
|
||||
|
||||
Reference in New Issue
Block a user