优化和平小店商品列表界面

This commit is contained in:
yml2213
2026-08-08 18:01:10 +08:00
parent 395096e229
commit 06ad1498da
5 changed files with 125 additions and 30 deletions
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useProducts } from '@/composables/useProducts'
import { useActivity } from '@/composables/useActivity'
import ProductSearch from '@/components/product/ProductSearch.vue'
@@ -11,6 +12,7 @@ defineProps<{
const { loadProducts, productInfo, filteredProducts, loading } = useProducts()
const { activities, currentActivity, switching, switchActivity } = useActivity()
const isXiaodian = computed(() => currentActivity.value?.id === 'xiaodian')
const onSwitchActivity = async (e: Event) => {
const id = (e.target as HTMLSelectElement).value
@@ -69,9 +71,9 @@ const onSwitchActivity = async (e: Event) => {
<div class="product-meta" :class="{ good: productInfo && !productInfo.stale, warn: productInfo?.stale }">
<template v-if="productInfo?.fetchedAt">
实时库存 {{ filteredProducts.length }} 个,刷新于 {{ productInfo.fetchedAt }}
{{ isXiaodian ? '商品' : '实时库存' }} {{ filteredProducts.length }} 个,刷新于 {{ productInfo.fetchedAt }}
</template>
<template v-else>库存未刷新</template>
<template v-else>{{ isXiaodian ? '商品未刷新' : '库存未刷新' }}</template>
</div>
</div>
@@ -194,6 +196,9 @@ const onSwitchActivity = async (e: Event) => {
font-size: 11px;
color: var(--muted);
padding: 0 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.product-meta.good {