杂务:更新 YumiNail 工作区

This commit is contained in:
xiaowang
2026-05-29 13:30:56 +08:00
parent 1d077d4089
commit 31cd06b5c9
16498 changed files with 10330586 additions and 2340 deletions
@@ -0,0 +1,82 @@
- generic [ref=e4]:
- main [ref=e6]:
- button "home 首页" [ref=e7] [cursor=pointer]:
- img "home" [ref=e10]:
- img [ref=e11]
- generic [ref=e13]: 首页
- button "shopping 作品" [ref=e14] [cursor=pointer]:
- img "shopping" [ref=e17]:
- img [ref=e18]
- generic [ref=e20]: 作品
- button "shopping-cart 购物车" [ref=e21] [cursor=pointer]:
- img "shopping-cart" [ref=e24]:
- img [ref=e25]
- generic [ref=e27]: 购物车
- button "user 我的" [ref=e28] [cursor=pointer]:
- generic [ref=e29]:
- img "user" [ref=e31]:
- img [ref=e32]
- superscript [ref=e34]
- generic [ref=e35]: 我的
- generic [ref=e37]:
- banner [ref=e38]:
- button "打开菜单" [ref=e39] [cursor=pointer]:
- img "menu" [ref=e40]:
- img [ref=e41]
- strong [ref=e43]: YumiNail
- button "查看购物车" [ref=e44] [cursor=pointer]:
- img "shopping" [ref=e45]:
- img [ref=e46]
- generic [ref=e48]:
- generic [ref=e49]:
- paragraph [ref=e50]: 游客模式
- heading "早上好,先看看门店和作品" [level=1] [ref=e51]
- paragraph [ref=e52]: 先看看门店和作品,喜欢了再登录也可以。
- button [ref=e53] [cursor=pointer]:
- img [ref=e55]
- generic [ref=e56]:
- img "search" [ref=e57]:
- img [ref=e58]
- searchbox "搜索美甲风格或美甲师..." [ref=e60]
- button "搜索" [ref=e61] [cursor=pointer]
- generic [ref=e62] [cursor=pointer]:
- img "春日柔彩系列" [ref=e63]
- generic [ref=e65]:
- generic [ref=e66]: 新品上线
- heading "春日柔彩系列" [level=2] [ref=e67]
- paragraph [ref=e68]: 轻盈裸粉、微闪珠光与日常通勤都刚好。
- navigation "快捷入口" [ref=e69]:
- button "calendar 约时间" [ref=e70] [cursor=pointer]:
- img "calendar" [ref=e72]:
- img [ref=e73]
- generic [ref=e75]: 约时间
- button "shop 找门店" [ref=e76] [cursor=pointer]:
- img "shop" [ref=e78]:
- img [ref=e79]
- generic [ref=e81]: 找门店
- button "shopping 购物车" [ref=e82] [cursor=pointer]:
- img "shopping" [ref=e84]:
- img [ref=e85]
- generic [ref=e87]: 购物车
- button "heart 我的收藏" [ref=e88] [cursor=pointer]:
- img "heart" [ref=e90]:
- img [ref=e91]
- generic [ref=e93]: 我的收藏
- generic [ref=e95]:
- generic [ref=e96]:
- generic [ref=e97]: Curated
- heading "精选作品" [level=3] [ref=e98]
- button "查看全部 right" [ref=e99] [cursor=pointer]:
- text: 查看全部
- img "right" [ref=e100]:
- img [ref=e101]
- generic [ref=e103]:
- generic [ref=e104]:
- generic [ref=e105]:
- generic [ref=e106]: Trending
- heading "热门作品" [level=3] [ref=e107]
- button "查看全部 right" [ref=e108] [cursor=pointer]:
- text: 查看全部
- img "right" [ref=e109]:
- img [ref=e110]
- generic [ref=e119]: 加载中...
+35 -26
View File
@@ -1,12 +1,28 @@
<template>
<el-config-provider>
<ConfigProvider :locale="antdLocale" :theme="antdTheme">
<div class="app-container">
<BottomNav v-if="!isHiddenNav" />
<div class="page-content" :class="{ 'no-nav-padding': isHiddenNav }">
<router-view v-slot="{ Component }">
<component :is="Component" :key="route.path" />
</router-view>
<div
class="app-container"
:class="{
'app-container--phone-shell': !isAdminShell,
'app-container--admin': isAdminShell
}"
>
<div v-if="isAdminShell" class="admin-shell">
<div class="page-content no-nav-padding">
<router-view v-slot="{ Component }">
<component :is="Component" :key="route.path" />
</router-view>
</div>
</div>
<div v-else class="yumi-phone-frame" :class="{ 'yumi-phone-frame--hidden-nav': isHiddenNav }">
<BottomNav v-if="!isHiddenNav" />
<div class="page-content" :class="{ 'no-nav-padding': isHiddenNav }">
<router-view v-slot="{ Component }">
<component :is="Component" :key="route.path" />
</router-view>
</div>
</div>
</div>
</ConfigProvider>
@@ -35,6 +51,7 @@ import { userApi, type SystemMessageVO } from './api/user'
import antdLocale from './config/antdv-locale'
import { useGlobalConfirmEnter } from './composables/useConfirmEnter'
import { useShopTheme } from './composables/useShopTheme'
import { buildSystemMessageActionPath } from './utils/system-message-action'
/**
* Purpose: route supports App.vue by holding or executing the route page or API role.
@@ -46,7 +63,7 @@ const route = useRoute()
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const { currentTheme, refreshShopTheme, resetShopTheme, setupShopThemeSync } = useShopTheme()
const { currentTheme, refreshShopTheme, setupShopThemeSync } = useShopTheme()
useGlobalConfirmEnter()
/**
* Purpose: ButtonPropsWithClass supports App.vue by holding or executing the button props with class page or API role.
@@ -57,6 +74,10 @@ const popupMessageOkButtonProps: ButtonPropsWithClass = { class: 'popup-message-
/** routerReady is a reactive state variable used by the template and event handlers. */
const routerReady = ref(false)
let stopThemeSync: (() => void) | undefined
const adminThemeRefreshOptions = { mode: 'admin' as const }
const customerThemeRefreshOptions = { mode: 'customer' as const }
const isAdminShell = computed(() => route.path.startsWith('/admin') || route.matched.some(r => r.meta.isAdmin))
/** isHiddenNav is a reactive state variable used by the template and event handlers. */
const isHiddenNav = computed(() => {
@@ -64,7 +85,7 @@ const isHiddenNav = computed(() => {
return true
}
if (route.path === '/' || route.path.startsWith('/admin')) {
if (route.path === '/' || isAdminShell.value) {
return true
}
@@ -135,11 +156,7 @@ const updateCartCount = async () => {
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const resolveSystemMessageActionPath = (item: SystemMessageVO) => {
const actionPath = String(item.actionPath || '').trim()
if (!actionPath || !actionPath.startsWith('/') || actionPath.startsWith('//')) {
return ''
}
return actionPath
return buildSystemMessageActionPath(item)
}
/**
@@ -224,11 +241,7 @@ provide('cartCount', cartCount)
watch(() => route.path, async () => {
// 检查当前是否是后台页面,如果是则不加载购物车数据
const isAdminPage = route.matched.some(r => r.meta.isAdmin)
if (isAdminPage) {
resetShopTheme()
} else {
await refreshShopTheme()
}
await refreshShopTheme(isAdminPage ? adminThemeRefreshOptions : customerThemeRefreshOptions)
if (!isAdminPage) {
await loadCartCount()
await checkPopupMessages()
@@ -242,11 +255,7 @@ onMounted(async () => {
stopThemeSync = setupShopThemeSync()
await router.isReady()
routerReady.value = true
if (route.matched.some(r => r.meta.isAdmin)) {
resetShopTheme()
} else {
await refreshShopTheme()
}
await refreshShopTheme(route.matched.some(r => r.meta.isAdmin) ? adminThemeRefreshOptions : customerThemeRefreshOptions)
await checkPopupMessages()
})
@@ -298,7 +307,7 @@ onUnmounted(() => {
.yumi-date-picker-panel .ant-picker-header {
padding: 8px 12px;
border-bottom-color: #eef1f5;
border-bottom-color: var(--theme-border);
}
.yumi-date-picker-panel .ant-picker-header button {
@@ -314,7 +323,7 @@ onUnmounted(() => {
.yumi-date-picker-panel .ant-picker-content th {
height: 34px;
color: #7b8494;
color: var(--text-secondary);
font-weight: 600;
}
@@ -344,7 +353,7 @@ onUnmounted(() => {
}
.yumi-date-picker-panel .ant-picker-footer {
border-top-color: #eef1f5;
border-top-color: var(--theme-border);
}
.yumi-date-time-panel .ant-picker-time-panel,
+12 -1
View File
@@ -32,7 +32,7 @@ const ERROR_DEBOUNCE_TIME = 1000
*/
const adminApi = axios.create({
baseURL: ADMIN_API_BASE_URL,
timeout: 10000,
timeout: 60000,
headers: {
'Content-Type': 'application/json'
}
@@ -913,6 +913,10 @@ export interface UserVO {
account: string
avatar: string
phone?: string
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
signature?: string
level?: string
type: number
@@ -1911,6 +1915,10 @@ export interface SystemParameterConfigVO {
updateTime?: string
}
export interface AdminDefaultPasswordResponse {
password: string
}
/**
* Purpose: adminSystemParameterConfigApi supports admin.ts by holding or executing the admin system parameter config api 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.
@@ -1927,6 +1935,9 @@ export const adminSystemParameterConfigApi = {
},
getMapConfig: () => {
return adminApi.get<{ provider: 'TENCENT' | 'AMAP'; tencentWebKey?: string; amapWebKey?: string; amapMiniKey?: string }>('/system-parameter-config/admin/map-config') as unknown as Promise<{ provider: 'TENCENT' | 'AMAP'; tencentWebKey?: string; amapWebKey?: string; amapMiniKey?: string }>
},
getUserDefaultPassword: () => {
return adminApi.get<AdminDefaultPasswordResponse>('/system-parameter-config/admin/user-default-password') as unknown as Promise<AdminDefaultPasswordResponse>
}
}
+9
View File
@@ -48,6 +48,15 @@ export const fileApi = {
}
})
},
uploadProfileImage: (file: File) => {
const formData = new FormData()
formData.append('file', file)
return api.post<string>('/user/upload-profile-image', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}) as unknown as Promise<string>
},
/**
* `initAvatarChunkUpload` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
+1 -1
View File
@@ -32,7 +32,7 @@ const ERROR_DEBOUNCE_TIME = 1000 // 1秒内不重复显示相同错误
*/
const api = axios.create({
baseURL: API_BASE_URL,
timeout: 10000,
timeout: 60000,
headers: {
'Content-Type': 'application/json'
}
+19
View File
@@ -27,6 +27,10 @@ export interface UserVO extends UserInfo {
updateTime: string
status: number
phone?: string
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
email?: string
maskedPhone?: string
maskedEmail?: string
@@ -46,6 +50,10 @@ export interface UpdateUserInfoRequest {
nickname?: string
avatar?: string
signature?: string
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
}
/**
@@ -68,6 +76,10 @@ export interface CreateUserRequest {
account: string
nickname: string
phone: string
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
password: string
type: number
shopId?: IdType
@@ -82,6 +94,10 @@ export interface UpdateUserRequest {
account?: string
nickname?: string
phone?: string
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
type?: number
shopId?: IdType
shopIds?: IdType[]
@@ -296,6 +312,9 @@ export interface ContactInfoVO {
roleLabel?: string
phone?: string
phoneAvailable?: boolean
wechatId?: string
wechatAvailable?: boolean
wechatQrCode?: string
platformContactAvailable?: boolean
platformContactText?: string
}
+1
View File
@@ -26,6 +26,7 @@ declare module 'vue' {
ADescriptions: typeof import('ant-design-vue/es')['Descriptions']
ADescriptionsItem: typeof import('ant-design-vue/es')['DescriptionsItem']
ADivider: typeof import('ant-design-vue/es')['Divider']
AdminFilterPanel: typeof import('./components/admin/AdminFilterPanel.vue')['default']
AdminMobileCardList: typeof import('./components/admin/AdminMobileCardList.vue')['default']
AdminMobileFab: typeof import('./components/admin/AdminMobileFab.vue')['default']
AdminResponsiveModal: typeof import('./components/admin/AdminResponsiveModal.vue')['default']
+60 -39
View File
@@ -1,45 +1,41 @@
<template>
<a-layout class="bottom-nav">
<a-layout-content class="nav-content">
<!-- 首页导航项 -->
<div class="nav-item" :class="{ active: currentRoute === 'home' }" @click="handleNavClick('home')">
<button class="nav-item" :class="{ active: currentRoute === 'home' }" type="button" @click="handleNavClick('home')">
<a-badge :count="0" :offset="[0, 0]">
<div class="nav-icon">
<HomeOutlined :style="{ fontSize: '24px' }" />
<HomeOutlined :style="{ fontSize: '22px' }" />
</div>
</a-badge>
<span class="nav-label">首页</span>
</div>
</button>
<!-- 作品导航项 -->
<div class="nav-item" :class="{ active: currentRoute === 'products' }" @click="handleNavClick('products')">
<button class="nav-item" :class="{ active: currentRoute === 'products' }" type="button" @click="handleNavClick('products')">
<a-badge :count="0" :offset="[0, 0]">
<div class="nav-icon">
<ShoppingOutlined :style="{ fontSize: '24px' }" />
<ShoppingOutlined :style="{ fontSize: '22px' }" />
</div>
</a-badge>
<span class="nav-label">作品</span>
</div>
</button>
<!-- 购物车导航项 -->
<div class="nav-item" :class="{ active: currentRoute === 'cart' }" @click="handleNavClick('cart')">
<button class="nav-item" :class="{ active: currentRoute === 'cart' }" type="button" @click="handleNavClick('cart')">
<a-badge :count="cartCount" :offset="[0, 0]">
<div class="nav-icon">
<ShoppingCartOutlined :style="{ fontSize: '24px' }" />
<ShoppingCartOutlined :style="{ fontSize: '22px' }" />
</div>
</a-badge>
<span class="nav-label">购物车</span>
</div>
</button>
<!-- 个人中心导航项 -->
<div class="nav-item" :class="{ active: currentRoute === 'profile' }" @click="handleNavClick('profile')">
<button class="nav-item" :class="{ active: currentRoute === 'profile' }" type="button" @click="handleNavClick('profile')">
<a-badge :dot="hasNotification" :offset="[0, 0]">
<div class="nav-icon">
<UserOutlined :style="{ fontSize: '24px' }" />
<UserOutlined :style="{ fontSize: '22px' }" />
</div>
</a-badge>
<span class="nav-label">我的</span>
</div>
</button>
</a-layout-content>
</a-layout>
</template>
@@ -132,11 +128,10 @@ const handleNavClick = (tab: string) => {
left: 0;
right: 0;
width: 100%;
height: 60px;
background: rgba(255, 255, 255, 0.98);
background: color-mix(in srgb, var(--theme-card-bg) 94%, transparent);
height: 64px;
background: color-mix(in srgb, var(--theme-card-bg) 96%, transparent);
border-top: 1px solid var(--theme-border);
box-shadow: 0 -12px 30px rgba(122, 67, 88, 0.1);
box-shadow: 0 -14px 34px color-mix(in srgb, var(--theme-neutral) 10%, transparent);
z-index: 1000;
display: flex;
align-items: center;
@@ -155,75 +150,80 @@ const handleNavClick = (tab: string) => {
align-items: center;
height: 100%;
width: 100%;
max-width: 560px;
max-width: none;
margin: 0 auto;
padding: 0 10px;
padding: 0 12px calc(env(safe-area-inset-bottom, 0px) / 2);
transition: none !important;
}
.nav-item {
appearance: none;
border: 0;
background: transparent;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 8px 12px;
gap: 3px;
min-width: 58px;
min-height: 54px;
padding: 6px 8px;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
border: 1px solid transparent;
border-radius: 14px;
min-width: 60px;
color: var(--text-secondary);
}
.nav-item:hover {
background: var(--theme-primary-soft);
border-color: var(--theme-border);
transform: translateY(-2px);
}
.nav-item.active {
color: var(--theme-primary);
background: var(--theme-primary-soft);
border-color: var(--theme-border);
color: var(--theme-primary-action);
}
.nav-item.active .nav-icon {
transform: scale(1.1);
transform: translateY(-2px);
}
.nav-icon {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 4px;
width: 34px;
height: 30px;
margin-bottom: 0;
border-radius: 18px 18px 16px 16px;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
color: var(--text-secondary);
opacity: 1;
}
.nav-item.active .nav-icon {
color: var(--theme-primary);
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 34%, var(--theme-card-bg));
}
.nav-label {
font-size: 11px;
font-weight: 500;
font-weight: 700;
color: var(--text-secondary);
transition: all 0.3s ease;
}
.nav-item.active .nav-label {
font-weight: 600;
color: var(--theme-primary);
color: var(--theme-primary-action);
}
.nav-item :deep(.ant-badge-count) {
background: var(--theme-primary);
min-width: 16px;
height: 16px;
line-height: 16px;
background: var(--theme-primary-action);
box-shadow: 0 0 0 1px var(--theme-card-bg);
}
.nav-item :deep(.ant-badge-dot) {
background: var(--theme-accent);
background: var(--theme-secondary);
box-shadow: 0 0 0 1px var(--theme-card-bg);
}
@@ -254,4 +254,25 @@ const handleNavClick = (tab: string) => {
display: none;
}
}
@media (min-width: 768px) {
.nav-content {
max-width: var(--frontend-page-max-width);
}
}
</style>
<style>
@media (min-width: 768px) {
.yumi-phone-frame > .bottom-nav {
right: auto;
bottom: 0;
left: 50%;
width: var(--frontend-page-max-width);
max-width: calc(100vw - 48px);
border-bottom-right-radius: 32px;
border-bottom-left-radius: 32px;
transform: translateX(-50%) translateZ(0);
}
}
</style>
@@ -64,7 +64,7 @@ const formattedSavedAt = computed(() => {
}
.draft-saved-at {
color: #8c8c8c;
color: var(--text-secondary);
font-size: 12px;
line-height: 24px;
}
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { computed } from 'vue'
import { BellOutlined, ClockCircleOutlined } from '@ant-design/icons-vue'
import { renderRichContent } from '@/utils/rich-content'
/**
* Purpose: props supports SystemMessageCard.vue by holding or executing the props page or API role.
@@ -43,6 +44,7 @@ const displayTitle = computed(() => props.title?.trim() || '系统消息')
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const displayContent = computed(() => props.content?.trim() || (hasImage.value ? '' : '你收到了一条新的系统消息。'))
const displayContentHtml = computed(() => renderRichContent(displayContent.value))
</script>
<template>
@@ -75,7 +77,7 @@ const displayContent = computed(() => props.content?.trim() || (hasImage.value ?
<span>{{ meta }}</span>
</div>
<p v-if="displayContent" class="system-message-card__content">{{ displayContent }}</p>
<div v-if="displayContentHtml" class="system-message-card__content" v-html="displayContentHtml"></div>
</section>
<footer v-if="$slots.footer" class="system-message-card__footer">
@@ -170,7 +172,7 @@ const displayContent = computed(() => props.content?.trim() || (hasImage.value ?
font-size: 22px;
font-weight: 800;
line-height: 1.35;
overflow-wrap: anywhere;
overflow-wrap: break-word;
}
.system-message-card__meta {
@@ -183,7 +185,7 @@ const displayContent = computed(() => props.content?.trim() || (hasImage.value ?
color: var(--text-secondary);
font-size: 13px;
line-height: 1.5;
overflow-wrap: anywhere;
overflow-wrap: break-word;
}
.system-message-card__content {
@@ -192,8 +194,51 @@ const displayContent = computed(() => props.content?.trim() || (hasImage.value ?
font-size: 15px;
line-height: 1.75;
text-align: left;
white-space: pre-wrap;
overflow-wrap: anywhere;
overflow-wrap: break-word;
}
.system-message-card__content :deep(*) {
max-width: 100%;
}
.system-message-card__content :deep(p),
.system-message-card__content :deep(ul),
.system-message-card__content :deep(ol),
.system-message-card__content :deep(blockquote),
.system-message-card__content :deep(pre),
.system-message-card__content :deep(table) {
margin: 0 0 12px;
}
.system-message-card__content :deep(p:last-child),
.system-message-card__content :deep(ul:last-child),
.system-message-card__content :deep(ol:last-child),
.system-message-card__content :deep(blockquote:last-child),
.system-message-card__content :deep(pre:last-child),
.system-message-card__content :deep(table:last-child) {
margin-bottom: 0;
}
.system-message-card__content :deep(ul),
.system-message-card__content :deep(ol) {
padding-left: 1.25em;
}
.system-message-card__content :deep(a) {
color: var(--theme-primary);
}
.system-message-card__content :deep(img) {
display: block;
max-width: 100%;
border-radius: 8px;
}
.system-message-card__content :deep(pre) {
overflow-x: auto;
padding: 10px 12px;
border-radius: 8px;
background: var(--theme-primary-soft);
}
.system-message-card__footer {
@@ -44,12 +44,13 @@ const lineClass = computed(() => {
<style scoped>
.ellipsis-text {
width: 100%;
display: inline-block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
line-height: 1.5;
vertical-align: bottom;
}
.lines-2,
@@ -57,7 +58,8 @@ const lineClass = computed(() => {
display: -webkit-box;
-webkit-box-orient: vertical;
white-space: normal;
word-break: break-word;
word-break: normal;
overflow-wrap: normal;
}
.lines-2 {
@@ -69,6 +71,6 @@ const lineClass = computed(() => {
}
.empty-text {
color: #bfbfbf;
color: var(--text-secondary);
}
</style>
@@ -0,0 +1,120 @@
<script setup lang="ts">
import { shallowRef } from 'vue'
import { DownOutlined, FilterOutlined } from '@ant-design/icons-vue'
const props = withDefaults(defineProps<{
activeCount?: number
label?: string
}>(), {
activeCount: 0,
label: '筛选'
})
const filtersOpen = shallowRef(false)
</script>
<template>
<div class="admin-filter-panel">
<div class="mobile-filter-toggle">
<button
class="mobile-filter-toggle__button"
type="button"
:aria-expanded="filtersOpen"
@click="filtersOpen = !filtersOpen"
>
<FilterOutlined />
<span>{{ props.activeCount ? `${props.label} ${props.activeCount}` : props.label }}</span>
<DownOutlined class="mobile-filter-toggle__chevron" :class="{ 'is-open': filtersOpen }" />
</button>
</div>
<div
class="admin-filter-bar admin-filter-bar--mobile"
:class="{ 'admin-filter-bar--collapsed': !filtersOpen }"
>
<slot />
</div>
</div>
</template>
<style scoped>
.admin-filter-panel {
display: grid;
gap: 10px;
margin-bottom: 16px;
}
.admin-filter-bar {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.mobile-filter-toggle {
display: none;
}
@media (max-width: 960px) {
.admin-filter-panel {
gap: 8px;
margin-bottom: 14px;
}
.mobile-filter-toggle {
display: block;
}
.mobile-filter-toggle__button {
width: 100%;
min-height: 40px;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 0 12px;
border: 1px solid var(--admin-mobile-border);
border-radius: 12px;
background: var(--theme-card-bg);
color: var(--admin-mobile-ink);
font-weight: 600;
}
.mobile-filter-toggle__chevron {
transition: transform 0.2s ease;
}
.mobile-filter-toggle__chevron.is-open {
transform: rotate(180deg);
}
.admin-filter-bar--mobile {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
max-height: 560px;
overflow: hidden;
opacity: 1;
transition: max-height 0.22s ease, opacity 0.18s ease;
}
.admin-filter-bar--mobile.admin-filter-bar--collapsed {
max-height: 0;
opacity: 0;
pointer-events: none;
}
.admin-filter-bar--mobile :deep(.ant-input),
.admin-filter-bar--mobile :deep(.ant-input-affix-wrapper),
.admin-filter-bar--mobile :deep(.ant-input-number),
.admin-filter-bar--mobile :deep(.ant-picker),
.admin-filter-bar--mobile :deep(.ant-select),
.admin-filter-bar--mobile :deep(.ant-btn) {
width: 100% !important;
min-width: 0;
}
.admin-filter-bar--mobile :deep(.ant-picker) {
grid-column: 1 / -1;
}
}
</style>
@@ -4,6 +4,7 @@
:open="open"
:title="title"
:width="mergedWidth"
:mask-closable="false"
:centered="!isMobile"
:wrap-class-name="mergedWrapClassName"
:style="mergedStyle"
@@ -75,13 +76,13 @@ const attrs = useAttrs()
const modalInstanceClass = `admin-responsive-modal-${modalInstanceSeed++}`
/** mergedWidth is a reactive state variable used by the template and event handlers. */
const mergedWidth = computed(() => (isMobile.value ? '100vw' : props.desktopWidth))
const mergedWidth = computed(() => (isMobile.value ? '100dvw' : props.desktopWidth))
/** mergedStyle is a reactive state variable used by the template and event handlers. */
const mergedStyle = computed(() => (
isMobile.value
? {
top: '0px',
maxWidth: '100vw',
maxWidth: '100dvw',
paddingBottom: '0px'
}
: undefined
@@ -0,0 +1,71 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
vi.mock('@/api/file', () => ({
fileApi: {
getSignedUrl: vi.fn()
}
}))
vi.mock('@/api/shop', () => ({
shopApi: {
getShopById: vi.fn()
}
}))
import { shopApi } from '@/api/shop'
import { DEFAULT_SHOP_THEME } from '@/utils/shop-theme'
import { useShopTheme } from './useShopTheme'
describe('useShopTheme', () => {
beforeEach(() => {
localStorage.clear()
sessionStorage.clear()
vi.clearAllMocks()
document.documentElement.removeAttribute('style')
})
it('uses the first preset as the default visible theme', async () => {
const { resetShopTheme } = useShopTheme()
resetShopTheme()
expect(DEFAULT_SHOP_THEME.primaryColor).toBe('#E8B4B8')
expect(DEFAULT_SHOP_THEME.secondaryColor).toBe('#C5A059')
expect(DEFAULT_SHOP_THEME.accentColor).toBe('#4A443F')
expect(DEFAULT_SHOP_THEME.pageBgColor).toBe('#FDFBF9')
expect(DEFAULT_SHOP_THEME.cardBgColor).toBe('#FFFFFF')
expect(document.documentElement.style.getPropertyValue('--theme-primary')).toBe('#E8B4B8')
expect(document.documentElement.style.getPropertyValue('--theme-secondary')).toBe('#C5A059')
expect(document.documentElement.style.getPropertyValue('--theme-neutral')).toBe('#4A443F')
expect(document.documentElement.style.getPropertyValue('--theme-tertiary')).toBe('#FDFBF9')
})
it('refreshes the admin theme from the cached admin shop context', async () => {
localStorage.setItem('adminAccessToken', 'admin-token')
localStorage.setItem('adminUserInfo', JSON.stringify({ shopId: 42 }))
vi.mocked(shopApi.getShopById).mockResolvedValue({
themePrimaryColor: '#123456',
themeSecondaryColor: '#ABCDEF',
themeAccentColor: '#345678',
themePageBgColor: '#F7FAFC',
themeCardBgColor: '#FFFFFF'
} as never)
const { refreshShopTheme } = useShopTheme()
await refreshShopTheme({ mode: 'admin' })
expect(shopApi.getShopById).toHaveBeenCalledWith('42')
expect(document.documentElement.style.getPropertyValue('--theme-primary')).toBe('#123456')
expect(document.documentElement.style.getPropertyValue('--theme-secondary')).toBe('#ABCDEF')
})
it('keeps the default theme for login pages without a shop context', async () => {
const { refreshShopTheme } = useShopTheme()
await refreshShopTheme({ mode: 'admin' })
expect(shopApi.getShopById).not.toHaveBeenCalled()
expect(document.documentElement.style.getPropertyValue('--theme-primary')).toBe('#E8B4B8')
})
})
@@ -13,6 +13,13 @@ import {
type ResolvedShopTheme
} from '@/utils/shop-theme'
type ShopThemeMode = 'auto' | 'admin' | 'customer'
export interface RefreshShopThemeOptions {
mode?: ShopThemeMode
shopId?: string | number | null
}
/**
* Purpose: currentTheme supports useShopTheme.ts by holding or executing the current theme 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.
@@ -25,6 +32,8 @@ let cleanupThemeSync: (() => void) | undefined
*/
let refreshSequence = 0
applyShopTheme(DEFAULT_SHOP_THEME)
/**
* Purpose: useShopTheme supports useShopTheme.ts by holding or executing the use shop theme page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
@@ -42,10 +51,11 @@ export function useShopTheme() {
* Purpose: refreshShopTheme supports useShopTheme.ts by holding or executing the refresh shop theme page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
async function refreshShopTheme() {
const token = readToken()
const userInfo = readStoredUserInfo()
const shopId = userInfo?.shopId
async function refreshShopTheme(options: RefreshShopThemeOptions = {}) {
const mode = resolveThemeMode(options.mode)
const token = readToken(mode)
const userInfo = readStoredUserInfo(mode)
const shopId = options.shopId === undefined ? userInfo?.shopId : options.shopId
if (!token || !shopId) {
resetShopTheme()
@@ -54,7 +64,7 @@ async function refreshShopTheme() {
const sequence = ++refreshSequence
try {
const shop = await shopApi.getShopById(shopId)
const shop = await shopApi.getShopById(String(shopId))
if (sequence !== refreshSequence) {
return
}
@@ -89,7 +99,14 @@ function setupShopThemeSync() {
void refreshShopTheme()
}
const handleStorage = (event: StorageEvent) => {
if (['accessToken', 'userInfo', 'refreshToken'].includes(event.key || '')) {
if ([
'accessToken',
'userInfo',
'refreshToken',
'adminAccessToken',
'adminRefreshToken',
'adminUserInfo'
].includes(event.key || '')) {
void refreshShopTheme()
}
}
@@ -137,10 +154,23 @@ async function resolveBackgroundImageUrl(fileId?: string) {
* Purpose: readToken supports useShopTheme.ts by holding or executing the read token page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function readToken() {
function resolveThemeMode(mode: ShopThemeMode = 'auto'): Exclude<ShopThemeMode, 'auto'> {
if (mode !== 'auto') {
return mode
}
if (typeof window !== 'undefined' && window.location.pathname.startsWith('/admin')) {
return 'admin'
}
return 'customer'
}
function readToken(mode: Exclude<ShopThemeMode, 'auto'>) {
if (typeof window === 'undefined') {
return ''
}
if (mode === 'admin') {
return localStorage.getItem('adminAccessToken') || sessionStorage.getItem('adminAccessToken') || ''
}
return localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken') || ''
}
@@ -148,11 +178,11 @@ function readToken() {
* Purpose: readStoredUserInfo supports useShopTheme.ts by holding or executing the read stored user info page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function readStoredUserInfo(): { shopId?: string | number } | null {
function readStoredUserInfo(mode: Exclude<ShopThemeMode, 'auto'>): { shopId?: string | number } | null {
if (typeof window === 'undefined') {
return null
}
const raw = localStorage.getItem('userInfo')
const raw = localStorage.getItem(mode === 'admin' ? 'adminUserInfo' : 'userInfo')
if (!raw) {
return null
}
+1
View File
@@ -2,6 +2,7 @@ import { createApp } from 'vue'
import { createPinia } from 'pinia'
import 'ant-design-vue/dist/reset.css'
import './styles/admin-mobile.css'
import './style.css'
import App from './App.vue'
import router from './router'
+30
View File
@@ -74,6 +74,36 @@ const router = createRouter({
component: () => import('../views/OrderView.vue'),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: '/orders/:id',
name: 'order-detail',
component: () => import('../views/OrderDetailView.vue'),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: '/after-sales',
name: 'after-sales',
component: () => import('../views/AfterSalesView.vue'),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: '/after-sale/apply',
name: 'after-sale-apply',
component: () => import('../views/AfterSaleApplyView.vue'),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: '/service-progress',
name: 'service-progress',
component: () => import('../views/ServiceProgressView.vue'),
meta: { requiresAuth: true, hideNav: true, isAdmin: false }
},
{
path: '/help',
name: 'help',
component: () => import('../views/HelpView.vue'),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: '/artist-orders',
name: 'artist-orders',
+276 -11
View File
@@ -1,13 +1,30 @@
:root {
--primary-color: #ff6600; /* 根据设计稿中的橙色色值调整 */
--bg-color: #ffffff;
--secondary-bg-color: #f5f5f5;
--text-primary: #333333;
--text-secondary: #999999;
--primary-color: #E8B4B8;
--theme-primary: #E8B4B8;
--theme-secondary: #C5A059;
--theme-accent: #4A443F;
--theme-neutral: #4A443F;
--theme-tertiary: #FDFBF9;
--theme-primary-action: #766361;
--theme-primary-soft: #FAEFF0;
--theme-secondary-soft: #EADCC2;
--theme-page-bg: #FDFBF9;
--theme-card-bg: #FFFFFF;
--theme-border: #F9EAEC;
--theme-gradient: linear-gradient(135deg, #766361 0%, #C5A059 100%);
--theme-gradient-soft: linear-gradient(145deg, #FFFFFF 0%, #EADCC2 58%, #F5E0E0 100%);
--theme-button-shadow: 0 12px 28px rgba(232, 180, 184, 0.26);
--theme-focus-shadow: 0 0 0 3px rgba(232, 180, 184, 0.2);
--theme-background-image: none;
--bg-color: #FDFBF9;
--secondary-bg-color: #EADCC2;
--surface-color: #FFFFFF;
--text-primary: #4A443F;
--text-secondary: #6B6662;
--border-radius-base: 10px;
--border-radius-large: 30px;
--frontend-min-safe-width: 320px;
--frontend-page-max-width: 1280px;
--frontend-page-max-width: 430px;
--frontend-content-max-width: 1120px;
--admin-content-max-width: 1440px;
}
@@ -18,14 +35,23 @@
box-sizing: border-box;
}
img,
video,
canvas,
svg {
max-width: 100%;
}
html,
body {
min-width: var(--frontend-min-safe-width);
overflow-x: auto;
overflow-x: hidden;
}
body {
background-color: var(--secondary-bg-color);
background:
radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--theme-primary) 24%, transparent), transparent 34%),
linear-gradient(180deg, var(--theme-tertiary), color-mix(in srgb, var(--theme-secondary) 12%, var(--theme-tertiary)));
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
color: var(--text-primary);
}
@@ -33,16 +59,255 @@ body {
.mobile-container {
width: 100%;
min-width: var(--frontend-min-safe-width);
max-width: 100%;
max-width: none;
margin: 0 auto;
min-height: 100vh;
background-color: var(--bg-color);
background:
radial-gradient(circle at 82% 2%, color-mix(in srgb, var(--theme-primary) 30%, transparent), transparent 28%),
linear-gradient(180deg, color-mix(in srgb, var(--theme-card-bg) 74%, transparent), color-mix(in srgb, var(--theme-page-bg) 98%, var(--theme-card-bg))),
var(--theme-background-image),
var(--bg-color);
background-size: auto, cover, cover, auto;
background-position: center top;
position: relative;
overflow-x: hidden;
}
@media (min-width: 992px) {
.yumi-page {
min-height: 100vh;
padding: 18px 18px calc(88px + env(safe-area-inset-bottom, 0px));
color: var(--text-primary);
background:
linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(253, 251, 249, 0.96)),
var(--theme-background-image),
var(--theme-page-bg);
background-size: cover, cover, auto;
background-position: center top;
}
.yumi-page--no-nav {
padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}
.yumi-section {
margin-top: 22px;
}
.yumi-section-head {
display: flex;
align-items: flex-end;
justify-content: space-between;
gap: 16px;
margin-bottom: 14px;
}
.yumi-kicker {
display: block;
color: var(--theme-primary-action);
font-size: 11px;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.yumi-title {
display: block;
color: var(--text-primary);
font-size: 24px;
font-weight: 760;
line-height: 1.18;
}
.yumi-subtitle {
display: block;
margin-top: 6px;
color: var(--text-secondary);
font-size: 13px;
line-height: 1.65;
}
.yumi-glass-card {
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.9);
border-radius: 24px;
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
box-shadow: 0 20px 44px rgba(74, 68, 63, 0.1);
backdrop-filter: blur(16px);
}
.yumi-icon-button {
display: inline-flex;
align-items: center;
justify-content: center;
width: 34px;
height: 34px;
border: 0;
border-radius: 999px;
color: var(--theme-neutral);
background: color-mix(in srgb, var(--theme-card-bg) 78%, transparent);
box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
cursor: pointer;
backdrop-filter: blur(14px);
}
.yumi-icon-button:active {
transform: scale(0.96);
}
.yumi-page-titlebar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 18px 8px;
}
.yumi-page-titlebar__title {
min-width: 0;
flex: 1;
text-align: center;
color: var(--text-primary);
font-size: 16px;
font-weight: 780;
}
.yumi-status-chip {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 26px;
padding: 0 12px;
border: 1px solid var(--theme-border);
border-radius: 999px;
color: var(--theme-primary-action);
background: var(--theme-primary-soft);
font-size: 12px;
font-weight: 700;
white-space: nowrap;
}
.yumi-bottom-action {
position: sticky;
bottom: 0;
z-index: 20;
display: flex;
gap: 12px;
margin: 24px -18px -18px;
padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
border-top: 1px solid var(--theme-border);
background: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
backdrop-filter: blur(18px);
}
.app-container--phone-shell :where(.ant-card) {
border-color: var(--theme-border);
border-radius: 24px;
background: rgba(255, 255, 255, 0.86);
box-shadow: 0 18px 42px rgba(74, 68, 63, 0.09);
backdrop-filter: blur(14px);
}
.app-container--phone-shell :where(.ant-btn-primary) {
border-color: transparent;
background: var(--theme-gradient);
box-shadow: var(--theme-button-shadow);
}
.app-container--phone-shell :where(.ant-btn-primary:hover, .ant-btn-primary:focus) {
border-color: transparent;
background: linear-gradient(135deg, var(--theme-primary-action), var(--theme-secondary));
}
.app-container--phone-shell :where(.ant-input, .ant-input-affix-wrapper, .ant-select-selector, .ant-picker) {
border-color: var(--theme-border);
border-radius: 14px;
background: color-mix(in srgb, var(--theme-card-bg) 86%, transparent);
}
.app-container--phone-shell :where(.ant-input:hover, .ant-input:focus, .ant-input-affix-wrapper:hover, .ant-input-affix-wrapper-focused, .ant-picker:hover, .ant-picker-focused) {
border-color: var(--theme-primary);
box-shadow: var(--theme-focus-shadow);
}
.app-container--phone-shell :where(.ant-tag) {
border-radius: 999px;
}
.app-container--phone-shell .header {
background: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
border-bottom-color: var(--theme-border);
backdrop-filter: blur(18px);
}
.yumi-phone-frame {
width: 100%;
min-width: var(--frontend-min-safe-width);
min-height: 100vh;
margin: 0 auto;
background: var(--theme-page-bg);
position: relative;
}
.yumi-phone-frame--hidden-nav {
min-height: 100vh;
}
@media (min-width: 768px) {
body {
background:
radial-gradient(circle at 18% 8%, rgba(254, 212, 136, 0.28), transparent 30%),
radial-gradient(circle at 82% 12%, rgba(232, 180, 184, 0.24), transparent 34%),
var(--secondary-bg-color);
}
.app-container--phone-shell {
align-items: center;
padding: 0;
}
.mobile-container {
max-width: var(--frontend-page-max-width);
}
.yumi-phone-frame {
width: min(100%, var(--frontend-page-max-width));
min-height: 100vh;
margin: 0 auto;
overflow: clip;
border: 1px solid rgba(212, 194, 195, 0.72);
border-radius: 32px;
box-shadow: 0 28px 80px rgba(74, 68, 63, 0.14);
}
.yumi-phone-frame > .bottom-nav,
.yumi-phone-frame > .page-content .header,
.yumi-phone-frame > .page-content .header-bg,
.yumi-phone-frame > .page-content .gallery-header,
.yumi-phone-frame > .page-content .order-header {
left: 50%;
right: auto;
width: var(--frontend-page-max-width);
max-width: calc(100vw - 48px);
transform: translateX(-50%) translateZ(0);
}
.yumi-phone-frame > .page-content .header,
.yumi-phone-frame > .page-content .header-bg,
.yumi-phone-frame > .page-content .gallery-header,
.yumi-phone-frame > .page-content .order-header {
top: 0;
}
.yumi-phone-frame > .page-content .header,
.yumi-phone-frame > .page-content .gallery-header,
.yumi-phone-frame > .page-content .order-header {
border-top-left-radius: 32px;
border-top-right-radius: 32px;
}
.yumi-phone-frame > .bottom-nav {
bottom: 0;
border-bottom-right-radius: 32px;
border-bottom-left-radius: 32px;
}
}
+34 -31
View File
@@ -1,20 +1,20 @@
:root {
--admin-mobile-ink: #5d4338;
--admin-mobile-surface: #f6eee5;
--admin-mobile-surface-alt: #f1e3d6;
--admin-mobile-card: #fff9f2;
--admin-mobile-border: rgba(122, 88, 72, 0.14);
--admin-mobile-muted: #897165;
--admin-mobile-accent: #cc7b5f;
--admin-mobile-accent-strong: #b96449;
--admin-mobile-accent-soft: rgba(204, 123, 95, 0.14);
--admin-mobile-shell-start: #c08a72;
--admin-mobile-shell-mid: #a8715d;
--admin-mobile-shell-end: #8a5c4c;
--admin-mobile-shell-glass: rgba(153, 105, 84, 0.9);
--admin-mobile-shell-soft: rgba(255, 248, 240, 0.16);
--admin-mobile-ink: var(--text-primary);
--admin-mobile-surface: var(--theme-page-bg);
--admin-mobile-surface-alt: var(--theme-primary-soft);
--admin-mobile-card: var(--theme-card-bg);
--admin-mobile-border: var(--theme-border);
--admin-mobile-muted: var(--text-secondary);
--admin-mobile-accent: var(--theme-primary);
--admin-mobile-accent-strong: var(--theme-accent);
--admin-mobile-accent-soft: var(--theme-primary-soft);
--admin-mobile-shell-start: var(--theme-primary);
--admin-mobile-shell-mid: var(--theme-accent);
--admin-mobile-shell-end: color-mix(in srgb, var(--theme-accent) 78%, var(--text-primary));
--admin-mobile-shell-glass: color-mix(in srgb, var(--theme-primary) 88%, transparent);
--admin-mobile-shell-soft: color-mix(in srgb, var(--theme-card-bg) 18%, transparent);
--admin-mobile-radius: 24px;
--admin-mobile-shadow: 0 16px 40px rgba(144, 103, 84, 0.14);
--admin-mobile-shadow: var(--theme-button-shadow);
}
.admin-page-intro {
@@ -22,10 +22,10 @@
gap: 10px;
margin-bottom: 18px;
padding: 20px 18px;
color: #fff8f1;
color: var(--theme-card-bg);
background:
radial-gradient(circle at top right, rgba(255, 244, 232, 0.2), transparent 38%),
radial-gradient(circle at left top, rgba(233, 193, 167, 0.22), transparent 42%),
radial-gradient(circle at top right, color-mix(in srgb, var(--theme-card-bg) 20%, transparent), transparent 38%),
radial-gradient(circle at left top, color-mix(in srgb, var(--theme-secondary) 22%, transparent), transparent 42%),
linear-gradient(
155deg,
var(--admin-mobile-shell-start) 0%,
@@ -76,8 +76,8 @@
min-height: 34px;
padding: 0 12px;
border-radius: 999px;
background: rgba(255, 248, 241, 0.16);
color: #fff8f1;
background: color-mix(in srgb, var(--theme-card-bg) 16%, transparent);
color: var(--theme-card-bg);
font-size: 13px;
}
@@ -117,7 +117,7 @@
border-radius: 18px;
object-fit: cover;
flex-shrink: 0;
background: #eedfce;
background: var(--theme-primary-soft);
}
.admin-mobile-card__cover--wide {
@@ -157,7 +157,7 @@
.admin-mobile-card__description {
margin-top: 10px;
color: #6d574d;
color: var(--text-secondary);
line-height: 1.6;
}
@@ -181,9 +181,12 @@
.admin-mobile-card__row strong,
.admin-mobile-card__row b {
min-width: 0;
color: var(--admin-mobile-ink);
font-weight: 600;
text-align: right;
word-break: normal;
overflow-wrap: break-word;
}
.admin-mobile-card__actions {
@@ -201,7 +204,7 @@
padding: 0 12px;
border-radius: 999px;
background: var(--admin-mobile-accent-soft);
color: #a4553d;
color: var(--theme-accent);
font-size: 12px;
font-weight: 600;
white-space: nowrap;
@@ -258,8 +261,8 @@
.admin-mobile-modal .ant-modal {
top: 0 !important;
max-width: 100vw !important;
width: 100vw !important;
max-width: 100dvw !important;
width: 100dvw !important;
margin: 0;
padding-bottom: 0;
}
@@ -275,7 +278,7 @@
top: 0;
z-index: 2;
padding: 18px 18px 14px;
background: #fffaf4;
background: var(--theme-card-bg);
border-bottom: 1px solid var(--admin-mobile-border);
}
@@ -303,7 +306,7 @@
justify-content: flex-end;
gap: 10px;
padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
background: rgba(255, 249, 242, 0.94);
background: color-mix(in srgb, var(--theme-card-bg) 94%, transparent);
border-top: 1px solid var(--admin-mobile-border);
backdrop-filter: blur(14px);
}
@@ -311,7 +314,7 @@
.admin-mobile-fab {
position: fixed;
right: 18px;
bottom: calc(96px + env(safe-area-inset-bottom));
bottom: var(--admin-mobile-fab-bottom, calc(96px + env(safe-area-inset-bottom)));
z-index: 120;
width: 56px;
height: 56px;
@@ -320,9 +323,9 @@
justify-content: center;
border: 0;
border-radius: 999px;
background: linear-gradient(135deg, var(--admin-mobile-accent) 0%, var(--admin-mobile-accent-strong) 100%);
color: #fffaf4;
box-shadow: 0 18px 32px rgba(185, 100, 73, 0.34);
background: var(--theme-gradient);
color: #ffffff;
box-shadow: var(--theme-button-shadow);
}
.admin-mobile-fab .anticon {
@@ -12,6 +12,8 @@ import {
getStoredUserPermissions,
} from '@/utils/permission'
const ADMIN_DASHBOARD_PATH = '/admin/dashboard'
/**
* Purpose: AuthBootstrapState supports admin-auth-bootstrap.ts by holding or executing the auth bootstrap state 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.
@@ -111,7 +113,7 @@ export const resolveAdminLandingPath = () => {
return '/admin'
}
if (snapshot.isBootstrapAdmin) {
return '/admin'
return ADMIN_DASHBOARD_PATH
}
const matchedRoute = ADMIN_PERMISSION_ROUTE_MAP.find(item => snapshot.permissions.includes(item.code))
@@ -9,6 +9,7 @@ const SHOPLESS_ADMIN_ALLOWED_PREFIXES = ['user:', 'shop:', 'permission:', 'messa
*/
const SHOPLESS_ADMIN_ALLOWED_PERMISSIONS = [
'messagehub:config:manage',
'security:audit:view',
'legal_agreement:manage'
]
@@ -0,0 +1,24 @@
import { describe, expect, it } from 'vitest'
import { extractRichText, renderRichContent } from './rich-content'
describe('rich content helpers', () => {
it('renders markdown into html', () => {
const html = renderRichContent('# 标题\n\n- 甲\n- 乙\n\n**加粗** [链接](https://example.com)')
expect(html).toContain('<h1>标题</h1>')
expect(html).toContain('<ul>')
expect(html).toContain('<strong>加粗</strong>')
expect(html).toContain('<a href="https://example.com"')
})
it('keeps safe html and strips scripts', () => {
const html = renderRichContent('<p>hello <strong>world</strong></p><script>alert(1)</script>')
expect(html).toBe('<p>hello <strong>world</strong></p>')
})
it('extracts plain text from rich content', () => {
expect(extractRichText('<p>Hello <strong>world</strong></p>')).toBe('Hello world')
expect(extractRichText('## 标题\n\n内容')).toBe('标题 内容')
})
})
+272
View File
@@ -0,0 +1,272 @@
const HTML_TAG_PATTERN = /<\/?[a-z][\s\S]*>/i
const DANGEROUS_TAGS = new Set(['script', 'style', 'iframe', 'object', 'embed', 'form', 'input', 'button', 'textarea', 'select', 'svg', 'math'])
const ALLOWED_TAGS = new Set([
'a',
'blockquote',
'br',
'code',
'del',
'div',
'em',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'hr',
'img',
'li',
'ol',
'p',
'pre',
'span',
'strong',
'table',
'tbody',
'td',
'th',
'thead',
'tr',
'ul'
])
const GLOBAL_ATTRS = new Set(['class', 'title'])
const TAG_ATTRS: Record<string, Set<string>> = {
a: new Set(['href', 'target', 'rel', 'title']),
img: new Set(['src', 'alt', 'title']),
td: new Set(['colspan', 'rowspan']),
th: new Set(['colspan', 'rowspan'])
}
const escapeHtml = (value: string) => value
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
const escapeAttr = (value: string) => escapeHtml(value).replace(/`/g, '&#96;')
const isSafeUrl = (value: string) => {
const normalized = value.trim().replace(/[\u0000-\u001F\u007F\s]+/g, '')
if (!normalized) return false
if (normalized.startsWith('#')) return true
if (normalized.startsWith('/') && !normalized.startsWith('//')) return true
if (/^(https?:|mailto:|tel:)/i.test(normalized)) return true
return /^data:image\/(?:png|jpe?g|gif|webp);base64,/i.test(normalized)
}
const isAllowedAttr = (tagName: string, attrName: string) => {
if (attrName.startsWith('on')) return false
return GLOBAL_ATTRS.has(attrName) || TAG_ATTRS[tagName]?.has(attrName)
}
const sanitizeFallback = (html: string) => html
.replace(/<\s*(script|style|iframe|object|embed|svg|math)[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, '')
.replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, '')
.replace(/\s+(href|src)\s*=\s*(["'])\s*javascript:[\s\S]*?\2/gi, '')
export const sanitizeRichHtml = (html: string) => {
const source = html.trim()
if (!source) return ''
if (typeof DOMParser === 'undefined') {
return sanitizeFallback(source)
}
const parser = new DOMParser()
const doc = parser.parseFromString(source, 'text/html')
const walk = (node: Node) => {
if (node.nodeType === Node.COMMENT_NODE) {
node.parentNode?.removeChild(node)
return
}
if (node.nodeType !== Node.ELEMENT_NODE) {
return
}
const element = node as HTMLElement
const tagName = element.tagName.toLowerCase()
if (DANGEROUS_TAGS.has(tagName)) {
element.remove()
return
}
if (!ALLOWED_TAGS.has(tagName)) {
const children = Array.from(element.childNodes)
element.replaceWith(...children)
children.forEach(walk)
return
}
Array.from(element.attributes).forEach(attribute => {
const attrName = attribute.name.toLowerCase()
const attrValue = attribute.value
if (!isAllowedAttr(tagName, attrName)) {
element.removeAttribute(attribute.name)
return
}
if ((attrName === 'href' || attrName === 'src') && !isSafeUrl(attrValue)) {
element.removeAttribute(attribute.name)
}
})
if (tagName === 'a' && element.getAttribute('href')) {
element.setAttribute('target', '_blank')
element.setAttribute('rel', 'noopener noreferrer')
}
Array.from(element.childNodes).forEach(walk)
}
Array.from(doc.body.childNodes).forEach(walk)
return doc.body.innerHTML.trim()
}
const renderInlineMarkdown = (value: string) => {
let html = escapeHtml(value)
html = html.replace(/`([^`]+)`/g, '<code>$1</code>')
html = html.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
html = html.replace(/__([^_]+)__/g, '<strong>$1</strong>')
html = html.replace(/\*([^*]+)\*/g, '<em>$1</em>')
html = html.replace(/_([^_]+)_/g, '<em>$1</em>')
html = html.replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g, (_match, label: string, url: string) => {
const href = url.replace(/&amp;/g, '&')
if (!isSafeUrl(href)) {
return label
}
return `<a href="${escapeAttr(href)}" target="_blank" rel="noopener noreferrer">${label}</a>`
})
return html.replace(/\n/g, '<br>')
}
const markdownToHtml = (markdown: string) => {
const lines = markdown.replace(/\r\n?/g, '\n').split('\n')
const html: string[] = []
const paragraphs: string[] = []
const listItems: string[] = []
let listTag: 'ul' | 'ol' | '' = ''
let inCodeFence = false
let codeLines: string[] = []
const flushParagraph = () => {
if (!paragraphs.length) return
html.push(`<p>${renderInlineMarkdown(paragraphs.join('\n'))}</p>`)
paragraphs.length = 0
}
const flushList = () => {
if (!listTag || !listItems.length) return
html.push(`<${listTag}>${listItems.map(item => `<li>${renderInlineMarkdown(item)}</li>`).join('')}</${listTag}>`)
listItems.length = 0
listTag = ''
}
const flushCodeFence = () => {
html.push(`<pre><code>${escapeHtml(codeLines.join('\n'))}</code></pre>`)
codeLines = []
}
lines.forEach(line => {
if (/^```/.test(line.trim())) {
if (inCodeFence) {
inCodeFence = false
flushCodeFence()
} else {
flushParagraph()
flushList()
inCodeFence = true
codeLines = []
}
return
}
if (inCodeFence) {
codeLines.push(line)
return
}
if (!line.trim()) {
flushParagraph()
flushList()
return
}
const heading = /^(#{1,6})\s+(.+)$/.exec(line)
if (heading) {
flushParagraph()
flushList()
const level = heading[1]!.length
html.push(`<h${level}>${renderInlineMarkdown(heading[2]!.trim())}</h${level}>`)
return
}
const blockquote = /^>\s?(.*)$/.exec(line)
if (blockquote) {
flushParagraph()
flushList()
html.push(`<blockquote>${renderInlineMarkdown(blockquote[1] || '')}</blockquote>`)
return
}
const unordered = /^\s*[-*+]\s+(.+)$/.exec(line)
if (unordered) {
flushParagraph()
if (listTag && listTag !== 'ul') flushList()
listTag = 'ul'
listItems.push(unordered[1] || '')
return
}
const ordered = /^\s*\d+\.\s+(.+)$/.exec(line)
if (ordered) {
flushParagraph()
if (listTag && listTag !== 'ol') flushList()
listTag = 'ol'
listItems.push(ordered[1] || '')
return
}
flushList()
paragraphs.push(line)
})
if (inCodeFence) {
flushCodeFence()
}
flushParagraph()
flushList()
return html.join('')
}
export const renderRichContent = (content?: string | null) => {
const source = String(content || '').trim()
if (!source) return ''
const html = HTML_TAG_PATTERN.test(source) ? source : markdownToHtml(source)
return sanitizeRichHtml(html)
}
export const extractRichText = (content?: string | null) => {
const html = renderRichContent(content)
if (!html) return ''
const spacedHtml = html
.replace(/<br\s*\/?>/gi, ' ')
.replace(/<\/(p|div|h[1-6]|li|blockquote|tr)>/gi, ' </$1>')
if (typeof DOMParser === 'undefined') {
return spacedHtml.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim()
}
const parser = new DOMParser()
const doc = parser.parseFromString(spacedHtml, 'text/html')
return (doc.body.textContent || '').replace(/\s+/g, ' ').trim()
}
+28 -12
View File
@@ -25,12 +25,16 @@ export interface ResolvedShopTheme {
primaryColor: string
secondaryColor: string
accentColor: string
tertiaryColor: string
neutralColor: string
pageBgColor: string
cardBgColor: string
textPrimary: string
textSecondary: string
borderColor: string
primarySoftColor: string
secondarySoftColor: string
primaryActionColor: string
gradient: string
softGradient: string
backgroundImageFileId?: string
@@ -85,21 +89,25 @@ export function notifyShopThemeChanged() {
*/
function resolveShopThemeSource(source?: ShopThemeSource | null): ResolvedShopTheme {
const normalizedPrimaryColor = normalizeHexColor(source?.themePrimaryColor)
const primaryColor = normalizedPrimaryColor || '#C6597D'
const primaryColor = normalizedPrimaryColor || '#E8B4B8'
const secondaryColor = normalizeHexColor(source?.themeSecondaryColor)
|| (normalizedPrimaryColor ? mixColor(primaryColor, '#FFFFFF', 0.68) : '#E9B7C7')
const accentColor = normalizeHexColor(source?.themeAccentColor)
|| (normalizedPrimaryColor ? mixColor(primaryColor, '#7A3F56', 0.38) : '#9F4967')
const pageBgColor = normalizeHexColor(source?.themePageBgColor) || '#FFF7F9'
|| (normalizedPrimaryColor ? mixColor(primaryColor, '#C5A059', 0.35) : '#C5A059')
const neutralColor = normalizeHexColor(source?.themeAccentColor)
|| (normalizedPrimaryColor ? mixColor('#4A443F', primaryColor, 0.14) : '#4A443F')
const accentColor = neutralColor
const tertiaryColor = normalizeHexColor(source?.themePageBgColor) || '#FDFBF9'
const pageBgColor = tertiaryColor
const cardBgColor = normalizeHexColor(source?.themeCardBgColor) || '#FFFFFF'
const textPrimary = readableTextColor(pageBgColor, '#2D2430')
const textSecondary = textPrimary === '#2D2430'
? mixColor('#7A6871', primaryColor, 0.12)
const textPrimary = readableTextColor(pageBgColor, neutralColor)
const textSecondary = textPrimary === neutralColor
? mixColor(neutralColor, cardBgColor, 0.18)
: mixColor('#FFFFFF', primaryColor, 0.3)
const borderColor = mixColor(primaryColor, cardBgColor, 0.82)
const primarySoftColor = mixColor(primaryColor, cardBgColor, 0.88)
const gradient = `linear-gradient(135deg, ${primaryColor} 0%, ${secondaryColor} 100%)`
const softGradient = `linear-gradient(145deg, ${cardBgColor} 0%, ${mixColor(secondaryColor, pageBgColor, 0.55)} 58%, ${mixColor(primaryColor, pageBgColor, 0.82)} 100%)`
const borderColor = mixColor(primaryColor, cardBgColor, 0.72)
const primarySoftColor = mixColor(primaryColor, cardBgColor, 0.78)
const secondarySoftColor = mixColor(secondaryColor, pageBgColor, 0.66)
const primaryActionColor = mixColor(neutralColor, primaryColor, 0.28)
const gradient = `linear-gradient(135deg, ${primaryActionColor} 0%, ${secondaryColor} 100%)`
const softGradient = `linear-gradient(145deg, ${cardBgColor} 0%, ${secondarySoftColor} 58%, ${mixColor(primaryColor, pageBgColor, 0.62)} 100%)`
const backgroundImageFileId = source?.themeBackgroundImageFileId === undefined || source?.themeBackgroundImageFileId === null
? undefined
: String(source.themeBackgroundImageFileId).trim() || undefined
@@ -108,12 +116,16 @@ function resolveShopThemeSource(source?: ShopThemeSource | null): ResolvedShopTh
primaryColor,
secondaryColor,
accentColor,
tertiaryColor,
neutralColor,
pageBgColor,
cardBgColor,
textPrimary,
textSecondary,
borderColor,
primarySoftColor,
secondarySoftColor,
primaryActionColor,
gradient,
softGradient,
backgroundImageFileId,
@@ -122,7 +134,11 @@ function resolveShopThemeSource(source?: ShopThemeSource | null): ResolvedShopTh
'--theme-primary': primaryColor,
'--theme-secondary': secondaryColor,
'--theme-accent': accentColor,
'--theme-neutral': neutralColor,
'--theme-tertiary': tertiaryColor,
'--theme-primary-action': primaryActionColor,
'--theme-primary-soft': primarySoftColor,
'--theme-secondary-soft': secondarySoftColor,
'--theme-page-bg': pageBgColor,
'--theme-card-bg': cardBgColor,
'--theme-border': borderColor,
@@ -0,0 +1,86 @@
import { fileApi } from '@/api/file'
import type { IdType } from '@/utils/id'
const SIGNED_IMAGE_CACHE_TTL_MS = 10 * 60 * 1000
type SignedImageCacheEntry = {
url: string
expiresAt: number
}
const signedImageUrlCache = new Map<string, SignedImageCacheEntry>()
const pendingSignedImageUrlRequests = new Map<string, Promise<string>>()
const normalizeFileId = (fileId: IdType | null | undefined) => String(fileId ?? '').trim()
const getUsableCacheEntry = (key: string) => {
const cached = signedImageUrlCache.get(key)
if (!cached) return undefined
if (cached.expiresAt <= Date.now()) {
signedImageUrlCache.delete(key)
return undefined
}
return cached.url
}
export const parseImageFileIds = (value?: string | null): string[] =>
String(value || '')
.split(',')
.map(id => id.trim())
.filter(Boolean)
export const getCachedSignedImageUrlSync = (fileId: IdType | null | undefined): string => {
const key = normalizeFileId(fileId)
return key ? getUsableCacheEntry(key) || '' : ''
}
export const getCachedSignedImageUrl = async (
fileId: IdType | null | undefined,
fallback = ''
): Promise<string> => {
const key = normalizeFileId(fileId)
if (!key) return fallback
const cachedUrl = getUsableCacheEntry(key)
if (cachedUrl) return cachedUrl
const pendingRequest = pendingSignedImageUrlRequests.get(key)
if (pendingRequest) {
return pendingRequest.then(url => url || fallback).catch(() => fallback)
}
const request = fileApi.getSignedUrl(key)
.then(response => {
const url = String(response || '').trim()
if (url) {
signedImageUrlCache.set(key, {
url,
expiresAt: Date.now() + SIGNED_IMAGE_CACHE_TTL_MS
})
}
return url
})
.finally(() => {
pendingSignedImageUrlRequests.delete(key)
})
pendingSignedImageUrlRequests.set(key, request)
return request.then(url => url || fallback).catch(() => fallback)
}
export const getCachedSignedImageUrls = async (
fileIds: Array<IdType | null | undefined>,
fallback = ''
): Promise<string[]> => {
const urls = await Promise.all(fileIds.map(fileId => getCachedSignedImageUrl(fileId)))
const validUrls = urls.filter(Boolean)
return validUrls.length ? validUrls : (fallback ? [fallback] : [])
}
export const getCachedSignedImageUrlsSync = (fileIds: Array<IdType | null | undefined>): string[] =>
fileIds.map(fileId => getCachedSignedImageUrlSync(fileId)).filter(Boolean)
export const extractLegacyFileId = (value?: string | null): string => {
const source = String(value || '').replace(/<[^>]*>/g, '')
return source.match(/\/api\/file\/get\/([^/?#"'<>]+)/)?.[1] || ''
}
@@ -27,12 +27,27 @@ describe('buildSystemMessageActionPath', () => {
expect(buildSystemMessageActionPath({
businessType: 'ORDER',
businessId: 10
})).toBe('/orders?orderId=10&source=message')
})).toBe('/orders/10')
})
it('uses after-sale fallback for after-sale messages', () => {
expect(buildSystemMessageActionPath({
businessType: 'AFTER_SALE',
businessId: 10
})).toBe('/after-sales?orderId=10&source=message')
})
it('keeps safe order detail and after-sale action paths', () => {
expect(buildSystemMessageActionPath({ actionPath: '/orders/10' })).toBe('/orders/10')
expect(buildSystemMessageActionPath({ actionPath: '/after-sales?orderId=10' })).toBe('/after-sales?orderId=10')
expect(buildSystemMessageActionPath({ actionPath: '/after-sale/apply?orderId=10&orderItemId=99' })).toBe('/after-sale/apply?orderId=10&orderItemId=99')
expect(buildSystemMessageActionPath({ actionPath: '/service-progress?orderId=10' })).toBe('/service-progress?orderId=10')
})
it('rejects unsafe or backend-only action paths', () => {
expect(buildSystemMessageActionPath({ actionPath: '//evil.example/orders' })).toBe('')
expect(buildSystemMessageActionPath({ actionPath: 'https://evil.example/orders' })).toBe('')
expect(buildSystemMessageActionPath({ actionPath: '/admin/users' })).toBe('')
expect(buildSystemMessageActionPath({ actionPath: '/orders-admin' })).toBe('')
})
})
@@ -4,6 +4,10 @@ type MessageLike = Pick<SystemMessageVO, 'actionPath' | 'businessType' | 'busine
const USER_ACTION_PREFIXES = [
'/orders',
'/after-sales',
'/after-sale/apply',
'/service-progress',
'/help',
'/product/',
'/shop/',
'/coupons',
@@ -12,7 +16,9 @@ const USER_ACTION_PREFIXES = [
'/notifications',
'/wishlist',
'/profile',
'/settings'
'/settings',
'/artist-orders',
'/artist-calendar'
]
const appendQuery = (path: string, query: Record<string, string | number | undefined>) => {
@@ -26,14 +32,22 @@ const appendQuery = (path: string, query: Record<string, string | number | undef
return queryString ? `${path}?${queryString}` : path
}
const isAllowedUserActionPath = (actionPath: string) => {
const pathOnly = actionPath.split('?')[0] || ''
return USER_ACTION_PREFIXES.some(prefix => {
if (prefix.endsWith('/')) {
return pathOnly.startsWith(prefix)
}
return pathOnly === prefix || pathOnly.startsWith(`${prefix}/`)
})
}
export const normalizeSystemMessageActionPath = (value?: string) => {
const actionPath = String(value || '').trim()
if (!actionPath || !actionPath.startsWith('/') || actionPath.startsWith('//') || actionPath.includes('\\')) {
return ''
}
return USER_ACTION_PREFIXES.some(prefix => actionPath === prefix || actionPath.startsWith(prefix))
? actionPath
: ''
return isAllowedUserActionPath(actionPath) ? actionPath : ''
}
export const buildSystemMessageActionPath = (message: MessageLike) => {
@@ -49,9 +63,18 @@ export const buildSystemMessageActionPath = (message: MessageLike) => {
? appendQuery('/orders', { reviewId: businessId, source: 'message' })
: appendQuery('/orders', { review: 'pending', source: 'message' })
}
if (businessType === 'ORDER' && businessId) {
return `/orders/${encodeURIComponent(businessId)}`
}
if (businessType === 'ORDER_ARTIST_CHANGE' && businessId) {
return appendQuery('/service-progress', { orderId: businessId, source: 'message' })
}
if (businessType === 'ORDER_ARTIST_CHANGE' || businessType === 'ORDER') {
return appendQuery('/orders', { orderId: businessId || undefined, source: 'message' })
}
if (businessType === 'AFTER_SALE') {
return appendQuery('/after-sales', { orderId: businessId || undefined, source: 'message' })
}
if (businessType === 'PRODUCT' && businessId) {
return `/product/${encodeURIComponent(businessId)}`
}
@@ -740,7 +740,7 @@ onMounted(() => {
<style scoped>
.mobile-container {
min-height: 100vh;
background: #f5f5f5;
background: var(--theme-page-bg);
}
.header {
@@ -748,8 +748,8 @@ onMounted(() => {
justify-content: space-between;
align-items: center;
padding: 10px 15px;
background: white;
border-bottom: 1px solid #f0f0f0;
background: var(--theme-card-bg);
border-bottom: 1px solid var(--theme-border);
}
.header h1 {
@@ -778,7 +778,7 @@ onMounted(() => {
.settings-card {
border-radius: 16px;
overflow: hidden;
background: white;
background: var(--theme-card-bg);
}
.settings-card :deep(.ant-card-body) {
@@ -789,11 +789,11 @@ onMounted(() => {
padding: 16px;
cursor: pointer;
transition: background 0.3s;
border-bottom: 1px solid #f0f0f0;
border-bottom: 1px solid var(--theme-border);
}
.setting-item:hover {
background: #fafafa;
background: var(--theme-primary-soft);
}
.setting-item:last-child {
@@ -802,7 +802,7 @@ onMounted(() => {
.setting-item :deep(.ant-list-item-action) {
margin-left: 8px;
color: #ccc;
color: var(--text-secondary);
}
.setting-icon {
@@ -819,17 +819,17 @@ onMounted(() => {
.setting-item :deep(.ant-list-item-meta-title) {
font-size: 15px;
font-weight: 500;
color: #333;
color: var(--text-primary);
}
.setting-item :deep(.ant-list-item-meta-description) {
font-size: 12px;
color: #999;
color: var(--text-secondary);
}
.password-tip {
font-size: 12px;
color: #999;
color: var(--text-secondary);
margin-top: 8px;
}
</style>
@@ -0,0 +1,141 @@
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { afterSaleApi, orderApi } from '../api/order'
import type { IdType } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
const route = useRoute()
const router = useRouter()
const loading = ref(false)
const submitting = ref(false)
const order = ref<any | null>(null)
const orderId = computed(() => String(route.query.orderId || ''))
const items = computed(() => Array.isArray(order.value?.items) ? order.value.items : [])
const form = reactive({
orderItemId: undefined as IdType | undefined,
type: 'REFUND',
reason: '',
refundAmount: undefined as number | undefined
})
const formatMoney = (value?: number | string) => {
const amount = Number(value)
return Number.isFinite(amount) ? `¥${amount.toFixed(2)}` : '¥0.00'
}
const loadOrder = async () => {
if (!orderId.value) return
loading.value = true
try {
order.value = await orderApi.getOrderDetail(orderId.value)
const preferredItemId = String(route.query.orderItemId || '')
const firstItem = items.value.find((item: any) => String(item.id) === preferredItemId) || items.value[0]
form.orderItemId = firstItem?.id
form.refundAmount = Number(order.value?.actualAmount || order.value?.totalAmount || 0)
} catch (error: any) {
message.error(error?.message || '订单信息加载失败')
} finally {
loading.value = false
}
}
const submit = async () => {
if (!orderId.value) {
message.warning('缺少订单信息')
return
}
if (!form.reason.trim()) {
message.warning('请填写售后原因')
return
}
submitting.value = true
try {
await runWithGlobalLoading(() => afterSaleApi.apply({
orderId: orderId.value,
orderItemId: form.orderItemId,
type: form.type,
reason: form.reason.trim(),
refundAmount: form.refundAmount
}))
message.success('售后申请已提交')
router.replace({ path: '/after-sales', query: { orderId: orderId.value } })
} catch (error: any) {
message.error(error?.message || '售后申请提交失败')
} finally {
submitting.value = false
}
}
onMounted(loadOrder)
</script>
<template>
<div class="apply-page">
<header class="header">
<a-button type="text" @click="router.back()">
<LeftOutlined />
</a-button>
<h1>申请售后</h1>
<a-button type="link" @click="router.push('/after-sales')">记录</a-button>
</header>
<main class="content">
<section class="hero-card">
<span>售后申请</span>
<h2>{{ order?.orderNo || (orderId ? `订单 ${orderId}` : '选择订单') }}</h2>
<p>{{ order ? `可申请金额 ${formatMoney(order.actualAmount || order.totalAmount)}` : '从订单详情或订单中心进入可自动带入订单信息' }}</p>
</section>
<a-spin :spinning="loading">
<a-empty v-if="!orderId" description="缺少订单参数">
<a-button type="primary" @click="router.push('/orders')">选择订单</a-button>
</a-empty>
<section v-else class="form-card">
<a-form layout="vertical">
<a-form-item label="订单项目">
<a-select v-model:value="form.orderItemId" allow-clear placeholder="默认整单">
<a-select-option v-for="item in items" :key="item.id" :value="item.id">
{{ item.productTitle || `项目 ${item.id}` }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="售后类型" required>
<a-select v-model:value="form.type">
<a-select-option value="REFUND">退款</a-select-option>
<a-select-option value="AFTER_SALE">售后服务</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="退款金额">
<a-input-number v-model:value="form.refundAmount" :min="0" :step="0.01" style="width: 100%" />
</a-form-item>
<a-form-item label="原因说明" required>
<a-textarea v-model:value="form.reason" :rows="5" :maxlength="300" placeholder="请说明退款或售后原因" />
</a-form-item>
<a-button type="primary" block :loading="submitting" @click="submit">提交申请</a-button>
</a-form>
</section>
</a-spin>
</main>
</div>
</template>
<style scoped>
.apply-page { min-height: 100vh; padding-top: 60px; background: var(--theme-page-bg); color: var(--text-primary); }
.header { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 9px 14px; background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent); border-bottom: 1px solid var(--theme-border); backdrop-filter: blur(14px); }
.header h1 { margin: 0; font-size: 18px; }
.content { padding: 16px 14px 32px; }
.hero-card, .form-card { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; margin-bottom: 14px; background: var(--theme-gradient-soft); }
.hero-card span { color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.form-card { padding: 16px; }
:deep(.ant-btn-primary) { background: var(--theme-primary); border-color: var(--theme-primary); }
:deep(.ant-btn-link) { color: var(--theme-primary); }
:deep(.ant-input:focus), :deep(.ant-input-focused), :deep(.ant-select-focused .ant-select-selector) { border-color: var(--theme-primary) !important; box-shadow: var(--theme-focus-shadow) !important; }
</style>
@@ -0,0 +1,122 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { afterSaleApi, type AfterSaleVO } from '../api/order'
const route = useRoute()
const router = useRouter()
const loading = ref(false)
const records = ref<AfterSaleVO[]>([])
const focusOrderId = computed(() => String(route.query.orderId || ''))
const focusedRecords = computed(() => {
if (!focusOrderId.value) return records.value
return records.value.filter(item => String(item.orderId) === focusOrderId.value)
})
const statusText = (status?: string) => {
if (status === 'PENDING') return '审核中'
if (status === 'APPROVED') return '已通过'
if (status === 'REJECTED') return '已拒绝'
return status || '处理中'
}
const typeText = (type?: string) => type === 'REFUND' ? '退款' : (type || '售后')
const formatMoney = (value?: number) => value === undefined || value === null ? '--' : `¥${Number(value).toFixed(2)}`
const formatTime = (value?: string) => value ? String(value).replace('T', ' ').slice(0, 16) : '--'
const loadRecords = async () => {
loading.value = true
try {
const page = await afterSaleApi.listMy({ page: 1, size: 50 })
records.value = page?.list || []
} catch (error: any) {
records.value = []
message.error(error?.message || '售后记录加载失败')
} finally {
loading.value = false
}
}
onMounted(loadRecords)
</script>
<template>
<div class="after-sales-page">
<header class="header">
<a-button type="text" @click="router.back()">
<LeftOutlined />
</a-button>
<h1>售后记录</h1>
<a-button type="link" @click="loadRecords">刷新</a-button>
</header>
<main class="content">
<section class="hero-card">
<span>售后服务</span>
<h2>{{ focusedRecords.length }} 条记录</h2>
<p>{{ focusOrderId ? `订单 ${focusOrderId} 的售后进度` : '查看退款、售后审核与处理说明' }}</p>
</section>
<a-spin :spinning="loading">
<a-empty v-if="!focusedRecords.length" description="暂无售后记录">
<a-button type="primary" @click="router.push('/orders')">查看订单</a-button>
</a-empty>
<article v-for="item in focusedRecords" :key="item.id" class="record-card">
<div class="record-head">
<div>
<span class="record-label">{{ typeText(item.type) }}</span>
<h3>{{ item.afterSaleNo || `售后 ${item.id}` }}</h3>
</div>
<strong>{{ statusText(item.status) }}</strong>
</div>
<dl>
<div>
<dt>订单</dt>
<dd>{{ item.orderId }}</dd>
</div>
<div>
<dt>金额</dt>
<dd>{{ formatMoney(item.refundAmount) }}</dd>
</div>
<div>
<dt>提交时间</dt>
<dd>{{ formatTime(item.createTime) }}</dd>
</div>
</dl>
<p v-if="item.reason">原因:{{ item.reason }}</p>
<p v-if="item.auditReason">处理说明:{{ item.auditReason }}</p>
<div class="actions">
<a-button size="small" @click="router.push(`/orders/${item.orderId}`)">订单详情</a-button>
<a-button size="small" @click="router.push({ path: '/service-progress', query: { orderId: String(item.orderId) } })">服务进度</a-button>
</div>
</article>
</a-spin>
</main>
</div>
</template>
<style scoped>
.after-sales-page { min-height: 100vh; padding-top: 60px; background: var(--theme-page-bg); color: var(--text-primary); }
.header { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 9px 14px; background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent); border-bottom: 1px solid var(--theme-border); backdrop-filter: blur(14px); }
.header h1 { margin: 0; font-size: 18px; }
.content { padding: 16px 14px 32px; }
.hero-card, .record-card { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; margin-bottom: 14px; background: var(--theme-gradient-soft); }
.hero-card span, .record-label { color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card p, .record-card p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.record-card { padding: 16px; margin-top: 14px; }
.record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.record-head h3 { margin: 6px 0 0; font-size: 17px; }
.record-head strong { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; background: var(--theme-primary-soft); color: var(--theme-primary); font-size: 12px; }
dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
dt { color: var(--text-secondary); font-size: 12px; }
dd { margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
:deep(.ant-btn-primary) { background: var(--theme-primary); border-color: var(--theme-primary); }
:deep(.ant-btn-link) { color: var(--theme-primary); }
</style>
@@ -249,35 +249,35 @@ onMounted(loadAppointments)
</script>
<style scoped>
.artist-calendar-page { min-height: 100vh; background: #f7f4f0; color: #2b2724; }
.calendar-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: rgba(255,255,255,.94); border-bottom: 1px solid #eee2d6; backdrop-filter: blur(12px); }
.artist-calendar-page { min-height: 100vh; background: var(--theme-page-bg); color: var(--text-primary); }
.calendar-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: color-mix(in srgb, var(--theme-card-bg) 94%, transparent); border-bottom: 1px solid var(--theme-border); backdrop-filter: blur(12px); }
.back-btn { width: 40px; height: 40px; }
.header-copy { flex: 1; min-width: 0; }
.header-copy span { display: block; font-size: 12px; color: #8b7c72; }
.header-copy span { display: block; font-size: 12px; color: var(--text-secondary); }
.header-copy h1 { margin: 2px 0 0; font-size: 20px; }
.calendar-content { max-width: 1040px; margin: 0 auto; padding: 18px 16px 96px; }
.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border-radius: 8px; background: #e7dbd1; }
.summary-strip div { padding: 16px; background: #fff; }
.summary-strip span { display: block; color: #8b7c72; font-size: 12px; }
.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; overflow: hidden; border-radius: 8px; background: var(--theme-border); }
.summary-strip div { padding: 16px; background: var(--theme-card-bg); }
.summary-strip span { display: block; color: var(--text-secondary); font-size: 12px; }
.summary-strip strong { display: block; margin-top: 8px; font-size: 22px; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; margin: 16px 0; }
.timeline { display: grid; gap: 14px; }
.day-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; }
.day-label { display: grid; align-content: start; gap: 4px; padding-top: 4px; }
.day-label strong { font-size: 20px; }
.day-label span, .day-label em { color: #8b7c72; font-style: normal; font-size: 12px; }
.day-line { position: relative; display: grid; gap: 10px; padding-left: 18px; border-left: 2px solid #e6d7ca; }
.appointment-block { width: 100%; display: grid; gap: 5px; padding: 14px 16px; border: 1px solid #efd7bd; border-radius: 8px; background: #fffaf5; text-align: left; color: #2b2724; box-shadow: 0 10px 22px rgba(120, 82, 58, 0.08); cursor: pointer; transition: transform .18s ease, border-color .18s ease; }
.appointment-block:hover { transform: translateY(-2px); border-color: #d9955d; }
.day-label span, .day-label em { color: var(--text-secondary); font-style: normal; font-size: 12px; }
.day-line { position: relative; display: grid; gap: 10px; padding-left: 18px; border-left: 2px solid var(--theme-border); }
.appointment-block { width: 100%; display: grid; gap: 5px; padding: 14px 16px; border: 1px solid var(--theme-border); border-radius: 8px; background: var(--theme-card-bg); text-align: left; color: var(--text-primary); box-shadow: 0 10px 22px color-mix(in srgb, var(--theme-primary) 8%, transparent); cursor: pointer; transition: transform .18s ease, border-color .18s ease; }
.appointment-block:hover { transform: translateY(-2px); border-color: var(--theme-primary); }
.appointment-block.is-completed { background: #f5fff7; border-color: #c8ead1; }
.appointment-block .time { color: #b35c28; font-weight: 700; }
.appointment-block small { color: #7b7068; }
.appointment-block .time { color: var(--theme-primary); font-weight: 700; }
.appointment-block small { color: var(--text-secondary); }
.detail-body { display: grid; gap: 18px; }
.detail-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-title strong { font-size: 20px; }
dl { display: grid; gap: 10px; margin: 0; }
dt { color: #8b7c72; font-size: 12px; }
dd { margin: -6px 0 4px; color: #2b2724; font-weight: 600; }
dt { color: var(--text-secondary); font-size: 12px; }
dd { margin: -6px 0 4px; color: var(--text-primary); font-weight: 600; }
@media (max-width: 720px) {
.summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-strip div { min-width: 0; padding: 12px 10px; }
@@ -68,7 +68,7 @@
<div v-for="item in order.items" :key="item.id" class="item">
<div class="thumb">
<img v-if="item.productImage" :src="item.productImage" :alt="item.productTitle" />
<img v-if="item.productImage" :src="item.productImage" :alt="item.productTitle" loading="lazy" decoding="async" />
<span v-else>{{ item.productTitle[0] }}</span>
</div>
<div class="main">
@@ -138,11 +138,11 @@ import { useRoute, useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
import { userApi } from '@/api/user'
import { fileApi } from '../api/index'
import { orderApi } from '../api/order'
import type { OrderArtistChangeOptionsVO, OrderArtistChangeRequestVO } from '../api/order'
import type { IdType } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { extractLegacyFileId, getCachedSignedImageUrl, getCachedSignedImageUrlSync } from '@/utils/signed-image-cache'
/**
* Purpose: router supports ArtistOrderView.vue by holding or executing the router page or API role.
@@ -159,11 +159,6 @@ const route = useRoute()
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orders = ref<any[]>([])
/**
* Purpose: imageIdCache supports ArtistOrderView.vue by holding or executing the image id cache 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 imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: orderRefs supports ArtistOrderView.vue by holding or executing the order refs 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.
@@ -352,15 +347,11 @@ const loadOrders = async () => {
orders.value = (await orderApi.getArtistOrders() as unknown as any[]) || []
for (const order of orders.value) {
for (const item of order.items || []) {
const match = item.productImage?.replace(/<[^>]*>/g, '').match(/\/api\/file\/get\/(\d+)/)
if (!match?.[1]) continue
const imageId = match[1]
try {
if (!imageIdCache.value[imageId]) imageIdCache.value[imageId] = await fileApi.getSignedUrl(imageId) as any
item.productImage = imageIdCache.value[imageId]
} catch {
item.productImage = ''
}
const imageId = extractLegacyFileId(item.productImage)
if (!imageId) continue
const cachedUrl = getCachedSignedImageUrlSync(imageId)
if (cachedUrl) item.productImage = cachedUrl
item.productImage = await getCachedSignedImageUrl(imageId)
}
}
await scrollToTargetOrder()
@@ -220,8 +220,8 @@ onMounted(loadProfile)
<style scoped>
.artist-profile {
min-height: 100vh;
background: #f6f7fb;
color: #1f2933;
background: var(--theme-page-bg);
color: var(--text-primary);
}
.page-header {
@@ -233,8 +233,8 @@ onMounted(loadProfile)
align-items: center;
height: 56px;
padding: 0 14px;
background: rgba(255, 255, 255, 0.94);
border-bottom: 1px solid #e6e9ef;
background: color-mix(in srgb, var(--theme-card-bg) 94%, transparent);
border-bottom: 1px solid var(--theme-border);
backdrop-filter: blur(14px);
}
@@ -265,7 +265,7 @@ onMounted(loadProfile)
min-height: 300px;
overflow: hidden;
border-radius: 8px;
background: #222831;
background: var(--theme-gradient);
}
.hero-image {
@@ -340,30 +340,30 @@ onMounted(loadProfile)
gap: 6px;
min-height: 98px;
padding: 16px;
background: #fff;
border: 1px solid #e6e9ef;
background: var(--theme-card-bg);
border: 1px solid var(--theme-border);
border-radius: 8px;
}
.metric-item svg {
color: #c6597d;
color: var(--theme-primary);
}
.metric-item span {
color: #65717f;
color: var(--text-secondary);
font-size: 13px;
}
.metric-item strong {
overflow-wrap: anywhere;
overflow-wrap: break-word;
font-size: 22px;
}
.content-section {
margin-top: 14px;
padding: 18px;
background: #fff;
border: 1px solid #e6e9ef;
background: var(--theme-card-bg);
border: 1px solid var(--theme-border);
border-radius: 8px;
}
@@ -382,7 +382,7 @@ onMounted(loadProfile)
.section-head span,
.muted {
color: #7b8794;
color: var(--text-secondary);
font-size: 13px;
}
@@ -405,13 +405,13 @@ onMounted(loadProfile)
padding: 10px;
text-align: left;
cursor: default;
background: #f6f7fb;
border: 1px solid #dfe4ea;
background: var(--theme-primary-soft);
border: 1px solid var(--theme-border);
border-radius: 8px;
}
.slot-chip span {
color: #65717f;
color: var(--text-secondary);
font-size: 12px;
}
@@ -432,8 +432,8 @@ onMounted(loadProfile)
overflow: hidden;
text-align: left;
cursor: pointer;
background: #fff;
border: 1px solid #e6e9ef;
background: var(--theme-card-bg);
border: 1px solid var(--theme-border);
border-radius: 8px;
}
@@ -441,7 +441,7 @@ onMounted(loadProfile)
width: 100%;
aspect-ratio: 4 / 3;
object-fit: cover;
background: #eef1f5;
background: var(--theme-primary-soft);
}
.work-card span,
@@ -451,7 +451,7 @@ onMounted(loadProfile)
.work-card span {
overflow: hidden;
color: #29333d;
color: var(--text-primary);
font-weight: 600;
text-overflow: ellipsis;
white-space: nowrap;
@@ -459,7 +459,7 @@ onMounted(loadProfile)
.work-card strong {
padding-bottom: 10px;
color: #c6597d;
color: var(--theme-primary);
}
.review-list {
@@ -469,8 +469,8 @@ onMounted(loadProfile)
.review-item {
padding: 14px;
background: #f8fafc;
border: 1px solid #e6e9ef;
background: var(--theme-card-bg);
border: 1px solid var(--theme-border);
border-radius: 8px;
}
@@ -490,19 +490,19 @@ onMounted(loadProfile)
}
.review-top span {
color: #7b8794;
color: var(--text-secondary);
font-size: 12px;
}
.review-top em {
color: #c6597d;
color: var(--theme-primary);
font-style: normal;
font-weight: 700;
}
.review-item p {
margin: 12px 0 0;
color: #3f4a56;
color: var(--text-secondary);
line-height: 1.7;
white-space: pre-wrap;
}
+521 -84
View File
@@ -1,10 +1,24 @@
<template>
<div class="mobile-container">
<div class="auth-container">
<div class="logo-section">
<div class="logo">Yumi</div>
<div class="subtitle">美甲服务平台</div>
</div>
<main class="auth-page">
<section class="brand-stage" aria-label="YumiNail">
<div class="brand-mark" aria-hidden="true">
<span>Y</span>
</div>
<p class="brand-name">YumiNail</p>
<h1 class="brand-title">
{{ activeTab === 'login' ? '艺术触手可及' : '开启你的预约账号' }}
</h1>
<p class="brand-copy">
{{ activeTab === 'login' ? '选择门店,继续你的美甲灵感旅程。' : '注册后即可收藏款式、预约服务并同步门店权益。' }}
</p>
</section>
<section class="auth-container" aria-label="账号登录注册">
<div class="auth-card-header">
<span class="auth-card-kicker">{{ activeTab === 'login' ? 'Welcome back' : 'Create account' }}</span>
<h2>{{ activeTab === 'login' ? '登录账号' : '注册账号' }}</h2>
</div>
<div class="tab-container">
<div
@@ -12,14 +26,14 @@
:class="{ active: activeTab === 'login' }"
@click="activeTab = 'login'"
>
登录
账号登录
</div>
<div
class="tab-item"
:class="{ active: activeTab === 'register' }"
@click="activeTab = 'register'"
>
注册
注册账号
</div>
</div>
@@ -44,7 +58,7 @@
size="large"
>
<template #prefix>
<UserOutlined style="color: #999" />
<UserOutlined style="color: var(--text-secondary)" />
</template>
</a-input>
</a-form-item>
@@ -58,7 +72,7 @@
@blur="handleRegisterAccountBlur"
>
<template #prefix>
<UserOutlined style="color: #999" />
<UserOutlined style="color: var(--text-secondary)" />
</template>
</a-input>
<div
@@ -78,7 +92,7 @@
@blur="handleRegisterPhoneBlur"
>
<template #prefix>
<UserOutlined style="color: #999" />
<UserOutlined style="color: var(--text-secondary)" />
</template>
</a-input>
<div
@@ -97,7 +111,7 @@
size="large"
>
<template #prefix>
<LockOutlined style="color: #999" />
<LockOutlined style="color: var(--text-secondary)" />
</template>
<template #suffix>
<a-button
@@ -123,7 +137,7 @@
@input="handleAccountInput"
>
<template #prefix>
<UserOutlined style="color: #999" />
<UserOutlined style="color: var(--text-secondary)" />
</template>
</a-input>
<div
@@ -146,11 +160,11 @@
size="large"
>
<template #prefix>
<UserOutlined style="color: #999" />
<UserOutlined style="color: var(--text-secondary)" />
</template>
</a-input>
<div class="phone-login-tip">
<InfoCircleOutlined style="color: #1890ff; margin-right: 4px;" />
<InfoCircleOutlined style="color: var(--theme-primary); margin-right: 4px;" />
<span>新用户将自动注册</span>
</div>
</a-form-item>
@@ -166,7 +180,7 @@
size="large"
>
<template #prefix>
<LockOutlined style="color: #999" />
<LockOutlined style="color: var(--text-secondary)" />
</template>
<template #suffix>
<a-button
@@ -184,6 +198,7 @@
v-if="activeTab === 'login'"
name="shopId"
label="选择登录店铺"
class="shop-select-item"
>
<a-select
v-model:value="formData.shopId"
@@ -228,7 +243,7 @@
size="large"
>
<template #prefix>
<LockOutlined style="color: #999" />
<LockOutlined style="color: var(--text-secondary)" />
</template>
</a-input-password>
</a-form-item>
@@ -240,7 +255,7 @@
size="large"
>
<template #prefix>
<LockOutlined style="color: #999" />
<LockOutlined style="color: var(--text-secondary)" />
</template>
</a-input-password>
</a-form-item>
@@ -253,7 +268,7 @@
/>
</a-form-item>
<a-form-item v-if="activeTab === 'register'" name="shopId" label="选择店铺">
<a-form-item v-if="activeTab === 'register'" name="shopId" label="选择店铺" class="shop-select-item">
<a-select
v-model:value="formData.shopId"
placeholder="请选择店铺"
@@ -299,6 +314,7 @@
html-type="submit"
size="large"
block
class="primary-action"
:loading="loading"
:disabled="!agreementAccepted"
>
@@ -313,13 +329,17 @@
<div class="social-hint">
微信手机号授权登录请在小程序中使用;网页端可使用账号密码或验证码登录。
</div>
<button type="button" class="guest-entry" @click="router.push('/home')">
游客浏览
</button>
</div>
<div class="admin-login">
<span class="admin-login-link" @click="handleAdminLogin">管理后台登录</span>
</div>
</a-form>
</div>
</section>
</main>
<a-modal
v-model:open="forgotPasswordVisible"
@@ -341,7 +361,7 @@
size="large"
>
<template #prefix>
<UserOutlined style="color: #999" />
<UserOutlined style="color: var(--text-secondary)" />
</template>
</a-input>
</a-form-item>
@@ -353,7 +373,7 @@
size="large"
>
<template #prefix>
<LockOutlined style="color: #999" />
<LockOutlined style="color: var(--text-secondary)" />
</template>
<template #suffix>
<a-button
@@ -374,7 +394,7 @@
size="large"
>
<template #prefix>
<LockOutlined style="color: #999" />
<LockOutlined style="color: var(--text-secondary)" />
</template>
</a-input-password>
</a-form-item>
@@ -407,7 +427,7 @@
>
<div class="agreement-content">
<div class="agreement-version">版本:{{ selectedAgreement?.version || '--' }}</div>
<pre>{{ selectedAgreement?.content || '暂无协议内容' }}</pre>
<div class="agreement-rich-content" v-html="agreementContentHtml"></div>
</div>
</a-modal>
</div>
@@ -432,6 +452,7 @@ import { shopApi } from '@/api/shop'
import { ACCOUNT_REGEX, ACCOUNT_RULE_MESSAGE, sanitizeAccountInput } from '@/utils/account'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { notifyShopThemeChanged } from '@/utils/shop-theme'
import { renderRichContent } from '@/utils/rich-content'
import {
userApi,
type AvailabilityCheckResponse,
@@ -518,6 +539,7 @@ const agreementModalOpen = ref(false)
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const selectedAgreement = ref<LegalAgreement | null>(null)
const agreementContentHtml = computed(() => renderRichContent(selectedAgreement.value?.content || '暂无协议内容'))
/**
* Purpose: forgotPasswordForm supports AuthView.vue by holding or executing the forgot password form page or API role.
@@ -1287,20 +1309,137 @@ onBeforeUnmount(() => {
<style scoped>
.mobile-container {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100svh;
background:
linear-gradient(
180deg,
color-mix(in srgb, var(--theme-page-bg) 86%, transparent) 0%,
color-mix(in srgb, var(--theme-primary-soft) 72%, var(--theme-page-bg)) 48%,
var(--theme-page-bg) 100%
),
var(--theme-background-image),
var(--theme-gradient-soft);
background-size: cover, cover, auto;
background-position: center top;
color: var(--text-primary);
overflow-x: hidden;
padding: 24px 20px 28px;
}
.auth-page {
width: 100%;
max-width: 430px;
min-height: calc(100svh - 52px);
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
padding: 20px;
gap: 22px;
margin: 0 auto;
}
.brand-stage {
width: 100%;
text-align: center;
padding: 12px 10px 0;
}
.brand-mark {
width: 76px;
height: 76px;
margin: 0 auto 14px;
display: grid;
place-items: center;
border-radius: 999px;
background:
linear-gradient(
145deg,
color-mix(in srgb, var(--theme-card-bg) 88%, transparent),
color-mix(in srgb, var(--theme-primary-soft) 84%, var(--theme-card-bg))
);
border: 1px solid color-mix(in srgb, var(--theme-card-bg) 70%, var(--theme-border));
box-shadow: var(--theme-button-shadow);
}
.brand-mark span {
width: 52px;
height: 52px;
display: grid;
place-items: center;
border-radius: 999px;
background: var(--theme-gradient);
color: var(--theme-card-bg);
font-family: "Playfair Display", serif;
font-size: 30px;
font-weight: 700;
line-height: 1;
letter-spacing: 0;
}
.brand-name {
margin: 0;
color: var(--theme-primary-action);
font-family: "Playfair Display", serif;
font-size: 42px;
font-weight: 700;
line-height: 1.05;
letter-spacing: 0;
}
.brand-title {
margin: 8px 0 0;
color: var(--text-primary);
font-family: "Playfair Display", serif;
font-size: 28px;
font-weight: 600;
line-height: 1.2;
letter-spacing: 0;
}
.brand-copy {
max-width: 310px;
margin: 10px auto 0;
color: var(--text-secondary);
font-size: 14px;
line-height: 1.7;
letter-spacing: 0;
}
.auth-container {
width: 100%;
max-width: 400px;
background: white;
border-radius: 20px;
padding: 30px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
background: color-mix(in srgb, var(--theme-card-bg) 86%, transparent);
border: 1px solid color-mix(in srgb, var(--theme-card-bg) 70%, var(--theme-border));
border-radius: 28px;
padding: 22px 18px 20px;
box-shadow: 0 22px 46px color-mix(in srgb, var(--theme-primary) 14%, transparent);
backdrop-filter: blur(18px);
}
.auth-card-header {
margin-bottom: 18px;
}
.auth-card-kicker {
display: inline-flex;
align-items: center;
min-height: 24px;
padding: 4px 10px;
border-radius: 999px;
background: color-mix(in srgb, var(--theme-primary-soft) 82%, var(--theme-card-bg));
color: var(--theme-primary-action);
font-size: 12px;
font-weight: 700;
line-height: 1;
letter-spacing: 0;
}
.auth-card-header h2 {
margin: 10px 0 0;
color: var(--text-primary);
font-family: "Playfair Display", serif;
font-size: 26px;
font-weight: 600;
line-height: 1.25;
letter-spacing: 0;
}
.logo-section {
@@ -1311,88 +1450,227 @@ onBeforeUnmount(() => {
.logo {
font-size: 48px;
font-weight: bold;
color: #667eea;
color: var(--theme-primary);
margin-bottom: 10px;
}
.subtitle {
font-size: 16px;
color: #999;
color: var(--text-secondary);
}
.tab-container {
display: flex;
margin-bottom: 30px;
border-bottom: 2px solid #f0f0f0;
gap: 8px;
margin-bottom: 18px;
padding: 5px;
border: 1px solid var(--theme-border);
border-radius: 999px;
background: color-mix(in srgb, var(--theme-primary-soft) 52%, var(--theme-card-bg));
}
.tab-item {
flex: 1;
text-align: center;
padding: 15px;
font-size: 16px;
color: #999;
min-height: 42px;
padding: 11px 8px;
border-radius: 999px;
font-size: 14px;
font-weight: 700;
color: var(--text-secondary);
cursor: pointer;
transition: all 0.3s;
transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
position: relative;
user-select: none;
}
.tab-item.active {
color: #667eea;
font-weight: bold;
color: var(--theme-card-bg);
background: var(--theme-gradient);
box-shadow: var(--theme-button-shadow);
}
.tab-item.active::after {
content: '';
position: absolute;
bottom: -2px;
left: 0;
right: 0;
height: 2px;
background: #667eea;
display: none;
}
.login-type-toggle {
margin-bottom: 20px;
text-align: center;
margin-bottom: 18px;
}
.login-type-toggle :deep(.ant-radio-group) {
width: 100%;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
}
.login-type-toggle :deep(.ant-radio-button-wrapper) {
height: 40px;
display: inline-flex;
align-items: center;
justify-content: center;
border: 1px solid var(--theme-border);
border-radius: 999px;
background: color-mix(in srgb, var(--theme-card-bg) 82%, transparent);
color: var(--text-secondary);
font-size: 13px;
font-weight: 700;
line-height: 1.2;
letter-spacing: 0;
white-space: normal;
}
.login-type-toggle :deep(.ant-radio-button-wrapper::before) {
display: none;
}
.login-type-toggle :deep(.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled)) {
color: var(--theme-card-bg);
background: var(--theme-primary-action);
border-color: var(--theme-primary-action);
box-shadow: none;
}
.auth-form {
margin-top: 20px;
margin-top: 0;
}
.auth-form :deep(.ant-form-item) {
margin-bottom: 16px;
}
.auth-form :deep(.ant-form-item-label) {
padding-bottom: 7px;
}
.auth-form :deep(.ant-form-item-label > label) {
color: var(--text-secondary);
font-size: 13px;
font-weight: 700;
letter-spacing: 0;
}
.auth-form :deep(.ant-input),
.auth-form :deep(.ant-input-affix-wrapper),
.auth-form :deep(.ant-select-selector) {
min-height: 52px;
border-radius: 18px;
border-color: var(--theme-border);
background: color-mix(in srgb, var(--theme-card-bg) 88%, var(--theme-primary-soft));
color: var(--text-primary);
box-shadow: none;
transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.auth-form :deep(.ant-input),
.auth-form :deep(.ant-input-affix-wrapper) {
padding-inline: 15px;
}
.auth-form :deep(.ant-input-affix-wrapper > input.ant-input) {
min-height: auto;
background: transparent;
}
.auth-form :deep(.ant-input::placeholder),
.auth-form :deep(.ant-select-selection-placeholder) {
color: color-mix(in srgb, var(--text-secondary) 70%, transparent);
}
.auth-form :deep(.ant-input-affix-wrapper-focused),
.auth-form :deep(.ant-input:focus),
.auth-form :deep(.ant-select-focused .ant-select-selector) {
border-color: var(--theme-primary);
box-shadow: var(--theme-focus-shadow);
background: color-mix(in srgb, var(--theme-card-bg) 94%, var(--theme-primary-soft));
}
.auth-form :deep(.ant-select-selector) {
align-items: center;
padding: 0 15px;
}
.auth-form :deep(.ant-select-selection-item) {
color: var(--text-primary);
font-weight: 600;
}
.auth-form :deep(.ant-input-prefix) {
margin-right: 8px;
}
.auth-form :deep(.ant-input-suffix .ant-btn-link) {
height: 32px;
padding: 0 2px;
color: var(--theme-primary-action);
font-size: 12px;
font-weight: 700;
letter-spacing: 0;
}
.shop-select-item {
margin: 4px 0 18px;
padding: 14px;
border-radius: 22px;
border: 1px solid var(--theme-border);
background:
linear-gradient(
145deg,
color-mix(in srgb, var(--theme-card-bg) 88%, var(--theme-primary-soft)),
color-mix(in srgb, var(--theme-secondary-soft) 32%, var(--theme-card-bg))
);
}
.shop-select-item :deep(.ant-form-item-label > label) {
color: var(--theme-primary-action);
}
.shop-select-item :deep(.ant-form-item-control-input) {
min-height: auto;
}
.form-actions {
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
font-size: 13px;
}
.form-actions :deep(.ant-checkbox-wrapper) {
color: var(--text-secondary);
}
.field-status {
margin-top: 8px;
margin-top: 9px;
font-size: 12px;
line-height: 1.5;
letter-spacing: 0;
}
.field-status.success {
color: #52c41a;
color: var(--theme-secondary);
}
.field-status.error {
color: #ff4d4f;
color: var(--theme-primary-action);
}
.forgot-password {
color: #667eea;
color: var(--theme-primary-action);
cursor: pointer;
font-weight: 700;
}
.social-login {
margin-top: 30px;
margin-top: 22px;
}
.divider {
text-align: center;
position: relative;
margin-bottom: 20px;
margin-bottom: 14px;
}
.divider::before {
@@ -1402,14 +1680,17 @@ onBeforeUnmount(() => {
top: 50%;
width: 100%;
height: 1px;
background: #f0f0f0;
background: color-mix(in srgb, var(--theme-border) 78%, transparent);
}
.divider span {
background: white;
padding: 0 15px;
color: #999;
font-size: 14px;
background: color-mix(in srgb, var(--theme-card-bg) 94%, var(--theme-primary-soft));
padding: 0 12px;
color: var(--text-secondary);
font-size: 12px;
font-weight: 700;
line-height: 1.2;
letter-spacing: 0;
position: relative;
}
@@ -1420,13 +1701,31 @@ onBeforeUnmount(() => {
}
.social-hint {
margin-bottom: 14px;
margin-bottom: 12px;
font-size: 12px;
line-height: 1.6;
color: #8c8c8c;
color: var(--text-secondary);
text-align: center;
}
.guest-entry {
width: 100%;
min-height: 44px;
border: 1px solid var(--theme-border);
border-radius: 999px;
background: color-mix(in srgb, var(--theme-card-bg) 76%, transparent);
color: var(--theme-primary-action);
font-size: 13px;
font-weight: 700;
letter-spacing: 0;
cursor: pointer;
transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.guest-entry:active {
transform: scale(0.98);
}
.social-circle-btn {
opacity: 0.72;
border-style: dashed;
@@ -1438,45 +1737,98 @@ onBeforeUnmount(() => {
justify-content: center;
gap: 18px;
font-size: 12px;
color: #8c8c8c;
color: var(--text-secondary);
}
.social-buttons .ant-btn {
border-color: #f0f0f0;
border-color: var(--theme-border);
}
.social-buttons .ant-btn:hover {
border-color: #667eea;
color: #667eea;
border-color: var(--theme-primary);
color: var(--theme-primary);
}
.admin-login {
text-align: center;
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #f0f0f0;
margin-top: 18px;
padding-top: 17px;
border-top: 1px solid color-mix(in srgb, var(--theme-border) 80%, transparent);
}
.admin-login-link {
color: #667eea;
font-size: 14px;
color: var(--text-secondary);
font-size: 12px;
font-weight: 700;
letter-spacing: 0;
cursor: pointer;
transition: all 0.3s;
transition: color 0.2s ease;
}
.admin-login-link:hover {
color: #764ba2;
color: var(--theme-primary-action);
text-decoration: underline;
}
.phone-login-tip {
margin-top: 8px;
font-size: 12px;
color: #1890ff;
color: var(--theme-primary-action);
display: flex;
align-items: center;
}
.primary-action {
min-height: 52px;
border: none;
border-radius: 999px;
background: var(--theme-gradient);
color: var(--theme-card-bg);
font-size: 15px;
font-weight: 800;
letter-spacing: 0;
box-shadow: var(--theme-button-shadow);
}
.primary-action:not(:disabled):hover,
.primary-action:not(:disabled):focus {
background: var(--theme-gradient);
color: var(--theme-card-bg);
box-shadow: var(--theme-button-shadow);
}
.primary-action:disabled {
color: color-mix(in srgb, var(--text-secondary) 56%, transparent);
background: color-mix(in srgb, var(--theme-border) 62%, var(--theme-card-bg));
box-shadow: none;
}
.auth-form :deep(.ant-checkbox-wrapper),
.auth-form :deep(a) {
font-size: 12px;
line-height: 1.6;
letter-spacing: 0;
}
.auth-form :deep(.ant-checkbox-wrapper) {
color: var(--text-secondary);
}
.auth-form :deep(a) {
color: var(--theme-primary-action);
font-weight: 700;
}
.auth-form :deep(.ant-checkbox-checked .ant-checkbox-inner) {
background-color: var(--theme-primary-action);
border-color: var(--theme-primary-action);
}
.auth-form :deep(.ant-checkbox-wrapper:hover .ant-checkbox-inner),
.auth-form :deep(.ant-checkbox:hover .ant-checkbox-inner) {
border-color: var(--theme-primary);
}
.agreement-content {
max-height: 60vh;
overflow: auto;
@@ -1484,16 +1836,101 @@ onBeforeUnmount(() => {
.agreement-version {
margin-bottom: 12px;
color: #8c8c8c;
color: var(--text-secondary);
font-size: 13px;
}
.agreement-content pre {
white-space: pre-wrap;
word-break: break-word;
margin: 0;
font-family: inherit;
line-height: 1.7;
color: #333;
.agreement-rich-content {
color: var(--text-primary);
line-height: 1.8;
overflow-wrap: break-word;
}
.agreement-rich-content :deep(*) {
max-width: 100%;
}
.agreement-rich-content :deep(p),
.agreement-rich-content :deep(ul),
.agreement-rich-content :deep(ol),
.agreement-rich-content :deep(blockquote),
.agreement-rich-content :deep(pre),
.agreement-rich-content :deep(table) {
margin: 0 0 12px;
}
.agreement-rich-content :deep(p:last-child),
.agreement-rich-content :deep(ul:last-child),
.agreement-rich-content :deep(ol:last-child),
.agreement-rich-content :deep(blockquote:last-child),
.agreement-rich-content :deep(pre:last-child),
.agreement-rich-content :deep(table:last-child) {
margin-bottom: 0;
}
.agreement-rich-content :deep(ul),
.agreement-rich-content :deep(ol) {
padding-left: 1.25em;
}
.agreement-rich-content :deep(a) {
color: var(--theme-primary);
}
.agreement-rich-content :deep(img) {
display: block;
max-width: 100%;
border-radius: 8px;
}
.agreement-rich-content :deep(pre) {
overflow-x: auto;
padding: 10px 12px;
border-radius: 8px;
background: var(--theme-primary-soft);
}
@media (max-width: 420px) {
.mobile-container {
padding: 18px 14px 24px;
}
.auth-page {
min-height: calc(100svh - 42px);
gap: 18px;
}
.brand-mark {
width: 68px;
height: 68px;
margin-bottom: 12px;
}
.brand-mark span {
width: 48px;
height: 48px;
font-size: 28px;
}
.brand-name {
font-size: 38px;
}
.brand-title {
font-size: 26px;
}
.brand-copy {
font-size: 13px;
}
.auth-container {
border-radius: 24px;
padding: 20px 16px 18px;
}
.auth-card-header h2 {
font-size: 24px;
}
}
</style>
File diff suppressed because it is too large Load Diff
+103
View File
@@ -333,6 +333,109 @@ onMounted(() => {
border-color: var(--theme-primary);
}
.mobile-container {
padding-top: 68px;
background:
radial-gradient(circle at 84% 0%, color-mix(in srgb, var(--theme-primary) 26%, transparent), transparent 32%),
linear-gradient(180deg, color-mix(in srgb, var(--theme-card-bg) 78%, transparent), var(--theme-page-bg));
}
.header {
height: 64px;
padding: 12px 18px 10px;
background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent);
}
.header h1 {
font-size: 17px;
font-weight: 820;
}
.back-btn {
border-radius: 999px;
background: color-mix(in srgb, var(--theme-card-bg) 74%, transparent);
}
.coupon-section {
padding: 18px;
}
.filter-card,
.content-card {
border-radius: 22px;
background: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
box-shadow: 0 18px 40px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
}
.coupon-list {
gap: 14px;
}
.coupon-card {
position: relative;
overflow: hidden;
border-radius: 24px;
background:
linear-gradient(135deg, color-mix(in srgb, var(--theme-card-bg) 88%, transparent), color-mix(in srgb, var(--theme-primary) 20%, var(--theme-card-bg)));
box-shadow: 0 20px 42px color-mix(in srgb, var(--theme-neutral) 9%, transparent);
}
.coupon-card::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: 112px;
width: 1px;
background: linear-gradient(var(--theme-border) 52%, transparent 0);
background-size: 1px 12px;
}
.coupon-content {
gap: 18px;
padding: 18px;
}
.coupon-value {
min-width: 78px;
padding: 16px 8px;
border-radius: 18px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 24%, var(--theme-card-bg));
font-family: Georgia, 'Times New Roman', serif;
}
.coupon-name {
font-weight: 820;
}
.coupon-condition,
.coupon-status.available {
color: var(--theme-primary-action);
}
:deep(.ant-segmented) {
width: 100%;
padding: 4px;
border-radius: 16px;
background: color-mix(in srgb, var(--theme-primary) 16%, var(--theme-card-bg));
}
:deep(.ant-segmented-item) {
border-radius: 13px;
}
:deep(.ant-segmented-item-selected) {
background: var(--theme-card-bg);
color: var(--theme-primary-action);
box-shadow: 0 10px 20px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
}
:deep(.ant-btn-primary) {
border-color: transparent;
background: linear-gradient(135deg, var(--theme-primary-action), var(--theme-secondary));
}
@media (min-width: 992px) {
.coupon-section {
max-width: 960px;
+95
View File
@@ -0,0 +1,95 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { userApi, type ContactInfoVO } from '@/api/user'
const router = useRouter()
const loading = ref(false)
const contact = ref<ContactInfoVO | null>(null)
const loadContact = async () => {
loading.value = true
try {
contact.value = await userApi.getPlatformContact()
} catch (error: any) {
contact.value = null
message.warning(error?.message || '暂时无法加载客服信息')
} finally {
loading.value = false
}
}
onMounted(loadContact)
</script>
<template>
<div class="help-page">
<header class="header">
<a-button type="text" @click="router.back()">
<LeftOutlined />
</a-button>
<h1>帮助与客服</h1>
<a-button type="link" @click="loadContact">刷新</a-button>
</header>
<main class="content">
<section class="hero-card">
<span>YumiNail Support</span>
<h2>帮助与客服</h2>
<p>订单、预约、售后和账号问题都可以从这里继续处理。</p>
</section>
<a-spin :spinning="loading">
<section class="section-card">
<h3>平台联系信息</h3>
<p v-if="contact?.contactName">{{ contact.contactName }} {{ contact.roleLabel || '' }}</p>
<p v-if="contact?.phoneAvailable && contact.phone">电话:{{ contact.phone }}</p>
<p v-if="contact?.wechatAvailable && contact.wechatId">微信:{{ contact.wechatId }}</p>
<p v-if="contact?.platformContactText">{{ contact.platformContactText }}</p>
<p v-if="!contact">暂无可展示的客服信息,请稍后重试或通过订单详情联系服务人员。</p>
</section>
<section class="quick-grid">
<button type="button" @click="router.push('/orders')">
<strong>订单中心</strong>
<span>查看预约、支付、评价</span>
</button>
<button type="button" @click="router.push('/after-sales')">
<strong>售后记录</strong>
<span>查看退款和处理进度</span>
</button>
<button type="button" @click="router.push('/notifications')">
<strong>消息中心</strong>
<span>查看系统通知</span>
</button>
<button type="button" @click="router.push('/settings')">
<strong>账号设置</strong>
<span>修改资料、手机号和密码</span>
</button>
</section>
</a-spin>
</main>
</div>
</template>
<style scoped>
.help-page { min-height: 100vh; padding-top: 66px; background: linear-gradient(180deg, color-mix(in srgb, var(--theme-card-bg) 76%, transparent), var(--theme-page-bg)); color: var(--text-primary); }
.header { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 11px 18px; background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent); border-bottom: 1px solid var(--theme-border); backdrop-filter: blur(14px); }
.header h1 { margin: 0; font-size: 17px; font-weight: 820; }
.content { padding: 18px 18px 34px; }
.hero-card, .section-card, .quick-grid button { border: 1px solid var(--theme-border); border-radius: 24px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px color-mix(in srgb, var(--theme-neutral) 8%, transparent); }
.hero-card { padding: 24px; margin-bottom: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--theme-primary) 24%, var(--theme-card-bg)), color-mix(in srgb, var(--theme-secondary) 18%, var(--theme-card-bg))); }
.hero-card span { color: var(--theme-primary-action); font-family: Georgia, 'Times New Roman', serif; font-size: 12px; font-weight: 800; }
.hero-card h2 { margin: 10px 0 6px; font-size: 25px; font-weight: 850; }
.hero-card p, .section-card p, .quick-grid span { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.section-card { padding: 16px; }
.section-card h3 { margin: 0 0 12px; font-size: 17px; }
.section-card p + p { margin-top: 8px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.quick-grid button { display: grid; gap: 6px; min-height: 112px; padding: 16px; border-color: var(--theme-border); text-align: left; color: var(--text-primary); cursor: pointer; }
.quick-grid strong { font-size: 16px; }
.quick-grid span { font-size: 13px; }
:deep(.ant-btn-link) { color: var(--theme-primary-action); }
</style>
File diff suppressed because it is too large Load Diff
+31 -19
View File
@@ -1,9 +1,10 @@
<template>
<div class="not-found-container">
<div class="not-found-content">
<span class="not-found-kicker">YumiNail</span>
<div class="error-code">404</div>
<h1>页面不存在</h1>
<p>您访问的页面不存在或已被删除</p>
<h1>这页去做护理了</h1>
<p>您访问的页面不存在或已被删除,我们带您回到首页继续浏览作品。</p>
<p class="redirect-message">
将在 <span class="countdown">{{ countdown }}</span> 秒后自动跳转到首页...
</p>
@@ -63,69 +64,80 @@ onUnmounted(() => {
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background:
radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--theme-primary) 30%, transparent), transparent 34%),
linear-gradient(180deg, var(--theme-tertiary), color-mix(in srgb, var(--theme-secondary) 14%, var(--theme-tertiary)));
padding: 20px;
}
.not-found-content {
background: white;
border-radius: 20px;
padding: 60px 40px;
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
border: 1px solid var(--theme-border);
border-radius: 28px;
padding: 48px 28px;
text-align: center;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
box-shadow: 0 24px 54px color-mix(in srgb, var(--theme-neutral) 12%, transparent);
max-width: 500px;
width: 100%;
backdrop-filter: blur(16px);
}
.not-found-kicker {
color: var(--theme-secondary);
font-family: Georgia, 'Times New Roman', serif;
font-size: 13px;
font-weight: 800;
}
.error-code {
font-size: 120px;
font-weight: bold;
color: #667eea;
margin: 0 0 20px 0;
font-size: 104px;
font-weight: 900;
color: var(--theme-primary-action);
margin: 10px 0 14px;
line-height: 1;
}
.not-found-content h1 {
font-size: 28px;
font-weight: 700;
color: #333;
color: var(--text-primary);
margin: 0 0 16px 0;
}
.not-found-content p {
font-size: 16px;
color: #666;
color: var(--text-secondary);
margin: 0 0 24px 0;
line-height: 1.6;
}
.redirect-message {
margin: 20px 0 30px 0;
color: #999;
color: var(--text-secondary);
font-size: 14px;
}
.countdown {
color: #667eea;
color: var(--theme-primary-action);
font-weight: bold;
font-size: 18px;
margin: 0 4px;
}
:deep(.ant-btn-primary) {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background: linear-gradient(135deg, var(--theme-primary-action), var(--theme-secondary));
border: none;
padding: 12px 32px;
font-size: 16px;
font-weight: 600;
border-radius: 25px;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
box-shadow: var(--theme-button-shadow);
transition: all 0.3s ease;
}
:deep(.ant-btn-primary:hover) {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
box-shadow: var(--theme-button-shadow);
}
@media (max-width: 768px) {
@@ -145,4 +157,4 @@ onUnmounted(() => {
font-size: 14px;
}
}
</style>
</style>
+120 -12
View File
@@ -30,7 +30,7 @@
<a-modal v-model:open="detailVisible" title="消息详情" @ok="detailVisible = false">
<h3>{{ currentMessage?.title }}</h3>
<p class="message-meta">{{ currentMessage?.publisherName || '系统消息' }} · {{ currentMessage?.publishTime }}</p>
<div v-if="currentMessage?.content" class="message-content">{{ currentMessage?.content }}</div>
<div v-if="currentMessageContentHtml" class="message-content" v-html="currentMessageContentHtml"></div>
<img v-if="currentMessage?.imageUrl" class="message-image" :src="currentMessage.imageUrl" alt="消息图片" />
</a-modal>
</div>
@@ -50,6 +50,7 @@ import { message } from 'ant-design-vue'
*/
import { userApi, type SystemMessageVO } from '@/api/user'
import { buildSystemMessageActionPath } from '@/utils/system-message-action'
import { renderRichContent } from '@/utils/rich-content'
/**
* Purpose: router supports NotificationsView.vue by holding or executing the router page or API role.
@@ -72,6 +73,7 @@ const detailVisible = ref(false)
const currentMessage = ref<SystemMessageVO | null>(null)
/** unreadCount is a reactive state variable used by the template and event handlers. */
const unreadCount = computed(() => messages.value.filter(item => item.readStatus !== 1).length)
const currentMessageContentHtml = computed(() => renderRichContent(currentMessage.value?.content || ''))
/**
* Purpose: resolveSystemMessageActionPath supports NotificationsView.vue by holding or executing the resolve system message action path page or API role.
@@ -128,7 +130,7 @@ onMounted(loadMessages)
<style scoped>
.notifications-page {
min-height: 100vh;
background: #fff7f8;
background: var(--theme-page-bg);
padding: 18px;
}
@@ -146,7 +148,7 @@ onMounted(loadMessages)
.page-header p {
margin: 4px 0 0;
color: #8a7b83;
color: var(--text-secondary);
}
.back-btn {
@@ -154,7 +156,7 @@ onMounted(loadMessages)
height: 40px;
border: 0;
border-radius: 20px;
background: #fff;
background: var(--theme-card-bg);
font-size: 28px;
}
@@ -171,7 +173,8 @@ onMounted(loadMessages)
padding: 16px;
border: 0;
border-radius: 8px;
background: #fff;
background: var(--theme-card-bg);
border: 1px solid var(--theme-border);
text-align: left;
}
@@ -179,11 +182,11 @@ onMounted(loadMessages)
width: 8px;
height: 8px;
border-radius: 50%;
background: #d7c9cf;
background: var(--theme-border);
}
.message-item.unread .dot {
background: #ff5c8a;
background: var(--theme-primary);
}
.message-main {
@@ -195,20 +198,64 @@ onMounted(loadMessages)
width: fit-content;
padding: 2px 8px;
border-radius: 999px;
background: #fff0f4;
color: #d74270;
background: var(--theme-primary-soft);
color: var(--theme-primary);
font-size: 12px;
font-style: normal;
}
.message-main small,
.message-meta {
color: #8a7b83;
color: var(--text-secondary);
}
.message-content {
white-space: pre-wrap;
line-height: 1.8;
overflow-wrap: break-word;
}
.message-content :deep(*) {
max-width: 100%;
}
.message-content :deep(p),
.message-content :deep(ul),
.message-content :deep(ol),
.message-content :deep(blockquote),
.message-content :deep(pre),
.message-content :deep(table) {
margin: 0 0 12px;
}
.message-content :deep(p:last-child),
.message-content :deep(ul:last-child),
.message-content :deep(ol:last-child),
.message-content :deep(blockquote:last-child),
.message-content :deep(pre:last-child),
.message-content :deep(table:last-child) {
margin-bottom: 0;
}
.message-content :deep(ul),
.message-content :deep(ol) {
padding-left: 1.25em;
}
.message-content :deep(a) {
color: var(--theme-primary);
}
.message-content :deep(img) {
display: block;
max-width: 100%;
border-radius: 8px;
}
.message-content :deep(pre) {
overflow-x: auto;
padding: 10px 12px;
border-radius: 8px;
background: var(--theme-primary-soft);
}
.message-image {
@@ -218,6 +265,67 @@ onMounted(loadMessages)
margin-top: 14px;
object-fit: contain;
border-radius: 8px;
background: #fff7f8;
background: var(--theme-primary-soft);
}
.notifications-page {
padding: 18px 18px 34px;
background:
radial-gradient(circle at 84% 0%, color-mix(in srgb, var(--theme-primary) 28%, transparent), transparent 30%),
linear-gradient(180deg, color-mix(in srgb, var(--theme-card-bg) 74%, transparent), var(--theme-page-bg));
}
.page-header {
margin-bottom: 22px;
}
.page-header h1 {
font-size: 27px;
font-weight: 860;
}
.page-header p {
color: var(--theme-secondary);
font-weight: 700;
}
.back-btn {
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 82%, transparent);
box-shadow: 0 12px 24px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
}
.message-list {
gap: 12px;
}
.message-item {
align-items: flex-start;
padding: 17px;
border-radius: 22px;
background: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
box-shadow: 0 18px 38px color-mix(in srgb, var(--theme-neutral) 7%, transparent);
}
.message-item.unread {
border-color: color-mix(in srgb, var(--theme-primary) 36%, var(--theme-border));
}
.message-item.unread .dot {
background: var(--theme-primary-action);
}
.message-main strong {
color: var(--text-primary);
font-size: 15px;
}
.message-main em {
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 18%, var(--theme-card-bg));
}
.message-content :deep(a) {
color: var(--theme-primary-action);
}
</style>
@@ -0,0 +1,241 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
import { afterSaleApi, orderApi, paymentApi } from '../api/order'
import type { AfterSaleVO, OrderArtistChangeRequestVO, OrderArtistReviewVO } from '../api/order'
import { userApi, type ContactInfoVO } from '@/api/user'
import type { IdType } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { extractLegacyFileId, getCachedSignedImageUrl, getCachedSignedImageUrlSync } from '@/utils/signed-image-cache'
const route = useRoute()
const router = useRouter()
const loading = ref(false)
const order = ref<any | null>(null)
const reviews = ref<OrderArtistReviewVO[]>([])
const changeRequests = ref<OrderArtistChangeRequestVO[]>([])
const afterSales = ref<AfterSaleVO[]>([])
const contact = ref<ContactInfoVO | null>(null)
const orderId = computed(() => String(route.params.id || route.query.orderId || ''))
const items = computed(() => Array.isArray(order.value?.items) ? order.value.items : [])
const formatMoney = (value?: number | string) => {
const amount = Number(value)
return Number.isFinite(amount) ? `¥${amount.toFixed(2)}` : '¥0.00'
}
const formatDateTime = (value?: string) => value ? String(value).replace('T', ' ').slice(0, 16) : '--'
const statusClass = (status?: number) => status === 2 ? 'done' : status === 3 ? 'cancelled' : 'pending'
const isOrderPaid = (target: any) => String(target?.paymentStatus || '').toUpperCase() === 'PAID'
const canPreparePayment = computed(() => Number(order.value?.status) === 1 && !isOrderPaid(order.value))
const canMockPay = computed(() => Number(order.value?.status) === 1 && String(order.value?.paymentStatus || '').toUpperCase() === 'PAYING')
const canApplyAfterSale = computed(() => Number(order.value?.status) === 2 || isOrderPaid(order.value))
const timeline = computed(() => {
const current = order.value || {}
const firstAppointment = items.value.map((item: any) => item.appointmentTime).find(Boolean)
const status = Number(current.status)
return [
{ key: 'created', title: '已创建', text: formatDateTime(current.createTime), done: true, active: false },
{ key: 'appointment', title: '预约时间', text: formatDateTime(firstAppointment), done: Boolean(firstAppointment), active: status === 1 },
{ key: 'service', title: status === 3 ? '已取消' : '服务完成', text: formatDateTime(current.completeTime || current.cancelTime || current.updateTime), done: status === 2 || status === 3, active: status === 2 || status === 3 },
{ key: 'review', title: '评价', text: reviews.value.length ? `${reviews.value.length} 条记录` : '完成后可评价', done: reviews.value.some(item => Number(item.status) === 1 || item.rating), active: reviews.value.some(item => Number(item.status) !== 1 && !item.rating) },
{ key: 'after-sale', title: '售后', text: afterSales.value.length ? `${afterSales.value.length} 条记录` : '暂无售后', done: afterSales.value.length > 0, active: afterSales.value.some(item => item.status === 'PENDING') }
]
})
const resolveOrderImages = async () => {
for (const item of items.value) {
const imageId = extractLegacyFileId(item.productImage)
if (!imageId) continue
const cachedUrl = getCachedSignedImageUrlSync(imageId)
if (cachedUrl) item.productImage = cachedUrl
item.productImage = await getCachedSignedImageUrl(imageId)
}
}
const loadRelated = async () => {
if (!orderId.value) return
const [reviewList, changeList, afterSalePage, contactInfo] = await Promise.all([
orderApi.getOrderReviews(orderId.value).catch(() => []),
orderApi.getOrderArtistChangeRequests(orderId.value).catch(() => []),
afterSaleApi.listMy({ page: 1, size: 50 }).catch(() => ({ list: [] })),
userApi.getOrderArtistContact(orderId.value).catch(() => null)
])
reviews.value = reviewList || []
changeRequests.value = changeList || []
afterSales.value = ((afterSalePage as any)?.list || []).filter((item: AfterSaleVO) => String(item.orderId) === orderId.value)
contact.value = contactInfo
}
const loadOrder = async () => {
if (!orderId.value) {
order.value = null
return
}
loading.value = true
try {
order.value = await orderApi.getOrderDetail(orderId.value)
await resolveOrderImages()
await loadRelated()
} catch (error: any) {
order.value = null
message.error(error?.message || '订单详情加载失败')
} finally {
loading.value = false
}
}
const preparePayment = async () => {
if (!order.value?.id) return
await runWithGlobalLoading(async () => {
await paymentApi.prepareOrderPayment(order.value.id)
await loadOrder()
})
message.success('支付单已准备')
}
const mockPay = async () => {
if (!order.value?.id) return
await runWithGlobalLoading(async () => {
await paymentApi.mockSuccess(order.value.id)
await loadOrder()
})
message.success('模拟支付成功')
}
const cancelOrder = () => {
if (!order.value?.id) return
Modal.confirm({
title: '取消订单',
content: '确认取消这笔订单吗?',
onOk: async () => {
await runWithGlobalLoading(() => orderApi.cancelOrder(order.value.id as IdType))
message.success('订单已取消')
await loadOrder()
}
})
}
onMounted(loadOrder)
</script>
<template>
<div class="detail-page">
<header class="header">
<a-button type="text" @click="router.back()">
<LeftOutlined />
</a-button>
<h1>订单详情</h1>
<a-button type="link" @click="router.push('/orders')">列表</a-button>
</header>
<main class="content">
<a-spin :spinning="loading">
<a-empty v-if="!order" description="未找到订单">
<a-button type="primary" @click="router.push('/orders')">查看订单中心</a-button>
</a-empty>
<template v-else>
<section class="hero-card">
<span class="eyebrow">预约订单</span>
<h2>{{ order.orderNo || `订单 ${order.id}` }}</h2>
<p>{{ order.shopName || '当前门店' }}</p>
<div class="hero-meta">
<strong>{{ formatMoney(order.actualAmount || order.totalAmount) }}</strong>
<span :class="['status-pill', statusClass(order.status)]">{{ order.statusText || '处理中' }}</span>
</div>
</section>
<section class="timeline-card">
<article v-for="node in timeline" :key="node.key" :class="{ done: node.done, active: node.active }">
<strong>{{ node.title }}</strong>
<span>{{ node.text }}</span>
</article>
</section>
<section class="section-card">
<div class="section-head">
<h3>预约项目</h3>
<a-button type="link" @click="router.push({ path: '/service-progress', query: { orderId } })">服务进度</a-button>
</div>
<article v-for="item in items" :key="item.id" class="item-row">
<div class="thumb">
<img v-if="item.productImage" :src="item.productImage" :alt="item.productTitle" loading="lazy" decoding="async" />
<span v-else>{{ String(item.productTitle || '项').slice(0, 1) }}</span>
</div>
<div class="item-main">
<strong>{{ item.productTitle || '预约项目' }}</strong>
<span>{{ formatMoney(item.price) }} x {{ item.quantity || 1 }}</span>
<span v-if="item.artistName">美甲师:{{ item.artistName }}</span>
<span v-if="item.appointmentTime">预约:{{ formatDateTime(item.appointmentTime) }}</span>
</div>
</article>
</section>
<section v-if="contact" class="section-card">
<h3>联系信息</h3>
<p>{{ contact.contactName || contact.roleLabel || '服务联系人' }}</p>
<p v-if="contact.phoneAvailable && contact.phone">电话:{{ contact.phone }}</p>
<p v-if="contact.wechatAvailable && contact.wechatId">微信:{{ contact.wechatId }}</p>
<p v-if="contact.platformContactText">{{ contact.platformContactText }}</p>
</section>
<section v-if="afterSales.length || changeRequests.length || reviews.length" class="section-card">
<h3>关联记录</h3>
<p v-for="item in afterSales" :key="`as-${item.id}`">售后 {{ item.afterSaleNo || item.id }}:{{ item.status || '-' }}</p>
<p v-for="item in changeRequests" :key="`change-${item.id}`">改派:{{ item.statusText || item.status || '-' }}</p>
<p v-for="item in reviews" :key="`review-${item.id}`">评价:{{ item.statusText || item.rating || '待评价' }}</p>
</section>
<section class="action-bar">
<a-button v-if="canPreparePayment" @click="preparePayment">准备支付</a-button>
<a-button v-if="canMockPay" type="primary" @click="mockPay">模拟支付</a-button>
<a-button v-if="canApplyAfterSale" @click="router.push({ path: '/after-sale/apply', query: { orderId } })">申请售后</a-button>
<a-button v-if="order.status === 1" danger @click="cancelOrder">取消订单</a-button>
</section>
</template>
</a-spin>
</main>
</div>
</template>
<style scoped>
.detail-page { min-height: 100vh; padding-top: 60px; background: var(--theme-page-bg); color: var(--text-primary); }
.header { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 9px 14px; background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent); border-bottom: 1px solid var(--theme-border); backdrop-filter: blur(14px); }
.header h1 { margin: 0; font-size: 18px; }
.content { padding: 16px 14px 28px; }
.hero-card, .section-card, .timeline-card { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; background: var(--theme-gradient-soft); }
.eyebrow { display: block; color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card p { margin: 0; color: var(--text-secondary); }
.hero-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.hero-meta strong { font-size: 22px; }
.status-pill { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--theme-primary-soft); color: var(--theme-primary); }
.status-pill.cancelled { color: var(--theme-accent); }
.timeline-card { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-top: 14px; background: var(--theme-border); }
.timeline-card article { min-width: 0; padding: 12px 8px; background: var(--theme-card-bg); color: var(--text-secondary); }
.timeline-card article.active { color: var(--theme-primary); }
.timeline-card article.done strong { color: var(--theme-primary); }
.timeline-card strong, .timeline-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline-card strong { font-size: 12px; }
.timeline-card span { margin-top: 4px; font-size: 11px; }
.section-card { margin-top: 14px; padding: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-card h3 { margin: 0 0 12px; font-size: 17px; }
.section-card p { margin: 8px 0 0; color: var(--text-secondary); line-height: 1.6; }
.item-row { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--theme-border); }
.item-row:first-of-type { border-top: 0; padding-top: 0; }
.thumb { width: 64px; height: 64px; flex: 0 0 auto; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: var(--theme-primary-soft); color: var(--theme-primary); font-weight: 700; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-main { display: grid; gap: 5px; min-width: 0; color: var(--text-secondary); font-size: 13px; }
.item-main strong { color: var(--text-primary); font-size: 15px; }
.action-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
:deep(.ant-btn-primary) { background: var(--theme-primary); border-color: var(--theme-primary); }
:deep(.ant-btn-link) { color: var(--theme-primary); }
</style>
File diff suppressed because it is too large Load Diff
@@ -52,7 +52,7 @@
@pressEnter="handleSubmit"
>
<template #prefix>
<LockOutlined style="color: #999" />
<LockOutlined style="color: var(--text-secondary)" />
</template>
</a-input-password>
<div class="password-tip">
@@ -68,7 +68,7 @@
@pressEnter="handleSubmit"
>
<template #prefix>
<LockOutlined style="color: #999" />
<LockOutlined style="color: var(--text-secondary)" />
</template>
</a-input-password>
</a-form-item>
@@ -298,7 +298,7 @@ onUnmounted(() => {
<style scoped>
.mobile-container {
min-height: 100vh;
background: #f5f5f5;
background: var(--theme-page-bg);
}
.header {
@@ -306,8 +306,8 @@ onUnmounted(() => {
justify-content: space-between;
align-items: center;
padding: 10px 15px;
background: white;
border-bottom: 1px solid #f0f0f0;
background: var(--theme-card-bg);
border-bottom: 1px solid var(--theme-border);
}
.header h1 {
@@ -332,12 +332,12 @@ onUnmounted(() => {
.form-card {
border-radius: 16px;
overflow: hidden;
background: white;
background: var(--theme-card-bg);
}
.password-tip {
margin-top: 8px;
color: #999;
color: var(--text-secondary);
font-size: 12px;
}
</style>
File diff suppressed because it is too large Load Diff
+477 -291
View File
@@ -1,38 +1,50 @@
<template>
<div class="mobile-container">
<header class="header">
<a-button class="back-btn" type="text" @click="handleBackClick">
<LeftOutlined :style="{ fontSize: '20px' }" />
<div class="mobile-container product-list-page">
<header class="gallery-header">
<a-button class="icon-btn" type="text" aria-label="返回首页" @click="handleBackClick">
<MenuOutlined />
</a-button>
<h1 v-if="!showSearch">作品列表</h1>
<div v-else class="search-input-container">
<a-input-search
v-model:value="searchKeyword"
placeholder="搜索标题、标签或描述"
class="search-input"
enter-button
@search="handleSearch"
/>
<div class="brand-lockup" aria-label="YumiNail 作品列表">
<span class="brand-kicker">Nail Gallery</span>
<h1>YumiNail</h1>
</div>
<a-button class="search-btn" type="text" @click="toggleSearch">
<SearchOutlined :style="{ fontSize: '20px' }" />
<a-button class="icon-btn icon-btn--bag" type="text" aria-label="前往购物车" @click="router.push('/cart')">
<ShoppingOutlined />
<span class="bag-dot" aria-hidden="true"></span>
</a-button>
</header>
<div class="main-content">
<div class="category-sidebar">
<button
class="category-item"
:class="{ active: selectedCategory === '全部' }"
type="button"
@click="handleCategoryClick('全部')"
>
全部
</button>
<div v-for="group in filterGroups" :key="group.groupName" class="filter-group">
<span class="filter-group__title">{{ group.groupName }}</span>
<main class="gallery-content">
<section class="search-panel" aria-label="作品搜索与筛选">
<div class="search-field">
<SearchOutlined class="search-field__icon" />
<input
v-model="searchKeyword"
class="search-field__input"
type="search"
placeholder="搜索美甲款式..."
@keydown.enter="handleSearch"
/>
<button
v-for="tag in group.tags"
type="button"
class="search-field__action"
@click="handleSearch"
>
搜索
</button>
</div>
<div class="category-rail" aria-label="作品分类">
<button
class="category-item"
:class="{ active: selectedCategory === '全部' }"
type="button"
@click="handleCategoryClick('全部')"
>
全部风格
</button>
<button
v-for="tag in allTags"
:key="tag.id"
class="category-item"
:class="{ active: selectedTagId === String(tag.id) }"
@@ -42,47 +54,60 @@
{{ tag.displayName || tag.tagName }}
</button>
</div>
</section>
<div v-if="activeBannerText" class="page-banner" role="status">
{{ activeBannerText }}
</div>
<div class="product-section">
<a-alert
v-if="activeBannerText"
class="page-banner"
type="info"
show-icon
:message="activeBannerText"
/>
<section class="product-section" aria-label="作品列表">
<div class="product-grid">
<a-card
<article
v-for="item in products"
:key="item.id"
class="product-card"
:body-style="{ padding: '12px' }"
hoverable
role="button"
tabindex="0"
@click="handleProductClick(item)"
@keydown.enter="handleProductClick(item)"
@keydown.space.prevent="handleProductClick(item)"
>
<div class="product-img">
<img
v-if="getProductImages(item).length > 0"
:src="getProductImages(item)[0]"
:alt="item.title || item.name"
class="product-image"
/>
<div v-else class="product-img-placeholder">
<span>{{ (item.title || item.name)?.[0] || '作' }}</span>
<div class="product-media">
<div class="product-img">
<img
v-if="getProductImages(item).length > 0"
:src="getProductImages(item)[0]"
:alt="item.title || item.name"
class="product-image"
loading="lazy"
decoding="async"
/>
<div v-else class="product-img-placeholder">
<span>{{ (item.title || item.name)?.[0] || '作' }}</span>
</div>
</div>
</div>
<div class="product-info">
<p class="name">{{ item.title || item.name }}</p>
<p v-if="item.shopName" class="shop-name">所属店铺:{{ item.shopName }}</p>
<div class="product-meta">
<span class="duration">{{ item.approximateDuration || '时长待定' }}</span>
<div class="stats">
<span>{{ item.likeCount || 0 }} 点赞</span>
<span>{{ item.collectCount || 0 }} 收藏</span>
<div class="product-head">
<div class="product-title-block">
<h2 class="name">{{ item.title || item.name }}</h2>
<p v-if="item.shopName" class="shop-name">{{ item.shopName }}</p>
<div class="duration">
<ClockCircleOutlined />
<span>{{ item.approximateDuration || '时长待定' }}</span>
</div>
</div>
<button
class="cart-btn"
:class="{ 'cart-btn-in-cart': item.inCart }"
type="button"
:aria-label="item.inCart ? '购物车已有' : `加入购物车:${item.title || item.name || '作品'}`"
@click.stop="handleAddToCart(item)"
>
<CheckOutlined v-if="item.inCart" />
<PlusOutlined v-else />
</button>
</div>
<div class="product-tags">
@@ -94,36 +119,26 @@
:style="{
marginRight: '4px',
marginBottom: '4px',
color: tag.textColor || '#333',
backgroundColor: tag.bgColor || '#f0f0f0',
borderColor: tag.borderColor || '#f0f0f0'
color: tag.textColor || 'var(--text-primary)',
backgroundColor: tag.bgColor || 'var(--theme-primary-soft)',
borderColor: tag.borderColor || 'var(--theme-border)'
}"
>
{{ tag.tagName }}
</a-tag>
</template>
<a-tag v-else size="small" color="default">暂无标签</a-tag>
<a-tag v-else size="small" color="default">精选款式</a-tag>
</div>
<div class="price-row">
<div class="card-foot">
<p class="price">¥{{ Number(item.price || 0).toFixed(2) }}</p>
<div class="cart-action">
<span v-if="item.inCart" class="cart-note">购物车已有</span>
<a-button
:type="item.inCart ? 'default' : 'primary'"
size="small"
shape="circle"
class="cart-btn"
:class="{ 'cart-btn-in-cart': item.inCart }"
@click.stop="handleAddToCart(item)"
>
<CheckOutlined v-if="item.inCart" />
<ShoppingCartOutlined v-else />
</a-button>
<div class="stats">
<span><HeartOutlined />{{ item.likeCount || 0 }}</span>
<span><StarOutlined />{{ item.collectCount || 0 }}</span>
</div>
</div>
</div>
</a-card>
</article>
</div>
<div v-if="products.length === 0 && !loading" class="empty-state">
@@ -135,8 +150,8 @@
<div v-if="loading" class="loading-state">
<a-spin />
</div>
</div>
</div>
</section>
</main>
</div>
</template>
@@ -147,7 +162,16 @@
*/
import { onMounted, ref, watch, inject, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { CheckOutlined, LeftOutlined, SearchOutlined, ShoppingCartOutlined } from '@ant-design/icons-vue'
import {
CheckOutlined,
ClockCircleOutlined,
HeartOutlined,
MenuOutlined,
PlusOutlined,
SearchOutlined,
ShoppingOutlined,
StarOutlined
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
/**
* Purpose: ProductVO supports ProductListView.vue by holding or executing the product vo page or API role.
@@ -160,9 +184,9 @@ import { productApi, type ProductVO } from '@/api/product'
*/
import { tagApi, type TagFilterGroupVO, type TagVO } from '@/api/tag'
import { cartApi } from '@/api/cart'
import { fileApi } from '@/api/file'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { fetchCartProductIdSet, hasCartProduct, withAddedCartProduct } from '@/utils/cart-state'
import { getCachedSignedImageUrls, getCachedSignedImageUrlsSync, parseImageFileIds } from '@/utils/signed-image-cache'
/**
* Purpose: ProductListItem supports ProductListView.vue by holding or executing the product list item page or API role.
@@ -207,11 +231,6 @@ const loading = ref(false)
const showSearch = ref(false)
/** searchKeyword is a reactive state variable used by the template and event handlers. */
const searchKeyword = ref('')
/**
* Purpose: imageIdCache supports ProductListView.vue by holding or executing the image id cache 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 imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: imageUrls supports ProductListView.vue by holding or executing the image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
@@ -262,26 +281,16 @@ const loadImageUrls = async (productList: ProductVO[]) => {
continue
}
const ids = product.imageFileIds.split(',').map(id => id.trim()).filter(Boolean)
const urls: string[] = []
for (const id of ids) {
try {
if (!imageIdCache.value[id]) {
imageIdCache.value[id] = await fileApi.getSignedUrl(id) as unknown as string
}
if (imageIdCache.value[id]) {
urls.push(imageIdCache.value[id])
}
} catch (error) {
console.error('获取作品图片失败:', error)
}
const ids = parseImageFileIds(product.imageFileIds)
const cachedUrls = getCachedSignedImageUrlsSync(ids)
if (cachedUrls.length) {
imageUrls.value[String(product.id)] = cachedUrls
}
const urls = await getCachedSignedImageUrls(ids, DEFAULT_PRODUCT_IMAGE)
imageUrls.value[String(product.id)] = urls.length ? urls : [DEFAULT_PRODUCT_IMAGE]
}
}
/** getProductImages is a local helper used by this page script. */
const getProductImages = (product: ProductVO): string[] => imageUrls.value[String(product.id)] || [DEFAULT_PRODUCT_IMAGE]
@@ -430,19 +439,6 @@ const handleSearch = () => {
})
}
/** toggleSearch is a local helper used by this page script. */
const toggleSearch = () => {
showSearch.value = !showSearch.value
if (!showSearch.value) {
searchKeyword.value = ''
useGlobalLoadingForNextRouteSync = true
router.replace({
path: '/products',
query: selectedTagId.value ? { tag: selectedCategory.value, tagId: selectedTagId.value } : {}
})
}
}
/** resetFilters is a local helper used by this page script. */
const resetFilters = () => {
selectedCategory.value = '全部'
@@ -468,318 +464,508 @@ onMounted(async () => {
</script>
<style scoped>
.mobile-container {
padding-top: 58px;
.product-list-page {
--gallery-header-height: 64px;
--gallery-gutter: 20px;
--gallery-surface: color-mix(in srgb, var(--theme-card-bg) 76%, transparent);
--gallery-surface-strong: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
--gallery-border: color-mix(in srgb, var(--theme-border) 72%, var(--theme-card-bg));
--gallery-muted: color-mix(in srgb, var(--text-secondary) 78%, var(--theme-card-bg));
--gallery-shadow: 0 18px 44px color-mix(in srgb, var(--theme-neutral) 11%, transparent);
--gallery-soft-shadow: 0 10px 30px color-mix(in srgb, var(--theme-primary) 14%, transparent);
min-height: 100vh;
padding: var(--gallery-header-height) 0 calc(104px + env(safe-area-inset-bottom, 0px));
color: var(--text-primary);
background:
linear-gradient(rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.92)),
var(--theme-background-image),
var(--theme-page-bg);
background-size: cover, cover, auto;
background-position: center top;
radial-gradient(circle at 18% 5%, color-mix(in srgb, var(--theme-secondary) 22%, transparent) 0, transparent 30%),
radial-gradient(circle at 86% 10%, color-mix(in srgb, var(--theme-primary) 26%, transparent) 0, transparent 34%),
linear-gradient(180deg, color-mix(in srgb, var(--theme-tertiary) 96%, var(--theme-card-bg)) 0%, var(--theme-page-bg) 62%, var(--theme-primary-soft) 100%);
}
.header {
.gallery-header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
height: 58px;
padding: 9px 15px;
border-bottom: 1px solid var(--theme-border);
background: rgba(255, 255, 255, 0.94);
background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent);
box-shadow: 0 10px 28px rgba(122, 67, 88, 0.08);
backdrop-filter: blur(16px);
justify-content: space-between;
width: 100%;
height: var(--gallery-header-height);
padding: 0 var(--gallery-gutter);
border-bottom: 1px solid var(--gallery-border);
background: color-mix(in srgb, var(--theme-tertiary) 86%, transparent);
box-shadow: 0 12px 36px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
backdrop-filter: blur(20px);
}
.header h1 {
margin: 0;
font-size: 18px;
.brand-lockup {
display: grid;
place-items: center;
min-width: 0;
}
.brand-kicker {
color: var(--theme-primary-action);
font-size: 10px;
font-weight: 700;
color: var(--text-primary);
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;
line-height: 1;
letter-spacing: 0;
}
.back-btn,
.search-btn {
width: 40px;
height: 40px;
display: flex;
.icon-btn {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border-radius: 999px;
color: var(--theme-primary);
background: var(--theme-primary-soft);
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 72%, transparent);
box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-primary) 12%, transparent);
}
.back-btn:hover,
.search-btn:hover,
.back-btn:focus,
.search-btn:focus {
.icon-btn:hover,
.icon-btn:focus {
color: var(--theme-accent);
background: var(--theme-primary-soft);
}
.search-input-container {
flex: 1;
margin: 0;
.icon-btn :deep(.anticon) {
font-size: 20px;
}
.search-input :deep(.ant-input),
.search-input :deep(.ant-input-group-addon .ant-btn) {
height: 38px;
.bag-dot {
position: absolute;
top: 10px;
right: 9px;
width: 7px;
height: 7px;
border: 1px solid var(--theme-card-bg);
border-radius: 999px;
background: var(--theme-secondary);
}
.search-input :deep(.ant-input) {
border-color: var(--theme-border);
.gallery-content {
padding: 0 var(--gallery-gutter);
}
.search-panel {
display: grid;
gap: 16px;
margin-bottom: 16px;
}
.search-field {
display: grid;
grid-template-columns: 22px minmax(0, 1fr) auto;
align-items: center;
gap: 10px;
min-height: 56px;
padding: 8px 8px 8px 17px;
border: 1px solid var(--gallery-border);
border-radius: 999px;
background: var(--gallery-surface-strong);
box-shadow: var(--gallery-soft-shadow);
backdrop-filter: blur(16px);
transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.search-field:focus-within {
border-color: var(--theme-primary);
box-shadow: var(--theme-focus-shadow), var(--gallery-soft-shadow);
transform: translateY(-1px);
}
.search-field__icon {
color: var(--theme-primary-action);
font-size: 19px;
}
.search-field__input {
min-width: 0;
border: 0;
outline: 0;
color: var(--text-primary);
background: transparent;
font-size: 15px;
line-height: 1.4;
}
.search-input :deep(.ant-input:hover),
.search-input :deep(.ant-input:focus) {
border-color: var(--theme-primary);
box-shadow: var(--theme-focus-shadow);
.search-field__input::placeholder {
color: var(--gallery-muted);
}
.search-input :deep(.ant-input-group-addon .ant-btn) {
border-color: var(--theme-primary);
background: var(--theme-gradient);
box-shadow: none;
.search-field__action {
min-width: 58px;
height: 38px;
padding: 0 14px;
border: 1px solid color-mix(in srgb, var(--theme-primary) 54%, var(--theme-card-bg));
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 18%, var(--theme-card-bg));
font-size: 13px;
font-weight: 700;
cursor: pointer;
transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.main-content {
.search-field__action:hover,
.search-field__action:focus {
color: var(--theme-card-bg);
background: var(--theme-primary-action);
}
.search-field__action:active {
transform: scale(0.96);
}
.category-rail {
display: flex;
flex-direction: column;
min-height: calc(100vh - 58px);
}
.category-sidebar {
position: sticky;
top: 58px;
z-index: 20;
display: flex;
gap: 8px;
width: 100%;
padding: 10px 14px 11px;
gap: 10px;
overflow-x: auto;
overflow-y: hidden;
background: rgba(255, 255, 255, 0.88);
background: color-mix(in srgb, var(--theme-card-bg) 86%, transparent);
border-bottom: 1px solid var(--theme-border);
box-shadow: 0 8px 22px rgba(122, 67, 88, 0.06);
backdrop-filter: blur(16px);
padding: 1px 0 7px;
scroll-snap-type: x proximity;
scrollbar-width: none;
}
.category-sidebar::-webkit-scrollbar {
.category-rail::-webkit-scrollbar {
display: none;
}
.category-item {
flex: 0 0 auto;
padding: 8px 15px;
min-height: 36px;
padding: 0 18px;
border: 1px solid var(--gallery-border);
border-radius: 999px;
font-size: 13px;
font-weight: 600;
color: var(--theme-accent);
text-align: center;
cursor: pointer;
transition: all 0.2s ease;
background: var(--theme-primary-soft);
border: 1px solid var(--theme-border);
}
.filter-group {
display: inline-flex;
flex: 0 0 auto;
align-items: center;
gap: 8px;
}
.filter-group__title {
flex: 0 0 auto;
color: var(--text-secondary);
font-size: 12px;
background: var(--gallery-surface-strong);
font-size: 13px;
font-weight: 700;
letter-spacing: 0;
cursor: pointer;
scroll-snap-align: start;
transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.category-item:hover {
color: var(--theme-primary);
.category-item:hover,
.category-item:focus {
color: var(--theme-primary-action);
border-color: var(--theme-primary);
transform: translateY(-1px);
}
.category-item.active {
color: #ffffff;
background: var(--theme-gradient);
color: var(--theme-card-bg);
border-color: transparent;
font-weight: 700;
background: var(--theme-primary-action);
box-shadow: var(--theme-button-shadow);
}
.product-section {
flex: 1;
padding: 16px;
overflow-y: auto;
.page-banner {
display: inline-flex;
align-items: center;
max-width: 100%;
min-height: 34px;
margin-bottom: 14px;
padding: 0 14px;
border: 1px solid color-mix(in srgb, var(--theme-secondary) 36%, var(--theme-border));
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-secondary) 16%, var(--theme-card-bg));
font-size: 12px;
font-weight: 700;
line-height: 1.35;
}
.page-banner {
margin-bottom: 16px;
border-radius: 14px;
.product-section {
min-height: 50vh;
}
.product-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
column-count: 2;
column-gap: 10px;
}
.product-card {
border-radius: 18px;
display: inline-block;
width: 100%;
margin: 0 0 10px;
overflow: hidden;
border: 1px solid color-mix(in srgb, var(--theme-card-bg) 70%, var(--theme-border));
border-radius: 24px;
color: inherit;
background: var(--gallery-surface);
box-shadow: var(--gallery-shadow);
backdrop-filter: blur(16px);
cursor: pointer;
break-inside: avoid;
transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.product-card:hover,
.product-card:focus {
border-color: color-mix(in srgb, var(--theme-primary) 58%, var(--theme-border));
box-shadow: 0 22px 52px color-mix(in srgb, var(--theme-primary) 18%, transparent);
transform: translateY(-2px);
outline: 0;
}
.product-media {
padding: 8px 8px 0;
}
.product-img {
width: 100%;
aspect-ratio: 1;
aspect-ratio: 3 / 4;
overflow: hidden;
border-radius: 14px;
background: var(--theme-primary-soft);
border-radius: 20px;
background:
linear-gradient(145deg, var(--theme-primary-soft), color-mix(in srgb, var(--theme-secondary) 18%, var(--theme-card-bg)));
}
.product-card:nth-child(4n + 2) .product-img {
aspect-ratio: 4 / 5;
}
.product-card:nth-child(4n + 3) .product-img {
aspect-ratio: 1 / 1;
}
.product-card:nth-child(4n) .product-img {
aspect-ratio: 3 / 5;
}
.product-image {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.55s ease;
}
.product-card:hover .product-image,
.product-card:focus .product-image {
transform: scale(1.045);
}
.product-img-placeholder {
display: grid;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 40px;
place-items: center;
color: color-mix(in srgb, var(--theme-primary-action) 30%, transparent);
font-family: "Playfair Display", "Times New Roman", serif;
font-size: 42px;
font-weight: 700;
color: rgba(0, 0, 0, 0.18);
}
.product-info {
display: grid;
gap: 10px;
padding: 12px 12px 14px;
}
.product-head {
display: grid;
grid-template-columns: minmax(0, 1fr) 32px;
align-items: start;
gap: 8px;
}
.product-title-block {
min-width: 0;
}
.name {
margin: 12px 0 6px;
font-size: 14px;
font-weight: 700;
color: #1f1f1f;
white-space: nowrap;
display: -webkit-box;
min-width: 0;
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.back-btn {
opacity: 0;
pointer-events: none;
color: var(--text-primary);
font-size: 15px;
font-weight: 800;
line-height: 1.28;
letter-spacing: 0;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.shop-name {
margin: 0 0 6px;
font-size: 12px;
color: var(--text-secondary);
white-space: nowrap;
margin: 5px 0 0;
overflow: hidden;
color: var(--gallery-muted);
font-size: 11px;
line-height: 1.3;
text-overflow: ellipsis;
}
.product-meta {
display: flex;
justify-content: space-between;
gap: 8px;
font-size: 12px;
color: #8b8b9a;
white-space: nowrap;
}
.duration {
display: inline-flex;
align-items: center;
padding: 2px 8px;
border-radius: 999px;
background: var(--theme-primary-soft);
max-width: 100%;
margin-top: 7px;
color: var(--gallery-muted);
font-size: 11px;
line-height: 1.2;
white-space: nowrap;
}
.stats {
display: flex;
gap: 8px;
.duration :deep(.anticon) {
flex: 0 0 auto;
margin-right: 5px;
color: var(--theme-secondary);
font-size: 13px;
}
.cart-btn {
display: inline-grid;
width: 32px;
height: 32px;
place-items: center;
border: 0;
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 28%, var(--theme-card-bg));
box-shadow: 0 8px 18px color-mix(in srgb, var(--theme-primary) 22%, transparent);
cursor: pointer;
transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.cart-btn:hover,
.cart-btn:focus {
color: var(--theme-card-bg);
background: var(--theme-primary-action);
outline: 0;
}
.cart-btn:active {
transform: scale(0.92);
}
.cart-btn-in-cart {
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-secondary) 28%, var(--theme-card-bg));
box-shadow: 0 8px 18px color-mix(in srgb, var(--theme-secondary) 22%, transparent);
}
.product-tags {
margin: 10px 0;
min-height: 26px;
min-height: 24px;
max-height: 54px;
overflow: hidden;
}
.price-row {
.product-tags :deep(.ant-tag) {
max-width: 100%;
border-radius: 999px;
font-size: 11px;
line-height: 20px;
}
.card-foot {
display: flex;
align-items: flex-end;
justify-content: space-between;
align-items: center;
gap: 12px;
gap: 8px;
}
.price {
margin: 0;
font-size: 18px;
font-weight: 700;
color: var(--theme-accent);
}
.cart-action {
display: inline-flex;
align-items: center;
justify-content: flex-end;
gap: 8px;
}
.cart-note {
font-size: 12px;
color: #8c8c8c;
color: var(--theme-primary-action);
font-size: 15px;
font-weight: 800;
line-height: 1;
white-space: nowrap;
}
.cart-btn {
flex-shrink: 0;
.stats {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 6px;
min-width: 0;
color: var(--gallery-muted);
font-size: 11px;
line-height: 1;
}
.cart-btn-in-cart {
color: var(--theme-primary);
border-color: var(--theme-border);
background: var(--theme-primary-soft);
.stats span {
display: inline-flex;
align-items: center;
gap: 3px;
white-space: nowrap;
}
.stats :deep(.anticon) {
color: var(--theme-secondary);
font-size: 12px;
}
.empty-state,
.loading-state {
padding: 56px 0;
padding: 58px 0;
text-align: center;
}
@media (min-width: 992px) {
.main-content {
max-width: var(--frontend-content-max-width);
margin: 0 auto;
width: 100%;
.empty-state :deep(.ant-empty-description) {
color: var(--text-secondary);
}
.empty-state :deep(.ant-btn-primary) {
border-color: transparent;
background: var(--theme-primary-action);
box-shadow: var(--theme-button-shadow);
}
@media (max-width: 360px) {
.product-list-page {
--gallery-gutter: 14px;
}
.category-sidebar {
width: 100%;
border-radius: 0;
.search-field {
grid-template-columns: 20px minmax(0, 1fr) auto;
gap: 7px;
padding-left: 14px;
}
.product-section {
padding: 24px;
.search-field__action {
min-width: 50px;
padding: 0 11px;
}
.product-grid {
grid-template-columns: repeat(4, minmax(0, 1fr));
column-gap: 8px;
}
.product-info {
padding-right: 10px;
padding-left: 10px;
}
}
@media (min-width: 768px) {
.gallery-header {
top: 0;
left: 50%;
width: min(100%, var(--frontend-page-max-width), calc(100vw - 48px));
border-top-left-radius: 32px;
border-top-right-radius: 32px;
transform: translateX(-50%);
}
}
</style>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,147 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { afterSaleApi, orderApi } from '../api/order'
import type { AfterSaleVO, OrderArtistChangeRequestVO, OrderArtistReviewVO } from '../api/order'
const route = useRoute()
const router = useRouter()
const loading = ref(false)
const order = ref<any | null>(null)
const reviews = ref<OrderArtistReviewVO[]>([])
const changes = ref<OrderArtistChangeRequestVO[]>([])
const afterSales = ref<AfterSaleVO[]>([])
const orderId = computed(() => String(route.query.orderId || route.params.id || ''))
const items = computed(() => Array.isArray(order.value?.items) ? order.value.items : [])
const firstAppointment = computed(() => items.value.map((item: any) => item.appointmentTime).find(Boolean))
const formatTime = (value?: string) => value ? String(value).replace('T', ' ').slice(0, 16) : '--'
const latestChangeText = computed(() => {
const latest = changes.value.slice().sort((left: any, right: any) => String(right.updateTime || right.createTime || '').localeCompare(String(left.updateTime || left.createTime || '')))[0] as any
return latest ? (latest.statusText || latest.status || '改派记录') : '暂无改派'
})
const nodes = computed(() => {
const current = order.value || {}
const status = Number(current.status)
return [
{ key: 'created', title: '订单创建', desc: formatTime(current.createTime), done: true, active: false },
{ key: 'appointment', title: '预约确认', desc: formatTime(firstAppointment.value), done: Boolean(firstAppointment.value), active: status === 1 },
{ key: 'artist', title: '服务安排', desc: latestChangeText.value, done: changes.value.length > 0 || items.value.some((item: any) => item.artistName), active: changes.value.some(item => item.status === 'PENDING') },
{ key: 'service', title: status === 3 ? '订单取消' : '服务完成', desc: formatTime(current.completeTime || current.cancelTime || current.updateTime), done: status === 2 || status === 3, active: status === 2 || status === 3 },
{ key: 'after-sale', title: '售后/评价', desc: afterSales.value.length ? `${afterSales.value.length} 条售后` : (reviews.value.length ? `${reviews.value.length} 条评价` : '暂无记录'), done: afterSales.value.length > 0 || reviews.value.length > 0, active: afterSales.value.some(item => item.status === 'PENDING') || reviews.value.some(item => !item.rating) }
]
})
const loadProgress = async () => {
if (!orderId.value) return
loading.value = true
try {
const [detail, reviewList, changeList, afterSalePage] = await Promise.all([
orderApi.getOrderDetail(orderId.value),
orderApi.getOrderReviews(orderId.value).catch(() => []),
orderApi.getOrderArtistChangeRequests(orderId.value).catch(() => []),
afterSaleApi.listMy({ page: 1, size: 50 }).catch(() => ({ list: [] }))
])
order.value = detail
reviews.value = reviewList || []
changes.value = changeList || []
afterSales.value = ((afterSalePage as any)?.list || []).filter((item: AfterSaleVO) => String(item.orderId) === orderId.value)
} catch (error: any) {
order.value = null
message.error(error?.message || '服务进度加载失败')
} finally {
loading.value = false
}
}
onMounted(loadProgress)
</script>
<template>
<div class="progress-page">
<header class="header">
<a-button type="text" @click="router.back()">
<LeftOutlined />
</a-button>
<h1>服务进度</h1>
<a-button type="link" @click="loadProgress">刷新</a-button>
</header>
<main class="content">
<section class="hero-card">
<span>进度追踪</span>
<h2>{{ order?.orderNo || (orderId ? `订单 ${orderId}` : '选择订单') }}</h2>
<p>{{ order?.shopName || '查看预约、服务、评价与售后节点' }}</p>
</section>
<a-spin :spinning="loading">
<a-empty v-if="!orderId" description="缺少订单参数">
<a-button type="primary" @click="router.push('/orders')">选择订单</a-button>
</a-empty>
<template v-else>
<section class="progress-list">
<article v-for="node in nodes" :key="node.key" :class="{ done: node.done, active: node.active }">
<i />
<div>
<strong>{{ node.title }}</strong>
<span>{{ node.desc }}</span>
</div>
</article>
</section>
<section v-if="items.length" class="section-card">
<h3>项目进度</h3>
<p v-for="item in items" :key="item.id">
{{ item.productTitle || '预约项目' }}:{{ item.artistName || '待安排美甲师' }},{{ formatTime(item.appointmentTime) }}
</p>
</section>
<section v-if="changes.length" class="section-card">
<h3>改派记录</h3>
<p v-for="item in changes" :key="item.id">{{ item.statusText || item.status }}:{{ item.reason || item.timeImpactText || '已记录' }}</p>
</section>
<section v-if="afterSales.length" class="section-card">
<h3>售后记录</h3>
<p v-for="item in afterSales" :key="item.id">{{ item.afterSaleNo || item.id }}:{{ item.status || '-' }}</p>
</section>
<div class="actions">
<a-button @click="router.push(`/orders/${orderId}`)">订单详情</a-button>
<a-button type="primary" @click="router.push({ path: '/after-sale/apply', query: { orderId } })">申请售后</a-button>
</div>
</template>
</a-spin>
</main>
</div>
</template>
<style scoped>
.progress-page { min-height: 100vh; padding-top: 60px; background: var(--theme-page-bg); color: var(--text-primary); }
.header { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 9px 14px; background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent); border-bottom: 1px solid var(--theme-border); backdrop-filter: blur(14px); }
.header h1 { margin: 0; font-size: 18px; }
.content { padding: 16px 14px 32px; }
.hero-card, .section-card, .progress-list { border: 1px solid var(--theme-border); border-radius: 20px; background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent); box-shadow: 0 18px 44px rgba(74, 68, 63, 0.08); }
.hero-card { padding: 22px; margin-bottom: 14px; background: var(--theme-gradient-soft); }
.hero-card span { color: var(--theme-primary); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.hero-card h2 { margin: 10px 0 6px; font-size: 24px; }
.hero-card p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.progress-list { display: grid; gap: 0; overflow: hidden; }
.progress-list article { display: flex; gap: 12px; padding: 16px; border-top: 1px solid var(--theme-border); }
.progress-list article:first-child { border-top: 0; }
.progress-list i { width: 14px; height: 14px; margin-top: 3px; border-radius: 999px; background: var(--theme-border); box-shadow: 0 0 0 5px var(--theme-primary-soft); }
.progress-list article.done i, .progress-list article.active i { background: var(--theme-primary); }
.progress-list strong, .progress-list span { display: block; }
.progress-list span, .section-card p { margin-top: 6px; color: var(--text-secondary); line-height: 1.6; }
.section-card { margin-top: 14px; padding: 16px; }
.section-card h3 { margin: 0 0 10px; font-size: 17px; }
.section-card p { margin: 8px 0 0; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
:deep(.ant-btn-primary) { background: var(--theme-primary); border-color: var(--theme-primary); }
:deep(.ant-btn-link) { color: var(--theme-primary); }
</style>
+50 -1
View File
@@ -177,7 +177,7 @@ const handleSettingClick = (key: string) => {
.setting-item :deep(.ant-list-item-action) {
margin-left: 8px;
color: #ccc;
color: var(--text-secondary);
}
.setting-icon {
@@ -206,4 +206,53 @@ const handleSettingClick = (key: string) => {
padding: 20px;
text-align: center;
}
.mobile-container {
padding-top: 68px;
background:
radial-gradient(circle at 85% 0%, color-mix(in srgb, var(--theme-primary) 28%, transparent), transparent 32%),
linear-gradient(180deg, color-mix(in srgb, var(--theme-card-bg) 78%, transparent), var(--theme-page-bg));
}
.header {
height: 64px;
padding: 12px 18px 10px;
background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent);
}
.header h1 {
font-size: 17px;
font-weight: 820;
}
.back-btn {
border-radius: 999px;
background: color-mix(in srgb, var(--theme-card-bg) 74%, transparent);
}
.settings-menu {
padding: 18px;
}
.settings-card {
border-radius: 24px;
background: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
box-shadow: 0 20px 42px color-mix(in srgb, var(--theme-neutral) 9%, transparent);
}
.section-title {
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 18%, var(--theme-card-bg));
font-weight: 800;
}
.setting-item {
padding: 18px 16px;
}
.setting-icon {
border-radius: 14px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 22%, var(--theme-card-bg)) !important;
}
</style>
+198 -18
View File
@@ -121,9 +121,42 @@
<a-modal v-model:open="contactOpen" title="一键联系" :footer="null">
<div class="contact-box">
<p class="contact-name">{{ contactInfo.contactName || contactInfo.roleLabel || '联系人' }}</p>
<p>电话联系:{{ contactInfo.phoneAvailable ? contactInfo.phone : '暂无电话' }}</p>
<a-button v-if="contactInfo.phoneAvailable" type="primary" block :href="`tel:${contactInfo.phone}`">拨打电话</a-button>
<a-button block disabled>{{ contactInfo.platformContactText || '平台联系暂未接入' }}</a-button>
<div class="contact-row">
<span>联系电话</span>
<strong>{{ contactInfo.phoneAvailable ? contactInfo.phone : '暂无电话' }}</strong>
</div>
<div class="contact-actions">
<a-button v-if="contactInfo.phoneAvailable" type="primary" :href="`tel:${contactInfo.phone}`">
<PhoneOutlined />
拨号
</a-button>
<a-button v-if="contactInfo.phoneAvailable" @click="copyToClipboard(contactInfo.phone || '', '联系电话')">
<CopyOutlined />
复制电话
</a-button>
</div>
<div class="contact-row">
<span>微信号</span>
<strong>{{ contactInfo.wechatAvailable ? contactInfo.wechatId : '暂无微信' }}</strong>
</div>
<img v-if="contactInfo.wechatQrCode" :src="contactInfo.wechatQrCode" alt="微信二维码" class="contact-qr" />
<div class="contact-actions">
<a-button v-if="contactInfo.wechatAvailable" type="primary" @click="openWechatContact">
<WechatOutlined />
打开微信
</a-button>
<a-button v-if="contactInfo.wechatAvailable" @click="copyToClipboard(contactInfo.wechatId || '', '微信号')">
<CopyOutlined />
复制微信
</a-button>
<a-button v-if="contactInfo.phoneAvailable || contactInfo.wechatAvailable" @click="copyContactInfo">
<CopyOutlined />
一键复制
</a-button>
</div>
<a-button v-if="!contactInfo.phoneAvailable && !contactInfo.wechatAvailable" block disabled>
{{ contactInfo.platformContactText || '平台联系暂未接入' }}
</a-button>
</div>
</a-modal>
@@ -147,7 +180,7 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { CopyOutlined, LeftOutlined, ShopOutlined } from '@ant-design/icons-vue'
import { CopyOutlined, LeftOutlined, PhoneOutlined, ShopOutlined, WechatOutlined } from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
import { fileApi } from '@/api/file'
/**
@@ -371,6 +404,24 @@ const copyToClipboard = async (text: string, type: string) => {
}
}
/** openWechatContact copies the WeChat ID and then asks the browser to open WeChat. */
const openWechatContact = async () => {
const wechatId = contactInfo.value.wechatId
if (!wechatId) return
await copyToClipboard(wechatId, '微信号')
window.location.href = 'weixin://'
}
/** copyContactInfo copies all available contact channels in one action. */
const copyContactInfo = async () => {
const lines = [
contactInfo.value.contactName || contactInfo.value.roleLabel || '联系人',
contactInfo.value.phoneAvailable && contactInfo.value.phone ? `电话:${contactInfo.value.phone}` : '',
contactInfo.value.wechatAvailable && contactInfo.value.wechatId ? `微信:${contactInfo.value.wechatId}` : ''
].filter(Boolean)
await copyToClipboard(lines.join('\n'), '联系方式')
}
/**
* Purpose: loadShopImages supports ShopDetailView.vue by holding or executing the load shop 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.
@@ -516,13 +567,13 @@ onMounted(fetchShopDetail)
font-size: 22px;
font-weight: 700;
margin: 0 0 8px;
color: #172033;
color: var(--text-primary);
cursor: pointer;
}
.shop-address {
font-size: 14px;
color: #667085;
color: var(--text-secondary);
margin: 0;
line-height: 1.5;
cursor: pointer;
@@ -537,7 +588,7 @@ onMounted(fetchShopDetail)
.copy-icon {
font-size: 13px;
margin-left: 6px;
color: #8a94a6;
color: var(--text-secondary);
}
.shop-details {
@@ -575,14 +626,14 @@ onMounted(fetchShopDetail)
.detail-label {
font-size: 13px;
color: #8a94a6;
color: var(--text-secondary);
font-weight: 600;
}
.detail-value {
margin-top: 6px;
font-size: 16px;
color: #172033;
color: var(--text-primary);
line-height: 1.55;
}
@@ -633,7 +684,7 @@ onMounted(fetchShopDetail)
text-align: left;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: #fff;
background: var(--theme-card-bg);
cursor: pointer;
}
@@ -661,7 +712,7 @@ onMounted(fetchShopDetail)
}
.featured-product strong {
color: #172033;
color: var(--text-primary);
font-size: 14px;
}
@@ -685,14 +736,14 @@ onMounted(fetchShopDetail)
padding: 12px;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: #fff;
background: var(--theme-card-bg);
}
.recent-review__head {
display: flex;
justify-content: space-between;
gap: 8px;
color: #172033;
color: var(--text-primary);
}
.recent-review__head span {
@@ -702,7 +753,7 @@ onMounted(fetchShopDetail)
.recent-review p {
margin: 8px 0 6px;
color: #475467;
color: var(--text-secondary);
line-height: 1.5;
}
@@ -713,7 +764,7 @@ onMounted(fetchShopDetail)
.section-title {
font-size: 16px;
font-weight: 700;
color: #172033;
color: var(--text-primary);
margin: 0 0 12px;
}
@@ -775,13 +826,49 @@ onMounted(fetchShopDetail)
.contact-name {
margin: 0;
font-weight: 700;
color: #172033;
color: var(--text-primary);
}
.contact-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 10px 12px;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: var(--theme-primary-soft);
}
.contact-row span {
color: var(--text-secondary);
font-size: 13px;
}
.contact-row strong {
min-width: 0;
overflow-wrap: break-word;
color: var(--text-primary);
}
.contact-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.contact-qr {
width: 128px;
height: 128px;
border: 1px solid var(--theme-border);
border-radius: 8px;
object-fit: cover;
}
.map-summary {
display: grid;
gap: 4px;
color: #475467;
color: var(--text-secondary);
}
.map-frame {
@@ -789,7 +876,7 @@ onMounted(fetchShopDetail)
height: 420px;
border: 0;
border-radius: 10px;
background: #eef2f7;
background: var(--theme-primary-soft);
}
@media (max-width: 640px) {
@@ -830,4 +917,97 @@ onMounted(fetchShopDetail)
padding: 100px 24px 24px;
}
}
.shop-detail {
background:
radial-gradient(circle at 82% 0%, color-mix(in srgb, var(--theme-primary) 26%, transparent), transparent 32%),
linear-gradient(180deg, color-mix(in srgb, var(--theme-card-bg) 76%, transparent), var(--theme-page-bg));
}
.header-bg {
height: 210px;
background: linear-gradient(135deg, color-mix(in srgb, var(--theme-primary) 28%, var(--theme-card-bg)), color-mix(in srgb, var(--theme-secondary) 22%, var(--theme-page-bg)));
}
.header {
color: var(--text-primary);
}
.back-btn {
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 76%, transparent);
box-shadow: 0 12px 24px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
}
.header h1 {
color: var(--text-primary);
font-weight: 820;
}
.shop-content {
padding: 92px 18px 28px;
}
.shop-card {
border: 1px solid var(--theme-border);
border-radius: 28px;
background: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
box-shadow: 0 24px 54px color-mix(in srgb, var(--theme-neutral) 11%, transparent);
}
.shop-card :deep(.ant-card-body) {
padding: 22px;
}
.shop-icon-wrapper {
border-radius: 22px;
background: linear-gradient(135deg, var(--theme-primary-action), var(--theme-secondary));
}
.shop-name {
font-size: 24px;
font-weight: 850;
}
.shop-distance,
.trust-card strong,
.featured-product span,
.recent-review__head span {
color: var(--theme-primary-action);
}
.trust-card,
.featured-product,
.recent-review,
.contact-row {
border-radius: 18px;
background: color-mix(in srgb, var(--theme-card-bg) 86%, var(--theme-primary-soft));
}
.image-carousel,
.carousel-item,
.carousel-image {
border-radius: 22px;
}
.section-title {
font-size: 17px;
font-weight: 820;
}
:deep(.ant-btn-primary) {
border-color: transparent;
background: linear-gradient(135deg, var(--theme-primary-action), var(--theme-secondary));
}
@media (max-width: 640px) {
.shop-content {
padding: 92px 18px 28px;
}
.trust-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
</style>
+89 -13
View File
@@ -161,31 +161,107 @@ onMounted(loadData)
</script>
<style scoped>
.vip-center { min-height: 100vh; background: #f6f7f9; color: #24242a; }
.vip-header { display: flex; gap: 16px; align-items: center; padding: 18px 18px 28px; color: #fff; background: linear-gradient(135deg, #2b2522, #896b48); }
.vip-center { min-height: 100vh; background: var(--theme-page-bg); color: var(--text-primary); }
.vip-header { display: flex; gap: 16px; align-items: center; padding: 18px 18px 28px; color: #fff; background: var(--theme-gradient); }
.vip-header p { margin: 0 0 4px; opacity: .78; }
.vip-header h1 { margin: 0; font-size: 30px; font-weight: 700; }
.back-btn { width: 36px; height: 36px; border: 0; border-radius: 18px; background: rgba(255,255,255,.18); color: #fff; font-size: 28px; line-height: 1; }
.vip-main { padding: 16px; display: grid; gap: 14px; }
.balance-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border-radius: 8px; background: #e5e0d7; }
.balance-panel > div { padding: 18px; background: #fff; }
.balance-panel span, .info-grid span, .history-row span { display: block; color: #7a7d85; font-size: 12px; }
.balance-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border-radius: 8px; background: var(--theme-border); }
.balance-panel > div { padding: 18px; background: var(--theme-card-bg); }
.balance-panel span, .info-grid span, .history-row span { display: block; color: var(--text-secondary); font-size: 12px; }
.balance-panel strong { display: block; margin-top: 8px; font-size: 24px; }
.vip-section { padding: 18px; border-radius: 8px; background: #fff; }
.vip-section { padding: 18px; border-radius: 8px; background: var(--theme-card-bg); border: 1px solid var(--theme-border); }
.vip-section h2 { margin: 0 0 14px; font-size: 17px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-grid strong { display: block; margin-top: 5px; font-size: 14px; }
.benefit { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid #eef0f3; color: #5f626a; }
.benefit { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--theme-border); color: var(--text-secondary); }
.history-list { display: grid; gap: 12px; }
.history-row { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #f0f1f3; }
.history-row { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--theme-border); }
.history-row:last-child { border-bottom: 0; padding-bottom: 0; }
.history-row em { display: block; margin-top: 4px; color: #9699a1; font-style: normal; font-size: 12px; }
.history-row b { color: #2f333a; white-space: nowrap; }
.history-row em { display: block; margin-top: 4px; color: var(--text-secondary); font-style: normal; font-size: 12px; }
.history-row b { color: var(--text-primary); white-space: nowrap; }
.history-row b.income { color: #0f8f63; }
.plan-list { display: grid; gap: 12px; }
.plan-card { padding: 14px; border-radius: 8px; border: 1px solid #eee2d6; background: #fffaf5; }
.plan-card { padding: 14px; border-radius: 8px; border: 1px solid var(--theme-border); background: var(--theme-gradient-soft); }
.plan-card div { display: flex; justify-content: space-between; gap: 12px; }
.plan-card span { color: #9a6a3b; }
.plan-card span { color: var(--theme-primary); }
.plan-card b { display: block; margin-top: 8px; font-size: 18px; }
.plan-card p { margin: 8px 0 0; color: #777; }
.plan-card p { margin: 8px 0 0; color: var(--text-secondary); }
.vip-center {
background:
radial-gradient(circle at 82% 0%, color-mix(in srgb, var(--theme-primary) 26%, transparent), transparent 32%),
linear-gradient(180deg, color-mix(in srgb, var(--theme-card-bg) 72%, transparent), var(--theme-page-bg));
}
.vip-header {
padding: 18px 18px 34px;
color: var(--text-primary);
background: transparent;
}
.vip-header p {
color: var(--theme-secondary);
font-family: Georgia, 'Times New Roman', serif;
font-weight: 800;
}
.vip-header h1 {
font-size: 32px;
font-weight: 860;
}
.back-btn {
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 80%, transparent);
box-shadow: 0 12px 24px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
}
.vip-main {
padding: 0 18px 34px;
gap: 16px;
}
.balance-panel {
gap: 0;
border: 1px solid color-mix(in srgb, var(--theme-secondary) 24%, var(--theme-border));
border-radius: 26px;
background: linear-gradient(135deg, color-mix(in srgb, var(--theme-primary) 20%, var(--theme-card-bg)), color-mix(in srgb, var(--theme-secondary) 18%, var(--theme-card-bg)));
box-shadow: 0 22px 46px color-mix(in srgb, var(--theme-neutral) 10%, transparent);
}
.balance-panel > div {
background: transparent;
}
.balance-panel strong {
color: var(--theme-primary-action);
font-family: Georgia, 'Times New Roman', serif;
}
.vip-section {
border-radius: 24px;
background: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
box-shadow: 0 18px 42px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
}
.vip-section h2 {
font-weight: 820;
}
.info-grid > div,
.history-row,
.plan-card {
border-radius: 18px;
}
.history-row b.income {
color: var(--theme-primary-action);
}
:deep(.ant-btn-primary) {
border-color: transparent;
background: linear-gradient(135deg, var(--theme-primary-action), var(--theme-secondary));
}
</style>
+90 -25
View File
@@ -36,6 +36,8 @@
v-if="getProductImages(item.product).length > 0"
:src="getProductImages(item.product)[0]"
:alt="item.product.title"
loading="lazy"
decoding="async"
/>
<div v-else class="image-placeholder" :style="{ backgroundColor: getRandomColor() }">
<span>{{ item.product.title ? item.product.title[0] : '作' }}</span>
@@ -86,11 +88,11 @@ import 'element-plus/es/components/message/style/css'
*/
import { wishlistApi, type WishlistGroup, type WishlistItem } from '@/api/wishlist'
import { cartApi } from '@/api/cart'
import { fileApi } from '@/api/file'
import type { IdType } from '@/utils/id'
import { sameId } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { fetchCartProductIdSet, hasCartProduct, withAddedCartProduct } from '@/utils/cart-state'
import { getCachedSignedImageUrls, getCachedSignedImageUrlsSync, parseImageFileIds } from '@/utils/signed-image-cache'
/**
* Purpose: router supports WishlistView.vue by holding or executing the router page or API role.
@@ -110,11 +112,6 @@ const updateCartCount = inject<() => Promise<void>>('updateCartCount', async ()
const wishlistItems = ref<WishlistItem[]>([])
const groups = ref<WishlistGroup[]>([])
const activeGroupId = ref<IdType | null>(null)
/**
* Purpose: imageIdCache supports WishlistView.vue by holding or executing the image id cache 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 imageIdCache = ref<Record<string, string>>({})
/**
* Purpose: imageUrls supports WishlistView.vue by holding or executing the image urls page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
@@ -162,33 +159,19 @@ const fetchWishlist = async () => {
const loadImageUrls = async (items: WishlistItem[]) => {
for (const item of items) {
if (item.product.imageFileIds) {
const ids = item.product.imageFileIds.split(',')
const urls: string[] = []
for (const id of ids) {
if (id) {
try {
if (!imageIdCache.value[id]) {
const response = await fileApi.getSignedUrl(id.trim()) as any
imageIdCache.value[id] = response
}
if (imageIdCache.value[id]) {
urls.push(imageIdCache.value[id] as string)
}
} catch (error) {
console.error('获取签名链接失败:', error)
urls.push(DEFAULT_PRODUCT_IMAGE)
}
}
const ids = parseImageFileIds(item.product.imageFileIds)
const cachedUrls = getCachedSignedImageUrlsSync(ids)
if (cachedUrls.length) {
imageUrls.value[String(item.product.id)] = cachedUrls
}
const urls = await getCachedSignedImageUrls(ids, DEFAULT_PRODUCT_IMAGE)
imageUrls.value[String(item.product.id)] = urls.length ? urls : [DEFAULT_PRODUCT_IMAGE]
} else {
imageUrls.value[String(item.product.id)] = [DEFAULT_PRODUCT_IMAGE]
}
}
}
/** getProductImages is a local helper used by this page script. */
const getProductImages = (product: any): string[] => {
return imageUrls.value[String(product.id)] || [DEFAULT_PRODUCT_IMAGE]
@@ -455,4 +438,86 @@ onMounted(() => {
--el-button-hover-border-color: var(--theme-border);
--el-button-hover-text-color: var(--theme-accent);
}
.mobile-container {
padding-top: 68px;
background:
radial-gradient(circle at 84% 0%, color-mix(in srgb, var(--theme-primary) 26%, transparent), transparent 32%),
linear-gradient(180deg, color-mix(in srgb, var(--theme-card-bg) 76%, transparent), var(--theme-page-bg));
}
.header {
height: 64px;
padding: 12px 18px 10px;
background: color-mix(in srgb, var(--theme-card-bg) 92%, transparent);
}
.header h1 {
font-size: 17px;
font-weight: 820;
}
.back-btn {
border-radius: 999px;
background: color-mix(in srgb, var(--theme-card-bg) 74%, transparent);
}
.group-tabs {
padding: 16px 18px 0;
}
.group-tab {
height: 34px;
border-radius: 999px;
background: color-mix(in srgb, var(--theme-card-bg) 84%, transparent);
}
.group-tab--active {
border-color: color-mix(in srgb, var(--theme-primary) 40%, var(--theme-border));
background: color-mix(in srgb, var(--theme-primary) 20%, var(--theme-card-bg));
color: var(--theme-primary-action);
}
.wishlist-items {
padding: 18px;
}
.wishlist-item {
border-radius: 24px;
background: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
box-shadow: 0 18px 42px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
}
.item-image {
width: 92px;
height: 92px;
border-radius: 18px;
}
.item-name {
font-weight: 820;
}
.item-group {
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary) 18%, var(--theme-card-bg));
}
.item-price {
color: var(--theme-primary-action);
}
.empty-wishlist {
border-radius: 24px;
background: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
box-shadow: 0 18px 42px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
}
:deep(.el-button--primary) {
--el-button-bg-color: var(--theme-primary-action);
--el-button-border-color: var(--theme-primary-action);
--el-button-hover-bg-color: var(--theme-secondary);
--el-button-hover-border-color: var(--theme-secondary);
}
</style>
+248 -155
View File
@@ -112,43 +112,27 @@
</template>
<template v-else>
<div class="mobile-shell">
<div class="mobile-shell mobile-shell--no-tabbar">
<header class="mobile-topbar">
<button class="mobile-icon-btn" type="button" @click="mobileDrawerOpen = true">
<button class="mobile-icon-btn" type="button" aria-label="打开后台导航" @click="mobileDrawerOpen = true">
<MenuOutlined />
</button>
<div class="mobile-title-block">
<span class="mobile-eyebrow">{{ currentMobileSectionLabel }}</span>
<strong class="mobile-title">{{ currentMobileTitle }}</strong>
</div>
<button class="mobile-avatar-btn" type="button" @click="router.push('/admin/profile')">
<a-avatar :size="34" :src="userInfo?.avatar || DEFAULT_AVATAR" />
</button>
<div class="mobile-topbar__actions">
<span class="mobile-role-pill">{{ roleLabel }}</span>
<button class="mobile-avatar-btn" type="button" aria-label="打开账号信息" @click="router.push('/admin/profile')">
<a-avatar :size="32" :src="userInfo?.avatar || DEFAULT_AVATAR" />
</button>
</div>
</header>
<section class="mobile-context">
<div class="mobile-context__primary">{{ currentShopName }}</div>
<div class="mobile-context__secondary">{{ roleLabel }}</div>
</section>
<main class="mobile-content">
<router-view />
</main>
<nav class="mobile-tabbar">
<button
v-for="tab in mobileTabs"
:key="tab.key"
class="mobile-tabbar__item"
:class="{ 'is-active': activeMobileTab === tab.key }"
type="button"
@click="handleMobileTabClick(tab.path)"
>
<component :is="tab.icon" />
<span>{{ tab.label }}</span>
</button>
</nav>
<a-drawer
v-model:open="mobileDrawerOpen"
placement="left"
@@ -244,6 +228,7 @@ import { DEFAULT_AVATAR } from '@/constants'
import { usePermission } from '@/utils/permission'
import { isAllowedForShoplessPlatformAdmin } from '@/utils/platform-admin-permissions'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { notifyShopThemeChanged } from '@/utils/shop-theme'
import { useAdminViewport } from '@/composables/useAdminViewport'
import {
getAdminCurrentShopName,
@@ -322,17 +307,6 @@ const menuItems: AdminMenuItem[] = [
{ key: '/admin/legal-agreements', icon: SafetyCertificateOutlined, label: '协议管理', permissionCode: 'legal_agreement:manage' }
]
/**
* Purpose: mobileTabs supports AdminLayout.vue by holding or executing the mobile tabs 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 mobileTabs = [
{ key: 'workbench', label: '工作台', path: '/admin', icon: HomeOutlined },
{ key: 'orders', label: '订单', path: '/admin/orders', icon: ShoppingOutlined },
{ key: 'manage', label: '经营', path: '/admin/manage', icon: DashboardOutlined },
{ key: 'profile', label: '我的', path: '/admin/profile', icon: UserOutlined }
]
/** isBootstrapAdmin is a reactive state variable used by the template and event handlers. */
const isBootstrapAdmin = computed(() => isBootstrapAdminUser(userInfo.value))
/** isShopAuthorizationExpired is a reactive state variable used by the template and event handlers. */
@@ -374,49 +348,18 @@ const filteredMenuItems = computed(() => {
return visibleItems
})
/** activeMobileTab is a reactive state variable used by the template and event handlers. */
const activeMobileTab = computed(() => {
if (route.path === '/admin' || route.path === '/admin/dashboard') {
return 'workbench'
}
if (route.path.startsWith('/admin/orders')) {
return 'orders'
}
if (
route.path === '/admin/manage' ||
route.path.startsWith('/admin/users') ||
route.path.startsWith('/admin/products') ||
route.path.startsWith('/admin/coupons') ||
route.path.startsWith('/admin/comments') ||
route.path.startsWith('/admin/shops') ||
route.path.startsWith('/admin/permissions') ||
route.path.startsWith('/admin/tags') ||
route.path.startsWith('/admin/nail-artists') ||
route.path.startsWith('/admin/schedules') ||
route.path.startsWith('/admin/after-sales') ||
route.path.startsWith('/admin/inventory') ||
route.path.startsWith('/admin/campaigns')
) {
return 'manage'
}
if (route.path.startsWith('/admin/profile')) {
return 'profile'
}
return 'workbench'
})
/** currentMobileSectionLabel is a reactive state variable used by the template and event handlers. */
const currentMobileSectionLabel = computed(() => {
switch (activeMobileTab.value) {
case 'orders':
return '订单'
case 'manage':
return '经营'
case 'profile':
return '我的'
default:
return '工作台'
if (route.path.startsWith('/admin/orders')) {
return '订单'
}
if (route.path.startsWith('/admin/profile')) {
return '我的'
}
if (route.path !== '/admin') {
return '经营'
}
return '工作台'
})
/** currentMobileTitle is a reactive state variable used by the template and event handlers. */
@@ -471,17 +414,6 @@ const openProfileFromDrawer = () => {
openPathFromDrawer('/admin/profile')
}
/** handleMobileTabClick is a local helper used by this page script. */
const handleMobileTabClick = (path: string) => {
if (isShopAuthorizationExpired.value && userInfo.value?.type !== 4 && path !== '/admin' && path !== '/admin/profile') {
message.warning('授权已到期,请联系管理员')
return
}
if (route.path !== path) {
router.push(path)
}
}
/** handleLogout is a local helper used by this page script. */
const handleLogout = () => {
Modal.confirm({
@@ -545,6 +477,7 @@ const handleShopChange = async (shopId: unknown) => {
persistAdminSession(response as any)
await fetchUserInfo()
await loadUserPermissions()
notifyShopThemeChanged()
})
message.success('门店上下文已切换')
window.location.reload()
@@ -581,6 +514,12 @@ onMounted(async () => {
--admin-sider-width: 240px;
}
.admin-layout--mobile {
width: 100%;
max-width: 100vw;
overflow-x: hidden;
}
.admin-layout--collapsed {
--admin-sider-width: 80px;
}
@@ -773,7 +712,7 @@ onMounted(async () => {
}
.user-dropdown:hover {
background: rgba(204, 123, 95, 0.1);
background: var(--theme-primary-soft);
}
.username {
@@ -789,7 +728,7 @@ onMounted(async () => {
min-height: calc(100vh - 64px);
padding: 24px;
background:
linear-gradient(180deg, #fbf6f0 0%, #f4e8dc 100%);
linear-gradient(180deg, var(--theme-page-bg) 0%, var(--theme-primary-soft) 100%);
transition: margin-left 0.2s;
}
@@ -816,9 +755,19 @@ onMounted(async () => {
}
.mobile-shell {
width: 100%;
max-width: 100vw;
min-height: 100vh;
--admin-mobile-content-bottom: calc(82px + env(safe-area-inset-bottom));
--admin-mobile-fab-bottom: calc(92px + env(safe-area-inset-bottom));
background:
linear-gradient(180deg, var(--admin-mobile-shell-mid) 0 132px, var(--admin-mobile-surface) 132px 100%);
linear-gradient(180deg, var(--admin-mobile-shell-mid) 0 86px, var(--admin-mobile-surface) 86px 100%);
overflow-x: hidden;
}
.mobile-shell--no-tabbar {
--admin-mobile-content-bottom: calc(24px + env(safe-area-inset-bottom));
--admin-mobile-fab-bottom: calc(24px + env(safe-area-inset-bottom));
}
.mobile-topbar {
@@ -827,8 +776,9 @@ onMounted(async () => {
z-index: 120;
display: flex;
align-items: center;
gap: 12px;
padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
justify-content: space-between;
gap: 10px;
padding: calc(10px + env(safe-area-inset-top)) 14px 8px;
background: var(--admin-mobile-shell-glass);
backdrop-filter: blur(16px);
}
@@ -838,92 +788,235 @@ onMounted(async () => {
display: inline-flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
width: 36px;
height: 36px;
padding: 0;
border: 0;
border-radius: 14px;
border-radius: 12px;
background: var(--admin-mobile-shell-soft);
color: #fff8f1;
color: var(--theme-card-bg);
}
.mobile-topbar__actions {
display: inline-flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
.mobile-role-pill {
max-width: 84px;
min-height: 28px;
display: inline-flex;
align-items: center;
padding: 0 9px;
border-radius: 999px;
background: color-mix(in srgb, var(--theme-card-bg) 14%, transparent);
color: color-mix(in srgb, var(--theme-card-bg) 90%, transparent);
font-size: 11px;
font-weight: 600;
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.mobile-title-block {
flex: 1;
min-width: 0;
display: grid;
gap: 4px;
display: none;
gap: 2px;
}
.mobile-eyebrow {
font-size: 11px;
letter-spacing: 0.14em;
font-size: 10px;
letter-spacing: 0.1em;
text-transform: uppercase;
color: rgba(247, 242, 235, 0.68);
color: color-mix(in srgb, var(--theme-card-bg) 68%, transparent);
}
.mobile-title {
color: #f7f2eb;
font-size: 18px;
color: var(--theme-card-bg);
font-size: 16px;
line-height: 1.2;
}
.mobile-context {
padding: 0 16px 16px;
color: #fff8f1;
}
.mobile-context__primary {
font-size: 20px;
font-weight: 700;
line-height: 1.2;
}
.mobile-context__secondary {
margin-top: 4px;
color: rgba(255, 248, 241, 0.74);
font-size: 13px;
}
.mobile-content {
padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
box-sizing: border-box;
width: 100%;
max-width: 100vw;
padding: 12px 14px var(--admin-mobile-content-bottom);
overflow-x: hidden;
}
.mobile-content :deep(*) {
box-sizing: border-box;
}
.admin-layout--mobile :deep(.admin-page-intro),
.admin-layout--mobile :deep(.message-page-head),
.admin-layout--mobile :deep(.page-head > div:first-child),
.admin-layout--mobile :deep(.page-header > div:first-child) {
display: none !important;
}
.admin-layout--mobile :deep(.page-head),
.admin-layout--mobile :deep(.page-header) {
width: 100%;
max-width: 100%;
align-items: stretch;
justify-content: flex-end;
gap: 10px;
margin-bottom: 12px;
}
.admin-layout--mobile :deep(.page-head .search) {
flex: 1 1 auto;
min-width: 0;
width: 100% !important;
}
.mobile-content :deep(.ant-card),
.mobile-content :deep(.ant-alert),
.mobile-content :deep(.ant-form),
.mobile-content :deep(.ant-row),
.mobile-content :deep(.ant-col),
.mobile-content :deep(.ant-table-wrapper) {
max-width: 100%;
min-width: 0;
}
.mobile-content :deep(.ant-card-head-wrapper),
.mobile-content :deep(.ant-card-body),
.mobile-content :deep(.ant-card-extra) {
max-width: 100%;
min-width: 0;
}
.mobile-content :deep(.ant-card-head-wrapper) {
align-items: flex-start;
gap: 8px;
}
.mobile-content :deep(.ant-card-extra) {
overflow: hidden;
}
.mobile-content :deep(.ant-input),
.mobile-content :deep(.ant-input-affix-wrapper),
.mobile-content :deep(.ant-input-number),
.mobile-content :deep(.ant-picker),
.mobile-content :deep(.ant-select),
.mobile-content :deep(.ant-btn) {
max-width: 100%;
}
.mobile-content :deep(.ant-space) {
display: flex;
max-width: 100%;
flex-wrap: wrap;
}
.mobile-content :deep(.ant-space-item) {
max-width: 100%;
}
.mobile-content :deep(.admin-filter-bar) {
width: 100%;
max-width: 100%;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
overflow: hidden;
}
.mobile-content :deep(.admin-filter-bar .ant-input),
.mobile-content :deep(.admin-filter-bar .ant-input-affix-wrapper),
.mobile-content :deep(.admin-filter-bar .ant-input-number),
.mobile-content :deep(.admin-filter-bar .ant-picker),
.mobile-content :deep(.admin-filter-bar .ant-select),
.mobile-content :deep(.admin-filter-bar .ant-btn) {
width: 100% !important;
}
.mobile-content :deep(.admin-filter-bar .ant-picker) {
grid-column: 1 / -1;
}
.mobile-content :deep(.ant-table-wrapper) {
overflow: hidden;
}
.admin-layout :deep(.ant-table-content),
.admin-layout :deep(.ant-table-body) {
width: 100%;
max-width: 100%;
overflow-x: auto;
}
.admin-layout :deep(.ant-table table) {
min-width: 100%;
width: max-content;
table-layout: auto;
}
.admin-layout :deep(.ant-table-cell) {
white-space: nowrap;
word-break: keep-all;
overflow-wrap: normal;
}
.mobile-content :deep(.ant-radio-group) {
max-width: 100%;
display: flex;
flex-wrap: wrap;
}
.mobile-content :deep(.ant-radio-button-wrapper) {
flex: 1 1 auto;
min-width: 0;
padding-inline: 8px;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
}
.mobile-tabbar {
position: fixed;
left: 12px;
right: 12px;
bottom: 12px;
left: 10px;
right: 10px;
bottom: 8px;
z-index: 130;
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px;
padding: 10px;
background: rgba(150, 103, 82, 0.92);
border: 1px solid rgba(255, 248, 241, 0.16);
border-radius: 24px;
box-shadow: 0 16px 40px rgba(146, 103, 82, 0.24);
gap: 4px;
padding: 6px;
background: var(--admin-mobile-shell-glass);
border: 1px solid color-mix(in srgb, var(--theme-card-bg) 16%, transparent);
border-radius: 20px;
box-shadow: var(--theme-button-shadow);
backdrop-filter: blur(18px);
}
.mobile-tabbar__item {
display: grid;
justify-items: center;
gap: 6px;
padding: 10px 4px;
gap: 3px;
padding: 7px 4px;
border: 0;
border-radius: 18px;
border-radius: 16px;
background: transparent;
color: rgba(255, 248, 241, 0.68);
font-size: 12px;
color: color-mix(in srgb, var(--theme-card-bg) 68%, transparent);
font-size: 11px;
}
.mobile-tabbar__item.is-active {
background: rgba(255, 248, 241, 0.16);
color: #fff7ef;
background: color-mix(in srgb, var(--theme-card-bg) 16%, transparent);
color: var(--theme-card-bg);
}
.mobile-tabbar__item :deep(.anticon) {
font-size: 18px;
font-size: 16px;
}
.drawer-account {
@@ -932,10 +1025,10 @@ onMounted(async () => {
gap: 14px;
padding: 18px;
border-radius: 24px;
color: #fff8f1;
color: var(--theme-card-bg);
background:
radial-gradient(circle at top right, rgba(255, 244, 232, 0.2), transparent 42%),
radial-gradient(circle at left top, rgba(232, 195, 169, 0.22), transparent 44%),
radial-gradient(circle at top right, color-mix(in srgb, var(--theme-card-bg) 20%, transparent), transparent 42%),
radial-gradient(circle at left top, color-mix(in srgb, var(--theme-secondary) 22%, transparent), transparent 44%),
linear-gradient(
160deg,
var(--admin-mobile-shell-start) 0%,
@@ -957,7 +1050,7 @@ onMounted(async () => {
.drawer-account__meta {
margin-top: 4px;
font-size: 13px;
color: rgba(255, 248, 241, 0.8);
color: color-mix(in srgb, var(--theme-card-bg) 80%, transparent);
}
.drawer-shop-card {
@@ -995,7 +1088,7 @@ onMounted(async () => {
margin-bottom: 12px;
font-size: 13px;
font-weight: 700;
color: #6f594e;
color: var(--text-primary);
}
.drawer-link {
@@ -1022,7 +1115,7 @@ onMounted(async () => {
height: 42px;
border-radius: 14px;
background: var(--admin-mobile-accent-soft);
color: #9e5a44;
color: var(--theme-primary);
}
.drawer-link__body {
@@ -1044,7 +1137,7 @@ onMounted(async () => {
}
.drawer-link__arrow {
color: #b39384;
color: var(--text-secondary);
}
.mobile-drawer :deep(.ant-drawer-body) {
@@ -1065,42 +1158,42 @@ onMounted(async () => {
.sider :deep(.ant-menu-dark .ant-menu-item),
.sider :deep(.ant-menu-dark .ant-menu-submenu-title) {
color: rgba(255, 248, 241, 0.8);
color: color-mix(in srgb, var(--theme-card-bg) 80%, transparent);
}
.sider :deep(.ant-menu-dark .ant-menu-item:hover),
.sider :deep(.ant-menu-dark .ant-menu-submenu-title:hover) {
color: #fff8f1;
background: rgba(255, 248, 241, 0.12);
color: var(--theme-card-bg);
background: color-mix(in srgb, var(--theme-card-bg) 12%, transparent);
}
.sider :deep(.ant-menu-dark .ant-menu-item-selected) {
color: #fff8f1;
background: rgba(255, 248, 241, 0.18);
color: var(--theme-card-bg);
background: color-mix(in srgb, var(--theme-card-bg) 18%, transparent);
}
.admin-layout :deep(.ant-btn-primary) {
border-color: transparent;
background: linear-gradient(135deg, var(--admin-mobile-accent) 0%, var(--admin-mobile-accent-strong) 100%);
box-shadow: 0 10px 20px rgba(185, 100, 73, 0.18);
background: var(--theme-gradient);
box-shadow: var(--theme-button-shadow);
}
.admin-layout :deep(.ant-btn-primary:hover),
.admin-layout :deep(.ant-btn-primary:focus) {
border-color: transparent;
background: linear-gradient(135deg, #d4866c 0%, #c26e52 100%);
background: linear-gradient(135deg, var(--theme-accent) 0%, var(--theme-secondary) 100%);
}
.admin-layout :deep(.ant-select:not(.ant-select-disabled):hover .ant-select-selector),
.admin-layout :deep(.ant-input:hover),
.admin-layout :deep(.ant-input-affix-wrapper:hover) {
border-color: rgba(204, 123, 95, 0.45);
border-color: var(--theme-primary);
}
.admin-layout :deep(.ant-select-focused .ant-select-selector),
.admin-layout :deep(.ant-input:focus),
.admin-layout :deep(.ant-input-affix-wrapper-focused) {
border-color: rgba(204, 123, 95, 0.6);
box-shadow: 0 0 0 2px rgba(204, 123, 95, 0.12);
border-color: var(--theme-primary);
box-shadow: var(--theme-focus-shadow);
}
</style>
@@ -95,6 +95,7 @@ import { ACCOUNT_REGEX, ACCOUNT_RULE_MESSAGE, sanitizeAccountInput } from '@/uti
import type { IdType } from '@/utils/id'
import { usePermission } from '@/utils/permission'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { resolveAdminLandingPath } from '@/utils/admin-auth-bootstrap'
/**
* Purpose: router supports AdminLoginView.vue by holding or executing the router page or API role.
@@ -312,10 +313,11 @@ const handleLogin = async () => {
message.success('登录成功')
await runWithGlobalLoading(() => loadUserPermissions())
router.push('/admin').catch(err => {
console.error('跳转到首页失败:', err)
window.location.href = '/admin'
const landingPath = resolveAdminLandingPath()
router.push(landingPath).catch(err => {
console.error('跳转到后台默认页面失败:', err)
window.location.href = landingPath
})
} catch (error: any) {
console.error('登录失败:', error)
@@ -368,14 +370,16 @@ const goToFrontend = () => {
.admin-login {
min-height: 100dvh;
background:
radial-gradient(circle at top right, rgba(255, 244, 232, 0.2), transparent 30%),
radial-gradient(circle at left top, rgba(233, 193, 167, 0.18), transparent 38%),
linear-gradient(color-mix(in srgb, var(--theme-page-bg) 74%, transparent), color-mix(in srgb, var(--theme-page-bg) 90%, transparent)),
var(--theme-background-image),
linear-gradient(
160deg,
var(--admin-mobile-shell-start) 0%,
var(--admin-mobile-shell-mid) 56%,
var(--admin-mobile-shell-end) 100%
var(--theme-primary) 0%,
var(--theme-accent) 58%,
color-mix(in srgb, var(--theme-accent) 78%, var(--text-primary)) 100%
);
background-size: cover, cover, auto;
background-position: center top;
display: flex;
align-items: center;
justify-content: center;
@@ -390,7 +394,7 @@ const goToFrontend = () => {
.login-header {
text-align: center;
margin-bottom: 28px;
color: #f7f2eb;
color: var(--text-primary);
}
.login-header h1 {
@@ -408,8 +412,8 @@ const goToFrontend = () => {
.login-card {
border-radius: 24px;
border: 1px solid var(--admin-mobile-border);
box-shadow: 0 24px 50px rgba(146, 103, 82, 0.18);
border: 1px solid var(--theme-border);
box-shadow: var(--theme-button-shadow);
overflow: hidden;
}
@@ -425,46 +429,46 @@ const goToFrontend = () => {
min-height: 36px;
padding: 0 14px;
border-radius: 999px;
color: #7a4058;
background: rgba(255, 255, 255, 0.92);
color: var(--theme-primary);
background: var(--theme-primary-soft);
text-decoration: none;
font-size: 14px;
font-weight: 700;
box-shadow: 0 8px 20px rgba(122, 64, 88, 0.14);
box-shadow: 0 8px 20px color-mix(in srgb, var(--theme-primary) 18%, transparent);
}
.login-footer a:hover {
color: #c6597d;
background: #ffffff;
color: var(--theme-accent);
background: var(--theme-card-bg);
}
.login-card :deep(.ant-card-body) {
background: rgba(255, 250, 244, 0.98);
background: var(--theme-card-bg);
}
.login-card :deep(.ant-btn-primary) {
border-color: transparent;
background: linear-gradient(135deg, var(--admin-mobile-accent) 0%, var(--admin-mobile-accent-strong) 100%);
box-shadow: 0 10px 22px rgba(185, 100, 73, 0.18);
background: var(--theme-gradient);
box-shadow: var(--theme-button-shadow);
}
.login-card :deep(.ant-btn-primary:hover),
.login-card :deep(.ant-btn-primary:focus) {
border-color: transparent;
background: linear-gradient(135deg, #d4866c 0%, #c26e52 100%);
background: linear-gradient(135deg, var(--theme-accent) 0%, var(--theme-secondary) 100%);
}
.login-card :deep(.ant-input:hover),
.login-card :deep(.ant-input-affix-wrapper:hover),
.login-card :deep(.ant-select:not(.ant-select-disabled):hover .ant-select-selector) {
border-color: rgba(204, 123, 95, 0.46);
border-color: var(--theme-primary);
}
.login-card :deep(.ant-input:focus),
.login-card :deep(.ant-input-affix-wrapper-focused),
.login-card :deep(.ant-select-focused .ant-select-selector) {
border-color: rgba(204, 123, 95, 0.62);
box-shadow: 0 0 0 2px rgba(204, 123, 95, 0.12);
border-color: var(--theme-primary);
box-shadow: var(--theme-focus-shadow);
}
@media (max-width: 960px) {
@@ -12,16 +12,16 @@
<a-card :bordered="false">
<template #title v-if="isMobile">售后列表</template>
<template #extra>
<div class="admin-toolbar" :class="{ 'admin-toolbar--stacked': isMobile }">
<a-select
v-model:value="statusFilter"
:options="statusOptions"
:style="isMobile ? { width: '100%' } : { width: '160px' }"
@change="reload"
/>
</div>
</template>
<AdminFilterPanel :active-count="activeFilterCount">
<a-select
v-model:value="statusFilter"
:options="statusOptions"
style="width: 160px"
@change="reload"
/>
<a-button @click="resetFilters">重置筛选</a-button>
</AdminFilterPanel>
<a-table
v-if="!isMobile"
@@ -30,6 +30,7 @@
:loading="loading"
:pagination="pagination"
row-key="id"
:scroll="{ x: 'max-content' }"
@change="handleTableChange"
>
<template #bodyCell="{ column, record }">
@@ -135,6 +136,7 @@ import { adminAfterSaleApi, type AfterSaleVO } from '@/api/admin'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { useAdminViewport } from '@/composables/useAdminViewport'
import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
import AdminFilterPanel from '@/components/admin/AdminFilterPanel.vue'
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { isMobile } = useAdminViewport()
@@ -162,6 +164,8 @@ const detailOpen = computed({
set: value => { if (!value) currentAfterSale.value = null }
})
const activeFilterCount = computed(() => statusFilter.value === 'all' ? 0 : 1)
const visibleAfterSales = computed(() => {
const orderId = route.query.orderId
if (!orderId) {
@@ -230,6 +234,11 @@ const reload = () => {
void loadAfterSales()
}
const resetFilters = () => {
statusFilter.value = 'all'
reload()
}
const handleTableChange = (pag: any) => {
pagination.current = pag.current || 1
pagination.pageSize = pag.pageSize || pagination.pageSize
@@ -8,10 +8,17 @@
<a-button type="primary" @click="openCreate">发布公告</a-button>
</div>
<a-table :columns="columns" :data-source="announcements" :loading="loading" row-key="id">
<a-table
class="announcement-table"
:columns="columns"
:data-source="announcements"
:loading="loading"
row-key="id"
:scroll="{ x: 'max-content' }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'content'">
<span class="ellipsis">{{ record.content }}</span>
<span class="ellipsis">{{ extractRichText(record.content) }}</span>
</template>
<template v-else-if="column.key === 'status'">
<a-tag :color="record.status === 1 ? 'green' : 'default'">{{ record.status === 1 ? '已发布' : '已撤回' }}</a-tag>
@@ -25,13 +32,13 @@
</template>
</a-table>
<a-modal v-model:open="formOpen" title="发布公告" @ok="submit" :confirm-loading="saving">
<a-modal v-model:open="formOpen" title="发布公告" :mask-closable="false" @ok="submit" :confirm-loading="saving">
<a-form layout="vertical">
<a-form-item label="标题">
<a-input v-model:value="form.title" :maxlength="100" />
</a-form-item>
<a-form-item label="内容">
<a-textarea v-model:value="form.content" :rows="4" :maxlength="1000" />
<a-textarea v-model:value="form.content" :rows="4" :maxlength="1000" placeholder="支持 HTML / Markdown,也可以直接输入纯文本" />
</a-form-item>
<a-form-item label="接收范围">
<a-select v-model:value="form.targetType" :options="targetOptions" />
@@ -55,13 +62,14 @@
* AnnouncementsView 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, onMounted, reactive, ref } from 'vue'
import { computed, h, onMounted, reactive, ref } from 'vue'
import { message, Modal } from 'ant-design-vue'
/**
* Purpose: AnnouncementVO supports AnnouncementsView.vue by holding or executing the announcement 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 { adminAnnouncementApi, type AnnouncementVO, type MessageTargetOptionsVO } from '@/api/admin'
import { extractRichText, renderRichContent } from '@/utils/rich-content'
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
@@ -158,7 +166,14 @@ const submit = async () => {
/** preview is a local helper used by this page script. */
const preview = (record: AnnouncementVO) => {
Modal.info({ title: record.title, content: record.content })
Modal.info({
title: record.title,
width: 560,
content: h('div', {
class: 'announcement-preview-content',
innerHTML: renderRichContent(record.content)
})
})
}
/** revoke is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
@@ -175,6 +190,27 @@ onMounted(load)
.admin-page { display: grid; gap: 18px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.page-head h2 { margin: 0 0 4px; }
.page-head p { margin: 0; color: #7a6f68; }
.page-head p { margin: 0; color: var(--text-secondary); }
.ellipsis { display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.announcement-table :deep(.ant-table) { min-width: 880px; }
.announcement-table :deep(.ant-table-cell) { white-space: nowrap; word-break: keep-all; overflow-wrap: normal; }
.announcement-table :deep(.ant-table-content) { overflow-x: auto; }
:global(.announcement-preview-content) { line-height: 1.8; overflow-wrap: break-word; }
:global(.announcement-preview-content *) { max-width: 100%; }
:global(.announcement-preview-content p),
:global(.announcement-preview-content ul),
:global(.announcement-preview-content ol),
:global(.announcement-preview-content blockquote),
:global(.announcement-preview-content pre),
:global(.announcement-preview-content table) { margin: 0 0 12px; }
:global(.announcement-preview-content p:last-child),
:global(.announcement-preview-content ul:last-child),
:global(.announcement-preview-content ol:last-child),
:global(.announcement-preview-content blockquote:last-child),
:global(.announcement-preview-content pre:last-child),
:global(.announcement-preview-content table:last-child) { margin-bottom: 0; }
:global(.announcement-preview-content ul),
:global(.announcement-preview-content ol) { padding-left: 1.25em; }
:global(.announcement-preview-content img) { display: block; max-width: 100%; border-radius: 8px; }
:global(.announcement-preview-content pre) { overflow-x: auto; padding: 10px 12px; border-radius: 8px; background: var(--theme-primary-soft); }
</style>
@@ -14,12 +14,6 @@
<template #title v-if="isMobile">活动列表</template>
<template #extra>
<div class="admin-toolbar" :class="{ 'admin-toolbar--stacked': isMobile }">
<a-select
v-model:value="statusFilter"
:options="statusOptions"
:style="isMobile ? { width: '100%' } : { width: '160px' }"
@change="reload"
/>
<a-button type="primary" @click="openCreateModal">
<template #icon>
<PlusOutlined />
@@ -29,6 +23,16 @@
</div>
</template>
<AdminFilterPanel :active-count="activeFilterCount">
<a-select
v-model:value="statusFilter"
:options="statusOptions"
style="width: 160px"
@change="reload"
/>
<a-button @click="resetFilters">重置筛选</a-button>
</AdminFilterPanel>
<a-table
v-if="!isMobile"
:columns="columns"
@@ -36,6 +40,7 @@
:loading="loading"
:pagination="pagination"
row-key="id"
:scroll="{ x: 'max-content' }"
@change="handleTableChange"
>
<template #bodyCell="{ column, record }">
@@ -140,7 +145,7 @@
</template>
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { computed, onMounted, reactive, ref } from 'vue'
import { message } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import { PlusOutlined } from '@ant-design/icons-vue'
@@ -148,6 +153,7 @@ import { adminCampaignApi, type CampaignRequest, type CampaignVO } from '@/api/a
import { runWithGlobalLoading } from '@/utils/action-loading'
import { useAdminViewport } from '@/composables/useAdminViewport'
import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
import AdminFilterPanel from '@/components/admin/AdminFilterPanel.vue'
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { isMobile } = useAdminViewport()
@@ -189,6 +195,8 @@ const statusOptions = [
{ label: '停用', value: 0 }
]
const activeFilterCount = computed(() => statusFilter.value === 'all' ? 0 : 1)
const columns = [
{ title: '标题', dataIndex: 'title', key: 'title' },
{ title: '场景', dataIndex: 'scene', key: 'scene', width: 120 },
@@ -237,6 +245,11 @@ const reload = () => {
void loadCampaigns()
}
const resetFilters = () => {
statusFilter.value = 'all'
reload()
}
const handleTableChange = (pag: any) => {
pagination.current = pag.current || 1
pagination.pageSize = pag.pageSize || pagination.pageSize
@@ -8,13 +8,13 @@
<a-input-search v-model:value="keyword" class="search" allow-clear placeholder="搜索评论内容" @search="loadComments" />
</header>
<div class="admin-filter-bar">
<AdminFilterPanel :active-count="activeFilterCount">
<a-input v-model:value="shopKeyword" allow-clear placeholder="店铺" style="width: 160px" @pressEnter="loadComments" />
<a-input v-model:value="productKeyword" allow-clear placeholder="作品" style="width: 160px" @pressEnter="loadComments" />
<a-input v-model:value="userKeyword" allow-clear placeholder="用户" style="width: 160px" @pressEnter="loadComments" />
<a-range-picker v-model:value="createdRange" value-format="YYYY-MM-DD HH:mm:ss" show-time />
<a-button @click="resetFilters">重置筛选</a-button>
</div>
</AdminFilterPanel>
<a-table
:columns="columns"
@@ -22,6 +22,7 @@
:loading="loading"
:pagination="{ pageSize: 10 }"
row-key="id"
:scroll="{ x: 'max-content' }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'commentContent'">
@@ -49,6 +50,7 @@ import { message } from 'ant-design-vue'
*/
import { adminCommentApi, type AdminCommentVO } from '@/api/admin'
import type { IdType } from '@/utils/id'
import AdminFilterPanel from '@/components/admin/AdminFilterPanel.vue'
/**
* Purpose: loading supports CommentsView.vue by holding or executing the loading page or API role.
@@ -85,6 +87,13 @@ const createdRange = ref<[string, string] | undefined>()
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const comments = ref<AdminCommentVO[]>([])
const activeFilterCount = computed(() => [
keyword.value,
shopKeyword.value,
productKeyword.value,
userKeyword.value,
createdRange.value?.length ? 'date' : ''
].filter(Boolean).length)
/**
* Purpose: columns supports CommentsView.vue by holding or executing the columns page or API role.
@@ -188,36 +197,49 @@ onMounted(loadComments)
.page-head h2 {
margin: 0;
font-size: 22px;
color: #20232a;
color: var(--text-primary);
}
.page-head p {
margin: 6px 0 0;
color: #687385;
color: var(--text-secondary);
}
.search {
width: min(360px, 100%);
}
.admin-filter-bar {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.comment-cell {
display: grid;
gap: 6px;
}
.comment-cell strong {
color: #20232a;
color: var(--text-primary);
font-weight: 600;
}
.comment-cell span {
color: #7b8494;
color: var(--text-secondary);
font-size: 12px;
}
@media (max-width: 960px) {
.comments-page {
gap: 12px;
}
.page-head {
align-items: stretch;
}
.page-head > div {
display: none;
}
.search {
width: 100%;
}
}
</style>
@@ -38,6 +38,7 @@
:loading="loading"
:pagination="pagination"
row-key="id"
:scroll="{ x: 'max-content' }"
@change="handleTableChange"
>
<template #bodyCell="{ column, record }">
@@ -2,12 +2,6 @@
<div class="dashboard">
<a-page-header v-if="!isMobile" title="仪表盘" :sub-title="pageSubtitle" />
<section v-else class="admin-page-intro">
<span class="admin-page-intro__eyebrow">工作台</span>
<h1 class="admin-page-intro__title">仪表盘</h1>
<p class="admin-page-intro__subtitle">{{ pageSubtitle }}</p>
</section>
<a-alert
v-if="currentUser?.shopAuthorizationExpired && currentUser?.type !== 4"
class="auth-alert"
@@ -17,10 +11,165 @@
description="当前店铺业务功能已被临时禁用,后台仅保留首页、账号信息和退出登录等基础能力。"
/>
<template v-if="isMobile">
<a-spin :spinning="loading">
<section class="mobile-dashboard">
<div class="mobile-dashboard-hero">
<div class="mobile-dashboard-hero__head">
<div>
<span class="mobile-dashboard-hero__eyebrow">今日经营</span>
<h2>{{ mobileScopeLabel }}</h2>
</div>
<span class="mobile-dashboard-hero__chip">{{ countText(stats.todayOrders) }} 单</span>
</div>
<div class="mobile-dashboard-hero__main">
<span>今日订单额</span>
<strong>¥{{ moneyText(stats.todayOrderAmount) }}</strong>
</div>
<div class="mobile-dashboard-hero__stats">
<div v-for="item in mobileHeroStats" :key="item.label">
<span>{{ item.label }}</span>
<strong>{{ item.value }}</strong>
</div>
</div>
</div>
<section class="mobile-dashboard-section">
<div class="mobile-dashboard-section__head">
<div>
<span>核心指标</span>
<strong>经营快照</strong>
</div>
<small>{{ mobileStatusText }}</small>
</div>
<div class="mobile-kpi-grid">
<div
v-for="item in mobileKpis"
:key="item.key"
class="mobile-kpi-card"
:class="item.tone ? `mobile-kpi-card--${item.tone}` : ''"
>
<div class="mobile-kpi-card__icon">
<component :is="item.icon" />
</div>
<div class="mobile-kpi-card__body">
<span>{{ item.label }}</span>
<strong>{{ item.value }}</strong>
<small>{{ item.hint }}</small>
</div>
</div>
</div>
</section>
<section class="mobile-dashboard-section">
<div class="mobile-dashboard-section__head">
<div>
<span>转化链路</span>
<strong>从浏览到完成</strong>
</div>
</div>
<div class="mobile-flow">
<div v-for="item in conversionStats" :key="item.key" class="mobile-flow__item">
<span>{{ item.label }}</span>
<strong>{{ item.value }}</strong>
</div>
</div>
<div class="mobile-insight-grid">
<div v-for="item in conversionInsights" :key="item.label">
<span>{{ item.label }}</span>
<strong>{{ item.value }}</strong>
</div>
</div>
</section>
<section class="mobile-dashboard-section">
<div class="mobile-dashboard-section__head">
<div>
<span>待办与资产</span>
<strong>需要关注的数字</strong>
</div>
</div>
<div class="mobile-queue-list">
<div v-for="item in workQueueItems" :key="item.label" class="mobile-queue-item">
<div>
<span>{{ item.label }}</span>
<small>{{ item.hint }}</small>
</div>
<strong>{{ item.value }}</strong>
</div>
</div>
</section>
<section class="mobile-dashboard-section">
<div class="mobile-dashboard-section__head">
<div>
<span>快捷跳转</span>
<strong>常用管理入口</strong>
</div>
</div>
<div class="mobile-action-grid">
<button v-for="item in quickLinks" :key="item.path" type="button" @click="router.push(item.path)">
<component :is="item.icon" />
<span>{{ item.label }}</span>
</button>
</div>
</section>
<section class="mobile-dashboard-section">
<div class="mobile-dashboard-section__head">
<div>
<span>热门作品</span>
<strong>近期互动表现</strong>
</div>
</div>
<div v-if="!mobileHotProducts.length" class="mobile-empty">暂无热门作品数据</div>
<div v-else class="mobile-hot-list">
<div v-for="item in mobileHotProducts" :key="item.id" class="mobile-hot-item">
<div>
<strong>{{ item.title }}</strong>
<span>点赞 {{ item.likeCount || 0 }} · 收藏 {{ item.collectCount || 0 }}</span>
</div>
<b>¥{{ moneyText(Number(item.price || 0)) }}</b>
</div>
</div>
</section>
<section class="mobile-dashboard-section">
<div class="mobile-dashboard-section__head">
<div>
<span>最近动态</span>
<strong>系统与业务更新</strong>
</div>
</div>
<div v-if="!mobileRecentActivities.length" class="mobile-empty">暂无最近动态</div>
<div v-else class="mobile-activity-list">
<div v-for="activity in mobileRecentActivities" :key="activity.id" class="mobile-activity-item">
<span class="mobile-activity-dot" :style="{ backgroundColor: activity.color || 'var(--theme-primary)' }" />
<div>
<strong>{{ activity.title || '系统动态' }}</strong>
<p>{{ activity.description }}</p>
<small>{{ formatTime(activity.time) }}</small>
</div>
</div>
</div>
</section>
</section>
</a-spin>
</template>
<template v-else>
<a-row :gutter="[16, 16]" class="stat-cards">
<a-col v-for="item in primaryStats" :key="item.key" :xs="24" :sm="12" :xl="6">
<a-card class="metric-card">
<a-statistic :title="item.title" :value="item.value" :precision="0" :loading="loading">
<a-statistic
:title="item.title"
:value="item.value"
:precision="item.precision ?? 0"
:suffix="item.suffix"
:loading="loading"
>
<template #prefix>
<component :is="item.icon" />
</template>
@@ -106,6 +255,7 @@
</a-card>
</a-col>
</a-row>
</template>
</div>
</template>
@@ -143,6 +293,15 @@ type StatCard = {
icon: Component
}
type MobileKpi = {
key: string
label: string
value: string
hint: string
icon: Component
tone?: 'accent' | 'warning' | 'success' | 'muted'
}
/**
* Purpose: router supports DashboardView.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.
@@ -235,6 +394,13 @@ const money = (value?: number) => Number(value || 0)
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const numberText = (value?: number) => String(Number(value || 0))
const countText = (value?: number) => Number(value || 0).toLocaleString('zh-CN')
const moneyText = (value?: number) => money(value).toFixed(2)
const ratioText = (value?: number, total?: number) => {
const base = Number(total || 0)
if (!base) return '0%'
return `${((Number(value || 0) / base) * 100).toFixed(1)}%`
}
/**
* Purpose: primaryStats supports DashboardView.vue by holding or executing the primary stats page or API role.
@@ -258,6 +424,115 @@ const analyticsStats = computed<StatCard[]>(() => [
{ key: 'rebooks', title: '复购数', value: Number(analytics.rebookCount || 0), icon: ShoppingOutlined }
])
const mobileScopeLabel = computed(() => {
if (isAdmin.value) return '全平台经营看板'
return currentUser.value?.shopName || '当前店铺经营看板'
})
const mobileStatusText = computed(() => {
const pending = Number(stats.pendingOrders || 0)
return pending > 0 ? `${countText(pending)} 个待处理` : '暂无待处理'
})
const mobileHeroStats = computed(() => [
{ label: '7日订单额', value: `¥${moneyText(stats.weekOrderAmount)}` },
{ label: '待处理', value: `${countText(stats.pendingOrders)} 单` },
{ label: '客户池', value: `${countText(stats.totalCustomers || stats.totalUsers)} 人` }
])
const mobileKpis = computed<MobileKpi[]>(() => [
{
key: 'orders7',
label: '7日新增订单',
value: countText(stats.newOrders7Days),
hint: `今日 ${countText(stats.todayOrders)} 单`,
icon: ShoppingOutlined,
tone: 'accent'
},
{
key: 'pending',
label: '待处理订单',
value: countText(stats.pendingOrders),
hint: Number(stats.pendingOrders || 0) > 0 ? '需要优先跟进' : '当前处理顺畅',
icon: ShoppingCartOutlined,
tone: 'warning'
},
{
key: 'customers',
label: '客户池',
value: countText(stats.totalCustomers || stats.totalUsers),
hint: `今日新增 ${countText(stats.newCustomersToday)}`,
icon: UserOutlined,
tone: 'success'
},
{
key: 'assets',
label: isAdmin.value ? '店铺/作品' : '作品/美甲师',
value: isAdmin.value
? `${countText(stats.totalShops)}/${countText(stats.totalProducts)}`
: `${countText(stats.totalProducts)}/${countText(stats.totalArtists)}`,
hint: isAdmin.value ? '平台资产规模' : '店铺服务资产',
icon: ShopOutlined,
tone: 'muted'
},
{
key: 'traffic',
label: '浏览与收藏',
value: `${countText(analytics.viewCount)}/${countText(analytics.favoriteCount)}`,
hint: `加购 ${countText(analytics.cartCount)}`,
icon: EyeOutlined,
tone: 'accent'
},
{
key: 'reputation',
label: '评价/复购',
value: `${countText(analytics.reviewCount)}/${countText(analytics.rebookCount)}`,
hint: '口碑与回访信号',
icon: StarOutlined,
tone: 'success'
}
])
const conversionStats = computed(() => [
{ key: 'views', label: '浏览', value: countText(analytics.viewCount) },
{ key: 'carts', label: '加购', value: countText(analytics.cartCount) },
{ key: 'orders', label: '下单', value: countText(analytics.orderCount) },
{ key: 'paid', label: '支付', value: countText(analytics.paidOrderCount) },
{ key: 'completed', label: '完成', value: countText(analytics.completedOrderCount) }
])
const conversionInsights = computed(() => [
{ label: '浏览下单率', value: ratioText(analytics.orderCount, analytics.viewCount) },
{ label: '下单支付率', value: ratioText(analytics.paidOrderCount, analytics.orderCount) },
{ label: '支付完成率', value: ratioText(analytics.completedOrderCount, analytics.paidOrderCount) }
])
const workQueueItems = computed(() => [
{
label: '待处理订单',
value: `${countText(stats.pendingOrders)} 单`,
hint: Number(stats.pendingOrders || 0) > 0 ? '建议先处理' : '暂无积压'
},
{
label: '已完成订单',
value: `${countText(stats.completedOrders)} 单`,
hint: `订单完成率 ${ratioText(stats.completedOrders, Number(stats.completedOrders || 0) + Number(stats.pendingOrders || 0))}`
},
{
label: '今日新增客户',
value: `${countText(stats.newCustomersToday)} 人`,
hint: `近7日 ${countText(stats.newCustomers7Days)} 人`
},
{
label: isAdmin.value ? '平台店铺' : '店铺作品',
value: countText(isAdmin.value ? stats.totalShops : stats.totalProducts),
hint: isAdmin.value ? `作品 ${countText(stats.totalProducts)}` : `美甲师 ${countText(stats.totalArtists)}`
}
])
const mobileHotProducts = computed(() => stats.hotProducts.slice(0, 3))
const mobileRecentActivities = computed(() => stats.recentActivities.slice(0, 3))
/**
* Purpose: overviewItems supports DashboardView.vue by holding or executing the overview items 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.
@@ -351,6 +626,377 @@ onMounted(() => {
border-radius: 8px;
}
.mobile-dashboard {
display: grid;
gap: 14px;
}
.mobile-dashboard-hero {
display: grid;
gap: 18px;
padding: 18px;
overflow: hidden;
color: #ffffff;
background:
radial-gradient(circle at 88% 8%, color-mix(in srgb, var(--theme-card-bg) 28%, transparent), transparent 34%),
var(--theme-gradient);
border-radius: 22px;
box-shadow: var(--theme-button-shadow);
}
.mobile-dashboard-hero__head,
.mobile-dashboard-section__head,
.mobile-queue-item,
.mobile-hot-item,
.mobile-activity-item {
display: flex;
gap: 12px;
}
.mobile-dashboard-hero__head,
.mobile-dashboard-section__head,
.mobile-queue-item,
.mobile-hot-item {
align-items: center;
justify-content: space-between;
}
.mobile-dashboard-hero__head > div,
.mobile-dashboard-section__head > div,
.mobile-queue-item > div,
.mobile-hot-item > div,
.mobile-activity-item > div {
min-width: 0;
}
.mobile-dashboard-hero__eyebrow,
.mobile-dashboard-hero__main span,
.mobile-dashboard-hero__stats span {
display: block;
color: rgba(255, 250, 244, 0.76);
font-size: 12px;
}
.mobile-dashboard-hero h2 {
margin: 4px 0 0;
color: #ffffff;
font-size: 20px;
line-height: 1.25;
font-weight: 700;
overflow-wrap: break-word;
}
.mobile-dashboard-hero__chip {
flex-shrink: 0;
max-width: 96px;
padding: 7px 10px;
border: 1px solid rgba(255, 250, 244, 0.22);
border-radius: 999px;
background: rgba(255, 250, 244, 0.16);
color: #ffffff;
font-size: 12px;
text-align: center;
overflow-wrap: break-word;
}
.mobile-dashboard-hero__main strong {
display: block;
margin-top: 6px;
color: #ffffff;
font-size: 34px;
line-height: 1.05;
font-weight: 800;
overflow-wrap: break-word;
}
.mobile-dashboard-hero__stats {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 8px;
}
.mobile-dashboard-hero__stats div {
min-width: 0;
padding: 10px;
border-radius: 16px;
background: rgba(255, 250, 244, 0.14);
}
.mobile-dashboard-hero__stats strong {
display: block;
margin-top: 5px;
color: #ffffff;
font-size: 14px;
line-height: 1.25;
overflow-wrap: break-word;
}
.mobile-dashboard-section {
padding: 16px;
background: var(--theme-card-bg);
border: 1px solid var(--theme-border);
border-radius: 20px;
box-shadow: 0 12px 28px color-mix(in srgb, var(--theme-primary) 8%, transparent);
}
.mobile-dashboard-section__head {
margin-bottom: 14px;
}
.mobile-dashboard-section__head span {
display: block;
color: var(--text-secondary);
font-size: 12px;
}
.mobile-dashboard-section__head strong {
display: block;
margin-top: 3px;
color: var(--text-primary);
font-size: 17px;
line-height: 1.25;
}
.mobile-dashboard-section__head small {
flex-shrink: 0;
max-width: 116px;
color: var(--theme-primary);
font-size: 12px;
text-align: right;
overflow-wrap: break-word;
}
.mobile-kpi-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.mobile-kpi-card {
display: grid;
grid-template-columns: 34px minmax(0, 1fr);
gap: 10px;
min-height: 112px;
padding: 12px;
border: 1px solid var(--theme-border);
border-radius: 16px;
background: var(--theme-primary-soft);
}
.mobile-kpi-card--accent {
background: color-mix(in srgb, var(--theme-accent) 14%, var(--theme-card-bg));
}
.mobile-kpi-card--warning {
background: color-mix(in srgb, #faad14 14%, var(--theme-card-bg));
}
.mobile-kpi-card--success {
background: color-mix(in srgb, #52c41a 12%, var(--theme-card-bg));
}
.mobile-kpi-card--muted {
background: color-mix(in srgb, var(--theme-secondary) 14%, var(--theme-card-bg));
}
.mobile-kpi-card__icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 34px;
height: 34px;
border-radius: 12px;
background: var(--theme-primary-soft);
color: var(--theme-primary);
font-size: 17px;
}
.mobile-kpi-card__body {
min-width: 0;
}
.mobile-kpi-card__body span,
.mobile-kpi-card__body small,
.mobile-hot-item span,
.mobile-activity-item p,
.mobile-activity-item small,
.mobile-queue-item small {
display: block;
color: var(--text-secondary);
font-size: 12px;
line-height: 1.45;
}
.mobile-kpi-card__body strong {
display: block;
margin: 8px 0 4px;
color: var(--text-primary);
font-size: 21px;
line-height: 1.1;
font-weight: 800;
overflow-wrap: break-word;
}
.mobile-flow {
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 6px;
}
.mobile-flow__item {
min-width: 0;
padding: 10px 6px;
border-radius: 14px;
background: var(--theme-primary-soft);
text-align: center;
}
.mobile-flow__item span,
.mobile-insight-grid span,
.mobile-queue-item span {
display: block;
color: var(--text-secondary);
font-size: 12px;
}
.mobile-flow__item strong,
.mobile-insight-grid strong,
.mobile-queue-item strong,
.mobile-hot-item b {
display: block;
color: var(--text-primary);
font-weight: 800;
overflow-wrap: break-word;
}
.mobile-flow__item strong {
margin-top: 5px;
font-size: 14px;
}
.mobile-insight-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 8px;
margin-top: 10px;
}
.mobile-insight-grid div {
min-width: 0;
padding: 10px;
border: 1px solid var(--theme-border);
border-radius: 14px;
background: var(--theme-card-bg);
}
.mobile-insight-grid strong {
margin-top: 5px;
font-size: 16px;
}
.mobile-queue-list,
.mobile-hot-list,
.mobile-activity-list {
display: grid;
gap: 10px;
}
.mobile-queue-item,
.mobile-hot-item,
.mobile-activity-item {
min-width: 0;
padding: 12px 0;
border-top: 1px solid var(--theme-border);
}
.mobile-queue-item:first-child,
.mobile-hot-item:first-child,
.mobile-activity-item:first-child {
padding-top: 0;
border-top: 0;
}
.mobile-queue-item strong {
flex-shrink: 0;
max-width: 112px;
font-size: 18px;
text-align: right;
}
.mobile-action-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px;
}
.mobile-action-grid button {
display: inline-flex;
align-items: center;
gap: 8px;
min-width: 0;
min-height: 52px;
padding: 0 12px;
border: 1px solid var(--theme-border);
border-radius: 16px;
background: var(--theme-primary-soft);
color: var(--text-primary);
font: inherit;
font-size: 13px;
text-align: left;
}
.mobile-action-grid button span {
min-width: 0;
overflow-wrap: break-word;
}
.mobile-action-grid .anticon {
flex-shrink: 0;
color: var(--theme-primary);
font-size: 16px;
}
.mobile-hot-item strong,
.mobile-activity-item strong {
display: block;
color: var(--text-primary);
line-height: 1.35;
overflow-wrap: break-word;
}
.mobile-hot-item b {
flex-shrink: 0;
max-width: 98px;
color: var(--theme-accent);
font-size: 15px;
text-align: right;
}
.mobile-activity-item {
align-items: flex-start;
}
.mobile-activity-dot {
flex: 0 0 9px;
width: 9px;
height: 9px;
margin-top: 5px;
border-radius: 999px;
}
.mobile-activity-item p {
margin: 4px 0;
}
.mobile-empty {
padding: 18px 10px;
border-radius: 16px;
background: var(--theme-primary-soft);
color: var(--text-secondary);
font-size: 13px;
text-align: center;
}
.overview-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
@@ -359,20 +1005,20 @@ onMounted(() => {
.overview-item {
padding: 14px;
border: 1px solid #f0e1d5;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: #fffaf5;
background: var(--theme-card-bg);
}
.overview-item span {
display: block;
color: #8a6b5f;
color: var(--text-secondary);
font-size: 13px;
margin-bottom: 6px;
}
.overview-item strong {
color: #2f211b;
color: var(--text-primary);
font-size: 20px;
}
@@ -392,7 +1038,7 @@ onMounted(() => {
justify-content: space-between;
gap: 12px;
padding: 12px 0;
border-bottom: 1px solid #f1e6dd;
border-bottom: 1px solid var(--theme-border);
}
.hot-item:last-child {
@@ -401,19 +1047,19 @@ onMounted(() => {
.hot-name {
font-weight: 700;
color: #2f211b;
color: var(--text-primary);
}
.hot-meta,
.activity-description,
.activity-time {
color: #8a6b5f;
color: var(--text-secondary);
font-size: 13px;
}
.hot-price {
white-space: nowrap;
color: #c05d3b;
color: var(--theme-accent);
font-weight: 700;
}
@@ -460,7 +460,7 @@ onBeforeUnmount(() => {
.user-details p {
margin: 4px 0;
color: #666;
color: var(--text-secondary);
}
.card-title {
@@ -495,7 +495,7 @@ onBeforeUnmount(() => {
.mobile-permission-group__title {
font-size: 14px;
font-weight: 600;
color: #a45d44;
color: var(--theme-primary);
margin-bottom: 4px;
}
@@ -515,7 +515,7 @@ onBeforeUnmount(() => {
.no-permissions {
text-align: center;
padding: 20px;
color: #999;
color: var(--text-secondary);
}
.quick-actions {
@@ -528,7 +528,7 @@ onBeforeUnmount(() => {
justify-content: center;
height: 80px;
font-size: 32px;
color: #b96449;
color: var(--theme-primary);
background: var(--admin-mobile-accent-soft);
}
@@ -561,7 +561,7 @@ onBeforeUnmount(() => {
height: 42px;
border-radius: 14px;
background: var(--admin-mobile-accent-soft);
color: #9e5a44;
color: var(--theme-primary);
}
.mobile-action__body {
@@ -577,7 +577,7 @@ onBeforeUnmount(() => {
.mobile-action__meta {
margin-top: 4px;
color: #67727a;
color: var(--text-secondary);
font-size: 12px;
}
</style>
@@ -44,6 +44,7 @@
:loading="loading"
:pagination="pagination"
row-key="id"
:scroll="{ x: 'max-content' }"
@change="handleTableChange"
>
<template #bodyCell="{ column, record }">
@@ -8,7 +8,7 @@
<a-button type="primary" @click="openCreate">新增协议</a-button>
</div>
<a-table :columns="columns" :data-source="agreements" :loading="loading" row-key="id" bordered>
<a-table :columns="columns" :data-source="agreements" :loading="loading" row-key="id" :scroll="{ x: 'max-content' }" bordered>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<a-tag :color="record.status === 1 ? 'green' : 'default'">{{ record.statusText || (record.status === 1 ? '已发布' : '草稿/停用') }}</a-tag>
@@ -27,6 +27,7 @@
v-model:open="modalOpen"
:title="editingId ? '编辑协议' : '新增协议'"
width="760px"
:mask-closable="false"
:confirm-loading="saving"
@ok="saveAgreement"
>
@@ -44,7 +45,7 @@
<a-input v-model:value="form.version" placeholder="例如:2026-05-18" />
</a-form-item>
<a-form-item label="内容">
<a-textarea v-model:value="form.content" :rows="12" placeholder="请输入协议正文" />
<a-textarea v-model:value="form.content" :rows="12" placeholder="请输入协议正文,支持 HTML / Markdown" />
</a-form-item>
</a-form>
</a-modal>
@@ -209,5 +210,5 @@ onMounted(loadAgreements)
.admin-page { padding: 16px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.page-header h2 { margin: 0 0 6px; }
.page-header p { margin: 0; color: #8c8c8c; }
.page-header p { margin: 0; color: var(--text-secondary); }
</style>
@@ -1,6 +1,6 @@
<template>
<div class="admin-manage">
<section class="admin-page-intro">
<section class="admin-page-intro admin-manage__intro">
<span class="admin-page-intro__eyebrow">经营</span>
<h1 class="admin-page-intro__title">{{ currentShopName }}</h1>
<div class="admin-page-intro__meta">
@@ -276,7 +276,7 @@ onMounted(() => {
height: 52px;
border-radius: 18px;
background: var(--admin-mobile-accent-soft);
color: #9e5a44;
color: var(--theme-primary);
flex-shrink: 0;
font-size: 20px;
}
@@ -305,8 +305,8 @@ onMounted(() => {
min-height: 28px;
padding: 0 10px;
border-radius: 999px;
background: rgba(215, 108, 84, 0.12);
color: #9a412d;
background: var(--theme-primary-soft);
color: var(--theme-primary);
font-size: 12px;
font-weight: 600;
}
@@ -314,21 +314,92 @@ onMounted(() => {
.module-card__subtitle {
margin-top: 8px;
line-height: 1.6;
color: #66727a;
color: var(--text-secondary);
}
.module-card__hint {
margin-top: 10px;
padding: 10px 12px;
border-radius: 14px;
background: rgba(204, 123, 95, 0.08);
color: #725d51;
background: var(--theme-primary-soft);
color: var(--text-secondary);
line-height: 1.55;
}
@media (max-width: 960px) {
.admin-manage {
gap: 12px;
}
.admin-manage__intro {
display: none;
}
.module-grid {
grid-template-columns: 1fr;
gap: 10px;
}
.module-card {
gap: 12px;
padding: 14px 16px;
border-radius: 18px;
box-shadow: 0 8px 20px rgba(144, 103, 84, 0.07);
}
.module-card:hover {
transform: none;
box-shadow: 0 8px 20px rgba(144, 103, 84, 0.07);
}
.module-card__icon {
width: 44px;
height: 44px;
border-radius: 14px;
font-size: 18px;
}
.module-card__head {
align-items: flex-start;
}
.module-card__title {
font-size: 16px;
line-height: 1.25;
}
.module-card__badge {
min-height: 24px;
padding: 0 8px;
font-size: 11px;
}
.module-card__subtitle {
margin-top: 5px;
font-size: 13px;
line-height: 1.45;
}
.module-card__hint {
margin-top: 8px;
padding: 8px 10px;
border-radius: 12px;
font-size: 13px;
}
}
@media (max-width: 420px) {
.module-card {
padding: 12px 14px;
}
.module-card__icon {
width: 40px;
height: 40px;
}
.module-card__head {
gap: 8px;
}
}
</style>
@@ -37,13 +37,42 @@
</a-form>
</a-card>
<a-card title="用户默认密码" :bordered="false">
<a-form layout="vertical">
<a-alert
type="info"
show-icon
message="后台新增用户时,密码留空会自动使用这里配置的默认密码。"
class="inline-alert"
/>
<a-form-item label="后台新增用户默认密码">
<a-input-password
v-model:value="defaultPasswordForm.configValue"
placeholder="请输入 8-32 位强密码"
autocomplete="new-password"
/>
</a-form-item>
<a-form-item label="备注">
<a-textarea v-model:value="defaultPasswordForm.remark" :rows="2" />
</a-form-item>
<a-form-item>
<a-space>
<a-switch v-model:checked="defaultPasswordEnabled" checked-children="启用" un-checked-children="停用" />
<a-button type="primary" :loading="savingDefaultPassword" @click="saveDefaultPasswordConfig">
保存默认密码
</a-button>
</a-space>
</a-form-item>
</a-form>
</a-card>
<a-alert
type="info"
show-icon
message="这里不配置 Spug、阿里云等供应商密钥;真实短信通道仍在 MessageHub 中独立管理。"
/>
<a-table :columns="columns" :data-source="configs" :loading="loading" row-key="id">
<a-table :columns="columns" :data-source="configs" :loading="loading" row-key="id" :scroll="{ x: 'max-content' }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'scene'">
<strong>{{ record.sceneName }}</strong>
@@ -69,7 +98,7 @@
</template>
</a-table>
<a-modal v-model:open="formOpen" :title="editingId ? '编辑配置' : '新增配置'" @ok="submit" :confirm-loading="saving">
<a-modal v-model:open="formOpen" :title="editingId ? '编辑配置' : '新增配置'" :mask-closable="false" @ok="submit" :confirm-loading="saving">
<a-form layout="vertical">
<a-form-item label="业务场景">
<a-select v-model:value="form.sceneCode" :options="sceneOptions" show-search @change="handleSceneChange" />
@@ -98,7 +127,7 @@
</a-form>
</a-modal>
<a-modal v-model:open="testOpen" title="测试投递" @ok="submitTest" :confirm-loading="testing">
<a-modal v-model:open="testOpen" title="测试投递" :mask-closable="false" @ok="submitTest" :confirm-loading="testing">
<a-form layout="vertical">
<a-form-item label="测试手机号">
<a-input v-model:value="testPhone" :maxlength="11" />
@@ -119,7 +148,12 @@ import { message } from 'ant-design-vue'
* Purpose: MessageHubPushConfigVO supports MessageHubPushConfigsView.vue by holding or executing the message hub push config 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 { adminMessageHubPushConfigApi, adminSystemParameterConfigApi, type MessageHubPushConfigVO } from '@/api/admin'
import {
adminMessageHubPushConfigApi,
adminSystemParameterConfigApi,
type MessageHubPushConfigVO,
type SystemParameterConfigVO
} from '@/api/admin'
/** loading is a reactive state variable used by the template and event handlers. */
const loading = ref(false)
@@ -153,11 +187,13 @@ const configs = ref<MessageHubPushConfigVO[]>([])
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const savingMap = ref(false)
const savingDefaultPassword = ref(false)
/**
* Purpose: mapEnabled supports MessageHubPushConfigsView.vue by holding or executing the map enabled 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 mapEnabled = ref(true)
const defaultPasswordEnabled = ref(true)
/**
* Purpose: mapProvider supports MessageHubPushConfigsView.vue by holding or executing the map provider 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.
@@ -190,6 +226,14 @@ const mapForms = reactive({
amapWeb: createMapForm('AMAP_WEB_KEY', '高德 Web Key', '用于后台高德地图选点和 Web 展示'),
amapMini: createMapForm('AMAP_MINI_KEY', '高德小程序 Key', '用于后续小程序端高德 SDK / API 调用')
})
const defaultPasswordForm = reactive<SystemParameterConfigVO>({
configGroup: 'USER',
configKey: 'DEFAULT_PASSWORD',
configName: '后台新增用户默认密码',
configValue: 'YumiNail@123',
enabled: 1,
remark: '后台新增用户不填写密码时使用;需满足 8-32 位且至少包含数字、小写字母、大写字母、特殊符号中的 3 类'
})
/**
* Purpose: sceneOptions supports MessageHubPushConfigsView.vue by holding or executing the scene options page or API role.
@@ -248,9 +292,10 @@ const columns = [
const load = async () => {
loading.value = true
try {
const [messageConfigs, mapConfigs] = await Promise.all([
const [messageConfigs, mapConfigs, userConfigs] = await Promise.all([
adminMessageHubPushConfigApi.listConfigs(),
adminSystemParameterConfigApi.listConfigs('MAP')
adminSystemParameterConfigApi.listConfigs('MAP'),
adminSystemParameterConfigApi.listConfigs('USER')
])
configs.value = messageConfigs
const providerConfig = mapConfigs.find(item => item.configKey === 'MAP_PROVIDER')
@@ -265,6 +310,11 @@ const load = async () => {
if (tencentMapConfig) Object.assign(mapForms.tencentWeb, tencentMapConfig)
if (amapWebConfig) Object.assign(mapForms.amapWeb, amapWebConfig)
if (amapMiniConfig) Object.assign(mapForms.amapMini, amapMiniConfig)
const defaultPasswordConfig = userConfigs.find(item => item.configKey === 'DEFAULT_PASSWORD')
if (defaultPasswordConfig) {
Object.assign(defaultPasswordForm, defaultPasswordConfig)
defaultPasswordEnabled.value = defaultPasswordConfig.enabled === 1
}
} finally {
loading.value = false
}
@@ -301,6 +351,43 @@ const saveMapConfig = async () => {
}
}
const validateDefaultPasswordInput = () => {
const password = defaultPasswordForm.configValue.trim()
if (password.length < 8 || password.length > 32) {
message.warning('默认密码长度需为 8-32 位')
return false
}
const categoryCount = [
/\d/.test(password),
/[a-z]/.test(password),
/[A-Z]/.test(password),
/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)
].filter(Boolean).length
if (categoryCount < 3) {
message.warning('默认密码需至少包含数字、小写字母、大写字母、特殊符号中的 3 类')
return false
}
return true
}
const saveDefaultPasswordConfig = async () => {
if (!validateDefaultPasswordInput()) {
return
}
savingDefaultPassword.value = true
try {
await adminSystemParameterConfigApi.saveConfig({
...defaultPasswordForm,
configValue: defaultPasswordForm.configValue.trim(),
enabled: defaultPasswordEnabled.value ? 1 : 0
})
message.success('默认密码已保存')
await load()
} finally {
savingDefaultPassword.value = false
}
}
/** resetForm is a local helper used by this page script. */
const resetForm = () => Object.assign(form, {
sceneCode: 'USER_LOGIN_SMS_CODE',
@@ -388,5 +475,6 @@ onMounted(load)
.admin-page { display: grid; gap: 18px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.page-head h2 { margin: 0 0 4px; }
.page-head p, .muted { margin: 0; color: #7a6f68; }
.page-head p, .muted { margin: 0; color: var(--text-secondary); }
.inline-alert { margin-bottom: 16px; }
</style>
@@ -36,6 +36,7 @@
:pagination="pagination"
@change="handleTableChange"
row-key="userId"
:scroll="{ x: 'max-content' }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
@@ -26,16 +26,16 @@
placeholder="搜索订单号、用户 ID 或优惠券"
@search="loadOrders"
/>
<a-select
v-model:value="statusFilter"
:options="statusOptions"
:style="isMobile ? { width: '100%' } : { width: '160px' }"
@change="loadOrders"
/>
</div>
</template>
<div class="admin-filter-bar">
<AdminFilterPanel :active-count="activeFilterCount">
<a-select
v-model:value="statusFilter"
:options="statusOptions"
style="width: 160px"
@change="loadOrders"
/>
<a-select
v-model:value="shopFilter"
:allow-clear="currentUserType === 4"
@@ -60,9 +60,9 @@
<a-input-number v-model:value="minAmount" :min="0" placeholder="最低金额" style="width: 120px" />
<a-input-number v-model:value="maxAmount" :min="0" placeholder="最高金额" style="width: 120px" />
<a-button @click="resetFilters">重置筛选</a-button>
</div>
</AdminFilterPanel>
<a-table v-if="!isMobile" :columns="columns" :data-source="filteredOrders" :loading="loading" row-key="id">
<a-table v-if="!isMobile" :columns="columns" :data-source="filteredOrders" :loading="loading" row-key="id" :scroll="{ x: 'max-content' }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<a-tag :color="statusColor(record.status)">{{ record.statusText }}</a-tag>
@@ -206,6 +206,7 @@
:data-source="currentOrder.items"
row-key="id"
:pagination="false"
:scroll="{ x: 'max-content' }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'price'">¥{{ record.price.toFixed(2) }}</template>
@@ -284,6 +285,7 @@ import { sameId } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { useAdminViewport } from '@/composables/useAdminViewport'
import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
import AdminFilterPanel from '@/components/admin/AdminFilterPanel.vue'
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { isMobile } = useAdminViewport()
@@ -398,6 +400,18 @@ const statusOptions = [
{ label: '已取消', value: '3' }
]
const activeFilterCount = computed(() => [
keyword.value,
statusFilter.value === 'all' ? undefined : statusFilter.value,
currentUserType.value === 4 ? shopFilter.value : undefined,
artistKeyword.value,
userKeyword.value,
createRange.value?.length ? 'createDate' : '',
appointmentRange.value?.length ? 'appointmentDate' : '',
minAmount.value,
maxAmount.value
].filter(value => value !== undefined && value !== null && value !== '').length)
/** filteredOrders is a reactive state variable used by the template and event handlers. */
const filteredOrders = computed(() => {
const keywordValue = keyword.value.trim().toLowerCase()
@@ -651,13 +665,6 @@ onMounted(async () => {
gap: 12px;
}
.admin-filter-bar {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 16px;
}
.order-action-alert {
margin-bottom: 16px;
}
@@ -32,7 +32,7 @@
:data-source="permissionList"
:loading="loading"
:pagination="permissionPagination"
:scroll="{ x: 1080 }"
:scroll="{ x: 'max-content' }"
@change="handlePermissionTableChange"
row-key="id"
>
@@ -177,7 +177,7 @@
:disabled="isPermissionDisabled(permission)"
>
{{ permission.permissionName }}
<span style="color: #999; font-size: 12px; margin-left: 8px;">
<span style="color: var(--text-secondary); font-size: 12px; margin-left: 8px;">
({{ permission.permissionCode }})
</span>
<span
@@ -263,7 +263,7 @@
:disabled="isPermissionDisabled(permission)"
>
{{ permission.permissionName }}
<span style="color: #999; font-size: 12px; margin-left: 8px;">
<span style="color: var(--text-secondary); font-size: 12px; margin-left: 8px;">
({{ permission.permissionCode }})
</span>
</a-checkbox>
@@ -811,8 +811,8 @@ watch(
}
.selected {
background: rgba(204, 123, 95, 0.12) !important;
border-left: 3px solid #cc7b5f;
background: var(--theme-primary-soft) !important;
border-left: 3px solid var(--theme-primary);
}
.mobile-permission-flow {
@@ -31,7 +31,7 @@
</div>
</template>
<div class="admin-filter-bar">
<AdminFilterPanel :active-count="activeFilterCount">
<a-select v-model:value="shopFilter" allow-clear placeholder="所属店铺" style="width: 180px" @change="handleSearch">
<a-select-option v-for="shop in shops" :key="shop.id" :value="shop.id">
{{ shop.shopName }}
@@ -46,7 +46,7 @@
<a-input-number v-model:value="maxPriceFilter" :min="0" placeholder="最高价" style="width: 120px" @pressEnter="handleSearch" />
<a-range-picker v-model:value="createdRange" value-format="YYYY-MM-DD HH:mm:ss" show-time @change="handleSearch" />
<a-button @click="resetFilters">重置筛选</a-button>
</div>
</AdminFilterPanel>
<a-table
v-if="!isMobile"
@@ -54,7 +54,7 @@
:data-source="productList"
:loading="loading"
:pagination="pagination"
:scroll="{ x: 1280 }"
:scroll="{ x: 'max-content' }"
@change="handleTableChange"
row-key="id"
>
@@ -246,7 +246,7 @@
</a-upload>
<div class="upload-tip">支持多选上传,不限制上传张数,单张图片超过 5MB 会自动压缩后再上传。</div>
<div v-if="isUploadPending" class="upload-pending-tip">图片正在上传中,上传完成前不可提交。</div>
<a-modal v-model:open="previewVisible" :footer="null" @cancel="previewVisible = false">
<a-modal v-model:open="previewVisible" :footer="null" :mask-closable="false" @cancel="previewVisible = false">
<img alt="预览" style="width: 100%" :src="previewImage" />
</a-modal>
</a-form-item>
@@ -559,6 +559,7 @@ import { runWithGlobalLoading } from '@/utils/action-loading'
import { useAdminViewport } from '@/composables/useAdminViewport'
import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
import AdminMobileFab from '@/components/admin/AdminMobileFab.vue'
import AdminFilterPanel from '@/components/admin/AdminFilterPanel.vue'
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { hasPermission, loadUserPermissions } = usePermission()
@@ -592,6 +593,14 @@ const maxPriceFilter = ref<number | undefined>()
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const createdRange = ref<[string, string] | undefined>()
const activeFilterCount = computed(() => [
searchText.value,
shopFilter.value,
tagFilter.value,
minPriceFilter.value,
maxPriceFilter.value,
createdRange.value?.length ? 'date' : ''
].filter(value => value !== undefined && value !== null && value !== '').length)
/**
* Purpose: productList supports ProductsView.vue by holding or executing the product list 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.
@@ -1669,7 +1678,7 @@ watch(() => formState.shopId, (newShopId) => {
}
.upload-tip {
color: #8c8c8c;
color: var(--text-secondary);
font-size: 12px;
line-height: 1.6;
margin-top: 8px;
@@ -1686,10 +1695,4 @@ watch(() => formState.shopId, (newShopId) => {
margin-top: 6px;
}
.admin-filter-bar {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 16px;
}
</style>
@@ -88,6 +88,7 @@ import { message, Modal } from 'ant-design-vue'
import { adminAuthApi } from '@/api/admin'
import { usePermission } from '@/utils/permission'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { notifyShopThemeChanged } from '@/utils/shop-theme'
import {
getAdminCurrentShopName,
getAdminRoleLabel,
@@ -166,6 +167,7 @@ const handleShopChange = async (shopId: unknown) => {
persistAdminSession(response as any)
refreshLocalUserInfo()
await loadUserPermissions()
notifyShopThemeChanged()
})
message.success('门店切换成功')
window.location.reload()
@@ -227,7 +229,7 @@ onMounted(async () => {
display: flex;
justify-content: space-between;
gap: 12px;
color: #64707a;
color: var(--text-secondary);
}
.profile-meta-list__row strong {
@@ -14,20 +14,6 @@
<template #title v-if="isMobile">班次列表</template>
<template #extra>
<div class="admin-toolbar" :class="{ 'admin-toolbar--stacked': isMobile }">
<a-select
v-model:value="filters.artistId"
allow-clear
placeholder="选择美甲师"
:options="artistOptions"
:style="isMobile ? { width: '100%' } : { width: '180px' }"
@change="loadSchedules"
/>
<a-range-picker
v-model:value="filters.dateRange"
value-format="YYYY-MM-DD"
:style="isMobile ? { width: '100%' } : { width: '240px' }"
@change="loadSchedules"
/>
<a-button type="primary" @click="openCreateModal">
<template #icon>
<PlusOutlined />
@@ -37,7 +23,25 @@
</div>
</template>
<a-table v-if="!isMobile" :columns="columns" :data-source="schedules" :loading="loading" row-key="id">
<AdminFilterPanel :active-count="activeFilterCount">
<a-select
v-model:value="filters.artistId"
allow-clear
placeholder="选择美甲师"
:options="artistOptions"
style="width: 180px"
@change="loadSchedules"
/>
<a-range-picker
v-model:value="filters.dateRange"
value-format="YYYY-MM-DD"
style="width: 240px"
@change="loadSchedules"
/>
<a-button @click="resetFilters">重置筛选</a-button>
</AdminFilterPanel>
<a-table v-if="!isMobile" :columns="columns" :data-source="schedules" :loading="loading" row-key="id" :scroll="{ x: 'max-content' }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'artist'">{{ artistName(record.artistId) }}</template>
<template v-else-if="column.key === 'time'">{{ record.startTime }} - {{ record.endTime }}</template>
@@ -139,6 +143,7 @@ import {
import { runWithGlobalLoading } from '@/utils/action-loading'
import { useAdminViewport } from '@/composables/useAdminViewport'
import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
import AdminFilterPanel from '@/components/admin/AdminFilterPanel.vue'
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { isMobile } = useAdminViewport()
@@ -188,6 +193,11 @@ const artistOptions = computed(() => artists.value.map(artist => ({
value: String(artist.userId || artist.id)
})))
const activeFilterCount = computed(() => [
filters.artistId,
filters.dateRange?.length ? 'date' : ''
].filter(Boolean).length)
const artistName = (artistId?: unknown) => {
const artist = artists.value.find(item => String(item.userId || item.id) === String(artistId))
return artist?.nickname || artist?.identity || (artistId ? `美甲师 ${artistId}` : '-')
@@ -233,6 +243,12 @@ const loadSchedules = async () => {
}
}
const resetFilters = () => {
filters.artistId = undefined
filters.dateRange = undefined
void loadSchedules()
}
const openCreateModal = () => {
editingSchedule.value = null
resetForm()
+62 -49
View File
@@ -40,7 +40,7 @@
:data-source="shopList"
:loading="loading"
:pagination="pagination"
:scroll="{ x: 1380 }"
:scroll="{ x: 'max-content' }"
@change="handleTableChange"
row-key="id"
>
@@ -283,7 +283,7 @@
</div>
</a-upload>
<div v-if="isUploadPending" class="upload-pending-tip">图片正在上传中,上传完成前不可提交。</div>
<a-modal v-model:open="bannerPreviewVisible" :footer="null" @cancel="bannerPreviewVisible = false">
<a-modal v-model:open="bannerPreviewVisible" :footer="null" :mask-closable="false" @cancel="bannerPreviewVisible = false">
<img alt="预览" style="width: 100%" :src="bannerPreviewImage" />
</a-modal>
</a-form-item>
@@ -304,7 +304,7 @@
</div>
</a-upload>
<div v-if="isUploadPending" class="upload-pending-tip">图片正在上传中,上传完成前不可提交。</div>
<a-modal v-model:open="previewVisible" :footer="null" @cancel="previewVisible = false">
<a-modal v-model:open="previewVisible" :footer="null" :mask-closable="false" @cancel="previewVisible = false">
<img alt="预览" style="width: 100%" :src="previewImage" />
</a-modal>
</a-form-item>
@@ -366,25 +366,25 @@
<a-form-item label="主色" name="themePrimaryColor">
<div class="theme-color-field">
<input v-model="formState.themePrimaryColor" class="theme-color-picker" type="color" />
<a-input v-model:value="formState.themePrimaryColor" placeholder="#C6597D" />
<a-input v-model:value="formState.themePrimaryColor" placeholder="#E8B4B8" />
</div>
</a-form-item>
<a-form-item label="辅色" name="themeSecondaryColor">
<div class="theme-color-field">
<input v-model="formState.themeSecondaryColor" class="theme-color-picker" type="color" />
<a-input v-model:value="formState.themeSecondaryColor" placeholder="#E9B7C7" />
<a-input v-model:value="formState.themeSecondaryColor" placeholder="#C5A059" />
</div>
</a-form-item>
<a-form-item label="强调色" name="themeAccentColor">
<a-form-item label="中性/强调色" name="themeAccentColor">
<div class="theme-color-field">
<input v-model="formState.themeAccentColor" class="theme-color-picker" type="color" />
<a-input v-model:value="formState.themeAccentColor" placeholder="#9F4967" />
<a-input v-model:value="formState.themeAccentColor" placeholder="#4A443F" />
</div>
</a-form-item>
<a-form-item label="页面背景" name="themePageBgColor">
<div class="theme-color-field">
<input v-model="formState.themePageBgColor" class="theme-color-picker" type="color" />
<a-input v-model:value="formState.themePageBgColor" placeholder="#FFF7F9" />
<a-input v-model:value="formState.themePageBgColor" placeholder="#FDFBF9" />
</div>
</a-form-item>
<a-form-item label="卡片背景" name="themeCardBgColor">
@@ -424,6 +424,7 @@
title="保存配色模板"
ok-text="保存"
cancel-text="取消"
:mask-closable="false"
@ok="handleConfirmSaveThemeTemplate"
@cancel="handleCancelSaveThemeTemplate"
>
@@ -544,6 +545,7 @@
:title="mapPickerTitle"
:width="920"
:footer="null"
:mask-closable="false"
destroy-on-close
class="tencent-map-picker-modal"
@cancel="closeMapLocationPicker"
@@ -600,7 +602,7 @@ import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-uploa
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
import { usePermission } from '@/utils/permission'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { resolveShopTheme } from '@/utils/shop-theme'
import { notifyShopThemeChanged, resolveShopTheme } from '@/utils/shop-theme'
import { useAdminViewport } from '@/composables/useAdminViewport'
import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
import AdminMobileFab from '@/components/admin/AdminMobileFab.vue'
@@ -644,6 +646,16 @@ const CUSTOM_THEME_TEMPLATE_STORAGE_KEY = 'yuminail:admin:shop-theme-templates'
const CUSTOM_THEME_TEMPLATE_LIMIT = 20
const PRESET_THEME_TEMPLATES: ShopThemeTemplate[] = [
{
id: 'preset-luminous-elegance',
name: 'Luminous Elegance',
source: 'preset',
themePrimaryColor: '#E8B4B8',
themeSecondaryColor: '#C5A059',
themeAccentColor: '#4A443F',
themePageBgColor: '#FDFBF9',
themeCardBgColor: '#FFFFFF'
},
{
id: 'preset-soft-nude',
name: '柔雾裸粉',
@@ -2347,6 +2359,7 @@ const handleModalOk = async () => {
...formState,
authorizationExpireTime: computedAuthorizationExpireTime.value
})
notifyShopThemeChanged()
message.success('更新成功')
} else {
await adminShopApi.createShop({
@@ -2420,9 +2433,9 @@ onMounted(async () => {
justify-content: space-between;
gap: 12px;
padding: 10px 12px;
border: 1px solid #d9d9d9;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: #fafafa;
background: var(--theme-card-bg);
}
.map-picker-main {
@@ -2431,7 +2444,7 @@ onMounted(async () => {
}
.map-picker-title {
color: #1f2937;
color: var(--text-primary);
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
@@ -2440,7 +2453,7 @@ onMounted(async () => {
.map-picker-subtitle {
margin-top: 4px;
color: #8c8c8c;
color: var(--text-secondary);
font-size: 12px;
overflow: hidden;
text-overflow: ellipsis;
@@ -2449,7 +2462,7 @@ onMounted(async () => {
.map-picker-tip {
margin-top: 8px;
color: #8c8c8c;
color: var(--text-secondary);
font-size: 12px;
line-height: 1.6;
}
@@ -2468,7 +2481,7 @@ onMounted(async () => {
.tencent-map-picker__toolbar p {
margin: 4px 0 0;
color: #8c8c8c;
color: var(--text-secondary);
font-size: 13px;
}
@@ -2477,7 +2490,7 @@ onMounted(async () => {
height: 520px;
border: 0;
border-radius: 8px;
background: #f5f5f5;
background: var(--theme-primary-soft);
}
.shop-banner {
@@ -2488,12 +2501,12 @@ onMounted(async () => {
}
.no-banner {
color: #999;
color: var(--text-secondary);
font-size: 12px;
}
.upload-tip {
color: #999;
color: var(--text-secondary);
font-size: 12px;
margin-bottom: 8px;
}
@@ -2512,16 +2525,16 @@ onMounted(async () => {
}
.business-hours-separator {
color: #666;
color: var(--text-secondary);
flex: 0 0 auto;
}
.theme-section {
margin: 8px 0 18px;
padding: 16px 18px;
border: 1px solid #f0dce4;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: #fffafb;
background: var(--theme-primary-soft);
}
.theme-section__header {
@@ -2533,13 +2546,13 @@ onMounted(async () => {
}
.theme-section__title {
color: #2d2430;
color: var(--text-primary);
font-weight: 700;
}
.theme-section__desc {
margin-top: 4px;
color: #7a6871;
color: var(--text-secondary);
font-size: 12px;
line-height: 1.6;
}
@@ -2551,9 +2564,9 @@ onMounted(async () => {
.theme-template-panel {
margin-bottom: 16px;
padding: 12px;
border: 1px solid #f0dce4;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: #ffffff;
background: var(--theme-card-bg);
}
.theme-template-panel__header {
@@ -2565,12 +2578,12 @@ onMounted(async () => {
}
.theme-template-panel__header span {
color: #2d2430;
color: var(--text-primary);
font-weight: 700;
}
.theme-template-panel__header small {
color: #8a737d;
color: var(--text-secondary);
line-height: 1.5;
}
@@ -2584,25 +2597,25 @@ onMounted(async () => {
position: relative;
min-height: 92px;
padding: 12px;
border: 1px solid #efdee5;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: #fffdfd;
background: var(--theme-card-bg);
cursor: pointer;
transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.theme-template-card:hover,
.theme-template-card:focus {
border-color: #c6597d;
box-shadow: 0 10px 24px rgba(198, 89, 125, .12);
border-color: var(--theme-primary);
box-shadow: var(--theme-button-shadow);
outline: none;
transform: translateY(-1px);
}
.theme-template-card--active {
border-color: #c6597d;
background: #fff7f9;
box-shadow: 0 0 0 2px rgba(198, 89, 125, .14);
border-color: var(--theme-primary);
background: var(--theme-primary-soft);
box-shadow: var(--theme-focus-shadow);
}
.theme-template-card--custom {
@@ -2615,7 +2628,7 @@ onMounted(async () => {
}
.theme-template-card__top strong {
color: #2d2430;
color: var(--text-primary);
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
@@ -2623,7 +2636,7 @@ onMounted(async () => {
}
.theme-template-card__top span {
color: #9a7b87;
color: var(--text-secondary);
font-size: 12px;
}
@@ -2638,9 +2651,9 @@ onMounted(async () => {
.theme-template-save-preview span {
width: 18px;
height: 18px;
border: 2px solid #ffffff;
border: 2px solid var(--theme-card-bg);
border-radius: 999px;
box-shadow: 0 0 0 1px #ead6de;
box-shadow: 0 0 0 1px var(--theme-border);
}
.theme-template-card__delete {
@@ -2649,18 +2662,18 @@ onMounted(async () => {
right: 9px;
height: 24px;
padding: 0 8px;
border: 1px solid #efdee5;
border: 1px solid var(--theme-border);
border-radius: 8px;
color: #9f4967;
color: var(--theme-accent);
font-size: 12px;
background: #fff8fa;
background: var(--theme-primary-soft);
cursor: pointer;
}
.theme-template-card__delete:hover,
.theme-template-card__delete:focus {
border-color: #c6597d;
color: #c6597d;
border-color: var(--theme-primary);
color: var(--theme-primary);
outline: none;
}
@@ -2670,7 +2683,7 @@ onMounted(async () => {
}
.theme-template-save-form label {
color: #2d2430;
color: var(--text-primary);
font-weight: 600;
}
@@ -2679,9 +2692,9 @@ onMounted(async () => {
gap: 8px;
margin-top: 16px;
padding: 12px;
border: 1px solid #f0dce4;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: #fffafb;
background: var(--theme-primary-soft);
}
.theme-grid {
@@ -2700,9 +2713,9 @@ onMounted(async () => {
width: 42px;
height: 34px;
padding: 0;
border: 1px solid #efd8e0;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: #fff;
background: var(--theme-card-bg);
}
.theme-preview {
@@ -2748,7 +2761,7 @@ onMounted(async () => {
.theme-view-swatches span {
width: 28px;
height: 28px;
border: 1px solid #efdee5;
border: 1px solid var(--theme-border);
border-radius: 999px;
}
@@ -22,7 +22,7 @@
<a-input v-model:value="form.title" :maxlength="100" placeholder="请输入消息标题" />
</a-form-item>
<a-form-item label="内容">
<a-textarea v-model:value="form.content" :rows="6" :maxlength="2000" placeholder="请输入消息内容,可配合图片展示" />
<a-textarea v-model:value="form.content" :rows="6" :maxlength="2000" placeholder="支持 HTML / Markdown,可配合图片展示" />
</a-form-item>
<a-form-item label="消息图片">
<div class="image-upload-row">
@@ -109,7 +109,7 @@
<a-card :bordered="false" class="admin-section-card">
<template #title>发布记录</template>
<a-table :columns="columns" :data-source="messages" :loading="loading" row-key="id" :pagination="{ pageSize: 8 }">
<a-table :columns="columns" :data-source="messages" :loading="loading" row-key="id" :pagination="{ pageSize: 8 }" :scroll="{ x: 'max-content' }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image v-if="record.imageUrl" :src="record.imageUrl" :width="54" :height="54" class="table-image" />
@@ -133,7 +133,7 @@
</a-table>
</a-card>
<a-modal v-model:open="previewVisible" :footer="null" width="560px" wrap-class-name="message-detail-modal-wrap">
<a-modal v-model:open="previewVisible" :footer="null" width="560px" wrap-class-name="message-detail-modal-wrap" :mask-closable="false">
<SystemMessageCard
:title="currentMessage?.title || '消息详情'"
:content="currentMessage?.content || ''"
@@ -476,7 +476,7 @@ onMounted(loadData)
}
.message-page-head :deep(.ant-page-header-heading-title) {
color: #33232d;
color: var(--text-primary);
font-weight: 700;
}
@@ -499,10 +499,10 @@ onMounted(loadData)
.message-editor-panel {
padding: 24px;
border: 1px solid rgba(245, 203, 218, 0.9);
border: 1px solid var(--theme-border);
border-radius: 22px;
background: rgba(255, 255, 255, 0.96);
box-shadow: 0 18px 48px rgba(198, 89, 125, 0.12);
background: var(--theme-card-bg);
box-shadow: 0 18px 48px color-mix(in srgb, var(--theme-primary) 12%, transparent);
}
.panel-heading {
@@ -521,26 +521,26 @@ onMounted(loadData)
border-radius: 14px;
color: #ffffff;
font-size: 20px;
background: linear-gradient(135deg, #c6597d 0%, #e9b7c7 100%);
box-shadow: 0 12px 24px rgba(198, 89, 125, 0.24);
background: var(--theme-gradient);
box-shadow: var(--theme-button-shadow);
}
.panel-eyebrow {
margin: 0 0 4px;
color: #a45771;
color: var(--theme-primary);
font-size: 13px;
font-weight: 600;
}
.panel-heading h2 {
margin: 0;
color: #312330;
color: var(--text-primary);
font-size: 22px;
font-weight: 750;
}
.message-form :deep(.ant-form-item-label > label) {
color: #4a3a44;
color: var(--text-primary);
font-weight: 600;
}
@@ -548,7 +548,7 @@ onMounted(loadData)
.message-form :deep(.ant-input-number),
.message-form :deep(.ant-select-selector),
.message-form :deep(.ant-input-affix-wrapper) {
border-color: #f1d6df;
border-color: var(--theme-border);
border-radius: 10px;
}
@@ -556,16 +556,16 @@ onMounted(loadData)
.message-form :deep(.ant-input-focused),
.message-form :deep(.ant-select-focused .ant-select-selector),
.message-form :deep(.ant-input-affix-wrapper-focused) {
border-color: #c6597d;
box-shadow: 0 0 0 3px rgba(198, 89, 125, 0.12);
border-color: var(--theme-primary);
box-shadow: var(--theme-focus-shadow);
}
.scope-panel {
padding: 16px 16px 0;
margin-bottom: 18px;
border: 1px solid rgba(246, 205, 219, 0.9);
border: 1px solid var(--theme-border);
border-radius: 16px;
background: #fff8fa;
background: var(--theme-gradient-soft);
}
.publish-footer {
@@ -574,28 +574,17 @@ onMounted(loadData)
align-items: center;
justify-content: space-between;
padding-top: 18px;
border-top: 1px solid #f5dbe4;
border-top: 1px solid var(--theme-border);
}
.popup-checkbox {
color: #5c4b55;
color: var(--text-secondary);
}
.message-preview-panel {
display: flex;
align-items: center;
justify-content: center;
--theme-primary: #c6597d;
--theme-secondary: #e9b7c7;
--theme-accent: #9f4967;
--theme-primary-soft: #f8edf1;
--theme-card-bg: #ffffff;
--theme-border: #efd4dd;
--theme-gradient: linear-gradient(135deg, #c6597d 0%, #e9b7c7 100%);
--theme-gradient-soft: linear-gradient(145deg, #ffffff 0%, #fff7f9 58%, #f8edf1 100%);
--theme-button-shadow: 0 12px 28px rgba(198, 89, 125, 0.22);
--text-primary: #2d2430;
--text-secondary: #7a6871;
}
.message-preview-panel :deep(.system-message-card) {
@@ -623,15 +612,15 @@ onMounted(loadData)
margin-bottom: 16px;
margin-left: auto;
margin-right: auto;
border: 1px solid rgba(246, 205, 219, 0.75);
border: 1px solid var(--theme-border);
border-radius: 18px;
box-shadow: 0 18px 42px rgba(198, 89, 125, 0.1);
box-shadow: 0 18px 42px color-mix(in srgb, var(--theme-primary) 10%, transparent);
overflow: hidden;
}
.admin-section-card :deep(.ant-card-head) {
color: #7a4058;
background: linear-gradient(135deg, #fff7f9 0%, #ffe8ef 100%);
color: var(--theme-primary);
background: var(--theme-gradient-soft);
}
.image-upload-row {
@@ -644,7 +633,7 @@ onMounted(loadData)
display: grid;
gap: 4px;
place-items: center;
color: #8a7b83;
color: var(--text-secondary);
text-align: center;
}
@@ -656,13 +645,13 @@ onMounted(loadData)
}
.image-upload-copy {
color: #5f5660;
color: var(--text-secondary);
line-height: 1.7;
}
.image-upload-copy small,
.muted {
color: #7f7781;
color: var(--text-secondary);
font-size: 13px;
}
@@ -682,20 +671,6 @@ onMounted(loadData)
padding: 0;
}
:global(.message-detail-modal-wrap .system-message-card) {
--theme-primary: #c6597d;
--theme-secondary: #e9b7c7;
--theme-accent: #9f4967;
--theme-primary-soft: #f8edf1;
--theme-card-bg: #ffffff;
--theme-border: #efd4dd;
--theme-gradient: linear-gradient(135deg, #c6597d 0%, #e9b7c7 100%);
--theme-gradient-soft: linear-gradient(145deg, #ffffff 0%, #fff7f9 58%, #f8edf1 100%);
--theme-button-shadow: 0 12px 28px rgba(198, 89, 125, 0.22);
--text-primary: #2d2430;
--text-secondary: #7a6871;
}
:global(.message-detail-modal-wrap .ant-modal-close) {
color: var(--text-secondary);
}
@@ -39,6 +39,7 @@
:pagination="pagination"
@change="handleTableChange"
row-key="id"
:scroll="{ x: 'max-content' }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'color'">
+312 -21
View File
@@ -31,7 +31,7 @@
</div>
</template>
<div class="admin-filter-bar">
<AdminFilterPanel :active-count="activeMobileFilterCount">
<a-select
v-model:value="shopFilter"
:allow-clear="currentUserType === 4"
@@ -72,7 +72,7 @@
<a-select-option value="false">无订单</a-select-option>
</a-select>
<a-button @click="resetFilters">重置筛选</a-button>
</div>
</AdminFilterPanel>
<a-table
v-if="!isMobile"
@@ -81,6 +81,7 @@
:loading="loading"
:pagination="pagination"
row-key="id"
:scroll="{ x: 'max-content' }"
@change="handleTableChange"
>
<template #bodyCell="{ column, record }">
@@ -242,10 +243,61 @@
@input="handlePhoneInput"
/>
</a-form-item>
<a-form-item v-if="!isEdit" label="密码" name="password">
<a-input-password v-model:value="formState.password" placeholder="请输入密码" />
<a-form-item label="生日" name="birthday">
<a-date-picker
v-model:value="formState.birthday"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
placeholder="请选择生日"
class="user-date-picker"
popup-class-name="yumi-date-picker-panel"
/>
</a-form-item>
<a-form-item label="所属店铺" name="shopIds">
<a-form-item
label="微信号"
name="wechatId"
:required="[2, 3].includes(Number(formState.type))"
>
<a-input v-model:value="formState.wechatId" placeholder="店长和美甲师必填" />
</a-form-item>
<a-form-item label="微信二维码" name="wechatQrCode">
<div class="wechat-qr-field">
<a-upload
accept="image/*"
:show-upload-list="false"
:before-upload="beforeUploadWechatQr"
:custom-request="handleWechatQrUpload"
>
<img
v-if="formState.wechatQrCode"
:src="formState.wechatQrCode"
alt="微信二维码"
class="wechat-qr-preview"
/>
<a-button v-else :loading="wechatQrUploading">上传二维码</a-button>
</a-upload>
<a-button v-if="formState.wechatQrCode" type="link" danger size="small" @click="formState.wechatQrCode = ''">
删除二维码
</a-button>
</div>
</a-form-item>
<a-form-item
v-if="!isEdit"
label="密码"
name="password"
extra="留空则使用参数管理中配置的后台新增用户默认密码"
>
<a-input-password
v-model:value="formState.password"
placeholder="不填则使用默认密码"
autocomplete="new-password"
/>
</a-form-item>
<a-form-item
label="所属店铺"
name="shopIds"
:required="Number(formState.type) !== 4"
>
<a-select
v-model:value="formState.shopIds"
mode="multiple"
@@ -284,6 +336,13 @@
@cancel="viewModalVisible = false"
>
<a-descriptions bordered :column="1" size="small">
<a-descriptions-item label="联系电话">{{ viewRecord?.contactPhone || '-' }}</a-descriptions-item>
<a-descriptions-item label="生日">{{ viewRecord?.birthday || '-' }}</a-descriptions-item>
<a-descriptions-item label="微信号">{{ viewRecord?.wechatId || '-' }}</a-descriptions-item>
<a-descriptions-item label="微信二维码">
<img v-if="viewRecord?.wechatQrCode" :src="viewRecord.wechatQrCode" alt="微信二维码" class="wechat-qr-preview" />
<span v-else>-</span>
</a-descriptions-item>
<a-descriptions-item label="账号">{{ viewRecord?.account || '-' }}</a-descriptions-item>
<a-descriptions-item label="昵称">{{ viewRecord?.nickname || '-' }}</a-descriptions-item>
<a-descriptions-item label="手机号">{{ viewRecord?.phone || '-' }}</a-descriptions-item>
@@ -449,7 +508,7 @@
:pagination="false"
size="small"
row-key="id"
:scroll="{ y: 320 }"
:scroll="{ x: 'max-content', y: 320 }"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'amount'">
@@ -489,7 +548,7 @@
* UsersView 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, onMounted, reactive, ref } from 'vue'
import { computed, h, onMounted, reactive, ref } from 'vue'
import { message, Modal } from 'ant-design-vue'
import type { FormInstance } from 'ant-design-vue'
import { PlusOutlined } from '@ant-design/icons-vue'
@@ -503,7 +562,9 @@ import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecor
*/
import { userApi, type AvailabilityCheckResponse } from '@/api/user'
import {
adminFileApi,
adminShopApi,
adminSystemParameterConfigApi,
adminUserApi,
adminVipRechargePlanApi,
type AdminUserBalanceChangeRequest,
@@ -520,10 +581,12 @@ import { runWithGlobalLoading } from '@/utils/action-loading'
import { useAdminViewport } from '@/composables/useAdminViewport'
import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
import AdminMobileFab from '@/components/admin/AdminMobileFab.vue'
import AdminFilterPanel from '@/components/admin/AdminFilterPanel.vue'
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
const { hasPermission, hasAnyPermission, loadUserPermissions } = usePermission()
const { isMobile } = useAdminViewport()
const FALLBACK_ADMIN_DEFAULT_PASSWORD = 'YumiNail@123'
/** currentUserInfo is a local helper used by this page script. */
const currentUserInfo = (() => {
@@ -536,6 +599,51 @@ const currentUserInfo = (() => {
}
})()
const copyTextToClipboard = async (value: string) => {
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(value)
} else {
const textarea = document.createElement('textarea')
textarea.value = value
textarea.setAttribute('readonly', 'readonly')
textarea.style.position = 'fixed'
textarea.style.left = '-9999px'
document.body.appendChild(textarea)
textarea.select()
document.execCommand('copy')
document.body.removeChild(textarea)
}
message.success('默认密码已复制')
} catch (error) {
console.error('复制默认密码失败:', error)
message.warning('复制失败,请手动复制')
}
}
const resolveAdminDefaultPasswordForNotice = async () => {
try {
const response = await adminSystemParameterConfigApi.getUserDefaultPassword()
return response?.password?.trim() || FALLBACK_ADMIN_DEFAULT_PASSWORD
} catch (error) {
console.error('获取后台默认密码失败:', error)
return FALLBACK_ADMIN_DEFAULT_PASSWORD
}
}
const showDefaultPasswordCreateNotice = async () => {
const password = await resolveAdminDefaultPasswordForNotice()
Modal.success({
title: '用户创建成功',
content: h('div', { class: 'default-password-notice' }, [
h('p', '本次使用后台默认密码,请提醒用户首次登录后修改。'),
h('div', { class: 'default-password-notice__value' }, password)
]),
okText: '一键复制密码',
onOk: () => copyTextToClipboard(password)
})
}
/** normalizeUserType is a local helper used by this page script. */
const normalizeUserType = (value: unknown) => {
const type = Number(value)
@@ -700,12 +808,33 @@ const canDeleteUser = computed(() =>
const canUnbindUser = computed(() =>
hasPermission('user:unbind')
)
/** activeMobileFilterCount summarizes applied filters while the mobile panel is collapsed. */
const activeMobileFilterCount = computed(() => {
const values = [
currentUserType.value === 4 ? shopFilter.value : undefined,
typeFilter.value,
vipLevelFilter.value,
statusFilter.value,
createdRange.value,
hasPhoneFilter.value,
hasOrderFilter.value
]
return values.filter(isActiveFilterValue).length
})
/**
* Purpose: PHONE_REGEX supports UsersView.vue by holding or executing the phone regex 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 PHONE_REGEX = /^1[3-9]\d{9}$/
/** isActiveFilterValue is a local helper used by the mobile filter summary. */
const isActiveFilterValue = (value: unknown) => {
if (Array.isArray(value)) {
return value.some(item => item !== undefined && item !== null && item !== '')
}
return value !== undefined && value !== null && value !== ''
}
/**
* Purpose: pagination supports UsersView.vue by holding or executing the pagination 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.
@@ -727,11 +856,18 @@ const formState = reactive({
account: '',
nickname: '',
phone: '',
contactPhone: '',
birthday: '',
wechatId: '',
wechatQrCode: '',
password: '',
type: 0,
shopIds: [] as string[]
})
/** wechatQrUploading tracks QR upload state in the user modal. */
const wechatQrUploading = ref(false)
/** handleAccountInput is a local helper used by this page script. */
const handleAccountInput = () => {
const normalized = sanitizeAccountInput(formState.account)
@@ -746,6 +882,39 @@ const handlePhoneInput = () => {
if (normalized !== formState.phone) {
formState.phone = normalized
}
formState.contactPhone = formState.phone
}
/** beforeUploadWechatQr validates QR image files before upload. */
const beforeUploadWechatQr = (file: File) => {
const isImage = file.type.startsWith('image/')
const isLt10M = file.size / 1024 / 1024 < 10
if (!isImage) {
message.error('只能上传图片文件')
}
if (!isLt10M) {
message.error('图片大小不能超过 10MB')
}
return isImage && isLt10M
}
/** handleWechatQrUpload uploads a QR image through admin object storage and stores the signed URL. */
const handleWechatQrUpload = async (options: any) => {
const { file, onSuccess, onError } = options
wechatQrUploading.value = true
try {
const uploaded = await adminFileApi.uploadFile(file as File)
const signedUrl = await adminFileApi.getSignedUrl(uploaded.id)
formState.wechatQrCode = signedUrl as unknown as string
onSuccess?.(uploaded)
message.success('微信二维码上传成功')
} catch (error) {
console.error('微信二维码上传失败:', error)
message.error((error as Error)?.message || '微信二维码上传失败')
onError?.(error)
} finally {
wechatQrUploading.value = false
}
}
/** validatePhoneUniqueness is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
@@ -773,6 +942,25 @@ const validatePhoneUniqueness = async (value: string) => {
}
}
const validateOptionalPasswordStrength = (value?: string) => {
const password = value?.trim()
if (!password) {
return
}
if (password.length < 8 || password.length > 32) {
throw new Error('密码长度需为 8-32 位')
}
const categoryCount = [
/\d/.test(password),
/[a-z]/.test(password),
/[A-Z]/.test(password),
/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)
].filter(Boolean).length
if (categoryCount < 3) {
throw new Error('密码需至少包含数字、小写字母、大写字母、特殊符号中的 3 类')
}
}
/**
* Purpose: balanceForm supports UsersView.vue by holding or executing the balance form 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.
@@ -893,7 +1081,22 @@ const formRules = {
trigger: 'blur'
}
],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
wechatId: [{
validator: async (_rule: unknown, value: string) => {
if ([2, 3].includes(Number(formState.type)) && !value?.trim()) {
return Promise.reject('店长和美甲师必须填写微信号')
}
return Promise.resolve()
},
trigger: ['blur', 'change']
}],
password: [{
validator: async (_rule: unknown, value: string) => {
validateOptionalPasswordStrength(value)
return Promise.resolve()
},
trigger: 'blur'
}],
shopIds: [{
validator: async (_rule: unknown, value: string[]) => {
if (Number(formState.type) === 4) {
@@ -1170,6 +1373,10 @@ const resetFormState = () => {
account: '',
nickname: '',
phone: '',
contactPhone: '',
birthday: '',
wechatId: '',
wechatQrCode: '',
password: '',
type: defaultUserType ?? 0,
shopIds: currentUserType.value !== 4 && currentUserInfo?.shopId
@@ -1186,6 +1393,10 @@ const buildDraftPayload = () => ({
account: formState.account,
nickname: formState.nickname,
phone: formState.phone,
contactPhone: formState.phone,
birthday: formState.birthday,
wechatId: formState.wechatId,
wechatQrCode: formState.wechatQrCode,
password: formState.password,
type: formState.type,
shopIds: [...formState.shopIds]
@@ -1200,6 +1411,10 @@ const restoreDraft = () => {
}
Object.assign(formState, draft.payload)
if (!formState.phone && formState.contactPhone) {
formState.phone = formState.contactPhone
}
formState.contactPhone = formState.phone
draftSavedAt.value = draft.savedAt
message.success('已恢复暂存内容')
}
@@ -1249,7 +1464,11 @@ const showEditModal = (record: any) => {
Object.assign(formState, {
account: record.account,
nickname: record.nickname,
phone: record.phone || '',
phone: record.phone || record.contactPhone || '',
contactPhone: record.phone || record.contactPhone || '',
birthday: record.birthday || '',
wechatId: record.wechatId || '',
wechatQrCode: record.wechatQrCode || '',
password: '',
type: record.type,
shopIds: resolveEditableShopIds(record)
@@ -1323,14 +1542,24 @@ const handleAssetModalCancel = () => {
/** handleModalOk is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const handleModalOk = async () => {
try {
if (wechatQrUploading.value) {
message.warning('微信二维码上传完成前不可保存')
return
}
await formRef.value?.validate()
modalLoading.value = true
await runWithGlobalLoading(async () => {
const requestShopIds = Number(formState.type) === 4 ? [] : formState.shopIds
const usedDefaultPassword = !isEdit.value && !formState.password.trim()
const primaryPhone = formState.phone.trim()
const requestData: Record<string, unknown> = {
account: formState.account.trim(),
nickname: formState.nickname.trim(),
phone: formState.phone.trim(),
phone: primaryPhone,
contactPhone: primaryPhone,
birthday: formState.birthday || undefined,
wechatId: formState.wechatId.trim(),
wechatQrCode: formState.wechatQrCode,
type: formState.type,
shopIds: requestShopIds,
shopId: requestShopIds.length ? requestShopIds[0] : undefined,
@@ -1347,7 +1576,11 @@ const handleModalOk = async () => {
message.success('更新成功')
} else {
await adminUserApi.createUser(requestData)
message.success('创建成功')
if (usedDefaultPassword) {
await showDefaultPasswordCreateNotice()
} else {
message.success('创建成功')
}
}
handleClearDraft(false)
@@ -1393,7 +1626,7 @@ const handleStatusChange = async (record: any, checked: boolean) => {
const handleResetPassword = (record: any) => {
Modal.confirm({
title: '确认重置密码',
content: `确定要将用户 ${record.nickname} 的密码重置为 888888 吗?`,
content: `确定要将用户 ${record.nickname} 的密码重置为后台默认密码吗?`,
async onOk() {
try {
await runWithGlobalLoading(async () => {
@@ -1621,13 +1854,6 @@ onMounted(async () => {
gap: 16px;
}
.admin-filter-bar {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 16px;
}
.mobile-user-head {
display: flex;
align-items: center;
@@ -1635,6 +1861,24 @@ onMounted(async () => {
min-width: 0;
}
.wechat-qr-field {
display: grid;
justify-items: start;
gap: 8px;
}
.user-date-picker {
width: 100%;
}
.wechat-qr-preview {
width: 88px;
height: 88px;
border: 1px solid var(--admin-mobile-border);
border-radius: 8px;
object-fit: cover;
}
.asset-summary,
.asset-actions,
.history-card {
@@ -1649,14 +1893,14 @@ onMounted(async () => {
.summary-sub {
margin-top: 8px;
color: #666;
color: var(--text-secondary);
font-size: 12px;
line-height: 1.6;
}
.vip-note {
margin-top: 12px;
color: #666;
color: var(--text-secondary);
font-size: 12px;
}
@@ -1669,4 +1913,51 @@ onMounted(async () => {
color: #ff4d4f;
font-weight: 600;
}
@media (max-width: 960px) {
.asset-summary,
.asset-actions {
row-gap: 12px;
}
.asset-summary :deep(.ant-col),
.asset-actions :deep(.ant-col) {
flex: 0 0 100%;
max-width: 100%;
}
.asset-actions :deep(.ant-space) {
width: 100%;
display: flex;
flex-wrap: wrap;
gap: 8px !important;
}
.asset-actions :deep(.ant-space-item) {
max-width: 100%;
}
}
:global(.default-password-notice) {
display: grid;
gap: 12px;
}
:global(.default-password-notice p) {
margin: 0;
color: var(--text-secondary);
line-height: 1.7;
}
:global(.default-password-notice__value) {
padding: 12px 14px;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: var(--theme-primary-soft);
color: var(--text-primary);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
font-size: 15px;
font-weight: 700;
overflow-wrap: break-word;
}
</style>
@@ -8,7 +8,7 @@
<a-button type="primary" @click="openCreate">新增档位</a-button>
</div>
<a-table :columns="columns" :data-source="plans" :loading="loading" row-key="id">
<a-table :columns="columns" :data-source="plans" :loading="loading" row-key="id" :scroll="{ x: 'max-content' }">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'amount'">
充 {{ money(record.rechargeAmount) }} 送 {{ money(record.giftAmount) }}
@@ -22,7 +22,7 @@
</template>
</a-table>
<a-modal v-model:open="formOpen" :title="editingId ? '编辑档位' : '新增档位'" @ok="submit" :confirm-loading="saving">
<a-modal v-model:open="formOpen" :title="editingId ? '编辑档位' : '新增档位'" :mask-closable="false" @ok="submit" :confirm-loading="saving">
<a-form layout="vertical">
<a-form-item label="所属店铺">
<a-select v-model:value="form.shopId" :options="shopOptions" allow-clear placeholder="店长默认当前店铺" />
@@ -183,7 +183,7 @@ onMounted(load)
.admin-page { display: grid; gap: 18px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.page-head h2 { margin: 0 0 4px; }
.page-head p { margin: 0; color: #7a6f68; }
.page-head p { margin: 0; color: var(--text-secondary); }
.level-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.level-shortcuts :deep(.ant-tag) { cursor: pointer; }
</style>
@@ -0,0 +1,70 @@
import { describe, expect, it } from 'vitest'
import { readFileSync, readdirSync } from 'node:fs'
import { join } from 'node:path'
const sourceRoot = join(process.cwd(), 'src')
const adminViewsPath = join(sourceRoot, 'views', 'admin')
function readSource(relativePath: string) {
return readFileSync(join(sourceRoot, relativePath), 'utf-8')
}
function findModalTags(source: string) {
return Array.from(source.matchAll(/<a-modal\b[\s\S]*?>/g), match => match[0])
}
function findUserFormModal(source: string) {
const match = source.match(/<AdminResponsiveModal\b[\s\S]*?@cancel="handleModalCancel"[\s\S]*?<\/AdminResponsiveModal>/)
return match?.[0] ?? ''
}
function findFormItem(source: string, name: string) {
const match = source.match(new RegExp(`<a-form-item\\b[\\s\\S]*?name="${name}"[\\s\\S]*?</a-form-item>`))
return match?.[0] ?? ''
}
describe('admin modal and user form behavior', () => {
it('keeps every backend modal open when users click the blank mask area', () => {
const responsiveModal = readSource('components/admin/AdminResponsiveModal.vue')
expect(responsiveModal).toMatch(/<a-modal\b[\s\S]*:mask-closable="false"/)
const missingMaskLock = readdirSync(adminViewsPath)
.filter(fileName => fileName.endsWith('.vue'))
.flatMap(fileName => {
const source = readFileSync(join(adminViewsPath, fileName), 'utf-8')
return findModalTags(source)
.map((tag, index) => ({ fileName, index: index + 1, tag }))
.filter(({ tag }) => !/:mask-closable\s*=\s*"false"/.test(tag))
.map(({ fileName, index }) => `${fileName} modal #${index}`)
})
expect(missingMaskLock).toEqual([])
})
it('shows only one editable phone field in the user create and edit form', () => {
const usersView = readSource('views/admin/UsersView.vue')
const userFormModal = findUserFormModal(usersView)
expect(userFormModal).toContain('name="phone"')
expect(userFormModal).not.toContain('name="contactPhone"')
expect(userFormModal).not.toContain('formState.contactPhone')
expect(usersView).toContain('const primaryPhone = formState.phone.trim()')
expect(usersView).toContain('phone: primaryPhone')
expect(usersView).toContain('contactPhone: primaryPhone')
})
it('uses a polished date picker and visible required markers for conditional user fields', () => {
const usersView = readSource('views/admin/UsersView.vue')
const userFormModal = findUserFormModal(usersView)
const wechatIdField = findFormItem(userFormModal, 'wechatId')
const shopIdsField = findFormItem(userFormModal, 'shopIds')
expect(userFormModal).not.toContain('type="date"')
expect(userFormModal).toContain('<a-date-picker')
expect(userFormModal).toContain('value-format="YYYY-MM-DD"')
expect(userFormModal).toContain('class="user-date-picker"')
expect(usersView).toContain('.user-date-picker')
expect(wechatIdField).toContain(':required="[2, 3].includes(Number(formState.type))"')
expect(shopIdsField).toContain(':required="Number(formState.type) !== 4"')
})
})
@@ -0,0 +1,47 @@
import { describe, expect, it } from 'vitest'
import { readFileSync, readdirSync } from 'node:fs'
import { join } from 'node:path'
const sourceRoot = join(process.cwd(), 'src')
const adminViewsPath = join(sourceRoot, 'views', 'admin')
function readSource(relativePath: string) {
return readFileSync(join(sourceRoot, relativePath), 'utf-8')
}
function findTableTags(source: string) {
return Array.from(source.matchAll(/<a-table\b[\s\S]*?>/g), match => match[0])
}
describe('admin table layout', () => {
it('keeps every admin table wide enough to scroll horizontally', () => {
const missingScrollX = readdirSync(adminViewsPath)
.filter(fileName => fileName.endsWith('.vue'))
.flatMap(fileName => {
const source = readFileSync(join(adminViewsPath, fileName), 'utf-8')
return findTableTags(source)
.map((tag, index) => ({ fileName, index: index + 1, tag }))
.filter(({ tag }) => !/:scroll\s*=\s*"\{[\s\S]*x:\s*'max-content'/.test(tag))
.map(({ fileName, index }) => `${fileName} table #${index}`)
})
expect(missingScrollX).toEqual([])
})
it('prevents backend table cells from breaking text into vertical columns', () => {
const adminLayout = readSource('views/admin/AdminLayout.vue')
expect(adminLayout).not.toMatch(/\.mobile-content\s+:deep\(\.ant-table-cell\)\s*\{[\s\S]*overflow-wrap:\s*anywhere/)
expect(adminLayout).toContain('table-layout: auto;')
expect(adminLayout).toContain('width: max-content;')
expect(adminLayout).toContain('word-break: keep-all;')
})
it('keeps table ellipsis text content-sized without arbitrary character breaking', () => {
const ellipsisText = readSource('components/TableEllipsisText.vue')
expect(ellipsisText).toContain('display: inline-block;')
expect(ellipsisText).not.toMatch(/^\s*width:\s*100%;$/m)
expect(ellipsisText).not.toContain('word-break: break-all;')
})
})
@@ -0,0 +1,76 @@
import { describe, expect, it } from 'vitest'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
const sourceRoot = join(process.cwd(), 'src')
const coreRoot = join(process.cwd(), '..', 'YumiNail-Core', 'src', 'main', 'java')
function readSource(relativePath: string) {
return readFileSync(join(sourceRoot, relativePath), 'utf-8')
}
describe('web theme governance', () => {
it('keeps login pages on the shared shop theme variables', () => {
const authView = readSource('views/AuthView.vue')
const adminLoginView = readSource('views/admin/AdminLoginView.vue')
expect(authView).not.toMatch(/#667eea|#764ba2/)
expect(authView).toContain('var(--theme-gradient)')
expect(authView).toContain('var(--theme-card-bg)')
expect(adminLoginView).not.toMatch(/--admin-mobile-accent|#d4866c|#c26e52/)
expect(adminLoginView).toContain('var(--theme-gradient)')
expect(adminLoginView).toContain('var(--theme-card-bg)')
})
it('does not reset admin routes back to an unrelated theme', () => {
const app = readSource('App.vue')
expect(app).not.toMatch(/if\s*\(\s*isAdminPage\s*\)\s*\{\s*resetShopTheme\(\)/)
expect(app).not.toMatch(/route\.matched\.some\(r => r\.meta\.isAdmin\)\)\s*\{\s*resetShopTheme\(\)/)
expect(app).toContain("mode: 'admin'")
})
it('derives backend mobile colors from the active shop theme', () => {
const adminMobile = readSource('styles/admin-mobile.css')
expect(adminMobile).toContain('--admin-mobile-ink: var(--text-primary);')
expect(adminMobile).toContain('--admin-mobile-card: var(--theme-card-bg);')
expect(adminMobile).toContain('--admin-mobile-accent: var(--theme-primary);')
expect(adminMobile).not.toMatch(/--admin-mobile-(?:ink|surface|card|accent|accent-strong|shell-start|shell-mid|shell-end):\s*#[0-9a-fA-F]{3,8}/)
expect(adminMobile).toContain('.admin-mobile-card__row strong')
expect(adminMobile).toContain('overflow-wrap: break-word;')
})
it('does not let feature pages redefine global theme variables', () => {
const systemMessages = readSource('views/admin/SystemMessagesView.vue')
expect(systemMessages).not.toMatch(/--theme-primary:\s*#[0-9a-fA-F]{3,8}/)
expect(systemMessages).not.toMatch(/--theme-gradient:\s*linear-gradient\([^;]*#[0-9a-fA-F]{3,8}/)
})
it('keeps the web customer surface in a centered phone shell on desktop', () => {
const app = readSource('App.vue')
const globalStyle = readSource('style.css')
expect(app).toContain('yumi-phone-frame')
expect(app).toContain('yumi-phone-frame--hidden-nav')
expect(globalStyle).toMatch(/--frontend-page-max-width:\s*430px/)
expect(globalStyle).toContain('--theme-neutral: #4A443F;')
expect(globalStyle).toContain('--theme-tertiary: #FDFBF9;')
expect(globalStyle).toContain('.yumi-phone-frame')
expect(globalStyle).toContain('.yumi-page')
expect(globalStyle).toContain('.yumi-glass-card')
expect(globalStyle).toContain('.yumi-status-chip')
expect(globalStyle).toContain('.yumi-bottom-action')
expect(globalStyle).toContain('max-width: var(--frontend-page-max-width);')
expect(globalStyle).not.toMatch(/--theme-primary:\s*#7C5357/)
})
it('keeps frontend and backend platform overview permission allowlists aligned', () => {
const frontend = readSource('utils/platform-admin-permissions.ts')
const backend = readFileSync(join(coreRoot, 'com', 'xiaowang', 'yuminailcore', 'support', 'PermissionCatalog.java'), 'utf-8')
expect(backend).toContain('"security:audit:view"')
expect(frontend).toContain("'security:audit:view'")
})
})
+3 -2
View File
@@ -10,6 +10,7 @@ export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const proxyTarget = (env.VITE_DEV_PROXY_TARGET || 'http://127.0.0.1:80').trim()
const proxyToCoreDirectly = /(^|:)81(\/|$)/.test(proxyTarget)
const shouldWriteDeclarationFiles = mode === 'development'
return {
plugins: [
@@ -17,11 +18,11 @@ export default defineConfig(({ mode }) => {
AutoImport({
resolvers: [ElementPlusResolver()],
imports: ['vue', 'vue-router', 'pinia'],
dts: 'src/auto-import.d.ts'
dts: shouldWriteDeclarationFiles ? 'src/auto-import.d.ts' : false
}),
Components({
resolvers: [ElementPlusResolver(), AntDesignVueResolver({ importStyle: 'less' })],
dts: 'src/components.d.ts'
dts: shouldWriteDeclarationFiles ? 'src/components.d.ts' : false
}),
{
name: 'ip-access-control',