feat(distribution): 添加分销员状态检查与加载指示

- 在多个分销相关页面中引入分销员状态检查,确保用户在访问前具备有效分销资格。
- 增加加载指示器以改善用户体验,提示用户正在加载数据。
- 更新相关逻辑以处理分销员资格的不同状态,确保用户在不符合条件时获得适当反馈。
This commit is contained in:
田香琪
2026-09-09 13:21:53 +08:00
parent 4fdd266dec
commit c12c76f6f5
21 changed files with 419 additions and 83 deletions

View File

@@ -1,5 +1,9 @@
<template>
<view class="wrapper" :style="themeStyle">
<view v-if="!pageReady" class="state-wrap">
<text class="state-text">加载中...</text>
</view>
<template v-else>
<view class="feedBack-box">
<view class="box-title">提现金额</view>
<view class="amount-row">
@@ -23,13 +27,15 @@
</view>
<view class="submit" @click="submitWithdraw">提现</view>
</template>
</view>
</template>
<script setup lang="ts">
import { ref, computed, getCurrentInstance, onMounted } from 'vue'
import { useStore } from '@/store'
import { distribution, cash } from '@/api/distribution'
import { cash } from '@/api/distribution'
import { assertActiveDistributor } from '@/utils/distributionStatus'
import { unitPrice } from '@/utils/filters.js'
import { getThemeStyle } from '@/utils/theme'
@@ -38,23 +44,20 @@ const { proxy } = getCurrentInstance()!
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const price = ref('')
const pageReady = ref(false)
const distributionData = ref<Record<string, any>>({})
onMounted(() => {
fetchDistributionInfo()
})
function hideLoadingIfNeeded() {
if (store.state.isShowToast) uni.hideLoading()
}
function fetchDistributionInfo() {
uni.showLoading({ title: '加载中' })
distribution().then((res) => {
if (res.data.result) {
distributionData.value = res.data.result
assertActiveDistributor().then((result) => {
if (!result) {
return
}
hideLoadingIfNeeded()
distributionData.value = result
pageReady.value = true
})
}
@@ -98,6 +101,16 @@ page {
background: #f8f8f8;
}
.state-wrap {
padding: 120rpx 0;
text-align: center;
}
.state-text {
color: #999;
font-size: 26rpx;
}
.feedBack-box {
background: #fff;
border-radius: 20rpx;