mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-09-22 04:42:02 +08:00
feat(distribution): 添加分销员状态检查与加载指示
- 在多个分销相关页面中引入分销员状态检查,确保用户在访问前具备有效分销资格。 - 增加加载指示器以改善用户体验,提示用户正在加载数据。 - 更新相关逻辑以处理分销员资格的不同状态,确保用户在不符合条件时获得适当反馈。
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
<view class="nav-placeholder"></view>
|
||||
</view>
|
||||
|
||||
<view v-if="checking" class="center-pending">加载中...</view>
|
||||
<template v-else-if="centerReady">
|
||||
<!-- 顶部用户信息 -->
|
||||
<view class="header">
|
||||
<view class="user-row" @click="goGrade">
|
||||
@@ -199,6 +201,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -209,7 +212,6 @@ import { useStore } from '@/store'
|
||||
import config from '@/config/config'
|
||||
import { getThemeStyle } from '@/utils/theme'
|
||||
import {
|
||||
distribution,
|
||||
getDistributionFeaturedGoods,
|
||||
getDistributionGrades,
|
||||
getDistributionCustomers,
|
||||
@@ -218,6 +220,7 @@ import {
|
||||
getDistributionPerformance,
|
||||
} from '@/api/distribution'
|
||||
import { getUserInfo } from '@/api/members'
|
||||
import { assertActiveDistributor } from '@/utils/distributionStatus'
|
||||
|
||||
const store = useStore()
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
@@ -226,6 +229,8 @@ const statusBarHeight = ref(20)
|
||||
const expanded = ref(false)
|
||||
|
||||
const distributionData = ref<Record<string, any>>({})
|
||||
const checking = ref(true)
|
||||
const centerReady = ref(false)
|
||||
const gradeList = ref<any[]>([])
|
||||
const featuredGoods = ref<any[]>([])
|
||||
const todayOrderCount = ref(0)
|
||||
@@ -288,25 +293,38 @@ function refreshUserInfo() {
|
||||
}
|
||||
|
||||
function loadPageData() {
|
||||
Promise.all([
|
||||
fetchDistribution(),
|
||||
fetchGrades(),
|
||||
fetchTodayOrders(),
|
||||
fetchTodayEarnings(),
|
||||
fetchTodayCustomers(),
|
||||
fetchTodayInvites(),
|
||||
fetchFeaturedGoods(),
|
||||
])
|
||||
checking.value = true
|
||||
centerReady.value = false
|
||||
distributionData.value = {}
|
||||
fetchDistribution()
|
||||
.then((active) => {
|
||||
if (!active) {
|
||||
return
|
||||
}
|
||||
centerReady.value = true
|
||||
Promise.all([
|
||||
fetchGrades(),
|
||||
fetchTodayOrders(),
|
||||
fetchTodayEarnings(),
|
||||
fetchTodayCustomers(),
|
||||
fetchTodayInvites(),
|
||||
fetchFeaturedGoods(),
|
||||
])
|
||||
})
|
||||
.finally(() => {
|
||||
if (centerReady.value) {
|
||||
checking.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function fetchDistribution() {
|
||||
return distribution().then((res) => {
|
||||
if (!res.data?.result) {
|
||||
uni.showToast({ title: '您还不是分销员', icon: 'none' })
|
||||
setTimeout(() => goBack(), 1500)
|
||||
return
|
||||
return assertActiveDistributor().then((result) => {
|
||||
if (!result) {
|
||||
return false
|
||||
}
|
||||
distributionData.value = res.data.result
|
||||
distributionData.value = result
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
@@ -497,6 +515,13 @@ function goOrder() {
|
||||
width: 72rpx;
|
||||
}
|
||||
|
||||
.center-pending {
|
||||
padding: 120rpx 0;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(180deg, #1f2228 0%, #2a2e36 100%);
|
||||
padding: 24rpx 32rpx 40rpx;
|
||||
|
||||
Reference in New Issue
Block a user