1936 lines
55 KiB
Vue
1936 lines
55 KiB
Vue
<template>
|
||
<div class="detail-page">
|
||
<nav class="detail-floating-nav" aria-label="作品详情导航">
|
||
<a-button class="nav-button" type="text" aria-label="返回" @click="router.back()">
|
||
<LeftOutlined />
|
||
</a-button>
|
||
<strong class="detail-floating-title">{{ shopDisplayName }}</strong>
|
||
<a-button class="nav-button" type="text" aria-label="分享作品" @click="copyShareLink">
|
||
<ShareAltOutlined />
|
||
</a-button>
|
||
</nav>
|
||
|
||
<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>
|
||
<section class="hero-section" aria-label="作品图片">
|
||
<a-carousel
|
||
v-if="productImages.length > 1"
|
||
:key="heroCarouselKey"
|
||
class="hero-carousel"
|
||
dots
|
||
autoplay
|
||
:initial-slide="0"
|
||
:autoplay-speed="3500"
|
||
>
|
||
<div v-for="(image, index) in productImages" :key="`${image}-${index}`" class="hero-slide-frame">
|
||
<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"
|
||
@error="handleProductImageError(index)"
|
||
/>
|
||
</button>
|
||
</div>
|
||
</a-carousel>
|
||
<div v-else-if="productImagesReady || productImages.length" class="hero-carousel hero-carousel-single">
|
||
<button
|
||
v-for="(image, index) in heroPreviewImages"
|
||
:key="`${image}-${index}`"
|
||
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"
|
||
@error="handleProductImageError(index)"
|
||
/>
|
||
</button>
|
||
</div>
|
||
<div v-else class="hero-carousel hero-carousel-single" aria-hidden="true"></div>
|
||
</section>
|
||
|
||
<section class="info-section">
|
||
<div class="primary-info">
|
||
<div class="product-copy">
|
||
<h1>{{ productTitle }}</h1>
|
||
<div class="duration-row">
|
||
<ClockCircleOutlined />
|
||
<span>预计时长 {{ displayDurationText }}</span>
|
||
</div>
|
||
</div>
|
||
<p class="price">参考价 ¥{{ Number(product.price || 0).toFixed(2) }}</p>
|
||
</div>
|
||
|
||
<button class="shop-card" type="button" :disabled="!shopInfo?.id" @click="openShopDetail">
|
||
<span class="shop-avatar">
|
||
<ShopOutlined />
|
||
</span>
|
||
<span class="shop-summary">
|
||
<strong>{{ shopDisplayName }}</strong>
|
||
<span class="shop-rating">
|
||
<StarFilled />
|
||
{{ shopRatingText }}
|
||
</span>
|
||
<span>{{ shopMetaText }}</span>
|
||
</span>
|
||
<RightOutlined class="shop-more" />
|
||
</button>
|
||
|
||
<section class="artist-section" aria-labelledby="artist-section-title">
|
||
<div class="section-title-row">
|
||
<h2 id="artist-section-title">选择美甲师</h2>
|
||
</div>
|
||
<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>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="description-section" aria-labelledby="description-section-title">
|
||
<h2 id="description-section-title">作品简介</h2>
|
||
<p>{{ product.description || '店家暂未补充作品说明。' }}</p>
|
||
<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>
|
||
|
||
<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>
|
||
|
||
<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">
|
||
<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>
|
||
<a-textarea
|
||
v-model:value="commentText"
|
||
:maxlength="300"
|
||
:rows="3"
|
||
:placeholder="replyTarget ? `回复 ${replyTarget.userNickname || '用户'}` : '说说你的看法'"
|
||
/>
|
||
<div class="comment-tools">
|
||
<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="还没有评论,来写第一条吧" />
|
||
<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>
|
||
<div v-if="getCommentImages(comment).length" class="review-images">
|
||
<a-image
|
||
v-for="(image, index) in getCommentImages(comment)"
|
||
: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>
|
||
|
||
<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">
|
||
<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>
|
||
|
||
<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 {
|
||
CheckCircleFilled,
|
||
ClockCircleOutlined,
|
||
HeartFilled,
|
||
HeartOutlined,
|
||
LeftOutlined,
|
||
PlusOutlined,
|
||
RightOutlined,
|
||
ShareAltOutlined,
|
||
ShoppingCartOutlined,
|
||
ShopOutlined,
|
||
StarFilled,
|
||
StarOutlined,
|
||
ThunderboltOutlined,
|
||
UserOutlined
|
||
} from '@ant-design/icons-vue'
|
||
import { message } from 'ant-design-vue'
|
||
import type { UploadProps } from 'ant-design-vue'
|
||
import { cartApi } from '@/api/cart'
|
||
/**
|
||
* 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'
|
||
/**
|
||
* 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'
|
||
/**
|
||
* 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'
|
||
import type { IdType } from '@/utils/id'
|
||
import { toOptionalIdString } from '@/utils/id'
|
||
import { runWithGlobalLoading } from '@/utils/action-loading'
|
||
import { createChunkUploadTask } from '@/utils/chunk-upload'
|
||
import {
|
||
getPublicImageFileIds,
|
||
refreshPublicImageUrl,
|
||
resolvePublicImageUrls,
|
||
resolvePublicImageUrlsSync
|
||
} from '@/utils/public-image-assets'
|
||
import { buildRatingStars, normalizeCommentRating } from '@/utils/comment-review'
|
||
|
||
/**
|
||
* 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()
|
||
/**
|
||
* 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()
|
||
/**
|
||
* 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.
|
||
*/
|
||
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
|
||
|
||
/**
|
||
* 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)
|
||
/**
|
||
* 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)
|
||
/**
|
||
* 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.
|
||
*/
|
||
const productImages = ref<string[]>([])
|
||
/** productImagesReady prevents the default fallback image from flashing before cached URLs are restored. */
|
||
const productImagesReady = ref(false)
|
||
const productImagePreviewVisible = ref(false)
|
||
const productImagePreviewIndex = ref(0)
|
||
/**
|
||
* 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[]>([])
|
||
const commentImageUrls = ref<Record<string, string[]>>({})
|
||
/** commentText is a reactive state variable used by the template and event handlers. */
|
||
const commentText = ref('')
|
||
/**
|
||
* 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)
|
||
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('')
|
||
/** 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 || '作品详情')
|
||
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 || '以门店安排为准')
|
||
const shopDisplayName = computed(() => shopInfo.value?.shopName || product.value.shopName || '当前门店')
|
||
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
|
||
})
|
||
const shopMetaText = computed(() => {
|
||
const details = [shopInfo.value?.businessHours, shopInfo.value?.address].filter(Boolean)
|
||
return details.length ? details.join(' · ') : '门店信息待完善'
|
||
})
|
||
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
|
||
}]
|
||
}
|
||
|
||
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
|
||
}))
|
||
})
|
||
/**
|
||
* 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)
|
||
}
|
||
}
|
||
|
||
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
|
||
}
|
||
|
||
/** loadProductImages is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||
const loadProductImages = async () => {
|
||
productImagesReady.value = false
|
||
productImagePreviewIndex.value = 0
|
||
const cachedImages = resolvePublicImageUrlsSync(product.value, '')
|
||
if (cachedImages.length) {
|
||
productImages.value = cachedImages
|
||
productImagesReady.value = true
|
||
}
|
||
|
||
const nextImages = await resolvePublicImageUrls(product.value, DEFAULT_PRODUCT_IMAGE)
|
||
productImages.value = nextImages
|
||
productImagesReady.value = true
|
||
}
|
||
|
||
const handleProductImageError = async (imageIndex: number) => {
|
||
const fileId = getPublicImageFileIds(product.value)[imageIndex]
|
||
productImages.value[imageIndex] = DEFAULT_PRODUCT_IMAGE
|
||
if (!fileId) return
|
||
productImages.value[imageIndex] = await refreshPublicImageUrl(fileId, DEFAULT_PRODUCT_IMAGE)
|
||
}
|
||
|
||
/** loadShopInfo is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||
const loadShopInfo = async (shopId?: IdType | null) => {
|
||
shopInfo.value = shopId ? await shopApi.getShopById(shopId).catch(() => null) : null
|
||
}
|
||
|
||
/** 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
|
||
const nextComments = await commentApi.listByProduct(product.value.id).catch(() => [])
|
||
comments.value = nextComments
|
||
const entries = await Promise.all(nextComments.map(async comment => {
|
||
const urls = await resolvePublicImageUrls({
|
||
imageUrls: comment.imageUrls,
|
||
imageFileIds: Array.isArray(comment.imageFileIds) ? comment.imageFileIds.map(id => String(id)).join(',') : comment.imageFileIds
|
||
}, '')
|
||
return [String(comment.id), urls] as const
|
||
}))
|
||
commentImageUrls.value = Object.fromEntries(entries)
|
||
}
|
||
|
||
const getCommentImages = (comment: CommentVO): string[] => commentImageUrls.value[String(comment.id)] || []
|
||
|
||
/** 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 = ''
|
||
productImages.value = []
|
||
productImagesReady.value = false
|
||
productImagePreviewVisible.value = false
|
||
productImagePreviewIndex.value = 0
|
||
try {
|
||
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 || '网络异常,请稍后再试'
|
||
}
|
||
}
|
||
|
||
/** 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. */
|
||
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('已点赞')
|
||
}
|
||
isLiked.value = !isLiked.value
|
||
}).catch((error: any) => message.error(error?.message || '点赞操作失败'))
|
||
}
|
||
|
||
/** 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) } })
|
||
}
|
||
|
||
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
|
||
})
|
||
|
||
const task = createChunkUploadTask({
|
||
file,
|
||
scene: 'comment-image',
|
||
concurrency: 3,
|
||
api: {
|
||
initUpload: commentApi.initImageChunkUpload,
|
||
uploadChunk: commentApi.uploadImageChunk,
|
||
completeUpload: commentApi.completeImageChunkUpload,
|
||
cancelUpload: commentApi.cancelImageChunkUpload
|
||
},
|
||
onProgress: (percent) => {
|
||
options.onProgress?.({ percent })
|
||
}
|
||
})
|
||
|
||
try {
|
||
const { response: uploaded } = await task.promise
|
||
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
|
||
})
|
||
const errorMessage = error?.message || '评价图片上传失败'
|
||
if (errorMessage !== '上传已取消' && errorMessage !== 'canceled') {
|
||
options.onError?.(error)
|
||
message.error(errorMessage)
|
||
}
|
||
} 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('请输入评论内容')
|
||
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,
|
||
commentContent: content,
|
||
ratingScore: replyTarget.value ? undefined : normalizeCommentRating(commentRating.value),
|
||
imageFileIds: replyTarget.value ? undefined : commentImageIds.value
|
||
})
|
||
commentText.value = ''
|
||
replyTarget.value = null
|
||
commentRating.value = 5
|
||
resetCommentImages()
|
||
await loadComments()
|
||
message.success('评论已发布')
|
||
} catch (error: any) {
|
||
message.error(error?.message || '评论发布失败')
|
||
} finally {
|
||
submittingComment.value = false
|
||
}
|
||
}
|
||
|
||
/** formatTime is a local helper used by this page script. */
|
||
const formatTime = (value?: string) => value ? value.replace('T', ' ').slice(0, 16) : ''
|
||
|
||
onMounted(() => {
|
||
void fetchProductDetail()
|
||
})
|
||
</script>
|
||
|
||
<style scoped>
|
||
.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);
|
||
--detail-shell-width: var(--frontend-page-max-width);
|
||
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;
|
||
}
|
||
|
||
.detail-floating-nav {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 50%;
|
||
z-index: 50;
|
||
display: grid;
|
||
grid-template-columns: 44px minmax(0, 1fr) 44px;
|
||
gap: 10px;
|
||
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);
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
.detail-header {
|
||
position: sticky;
|
||
top: 0;
|
||
z-index: 40;
|
||
display: grid;
|
||
grid-template-columns: 44px minmax(0, 1fr) 44px;
|
||
gap: 10px;
|
||
width: min(100%, var(--detail-shell-width));
|
||
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 {
|
||
width: min(100%, var(--detail-shell-width));
|
||
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%;
|
||
}
|
||
|
||
.hero-carousel-single {
|
||
display: block;
|
||
}
|
||
|
||
.hero-carousel :deep(.slick-slider),
|
||
.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%;
|
||
}
|
||
|
||
.hero-image-button {
|
||
display: block;
|
||
width: 100%;
|
||
height: 100%;
|
||
padding: 0;
|
||
border: 0;
|
||
background: transparent;
|
||
cursor: zoom-in;
|
||
}
|
||
|
||
.hero-image {
|
||
display: block;
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
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);
|
||
}
|
||
|
||
.product-image-preview {
|
||
display: block;
|
||
width: 100%;
|
||
max-height: 78vh;
|
||
border-radius: 14px;
|
||
object-fit: contain;
|
||
object-position: center;
|
||
}
|
||
|
||
.info-section {
|
||
position: relative;
|
||
z-index: 3;
|
||
display: grid;
|
||
gap: 24px;
|
||
margin-top: -32px;
|
||
padding: 28px 20px 26px;
|
||
border-radius: 32px 32px 0 0;
|
||
background: var(--detail-bg);
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
.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;
|
||
font-size: clamp(22px, 5.4vw, 28px);
|
||
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;
|
||
font-size: clamp(28px, 6.2vw, 34px);
|
||
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;
|
||
margin-top: 0;
|
||
border-radius: 18px;
|
||
}
|
||
|
||
.shop-card:disabled {
|
||
cursor: default;
|
||
}
|
||
|
||
.shop-avatar,
|
||
.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);
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
.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);
|
||
font-size: 22px;
|
||
line-height: 1;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
.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;
|
||
margin-top: 0;
|
||
}
|
||
|
||
.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;
|
||
margin-top: 0;
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
.review-section {
|
||
display: grid;
|
||
gap: 14px;
|
||
padding: 0 20px 24px;
|
||
background: var(--detail-bg);
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
.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);
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
.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;
|
||
max-width: var(--detail-shell-width);
|
||
grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1.5fr);
|
||
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;
|
||
}
|
||
}
|
||
|
||
@media (min-width: 768px) {
|
||
.hero-section {
|
||
aspect-ratio: 16 / 9;
|
||
}
|
||
}
|
||
|
||
@media (max-width: 374px) {
|
||
.primary-info,
|
||
.product-hero-copy,
|
||
.service-grid {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
|
||
.price {
|
||
justify-self: start;
|
||
}
|
||
|
||
.footer-inner {
|
||
grid-template-columns: 50px minmax(0, 1fr) minmax(0, 1.25fr);
|
||
gap: 8px;
|
||
}
|
||
|
||
.detail-footer :deep(.ant-btn) {
|
||
font-size: 13px;
|
||
}
|
||
}
|
||
</style>
|