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

1899 lines
53 KiB
Vue
Raw Normal View History

<template>
<div class="detail-page">
2026-05-31 18:36:52 +08:00
<nav class="detail-floating-nav" aria-label="作品详情导航">
2026-05-29 13:30:56 +08:00
<a-button class="nav-button" type="text" aria-label="返回" @click="router.back()">
<LeftOutlined />
</a-button>
2026-06-04 16:39:06 +08:00
<strong class="detail-floating-title">{{ shopDisplayName }}</strong>
2026-05-31 18:36:52 +08:00
<a-button class="nav-button" type="text" aria-label="分享作品" @click="copyShareLink">
<ShareAltOutlined />
</a-button>
2026-05-31 18:36:52 +08:00
</nav>
2026-05-29 13:30:56 +08:00
<main class="detail-content" :class="{ 'detail-content-error': loadError }">
<a-result v-if="loadError" status="warning" title="暂时无法查看作品详情" :sub-title="loadError">
<template #extra>
<a-button type="primary" @click="router.back()">返回上一页</a-button>
</template>
</a-result>
<template v-else>
2026-05-31 18:36:52 +08:00
<section class="hero-section" aria-label="作品图片">
2026-05-29 13:30:56 +08:00
<a-carousel
v-if="productImages.length > 1"
2026-06-04 16:39:06 +08:00
:key="heroCarouselKey"
2026-05-29 13:30:56 +08:00
class="hero-carousel"
dots
autoplay
2026-06-04 16:39:06 +08:00
:initial-slide="0"
2026-05-29 13:30:56 +08:00
:autoplay-speed="3500"
>
<div v-for="(image, index) in productImages" :key="`${image}-${index}`" class="hero-slide-frame">
2026-06-04 16:39:06 +08:00
<button class="hero-image-button" type="button" @click="openProductImagePreview(index)">
<img
class="hero-image"
:src="image"
:alt="`${productTitle} 图片 ${index + 1}`"
:loading="index === 0 ? 'eager' : 'lazy'"
decoding="async"
/>
</button>
2026-05-29 13:30:56 +08:00
</div>
</a-carousel>
<div v-else-if="productImagesReady || productImages.length" class="hero-carousel hero-carousel-single">
2026-06-04 16:39:06 +08:00
<button
v-for="(image, index) in heroPreviewImages"
2026-05-29 13:30:56 +08:00
:key="`${image}-${index}`"
2026-06-04 16:39:06 +08:00
class="hero-image-button"
type="button"
@click="openProductImagePreview(index)"
>
<img
class="hero-image"
:src="image"
:alt="`${productTitle} 图片 ${index + 1}`"
:loading="index === 0 ? 'eager' : 'lazy'"
decoding="async"
/>
</button>
2026-05-29 13:30:56 +08:00
</div>
<div v-else class="hero-carousel hero-carousel-single" aria-hidden="true"></div>
</section>
<section class="info-section">
2026-05-31 18:36:52 +08:00
<div class="primary-info">
<div class="product-copy">
2026-05-29 13:30:56 +08:00
<h1>{{ productTitle }}</h1>
2026-05-31 18:36:52 +08:00
<div class="duration-row">
<ClockCircleOutlined />
<span>预计时长 {{ displayDurationText }}</span>
2026-05-29 13:30:56 +08:00
</div>
</div>
2026-06-04 16:39:06 +08:00
<p class="price">参考价 ¥{{ Number(product.price || 0).toFixed(2) }}</p>
</div>
2026-05-29 13:30:56 +08:00
<button class="shop-card" type="button" :disabled="!shopInfo?.id" @click="openShopDetail">
2026-05-31 18:36:52 +08:00
<span class="shop-avatar">
2026-05-29 13:30:56 +08:00
<ShopOutlined />
</span>
2026-05-31 18:36:52 +08:00
<span class="shop-summary">
<strong>{{ shopDisplayName }}</strong>
<span class="shop-rating">
<StarFilled />
{{ shopRatingText }}
</span>
<span>{{ shopMetaText }}</span>
2026-05-29 13:30:56 +08:00
</span>
2026-05-31 18:36:52 +08:00
<RightOutlined class="shop-more" />
2026-05-29 13:30:56 +08:00
</button>
2026-05-31 18:36:52 +08:00
<section class="artist-section" aria-labelledby="artist-section-title">
<div class="section-title-row">
<h2 id="artist-section-title">选择美甲师</h2>
2026-05-29 13:30:56 +08:00
</div>
2026-05-31 18:36:52 +08:00
<div class="artist-strip">
<button
v-for="artist in artistOptions"
:key="artist.key"
class="artist-option"
:class="{ active: selectedArtistKey === artist.key }"
type="button"
@click="selectedArtistKey = artist.key"
>
<span class="artist-portrait">
<UserOutlined />
<span v-if="artist.preferred" class="artist-verified">
<CheckCircleFilled />
</span>
</span>
<strong>{{ artist.name }}</strong>
<small>{{ artist.caption }}</small>
</button>
2026-05-29 13:30:56 +08:00
</div>
2026-05-31 18:36:52 +08:00
</section>
2026-05-31 18:36:52 +08:00
<section class="description-section" aria-labelledby="description-section-title">
<h2 id="description-section-title">作品简介</h2>
<p>{{ product.description || '店家暂未补充作品说明。' }}</p>
2026-05-31 18:36:52 +08:00
<div class="tags">
<a-tag v-for="tag in product.tagInfos || []" :key="tag.id" class="detail-tag">{{ tag.tagName }}</a-tag>
<a-tag v-if="!product.tagInfos?.length" class="detail-tag">暂无标签</a-tag>
</div>
</section>
<div v-if="product.targetAudience || product.precautions" class="guidance-grid">
<section v-if="product.targetAudience" class="guidance-panel">
<h3>适合人群</h3>
<p>{{ product.targetAudience }}</p>
</section>
<section v-if="product.precautions" class="guidance-panel">
<h3>注意事项</h3>
<p>{{ product.precautions }}</p>
</section>
</div>
2026-05-31 18:36:52 +08:00
<div class="engagement-row">
<button class="action-pill" type="button" :class="{ active: isLiked }" @click="handleLikeClick">
<component :is="isLiked ? HeartFilled : HeartOutlined" />
{{ product.likeCount || 0 }} 点赞
</button>
<button class="action-pill" type="button" :class="{ active: isFavorite }" @click="handleFavoriteClick">
<component :is="isFavorite ? StarFilled : StarOutlined" />
{{ product.collectCount || 0 }} 收藏
</button>
</div>
</section>
2026-05-31 18:36:52 +08:00
<section class="review-section" aria-labelledby="review-section-title">
<div class="section-title-row">
<h2 id="review-section-title">用户评价</h2>
<span>{{ comments.length }} 条</span>
</div>
<div class="comment-editor">
2026-05-31 18:36:52 +08:00
<div v-if="!replyTarget" class="comment-rating-row">
<span>评价星级</span>
<div class="rating-star-group" role="radiogroup" aria-label="选择评价星级">
<button
v-for="item in 5"
:key="item"
class="rating-star-button"
:class="{ active: item <= commentRating }"
type="button"
role="radio"
:aria-checked="item === commentRating"
@click="commentRating = item"
>
<component :is="item <= commentRating ? StarFilled : StarOutlined" />
</button>
</div>
<small>{{ commentRating }} 星</small>
</div>
<a-upload
v-if="!replyTarget"
v-model:file-list="commentImageFileList"
class="comment-image-upload"
list-type="picture-card"
accept="image/*"
multiple
:max-count="MAX_COMMENT_IMAGES"
:before-upload="beforeUploadCommentImage"
:custom-request="handleUploadCommentImage"
@remove="handleRemoveCommentImage"
>
<div v-if="commentImageFileList.length < MAX_COMMENT_IMAGES" class="comment-upload-trigger">
<PlusOutlined />
<span>图片</span>
</div>
</a-upload>
2026-05-29 13:30:56 +08:00
<a-textarea
v-model:value="commentText"
:maxlength="300"
:rows="3"
:placeholder="replyTarget ? `回复 ${replyTarget.userNickname || '用户'}` : '说说你的看法'"
/>
<div class="comment-tools">
2026-05-31 18:36:52 +08:00
<a-button v-if="replyTarget" type="text" @click="cancelReply">取消回复</a-button>
<a-button type="primary" :loading="submittingComment" @click="submitComment">发布</a-button>
</div>
</div>
<a-empty v-if="!comments.length" description="还没有评论,来写第一条吧" />
2026-05-31 18:36:52 +08:00
<div v-for="comment in comments" :key="comment.id" class="review-card">
<div class="review-card-head">
<div class="review-user">
<span class="review-avatar">{{ (comment.userNickname || '用').slice(0, 1) }}</span>
<span>
<strong>{{ comment.userNickname || '用户' }}</strong>
<small>{{ formatTime(comment.createTime) }}</small>
</span>
</div>
<span class="review-stars" :aria-label="`${normalizeCommentRating(comment.ratingScore)}星评价`">
<component
:is="filled ? StarFilled : StarOutlined"
v-for="(filled, index) in buildRatingStars(comment.ratingScore)"
:key="index"
:class="{ 'star-empty': !filled }"
/>
</span>
</div>
<p>{{ comment.commentContent }}</p>
2026-05-31 18:36:52 +08:00
<div v-if="comment.imageUrls?.length" class="review-images">
<a-image
v-for="(image, index) in comment.imageUrls"
:key="`${comment.id}-${index}`"
class="review-image"
:src="image"
:preview="{ src: image }"
/>
</div>
<button class="reply-button" type="button" @click="startReply(comment)">回复</button>
<div v-if="comment.replies?.length" class="reply-list">
<div v-for="reply in comment.replies" :key="reply.id" class="reply-item">
<strong>{{ reply.userNickname || '用户' }}</strong>
<span>{{ reply.commentContent }}</span>
</div>
</div>
</div>
</section>
2026-05-31 18:36:52 +08:00
<section class="booking-note" aria-label="预约说明">
<span class="shop-avatar">
<ClockCircleOutlined />
</span>
<span>
<strong>预约提醒</strong>
<small>{{ earliestBookableText }},最终接待人员与时段以门店确认为准。</small>
</span>
</section>
</template>
</main>
<footer v-if="!loadError" class="detail-footer">
2026-05-29 13:30:56 +08:00
<div class="footer-inner">
<a-button class="footer-favorite" size="large" :aria-label="isFavorite ? '取消收藏' : '收藏作品'" @click="handleFavoriteClick">
<component :is="isFavorite ? StarFilled : StarOutlined" :class="{ active: isFavorite }" />
</a-button>
<a-button class="cart-button" size="large" @click="handleAddToCart">
<ShoppingCartOutlined />加入购物车
</a-button>
<a-button class="book-button" type="primary" size="large" @click="handleBuyNow">
<ThunderboltOutlined />立即预约
</a-button>
</div>
</footer>
2026-06-04 16:39:06 +08:00
<a-modal
v-model:open="productImagePreviewVisible"
:title="productTitle"
:footer="null"
:width="820"
class="product-image-preview-modal"
@cancel="closeProductImagePreview"
>
<img :src="currentPreviewImage" :alt="`${productTitle} 预览图`" class="product-image-preview" />
</a-modal>
</div>
</template>
<script setup lang="ts">
/**
* ProductDetailView 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, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import {
2026-05-31 18:36:52 +08:00
CheckCircleFilled,
ClockCircleOutlined,
HeartFilled,
HeartOutlined,
LeftOutlined,
2026-05-31 18:36:52 +08:00
PlusOutlined,
RightOutlined,
ShareAltOutlined,
ShoppingCartOutlined,
ShopOutlined,
StarFilled,
StarOutlined,
2026-05-31 18:36:52 +08:00
ThunderboltOutlined,
UserOutlined
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
2026-05-31 18:36:52 +08:00
import type { UploadProps } from 'ant-design-vue'
import { cartApi } from '@/api/cart'
2026-05-23 18:44:57 +08:00
/**
* Purpose: CommentVO supports ProductDetailView.vue by holding or executing the comment 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 { commentApi, type CommentVO } from '@/api/comment'
2026-05-23 18:44:57 +08:00
/**
* Purpose: ProductVO supports ProductDetailView.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'
import { productLikeApi } from '@/api/productLike'
2026-05-23 18:44:57 +08:00
/**
* Purpose: ShopVO supports ProductDetailView.vue by holding or executing the shop 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 { shopApi, type ShopVO } from '@/api/shop'
import { wishlistApi } from '@/api/wishlist'
import { DEFAULT_PRODUCT_IMAGE } from '@/constants'
2026-03-27 14:55:41 +08:00
import type { IdType } from '@/utils/id'
import { toOptionalIdString } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
2026-05-29 13:30:56 +08:00
import { getCachedSignedImageUrls, getCachedSignedImageUrlsSync, parseImageFileIds } from '@/utils/signed-image-cache'
2026-05-31 18:36:52 +08:00
import { buildRatingStars, normalizeCommentRating } from '@/utils/comment-review'
2026-05-23 18:44:57 +08:00
/**
* Purpose: route supports ProductDetailView.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: router supports ProductDetailView.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: updateCartCount supports ProductDetailView.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-02-28 17:09:45 +08:00
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
2026-05-23 18:44:57 +08:00
/**
* Purpose: product supports ProductDetailView.vue by holding or executing the product 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 product = ref<ProductVO>({} as ProductVO)
2026-05-23 18:44:57 +08:00
/**
* Purpose: shopInfo supports ProductDetailView.vue by holding or executing the shop info 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 shopInfo = ref<ShopVO | null>(null)
2026-05-23 18:44:57 +08:00
/**
* Purpose: productImages supports ProductDetailView.vue by holding or executing the product images 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-02-26 11:16:24 +08:00
const productImages = ref<string[]>([])
2026-05-29 13:30:56 +08:00
/** productImagesReady prevents the default fallback image from flashing before cached URLs are restored. */
const productImagesReady = ref(false)
2026-06-04 16:39:06 +08:00
const productImagePreviewVisible = ref(false)
const productImagePreviewIndex = ref(0)
2026-05-23 18:44:57 +08:00
/**
* Purpose: comments supports ProductDetailView.vue by holding or executing the comments 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 comments = ref<CommentVO[]>([])
/** commentText is a reactive state variable used by the template and event handlers. */
const commentText = ref('')
2026-05-23 18:44:57 +08:00
/**
* Purpose: replyTarget supports ProductDetailView.vue by holding or executing the reply target 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 replyTarget = ref<CommentVO | null>(null)
/** submittingComment is a reactive state variable used by the template and event handlers. */
const submittingComment = ref(false)
2026-05-31 18:36:52 +08:00
const commentRating = ref(5)
const commentImageFileList = ref<any[]>([])
const commentImageIds = ref<IdType[]>([])
const uploadingCommentImages = ref(0)
const MAX_COMMENT_IMAGES = 6
/** isFavorite is a reactive state variable used by the template and event handlers. */
const isFavorite = ref(false)
/** isLiked is a reactive state variable used by the template and event handlers. */
const isLiked = ref(false)
/** loadError is a reactive state variable used by the template and event handlers. */
const loadError = ref('')
2026-05-31 18:36:52 +08:00
/** selectedArtistKey stores the visual technician selection from the Stitch-style strip. */
const selectedArtistKey = ref('primary-artist')
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
/** productTitle is a reactive state variable used by the template and event handlers. */
const productTitle = computed(() => product.value.title || product.value.name || '作品详情')
2026-05-31 18:36:52 +08:00
const formatDurationText = (value?: string | number | null) => {
if (value === undefined || value === null || value === '') return ''
const text = String(value).trim()
if (!text) return ''
return /分钟|小时|h|min/i.test(text) ? text : `${text}分钟`
}
const displayDurationText = computed(() => {
return formatDurationText(product.value.approximateDuration)
|| formatDurationText(product.value.serviceDurationMinutes)
|| formatDurationText(product.value.estimatedTime)
|| '60分钟'
})
/** artistCount is a reactive state variable used by the template and event handlers. */
const artistCount = computed(() => {
if (typeof product.value.availableBookableArtistCount === 'number') return product.value.availableBookableArtistCount
return String(product.value.bookableArtists || '').split(',').map(id => id.trim()).filter(Boolean).length
})
/** artistCountText is a reactive state variable used by the template and event handlers. */
const artistCountText = computed(() => artistCount.value > 0 ? `${artistCount.value} 位` : (product.value.bookableArtistRestricted ? '暂无可约' : '门店安排'))
/** earliestBookableText is a reactive state variable used by the template and event handlers. */
const earliestBookableText = computed(() => shopInfo.value?.businessHours || '以门店安排为准')
2026-05-31 18:36:52 +08:00
const shopDisplayName = computed(() => shopInfo.value?.shopName || product.value.shopName || '当前门店')
2026-06-04 16:39:06 +08:00
const heroPreviewImages = computed(() => productImages.value.length ? productImages.value : [DEFAULT_PRODUCT_IMAGE])
const heroCarouselKey = computed(() => {
const productKey = toOptionalIdString(product.value.id) || toOptionalIdString(route.params.id) || 'pending'
return `${productKey}-${heroPreviewImages.value[0] || DEFAULT_PRODUCT_IMAGE}-${heroPreviewImages.value.length}`
})
const currentPreviewImage = computed(() => {
return heroPreviewImages.value[productImagePreviewIndex.value] || heroPreviewImages.value[0] || DEFAULT_PRODUCT_IMAGE
})
2026-05-31 18:36:52 +08:00
const shopMetaText = computed(() => {
const details = [shopInfo.value?.businessHours, shopInfo.value?.address].filter(Boolean)
return details.length ? details.join(' · ') : '门店信息待完善'
2026-05-29 13:30:56 +08:00
})
2026-05-31 18:36:52 +08:00
const shopRatingText = computed(() => {
const heat = Number(product.value.likeCount || 0) + Number(product.value.collectCount || 0)
return heat > 0 ? `热度 ${heat}` : '精选款式'
})
const artistOptions = computed(() => {
const count = Math.max(0, artistCount.value)
if (count <= 0) {
return [{
key: 'primary-artist',
name: product.value.bookableArtistRestricted ? '暂无可约' : '门店安排',
caption: artistCountText.value,
preferred: true
}]
}
2026-05-31 18:36:52 +08:00
return Array.from({ length: count }, (_, index) => ({
key: index === 0 ? 'primary-artist' : `artist-${index + 1}`,
name: count === 1 ? '门店推荐' : `美甲师 ${index + 1}`,
caption: index === 0 ? '推荐' : '可预约',
preferred: index === 0
}))
})
2026-05-23 18:44:57 +08:00
/**
* Purpose: copyShareLink supports ProductDetailView.vue by holding or executing the copy share link 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 copyShareLink = async () => {
const url = `${window.location.origin}/product/${route.params.id}`
try {
await navigator.clipboard.writeText(url)
message.success('分享链接已复制,未登录用户也可以查看详情')
} catch {
message.warning(url)
}
}
2026-06-04 16:39:06 +08:00
const openProductImagePreview = (index: number) => {
productImagePreviewIndex.value = Math.max(0, Math.min(index, heroPreviewImages.value.length - 1))
productImagePreviewVisible.value = true
}
const closeProductImagePreview = () => {
productImagePreviewVisible.value = false
}
/** requireLogin is a local helper used by this page script. */
const requireLogin = (actionText: string) => {
if (isLoggedIn.value) return true
message.info(`${actionText}前请先登录`)
router.push('/')
return false
2026-03-05 15:15:59 +08:00
}
/** loadProductImages is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
2026-02-26 11:16:24 +08:00
const loadProductImages = async () => {
2026-05-29 13:30:56 +08:00
productImagesReady.value = false
2026-06-04 16:39:06 +08:00
productImagePreviewIndex.value = 0
2026-05-29 13:30:56 +08:00
const fileIds = parseImageFileIds(product.value.imageFileIds)
if (!fileIds.length) {
2026-05-29 13:30:56 +08:00
const fallbackImages = [DEFAULT_PRODUCT_IMAGE]
productImages.value = fallbackImages
productImagesReady.value = true
return
}
2026-05-29 13:30:56 +08:00
const cachedImages = getCachedSignedImageUrlsSync(fileIds)
if (cachedImages.length) {
productImages.value = cachedImages
productImagesReady.value = true
}
2026-05-29 13:30:56 +08:00
const nextImages = await getCachedSignedImageUrls(fileIds, DEFAULT_PRODUCT_IMAGE)
productImages.value = nextImages
productImagesReady.value = true
}
/** loadShopInfo is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
2026-03-27 14:55:41 +08:00
const loadShopInfo = async (shopId?: IdType | null) => {
shopInfo.value = shopId ? await shopApi.getShopById(shopId).catch(() => null) : null
2026-02-26 11:16:24 +08:00
}
/** loadComments is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const loadComments = async () => {
if (!product.value.id) return
comments.value = await commentApi.listByProduct(product.value.id).catch(() => [])
}
/** checkInteractionStatus is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const checkInteractionStatus = async () => {
if (!isLoggedIn.value || !product.value.id) {
isFavorite.value = false
isLiked.value = false
return
}
const [favorite, liked] = await Promise.all([
wishlistApi.checkWishlist(product.value.id).catch(() => false),
productLikeApi.checkLikeStatus(product.value.id).catch(() => false)
])
isFavorite.value = Boolean(favorite)
isLiked.value = Boolean(liked)
}
/** fetchProductDetail is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const fetchProductDetail = async () => {
loadError.value = ''
2026-06-04 16:39:06 +08:00
productImages.value = []
productImagesReady.value = false
productImagePreviewVisible.value = false
productImagePreviewIndex.value = 0
try {
2026-03-27 14:55:41 +08:00
const productId = toOptionalIdString(route.params.id)
if (!productId) throw new Error('作品不存在')
const response = await productApi.getProductById(productId)
if (!response?.id) throw new Error('作品不存在或已下架')
product.value = response
await Promise.all([loadProductImages(), loadShopInfo(response.shopId), checkInteractionStatus(), loadComments()])
} catch (error: any) {
loadError.value = error?.message || '网络异常,请稍后再试'
}
2026-02-26 11:16:24 +08:00
}
/** openShopDetail is a local helper used by this page script. */
const openShopDetail = () => {
if (shopInfo.value?.id) router.push(`/shop/${shopInfo.value.id}`)
}
/** handleFavoriteClick is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const handleFavoriteClick = async () => {
if (!product.value.id || !requireLogin('收藏作品')) return
await runWithGlobalLoading(async () => {
if (isFavorite.value) {
await wishlistApi.removeFromWishlist(product.value.id)
product.value.collectCount = Math.max(0, Number(product.value.collectCount || 0) - 1)
message.success('已取消收藏')
} else {
await wishlistApi.addToWishlist(product.value.id)
product.value.collectCount = Number(product.value.collectCount || 0) + 1
message.success('已加入收藏')
}
isFavorite.value = !isFavorite.value
}).catch((error: any) => message.error(error?.message || '收藏操作失败'))
}
/** handleLikeClick is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
2026-03-05 15:15:59 +08:00
const handleLikeClick = async () => {
if (!product.value.id || !requireLogin('点赞作品')) return
await runWithGlobalLoading(async () => {
if (isLiked.value) {
await productLikeApi.unlikeProduct(product.value.id)
product.value.likeCount = Math.max(0, Number(product.value.likeCount || 0) - 1)
message.success('已取消点赞')
} else {
await productLikeApi.likeProduct(product.value.id)
product.value.likeCount = Number(product.value.likeCount || 0) + 1
message.success('已点赞')
}
2026-03-05 15:15:59 +08:00
isLiked.value = !isLiked.value
}).catch((error: any) => message.error(error?.message || '点赞操作失败'))
2026-03-05 15:15:59 +08:00
}
/** handleAddToCart is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const handleAddToCart = async () => {
if (!product.value.id || !requireLogin('加入购物车')) return
await runWithGlobalLoading(() => cartApi.addToCart({ productId: product.value.id, quantity: 1 }))
await updateCartCount()
message.success('已加入购物车')
}
/** handleBuyNow is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const handleBuyNow = async () => {
if (!product.value.id || !requireLogin('预约下单')) return
await runWithGlobalLoading(() => cartApi.addToCart({ productId: product.value.id, quantity: 1 }))
await updateCartCount()
message.success('已加入确认订单')
router.push({ path: '/cart', query: { mode: 'buyNow', productId: String(product.value.id) } })
}
2026-05-31 18:36:52 +08:00
const revokeCommentImagePreview = (file: any) => {
const url = file?.url || file?.thumbUrl
if (typeof url === 'string' && url.startsWith('blob:')) {
URL.revokeObjectURL(url)
}
}
const resetCommentImages = () => {
commentImageFileList.value.forEach(revokeCommentImagePreview)
commentImageFileList.value = []
commentImageIds.value = []
}
const resolveCommentImageId = (file: any) => {
return file?.fileId || file?.response?.id || file?.response?.fileId
}
const startReply = (comment: CommentVO) => {
replyTarget.value = comment
resetCommentImages()
}
const cancelReply = () => {
replyTarget.value = null
}
const beforeUploadCommentImage: UploadProps['beforeUpload'] = file => {
if (commentImageFileList.value.length >= MAX_COMMENT_IMAGES) {
message.warning(`评价图片最多上传 ${MAX_COMMENT_IMAGES} 张`)
return false
}
const isImage = file.type.startsWith('image/')
if (!isImage) {
message.error('只能上传图片文件')
}
return isImage
}
const handleUploadCommentImage: UploadProps['customRequest'] = async options => {
const file = options.file as File & { uid?: string }
const uid = String(file.uid || Date.now())
const previewUrl = URL.createObjectURL(file)
uploadingCommentImages.value += 1
commentImageFileList.value = commentImageFileList.value.map(item => {
return String(item.uid) === uid ? { ...item, url: previewUrl, thumbUrl: previewUrl, status: 'uploading' } : item
})
try {
const uploaded = await commentApi.uploadImage(file)
const stillListed = commentImageFileList.value.some(item => String(item.uid) === uid)
if (!stillListed) {
URL.revokeObjectURL(previewUrl)
return
}
commentImageIds.value = [...commentImageIds.value, uploaded.id]
commentImageFileList.value = commentImageFileList.value.map(item => {
return String(item.uid) === uid
? { ...item, fileId: uploaded.id, response: uploaded, status: 'done', url: previewUrl, thumbUrl: previewUrl }
: item
})
options.onSuccess?.(uploaded)
} catch (error: any) {
commentImageFileList.value = commentImageFileList.value.map(item => {
return String(item.uid) === uid ? { ...item, status: 'error' } : item
})
options.onError?.(error)
message.error(error?.message || '评价图片上传失败')
} finally {
uploadingCommentImages.value = Math.max(0, uploadingCommentImages.value - 1)
}
}
const handleRemoveCommentImage: UploadProps['onRemove'] = file => {
const fileId = resolveCommentImageId(file)
if (fileId) {
commentImageIds.value = commentImageIds.value.filter(id => String(id) !== String(fileId))
}
revokeCommentImagePreview(file)
return true
}
/** submitComment is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const submitComment = async () => {
if (!product.value.id || !requireLogin('发表评论')) return
const content = commentText.value.trim()
if (!content) return message.warning('请输入评论内容')
2026-05-31 18:36:52 +08:00
if (uploadingCommentImages.value > 0) return message.warning('图片上传完成后再发布')
submittingComment.value = true
try {
await commentApi.create({
productId: product.value.id,
shopId: product.value.shopId,
parentCommentId: replyTarget.value?.id,
2026-05-31 18:36:52 +08:00
commentContent: content,
ratingScore: replyTarget.value ? undefined : normalizeCommentRating(commentRating.value),
imageFileIds: replyTarget.value ? undefined : commentImageIds.value
})
commentText.value = ''
replyTarget.value = null
2026-05-31 18:36:52 +08:00
commentRating.value = 5
resetCommentImages()
await loadComments()
message.success('评论已发布')
} catch (error: any) {
message.error(error?.message || '评论发布失败')
} finally {
submittingComment.value = false
}
}
2026-02-24 09:59:22 +08:00
/** formatTime is a local helper used by this page script. */
const formatTime = (value?: string) => value ? value.replace('T', ' ').slice(0, 16) : ''
2026-02-24 09:59:22 +08:00
onMounted(() => {
void fetchProductDetail()
2026-02-24 09:59:22 +08:00
})
</script>
<style scoped>
2026-05-29 13:30:56 +08:00
.detail-page {
--detail-bg: var(--theme-page-bg);
--detail-surface: var(--theme-card-bg);
--detail-surface-soft: color-mix(in srgb, var(--theme-primary) 10%, var(--theme-card-bg));
--detail-surface-high: color-mix(in srgb, var(--theme-secondary) 16%, var(--theme-card-bg));
--detail-surface-muted: color-mix(in srgb, var(--theme-neutral) 10%, var(--theme-card-bg));
--detail-text: var(--text-primary);
--detail-muted: var(--text-secondary);
--detail-primary: var(--theme-primary-action);
--detail-primary-soft: var(--theme-primary-soft);
--detail-blush: var(--theme-primary);
--detail-gold: var(--theme-secondary);
--detail-gold-soft: var(--theme-secondary-soft);
--detail-border: var(--theme-border);
--detail-glass: color-mix(in srgb, var(--theme-card-bg) 80%, transparent);
--detail-glass-strong: color-mix(in srgb, var(--theme-card-bg) 92%, transparent);
--detail-hero-scrim: color-mix(in srgb, var(--theme-neutral) 20%, transparent);
--detail-shadow: 0 20px 44px color-mix(in srgb, var(--theme-neutral) 14%, transparent);
--detail-shadow-soft: 0 12px 30px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
2026-05-30 18:31:35 +08:00
--detail-shell-width: var(--frontend-page-max-width);
2026-05-29 13:30:56 +08:00
box-sizing: border-box;
min-height: 100vh;
overflow-x: hidden;
background:
radial-gradient(circle at top left, var(--detail-primary-soft), transparent 34%),
linear-gradient(180deg, var(--detail-bg) 0%, var(--detail-surface-soft) 100%);
color: var(--detail-text);
font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.detail-page *,
.detail-page *::before,
.detail-page *::after {
box-sizing: border-box;
}
2026-05-31 18:36:52 +08:00
.detail-floating-nav {
position: fixed;
top: 0;
left: 50%;
z-index: 50;
2026-06-04 16:39:06 +08:00
display: grid;
grid-template-columns: 44px minmax(0, 1fr) 44px;
gap: 10px;
2026-05-31 18:36:52 +08:00
width: min(100%, var(--detail-shell-width));
align-items: center;
padding: calc(12px + env(safe-area-inset-top)) 20px 0;
pointer-events: none;
transform: translateX(-50%);
}
.detail-floating-nav :deep(.ant-btn) {
display: inline-flex;
width: 40px;
height: 40px;
align-items: center;
justify-content: center;
border: 1px solid color-mix(in srgb, var(--detail-surface) 36%, transparent);
border-radius: 999px;
background: color-mix(in srgb, var(--detail-surface) 80%, transparent);
box-shadow: 0 10px 26px color-mix(in srgb, var(--theme-neutral) 14%, transparent);
color: var(--detail-muted);
pointer-events: auto;
backdrop-filter: blur(16px);
}
2026-06-04 16:39:06 +08:00
.detail-floating-title {
min-width: 0;
overflow: hidden;
align-self: center;
justify-self: center;
padding: 9px 14px;
border: 1px solid color-mix(in srgb, var(--detail-surface) 36%, transparent);
border-radius: 999px;
color: var(--detail-text);
background: color-mix(in srgb, var(--detail-surface) 82%, transparent);
box-shadow: 0 10px 26px color-mix(in srgb, var(--theme-neutral) 12%, transparent);
font-size: 15px;
font-weight: 800;
line-height: 1.2;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
pointer-events: auto;
backdrop-filter: blur(16px);
}
2026-05-31 18:36:52 +08:00
.detail-floating-nav :deep(.ant-btn:hover),
.detail-floating-nav :deep(.ant-btn:focus) {
border-color: var(--detail-blush);
background: var(--detail-glass-strong);
color: var(--detail-primary);
}
2026-05-29 13:30:56 +08:00
.detail-header {
position: sticky;
top: 0;
z-index: 40;
display: grid;
grid-template-columns: 44px minmax(0, 1fr) 44px;
gap: 10px;
2026-05-30 18:31:35 +08:00
width: min(100%, var(--detail-shell-width));
2026-05-29 13:30:56 +08:00
margin: 0 auto;
align-items: center;
padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
border-bottom: 1px solid var(--detail-border);
background: var(--detail-glass-strong);
box-shadow: 0 10px 28px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
backdrop-filter: blur(18px);
}
.nav-button {
justify-self: start;
}
.nav-button:last-child {
justify-self: end;
}
.detail-title {
display: grid;
min-width: 0;
gap: 2px;
text-align: center;
}
.detail-title span {
color: var(--detail-muted);
font-size: 11px;
font-weight: 600;
line-height: 1.1;
}
.detail-title strong {
min-width: 0;
overflow: hidden;
color: var(--detail-text);
font-size: 15px;
font-weight: 700;
line-height: 1.25;
text-overflow: ellipsis;
white-space: nowrap;
}
.detail-header :deep(.ant-btn) {
display: inline-flex;
width: 40px;
height: 40px;
align-items: center;
justify-content: center;
border: 1px solid var(--detail-border);
border-radius: 999px;
background: var(--detail-glass);
box-shadow: var(--detail-shadow-soft);
color: var(--detail-muted);
backdrop-filter: blur(16px);
}
.detail-header :deep(.ant-btn:hover),
.detail-header :deep(.ant-btn:focus) {
color: var(--detail-primary);
border-color: var(--detail-blush);
background: var(--detail-glass-strong);
}
.detail-header .active {
color: var(--detail-gold);
}
.detail-content {
2026-05-30 18:31:35 +08:00
width: min(100%, var(--detail-shell-width));
2026-05-29 13:30:56 +08:00
margin: 0 auto;
padding: 0 0 calc(112px + env(safe-area-inset-bottom));
}
.detail-content-error {
min-height: 100vh;
padding: 36px 18px 120px;
}
.hero-section {
position: relative;
overflow: hidden;
width: 100%;
aspect-ratio: 4 / 5;
background: var(--detail-surface-high);
}
.hero-section::after {
position: absolute;
inset: 0;
z-index: 2;
display: block;
pointer-events: none;
content: "";
background: linear-gradient(180deg, var(--detail-hero-scrim) 0%, transparent 30%, transparent 72%, var(--detail-bg) 100%);
}
.hero-carousel {
position: relative;
width: 100%;
height: 100%;
}
2026-05-31 18:36:52 +08:00
.hero-carousel-single {
display: block;
}
.hero-carousel :deep(.slick-slider),
2026-05-29 13:30:56 +08:00
.hero-carousel :deep(.slick-list),
.hero-carousel :deep(.slick-track),
.hero-carousel :deep(.slick-slide),
.hero-carousel :deep(.slick-slide > div),
.hero-slide-frame {
height: 100%;
}
2026-06-04 16:39:06 +08:00
.hero-image-button {
display: block;
width: 100%;
height: 100%;
padding: 0;
border: 0;
background: transparent;
cursor: zoom-in;
}
2026-05-31 18:36:52 +08:00
.hero-image {
display: block;
2026-05-29 13:30:56 +08:00
width: 100%;
height: 100%;
2026-05-31 18:36:52 +08:00
object-fit: cover;
2026-05-29 13:30:56 +08:00
object-position: center;
}
.hero-carousel :deep(.slick-dots) {
z-index: 3;
bottom: 26px;
}
.hero-carousel :deep(.slick-dots li button) {
width: 7px;
height: 7px;
border-radius: 999px;
background: var(--detail-glass);
box-shadow: var(--detail-shadow-soft);
opacity: 1;
}
.hero-carousel :deep(.slick-dots li.slick-active button) {
width: 18px;
background: var(--detail-surface);
}
2026-06-04 16:39:06 +08:00
.product-image-preview {
display: block;
width: 100%;
max-height: 78vh;
border-radius: 14px;
object-fit: contain;
object-position: center;
}
2026-05-29 13:30:56 +08:00
.info-section {
position: relative;
z-index: 3;
2026-05-31 18:36:52 +08:00
display: grid;
gap: 24px;
2026-05-29 13:30:56 +08:00
margin-top: -32px;
padding: 28px 20px 26px;
border-radius: 32px 32px 0 0;
background: var(--detail-bg);
}
2026-05-31 18:36:52 +08:00
.primary-info {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 16px;
align-items: start;
}
.product-copy {
min-width: 0;
}
.product-copy h1 {
margin: 0;
color: var(--detail-text);
font-family: "Playfair Display", Georgia, serif;
font-size: clamp(24px, 6.2vw, 30px);
font-weight: 600;
line-height: 1.18;
letter-spacing: 0;
overflow-wrap: anywhere;
}
.duration-row {
display: flex;
min-width: 0;
align-items: center;
gap: 7px;
margin-top: 7px;
color: var(--detail-muted);
font-size: 14px;
font-weight: 600;
line-height: 1.25;
}
.duration-row svg {
flex: 0 0 auto;
color: var(--detail-primary);
}
2026-05-29 13:30:56 +08:00
.product-hero-copy {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 16px;
align-items: start;
}
.product-heading {
min-width: 0;
}
.product-heading h1 {
margin: 0;
color: var(--detail-text);
font-family: "Playfair Display", Georgia, serif;
2026-05-31 18:36:52 +08:00
font-size: clamp(22px, 5.4vw, 28px);
2026-05-29 13:30:56 +08:00
font-weight: 600;
line-height: 1.16;
letter-spacing: 0;
overflow-wrap: anywhere;
}
.duration-chip {
display: inline-flex;
max-width: 100%;
align-items: center;
gap: 6px;
margin-top: 10px;
padding: 7px 10px;
border: 1px solid var(--detail-border);
border-radius: 999px;
background: var(--detail-glass);
color: var(--detail-muted);
font-size: 12px;
line-height: 1.2;
}
.duration-chip svg {
flex: 0 0 auto;
color: var(--detail-primary);
}
.duration-chip span {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.price {
margin: 0;
color: var(--detail-primary);
font-family: "Playfair Display", Georgia, serif;
2026-05-31 18:36:52 +08:00
font-size: clamp(28px, 6.2vw, 34px);
2026-05-29 13:30:56 +08:00
font-weight: 600;
line-height: 1.1;
white-space: nowrap;
}
.service-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
margin-top: 22px;
}
.service-item {
display: grid;
min-width: 0;
gap: 5px;
padding: 14px;
border: 1px solid var(--detail-border);
border-radius: 18px;
background: linear-gradient(180deg, var(--detail-surface) 0%, var(--detail-surface-soft) 100%);
box-shadow: var(--detail-shadow-soft);
}
.service-item svg {
color: var(--detail-primary);
}
.service-item span {
color: var(--detail-muted);
font-size: 12px;
line-height: 1.3;
}
.service-item strong {
min-width: 0;
color: var(--detail-text);
font-size: 14px;
line-height: 1.35;
overflow-wrap: anywhere;
}
.shop-card,
.artist-card {
display: flex;
width: 100%;
min-width: 0;
align-items: center;
gap: 14px;
margin-top: 14px;
padding: 16px;
border: 1px solid var(--detail-border);
border-radius: 22px;
background: var(--detail-glass);
box-shadow: var(--detail-shadow-soft);
color: var(--detail-text);
text-align: left;
backdrop-filter: blur(16px);
}
.shop-card {
cursor: pointer;
2026-05-31 18:36:52 +08:00
margin-top: 0;
border-radius: 18px;
2026-05-29 13:30:56 +08:00
}
.shop-card:disabled {
cursor: default;
}
2026-05-31 18:36:52 +08:00
.shop-avatar,
2026-05-29 13:30:56 +08:00
.shop-icon,
.artist-avatar {
display: inline-flex;
flex: 0 0 48px;
width: 48px;
height: 48px;
align-items: center;
justify-content: center;
border-radius: 18px;
background: var(--detail-primary-soft);
color: var(--detail-primary);
}
2026-05-31 18:36:52 +08:00
.shop-avatar {
border-radius: 999px;
background: var(--detail-surface-high);
}
.shop-summary {
display: grid;
min-width: 0;
gap: 4px;
flex: 1;
}
.shop-summary strong {
overflow: hidden;
color: var(--detail-text);
font-size: 15px;
font-weight: 700;
line-height: 1.35;
text-overflow: ellipsis;
white-space: nowrap;
}
.shop-summary span {
min-width: 0;
overflow: hidden;
color: var(--detail-muted);
font-size: 12px;
line-height: 1.35;
text-overflow: ellipsis;
white-space: nowrap;
}
.shop-rating {
display: inline-flex;
align-items: center;
gap: 4px;
}
.shop-rating svg {
color: var(--detail-gold);
}
2026-05-29 13:30:56 +08:00
.shop-copy,
.artist-copy {
display: grid;
min-width: 0;
gap: 3px;
flex: 1;
}
.eyebrow {
color: var(--detail-muted);
font-size: 11px;
font-weight: 600;
line-height: 1.2;
text-transform: uppercase;
letter-spacing: 0;
}
.shop-copy strong,
.artist-copy strong {
color: var(--detail-text);
font-size: 15px;
line-height: 1.35;
overflow-wrap: anywhere;
}
.shop-copy span:not(.eyebrow),
.artist-copy span:not(.eyebrow) {
color: var(--detail-muted);
font-size: 12px;
line-height: 1.45;
overflow-wrap: anywhere;
}
.shop-more {
flex: 0 0 auto;
color: var(--detail-primary);
2026-05-31 18:36:52 +08:00
font-size: 22px;
2026-05-29 13:30:56 +08:00
line-height: 1;
}
2026-05-31 18:36:52 +08:00
.section-title-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.section-title-row h2,
.description-section h2,
.guidance-panel h3 {
margin: 0;
color: var(--detail-text);
font-size: 14px;
font-weight: 700;
line-height: 1.25;
text-transform: uppercase;
letter-spacing: 0;
}
.section-title-row span {
color: var(--detail-muted);
font-size: 12px;
white-space: nowrap;
}
.artist-section {
display: grid;
gap: 12px;
}
.artist-strip {
display: flex;
gap: 16px;
overflow-x: auto;
margin-inline: -20px;
padding: 2px 20px 4px;
scrollbar-width: none;
}
.artist-strip::-webkit-scrollbar {
display: none;
}
.artist-option {
display: grid;
flex: 0 0 72px;
justify-items: center;
gap: 7px;
padding: 0;
border: 0;
background: transparent;
color: var(--detail-text);
cursor: pointer;
text-align: center;
}
.artist-portrait {
position: relative;
display: inline-flex;
width: 64px;
height: 64px;
align-items: center;
justify-content: center;
border: 2px solid transparent;
border-radius: 999px;
background:
linear-gradient(var(--detail-surface), var(--detail-surface)) padding-box,
linear-gradient(135deg, transparent, transparent) border-box;
color: var(--detail-primary);
font-size: 26px;
transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.artist-option.active .artist-portrait {
border-color: var(--detail-primary);
background:
linear-gradient(var(--detail-primary-soft), var(--detail-primary-soft)) padding-box,
linear-gradient(135deg, var(--detail-primary), var(--detail-gold)) border-box;
transform: translateY(-1px);
}
.artist-verified {
position: absolute;
right: -2px;
bottom: -2px;
display: inline-flex;
width: 20px;
height: 20px;
align-items: center;
justify-content: center;
border: 2px solid var(--detail-bg);
border-radius: 999px;
background: var(--detail-gold);
color: var(--detail-surface);
font-size: 12px;
}
.artist-option strong {
width: 100%;
overflow: hidden;
color: var(--detail-text);
font-size: 12px;
line-height: 1.2;
text-overflow: ellipsis;
white-space: nowrap;
}
.artist-option small {
width: 100%;
overflow: hidden;
color: var(--detail-muted);
font-size: 10px;
line-height: 1.2;
text-overflow: ellipsis;
white-space: nowrap;
}
.description-section {
display: grid;
gap: 12px;
}
.description-section p {
margin: 0;
color: var(--detail-muted);
font-size: 15px;
line-height: 1.75;
white-space: pre-wrap;
}
.engagement-row {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
2026-05-29 13:30:56 +08:00
.quick-actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 18px;
}
.action-pill {
display: inline-flex;
min-height: 38px;
align-items: center;
justify-content: center;
gap: 7px;
padding: 8px 13px;
border: 1px solid var(--detail-border);
border-radius: 999px;
background: var(--detail-surface);
color: var(--detail-muted);
font-size: 13px;
line-height: 1.2;
}
.action-pill.active {
color: var(--detail-gold);
border-color: var(--detail-gold-soft);
background: var(--detail-surface);
}
.tags {
display: flex;
flex-wrap: wrap;
gap: 8px;
2026-05-31 18:36:52 +08:00
margin-top: 0;
2026-05-29 13:30:56 +08:00
}
.detail-tag {
border: 0;
border-radius: 999px;
background: var(--detail-surface-high);
color: var(--detail-muted);
font-size: 12px;
}
.description {
margin-top: 26px;
}
.description h3,
.section-head h3 {
margin: 0;
color: var(--detail-text);
font-size: 15px;
font-weight: 700;
line-height: 1.3;
}
.description p,
.guidance-panel p {
margin: 10px 0 0;
color: var(--detail-muted);
font-size: 14px;
line-height: 1.8;
white-space: pre-wrap;
}
.guidance-grid {
display: grid;
gap: 12px;
2026-05-31 18:36:52 +08:00
margin-top: 0;
2026-05-29 13:30:56 +08:00
}
.guidance-panel {
padding: 15px;
border: 1px solid var(--detail-border);
border-radius: 18px;
background: var(--detail-surface-soft);
}
.comment-section {
padding: 8px 20px 22px;
background: var(--detail-surface-soft);
}
2026-05-31 18:36:52 +08:00
.review-section {
display: grid;
gap: 14px;
padding: 0 20px 24px;
background: var(--detail-bg);
}
2026-05-29 13:30:56 +08:00
.section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 14px;
}
.section-head span {
color: var(--detail-muted);
font-size: 12px;
white-space: nowrap;
}
.comment-editor {
padding: 14px;
border: 1px solid var(--detail-border);
border-radius: 20px;
background: var(--detail-glass);
box-shadow: var(--detail-shadow-soft);
}
2026-05-31 18:36:52 +08:00
.comment-rating-row {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
color: var(--detail-text);
font-size: 13px;
font-weight: 700;
}
.comment-rating-row small {
color: var(--detail-muted);
font-size: 12px;
font-weight: 600;
}
.rating-star-group {
display: inline-flex;
gap: 4px;
}
.rating-star-button {
display: inline-flex;
width: 28px;
height: 28px;
align-items: center;
justify-content: center;
padding: 0;
border: 0;
background: transparent;
color: color-mix(in srgb, var(--detail-muted) 52%, transparent);
cursor: pointer;
font-size: 18px;
transition: color 0.18s ease, transform 0.18s ease;
}
.rating-star-button.active,
.rating-star-button:hover {
color: var(--detail-gold);
}
.rating-star-button:hover {
transform: translateY(-1px);
}
.comment-image-upload {
display: block;
margin-bottom: 12px;
}
.comment-image-upload :deep(.ant-upload-list-picture-card-container),
.comment-image-upload :deep(.ant-upload.ant-upload-select-picture-card) {
width: 72px;
height: 72px;
margin: 0 8px 8px 0;
border-radius: 14px;
overflow: hidden;
}
.comment-image-upload :deep(.ant-upload.ant-upload-select-picture-card) {
border-color: var(--detail-border);
background: var(--detail-surface);
}
.comment-upload-trigger {
display: grid;
justify-items: center;
gap: 4px;
color: var(--detail-muted);
font-size: 12px;
}
2026-05-29 13:30:56 +08:00
.comment-editor :deep(.ant-input) {
border: 0;
border-radius: 14px;
background: var(--detail-surface);
color: var(--detail-text);
resize: none;
}
.comment-editor :deep(.ant-input:focus) {
box-shadow: 0 0 0 2px var(--detail-primary-soft);
}
.comment-tools {
display: flex;
justify-content: flex-end;
gap: 8px;
margin-top: 10px;
}
.comment-tools :deep(.ant-btn-primary),
.detail-content-error :deep(.ant-btn-primary) {
border-color: var(--detail-primary);
background: var(--detail-primary);
box-shadow: none;
}
2026-05-31 18:36:52 +08:00
.review-card {
display: grid;
gap: 11px;
padding: 18px;
border: 1px solid color-mix(in srgb, var(--detail-surface) 44%, transparent);
border-radius: 18px;
background: var(--detail-glass);
box-shadow: var(--detail-shadow-soft);
backdrop-filter: blur(16px);
}
.review-card-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 14px;
}
.review-user {
display: flex;
min-width: 0;
align-items: center;
gap: 10px;
}
.review-avatar {
display: inline-flex;
flex: 0 0 40px;
width: 40px;
height: 40px;
align-items: center;
justify-content: center;
border-radius: 999px;
background: var(--detail-primary-soft);
color: var(--detail-primary);
font-size: 14px;
font-weight: 700;
}
.review-user span:last-child {
display: grid;
min-width: 0;
gap: 2px;
}
.review-user strong {
overflow: hidden;
color: var(--detail-text);
font-size: 14px;
line-height: 1.3;
text-overflow: ellipsis;
white-space: nowrap;
}
.review-user small {
color: var(--detail-muted);
font-size: 10px;
line-height: 1.2;
}
.review-stars {
display: inline-flex;
flex: 0 0 auto;
gap: 1px;
color: var(--detail-gold);
font-size: 14px;
}
.review-stars .star-empty {
color: color-mix(in srgb, var(--detail-muted) 34%, transparent);
}
.review-card p {
margin: 0;
color: var(--detail-muted);
font-size: 14px;
font-style: italic;
line-height: 1.7;
}
.review-images {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.review-images :deep(.ant-image) {
width: 72px;
height: 72px;
overflow: hidden;
border-radius: 12px;
background: var(--detail-surface);
}
.review-images :deep(.ant-image-img) {
width: 100%;
height: 100%;
object-fit: cover;
}
.reply-button {
justify-self: start;
padding: 0;
border: 0;
background: transparent;
color: var(--detail-primary);
cursor: pointer;
font-size: 13px;
font-weight: 700;
}
2026-05-29 13:30:56 +08:00
.comment-item {
padding: 18px 0;
border-bottom: 1px solid var(--detail-border);
}
.comment-item:last-child {
border-bottom: 0;
}
.comment-main {
display: flex;
justify-content: space-between;
gap: 12px;
color: var(--detail-muted);
font-size: 12px;
}
.comment-main strong {
color: var(--detail-text);
font-size: 14px;
}
.comment-item p {
margin: 8px 0;
color: var(--detail-text);
font-size: 14px;
line-height: 1.75;
}
.comment-item button {
padding: 0;
border: 0;
background: transparent;
color: var(--detail-primary);
cursor: pointer;
font-size: 13px;
}
.reply-list {
display: grid;
gap: 8px;
margin-top: 12px;
padding: 12px;
border-radius: 16px;
background: var(--detail-bg);
}
.reply-item {
display: grid;
gap: 3px;
color: var(--detail-muted);
font-size: 13px;
}
.reply-item strong {
color: var(--detail-text);
}
2026-05-31 18:36:52 +08:00
.booking-note {
display: flex;
align-items: center;
gap: 12px;
margin: 0 20px 24px;
padding: 15px;
border: 1px solid var(--detail-border);
border-radius: 18px;
background: var(--detail-surface-soft);
}
.booking-note span:last-child {
display: grid;
min-width: 0;
gap: 3px;
}
.booking-note strong {
color: var(--detail-text);
font-size: 14px;
line-height: 1.3;
}
.booking-note small {
color: var(--detail-muted);
font-size: 12px;
line-height: 1.5;
}
2026-05-29 13:30:56 +08:00
.detail-footer {
position: fixed;
right: auto;
bottom: 0;
left: 50%;
z-index: 35;
width: min(100%, var(--frontend-page-max-width));
padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
border-top: 1px solid var(--detail-border);
background: var(--detail-glass-strong);
box-shadow: 0 -14px 30px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
backdrop-filter: blur(18px);
transform: translateX(-50%);
}
.footer-inner {
display: grid;
2026-05-30 18:31:35 +08:00
max-width: var(--detail-shell-width);
2026-05-31 18:36:52 +08:00
grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1.5fr);
2026-05-29 13:30:56 +08:00
gap: 10px;
margin: 0 auto;
}
.detail-footer :deep(.ant-btn) {
display: inline-flex;
min-width: 0;
height: 52px;
align-items: center;
justify-content: center;
gap: 7px;
border-radius: 18px;
font-size: 14px;
font-weight: 700;
line-height: 1.2;
white-space: nowrap;
}
.footer-favorite {
border-color: var(--detail-border);
background: var(--detail-surface-high);
color: var(--detail-primary);
}
.footer-favorite .active {
color: var(--detail-gold);
}
.cart-button {
border-color: var(--detail-border);
background: var(--detail-surface-muted);
color: var(--detail-text);
}
.book-button {
border-color: var(--detail-primary);
background: var(--detail-primary);
color: var(--detail-surface);
box-shadow: 0 12px 22px color-mix(in srgb, var(--theme-primary-action) 20%, transparent);
}
@media (min-width: 461px) {
.detail-page {
padding-inline: 14px;
}
.hero-section {
border-radius: 0 0 26px 26px;
}
}
2026-05-31 18:36:52 +08:00
@media (min-width: 768px) {
.hero-section {
aspect-ratio: 16 / 9;
}
}
2026-05-29 13:30:56 +08:00
@media (max-width: 374px) {
2026-05-31 18:36:52 +08:00
.primary-info,
2026-05-29 13:30:56 +08:00
.product-hero-copy,
.service-grid {
grid-template-columns: 1fr;
}
.price {
justify-self: start;
}
.footer-inner {
2026-05-31 18:36:52 +08:00
grid-template-columns: 50px minmax(0, 1fr) minmax(0, 1.25fr);
2026-05-29 13:30:56 +08:00
gap: 8px;
}
.detail-footer :deep(.ant-btn) {
font-size: 13px;
}
}
2026-03-05 15:15:59 +08:00
</style>