功能(网页):新增客户体验流程
This commit is contained in:
@@ -30,9 +30,23 @@
|
||||
</section>
|
||||
|
||||
<section class="shop-details">
|
||||
<div v-if="trustProfile" class="trust-grid">
|
||||
<div class="trust-card">
|
||||
<strong>{{ formatRating(trustProfile.stats?.averageRating) }}</strong>
|
||||
<span>{{ Number(trustProfile.stats?.reviewCount || 0) }} 条评价</span>
|
||||
</div>
|
||||
<div class="trust-card">
|
||||
<strong>{{ Number(trustProfile.stats?.productCount || 0) }}</strong>
|
||||
<span>在售作品</span>
|
||||
</div>
|
||||
<div class="trust-card">
|
||||
<strong>{{ trustProfile.businessStatusText || '可浏览' }}</strong>
|
||||
<span>{{ trustProfile.availabilitySummary?.summaryText || '预约前会再次确认档期' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<div class="detail-label">营业时间</div>
|
||||
<div class="detail-value">{{ shopInfo.businessHours || '暂未设置' }}</div>
|
||||
<div class="detail-value">{{ trustProfile?.businessHoursText || shopInfo.businessHours || '暂未设置' }}</div>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<div class="detail-label">店铺描述</div>
|
||||
@@ -62,6 +76,41 @@
|
||||
</a-carousel>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="trustProfile?.featuredProducts?.length" class="shop-trust-section">
|
||||
<h3 class="section-title">可预约作品</h3>
|
||||
<div class="featured-products">
|
||||
<button
|
||||
v-for="product in trustProfile.featuredProducts"
|
||||
:key="product.id"
|
||||
type="button"
|
||||
class="featured-product"
|
||||
@click="openProduct(product.id)"
|
||||
>
|
||||
<img v-if="product.imageUrl" :src="product.imageUrl" :alt="product.title || '作品'" />
|
||||
<div v-else class="featured-product__placeholder">作</div>
|
||||
<div>
|
||||
<strong>{{ product.title || '美甲作品' }}</strong>
|
||||
<span>¥{{ Number(product.price || 0).toFixed(2) }}</span>
|
||||
<small>{{ product.bookingHint || '下单前选择美甲师和时间' }}</small>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="trustProfile?.recentReviews?.length" class="shop-trust-section">
|
||||
<h3 class="section-title">近期评价</h3>
|
||||
<div class="recent-reviews">
|
||||
<article v-for="review in trustProfile.recentReviews" :key="review.id" class="recent-review">
|
||||
<div class="recent-review__head">
|
||||
<strong>{{ review.productTitle || '订单评价' }}</strong>
|
||||
<span>{{ formatRating(review.ratingScore) }}</span>
|
||||
</div>
|
||||
<p>{{ review.content || '用户已完成评价' }}</p>
|
||||
<small>{{ formatTime(review.submittedAt) }}</small>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
</a-card>
|
||||
</main>
|
||||
|
||||
@@ -105,7 +154,7 @@ import { fileApi } from '@/api/file'
|
||||
* Purpose: ShopVO supports ShopDetailView.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 { shopApi, type ShopTrustProfileVO, type ShopVO } from '@/api/shop'
|
||||
/**
|
||||
* Purpose: ContactInfoVO supports ShopDetailView.vue by holding or executing the contact info 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.
|
||||
@@ -177,6 +226,8 @@ const mapOpen = ref(false)
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const distanceText = ref('')
|
||||
/** trustProfile stores public confidence signals for this shop. */
|
||||
const trustProfile = ref<ShopTrustProfileVO | null>(null)
|
||||
|
||||
/**
|
||||
* Purpose: hasLocation supports ShopDetailView.vue by holding or executing the has location page or API role.
|
||||
@@ -253,6 +304,23 @@ const openNavigation = (provider: 'TENCENT' | 'AMAP') => {
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
|
||||
/** openProduct routes from shop trust cards to the product detail page. */
|
||||
const openProduct = (productId: string | number) => {
|
||||
router.push(`/product/${productId}`)
|
||||
}
|
||||
|
||||
/** formatRating renders trust scores without exposing backend numeric details. */
|
||||
const formatRating = (value: unknown) => {
|
||||
const rating = Number(value || 0)
|
||||
return rating > 0 ? rating.toFixed(1) : '暂无'
|
||||
}
|
||||
|
||||
/** formatTime renders review timestamps for the trust section. */
|
||||
const formatTime = (value?: string) => {
|
||||
if (!value) return ''
|
||||
return String(value).replace('T', ' ').slice(0, 16)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: calculateDistanceText supports ShopDetailView.vue by holding or executing the calculate distance text 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.
|
||||
@@ -311,6 +379,7 @@ const loadShopImages = async () => {
|
||||
try {
|
||||
const imageFileIds = shopInfo.value.imageFileIds
|
||||
if (!imageFileIds) return
|
||||
if (shopImages.value.length > 0) return
|
||||
|
||||
const fileIds = imageFileIds.split(',').map(id => id.trim()).filter(Boolean)
|
||||
const results = await Promise.all(fileIds.map(fileId => fileApi.getSignedUrl(fileId).catch(() => null)))
|
||||
@@ -336,6 +405,10 @@ const fetchShopDetail = async () => {
|
||||
}
|
||||
|
||||
shopInfo.value = await shopApi.getShopById(shopId)
|
||||
trustProfile.value = await shopApi.getTrustProfile(shopId).catch(() => null)
|
||||
if (trustProfile.value?.environmentImages?.length) {
|
||||
shopImages.value = trustProfile.value.environmentImages.filter(Boolean)
|
||||
}
|
||||
await loadShopImages()
|
||||
loadCurrentDistance()
|
||||
} catch (error: any) {
|
||||
@@ -473,6 +546,33 @@ onMounted(fetchShopDetail)
|
||||
margin-top: 22px;
|
||||
}
|
||||
|
||||
.trust-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.trust-card {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
min-height: 74px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--theme-border);
|
||||
border-radius: 8px;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.trust-card strong {
|
||||
color: var(--theme-primary);
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.trust-card span {
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.detail-label {
|
||||
font-size: 13px;
|
||||
color: #8a94a6;
|
||||
@@ -515,6 +615,101 @@ onMounted(fetchShopDetail)
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.shop-trust-section {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.featured-products {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.featured-product {
|
||||
display: grid;
|
||||
grid-template-columns: 84px minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
text-align: left;
|
||||
border: 1px solid var(--theme-border);
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.featured-product img,
|
||||
.featured-product__placeholder {
|
||||
width: 84px;
|
||||
height: 84px;
|
||||
border-radius: 8px;
|
||||
object-fit: cover;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.featured-product__placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--theme-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.featured-product strong,
|
||||
.featured-product span,
|
||||
.featured-product small {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.featured-product strong {
|
||||
color: #172033;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.featured-product span {
|
||||
margin-top: 4px;
|
||||
color: var(--theme-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.featured-product small {
|
||||
margin-top: 6px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.recent-reviews {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.recent-review {
|
||||
padding: 12px;
|
||||
border: 1px solid var(--theme-border);
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.recent-review__head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
color: #172033;
|
||||
}
|
||||
|
||||
.recent-review__head span {
|
||||
color: var(--theme-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.recent-review p {
|
||||
margin: 8px 0 6px;
|
||||
color: #475467;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.recent-review small {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
@@ -619,6 +814,10 @@ onMounted(fetchShopDetail)
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.trust-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.map-frame {
|
||||
height: 320px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user