1044 lines
32 KiB
Vue
1044 lines
32 KiB
Vue
<template>
|
||
<div class="mobile-container product-list-page">
|
||
<header class="gallery-header">
|
||
<span class="header-spacer" aria-hidden="true"></span>
|
||
<div class="brand-lockup" :aria-label="currentShopName">
|
||
<h1>{{ currentShopName }}</h1>
|
||
</div>
|
||
<span class="header-spacer" aria-hidden="true"></span>
|
||
</header>
|
||
|
||
<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
|
||
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('全部')"
|
||
>
|
||
全部款式
|
||
</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>
|
||
</section>
|
||
|
||
<div v-if="activeBannerText" class="page-banner" role="status">
|
||
{{ activeBannerText }}
|
||
</div>
|
||
|
||
<section class="product-section" aria-label="作品列表">
|
||
<div class="product-grid">
|
||
<article
|
||
v-for="item in products"
|
||
:key="item.id"
|
||
class="product-card"
|
||
role="button"
|
||
tabindex="0"
|
||
@click="handleProductClick(item)"
|
||
@keydown.enter="handleProductClick(item)"
|
||
@keydown.space.prevent="handleProductClick(item)"
|
||
>
|
||
<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>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="product-info">
|
||
<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 />
|
||
<span>{{ displayProductDuration(item) }}</span>
|
||
</div>
|
||
</div>
|
||
<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" />
|
||
<ShoppingCartOutlined v-else />
|
||
</button>
|
||
</div>
|
||
|
||
<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',
|
||
color: tag.textColor || 'var(--text-primary)',
|
||
backgroundColor: tag.bgColor || 'var(--theme-primary-soft)',
|
||
borderColor: tag.borderColor || 'var(--theme-border)'
|
||
}"
|
||
>
|
||
{{ tag.tagName }}
|
||
</a-tag>
|
||
</template>
|
||
<a-tag v-else size="small" color="default">精选款式</a-tag>
|
||
</div>
|
||
|
||
<div class="card-foot">
|
||
<p class="price">参考价 ¥{{ Number(item.price || 0).toFixed(2) }}</p>
|
||
<div class="stats">
|
||
<span><HeartOutlined />{{ item.likeCount || 0 }}</span>
|
||
<span><StarOutlined />{{ item.collectCount || 0 }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</article>
|
||
</div>
|
||
|
||
<div v-if="products.length === 0 && !loading" class="empty-state">
|
||
<a-empty description="暂时没有匹配的作品">
|
||
<a-button type="primary" @click="resetFilters">查看全部作品</a-button>
|
||
</a-empty>
|
||
</div>
|
||
|
||
<div v-if="loading" class="loading-state">
|
||
<a-spin />
|
||
</div>
|
||
</section>
|
||
</main>
|
||
|
||
<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.
|
||
*/
|
||
import { computed, inject, onMounted, onUnmounted, ref, watch } from 'vue'
|
||
import { useRouter, useRoute } from 'vue-router'
|
||
import {
|
||
CheckOutlined,
|
||
ClockCircleOutlined,
|
||
HeartOutlined,
|
||
SearchOutlined,
|
||
ShoppingCartOutlined,
|
||
StarOutlined,
|
||
UpOutlined
|
||
} from '@ant-design/icons-vue'
|
||
import { message } from 'ant-design-vue'
|
||
/**
|
||
* 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.
|
||
*/
|
||
import { productApi, type ProductVO } from '@/api/product'
|
||
/**
|
||
* 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'
|
||
import { getCachedSignedImageUrls, getCachedSignedImageUrlsSync, parseImageFileIds } from '@/utils/signed-image-cache'
|
||
|
||
/**
|
||
* 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
|
||
}
|
||
|
||
/**
|
||
* 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()
|
||
/**
|
||
* 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()
|
||
/**
|
||
* 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.
|
||
*/
|
||
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
|
||
|
||
/** 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('')
|
||
const selectedShopId = ref('')
|
||
const bookableOnly = ref(false)
|
||
/**
|
||
* 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. */
|
||
const loading = ref(false)
|
||
/** 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. */
|
||
const showSearch = ref(false)
|
||
/** searchKeyword is a reactive state variable used by the template and event handlers. */
|
||
const searchKeyword = ref('')
|
||
/**
|
||
* 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.
|
||
*/
|
||
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>())
|
||
/**
|
||
* 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
|
||
|
||
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
|
||
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
|
||
/** 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()}”的匹配结果`
|
||
}
|
||
if (selectedShopId.value && bookableOnly.value) {
|
||
return `当前显示“${currentShopName.value}”的可预约作品`
|
||
}
|
||
if (selectedShopId.value) {
|
||
return `当前显示“${currentShopName.value}”的作品`
|
||
}
|
||
if (selectedCategory.value !== '全部') {
|
||
return `当前按场景“${selectedCategory.value}”筛选`
|
||
}
|
||
return ''
|
||
})
|
||
|
||
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
|
||
}
|
||
|
||
/**
|
||
* 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) {
|
||
imageUrls.value[String(product.id)] = [DEFAULT_PRODUCT_IMAGE]
|
||
continue
|
||
}
|
||
|
||
const ids = parseImageFileIds(product.imageFileIds)
|
||
const cachedUrls = getCachedSignedImageUrlsSync(ids)
|
||
if (cachedUrls.length) {
|
||
imageUrls.value[String(product.id)] = cachedUrls
|
||
}
|
||
|
||
const urls = await getCachedSignedImageUrls(ids, DEFAULT_PRODUCT_IMAGE)
|
||
imageUrls.value[String(product.id)] = urls.length ? urls : [DEFAULT_PRODUCT_IMAGE]
|
||
}
|
||
}
|
||
/** getProductImages is a local helper used by this page script. */
|
||
const getProductImages = (product: ProductVO): string[] => imageUrls.value[String(product.id)] || [DEFAULT_PRODUCT_IMAGE]
|
||
|
||
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. */
|
||
const fetchTags = async () => {
|
||
try {
|
||
const response = await tagApi.getFilterOptions() as unknown as TagFilterGroupVO[]
|
||
filterGroups.value = Array.isArray(response) ? response : []
|
||
} catch (error: any) {
|
||
console.error('获取标签失败:', error)
|
||
filterGroups.value = []
|
||
}
|
||
}
|
||
|
||
/** fetchProducts is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||
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()
|
||
} else {
|
||
const pageResult = await productApi.getProductPage({
|
||
page: 1,
|
||
size: 200,
|
||
tagIds: selectedTagId.value
|
||
})
|
||
response = pageResult.list || []
|
||
}
|
||
|
||
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 = []
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
/** 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() : ''
|
||
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)
|
||
|
||
searchKeyword.value = keyword
|
||
showSearch.value = Boolean(keyword)
|
||
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()
|
||
}
|
||
|
||
/** 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
|
||
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)
|
||
searchKeyword.value = ''
|
||
showSearch.value = false
|
||
useGlobalLoadingForNextRouteSync = true
|
||
router.replace({
|
||
path: '/products',
|
||
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)
|
||
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',
|
||
query: keyword ? { ...getScopedRouteQuery(), keyword } : getScopedRouteQuery()
|
||
})
|
||
}
|
||
|
||
/** resetFilters is a local helper used by this page script. */
|
||
const resetFilters = () => {
|
||
selectedCategory.value = '全部'
|
||
selectedTagId.value = ''
|
||
searchKeyword.value = ''
|
||
showSearch.value = false
|
||
bookableOnly.value = false
|
||
useGlobalLoadingForNextRouteSync = true
|
||
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' })
|
||
}
|
||
|
||
watch(
|
||
() => route.query,
|
||
async () => {
|
||
await syncRouteFilters()
|
||
},
|
||
{ deep: true }
|
||
)
|
||
|
||
onMounted(async () => {
|
||
await fetchTags()
|
||
await syncRouteFilters()
|
||
handleWindowScroll()
|
||
window.addEventListener('scroll', handleWindowScroll, { passive: true })
|
||
})
|
||
|
||
onUnmounted(() => {
|
||
window.removeEventListener('scroll', handleWindowScroll)
|
||
})
|
||
</script>
|
||
|
||
<style scoped>
|
||
.product-list-page {
|
||
--gallery-header-height: 52px;
|
||
--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;
|
||
padding: var(--gallery-header-height) 0 calc(104px + env(safe-area-inset-bottom, 0px));
|
||
color: var(--text-primary);
|
||
background:
|
||
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%);
|
||
}
|
||
|
||
.gallery-header {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 50%;
|
||
z-index: 100;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
width: min(100%, var(--app-mobile-max-width, 480px));
|
||
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);
|
||
transform: translateX(-50%);
|
||
}
|
||
|
||
.header-spacer {
|
||
flex: 0 0 36px;
|
||
width: 36px;
|
||
height: 36px;
|
||
}
|
||
|
||
.brand-lockup {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-width: 0;
|
||
}
|
||
|
||
.brand-lockup h1 {
|
||
margin: 0;
|
||
overflow: hidden;
|
||
color: var(--text-primary);
|
||
font-size: 16px;
|
||
font-weight: 800;
|
||
line-height: 1;
|
||
letter-spacing: 0;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.gallery-content {
|
||
padding: 0 var(--gallery-gutter);
|
||
}
|
||
|
||
.search-panel {
|
||
display: grid;
|
||
gap: 10px;
|
||
margin-bottom: 12px;
|
||
}
|
||
|
||
.search-field {
|
||
display: grid;
|
||
grid-template-columns: 22px minmax(0, 1fr) auto;
|
||
align-items: center;
|
||
gap: 8px;
|
||
min-height: 46px;
|
||
padding: 6px 7px 6px 15px;
|
||
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);
|
||
font-size: 18px;
|
||
}
|
||
|
||
.search-field__input {
|
||
min-width: 0;
|
||
border: 0;
|
||
outline: 0;
|
||
color: var(--text-primary);
|
||
background: transparent;
|
||
font-size: 15px;
|
||
line-height: 1.4;
|
||
}
|
||
|
||
.search-field__input::placeholder {
|
||
color: var(--gallery-muted);
|
||
}
|
||
|
||
.search-field__action {
|
||
min-width: 52px;
|
||
height: 32px;
|
||
padding: 0 12px;
|
||
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;
|
||
}
|
||
|
||
.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;
|
||
gap: 8px;
|
||
overflow-x: auto;
|
||
overflow-y: hidden;
|
||
padding: 0 0 5px;
|
||
scroll-snap-type: x proximity;
|
||
scrollbar-width: none;
|
||
}
|
||
|
||
.category-rail::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
|
||
.category-item {
|
||
flex: 0 0 auto;
|
||
min-height: 30px;
|
||
padding: 0 14px;
|
||
border: 1px solid var(--gallery-border);
|
||
border-radius: 999px;
|
||
color: var(--text-secondary);
|
||
background: var(--gallery-surface-strong);
|
||
font-size: 13px;
|
||
font-weight: 700;
|
||
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;
|
||
}
|
||
|
||
.category-item:hover,
|
||
.category-item:focus {
|
||
color: var(--theme-primary-action);
|
||
border-color: var(--theme-primary);
|
||
transform: translateY(-1px);
|
||
}
|
||
|
||
.category-item.active {
|
||
color: var(--theme-card-bg);
|
||
border-color: transparent;
|
||
background: var(--theme-primary-action);
|
||
box-shadow: var(--theme-button-shadow);
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
.product-section {
|
||
min-height: 50vh;
|
||
}
|
||
|
||
.product-grid {
|
||
column-count: 2;
|
||
column-gap: 10px;
|
||
}
|
||
|
||
.product-card {
|
||
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%;
|
||
aspect-ratio: 3 / 4;
|
||
overflow: hidden;
|
||
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;
|
||
}
|
||
|
||
.product-image {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
transition: transform 0.55s ease;
|
||
}
|
||
|
||
.product-card:hover .product-image,
|
||
.product-card:focus .product-image {
|
||
transform: scale(1.045);
|
||
}
|
||
|
||
.product-img-placeholder {
|
||
display: grid;
|
||
width: 100%;
|
||
height: 100%;
|
||
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;
|
||
}
|
||
|
||
.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 {
|
||
display: -webkit-box;
|
||
min-width: 0;
|
||
margin: 0;
|
||
overflow: hidden;
|
||
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 {
|
||
margin: 5px 0 0;
|
||
overflow: hidden;
|
||
color: var(--gallery-muted);
|
||
font-size: 11px;
|
||
line-height: 1.3;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.duration {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
max-width: 100%;
|
||
margin-top: 7px;
|
||
color: var(--gallery-muted);
|
||
font-size: 11px;
|
||
line-height: 1.2;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
.product-tags {
|
||
min-height: 24px;
|
||
max-height: 54px;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.product-tags :deep(.ant-tag) {
|
||
max-width: 100%;
|
||
border-radius: 999px;
|
||
font-size: 11px;
|
||
line-height: 20px;
|
||
}
|
||
|
||
.card-foot {
|
||
display: flex;
|
||
align-items: flex-end;
|
||
justify-content: space-between;
|
||
gap: 8px;
|
||
}
|
||
|
||
.price {
|
||
margin: 0;
|
||
color: var(--theme-primary-action);
|
||
font-size: 15px;
|
||
font-weight: 800;
|
||
line-height: 1;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
.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 {
|
||
padding: 58px 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
@media (max-width: 360px) {
|
||
.product-list-page {
|
||
--gallery-gutter: 14px;
|
||
}
|
||
|
||
.search-field {
|
||
grid-template-columns: 20px minmax(0, 1fr) auto;
|
||
gap: 7px;
|
||
padding-left: 14px;
|
||
}
|
||
|
||
.search-field__action {
|
||
min-width: 50px;
|
||
padding: 0 11px;
|
||
}
|
||
|
||
.product-grid {
|
||
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%);
|
||
}
|
||
}
|
||
</style>
|