feat(distribution): 完善分销站与主站业务数据及权益风控隔离,修复历史商品归属
This commit is contained in:
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user