feat(distribution): 完善分销站与主站业务数据及权益风控隔离,修复历史商品归属

This commit is contained in:
yml2213
2026-09-08 15:25:46 +08:00
parent 0fcb6a513f
commit fd4e490ed3
16 changed files with 221 additions and 35 deletions
@@ -135,6 +135,15 @@
font-weight: 900;
}
.growth-card.is-distribution > div {
background: #f0fdf4;
border-color: rgba(167, 243, 208, 0.6);
}
.growth-card.is-distribution strong {
color: #059669;
}
/* ========== Balance Card ========== */
.balance-card {
margin: 12px 16px 14px;
@@ -18,7 +18,10 @@ import { uploadFile } from '@/shared/api/files'
import { formatCent } from '@/shared/utils/money'
import { setPassword } from '@/features/auth/api/auth'
import { useDistributionSiteStore } from '@/stores/distributionSite'
const session = useSessionStore()
const siteStore = useDistributionSiteStore()
const router = useRouter()
const route = useRoute()
const { unreadCount: notificationUnreadCount, unreadLabel: notificationUnreadLabel } =
@@ -353,7 +356,17 @@ function resolveAvatarURL(url: string | undefined | null) {
</div>
</section>
<section class="growth-card">
<section v-if="siteStore.isDistribution" class="growth-card is-distribution">
<div>
<span>所属商城</span>
<strong>{{ siteStore.siteName || '专属分销商城' }}</strong>
</div>
<div>
<span>会员特权</span>
<strong>渠道直租专享</strong>
</div>
</section>
<section v-else class="growth-card">
<div>
<span>租客成长等级</span>
<strong>{{ session.renterGrowthLevelName }}</strong>
@@ -1,9 +1,18 @@
import { computed, ref } from 'vue'
import type { PublicListingItem } from '@/features/listings/api/listings'
import { getEffectiveSiteCode } from '@/stores/distributionSite'
function getHistoryKey() {
const code = getEffectiveSiteCode()
return code ? `hfb.listing.view.history.${code}` : 'hfb.listing.view.history'
}
function getFavoriteKey() {
const code = getEffectiveSiteCode()
return code ? `hfb.listing.favorites.${code}` : 'hfb.listing.favorites'
}
const historyKey = 'hfb.listing.view.history'
const favoriteKey = 'hfb.listing.favorites'
const maxHistoryItems = 80
export interface ListingCollectionItem {
@@ -12,10 +21,12 @@ export interface ListingCollectionItem {
favorited_at?: string
}
const historyItems = ref<ListingCollectionItem[]>(readItems(historyKey))
const favoriteItems = ref<ListingCollectionItem[]>(readItems(favoriteKey))
export function useListingCollections() {
const historyKey = getHistoryKey()
const favoriteKey = getFavoriteKey()
const historyItems = ref<ListingCollectionItem[]>(readItems(historyKey))
const favoriteItems = ref<ListingCollectionItem[]>(readItems(favoriteKey))
const history = computed(() => historyItems.value)
const favorites = computed(() => favoriteItems.value)
const favoriteIDs = computed(() => new Set(favoriteItems.value.map(item => item.listing.id)))
@@ -1,17 +1,27 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { Refresh, Search } from '@element-plus/icons-vue'
import { fetchSellerPickups, type SellerPickup } from '@/features/seller/api/sellerPickup'
import { formatCentWithSymbol } from '@/shared/utils/money'
import { formatDateTime } from '@/shared/utils/time'
import { pickupStatusLabel } from '@/shared/utils/statusLabels'
import { useDistributionSiteStore } from '@/stores/distributionSite'
const siteStore = useDistributionSiteStore()
const router = useRouter()
const loading = ref(false)
const items = ref<SellerPickup[]>([])
const total = ref(0)
const filters = reactive({ page: 1, page_size: 20, status: '' })
onMounted(loadList)
onMounted(() => {
if (siteStore.isDistribution) {
router.replace('/seller/listings')
return
}
loadList()
})
async function loadList() {
loading.value = true