Files
JayuCloud/FD-Frontend/src/views/ProductListView.vue
T

1044 lines
32 KiB
Vue
Raw Normal View History

<template>
2026-05-29 13:30:56 +08:00
<div class="mobile-container product-list-page">
<header class="gallery-header">
2026-05-31 18:36:52 +08:00
<span class="header-spacer" aria-hidden="true"></span>
<div class="brand-lockup" :aria-label="currentShopName">
<h1>{{ currentShopName }}</h1>
2026-03-05 16:02:34 +08:00
</div>
2026-05-31 18:36:52 +08:00
<span class="header-spacer" aria-hidden="true"></span>
</header>
2026-05-29 13:30:56 +08:00
<main class="gallery-content">
<section class="search-panel" aria-label="作品搜索与筛选">
<div class="search-field">
<SearchOutlined class="search-field__icon" />
<input
v-model="searchKeyword"
class="search-field__input"
type="search"
placeholder="搜索美甲款式..."
@keydown.enter="handleSearch"
/>
<button
2026-05-29 13:30:56 +08:00
type="button"
class="search-field__action"
@click="handleSearch"
>
搜索
</button>
</div>
<div class="category-rail" aria-label="作品分类">
<button
class="category-item"
:class="{ active: selectedCategory === '全部' }"
type="button"
@click="handleCategoryClick('全部')"
>
2026-05-30 18:31:35 +08:00
全部款式
2026-05-29 13:30:56 +08:00
</button>
<button
v-for="tag in allTags"
:key="tag.id"
class="category-item"
:class="{ active: selectedTagId === String(tag.id) }"
type="button"
@click="handleTagClick(tag)"
>
{{ tag.displayName || tag.tagName }}
</button>
</div>
2026-05-29 13:30:56 +08:00
</section>
<div v-if="activeBannerText" class="page-banner" role="status">
{{ activeBannerText }}
</div>
2026-05-29 13:30:56 +08:00
<section class="product-section" aria-label="作品列表">
<div class="product-grid">
2026-05-29 13:30:56 +08:00
<article
v-for="item in products"
:key="item.id"
class="product-card"
2026-05-29 13:30:56 +08:00
role="button"
tabindex="0"
@click="handleProductClick(item)"
2026-05-29 13:30:56 +08:00
@keydown.enter="handleProductClick(item)"
@keydown.space.prevent="handleProductClick(item)"
>
2026-05-29 13:30:56 +08:00
<div class="product-media">
<div class="product-img">
<img
v-if="getProductImages(item).length > 0"
:src="getProductImages(item)[0]"
:alt="item.title || item.name"
class="product-image"
loading="lazy"
decoding="async"
/>
<div v-else class="product-img-placeholder">
<span>{{ (item.title || item.name)?.[0] || '作' }}</span>
</div>
2026-02-24 09:59:22 +08:00
</div>
</div>
2026-02-24 09:59:22 +08:00
<div class="product-info">
2026-05-29 13:30:56 +08:00
<div class="product-head">
<div class="product-title-block">
<h2 class="name">{{ item.title || item.name }}</h2>
<p v-if="item.shopName" class="shop-name">{{ item.shopName }}</p>
<div class="duration">
<ClockCircleOutlined />
2026-06-04 16:39:06 +08:00
<span>{{ displayProductDuration(item) }}</span>
2026-05-29 13:30:56 +08:00
</div>
2026-02-24 09:59:22 +08:00
</div>
2026-05-29 13:30:56 +08:00
<button
class="cart-btn"
:class="{ 'cart-btn-in-cart': item.inCart }"
type="button"
:aria-label="item.inCart ? '购物车已有' : `加入购物车:${item.title || item.name || '作品'}`"
@click.stop="handleAddToCart(item)"
>
<CheckOutlined v-if="item.inCart" />
2026-05-31 18:36:52 +08:00
<ShoppingCartOutlined v-else />
2026-05-29 13:30:56 +08:00
</button>
2026-02-24 09:59:22 +08:00
</div>
2026-02-24 09:59:22 +08:00
<div class="product-tags">
<template v-if="item.tagInfos?.length">
<a-tag
v-for="tag in item.tagInfos"
:key="tag.id"
size="small"
:style="{
marginRight: '4px',
marginBottom: '4px',
2026-05-29 13:30:56 +08:00
color: tag.textColor || 'var(--text-primary)',
backgroundColor: tag.bgColor || 'var(--theme-primary-soft)',
borderColor: tag.borderColor || 'var(--theme-border)'
}"
>
{{ tag.tagName }}
</a-tag>
</template>
2026-05-29 13:30:56 +08:00
<a-tag v-else size="small" color="default">精选款式</a-tag>
2026-02-24 09:59:22 +08:00
</div>
2026-05-29 13:30:56 +08:00
<div class="card-foot">
2026-06-04 16:39:06 +08:00
<p class="price">参考价 ¥{{ Number(item.price || 0).toFixed(2) }}</p>
2026-05-29 13:30:56 +08:00
<div class="stats">
<span><HeartOutlined />{{ item.likeCount || 0 }}</span>
<span><StarOutlined />{{ item.collectCount || 0 }}</span>
</div>
2026-02-24 09:59:22 +08:00
</div>
</div>
2026-05-29 13:30:56 +08:00
</article>
</div>
2026-02-24 09:59:22 +08:00
<div v-if="products.length === 0 && !loading" class="empty-state">
<a-empty description="暂时没有匹配的作品">
<a-button type="primary" @click="resetFilters">查看全部作品</a-button>
</a-empty>
2026-02-24 09:59:22 +08:00
</div>
<div v-if="loading" class="loading-state">
<a-spin />
2026-02-24 09:59:22 +08:00
</div>
2026-05-29 13:30:56 +08:00
</section>
</main>
2026-05-31 18:36:52 +08:00
<button
v-show="showBackTop"
class="back-to-top-button"
type="button"
aria-label="返回顶部"
@click="scrollToTop"
>
<UpOutlined />
</button>
</div>
</template>
<script setup lang="ts">
/**
* ProductListView page script.
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
*/
2026-05-31 18:36:52 +08:00
import { computed, inject, onMounted, onUnmounted, ref, watch } from 'vue'
import { useRouter, useRoute } from 'vue-router'
2026-05-29 13:30:56 +08:00
import {
CheckOutlined,
ClockCircleOutlined,
HeartOutlined,
SearchOutlined,
2026-05-31 18:36:52 +08:00
ShoppingCartOutlined,
StarOutlined,
UpOutlined
2026-05-29 13:30:56 +08:00
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
2026-05-23 18:44:57 +08:00
/**
* Purpose: ProductVO supports ProductListView.vue by holding or executing the product vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-02-24 09:59:22 +08:00
import { productApi, type ProductVO } from '@/api/product'
2026-05-23 18:44:57 +08:00
/**
* Purpose: TagVO supports ProductListView.vue by holding or executing the tag vo page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
import { tagApi, type TagFilterGroupVO, type TagVO } from '@/api/tag'
import { cartApi } from '@/api/cart'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { fetchCartProductIdSet, hasCartProduct, withAddedCartProduct } from '@/utils/cart-state'
2026-05-29 13:30:56 +08:00
import { getCachedSignedImageUrls, getCachedSignedImageUrlsSync, parseImageFileIds } from '@/utils/signed-image-cache'
2026-05-23 18:44:57 +08:00
/**
* Purpose: ProductListItem supports ProductListView.vue by holding or executing the product list item page or API role.
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
*/
type ProductListItem = ProductVO & {
inCart?: boolean
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: router supports ProductListView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
2026-05-23 18:44:57 +08:00
/**
* Purpose: route supports ProductListView.vue by holding or executing the route page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const route = useRoute()
2026-05-23 18:44:57 +08:00
/**
* Purpose: updateCartCount supports ProductListView.vue by holding or executing the update cart count page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-03-19 20:51:07 +08:00
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
2026-03-05 16:28:05 +08:00
/** filterGroups stores scene-based tag filters shown above the product grid. */
const filterGroups = ref<TagFilterGroupVO[]>([])
/** allTags flattens filter groups for route/query lookup. */
const allTags = computed(() => filterGroups.value.flatMap(group => group.tags || []))
/** selectedCategory is a reactive state variable used by the template and event handlers. */
const selectedCategory = ref('全部')
/** selectedTagId tracks the grouped filter id sent to the backend. */
const selectedTagId = ref('')
2026-05-31 18:36:52 +08:00
const selectedShopId = ref('')
const bookableOnly = ref(false)
2026-05-23 18:44:57 +08:00
/**
* Purpose: products supports ProductListView.vue by holding or executing the products page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const products = ref<ProductListItem[]>([])
/** loading is a reactive state variable used by the template and event handlers. */
2026-02-24 09:59:22 +08:00
const loading = ref(false)
2026-05-31 18:36:52 +08:00
/** showBackTop toggles the floating shortcut after the gallery scrolls down. */
const showBackTop = ref(false)
/** showSearch is a reactive state variable used by the template and event handlers. */
2026-03-05 16:02:34 +08:00
const showSearch = ref(false)
/** searchKeyword is a reactive state variable used by the template and event handlers. */
2026-03-05 16:02:34 +08:00
const searchKeyword = ref('')
2026-05-23 18:44:57 +08:00
/**
* Purpose: imageUrls supports ProductListView.vue by holding or executing the image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-03-27 14:55:41 +08:00
const imageUrls = ref<Record<string, string[]>>({})
/** cartProductIdSet is a reactive state variable used by the template and event handlers. */
const cartProductIdSet = ref(new Set<string>())
2026-05-23 18:44:57 +08:00
/**
* Purpose: useGlobalLoadingForNextRouteSync supports ProductListView.vue by holding or executing the use global loading for next route sync page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let useGlobalLoadingForNextRouteSync = false
2026-02-26 11:16:24 +08:00
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
2026-05-31 18:36:52 +08:00
/** currentShopName renders the active shop name in the page navigation bar. */
const currentShopName = computed(() => {
const routeShopName = typeof route.query.shopName === 'string' ? route.query.shopName.trim() : ''
if (routeShopName) {
return routeShopName
}
if (typeof window !== 'undefined') {
try {
const raw = localStorage.getItem('userInfo')
const storedUser = raw ? JSON.parse(raw) as { shopName?: string; shopNames?: string[] } : null
return storedUser?.shopName || storedUser?.shopNames?.find(Boolean) || '当前门店'
} catch {
return '当前门店'
}
}
return '当前门店'
})
/** activeBannerText is a reactive state variable used by the template and event handlers. */
const activeBannerText = computed(() => {
if (searchKeyword.value.trim()) {
return `当前显示“${searchKeyword.value.trim()}”的匹配结果`
}
2026-05-31 18:36:52 +08:00
if (selectedShopId.value && bookableOnly.value) {
return `当前显示“${currentShopName.value}”的可预约作品`
}
if (selectedShopId.value) {
return `当前显示“${currentShopName.value}”的作品`
}
if (selectedCategory.value !== '全部') {
return `当前按场景“${selectedCategory.value}”筛选`
}
return ''
})
2026-05-31 18:36:52 +08:00
const getScopedRouteQuery = (includeBookable = true) => {
const query: Record<string, string> = {}
const routeShopName = typeof route.query.shopName === 'string' ? route.query.shopName.trim() : ''
if (selectedShopId.value) {
query.shopId = selectedShopId.value
}
if (routeShopName) {
query.shopName = routeShopName
}
if (includeBookable && bookableOnly.value) {
query.bookable = '1'
}
return query
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: DEFAULT_PRODUCT_IMAGE supports ProductListView.vue by holding or executing the default product image page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEFAULT_PRODUCT_IMAGE = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCBmaWxsPSIjZjVmNWY1IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIvPjx0ZXh0IHg9IjUwJSIgeT0iNTAlIiBmaWxsPSIjYmZiZmJmIiBmb250LXNpemU9IjI0IiB0ZXh0LWFuY2hvcj0ibWlkZGxlIiBkeT0iLjNlbSI+YWFhPC90ZXh0Pjwvc3ZnPg=='
/** ensureLoginForAction is a local helper used by this page script. */
const ensureLoginForAction = (actionText: string) => {
if (isLoggedIn.value) {
return true
}
message.info(`${actionText}前请先登录账号`)
router.push('/')
return false
}
/** loadImageUrls is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const loadImageUrls = async (productList: ProductVO[]) => {
for (const product of productList) {
if (!product.imageFileIds) {
2026-03-27 14:55:41 +08:00
imageUrls.value[String(product.id)] = [DEFAULT_PRODUCT_IMAGE]
continue
}
2026-05-29 13:30:56 +08:00
const ids = parseImageFileIds(product.imageFileIds)
const cachedUrls = getCachedSignedImageUrlsSync(ids)
if (cachedUrls.length) {
imageUrls.value[String(product.id)] = cachedUrls
}
2026-05-29 13:30:56 +08:00
const urls = await getCachedSignedImageUrls(ids, DEFAULT_PRODUCT_IMAGE)
2026-03-27 14:55:41 +08:00
imageUrls.value[String(product.id)] = urls.length ? urls : [DEFAULT_PRODUCT_IMAGE]
}
}
/** getProductImages is a local helper used by this page script. */
2026-03-27 14:55:41 +08:00
const getProductImages = (product: ProductVO): string[] => imageUrls.value[String(product.id)] || [DEFAULT_PRODUCT_IMAGE]
2026-06-04 16:39:06 +08:00
const displayProductDuration = (product: ProductVO) => {
const duration = product.approximateDuration?.trim()
if (duration) return duration
const minutes = Number(product.serviceDurationMinutes || product.estimatedTime || 0)
return minutes > 0 ? `${minutes}分钟` : '时长待定'
}
/** markProductsInCart is a local helper used by this page script. */
const markProductsInCart = (productList: ProductVO[]) => {
return (Array.isArray(productList) ? productList : []).map(item => ({
...item,
inCart: hasCartProduct(cartProductIdSet.value, item.id)
}))
}
/** syncCartProductState is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const syncCartProductState = async () => {
if (!isLoggedIn.value) {
cartProductIdSet.value = new Set()
return
}
cartProductIdSet.value = await fetchCartProductIdSet()
}
/** fetchTags is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
2026-02-24 09:59:22 +08:00
const fetchTags = async () => {
try {
const response = await tagApi.getFilterOptions() as unknown as TagFilterGroupVO[]
filterGroups.value = Array.isArray(response) ? response : []
} catch (error: any) {
2026-02-24 09:59:22 +08:00
console.error('获取标签失败:', error)
filterGroups.value = []
2026-02-24 09:59:22 +08:00
}
}
/** fetchProducts is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
2026-02-24 09:59:22 +08:00
const fetchProducts = async () => {
loading.value = true
try {
let response: ProductVO[] = []
const keyword = searchKeyword.value.trim()
if (keyword) {
response = await productApi.searchProducts(keyword)
} else if (!selectedTagId.value) {
response = await productApi.getAllProducts()
2026-02-24 09:59:22 +08:00
} else {
const pageResult = await productApi.getProductPage({
page: 1,
size: 200,
tagIds: selectedTagId.value
})
response = pageResult.list || []
2026-02-24 09:59:22 +08:00
}
2026-05-31 18:36:52 +08:00
let filteredProducts = Array.isArray(response) ? response : []
if (selectedShopId.value) {
filteredProducts = filteredProducts.filter(item => String(item.shopId || '') === selectedShopId.value)
}
if (bookableOnly.value) {
filteredProducts = filteredProducts.filter(item => item.availableBookableArtistCount === undefined || Number(item.availableBookableArtistCount) > 0)
}
products.value = markProductsInCart(filteredProducts)
await loadImageUrls(products.value)
} catch (error: any) {
console.error('获取作品列表失败:', error)
message.error(error?.message || '加载作品列表失败,请稍后重试')
products.value = []
2026-02-24 09:59:22 +08:00
} finally {
loading.value = false
}
2026-02-26 11:16:24 +08:00
}
/** syncRouteFilters is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const syncRouteFilters = async () => {
await syncCartProductState()
const keyword = typeof route.query.keyword === 'string' ? route.query.keyword.trim() : ''
const tag = typeof route.query.tag === 'string' ? route.query.tag.trim() : ''
const tagId = typeof route.query.tagId === 'string' ? route.query.tagId.trim() : ''
2026-05-31 18:36:52 +08:00
const shopId = typeof route.query.shopId === 'string' ? route.query.shopId.trim() : ''
const bookable = route.query.bookable === '1'
const matchedTag = tagId
? allTags.value.find(item => String(item.id) === tagId)
: allTags.value.find(item => item.tagName === tag || item.displayName === tag)
2026-02-26 11:16:24 +08:00
searchKeyword.value = keyword
showSearch.value = Boolean(keyword)
2026-05-31 18:36:52 +08:00
selectedShopId.value = shopId
bookableOnly.value = bookable
selectedTagId.value = matchedTag ? String(matchedTag.id) : ''
selectedCategory.value = matchedTag ? (matchedTag.displayName || matchedTag.tagName) : '全部'
if (useGlobalLoadingForNextRouteSync) {
useGlobalLoadingForNextRouteSync = false
await runWithGlobalLoading(() => fetchProducts())
return
}
await fetchProducts()
}
2026-02-24 09:59:22 +08:00
/** handleCategoryClick is a local helper used by this page script. */
const handleCategoryClick = (category: string) => {
selectedCategory.value = category
selectedTagId.value = ''
searchKeyword.value = ''
showSearch.value = false
useGlobalLoadingForNextRouteSync = true
2026-05-31 18:36:52 +08:00
router.replace({ path: '/products', query: getScopedRouteQuery() })
}
/** handleTagClick is a local helper used by grouped scene-filter chips. */
const handleTagClick = (tag: TagVO) => {
selectedCategory.value = tag.displayName || tag.tagName
selectedTagId.value = String(tag.id)
2026-03-05 16:02:34 +08:00
searchKeyword.value = ''
showSearch.value = false
useGlobalLoadingForNextRouteSync = true
router.replace({
path: '/products',
2026-05-31 18:36:52 +08:00
query: { ...getScopedRouteQuery(), tag: tag.displayName || tag.tagName, tagId: String(tag.id) }
})
}
/** handleProductClick is a local helper used by this page script. */
const handleProductClick = (item: ProductVO) => {
router.push(`/product/${item.id}`)
}
/** handleAddToCart is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const handleAddToCart = async (item: ProductListItem) => {
if (!ensureLoginForAction('加入购物车')) {
return
}
if (hasCartProduct(cartProductIdSet.value, item.id)) {
message.info('购物车已有')
return
}
try {
await runWithGlobalLoading(() => cartApi.addToCart({ productId: item.id, quantity: 1 }))
cartProductIdSet.value = withAddedCartProduct(cartProductIdSet.value, item.id)
products.value = markProductsInCart(products.value)
2026-03-19 20:51:07 +08:00
await updateCartCount()
message.success(`已将 ${item.title || item.name || '作品'} 加入购物车`)
} catch (error: any) {
console.error('加入购物车失败:', error)
message.error(error?.message || '加入购物车失败,请稍后重试')
}
}
/** handleSearch is a local helper used by this page script. */
const handleSearch = () => {
const keyword = searchKeyword.value.trim()
useGlobalLoadingForNextRouteSync = true
router.replace({
path: '/products',
2026-05-31 18:36:52 +08:00
query: keyword ? { ...getScopedRouteQuery(), keyword } : getScopedRouteQuery()
})
}
2026-02-24 09:59:22 +08:00
/** resetFilters is a local helper used by this page script. */
const resetFilters = () => {
selectedCategory.value = '全部'
selectedTagId.value = ''
searchKeyword.value = ''
showSearch.value = false
2026-05-31 18:36:52 +08:00
bookableOnly.value = false
useGlobalLoadingForNextRouteSync = true
2026-05-31 18:36:52 +08:00
router.replace({ path: '/products', query: getScopedRouteQuery(false) })
}
/** handleWindowScroll keeps the return-to-top shortcut in sync with page position. */
const handleWindowScroll = () => {
showBackTop.value = (document.documentElement.scrollTop || document.body.scrollTop) > 360
}
/** scrollToTop returns the product gallery to the top of the page. */
const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: 'smooth' })
2026-03-05 16:02:34 +08:00
}
watch(
() => route.query,
async () => {
await syncRouteFilters()
},
{ deep: true }
)
2026-02-24 11:34:25 +08:00
onMounted(async () => {
await fetchTags()
await syncRouteFilters()
2026-05-31 18:36:52 +08:00
handleWindowScroll()
window.addEventListener('scroll', handleWindowScroll, { passive: true })
})
onUnmounted(() => {
window.removeEventListener('scroll', handleWindowScroll)
2026-02-24 09:59:22 +08:00
})
</script>
<style scoped>
2026-05-29 13:30:56 +08:00
.product-list-page {
2026-05-30 18:31:35 +08:00
--gallery-header-height: 52px;
2026-05-29 13:30:56 +08:00
--gallery-gutter: 20px;
--gallery-surface: color-mix(in srgb, var(--theme-card-bg) 76%, transparent);
--gallery-surface-strong: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
--gallery-border: color-mix(in srgb, var(--theme-border) 72%, var(--theme-card-bg));
--gallery-muted: color-mix(in srgb, var(--text-secondary) 78%, var(--theme-card-bg));
--gallery-shadow: 0 18px 44px color-mix(in srgb, var(--theme-neutral) 11%, transparent);
--gallery-soft-shadow: 0 10px 30px color-mix(in srgb, var(--theme-primary) 14%, transparent);
min-height: 100vh;
2026-05-29 13:30:56 +08:00
padding: var(--gallery-header-height) 0 calc(104px + env(safe-area-inset-bottom, 0px));
color: var(--text-primary);
background:
2026-05-29 13:30:56 +08:00
radial-gradient(circle at 18% 5%, color-mix(in srgb, var(--theme-secondary) 22%, transparent) 0, transparent 30%),
radial-gradient(circle at 86% 10%, color-mix(in srgb, var(--theme-primary) 26%, transparent) 0, transparent 34%),
linear-gradient(180deg, color-mix(in srgb, var(--theme-tertiary) 96%, var(--theme-card-bg)) 0%, var(--theme-page-bg) 62%, var(--theme-primary-soft) 100%);
}
2026-05-29 13:30:56 +08:00
.gallery-header {
position: fixed;
top: 0;
2026-05-31 18:36:52 +08:00
left: 50%;
z-index: 100;
display: flex;
align-items: center;
2026-05-29 13:30:56 +08:00
justify-content: space-between;
2026-05-31 18:36:52 +08:00
width: min(100%, var(--app-mobile-max-width, 480px));
2026-05-29 13:30:56 +08:00
height: var(--gallery-header-height);
padding: 0 var(--gallery-gutter);
border-bottom: 1px solid var(--gallery-border);
background: color-mix(in srgb, var(--theme-tertiary) 86%, transparent);
box-shadow: 0 12px 36px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
backdrop-filter: blur(20px);
2026-05-31 18:36:52 +08:00
transform: translateX(-50%);
}
.header-spacer {
flex: 0 0 36px;
width: 36px;
height: 36px;
}
2026-05-29 13:30:56 +08:00
.brand-lockup {
2026-05-30 18:31:35 +08:00
display: flex;
align-items: center;
justify-content: center;
2026-05-29 13:30:56 +08:00
min-width: 0;
}
.brand-lockup h1 {
2026-05-30 18:31:35 +08:00
margin: 0;
2026-05-31 18:36:52 +08:00
overflow: hidden;
2026-05-30 18:31:35 +08:00
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
2026-05-29 13:30:56 +08:00
line-height: 1;
letter-spacing: 0;
2026-05-31 18:36:52 +08:00
text-overflow: ellipsis;
white-space: nowrap;
}
2026-05-29 13:30:56 +08:00
.gallery-content {
padding: 0 var(--gallery-gutter);
}
.search-panel {
display: grid;
2026-05-31 18:36:52 +08:00
gap: 10px;
margin-bottom: 12px;
2026-05-29 13:30:56 +08:00
}
.search-field {
display: grid;
grid-template-columns: 22px minmax(0, 1fr) auto;
align-items: center;
2026-05-31 18:36:52 +08:00
gap: 8px;
min-height: 46px;
padding: 6px 7px 6px 15px;
2026-05-29 13:30:56 +08:00
border: 1px solid var(--gallery-border);
border-radius: 999px;
background: var(--gallery-surface-strong);
box-shadow: var(--gallery-soft-shadow);
backdrop-filter: blur(16px);
transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.search-field:focus-within {
border-color: var(--theme-primary);
box-shadow: var(--theme-focus-shadow), var(--gallery-soft-shadow);
transform: translateY(-1px);
}
.search-field__icon {
color: var(--theme-primary-action);
2026-05-31 18:36:52 +08:00
font-size: 18px;
2026-05-29 13:30:56 +08:00
}
.search-field__input {
min-width: 0;
border: 0;
outline: 0;
color: var(--text-primary);
2026-05-29 13:30:56 +08:00
background: transparent;
font-size: 15px;
line-height: 1.4;
}
2026-05-29 13:30:56 +08:00
.search-field__input::placeholder {
color: var(--gallery-muted);
}
2026-05-29 13:30:56 +08:00
.search-field__action {
2026-05-31 18:36:52 +08:00
min-width: 52px;
height: 32px;
padding: 0 12px;
2026-05-29 13:30:56 +08:00
border: 1px solid color-mix(in srgb, var(--theme-primary) 54%, var(--theme-card-bg));
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 18%, var(--theme-card-bg));
font-size: 13px;
font-weight: 700;
cursor: pointer;
transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
2026-03-05 16:02:34 +08:00
}
2026-05-29 13:30:56 +08:00
.search-field__action:hover,
.search-field__action:focus {
color: var(--theme-card-bg);
background: var(--theme-primary-action);
}
.search-field__action:active {
transform: scale(0.96);
}
.category-rail {
display: flex;
2026-05-31 18:36:52 +08:00
gap: 8px;
overflow-x: auto;
overflow-y: hidden;
2026-05-31 18:36:52 +08:00
padding: 0 0 5px;
2026-05-29 13:30:56 +08:00
scroll-snap-type: x proximity;
scrollbar-width: none;
}
2026-05-29 13:30:56 +08:00
.category-rail::-webkit-scrollbar {
display: none;
}
.category-item {
flex: 0 0 auto;
2026-05-31 18:36:52 +08:00
min-height: 30px;
padding: 0 14px;
2026-05-29 13:30:56 +08:00
border: 1px solid var(--gallery-border);
border-radius: 999px;
color: var(--text-secondary);
2026-05-29 13:30:56 +08:00
background: var(--gallery-surface-strong);
font-size: 13px;
font-weight: 700;
2026-05-29 13:30:56 +08:00
letter-spacing: 0;
cursor: pointer;
scroll-snap-align: start;
transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
2026-05-29 13:30:56 +08:00
.category-item:hover,
.category-item:focus {
color: var(--theme-primary-action);
border-color: var(--theme-primary);
transform: translateY(-1px);
}
.category-item.active {
2026-05-29 13:30:56 +08:00
color: var(--theme-card-bg);
border-color: transparent;
2026-05-29 13:30:56 +08:00
background: var(--theme-primary-action);
box-shadow: var(--theme-button-shadow);
}
2026-05-29 13:30:56 +08:00
.page-banner {
display: inline-flex;
align-items: center;
max-width: 100%;
min-height: 34px;
margin-bottom: 14px;
padding: 0 14px;
border: 1px solid color-mix(in srgb, var(--theme-secondary) 36%, var(--theme-border));
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-secondary) 16%, var(--theme-card-bg));
font-size: 12px;
font-weight: 700;
line-height: 1.35;
}
2026-05-29 13:30:56 +08:00
.product-section {
min-height: 50vh;
}
.product-grid {
2026-05-29 13:30:56 +08:00
column-count: 2;
column-gap: 10px;
}
.product-card {
2026-05-29 13:30:56 +08:00
display: inline-block;
width: 100%;
margin: 0 0 10px;
overflow: hidden;
border: 1px solid color-mix(in srgb, var(--theme-card-bg) 70%, var(--theme-border));
border-radius: 24px;
color: inherit;
background: var(--gallery-surface);
box-shadow: var(--gallery-shadow);
backdrop-filter: blur(16px);
cursor: pointer;
break-inside: avoid;
transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.product-card:hover,
.product-card:focus {
border-color: color-mix(in srgb, var(--theme-primary) 58%, var(--theme-border));
box-shadow: 0 22px 52px color-mix(in srgb, var(--theme-primary) 18%, transparent);
transform: translateY(-2px);
outline: 0;
}
.product-media {
padding: 8px 8px 0;
}
.product-img {
width: 100%;
2026-05-29 13:30:56 +08:00
aspect-ratio: 3 / 4;
2026-02-24 09:59:22 +08:00
overflow: hidden;
2026-05-29 13:30:56 +08:00
border-radius: 20px;
background:
linear-gradient(145deg, var(--theme-primary-soft), color-mix(in srgb, var(--theme-secondary) 18%, var(--theme-card-bg)));
}
.product-card:nth-child(4n + 2) .product-img {
aspect-ratio: 4 / 5;
}
.product-card:nth-child(4n + 3) .product-img {
aspect-ratio: 1 / 1;
}
.product-card:nth-child(4n) .product-img {
aspect-ratio: 3 / 5;
2026-02-24 09:59:22 +08:00
}
.product-image {
width: 100%;
height: 100%;
object-fit: cover;
2026-05-29 13:30:56 +08:00
transition: transform 0.55s ease;
}
.product-card:hover .product-image,
.product-card:focus .product-image {
transform: scale(1.045);
2026-02-24 09:59:22 +08:00
}
.product-img-placeholder {
2026-05-29 13:30:56 +08:00
display: grid;
2026-02-24 09:59:22 +08:00
width: 100%;
height: 100%;
2026-05-29 13:30:56 +08:00
place-items: center;
color: color-mix(in srgb, var(--theme-primary-action) 30%, transparent);
font-family: "Playfair Display", "Times New Roman", serif;
font-size: 42px;
font-weight: 700;
2026-05-29 13:30:56 +08:00
}
.product-info {
display: grid;
gap: 10px;
padding: 12px 12px 14px;
}
.product-head {
display: grid;
grid-template-columns: minmax(0, 1fr) 32px;
align-items: start;
gap: 8px;
}
.product-title-block {
min-width: 0;
}
.name {
2026-05-29 13:30:56 +08:00
display: -webkit-box;
min-width: 0;
margin: 0;
overflow: hidden;
2026-05-29 13:30:56 +08:00
color: var(--text-primary);
font-size: 15px;
font-weight: 800;
line-height: 1.28;
letter-spacing: 0;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.shop-name {
2026-05-29 13:30:56 +08:00
margin: 5px 0 0;
overflow: hidden;
2026-05-29 13:30:56 +08:00
color: var(--gallery-muted);
font-size: 11px;
line-height: 1.3;
text-overflow: ellipsis;
2026-05-29 13:30:56 +08:00
white-space: nowrap;
2026-02-24 09:59:22 +08:00
}
.duration {
display: inline-flex;
align-items: center;
2026-05-29 13:30:56 +08:00
max-width: 100%;
margin-top: 7px;
color: var(--gallery-muted);
font-size: 11px;
line-height: 1.2;
white-space: nowrap;
2026-02-24 09:59:22 +08:00
}
2026-05-29 13:30:56 +08:00
.duration :deep(.anticon) {
flex: 0 0 auto;
margin-right: 5px;
color: var(--theme-secondary);
font-size: 13px;
}
.cart-btn {
display: inline-grid;
width: 32px;
height: 32px;
place-items: center;
border: 0;
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 28%, var(--theme-card-bg));
box-shadow: 0 8px 18px color-mix(in srgb, var(--theme-primary) 22%, transparent);
cursor: pointer;
transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.cart-btn:hover,
.cart-btn:focus {
color: var(--theme-card-bg);
background: var(--theme-primary-action);
outline: 0;
}
.cart-btn:active {
transform: scale(0.92);
}
.cart-btn-in-cart {
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-secondary) 28%, var(--theme-card-bg));
box-shadow: 0 8px 18px color-mix(in srgb, var(--theme-secondary) 22%, transparent);
2026-02-24 09:59:22 +08:00
}
.product-tags {
2026-05-29 13:30:56 +08:00
min-height: 24px;
max-height: 54px;
overflow: hidden;
2026-02-24 09:59:22 +08:00
}
2026-05-29 13:30:56 +08:00
.product-tags :deep(.ant-tag) {
max-width: 100%;
border-radius: 999px;
font-size: 11px;
line-height: 20px;
}
.card-foot {
display: flex;
2026-05-29 13:30:56 +08:00
align-items: flex-end;
justify-content: space-between;
2026-05-29 13:30:56 +08:00
gap: 8px;
}
.price {
margin: 0;
2026-05-29 13:30:56 +08:00
color: var(--theme-primary-action);
font-size: 15px;
font-weight: 800;
line-height: 1;
white-space: nowrap;
}
2026-05-29 13:30:56 +08:00
.stats {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 6px;
min-width: 0;
color: var(--gallery-muted);
font-size: 11px;
line-height: 1;
}
2026-05-29 13:30:56 +08:00
.stats span {
display: inline-flex;
align-items: center;
gap: 3px;
white-space: nowrap;
}
.stats :deep(.anticon) {
color: var(--theme-secondary);
font-size: 12px;
}
.empty-state,
.loading-state {
2026-05-29 13:30:56 +08:00
padding: 58px 0;
text-align: center;
2026-02-24 09:59:22 +08:00
}
2026-03-24 09:50:55 +08:00
2026-05-29 13:30:56 +08:00
.empty-state :deep(.ant-empty-description) {
color: var(--text-secondary);
}
.empty-state :deep(.ant-btn-primary) {
border-color: transparent;
background: var(--theme-primary-action);
box-shadow: var(--theme-button-shadow);
}
2026-05-31 18:36:52 +08:00
.back-to-top-button {
position: fixed;
right: max(18px, calc((100vw - var(--app-mobile-max-width, 480px)) / 2 + 18px));
bottom: calc(92px + env(safe-area-inset-bottom, 0px));
z-index: 120;
display: inline-grid;
width: 42px;
height: 42px;
place-items: center;
border: 1px solid color-mix(in srgb, var(--theme-primary) 36%, var(--theme-border));
border-radius: 999px;
color: var(--theme-card-bg);
background: var(--theme-primary-action);
box-shadow: 0 14px 34px color-mix(in srgb, var(--theme-primary) 26%, transparent);
cursor: pointer;
transition: transform 0.18s ease, opacity 0.18s ease;
}
.back-to-top-button:hover,
.back-to-top-button:focus {
transform: translateY(-2px);
outline: 0;
}
.back-to-top-button:active {
transform: scale(0.94);
}
2026-05-29 13:30:56 +08:00
@media (max-width: 360px) {
.product-list-page {
--gallery-gutter: 14px;
}
2026-05-29 13:30:56 +08:00
.search-field {
grid-template-columns: 20px minmax(0, 1fr) auto;
gap: 7px;
padding-left: 14px;
}
2026-05-29 13:30:56 +08:00
.search-field__action {
min-width: 50px;
padding: 0 11px;
}
.product-grid {
2026-05-29 13:30:56 +08:00
column-gap: 8px;
}
.product-info {
padding-right: 10px;
padding-left: 10px;
}
}
@media (min-width: 768px) {
.gallery-header {
top: 0;
left: 50%;
width: min(100%, var(--frontend-page-max-width), calc(100vw - 48px));
border-top-left-radius: 32px;
border-top-right-radius: 32px;
transform: translateX(-50%);
2026-03-24 09:50:55 +08:00
}
}
2026-03-19 20:51:07 +08:00
</style>