mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-09-20 11:52:02 +08:00
feat(distribution): 更新分销等级逻辑与条件可见性
- 修改分销等级列表的文档注释,明确包含的条件。 - 在分销等级页面中引入条件可见性逻辑,确保等级规则仅在满足条件时显示。 - 优化获取分销等级的逻辑,确保正确处理和展示等级数据。
This commit is contained in:
@@ -85,7 +85,7 @@ export function updateDistributionCustomerStarred(id, starred) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 分销等级列表(买家端可见时) */
|
/** 分销等级列表(包装 VO:upgradeConditionVisible + grades) */
|
||||||
export function getDistributionGrades() {
|
export function getDistributionGrades() {
|
||||||
return http.request({
|
return http.request({
|
||||||
url: `/distribution/distribution/grades`,
|
url: `/distribution/distribution/grades`,
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 等级规则 -->
|
<!-- 等级规则 -->
|
||||||
<view class="card rules-card">
|
<view class="card rules-card" v-if="upgradeConditionVisible !== false">
|
||||||
<view class="rules-title">等级规则</view>
|
<view class="rules-title">等级规则</view>
|
||||||
<view class="rules-timeline">
|
<view class="rules-timeline">
|
||||||
<view
|
<view
|
||||||
@@ -129,6 +129,7 @@ const defaultAvatar = config.defaultUserPhoto
|
|||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const distributionData = ref<Record<string, any>>({})
|
const distributionData = ref<Record<string, any>>({})
|
||||||
const gradeList = ref<any[]>([])
|
const gradeList = ref<any[]>([])
|
||||||
|
const upgradeConditionVisible = ref<boolean | undefined>(true)
|
||||||
|
|
||||||
const userInfo = computed(() => store.state.userInfo || {})
|
const userInfo = computed(() => store.state.userInfo || {})
|
||||||
|
|
||||||
@@ -188,7 +189,9 @@ function fetchGrades() {
|
|||||||
return getDistributionGrades()
|
return getDistributionGrades()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const result = res.data?.result
|
const result = res.data?.result
|
||||||
gradeList.value = (Array.isArray(result) ? result : []).sort(
|
upgradeConditionVisible.value = result?.upgradeConditionVisible
|
||||||
|
const grades = result?.grades
|
||||||
|
gradeList.value = (Array.isArray(grades) ? grades : []).sort(
|
||||||
(a: any, b: any) => Number(a.sortOrder) - Number(b.sortOrder)
|
(a: any, b: any) => Number(a.sortOrder) - Number(b.sortOrder)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -330,7 +330,8 @@ function fetchDistribution() {
|
|||||||
|
|
||||||
function fetchGrades() {
|
function fetchGrades() {
|
||||||
return getDistributionGrades().then((res) => {
|
return getDistributionGrades().then((res) => {
|
||||||
gradeList.value = res.data?.result || []
|
const grades = res.data?.result?.grades
|
||||||
|
gradeList.value = Array.isArray(grades) ? grades : []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user