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
+14
View File
@@ -409,6 +409,11 @@
color: #ea580c;
}
.pc-growth-badge.is-distribution {
background: #ecfdf5;
color: #059669;
}
.pc-realname-badge.is-verified,
.dropdown-status.is-verified {
background: #ecfdf3;
@@ -512,6 +517,15 @@
white-space: nowrap;
}
.dropdown-growth-panel.is-distribution > div {
background: #f0fdf4;
border: 1px solid rgba(167, 243, 208, 0.5);
}
.dropdown-growth-panel.is-distribution strong {
color: #059669;
}
.dropdown-status {
display: inline-flex;
align-items: center;
+33 -8
View File
@@ -48,12 +48,17 @@ const buyerServiceItems = [
{ label: '使用中', icon: VideoPlay, to: { path: '/orders', query: { tab: 'renting' } } },
{ label: '已完成', icon: Finished, to: { path: '/orders', query: { tab: 'completed' } } },
]
const sellerServiceItems = [
{ label: '发布商品', icon: CirclePlus, to: '/seller/listings/create' },
{ label: '我的商品', icon: Shop, to: '/seller/listings' },
{ label: '提号记录', icon: Switch, to: '/seller/pickups' },
{ label: '提现/账单', icon: Wallet, to: '/wallet' },
]
const sellerServiceItems = computed(() => {
const items = [
{ label: '发布商品', icon: CirclePlus, to: '/seller/listings/create' },
{ label: '我的商品', icon: Shop, to: '/seller/listings' },
]
if (!siteStore.isDistribution) {
items.push({ label: '提号记录', icon: Switch, to: '/seller/pickups' })
}
items.push({ label: '提现/账单', icon: Wallet, to: '/wallet' })
return items
})
const showUserDropdown = ref(false)
const supportLoading = ref(false)
@@ -220,7 +225,17 @@ async function handleSupportClick() {
<span v-else class="pc-avatar-text">{{ session.avatarText }}</span>
</span>
<span class="pc-user-name">{{ session.displayName }}</span>
<span class="pc-growth-badge" :class="`is-${growthBadgeTone}`">
<span
v-if="siteStore.isDistribution"
class="pc-growth-badge is-distribution"
>
分销专享
</span>
<span
v-else
class="pc-growth-badge"
:class="`is-${growthBadgeTone}`"
>
{{ session.renterGrowthLevelName }}
</span>
<span class="pc-realname-badge" :class="`is-${realnameBadge.tone}`">
@@ -234,7 +249,17 @@ async function handleSupportClick() {
<Transition name="dropdown">
<div v-if="showUserDropdown" class="pc-user-dropdown-container">
<div class="pc-user-dropdown">
<div class="dropdown-growth-panel">
<div v-if="siteStore.isDistribution" class="dropdown-growth-panel is-distribution">
<div>
<span>所属商城</span>
<strong>{{ siteStore.siteName || '专属分销站' }}</strong>
</div>
<div>
<span>会员权益</span>
<strong>渠道特惠直租</strong>
</div>
</div>
<div v-else class="dropdown-growth-panel">
<div>
<span>租客成长等级</span>
<strong>{{ session.renterGrowthLevelName }}</strong>