修复:对齐用户端店铺页面

This commit is contained in:
xiaowang
2026-05-30 18:31:35 +08:00
parent 31cd06b5c9
commit 22347ff076
10 changed files with 165 additions and 108 deletions
@@ -16,7 +16,7 @@
<ShoppingOutlined :style="{ fontSize: '22px' }" />
</div>
</a-badge>
<span class="nav-label">作品</span>
<span class="nav-label">作品集</span>
</button>
<button class="nav-item" :class="{ active: currentRoute === 'cart' }" type="button" @click="handleNavClick('cart')">
+3 -3
View File
@@ -1,11 +1,11 @@
<template>
<div class="mobile-container">
<main class="auth-page">
<section class="brand-stage" aria-label="YumiNail">
<section class="brand-stage" aria-label="指尖设计师">
<div class="brand-mark" aria-hidden="true">
<span>Y</span>
<span>指</span>
</div>
<p class="brand-name">YumiNail</p>
<p class="brand-name">指尖设计师</p>
<h1 class="brand-title">
{{ activeTab === 'login' ? '艺术触手可及' : '开启你的预约账号' }}
</h1>
+49 -16
View File
@@ -6,10 +6,12 @@
<LeftOutlined />
</button>
<div class="header-title">
<span>{{ isBuyNowMode ? '确认订单' : '购物车' }}</span>
<strong>YumiNail</strong>
<strong>{{ isBuyNowMode ? '确认订单' : '购物车' }}</strong>
</div>
<div class="header-count" aria-label="购物车数量">
<ShoppingOutlined />
<span v-if="cartItems.length">{{ cartItems.length }}</span>
</div>
<div class="header-count" aria-label="购物车数量">{{ cartItems.length }}</div>
</header>
<a-empty v-if="!cartItems.length" class="empty-cart" description="购物车还是空的">
@@ -58,9 +60,9 @@
<div class="checkout-layout">
<section class="cart-group-card" aria-label="购物车商品">
<div class="group-head">
<div class="shop-mark">Y</div>
<div class="shop-mark">指</div>
<div class="group-copy">
<span>YumiNail Studio</span>
<span>{{ checkoutShopName }}</span>
<strong>{{ cartItems.length }} 项作品</strong>
</div>
<em>{{ selectedCount }} 项已选</em>
@@ -287,7 +289,7 @@
*/
import { computed, inject, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { DeleteOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons-vue'
import { DeleteOutlined, LeftOutlined, RightOutlined, ShoppingOutlined } from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
import type { ButtonProps } from 'ant-design-vue/es/button/buttonTypes'
import { cartApi } from '../api/cart'
@@ -352,6 +354,7 @@ interface CartItem {
id: IdType
productId: IdType
shopId?: IdType
shopName?: string
productTitle: string
productImage: string
originalProductImage?: string
@@ -439,6 +442,26 @@ const isBuyNowMode = computed(() => Boolean(buyNowProductId.value))
/** selectedItems is a reactive state variable used by the template and event handlers. */
const selectedItems = computed(() => cartItems.value.filter(item => item.selected))
const checkoutShopName = computed(() => {
const itemWithShopName = selectedItems.value.find(item => item.shopName) || cartItems.value.find(item => item.shopName)
if (itemWithShopName?.shopName) {
return itemWithShopName.shopName
}
if (typeof window !== 'undefined') {
try {
const raw = localStorage.getItem('userInfo')
const storedUser = raw ? JSON.parse(raw) as { shopName?: string } : null
if (storedUser?.shopName) {
return storedUser.shopName
}
} catch {
// Ignore malformed cached user data and fall back to the neutral shop label.
}
}
return '当前门店'
})
/** selectedCount is a reactive state variable used by the template and event handlers. */
const selectedCount = computed(() => selectedItems.value.length)
/** totalQuantity is a reactive state variable used by the template and event handlers. */
@@ -1033,6 +1056,7 @@ onMounted(async () => {
--cart-radius-lg: 24px;
--cart-radius-md: 18px;
--cart-bottom-offset: 60px;
--cart-shell-width: var(--frontend-page-max-width);
min-height: 100vh;
color: var(--text-primary);
background:
@@ -1041,7 +1065,7 @@ onMounted(async () => {
}
.content {
width: min(100%, 430px);
width: min(100%, var(--cart-shell-width));
margin: 0 auto;
padding: 0 16px calc(168px + env(safe-area-inset-bottom));
}
@@ -1079,6 +1103,7 @@ onMounted(async () => {
}
.header-count {
position: relative;
justify-self: end;
color: var(--theme-secondary);
font-size: 13px;
@@ -1090,26 +1115,34 @@ onMounted(async () => {
text-align: center;
}
.header-title span,
.header-title strong {
display: block;
}
.header-title span {
color: var(--text-secondary);
font-size: 11px;
font-weight: 700;
}
.header-title strong {
overflow: hidden;
color: var(--text-primary);
font-size: 15px;
font-size: 16px;
line-height: 1.25;
text-overflow: ellipsis;
white-space: nowrap;
}
.header-count span {
position: absolute;
top: 4px;
right: 3px;
min-width: 14px;
height: 14px;
padding: 0 4px;
border: 1px solid var(--theme-card-bg);
border-radius: 999px;
background: var(--theme-primary);
color: var(--theme-accent);
font-size: 9px;
line-height: 12px;
}
.empty-cart {
margin-top: 64px;
padding: 44px 18px;
@@ -1745,7 +1778,7 @@ onMounted(async () => {
left: 50%;
bottom: var(--cart-bottom-offset);
z-index: 20;
width: min(100%, 430px);
width: min(100%, var(--cart-shell-width));
display: flex;
align-items: center;
gap: 12px;
+1 -1
View File
@@ -36,7 +36,7 @@ onMounted(loadContact)
<main class="content">
<section class="hero-card">
<span>YumiNail Support</span>
<span>指尖设计师客服</span>
<h2>帮助与客服</h2>
<p>订单、预约、售后和账号问题都可以从这里继续处理。</p>
</section>
+75 -36
View File
@@ -4,7 +4,7 @@
<button class="yumi-icon-button" type="button" aria-label="打开菜单" @click="router.push('/profile')">
<MenuOutlined />
</button>
<strong class="home-brand">YumiNail</strong>
<strong class="home-brand">首页</strong>
<button class="yumi-icon-button" type="button" aria-label="查看购物车" @click="router.push('/cart')">
<ShoppingOutlined />
</button>
@@ -13,8 +13,11 @@
<section class="hero">
<div class="hero-copy" @click="handleUserClick">
<p class="hero-kicker">{{ greeting }}</p>
<h1>早上好,{{ displayName }}</h1>
<p>{{ isLoggedIn ? '为你挑选今天适合预约的美甲灵感。' : '先看看门店和作品,喜欢了再登录也可以。' }}</p>
<h1>{{ displayName }}</h1>
<div class="member-line" aria-label="会员等级">
<span></span>
<p>{{ memberLevelText }}</p>
</div>
</div>
<button class="avatar-button" type="button" @click="handleUserClick">
<a-avatar :size="42" :src="userInfo?.avatar || DEFAULT_AVATAR" />
@@ -23,7 +26,7 @@
<form class="search-card" @submit.prevent="handleSearch">
<SearchOutlined class="search-card__icon" />
<input v-model="searchQuery" type="search" placeholder="搜索美甲风格或美甲师..." />
<input v-model="searchQuery" type="search" placeholder="搜索服务或美甲款式..." />
<button type="submit">搜索</button>
</form>
@@ -75,19 +78,19 @@
/>
<div class="feature-banner__shade"></div>
<div class="feature-banner__copy">
<span>新品上线</span>
<span>新品上市</span>
<h2>{{ item.name }}</h2>
<p>{{ item.shopName || item.meta }} · ¥{{ item.price }}</p>
</div>
</button>
</div>
</a-carousel>
<button v-else-if="featuredItems.length || popularItems.length" class="new-arrival-card" type="button" @click="router.push('/products')">
<img :src="DEFAULT_PRODUCT_IMAGE" alt="春日柔彩系列" class="feature-banner__image" />
<button v-else class="new-arrival-card" type="button" @click="router.push('/products')">
<img :src="DEFAULT_PRODUCT_IMAGE" alt="春日繁花系列" class="feature-banner__image" loading="eager" decoding="async" />
<div class="feature-banner__shade"></div>
<div class="feature-banner__copy">
<span>新品上线</span>
<h2>春日柔彩系列</h2>
<span>新品上市</span>
<h2>春日繁花系列</h2>
<p>轻盈裸粉、微闪珠光与日常通勤都刚好。</p>
</div>
</button>
@@ -96,19 +99,19 @@
<nav class="quick-actions" aria-label="快捷入口">
<button type="button" @click="router.push('/products')">
<span><CalendarOutlined /></span>
<b>约时间</b>
<b>在线预约</b>
</button>
<button type="button" @click="router.push('/products')">
<span><ShopOutlined /></span>
<b>找门店</b>
<span><AppstoreOutlined /></span>
<b>作品集</b>
</button>
<button type="button" @click="router.push('/cart')">
<span><ShoppingOutlined /></span>
<b>购物车</b>
<button type="button" @click="router.push('/vip-center')">
<span><CreditCardOutlined /></span>
<b>会员中心</b>
</button>
<button type="button" @click="router.push('/wishlist')">
<span><HeartOutlined /></span>
<b>我的收藏</b>
<button type="button" @click="router.push('/coupons')">
<span><TagsOutlined /></span>
<b>优惠活动</b>
</button>
</nav>
@@ -196,7 +199,7 @@
<h3>门店环境</h3>
</div>
<button class="see-all" type="button" @click="router.push('/products')">
去预约 <RightOutlined />
参观门店 <RightOutlined />
</button>
</div>
<div class="shop-strip">
@@ -224,13 +227,14 @@ import { computed, onMounted, onUnmounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import {
AppstoreOutlined,
CalendarOutlined,
HeartOutlined,
CreditCardOutlined,
MenuOutlined,
RightOutlined,
SearchOutlined,
ShopOutlined,
ShoppingOutlined,
TagsOutlined,
} from '@ant-design/icons-vue'
/**
* Purpose: AnnouncementVO supports HomeView.vue by holding or executing the announcement vo page or API role.
@@ -348,9 +352,10 @@ const pageSize = 8
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
/** greeting is a reactive state variable used by the template and event handlers. */
const greeting = computed(() => (isLoggedIn.value ? '欢迎回来' : '游客模式'))
const greeting = computed(() => '早上好,')
/** displayName is a reactive state variable used by the template and event handlers. */
const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value ? '用户' : '先看看门店和作品'))
const displayName = computed(() => userInfo.value?.nickname || (isLoggedIn.value ? '用户' : '朋友'))
const memberLevelText = computed(() => `会员等级:${userInfo.value?.level || (isLoggedIn.value ? '普通会员' : '游客')}`)
/** announcementLoop is a reactive state variable used by the template and event handlers. */
const announcementLoop = computed(() => [...announcements.value, ...announcements.value].map((item, index) => ({ ...item, loopKey: index })))
const selectedAnnouncementContentHtml = computed(() => renderRichContent(selectedAnnouncement.value?.content || '暂无公告内容'))
@@ -587,13 +592,10 @@ onMounted(async () => {
loadAnnouncements(),
loadNewArrivalProducts(),
loadFeaturedProducts(),
loadPopularProducts()
loadPopularProducts(),
loadPublicShops()
]
if (!isLoggedIn.value) {
homeTasks.push(loadPublicShops())
}
await Promise.all(homeTasks)
window.addEventListener('scroll', handleScroll)
})
@@ -1068,17 +1070,23 @@ onUnmounted(() => {
}
.home-topbar {
position: sticky;
top: 0;
z-index: 40;
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 18px 6px;
padding: 12px 18px 9px;
border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 78%, transparent);
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
backdrop-filter: blur(18px);
}
.home-brand {
color: var(--text-primary);
font-family: Georgia, 'Times New Roman', serif;
font-size: 15px;
font-weight: 700;
font-size: 16px;
font-weight: 800;
letter-spacing: 0;
}
.hero {
@@ -1108,8 +1116,23 @@ onUnmounted(() => {
line-height: 1.12;
}
.hero p:last-child {
.member-line {
display: flex;
align-items: center;
gap: 8px;
margin: 7px 0 0;
}
.member-line span {
display: inline-block;
width: 7px;
height: 7px;
border-radius: 999px;
background: var(--theme-secondary);
}
.member-line p {
margin: 0;
color: var(--text-secondary);
font-size: 12px;
line-height: 1.5;
@@ -1181,6 +1204,7 @@ onUnmounted(() => {
.feature-banner {
position: relative;
aspect-ratio: 4 / 3;
min-height: 132px;
margin: 16px 18px 0;
overflow: hidden;
@@ -1193,17 +1217,25 @@ onUnmounted(() => {
.new-arrival-carousel,
.new-arrival-card,
.new-arrival-slide,
.new-arrival-carousel :deep(.slick-slider),
.new-arrival-carousel :deep(.slick-list),
.new-arrival-carousel :deep(.slick-track),
.new-arrival-carousel :deep(.slick-slide),
.new-arrival-carousel :deep(.slick-slide > div) {
min-height: 132px;
height: 100% !important;
min-height: 100%;
}
.new-arrival-carousel,
.new-arrival-card {
position: absolute;
inset: 0;
}
.new-arrival-card {
position: relative;
display: block;
width: 100%;
height: 100%;
overflow: hidden;
border: 0;
background: transparent;
@@ -1212,6 +1244,11 @@ onUnmounted(() => {
text-align: left;
}
.new-arrival-slide {
position: relative;
width: 100%;
}
.new-arrival-carousel :deep(.slick-dots) {
right: 16px;
bottom: 14px;
@@ -1239,6 +1276,7 @@ onUnmounted(() => {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.feature-banner__shade {
@@ -1253,7 +1291,8 @@ onUnmounted(() => {
position: relative;
z-index: 1;
display: flex;
min-height: 132px;
height: 100%;
min-height: 0;
max-width: 72%;
flex-direction: column;
justify-content: flex-end;
+1 -1
View File
@@ -1,7 +1,7 @@
<template>
<div class="not-found-container">
<div class="not-found-content">
<span class="not-found-kicker">YumiNail</span>
<span class="not-found-kicker">指尖设计师</span>
<div class="error-code">404</div>
<h1>这页去做护理了</h1>
<p>您访问的页面不存在或已被删除,我们带您回到首页继续浏览作品。</p>
+12 -18
View File
@@ -5,7 +5,7 @@
<LeftOutlined :style="{ fontSize: '19px' }" />
</a-button>
<div class="order-header__copy">
<span>YumiNail</span>
<span>指尖设计师</span>
<h1 class="order-header__title">订单中心</h1>
</div>
<div class="order-header__spacer" />
@@ -1048,6 +1048,7 @@ onMounted(async () => {
<style scoped>
.order-page {
--order-shell-width: var(--frontend-page-max-width);
min-height: 100vh;
min-height: 100svh;
padding-top: 64px;
@@ -1065,19 +1066,20 @@ onMounted(async () => {
.order-header {
position: fixed;
top: 0;
right: 0;
left: 0;
left: 50%;
z-index: 20;
display: grid;
grid-template-columns: 42px minmax(0, 1fr) 42px;
align-items: center;
gap: 10px;
width: min(100%, var(--order-shell-width));
height: 64px;
padding: 8px 18px;
border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 72%, transparent);
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
-webkit-backdrop-filter: blur(18px);
backdrop-filter: blur(18px);
transform: translateX(-50%);
}
.order-header__back,
@@ -1121,8 +1123,8 @@ onMounted(async () => {
}
.order-content {
width: 100%;
max-width: 480px;
width: min(100%, var(--order-shell-width));
max-width: var(--order-shell-width);
margin: 0 auto;
padding: 14px 16px 30px;
}
@@ -1707,28 +1709,20 @@ onMounted(async () => {
@media (min-width: 768px) {
.order-content {
max-width: 720px;
padding: 24px;
}
.status-tabs {
margin-right: -24px;
margin-left: -24px;
padding-right: 24px;
padding-left: 24px;
padding: 14px 16px 30px;
}
.order-card {
padding: 20px;
padding: 18px;
}
.order-item {
grid-template-columns: 120px minmax(0, 1fr);
grid-template-columns: 94px minmax(0, 1fr);
}
.thumb {
width: 120px;
height: 120px;
width: 94px;
height: 94px;
}
}
</style>
@@ -309,7 +309,7 @@ const earliestBookableText = computed(() => shopInfo.value?.businessHours || '
const heroMaxHeightRatio = computed(() => {
const ratios = productImages.value
.map(url => productImageRatios.value[url])
.filter((ratio): ratio is number => Number.isFinite(ratio) && ratio > 0)
.filter((ratio): ratio is number => typeof ratio === 'number' && Number.isFinite(ratio) && ratio > 0)
return ratios.length ? Math.max(...ratios) : 1.25
})
/** heroSectionStyle lets shorter images center inside the tallest-image frame. */
@@ -540,6 +540,7 @@ onMounted(() => {
--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;
@@ -563,7 +564,7 @@ onMounted(() => {
display: grid;
grid-template-columns: 44px minmax(0, 1fr) 44px;
gap: 10px;
width: min(100%, 460px);
width: min(100%, var(--detail-shell-width));
margin: 0 auto;
align-items: center;
padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
@@ -632,7 +633,7 @@ onMounted(() => {
}
.detail-content {
width: min(100%, 460px);
width: min(100%, var(--detail-shell-width));
margin: 0 auto;
padding: 0 0 calc(112px + env(safe-area-inset-bottom));
}
@@ -1102,7 +1103,7 @@ onMounted(() => {
.footer-inner {
display: grid;
max-width: 430px;
max-width: var(--detail-shell-width);
grid-template-columns: 54px minmax(0, 1fr) minmax(0, 1.18fr);
gap: 10px;
margin: 0 auto;
+14 -24
View File
@@ -4,9 +4,8 @@
<a-button class="icon-btn" type="text" aria-label="返回首页" @click="handleBackClick">
<MenuOutlined />
</a-button>
<div class="brand-lockup" aria-label="YumiNail 作品列表">
<span class="brand-kicker">Nail Gallery</span>
<h1>YumiNail</h1>
<div class="brand-lockup" aria-label="指尖设计师">
<h1>指尖设计师</h1>
</div>
<a-button class="icon-btn icon-btn--bag" type="text" aria-label="前往购物车" @click="router.push('/cart')">
<ShoppingOutlined />
@@ -41,7 +40,7 @@
type="button"
@click="handleCategoryClick('全部')"
>
全部风格
全部款式
</button>
<button
v-for="tag in allTags"
@@ -465,7 +464,7 @@ onMounted(async () => {
<style scoped>
.product-list-page {
--gallery-header-height: 64px;
--gallery-header-height: 52px;
--gallery-gutter: 20px;
--gallery-surface: color-mix(in srgb, var(--theme-card-bg) 76%, transparent);
--gallery-surface-strong: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
@@ -501,26 +500,17 @@ onMounted(async () => {
}
.brand-lockup {
display: grid;
place-items: center;
display: flex;
align-items: center;
justify-content: center;
min-width: 0;
}
.brand-kicker {
color: var(--theme-primary-action);
font-size: 10px;
font-weight: 700;
line-height: 1;
letter-spacing: 0;
text-transform: uppercase;
}
.brand-lockup h1 {
margin: 3px 0 0;
color: var(--theme-primary-action);
font-family: "Playfair Display", "Times New Roman", serif;
font-size: 28px;
font-weight: 700;
margin: 0;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
line-height: 1;
letter-spacing: 0;
}
@@ -530,8 +520,8 @@ onMounted(async () => {
display: inline-flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
width: 36px;
height: 36px;
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 72%, transparent);
@@ -545,7 +535,7 @@ onMounted(async () => {
}
.icon-btn :deep(.anticon) {
font-size: 20px;
font-size: 18px;
}
.bag-dot {
+4 -4
View File
@@ -3,7 +3,7 @@
<header class="profile-hero">
<div class="profile-topbar">
<div class="profile-title-copy">
<span class="profile-kicker">YumiNail</span>
<span class="profile-kicker">指尖设计师</span>
<h1>个人中心</h1>
</div>
<button class="profile-icon-button" type="button" aria-label="打开设置" @click="handleSettingsClick">
@@ -19,7 +19,7 @@
</div>
<div class="welcome-copy">
<span class="welcome-label">Welcome back</span>
<h2 class="username">{{ userInfo.nickname || 'Yumi 用户' }}</h2>
<h2 class="username">{{ userInfo.nickname || '指尖设计师用户' }}</h2>
<p class="account">{{ userInfo.account || '登录后解锁预约礼遇' }}</p>
<p v-if="userInfo.signature" class="signature">{{ userInfo.signature }}</p>
</div>
@@ -44,7 +44,7 @@
<button class="vip-card" type="button" @click="handleMenuClick('vip')">
<span class="vip-card__glow"></span>
<span class="vip-card__copy">
<span class="section-eyebrow">Luminous VIP</span>
<span class="section-eyebrow">指尖会员</span>
<strong>会员柔光礼遇</strong>
<small>查看会员等级、余额和专属优惠</small>
</span>
@@ -416,7 +416,7 @@ const shopOptions = computed(() => {
})
/** currentShopName is a reactive state variable used by the template and event handlers. */
const currentShopName = computed(() => userInfo.value.shopName || '当前暂无可用门店')
const currentShopName = computed(() => userInfo.value.shopName || '当前门店')
/** shopSwitchTip is a reactive state variable used by the template and event handlers. */
const shopSwitchTip = computed(() => {
if (shopOptions.value.length > 1) {