功能:更新消息中心和 YumiNail 模块

This commit is contained in:
xiaowang
2026-05-13 12:43:01 +08:00
parent 6b9eba5aca
commit 2074addc40
284 changed files with 21031 additions and 4533 deletions
+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>YumiNail Calendar</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
File diff suppressed because it is too large Load Diff
+24
View File
@@ -0,0 +1,24 @@
{
"name": "yuminail-calendar-frontend",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc -b && vite build",
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.13.5",
"element-plus": "^2.13.2",
"vue": "^3.5.25"
},
"devDependencies": {
"@types/node": "^24.10.13",
"@vitejs/plugin-vue": "^6.0.2",
"@vue/tsconfig": "^0.8.1",
"typescript": "~5.9.3",
"vite": "^7.3.1",
"vue-tsc": "^3.1.5"
}
}
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

File diff suppressed because it is too large Load Diff
@@ -0,0 +1,78 @@
import http from './http'
import type {
AppointmentDashboard,
AppointmentExportData,
AppointmentPayload,
CalendarAppointment,
CalendarDaySummary,
} from '@/types/appointment'
export const appointmentApi = {
getDayAppointments(date: string, keyword?: string, sortBy = 'time') {
return http.get<any, CalendarAppointment[]>('/appointment/day', {
params: { date, keyword: keyword || undefined, sortBy },
})
},
searchAppointments(params: {
startDate?: string
endDate?: string
customerId?: string
keyword?: string
serviceName?: string
status?: string
sortBy?: string
}) {
return http.get<any, CalendarAppointment[]>('/appointment/list', { params })
},
getMonthOverview(month: string) {
return http.get<any, CalendarDaySummary[]>('/appointment/month-overview', {
params: { month },
})
},
getDashboard(date?: string) {
return http.get<any, AppointmentDashboard>('/appointment/dashboard', {
params: { date },
})
},
getAppointment(id: string) {
return http.get<any, CalendarAppointment>(`/appointment/${id}`)
},
createAppointment(payload: AppointmentPayload) {
return http.post<any, CalendarAppointment[]>('/appointment', payload)
},
updateAppointment(id: string, payload: AppointmentPayload) {
return http.put<any, CalendarAppointment[]>(`/appointment/${id}`, payload)
},
deleteAppointment(id: string, deleteSeries = false) {
return http.delete<any, void>(`/appointment/${id}`, {
params: { deleteSeries },
})
},
batchDelete(ids: string[], deleteSeries = false) {
return http.post<any, void>('/appointment/batch-delete', {
ids,
deleteSeries,
})
},
updateStatus(id: string, status: string) {
return http.patch<any, CalendarAppointment>(`/appointment/${id}/status`, {
status,
})
},
updateStatusWithExpected(id: string, status: string, expectedUpdateTime?: string | null) {
return http.patch<any, CalendarAppointment>(`/appointment/${id}/status`, {
status,
expectedUpdateTime: expectedUpdateTime || undefined,
})
},
exportAppointments(startDate?: string, endDate?: string) {
return http.get<any, AppointmentExportData>('/appointment/export', {
params: { startDate, endDate },
})
},
importAppointments(appointments: AppointmentPayload[]) {
return http.post<any, CalendarAppointment[]>('/appointment/import', {
appointments,
})
},
}
@@ -0,0 +1,11 @@
import http from './http'
import type { BackupExportData } from '@/types/appointment'
export const backupApi = {
exportAll() {
return http.get<any, BackupExportData>('/backup/export')
},
importAll(payload: BackupExportData) {
return http.post<any, void>('/backup/import', payload)
},
}
@@ -0,0 +1,20 @@
import http from './http'
import type { CustomerPayload, CustomerProfile } from '@/types/appointment'
export const customerApi = {
searchCustomers(params: { keyword?: string; tag?: string }) {
return http.get<any, CustomerProfile[]>('/customer/list', { params })
},
getCustomer(id: string) {
return http.get<any, CustomerProfile>(`/customer/${id}`)
},
createCustomer(payload: CustomerPayload) {
return http.post<any, CustomerProfile>('/customer', payload)
},
updateCustomer(id: string, payload: CustomerPayload) {
return http.put<any, CustomerProfile>(`/customer/${id}`, payload)
},
deleteCustomer(id: string) {
return http.delete<any, void>(`/customer/${id}`)
},
}
@@ -0,0 +1,48 @@
import axios from 'axios'
interface ApiResponse<T> {
code: number
message: string
data: T
}
export interface ApiError extends Error {
code?: number
}
const http = axios.create({
baseURL: '/calendar-api',
timeout: 12000,
})
http.interceptors.response.use(
(response) => {
const payload = response.data as ApiResponse<unknown>
if (payload && typeof payload.code !== 'undefined') {
if (payload.code === 200) {
return payload.data
}
const error = new Error(payload.message || '请求失败') as ApiError
error.code = payload.code
return Promise.reject(error)
}
return response.data
},
(error) => {
const apiError = new Error(
error?.response?.data?.message || error?.message || '网络连接异常,请稍后重试',
) as ApiError
apiError.code = error?.response?.data?.code
if (!apiError.code && error?.response?.status) {
apiError.code = error.response.status
}
const message =
error?.response?.data?.message ||
error?.message ||
'网络连接异常,请稍后重试'
apiError.message = message
return Promise.reject(apiError)
},
)
export default http
@@ -0,0 +1,27 @@
import http from './http'
import type { OrderPayload, ServiceOrder } from '@/types/appointment'
export const orderApi = {
searchOrders(params: {
startDate?: string
endDate?: string
customerId?: string
appointmentId?: string
keyword?: string
paymentStatus?: string
}) {
return http.get<any, ServiceOrder[]>('/order/list', { params })
},
getOrder(id: string) {
return http.get<any, ServiceOrder>(`/order/${id}`)
},
createOrder(payload: OrderPayload) {
return http.post<any, ServiceOrder>('/order', payload)
},
updateOrder(id: string, payload: OrderPayload) {
return http.put<any, ServiceOrder>(`/order/${id}`, payload)
},
deleteOrder(id: string) {
return http.delete<any, void>(`/order/${id}`)
},
}
@@ -0,0 +1,275 @@
<template>
<el-drawer
:model-value="visible"
:title="appointment ? '编辑预约' : '新建预约'"
size="520px"
@close="emit('close')"
>
<el-form ref="formRef" :model="form" :rules="rules" label-position="top">
<div class="drawer-grid">
<el-form-item label="关联客户">
<div class="inline-row">
<el-select v-model="form.customerId" filterable clearable placeholder="选择已有客户" @change="handleCustomerChange">
<el-option
v-for="item in customers"
:key="item.id"
:label="`${item.name}${item.phone ? ` / ${item.phone}` : ''}`"
:value="item.id"
/>
</el-select>
<el-button plain @click="emit('request-create-customer')">新建客户</el-button>
</div>
</el-form-item>
<el-form-item label="客户姓名" prop="customerName">
<el-input v-model="form.customerName" placeholder="例如:陈小姐" />
</el-form-item>
<el-form-item label="联系电话" prop="customerPhone">
<el-input v-model="form.customerPhone" placeholder="可选,支持手机号或座机" />
</el-form-item>
<el-form-item label="服务项目" prop="serviceName">
<el-input v-model="form.serviceName" placeholder="例如:法式延长、猫眼补甲" />
</el-form-item>
<el-form-item label="预约类型" prop="appointmentType">
<el-select v-model="form.appointmentType" placeholder="请选择预约类型">
<el-option label="普通服务" value="NORMAL" />
<el-option label="VIP 服务" value="VIP" />
<el-option label="复诊维护" value="FOLLOW_UP" />
</el-select>
</el-form-item>
<el-form-item label="开始时间" prop="appointmentStartTime">
<el-date-picker
v-model="form.appointmentStartTime"
type="datetime"
value-format="YYYY-MM-DDTHH:mm:ss"
placeholder="请选择开始时间"
/>
</el-form-item>
<el-form-item label="结束时间" prop="appointmentEndTime">
<el-date-picker
v-model="form.appointmentEndTime"
type="datetime"
value-format="YYYY-MM-DDTHH:mm:ss"
placeholder="请选择结束时间"
/>
</el-form-item>
<el-form-item label="提前提醒">
<el-input-number v-model="form.reminderMinutes" :min="0" :max="10080" />
</el-form-item>
<el-form-item label="通知开关">
<el-switch v-model="form.notificationEnabled" />
</el-form-item>
<el-form-item label="重复规则">
<el-select v-model="form.repeatType">
<el-option label="不重复" value="NONE" />
<el-option label="每周重复" value="WEEKLY" />
<el-option label="每月重复" value="MONTHLY" />
</el-select>
</el-form-item>
<el-form-item v-if="form.repeatType !== 'NONE'" label="重复截止日期" prop="repeatUntil">
<el-date-picker
v-model="form.repeatUntil"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择截止日期"
/>
</el-form-item>
<el-form-item label="订单号">
<el-input v-model="form.orderReference" placeholder="可选,填写关联订单号" />
</el-form-item>
</div>
<el-form-item label="备注">
<el-input v-model="form.notes" type="textarea" :rows="4" placeholder="例如:偏好颜色、过敏提示、照片链接等" />
</el-form-item>
<el-form-item v-if="appointment?.seriesId" label="批量更新">
<el-checkbox v-model="form.applyToSeries">应用到当前系列后续预约</el-checkbox>
</el-form-item>
</el-form>
<template #footer>
<div class="drawer-footer">
<el-button @click="emit('close')">取消</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">保存预约</el-button>
</div>
</template>
</el-drawer>
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
import type { AppointmentPayload, CalendarAppointment, CustomerProfile } from '@/types/appointment'
const props = defineProps<{
visible: boolean
initialDate: string
appointment: CalendarAppointment | null
submitting: boolean
customers: CustomerProfile[]
initialValue?: Partial<AppointmentPayload> | null
}>()
const emit = defineEmits<{
(event: 'close'): void
(event: 'submit', payload: AppointmentPayload): void
(event: 'request-create-customer'): void
}>()
const formRef = ref<FormInstance>()
const form = reactive<AppointmentPayload>({
customerId: '',
customerName: '',
customerPhone: '',
appointmentStartTime: '',
appointmentEndTime: '',
serviceName: '',
appointmentType: 'NORMAL',
orderReference: '',
notes: '',
reminderMinutes: 60,
repeatType: 'NONE',
repeatUntil: '',
notificationEnabled: true,
applyToSeries: false,
})
const rules: FormRules = {
customerName: [{ required: true, message: '请输入客户姓名', trigger: 'blur' }],
serviceName: [{ required: true, message: '请输入服务项目', trigger: 'blur' }],
appointmentType: [{ required: true, message: '请选择预约类型', trigger: 'change' }],
appointmentStartTime: [{ required: true, message: '请选择开始时间', trigger: 'change' }],
appointmentEndTime: [{ required: true, message: '请选择结束时间', trigger: 'change' }],
repeatUntil: [
{
validator: (_rule, value, callback) => {
if (form.repeatType !== 'NONE' && !value) {
callback(new Error('请选择重复截止日期'))
return
}
callback()
},
trigger: 'change',
},
],
}
watch(
() => [props.visible, props.appointment, props.initialDate, props.initialValue],
() => {
if (!props.visible) {
return
}
resetForm()
},
{ immediate: true },
)
function resetForm() {
const baseDate = props.initialDate || new Date().toISOString().slice(0, 10)
const defaultStart = `${baseDate}T10:00:00`
const defaultEnd = `${baseDate}T11:30:00`
form.customerId = props.appointment?.customerId || props.initialValue?.customerId || ''
form.customerName = props.appointment?.customerName || props.initialValue?.customerName || ''
form.customerPhone = props.appointment?.customerPhone || props.initialValue?.customerPhone || ''
form.appointmentStartTime = props.appointment?.appointmentStartTime || props.initialValue?.appointmentStartTime || defaultStart
form.appointmentEndTime = props.appointment?.appointmentEndTime || props.initialValue?.appointmentEndTime || defaultEnd
form.serviceName = props.appointment?.serviceName || props.initialValue?.serviceName || ''
form.appointmentType = props.appointment?.appointmentType || props.initialValue?.appointmentType || 'NORMAL'
form.orderReference = props.appointment?.orderReference || props.initialValue?.orderReference || ''
form.notes = props.appointment?.notes || props.initialValue?.notes || ''
form.reminderMinutes = props.appointment?.reminderMinutes ?? props.initialValue?.reminderMinutes ?? 60
form.repeatType = props.appointment?.repeatType || props.initialValue?.repeatType || 'NONE'
form.repeatUntil = props.appointment?.repeatUntil || props.initialValue?.repeatUntil || ''
form.notificationEnabled = props.appointment?.notificationEnabled ?? props.initialValue?.notificationEnabled ?? true
form.applyToSeries = false
formRef.value?.clearValidate()
}
function handleCustomerChange(customerId: string) {
const customer = props.customers.find((item) => item.id === customerId)
if (!customer) {
return
}
form.customerName = customer.name
form.customerPhone = customer.phone || ''
}
async function handleSubmit() {
const valid = await formRef.value?.validate().catch(() => false)
if (!valid) {
return
}
if (new Date(form.appointmentEndTime).getTime() <= new Date(form.appointmentStartTime).getTime()) {
ElMessage.error('预约结束时间必须晚于开始时间')
return
}
emit('submit', {
customerId: form.customerId || null,
customerName: form.customerName,
customerPhone: form.customerPhone,
appointmentStartTime: form.appointmentStartTime,
appointmentEndTime: form.appointmentEndTime,
serviceName: form.serviceName,
appointmentType: form.appointmentType,
orderReference: form.orderReference,
notes: form.notes,
reminderMinutes: form.reminderMinutes,
repeatType: form.repeatType,
repeatUntil: form.repeatType === 'NONE' ? null : form.repeatUntil,
notificationEnabled: form.notificationEnabled,
applyToSeries: form.applyToSeries,
})
}
</script>
<style scoped>
.drawer-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px 14px;
}
.inline-row {
display: flex;
gap: 10px;
width: 100%;
}
.inline-row :deep(.el-select) {
flex: 1;
}
.drawer-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
}
@media (max-width: 720px) {
.drawer-grid {
grid-template-columns: 1fr;
}
.inline-row {
flex-direction: column;
}
}
</style>
@@ -0,0 +1,309 @@
<template>
<section class="appointment-list">
<div class="appointment-list__header">
<div>
<p class="appointment-list__eyebrow">{{ displayMode === 'calendar' ? 'Selected Day' : 'Search Result' }}</p>
<h2>{{ title }}</h2>
</div>
<div class="appointment-list__summary">
<strong>{{ appointments.length }}</strong>
<span>条预约</span>
</div>
</div>
<div v-if="selectedIds.length" class="appointment-list__batch">
<span>已选 {{ selectedIds.length }} 条</span>
<div class="appointment-list__batch-actions">
<el-button size="small" @click="emit('batch-delete', selectedIds, false)">批量删除</el-button>
<el-button size="small" type="danger" plain @click="emit('batch-delete', selectedIds, true)">整组删除</el-button>
</div>
</div>
<div v-loading="loading" class="appointment-list__cards">
<el-empty v-if="!appointments.length" description="当前条件下还没有预约,试试长按日历空白日期快速创建。" />
<article v-for="item in appointments" :key="item.id" class="appointment-card">
<div class="appointment-card__top">
<el-checkbox
:model-value="selectedIds.includes(item.id)"
@change="(value: string | number | boolean) => toggleSelection(item.id, Boolean(value))"
/>
<div class="appointment-card__headline">
<h3>{{ item.customerName }}</h3>
<p>{{ formatTimeRange(item.appointmentStartTime, item.appointmentEndTime) }}</p>
</div>
<el-tag :type="statusType(item.status)" effect="light">{{ statusLabel(item.status) }}</el-tag>
</div>
<div class="appointment-card__meta">
<span>{{ item.serviceName }}</span>
<span>{{ typeLabel(item.appointmentType) }}</span>
<span v-if="item.customerPhone">{{ item.customerPhone }}</span>
<span v-if="item.orderReference">订单号:{{ item.orderReference }}</span>
<span>提醒:提前 {{ item.reminderMinutes }} 分钟</span>
<span v-if="item.repeatType !== 'NONE'">重复:{{ repeatLabel(item.repeatType) }}</span>
</div>
<p v-if="item.notes" class="appointment-card__note">{{ item.notes }}</p>
<div class="appointment-card__actions">
<el-button size="small" @click="emit('edit', item)">编辑</el-button>
<el-button size="small" plain @click="emit('create-order', item)">
{{ item.orderId ? '查看订单' : '转订单' }}
</el-button>
<el-button
v-if="item.status === 'SCHEDULED'"
size="small"
type="warning"
plain
@click="emit('update-status', item, 'IN_SERVICE')"
>
服务中
</el-button>
<el-button
v-if="item.status !== 'COMPLETED'"
size="small"
type="success"
plain
@click="emit('update-status', item, 'COMPLETED')"
>
完成
</el-button>
<el-button
v-if="item.status !== 'SCHEDULED'"
size="small"
plain
@click="emit('update-status', item, 'SCHEDULED')"
>
恢复待服务
</el-button>
<el-button
v-if="item.status !== 'CANCELLED'"
size="small"
plain
@click="emit('update-status', item, 'CANCELLED')"
>
取消
</el-button>
<el-button
v-if="item.status !== 'NO_SHOW'"
size="small"
plain
@click="emit('update-status', item, 'NO_SHOW')"
>
爽约
</el-button>
<el-button size="small" type="danger" plain @click="emit('delete', item, false)">删除</el-button>
<el-button
v-if="item.seriesId"
size="small"
type="danger"
link
@click="emit('delete', item, true)"
>
删整组
</el-button>
</div>
</article>
</div>
</section>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import type { CalendarAppointment } from '@/types/appointment'
import { formatTimeRange } from '@/utils/date'
const props = defineProps<{
appointments: CalendarAppointment[]
loading: boolean
displayMode: 'calendar' | 'list'
title: string
}>()
const emit = defineEmits<{
(event: 'edit', appointment: CalendarAppointment): void
(event: 'delete', appointment: CalendarAppointment, deleteSeries: boolean): void
(event: 'update-status', appointment: CalendarAppointment, status: string): void
(event: 'batch-delete', ids: string[], deleteSeries: boolean): void
(event: 'create-order', appointment: CalendarAppointment): void
}>()
const selectedIds = ref<string[]>([])
watch(
() => props.appointments,
(appointments) => {
const validIds = new Set(appointments.map((item) => item.id))
selectedIds.value = selectedIds.value.filter((id) => validIds.has(id))
},
{ deep: true },
)
function toggleSelection(id: string, checked: boolean) {
if (checked) {
selectedIds.value = Array.from(new Set([...selectedIds.value, id]))
return
}
selectedIds.value = selectedIds.value.filter((item) => item !== id)
}
function statusType(status: string) {
if (status === 'COMPLETED') return 'success'
if (status === 'IN_SERVICE') return 'warning'
if (status === 'CANCELLED') return 'warning'
if (status === 'NO_SHOW') return 'danger'
return 'info'
}
function statusLabel(status: string) {
if (status === 'IN_SERVICE') return '服务中'
if (status === 'COMPLETED') return '已完成'
if (status === 'CANCELLED') return '已取消'
if (status === 'NO_SHOW') return '已爽约'
return '待服务'
}
function typeLabel(type: string) {
if (type === 'VIP') return 'VIP'
if (type === 'FOLLOW_UP') return '复诊'
return '普通'
}
function repeatLabel(type: string) {
if (type === 'WEEKLY') return '每周'
if (type === 'MONTHLY') return '每月'
return '不重复'
}
</script>
<style scoped>
.appointment-list {
display: flex;
flex-direction: column;
gap: 18px;
}
.appointment-list__header {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 16px;
}
.appointment-list__eyebrow {
margin: 0 0 6px;
color: var(--muted-text);
font-size: 12px;
letter-spacing: 0.24em;
text-transform: uppercase;
}
.appointment-list__header h2 {
margin: 0;
font-size: 26px;
}
.appointment-list__summary {
display: inline-flex;
align-items: baseline;
gap: 6px;
padding: 12px 16px;
border-radius: 16px;
background: rgba(255, 255, 255, 0.7);
}
.appointment-list__summary strong {
font-size: 28px;
}
.appointment-list__batch {
display: flex;
justify-content: space-between;
gap: 16px;
align-items: center;
padding: 14px 18px;
border-radius: 16px;
background: rgba(209, 119, 61, 0.12);
}
.appointment-list__batch-actions {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.appointment-list__cards {
display: flex;
flex-direction: column;
gap: 14px;
min-height: 280px;
}
.appointment-card {
padding: 20px;
border-radius: 24px;
background: rgba(255, 255, 255, 0.82);
border: 1px solid rgba(205, 178, 158, 0.36);
box-shadow: 0 18px 36px rgba(83, 47, 30, 0.08);
display: flex;
flex-direction: column;
gap: 14px;
}
.appointment-card__top {
display: grid;
grid-template-columns: auto 1fr auto;
gap: 12px;
align-items: center;
}
.appointment-card__headline h3 {
margin: 0;
font-size: 20px;
}
.appointment-card__headline p {
margin: 6px 0 0;
color: var(--muted-text);
}
.appointment-card__meta {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.appointment-card__meta span {
padding: 8px 12px;
border-radius: 999px;
background: rgba(49, 37, 30, 0.06);
font-size: 13px;
}
.appointment-card__note {
margin: 0;
padding: 12px 14px;
border-radius: 16px;
background: rgba(251, 239, 231, 0.85);
color: var(--muted-text);
}
.appointment-card__actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
@media (max-width: 720px) {
.appointment-list__header,
.appointment-list__batch {
flex-direction: column;
align-items: flex-start;
}
.appointment-card__top {
grid-template-columns: 1fr;
}
}
</style>
@@ -0,0 +1,261 @@
<template>
<section class="calendar-board">
<div class="calendar-board__header">
<div>
<p class="calendar-board__eyebrow">Calendar</p>
<h2>{{ formatMonthLabel(currentMonth) }}</h2>
</div>
<div class="calendar-board__actions">
<el-button circle plain @click="emit('change-month', -1)">‹</el-button>
<el-button circle plain @click="emit('change-month', 1)">›</el-button>
<el-button plain @click="emit('change-mode', calendarMode === 'month' ? 'week' : 'month')">
{{ calendarMode === 'month' ? '切换周视图' : '切换月视图' }}
</el-button>
</div>
</div>
<div
class="calendar-board__surface"
@touchstart="onTouchStart"
@touchend="onTouchEnd"
>
<div class="calendar-board__weekdays">
<span v-for="weekday in weekdays" :key="weekday">{{ weekday }}</span>
</div>
<div class="calendar-board__grid" :class="`calendar-board__grid--${calendarMode}`">
<button
v-for="cell in visibleCells"
:key="cell.dateKey"
type="button"
class="calendar-cell"
:class="{
'calendar-cell--muted': !cell.isCurrentMonth,
'calendar-cell--today': cell.isToday,
'calendar-cell--selected': selectedDate === cell.dateKey,
}"
@click="emit('select-date', cell.dateKey)"
@mousedown="startLongPress(cell.dateKey)"
@mouseup="clearLongPress"
@mouseleave="clearLongPress"
@touchstart="startLongPress(cell.dateKey)"
@touchend="clearLongPress"
>
<span class="calendar-cell__day">{{ cell.dayNumber }}</span>
<div v-if="getSummary(cell.dateKey)" class="calendar-cell__meta">
<strong>{{ getSummary(cell.dateKey)?.totalCount }}</strong>
<span>{{ getSummary(cell.dateKey)?.completedCount }}/{{ getSummary(cell.dateKey)?.scheduledCount }}</span>
</div>
</button>
</div>
</div>
<p class="calendar-board__hint">左右滑动切月,上滑切到周视图,长按日期快速新建预约。</p>
</section>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import type { CalendarDaySummary } from '@/types/appointment'
import { buildCalendarCells, formatMonthLabel, getWeekCells, summaryMap } from '@/utils/date'
const props = defineProps<{
currentMonth: string
selectedDate: string
calendarMode: 'month' | 'week'
overview: CalendarDaySummary[]
}>()
const emit = defineEmits<{
(event: 'change-month', offset: number): void
(event: 'select-date', dateKey: string): void
(event: 'change-mode', mode: 'month' | 'week'): void
(event: 'request-create', dateKey: string): void
}>()
const weekdays = ['一', '二', '三', '四', '五', '六', '日']
const touchStartPoint = ref({ x: 0, y: 0 })
const longPressTimer = ref<number | null>(null)
const overviewByDate = computed(() => summaryMap(props.overview))
const visibleCells = computed(() =>
props.calendarMode === 'week'
? getWeekCells(props.currentMonth, props.selectedDate)
: buildCalendarCells(props.currentMonth),
)
function onTouchStart(event: TouchEvent) {
const touch = event.changedTouches[0]
if (!touch) {
return
}
touchStartPoint.value = { x: touch.clientX, y: touch.clientY }
}
function onTouchEnd(event: TouchEvent) {
const touch = event.changedTouches[0]
if (!touch) {
return
}
const offsetX = touch.clientX - touchStartPoint.value.x
const offsetY = touch.clientY - touchStartPoint.value.y
if (Math.abs(offsetX) > 48 && Math.abs(offsetX) > Math.abs(offsetY)) {
emit('change-month', offsetX < 0 ? 1 : -1)
return
}
if (Math.abs(offsetY) > 48 && Math.abs(offsetY) > Math.abs(offsetX)) {
emit('change-mode', offsetY < 0 ? 'week' : 'month')
}
}
function startLongPress(dateKey: string) {
clearLongPress()
longPressTimer.value = window.setTimeout(() => {
emit('request-create', dateKey)
}, 520)
}
function clearLongPress() {
if (longPressTimer.value) {
clearTimeout(longPressTimer.value)
longPressTimer.value = null
}
}
function getSummary(dateKey: string) {
return overviewByDate.value[dateKey]
}
</script>
<style scoped>
.calendar-board {
display: flex;
flex-direction: column;
gap: 18px;
}
.calendar-board__header {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 16px;
}
.calendar-board__eyebrow {
margin: 0 0 6px;
font-size: 12px;
letter-spacing: 0.28em;
text-transform: uppercase;
color: var(--muted-text);
}
.calendar-board__header h2 {
margin: 0;
font-size: 28px;
}
.calendar-board__actions {
display: flex;
gap: 10px;
flex-wrap: wrap;
justify-content: flex-end;
}
.calendar-board__surface {
display: flex;
flex-direction: column;
gap: 14px;
}
.calendar-board__weekdays,
.calendar-board__grid {
display: grid;
grid-template-columns: repeat(7, minmax(0, 1fr));
}
.calendar-board__weekdays {
gap: 10px;
}
.calendar-board__weekdays span {
text-align: center;
font-size: 13px;
color: var(--muted-text);
}
.calendar-board__grid {
gap: 10px;
}
.calendar-cell {
min-height: 88px;
border: 1px solid var(--line-color);
border-radius: 18px;
background: rgba(255, 255, 255, 0.72);
color: var(--text-color);
padding: 12px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.calendar-cell:hover {
transform: translateY(-2px);
border-color: var(--accent-color);
box-shadow: 0 12px 26px rgba(197, 120, 78, 0.14);
}
.calendar-cell--muted {
opacity: 0.45;
}
.calendar-cell--today {
border-color: rgba(209, 119, 61, 0.55);
}
.calendar-cell--selected {
background: linear-gradient(180deg, rgba(240, 146, 96, 0.18), rgba(255, 255, 255, 0.9));
border-color: var(--accent-color);
}
.calendar-cell__day {
font-size: 17px;
font-weight: 700;
}
.calendar-cell__meta {
display: inline-flex;
flex-direction: column;
gap: 4px;
align-items: flex-start;
padding: 8px 10px;
border-radius: 14px;
background: rgba(49, 37, 30, 0.06);
font-size: 11px;
}
.calendar-cell__meta strong {
font-size: 16px;
}
.calendar-board__hint {
margin: 0;
color: var(--muted-text);
font-size: 13px;
}
@media (max-width: 720px) {
.calendar-board__header {
flex-direction: column;
}
.calendar-cell {
min-height: 72px;
padding: 10px;
}
}
</style>
@@ -0,0 +1,110 @@
<template>
<el-drawer
:model-value="visible"
:title="customer ? '编辑客户' : '新建客户'"
size="480px"
@close="emit('close')"
>
<el-form ref="formRef" :model="form" :rules="rules" label-position="top">
<el-form-item label="客户姓名" prop="name">
<el-input v-model="form.name" placeholder="例如:林小姐" />
</el-form-item>
<el-form-item label="联系电话">
<el-input v-model="form.phone" placeholder="可选,支持手机号或座机" />
</el-form-item>
<el-form-item label="标签">
<el-input v-model="form.tags" placeholder="例如:猫眼偏好 / 易沟通 / 老客" />
</el-form-item>
<el-form-item label="偏好">
<el-input v-model="form.preferences" type="textarea" :rows="3" placeholder="记录颜色、风格、款式偏好" />
</el-form-item>
<el-form-item label="禁忌或注意事项">
<el-input v-model="form.cautions" type="textarea" :rows="3" placeholder="例如:甲油胶过敏、手部护理注意点" />
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.notes" type="textarea" :rows="4" placeholder="补充客户习惯、沟通记录等" />
</el-form-item>
</el-form>
<template #footer>
<div class="drawer-footer">
<el-button @click="emit('close')">取消</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">保存客户</el-button>
</div>
</template>
</el-drawer>
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import type { CustomerPayload, CustomerProfile } from '@/types/appointment'
const props = defineProps<{
visible: boolean
customer: CustomerProfile | null
submitting: boolean
initialValue?: Partial<CustomerPayload> | null
}>()
const emit = defineEmits<{
(event: 'close'): void
(event: 'submit', payload: CustomerPayload): void
}>()
const formRef = ref<FormInstance>()
const form = reactive<CustomerPayload>({
name: '',
phone: '',
notes: '',
preferences: '',
cautions: '',
tags: '',
})
const rules: FormRules = {
name: [{ required: true, message: '请输入客户姓名', trigger: 'blur' }],
}
watch(
() => [props.visible, props.customer, props.initialValue],
() => {
if (!props.visible) {
return
}
form.name = props.customer?.name || props.initialValue?.name || ''
form.phone = props.customer?.phone || props.initialValue?.phone || ''
form.notes = props.customer?.notes || props.initialValue?.notes || ''
form.preferences = props.customer?.preferences || props.initialValue?.preferences || ''
form.cautions = props.customer?.cautions || props.initialValue?.cautions || ''
form.tags = props.customer?.tags || props.initialValue?.tags || ''
formRef.value?.clearValidate()
},
{ immediate: true },
)
async function handleSubmit() {
const valid = await formRef.value?.validate().catch(() => false)
if (!valid) {
return
}
emit('submit', {
name: form.name,
phone: form.phone,
notes: form.notes,
preferences: form.preferences,
cautions: form.cautions,
tags: form.tags,
})
}
</script>
<style scoped>
.drawer-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
}
</style>
@@ -0,0 +1,161 @@
<template>
<section class="entity-list">
<div class="entity-list__header">
<div>
<p class="entity-list__eyebrow">Customers</p>
<h2>客户档案</h2>
</div>
<div class="entity-list__summary">
<strong>{{ customers.length }}</strong>
<span>位客户</span>
</div>
</div>
<div class="entity-list__cards">
<el-empty v-if="!customers.length" description="还没有客户档案,可以从预约或这里直接创建。" />
<article v-for="customer in customers" :key="customer.id" class="entity-card">
<div class="entity-card__header">
<div>
<h3>{{ customer.name }}</h3>
<p>{{ customer.phone || '未填写联系电话' }}</p>
</div>
<el-tag type="info" effect="light">{{ customer.totalVisitCount }} 次到店</el-tag>
</div>
<div class="entity-card__chips">
<span>累计消费 ¥{{ customer.totalSpentAmount || 0 }}</span>
<span v-if="customer.tags">{{ customer.tags }}</span>
<span v-if="customer.lastVisitTime">最近到店 {{ customer.lastVisitTime.slice(0, 10) }}</span>
</div>
<p v-if="customer.preferences" class="entity-card__text">偏好:{{ customer.preferences }}</p>
<p v-if="customer.cautions" class="entity-card__text">禁忌:{{ customer.cautions }}</p>
<p v-if="customer.notes" class="entity-card__text">备注:{{ customer.notes }}</p>
<div class="entity-card__actions">
<el-button size="small" @click="emit('edit', customer)">编辑</el-button>
<el-button size="small" plain @click="emit('create-appointment', customer)">新建预约</el-button>
<el-button size="small" plain @click="emit('create-order', customer)">新建订单</el-button>
<el-button size="small" type="danger" plain @click="emit('delete', customer)">删除</el-button>
</div>
</article>
</div>
</section>
</template>
<script setup lang="ts">
import type { CustomerProfile } from '@/types/appointment'
defineProps<{
customers: CustomerProfile[]
}>()
const emit = defineEmits<{
(event: 'edit', customer: CustomerProfile): void
(event: 'delete', customer: CustomerProfile): void
(event: 'create-appointment', customer: CustomerProfile): void
(event: 'create-order', customer: CustomerProfile): void
}>()
</script>
<style scoped>
.entity-list {
display: flex;
flex-direction: column;
gap: 18px;
}
.entity-list__header {
display: flex;
justify-content: space-between;
gap: 16px;
align-items: flex-start;
}
.entity-list__eyebrow {
margin: 0 0 6px;
font-size: 12px;
letter-spacing: 0.24em;
text-transform: uppercase;
color: var(--muted-text);
}
.entity-list__header h2 {
margin: 0;
font-size: 26px;
}
.entity-list__summary {
display: inline-flex;
align-items: baseline;
gap: 6px;
padding: 12px 16px;
border-radius: 16px;
background: rgba(255, 255, 255, 0.7);
}
.entity-list__cards {
display: flex;
flex-direction: column;
gap: 14px;
}
.entity-card {
padding: 20px;
border-radius: 24px;
background: rgba(255, 255, 255, 0.82);
border: 1px solid rgba(205, 178, 158, 0.36);
box-shadow: 0 18px 36px rgba(83, 47, 30, 0.08);
display: flex;
flex-direction: column;
gap: 12px;
}
.entity-card__header {
display: flex;
justify-content: space-between;
gap: 16px;
}
.entity-card__header h3 {
margin: 0;
font-size: 20px;
}
.entity-card__header p {
margin: 6px 0 0;
color: var(--muted-text);
}
.entity-card__chips {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.entity-card__chips span {
padding: 8px 12px;
border-radius: 999px;
background: rgba(49, 37, 30, 0.06);
font-size: 13px;
}
.entity-card__text {
margin: 0;
color: var(--muted-text);
}
.entity-card__actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
@media (max-width: 720px) {
.entity-list__header,
.entity-card__header {
flex-direction: column;
}
}
</style>
@@ -0,0 +1,181 @@
<template>
<el-drawer
:model-value="visible"
:title="order ? '编辑订单' : '新建订单'"
size="520px"
@close="emit('close')"
>
<el-form ref="formRef" :model="form" :rules="rules" label-position="top">
<div class="drawer-grid">
<el-form-item label="关联客户">
<el-select v-model="form.customerId" filterable clearable placeholder="可选择已有客户">
<el-option
v-for="item in customers"
:key="item.id"
:label="`${item.name}${item.phone ? ` / ${item.phone}` : ''}`"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="关联预约">
<el-select v-model="form.appointmentId" filterable clearable placeholder="可从预约转订单">
<el-option
v-for="item in appointments"
:key="item.id"
:label="`${item.customerName} / ${item.serviceName} / ${item.appointmentDate}`"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="服务项目" prop="serviceName">
<el-input v-model="form.serviceName" placeholder="例如:法式延长" />
</el-form-item>
<el-form-item label="预约时间">
<el-date-picker
v-model="form.appointmentTime"
type="datetime"
value-format="YYYY-MM-DDTHH:mm:ss"
placeholder="可选"
/>
</el-form-item>
<el-form-item label="成交金额" prop="amount">
<el-input-number v-model="form.amount" :min="0" :precision="2" />
</el-form-item>
<el-form-item label="定金">
<el-input-number v-model="form.depositAmount" :min="0" :precision="2" />
</el-form-item>
<el-form-item label="实收金额">
<el-input-number v-model="form.receivedAmount" :min="0" :precision="2" />
</el-form-item>
<el-form-item label="支付状态">
<el-select v-model="form.paymentStatus" placeholder="请选择支付状态">
<el-option label="未收款" value="UNPAID" />
<el-option label="部分收款" value="PARTIALLY_PAID" />
<el-option label="已收清" value="PAID" />
<el-option label="已退款" value="REFUNDED" />
</el-select>
</el-form-item>
</div>
<el-form-item label="备注">
<el-input v-model="form.notes" type="textarea" :rows="4" placeholder="记录收款、改款、补款等信息" />
</el-form-item>
</el-form>
<template #footer>
<div class="drawer-footer">
<el-button @click="emit('close')">取消</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">保存订单</el-button>
</div>
</template>
</el-drawer>
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import type {
CalendarAppointment,
CustomerProfile,
OrderPayload,
ServiceOrder,
} from '@/types/appointment'
const props = defineProps<{
visible: boolean
order: ServiceOrder | null
customers: CustomerProfile[]
appointments: CalendarAppointment[]
submitting: boolean
initialValue?: Partial<OrderPayload> | null
}>()
const emit = defineEmits<{
(event: 'close'): void
(event: 'submit', payload: OrderPayload): void
}>()
const formRef = ref<FormInstance>()
const form = reactive<OrderPayload>({
customerId: '',
appointmentId: '',
serviceName: '',
appointmentTime: '',
amount: 0,
depositAmount: 0,
receivedAmount: 0,
paymentStatus: 'UNPAID',
notes: '',
})
const rules: FormRules = {
amount: [{ required: true, message: '请输入成交金额', trigger: 'change' }],
}
watch(
() => [props.visible, props.order, props.initialValue],
() => {
if (!props.visible) {
return
}
form.customerId = props.order?.customerId || props.initialValue?.customerId || ''
form.appointmentId = props.order?.appointmentId || props.initialValue?.appointmentId || ''
form.serviceName = props.order?.serviceName || props.initialValue?.serviceName || ''
form.appointmentTime = props.order?.appointmentTime || props.initialValue?.appointmentTime || ''
form.amount = props.order?.amount ?? props.initialValue?.amount ?? 0
form.depositAmount = props.order?.depositAmount ?? props.initialValue?.depositAmount ?? 0
form.receivedAmount = props.order?.receivedAmount ?? props.initialValue?.receivedAmount ?? 0
form.paymentStatus = props.order?.paymentStatus || props.initialValue?.paymentStatus || 'UNPAID'
form.notes = props.order?.notes || props.initialValue?.notes || ''
formRef.value?.clearValidate()
},
{ immediate: true },
)
async function handleSubmit() {
const valid = await formRef.value?.validate().catch(() => false)
if (!valid) {
return
}
emit('submit', {
customerId: form.customerId || null,
appointmentId: form.appointmentId || null,
serviceName: form.serviceName,
appointmentTime: form.appointmentTime || null,
amount: form.amount ?? 0,
depositAmount: form.depositAmount ?? 0,
receivedAmount: form.receivedAmount ?? 0,
paymentStatus: form.paymentStatus || 'UNPAID',
notes: form.notes,
})
}
</script>
<style scoped>
.drawer-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px 14px;
}
.drawer-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
}
@media (max-width: 720px) {
.drawer-grid {
grid-template-columns: 1fr;
}
}
</style>
@@ -0,0 +1,169 @@
<template>
<section class="entity-list">
<div class="entity-list__header">
<div>
<p class="entity-list__eyebrow">Orders</p>
<h2>订单与收入</h2>
</div>
<div class="entity-list__summary">
<strong>{{ orders.length }}</strong>
<span>笔订单</span>
</div>
</div>
<div class="entity-list__cards">
<el-empty v-if="!orders.length" description="还没有订单记录,可从预约直接转订单。" />
<article v-for="order in orders" :key="order.id" class="entity-card">
<div class="entity-card__header">
<div>
<h3>{{ order.customerName }}</h3>
<p>{{ order.serviceName }}{{ order.appointmentTime ? ` / ${order.appointmentTime.slice(0, 16).replace('T', ' ')}` : '' }}</p>
</div>
<el-tag :type="paymentType(order.paymentStatus)" effect="light">{{ paymentLabel(order.paymentStatus) }}</el-tag>
</div>
<div class="entity-card__chips">
<span>成交 ¥{{ order.amount }}</span>
<span>已收 ¥{{ order.receivedAmount }}</span>
<span>待收 ¥{{ order.outstandingAmount }}</span>
</div>
<p v-if="order.notes" class="entity-card__text">{{ order.notes }}</p>
<div class="entity-card__actions">
<el-button size="small" @click="emit('edit', order)">编辑</el-button>
<el-button size="small" type="danger" plain @click="emit('delete', order)">删除</el-button>
</div>
</article>
</div>
</section>
</template>
<script setup lang="ts">
import type { ServiceOrder } from '@/types/appointment'
defineProps<{
orders: ServiceOrder[]
}>()
const emit = defineEmits<{
(event: 'edit', order: ServiceOrder): void
(event: 'delete', order: ServiceOrder): void
}>()
function paymentType(status: string) {
if (status === 'PAID') return 'success'
if (status === 'PARTIALLY_PAID') return 'warning'
if (status === 'REFUNDED') return 'danger'
return 'info'
}
function paymentLabel(status: string) {
if (status === 'PAID') return '已收清'
if (status === 'PARTIALLY_PAID') return '部分收款'
if (status === 'REFUNDED') return '已退款'
return '未收款'
}
</script>
<style scoped>
.entity-list {
display: flex;
flex-direction: column;
gap: 18px;
}
.entity-list__header {
display: flex;
justify-content: space-between;
gap: 16px;
align-items: flex-start;
}
.entity-list__eyebrow {
margin: 0 0 6px;
font-size: 12px;
letter-spacing: 0.24em;
text-transform: uppercase;
color: var(--muted-text);
}
.entity-list__header h2 {
margin: 0;
font-size: 26px;
}
.entity-list__summary {
display: inline-flex;
align-items: baseline;
gap: 6px;
padding: 12px 16px;
border-radius: 16px;
background: rgba(255, 255, 255, 0.7);
}
.entity-list__cards {
display: flex;
flex-direction: column;
gap: 14px;
}
.entity-card {
padding: 20px;
border-radius: 24px;
background: rgba(255, 255, 255, 0.82);
border: 1px solid rgba(205, 178, 158, 0.36);
box-shadow: 0 18px 36px rgba(83, 47, 30, 0.08);
display: flex;
flex-direction: column;
gap: 12px;
}
.entity-card__header {
display: flex;
justify-content: space-between;
gap: 16px;
}
.entity-card__header h3 {
margin: 0;
font-size: 20px;
}
.entity-card__header p {
margin: 6px 0 0;
color: var(--muted-text);
}
.entity-card__chips {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.entity-card__chips span {
padding: 8px 12px;
border-radius: 999px;
background: rgba(49, 37, 30, 0.06);
font-size: 13px;
}
.entity-card__text {
margin: 0;
color: var(--muted-text);
}
.entity-card__actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
@media (max-width: 720px) {
.entity-list__header,
.entity-card__header {
flex-direction: column;
}
}
</style>
+7
View File
@@ -0,0 +1,7 @@
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import './style.css'
createApp(App).use(ElementPlus).mount('#app')
+427
View File
@@ -0,0 +1,427 @@
:root {
font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
line-height: 1.5;
font-weight: 400;
color: #2b211c;
background:
radial-gradient(circle at top left, rgba(247, 196, 159, 0.55), transparent 32%),
radial-gradient(circle at bottom right, rgba(198, 117, 70, 0.22), transparent 24%),
linear-gradient(180deg, #fcf8f4 0%, #f5ece3 100%);
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
--accent-color: #d1773d;
--text-color: #2b211c;
--muted-text: #7f685c;
--panel-bg: rgba(255, 247, 241, 0.72);
--panel-strong-bg: rgba(255, 251, 247, 0.86);
--line-color: rgba(194, 159, 138, 0.38);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-width: 320px;
min-height: 100vh;
}
button,
input,
textarea,
select {
font: inherit;
}
#app {
min-height: 100vh;
}
.calendar-app {
min-height: 100vh;
color: var(--text-color);
background:
radial-gradient(circle at top left, rgba(247, 196, 159, 0.55), transparent 32%),
radial-gradient(circle at bottom right, rgba(198, 117, 70, 0.22), transparent 24%),
linear-gradient(180deg, #fcf8f4 0%, #f5ece3 100%);
}
.calendar-app.theme-dark {
--accent-color: #f0ae73;
--text-color: #f7ecdf;
--muted-text: #cdb7a5;
--panel-bg: rgba(40, 30, 27, 0.72);
--panel-strong-bg: rgba(47, 36, 32, 0.84);
--line-color: rgba(234, 198, 168, 0.18);
background:
radial-gradient(circle at top left, rgba(156, 93, 58, 0.34), transparent 24%),
radial-gradient(circle at bottom right, rgba(78, 46, 34, 0.72), transparent 28%),
linear-gradient(180deg, #1f1714 0%, #2d211c 100%);
}
.app-shell {
width: min(1400px, calc(100vw - 40px));
margin: 0 auto;
padding: 28px 0 44px;
display: flex;
flex-direction: column;
gap: 20px;
}
.panel {
background: var(--panel-bg);
border: 1px solid var(--line-color);
backdrop-filter: blur(16px);
border-radius: 28px;
box-shadow: 0 24px 52px rgba(76, 47, 33, 0.08);
}
.hero-panel {
padding: 28px;
display: grid;
grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
gap: 22px;
}
.hero-panel__eyebrow {
margin: 0 0 10px;
font-size: 12px;
letter-spacing: 0.36em;
text-transform: uppercase;
color: var(--muted-text);
}
.hero-panel h1 {
margin: 0;
font-size: clamp(34px, 4vw, 56px);
line-height: 1.06;
}
.hero-panel__summary {
margin: 14px 0 0;
font-size: 16px;
max-width: 760px;
color: var(--muted-text);
}
.section-nav {
margin-top: 22px;
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px;
}
.section-nav__item {
border: 1px solid var(--line-color);
border-radius: 20px;
background: rgba(255, 255, 255, 0.44);
color: var(--text-color);
padding: 14px 16px;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 6px;
transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.section-nav__item:hover {
transform: translateY(-2px);
border-color: var(--accent-color);
}
.section-nav__item span {
font-size: 16px;
font-weight: 700;
}
.section-nav__item small {
color: var(--muted-text);
}
.section-nav__item--active {
background: linear-gradient(180deg, rgba(240, 146, 96, 0.18), rgba(255, 255, 255, 0.9));
border-color: var(--accent-color);
}
.hero-panel__aside {
display: flex;
flex-direction: column;
gap: 18px;
justify-content: space-between;
}
.hero-panel__chips,
.hero-panel__controls {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.status-chip {
padding: 10px 14px;
border-radius: 999px;
background: var(--panel-strong-bg);
border: 1px solid var(--line-color);
font-size: 13px;
}
.status-chip--offline {
background: rgba(245, 189, 91, 0.18);
}
.dashboard-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 16px;
}
.dashboard-grid--compact {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stat-card {
padding: 22px;
display: flex;
flex-direction: column;
gap: 6px;
}
.stat-card p,
.stat-card span {
margin: 0;
color: var(--muted-text);
}
.stat-card strong {
font-size: 34px;
line-height: 1;
}
.toolbar-panel {
padding: 20px;
display: flex;
flex-direction: column;
gap: 14px;
}
.toolbar-panel__actions,
.toolbar-panel__filters,
.toolbar-panel__range {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.toolbar-panel .el-input,
.toolbar-panel .el-select,
.toolbar-panel .el-date-editor {
width: 220px;
}
.content-grid {
display: grid;
grid-template-columns: minmax(380px, 0.95fr) minmax(0, 1.35fr);
gap: 18px;
}
.content-grid--list {
grid-template-columns: 1fr;
}
.calendar-panel,
.list-panel {
padding: 22px;
}
.settings-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 18px;
}
.settings-card {
padding: 22px;
display: flex;
flex-direction: column;
gap: 18px;
}
.settings-card--full {
grid-column: 1 / -1;
}
.settings-card__header {
display: flex;
justify-content: space-between;
gap: 16px;
align-items: flex-start;
}
.settings-card__eyebrow {
margin: 0 0 6px;
font-size: 12px;
letter-spacing: 0.24em;
text-transform: uppercase;
color: var(--muted-text);
}
.settings-card__header h2 {
margin: 0;
font-size: 24px;
}
.settings-card__form {
display: flex;
flex-direction: column;
gap: 14px;
}
.settings-row {
display: flex;
justify-content: space-between;
gap: 16px;
align-items: center;
padding: 14px 16px;
border-radius: 18px;
background: rgba(255, 255, 255, 0.56);
}
.settings-card__actions {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.trend-list {
display: flex;
flex-direction: column;
gap: 14px;
}
.trend-row {
display: grid;
grid-template-columns: 62px minmax(0, 1fr) 88px;
gap: 12px;
align-items: center;
}
.trend-row span,
.trend-row strong {
font-size: 14px;
}
.trend-row__bar {
height: 12px;
border-radius: 999px;
background: rgba(49, 37, 30, 0.08);
overflow: hidden;
}
.trend-row__bar i {
display: block;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, #d1773d, #efb07f);
}
.sync-list {
display: flex;
flex-direction: column;
gap: 12px;
}
.sync-item {
padding: 16px 18px;
border-radius: 20px;
border: 1px solid var(--line-color);
background: rgba(255, 255, 255, 0.58);
display: flex;
justify-content: space-between;
gap: 18px;
}
.sync-item--conflict {
border-color: rgba(239, 154, 74, 0.8);
}
.sync-item--failed {
border-color: rgba(212, 87, 87, 0.72);
}
.sync-item h3 {
margin: 0;
font-size: 16px;
}
.sync-item p {
margin: 6px 0 0;
color: var(--muted-text);
}
.sync-item__error {
color: #c45135;
}
.sync-item__actions {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
justify-content: flex-end;
}
.hidden-input {
display: none;
}
@media (max-width: 1120px) {
.hero-panel,
.content-grid {
grid-template-columns: 1fr;
}
.dashboard-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.section-nav,
.settings-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 720px) {
.app-shell {
width: min(100vw - 22px, 100%);
padding: 12px 0 24px;
}
.dashboard-grid {
grid-template-columns: 1fr;
}
.toolbar-panel .el-input,
.toolbar-panel .el-select,
.toolbar-panel .el-date-editor {
width: 100%;
}
.section-nav,
.dashboard-grid--compact,
.settings-grid {
grid-template-columns: 1fr;
}
.settings-row,
.sync-item {
flex-direction: column;
align-items: flex-start;
}
.trend-row {
grid-template-columns: 1fr;
}
}
@@ -0,0 +1,184 @@
export interface CalendarDaySummary {
date: string
totalCount: number
scheduledCount: number
completedCount: number
cancelledCount: number
}
export interface CalendarAppointment {
id: string
seriesId?: string | null
customerId?: string | null
orderId?: string | null
customerName: string
customerPhone?: string | null
appointmentDate: string
appointmentStartTime: string
appointmentEndTime: string
serviceName: string
appointmentType: string
orderReference?: string | null
notes?: string | null
reminderMinutes: number
repeatType: string
repeatUntil?: string | null
status: string
notificationEnabled: boolean
syncStatus?: string | null
createTime?: string
updateTime?: string
}
export interface AppointmentPayload {
id?: string
seriesId?: string | null
customerId?: string | null
orderId?: string | null
customerName: string
customerPhone?: string | null
appointmentStartTime: string
appointmentEndTime: string
serviceName: string
appointmentType: string
orderReference?: string | null
notes?: string | null
reminderMinutes?: number
repeatType?: string
repeatUntil?: string | null
status?: string
notificationEnabled?: boolean
applyToSeries?: boolean
expectedUpdateTime?: string | null
}
export interface CustomerProfile {
id: string
name: string
phone?: string | null
notes?: string | null
preferences?: string | null
cautions?: string | null
tags?: string | null
lastVisitTime?: string | null
totalVisitCount: number
totalSpentAmount: number
createTime?: string
updateTime?: string
}
export interface CustomerPayload {
id?: string
name: string
phone?: string | null
notes?: string | null
preferences?: string | null
cautions?: string | null
tags?: string | null
expectedUpdateTime?: string | null
}
export interface ServiceOrder {
id: string
customerId?: string | null
appointmentId?: string | null
customerName: string
customerPhone?: string | null
serviceName: string
appointmentTime?: string | null
amount: number
depositAmount: number
receivedAmount: number
outstandingAmount: number
paymentStatus: string
completedAt?: string | null
notes?: string | null
createTime?: string
updateTime?: string
}
export interface OrderPayload {
id?: string
customerId?: string | null
appointmentId?: string | null
serviceName?: string | null
appointmentTime?: string | null
amount?: number | null
depositAmount?: number | null
receivedAmount?: number | null
paymentStatus?: string | null
completedAt?: string | null
notes?: string | null
expectedUpdateTime?: string | null
}
export interface IncomeTrendPoint {
date: string
amount: number
}
export interface AppointmentDashboard {
totalAppointments: number
todayAppointments: number
scheduledAppointments: number
completedAppointments: number
cancelledAppointments: number
upcomingReminderCount: number
pendingReminders: number
todayIncome: number
pendingReceivables: number
incomeTrend: IncomeTrendPoint[]
}
export interface AppointmentExportData {
exportedAt: string
startDate?: string | null
endDate?: string | null
total: number
appointments: CalendarAppointment[]
}
export interface BackupExportData {
exportedAt: string
customerCount: number
appointmentCount: number
orderCount: number
customers: CustomerProfile[]
appointments: CalendarAppointment[]
orders: ServiceOrder[]
settings?: Record<string, unknown>
syncMeta?: {
syncTasks: SyncTask[]
idAliasMap: Record<string, string>
lastSyncedAt?: string
}
}
export interface CalendarSettings {
theme: 'light' | 'dark'
defaultReminderMinutes: number
notificationsEnabled: boolean
autoSyncEnabled: boolean
}
export interface SyncTaskDependency {
entityType: 'appointment' | 'customer' | 'order'
field: 'customerId' | 'appointmentId' | 'orderId'
localId: string
}
export interface SyncTask {
id: string
entityType: 'appointment' | 'customer' | 'order'
action: 'create' | 'update' | 'delete' | 'status'
recordId: string
label: string
payload: any
status: 'pending' | 'blocked' | 'failed' | 'conflict'
createdAt: string
updatedAt: string
lastError?: string
dependencies?: SyncTaskDependency[]
}
export type SortBy = 'time' | 'customerName' | 'date'
@@ -0,0 +1,51 @@
import { ElLoading, type LoadingInstance } from 'element-plus'
export interface GlobalLoadingOptions {
text?: string
lock?: boolean
}
let activeLoadingCount = 0
let loadingInstance: LoadingInstance | null = null
const openGlobalLoading = (options?: GlobalLoadingOptions) => {
activeLoadingCount += 1
if (typeof window === 'undefined' || loadingInstance) {
return
}
loadingInstance = ElLoading.service({
lock: options?.lock ?? true,
text: options?.text ?? '\u52a0\u8f7d\u4e2d',
background: 'rgba(255, 255, 255, 0.72)'
})
}
const closeGlobalLoading = () => {
activeLoadingCount = Math.max(0, activeLoadingCount - 1)
if (activeLoadingCount > 0) {
return
}
loadingInstance?.close()
loadingInstance = null
}
export const runWithGlobalLoading = async <T>(
task: (() => Promise<T>) | Promise<T>,
options?: GlobalLoadingOptions
) => {
openGlobalLoading(options)
try {
if (typeof task === 'function') {
return await task()
}
return await task
} finally {
closeGlobalLoading()
}
}
@@ -0,0 +1,150 @@
import type {
AppointmentDashboard,
CalendarAppointment,
CalendarDaySummary,
CustomerProfile,
IncomeTrendPoint,
ServiceOrder,
SortBy,
} from '@/types/appointment'
import { sortAppointments, toDateKey, toMonthKey } from '@/utils/date'
function toNumber(value: unknown) {
const numeric = Number(value)
return Number.isFinite(numeric) ? numeric : 0
}
export function buildMonthOverview(appointments: CalendarAppointment[], monthKey: string) {
const summaryMap = new Map<string, CalendarDaySummary>()
appointments
.filter((item) => item.appointmentDate.startsWith(monthKey))
.forEach((appointment) => {
const current =
summaryMap.get(appointment.appointmentDate) ||
({
date: appointment.appointmentDate,
totalCount: 0,
scheduledCount: 0,
completedCount: 0,
cancelledCount: 0,
} satisfies CalendarDaySummary)
current.totalCount += 1
if (appointment.status === 'COMPLETED') {
current.completedCount += 1
} else if (appointment.status === 'CANCELLED' || appointment.status === 'NO_SHOW') {
current.cancelledCount += 1
} else {
current.scheduledCount += 1
}
summaryMap.set(appointment.appointmentDate, current)
})
return Array.from(summaryMap.values()).sort((left, right) => left.date.localeCompare(right.date))
}
export function filterAppointments(
appointments: CalendarAppointment[],
filters: {
keyword?: string
serviceName?: string
status?: string
customerId?: string
startDate?: string
endDate?: string
sortBy?: SortBy
},
) {
const keyword = filters.keyword?.trim().toLowerCase()
const serviceName = filters.serviceName?.trim().toLowerCase()
const result = appointments.filter((appointment) => {
const keywordMatched =
!keyword ||
[
appointment.customerName,
appointment.customerPhone,
appointment.serviceName,
appointment.orderReference,
]
.filter(Boolean)
.some((value) => String(value).toLowerCase().includes(keyword))
const serviceMatched = !serviceName || appointment.serviceName.toLowerCase().includes(serviceName)
const statusMatched = !filters.status || appointment.status === filters.status
const customerMatched = !filters.customerId || appointment.customerId === filters.customerId
const startMatched = !filters.startDate || appointment.appointmentDate >= filters.startDate
const endMatched = !filters.endDate || appointment.appointmentDate <= filters.endDate
return keywordMatched && serviceMatched && statusMatched && customerMatched && startMatched && endMatched
})
return sortAppointments(result, filters.sortBy || 'time')
}
export function computeDashboard(
appointments: CalendarAppointment[],
orders: ServiceOrder[],
dateKey: string,
): AppointmentDashboard {
const now = Date.now()
const horizon = now + 24 * 60 * 60 * 1000
const todayAppointments = appointments.filter((item) => item.appointmentDate === dateKey)
const todayIncome = orders
.filter((item) => item.completedAt?.slice(0, 10) === dateKey)
.reduce((sum, item) => sum + toNumber(item.receivedAmount), 0)
const pendingReceivables = orders.reduce((sum, item) => sum + Math.max(toNumber(item.outstandingAmount), 0), 0)
const incomeTrend: IncomeTrendPoint[] = Array.from({ length: 7 }, (_, index) => {
const date = new Date(`${dateKey}T00:00:00`)
date.setDate(date.getDate() - (6 - index))
const targetKey = toDateKey(date)
const amount = orders
.filter((item) => item.completedAt?.slice(0, 10) === targetKey)
.reduce((sum, item) => sum + toNumber(item.receivedAmount), 0)
return {
date: targetKey,
amount,
}
})
const upcomingReminderCount = appointments.filter((appointment) => {
if (!appointment.notificationEnabled) return false
if (appointment.status !== 'SCHEDULED' && appointment.status !== 'IN_SERVICE') return false
const notifyAt =
new Date(appointment.appointmentStartTime).getTime() -
appointment.reminderMinutes * 60 * 1000
return notifyAt >= now && notifyAt <= horizon
}).length
return {
totalAppointments: appointments.length,
todayAppointments: todayAppointments.length,
scheduledAppointments: todayAppointments.filter(
(item) => item.status === 'SCHEDULED' || item.status === 'IN_SERVICE',
).length,
completedAppointments: todayAppointments.filter((item) => item.status === 'COMPLETED').length,
cancelledAppointments: todayAppointments.filter(
(item) => item.status === 'CANCELLED' || item.status === 'NO_SHOW',
).length,
upcomingReminderCount,
pendingReminders: upcomingReminderCount,
todayIncome,
pendingReceivables,
incomeTrend,
}
}
export function findCustomer(customers: CustomerProfile[], customerId?: string | null) {
if (!customerId) {
return undefined
}
return customers.find((item) => item.id === customerId)
}
export function groupAppointmentsByDate(appointments: CalendarAppointment[]) {
return appointments.reduce<Record<string, CalendarAppointment[]>>((accumulator, appointment) => {
const targetKey = appointment.appointmentDate || toDateKey(appointment.appointmentStartTime)
accumulator[targetKey] = accumulator[targetKey] || []
accumulator[targetKey].push(appointment)
return accumulator
}, {})
}
export function isInMonth(dateKey: string, monthKey: string) {
return toMonthKey(dateKey) === monthKey
}
@@ -0,0 +1,105 @@
import type { CalendarDaySummary, CalendarAppointment } from '@/types/appointment'
function parseMonthKey(monthKey: string) {
const [yearPart = '', monthPart = ''] = monthKey.split('-')
const parsedYear = Number(yearPart)
const parsedMonth = Number(monthPart)
const now = new Date()
return {
year: Number.isFinite(parsedYear) && parsedYear > 0 ? parsedYear : now.getFullYear(),
month: Number.isFinite(parsedMonth) && parsedMonth > 0 ? parsedMonth : now.getMonth() + 1,
}
}
export function toDateKey(date: Date | string) {
const target = typeof date === 'string' ? new Date(date) : date
return `${target.getFullYear()}-${String(target.getMonth() + 1).padStart(2, '0')}-${String(
target.getDate(),
).padStart(2, '0')}`
}
export function toMonthKey(date: Date | string) {
const target = typeof date === 'string' ? new Date(date) : date
return `${target.getFullYear()}-${String(target.getMonth() + 1).padStart(2, '0')}`
}
export function addMonths(monthKey: string, offset: number) {
const { year, month } = parseMonthKey(monthKey)
const next = new Date(year, month - 1 + offset, 1)
return toMonthKey(next)
}
export function dateFromKey(dateKey: string) {
return new Date(`${dateKey}T00:00:00`)
}
export function formatMonthLabel(monthKey: string) {
const { year, month } = parseMonthKey(monthKey)
return `${year}年${month}月`
}
export function formatDateLabel(dateKey: string) {
const target = dateFromKey(dateKey)
return target.toLocaleDateString('zh-CN', {
month: 'long',
day: 'numeric',
weekday: 'long',
})
}
export function formatTimeRange(startTime: string, endTime: string) {
const start = new Date(startTime)
const end = new Date(endTime)
const formatter = new Intl.DateTimeFormat('zh-CN', {
hour: '2-digit',
minute: '2-digit',
hour12: false,
})
return `${formatter.format(start)} - ${formatter.format(end)}`
}
export function buildCalendarCells(monthKey: string) {
const { year, month } = parseMonthKey(monthKey)
const firstDay = new Date(year, month - 1, 1)
const startOffset = (firstDay.getDay() + 6) % 7
const gridStart = new Date(year, month - 1, 1 - startOffset)
return Array.from({ length: 42 }, (_, index) => {
const current = new Date(gridStart)
current.setDate(gridStart.getDate() + index)
return {
dateKey: toDateKey(current),
dayNumber: current.getDate(),
isCurrentMonth: current.getMonth() === month - 1,
isToday: toDateKey(new Date()) === toDateKey(current),
}
})
}
export function getWeekCells(monthKey: string, selectedDate: string) {
const cells = buildCalendarCells(monthKey)
const selectedIndex = cells.findIndex((cell) => cell.dateKey === selectedDate)
const weekStart = selectedIndex >= 0 ? Math.floor(selectedIndex / 7) * 7 : 0
return cells.slice(weekStart, weekStart + 7)
}
export function summaryMap(list: CalendarDaySummary[]) {
return list.reduce<Record<string, CalendarDaySummary>>((accumulator, item) => {
accumulator[item.date] = item
return accumulator
}, {})
}
export function sortAppointments(list: CalendarAppointment[], sortBy: string) {
const copied = [...list]
copied.sort((left, right) => {
if (sortBy === 'customerName') {
return left.customerName.localeCompare(right.customerName, 'zh-CN')
}
if (sortBy === 'date') {
return left.appointmentStartTime.localeCompare(right.appointmentStartTime)
}
return left.appointmentStartTime.localeCompare(right.appointmentStartTime)
})
return copied
}
@@ -0,0 +1,3 @@
export function createLocalId(prefix: string) {
return `local-${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
}
@@ -0,0 +1,90 @@
import type {
CalendarAppointment,
CalendarSettings,
CustomerProfile,
ServiceOrder,
SyncTask,
} from '@/types/appointment'
const VIEW_STATE_KEY = 'yuminail-calendar:view-state'
const DATA_CACHE_KEY = 'yuminail-calendar:data-cache'
const SYNC_QUEUE_KEY = 'yuminail-calendar:sync-queue'
const SETTINGS_KEY = 'yuminail-calendar:settings'
const ID_ALIAS_KEY = 'yuminail-calendar:id-alias'
interface DataCache {
appointments: CalendarAppointment[]
customers: CustomerProfile[]
orders: ServiceOrder[]
lastSyncedAt: string
}
function readJson<T>(key: string, fallback: T) {
try {
const raw = localStorage.getItem(key)
return raw ? (JSON.parse(raw) as T) : fallback
} catch {
return fallback
}
}
function writeJson(key: string, value: unknown) {
localStorage.setItem(key, JSON.stringify(value))
}
export function loadViewState() {
return readJson(VIEW_STATE_KEY, {
theme: 'light',
displayMode: 'calendar',
calendarMode: 'month',
selectedDate: '',
currentMonth: '',
activeSection: 'calendar',
})
}
export function saveViewState(value: unknown) {
writeJson(VIEW_STATE_KEY, value)
}
export function loadDataCache(): DataCache {
return readJson<DataCache>(DATA_CACHE_KEY, {
appointments: [],
customers: [],
orders: [],
lastSyncedAt: '',
})
}
export function saveDataCache(value: DataCache) {
writeJson(DATA_CACHE_KEY, value)
}
export function loadSyncTasks() {
return readJson<SyncTask[]>(SYNC_QUEUE_KEY, [])
}
export function saveSyncTasks(tasks: SyncTask[]) {
writeJson(SYNC_QUEUE_KEY, tasks)
}
export function loadSettings(): CalendarSettings {
return readJson<CalendarSettings>(SETTINGS_KEY, {
theme: 'light',
defaultReminderMinutes: 60,
notificationsEnabled: true,
autoSyncEnabled: true,
})
}
export function saveSettings(settings: CalendarSettings) {
writeJson(SETTINGS_KEY, settings)
}
export function loadIdAliasMap() {
return readJson<Record<string, string>>(ID_ALIAS_KEY, {})
}
export function saveIdAliasMap(aliasMap: Record<string, string>) {
writeJson(ID_ALIAS_KEY, aliasMap)
}
@@ -0,0 +1,20 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"types": ["vite/client"],
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
}
+7
View File
@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}
+37
View File
@@ -0,0 +1,37 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 3010,
host: true,
proxy: {
'/calendar-api': {
target: 'http://127.0.0.1:8098',
changeOrigin: true,
},
},
},
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (!id.includes('node_modules')) {
return undefined
}
if (id.includes('element-plus') || id.includes('@element-plus')) {
return 'element-plus'
}
return 'vendor'
},
},
},
},
})
@@ -0,0 +1,13 @@
# YumiNail-Calendar-Frontend 项目说明
`YumiNail-Calendar-Frontend` 是“美甲师日历表”独立系统的前端应用,当前包含:
- 月历/周历双视图
- 日历与列表视图切换
- 预约新增、编辑、删除、批量删除
- 预约状态流转
- 本地缓存回退
- 浏览器提醒授权
- JSON 导入导出
默认开发端口为 `3010`,通过 `/calendar-api/**` 代理到 `YumiNail-Calendar-Gateway`。