给店铺增加排班规则
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { adminApi } from '@/api/client'
|
||||
import type { ShopInfo } from '@/types/manager'
|
||||
import type { ShopInfo, ShopScheduleException } from '@/types/manager'
|
||||
|
||||
export const managerShopApi = {
|
||||
info(): Promise<ShopInfo> {
|
||||
@@ -8,6 +8,12 @@ export const managerShopApi = {
|
||||
update(data: Partial<ShopInfo>): Promise<boolean> {
|
||||
return adminApi.put('/manager/shop', data)
|
||||
},
|
||||
scheduleExceptions(params?: { startDate?: string; endDate?: string }): Promise<ShopScheduleException[]> {
|
||||
return adminApi.get('/manager/shop/schedule-exceptions', { params })
|
||||
},
|
||||
saveScheduleException(data: ShopScheduleException): Promise<ShopScheduleException> {
|
||||
return adminApi.post('/manager/shop/schedule-exceptions', data)
|
||||
},
|
||||
exportPreview(params: { type: string; startDate: string; endDate: string }): Promise<unknown> {
|
||||
return adminApi.get('/export', { params })
|
||||
}
|
||||
|
||||
@@ -86,16 +86,20 @@ export interface ArtistScheduleException {
|
||||
artistId: IdType
|
||||
shopId?: IdType
|
||||
workDate: string
|
||||
exceptionType?: string
|
||||
startTime?: string
|
||||
endTime?: string
|
||||
status: number
|
||||
reason?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface DaySummary {
|
||||
date: string
|
||||
totalCount: number
|
||||
dayStatus?: string
|
||||
businessStartTime?: string
|
||||
businessEndTime?: string
|
||||
artistCounts?: Array<{
|
||||
artistId: IdType
|
||||
artistName?: string
|
||||
@@ -153,12 +157,25 @@ export interface ShopInfo {
|
||||
businessHours?: string
|
||||
startTime?: string
|
||||
endTime?: string
|
||||
schedulePresetType?: string
|
||||
scheduleWorkDays?: string
|
||||
scheduleRemark?: string
|
||||
description?: string
|
||||
logo?: string
|
||||
imageUrl?: string
|
||||
authorizationExpireTime?: string
|
||||
}
|
||||
|
||||
export interface ShopScheduleException {
|
||||
id?: IdType
|
||||
shopId?: IdType
|
||||
workDate: string
|
||||
exceptionType: string
|
||||
startTime?: string
|
||||
endTime?: string
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface CustomerCreateRequest {
|
||||
nickname: string
|
||||
phone: string
|
||||
|
||||
@@ -52,4 +52,28 @@ describe('available time groups', () => {
|
||||
|
||||
expect(groups[0]?.times.map(item => item.value)).toEqual(['10:00'])
|
||||
})
|
||||
|
||||
it('returns no slots when the store day is closed', () => {
|
||||
const calendar: PlanningCalendar = {
|
||||
daySummaries: [{ date: '2026-06-29', totalCount: 0, dayStatus: 'rest' }],
|
||||
schedules: [{ artistId: 1, date: '2026-06-29', startTime: '10:00', endTime: '12:00', status: 1 }]
|
||||
}
|
||||
|
||||
const groups = buildAvailableTimeGroups(calendar, buildForm())
|
||||
|
||||
expect(groups).toEqual([])
|
||||
})
|
||||
|
||||
it('clamps slots to store business hours from day summary', () => {
|
||||
const calendar: PlanningCalendar = {
|
||||
daySummaries: [{ date: '2026-06-29', totalCount: 0, dayStatus: 'free', businessStartTime: '09:00', businessEndTime: '10:30' }],
|
||||
schedules: [{ artistId: 1, date: '2026-06-29', startTime: '08:00', endTime: '12:00', status: 1 }]
|
||||
}
|
||||
const form = buildForm()
|
||||
form.durationMinutes = '60'
|
||||
|
||||
const groups = buildAvailableTimeGroups(calendar, form)
|
||||
|
||||
expect(groups[0]?.times.map(item => item.value)).toEqual(['09:00', '09:15', '09:30'])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -46,11 +46,24 @@ const hasBusyConflict = (startMinute: number, endMinute: number, ranges: Array<{
|
||||
return ranges.some(range => startMinute < range.endMinute && endMinute > range.startMinute)
|
||||
}
|
||||
|
||||
const clampToBusinessHours = (startMinute: number, endMinute: number, businessStartTime?: string, businessEndTime?: string): { startMinute: number; endMinute: number } => {
|
||||
const businessStartMinute = businessStartTime ? minutesOfDay(businessStartTime) : startMinute
|
||||
const businessEndMinute = businessEndTime ? minutesOfDay(businessEndTime) : endMinute
|
||||
return {
|
||||
startMinute: Math.max(startMinute, businessStartMinute),
|
||||
endMinute: Math.min(endMinute, businessEndMinute)
|
||||
}
|
||||
}
|
||||
|
||||
export const buildAvailableTimeGroups = (calendar: PlanningCalendar, form: AppointmentForm): AvailableTimeGroup[] => {
|
||||
const durationMinutes = normalizeDuration(form.durationMinutes)
|
||||
if (!durationMinutes) {
|
||||
return []
|
||||
}
|
||||
const daySummary = (calendar.daySummaries || []).find(item => item.date === form.appointmentDate)
|
||||
if (daySummary?.dayStatus === 'rest') {
|
||||
return []
|
||||
}
|
||||
const schedules = (calendar.schedules || [])
|
||||
.filter((item: ArtistSchedule) => String(item.artistId) === String(form.artistId))
|
||||
.filter(item => item.date === form.appointmentDate)
|
||||
@@ -62,8 +75,14 @@ export const buildAvailableTimeGroups = (calendar: PlanningCalendar, form: Appoi
|
||||
evening: { key: 'evening', title: '晚上', times: [] }
|
||||
}
|
||||
schedules.forEach(schedule => {
|
||||
const scheduleStart = minutesOfDay(extractTimeText(schedule.startTime))
|
||||
const scheduleEnd = minutesOfDay(extractTimeText(schedule.endTime))
|
||||
const range = clampToBusinessHours(
|
||||
minutesOfDay(extractTimeText(schedule.startTime)),
|
||||
minutesOfDay(extractTimeText(schedule.endTime)),
|
||||
daySummary?.businessStartTime,
|
||||
daySummary?.businessEndTime
|
||||
)
|
||||
const scheduleStart = range.startMinute
|
||||
const scheduleEnd = range.endMinute
|
||||
for (let minute = scheduleStart; minute + durationMinutes <= scheduleEnd; minute += TIME_SLOT_MINUTES) {
|
||||
const endMinute = minute + durationMinutes
|
||||
if (!hasBusyConflict(minute, endMinute, busyRanges)) {
|
||||
|
||||
@@ -278,8 +278,17 @@ const checkAvailability = async (): Promise<{ ok: boolean; tip?: string }> => {
|
||||
}
|
||||
const startMinute = minutesOfDay(form.appointmentTime)
|
||||
const endMinute = startMinute + normalizeDuration(form.durationMinutes)
|
||||
if (startMinute < minutesOfDay('10:00') || endMinute > minutesOfDay('22:00')) {
|
||||
conflictTip.value = '该时间超出营业时间 10:00-22:00'
|
||||
const calendar = await managerPlanningApi.calendar({ startDate: form.appointmentDate, endDate: form.appointmentDate, artistId: form.artistId })
|
||||
const daySummary = (calendar.daySummaries || []).find(item => item.date === form.appointmentDate)
|
||||
const businessStartTime = String(daySummary?.businessStartTime || calendar.businessStartTime || '10:00').slice(0, 5)
|
||||
const businessEndTime = String(daySummary?.businessEndTime || calendar.businessEndTime || '22:00').slice(0, 5)
|
||||
if (daySummary?.dayStatus === 'rest') {
|
||||
conflictTip.value = '当前日期为店铺休息日'
|
||||
conflictLevel.value = 'danger'
|
||||
return { ok: false, tip: conflictTip.value }
|
||||
}
|
||||
if (startMinute < minutesOfDay(businessStartTime) || endMinute > minutesOfDay(businessEndTime)) {
|
||||
conflictTip.value = `该时间超出营业时间 ${businessStartTime}-${businessEndTime}`
|
||||
conflictLevel.value = 'danger'
|
||||
return { ok: false, tip: conflictTip.value }
|
||||
}
|
||||
|
||||
@@ -2,35 +2,116 @@
|
||||
<MobileShell title="店铺设置">
|
||||
<div class="settings-view">
|
||||
<LoadingState v-if="loading" text="店铺信息加载中" />
|
||||
<section v-else class="card form-card">
|
||||
<label class="field">
|
||||
<span class="field-label">店铺名称</span>
|
||||
<input v-model.trim="form.shopName" placeholder="请输入店铺名称" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">营业开始</span>
|
||||
<input v-model="form.startTime" class="field-value" type="time" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">营业结束</span>
|
||||
<input v-model="form.endTime" class="field-value" type="time" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="label-with-help">
|
||||
<span class="field-label">默认时长</span>
|
||||
<button class="help-badge" type="button" aria-label="默认时长说明" @click.stop.prevent="showDurationHelp">?</button>
|
||||
</span>
|
||||
<input v-model.trim="form.defaultDuration" inputmode="numeric" placeholder="60" />
|
||||
<span class="muted">分钟</span>
|
||||
</label>
|
||||
<label class="field field--stack">
|
||||
<span class="label-with-help">
|
||||
<span class="field-label">预约规则</span>
|
||||
<button class="help-badge" type="button" aria-label="预约规则说明" @click.stop.prevent="showRuleHelp">?</button>
|
||||
</span>
|
||||
<textarea v-model.trim="form.rule" placeholder="例如:必须选择已有作品作为项目来源"></textarea>
|
||||
</label>
|
||||
</section>
|
||||
<template v-else>
|
||||
<section class="card form-card">
|
||||
<label class="field">
|
||||
<span class="field-label">店铺名称</span>
|
||||
<input v-model.trim="form.shopName" placeholder="请输入店铺名称" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="label-with-help">
|
||||
<span class="field-label">默认时长</span>
|
||||
<button class="help-badge" type="button" aria-label="默认时长说明" @click.stop.prevent="showDurationHelp">?</button>
|
||||
</span>
|
||||
<input v-model.trim="form.defaultDuration" inputmode="numeric" placeholder="60" />
|
||||
<span class="muted">分钟</span>
|
||||
</label>
|
||||
<label class="field field--stack">
|
||||
<span class="label-with-help">
|
||||
<span class="field-label">预约规则</span>
|
||||
<button class="help-badge" type="button" aria-label="预约规则说明" @click.stop.prevent="showRuleHelp">?</button>
|
||||
</span>
|
||||
<textarea v-model.trim="form.rule" placeholder="例如:必须选择已有作品作为项目来源"></textarea>
|
||||
</label>
|
||||
</section>
|
||||
|
||||
<PageSection title="店铺排班">
|
||||
<section class="card form-card">
|
||||
<div class="preset-grid">
|
||||
<button
|
||||
v-for="item in presets"
|
||||
:key="item.value"
|
||||
class="preset-chip"
|
||||
:class="{ active: form.schedulePresetType === item.value }"
|
||||
type="button"
|
||||
@click="selectPreset(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="field-block">
|
||||
<div class="field-title">营业日</div>
|
||||
<div class="weekday-grid">
|
||||
<button
|
||||
v-for="item in weekdays"
|
||||
:key="item.value"
|
||||
class="weekday-chip"
|
||||
:class="{ active: workDays.includes(item.value) }"
|
||||
type="button"
|
||||
@click="toggleWeekday(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="field">
|
||||
<span class="field-label">营业开始</span>
|
||||
<input v-model="form.startTime" class="field-value" type="time" @change="markCustom" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">营业结束</span>
|
||||
<input v-model="form.endTime" class="field-value" type="time" @change="markCustom" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">排班备注</span>
|
||||
<input v-model.trim="form.scheduleRemark" placeholder="可选" />
|
||||
</label>
|
||||
</section>
|
||||
</PageSection>
|
||||
|
||||
<PageSection title="特殊日期">
|
||||
<section class="card form-card">
|
||||
<label class="field">
|
||||
<span class="field-label">日期</span>
|
||||
<input v-model="exceptionForm.workDate" type="date" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">类型</span>
|
||||
<select v-model="exceptionForm.exceptionType">
|
||||
<option v-for="item in exceptionTypes" :key="item.value" :value="item.value">{{ item.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label v-if="exceptionForm.exceptionType !== 'REST'" class="field">
|
||||
<span class="field-label">开始时间</span>
|
||||
<input v-model="exceptionForm.startTime" type="time" />
|
||||
</label>
|
||||
<label v-if="exceptionForm.exceptionType !== 'REST'" class="field">
|
||||
<span class="field-label">结束时间</span>
|
||||
<input v-model="exceptionForm.endTime" type="time" />
|
||||
</label>
|
||||
<label class="field">
|
||||
<span class="field-label">备注</span>
|
||||
<input v-model.trim="exceptionForm.remark" placeholder="可选" />
|
||||
</label>
|
||||
</section>
|
||||
<button class="secondary-btn section-action" type="button" :disabled="saving" @click="saveException">保存特殊日期</button>
|
||||
<EmptyState v-if="exceptions.length === 0" title="暂无特殊日期" />
|
||||
<section v-else class="exception-list">
|
||||
<article v-for="item in exceptions" :key="String(item.id || item.workDate)" class="card exception-card">
|
||||
<div class="row-between">
|
||||
<div>
|
||||
<h2 class="exception-card__title">{{ item.workDate }}</h2>
|
||||
<div class="exception-card__subtitle">{{ exceptionSummary(item) }}</div>
|
||||
</div>
|
||||
<span class="tag">{{ exceptionTypeLabel(item.exceptionType) }}</span>
|
||||
</div>
|
||||
<p v-if="item.remark" class="exception-card__remark">{{ item.remark }}</p>
|
||||
</article>
|
||||
</section>
|
||||
</PageSection>
|
||||
</template>
|
||||
|
||||
<BaseModal v-model="helpModal.visible" :title="helpModal.title">
|
||||
<p class="help-content">{{ helpModal.content }}</p>
|
||||
@@ -51,22 +132,60 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import BaseModal from '@/components/BaseModal.vue'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import LoadingState from '@/components/LoadingState.vue'
|
||||
import MobileShell from '@/components/MobileShell.vue'
|
||||
import PageSection from '@/components/PageSection.vue'
|
||||
import { managerShopApi } from '@/api/managerShop'
|
||||
import type { ShopScheduleException } from '@/types/manager'
|
||||
import { formatDate } from '@/utils/date'
|
||||
import { useToastStore } from '@/stores/toast'
|
||||
|
||||
const presets = [
|
||||
{ value: 'EVERYDAY', label: '全周营业', workDays: [1, 2, 3, 4, 5, 6, 7], startTime: '10:00', endTime: '22:00' },
|
||||
{ value: 'DOUBLE_REST', label: '双休', workDays: [1, 2, 3, 4, 5], startTime: '09:00', endTime: '18:00' },
|
||||
{ value: 'SINGLE_REST', label: '单休', workDays: [1, 2, 3, 4, 5, 6], startTime: '10:00', endTime: '22:00' },
|
||||
{ value: 'CUSTOM', label: '自定义', workDays: [1, 2, 3, 4, 5], startTime: '10:00', endTime: '22:00' }
|
||||
]
|
||||
|
||||
const weekdays = [
|
||||
{ value: 1, label: '周一' },
|
||||
{ value: 2, label: '周二' },
|
||||
{ value: 3, label: '周三' },
|
||||
{ value: 4, label: '周四' },
|
||||
{ value: 5, label: '周五' },
|
||||
{ value: 6, label: '周六' },
|
||||
{ value: 7, label: '周日' }
|
||||
]
|
||||
|
||||
const exceptionTypes = [
|
||||
{ value: 'REST', label: '休息' },
|
||||
{ value: 'EXTRA_WORK', label: '临时营业' },
|
||||
{ value: 'CHANGE_SHIFT', label: '临时改班' }
|
||||
]
|
||||
|
||||
const toast = useToastStore()
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
const exceptions = ref<ShopScheduleException[]>([])
|
||||
const form = reactive({
|
||||
shopName: '甲屿云',
|
||||
shopName: '甲屿店务',
|
||||
startTime: '10:00',
|
||||
endTime: '22:00',
|
||||
defaultDuration: '60',
|
||||
rule: '必须选择已有作品作为项目来源'
|
||||
rule: '必须选择已有作品作为项目来源',
|
||||
schedulePresetType: 'EVERYDAY',
|
||||
scheduleWorkDays: '1,2,3,4,5,6,7',
|
||||
scheduleRemark: ''
|
||||
})
|
||||
const exceptionForm = reactive({
|
||||
workDate: formatDate(new Date()),
|
||||
exceptionType: 'REST',
|
||||
startTime: '10:00',
|
||||
endTime: '18:00',
|
||||
remark: ''
|
||||
})
|
||||
const helpModal = reactive({
|
||||
visible: false,
|
||||
@@ -74,19 +193,79 @@ const helpModal = reactive({
|
||||
content: ''
|
||||
})
|
||||
|
||||
const workDays = computed(() => parseWorkDays(form.scheduleWorkDays))
|
||||
|
||||
const parseWorkDays = (value: string): number[] => {
|
||||
return value.split(',')
|
||||
.map(item => Number(item.trim()))
|
||||
.filter(item => item >= 1 && item <= 7)
|
||||
.sort((a, b) => a - b)
|
||||
}
|
||||
|
||||
const encodeWorkDays = (days: number[]): string => {
|
||||
return [...new Set(days)].sort((a, b) => a - b).join(',')
|
||||
}
|
||||
|
||||
const selectedPreset = (value: string) => presets.find(item => item.value === value) ?? presets[0]!
|
||||
|
||||
const loadInfo = async (): Promise<void> => {
|
||||
loading.value = true
|
||||
try {
|
||||
const info = await managerShopApi.info()
|
||||
const [info, exceptionList] = await Promise.all([
|
||||
managerShopApi.info(),
|
||||
managerShopApi.scheduleExceptions()
|
||||
])
|
||||
form.shopName = info.shopName || info.name || form.shopName
|
||||
form.startTime = info.startTime || form.startTime
|
||||
form.endTime = info.endTime || form.endTime
|
||||
const hours = String(info.businessHours || '').split('-')
|
||||
form.startTime = String(info.startTime || hours[0] || form.startTime).slice(0, 5)
|
||||
form.endTime = String(info.endTime || hours[1] || form.endTime).slice(0, 5)
|
||||
form.rule = info.description || form.rule
|
||||
form.schedulePresetType = info.schedulePresetType || 'EVERYDAY'
|
||||
form.scheduleWorkDays = info.scheduleWorkDays || selectedPreset(form.schedulePresetType).workDays.join(',')
|
||||
form.scheduleRemark = info.scheduleRemark || ''
|
||||
exceptions.value = (exceptionList || []).map(normalizeException)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const normalizeException = (item: ShopScheduleException): ShopScheduleException => ({
|
||||
...item,
|
||||
startTime: item.startTime ? String(item.startTime).slice(0, 5) : '',
|
||||
endTime: item.endTime ? String(item.endTime).slice(0, 5) : ''
|
||||
})
|
||||
|
||||
const selectPreset = (value: string): void => {
|
||||
const preset = selectedPreset(value)
|
||||
form.schedulePresetType = preset.value
|
||||
form.scheduleWorkDays = preset.workDays.join(',')
|
||||
form.startTime = preset.startTime
|
||||
form.endTime = preset.endTime
|
||||
}
|
||||
|
||||
const toggleWeekday = (day: number): void => {
|
||||
const days = workDays.value.includes(day)
|
||||
? workDays.value.filter(item => item !== day)
|
||||
: [...workDays.value, day]
|
||||
form.schedulePresetType = 'CUSTOM'
|
||||
form.scheduleWorkDays = encodeWorkDays(days)
|
||||
}
|
||||
|
||||
const markCustom = (): void => {
|
||||
form.schedulePresetType = 'CUSTOM'
|
||||
}
|
||||
|
||||
const exceptionTypeLabel = (value: string): string => {
|
||||
return exceptionTypes.find(item => item.value === value)?.label || '特殊日期'
|
||||
}
|
||||
|
||||
const exceptionSummary = (item: ShopScheduleException): string => {
|
||||
if (item.exceptionType === 'REST') {
|
||||
return '店铺休息'
|
||||
}
|
||||
return `${String(item.startTime || '').slice(0, 5)} - ${String(item.endTime || '').slice(0, 5)}`
|
||||
}
|
||||
|
||||
const showDurationHelp = (): void => {
|
||||
helpModal.title = '默认时长'
|
||||
helpModal.content = '用于手动创建预约或未选择作品时的默认服务时长,会影响可约时间校验和预约结束时间估算。'
|
||||
@@ -99,7 +278,26 @@ const showRuleHelp = (): void => {
|
||||
helpModal.visible = true
|
||||
}
|
||||
|
||||
const validateRule = (): boolean => {
|
||||
if (!form.shopName) {
|
||||
toast.error('请填写店铺名称')
|
||||
return false
|
||||
}
|
||||
if (workDays.value.length === 0) {
|
||||
toast.error('请选择店铺营业日')
|
||||
return false
|
||||
}
|
||||
if (!form.startTime || !form.endTime || form.startTime >= form.endTime) {
|
||||
toast.error('请填写正确的营业时间')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
const save = async (): Promise<void> => {
|
||||
if (!validateRule()) {
|
||||
return
|
||||
}
|
||||
saving.value = true
|
||||
try {
|
||||
await managerShopApi.update({
|
||||
@@ -108,7 +306,10 @@ const save = async (): Promise<void> => {
|
||||
startTime: form.startTime,
|
||||
endTime: form.endTime,
|
||||
businessHours: `${form.startTime}-${form.endTime}`,
|
||||
description: form.rule
|
||||
description: form.rule,
|
||||
schedulePresetType: form.schedulePresetType,
|
||||
scheduleWorkDays: form.scheduleWorkDays,
|
||||
scheduleRemark: form.scheduleRemark
|
||||
})
|
||||
toast.success('已保存')
|
||||
} finally {
|
||||
@@ -116,6 +317,34 @@ const save = async (): Promise<void> => {
|
||||
}
|
||||
}
|
||||
|
||||
const saveException = async (): Promise<void> => {
|
||||
if (!exceptionForm.workDate) {
|
||||
toast.error('请选择特殊日期')
|
||||
return
|
||||
}
|
||||
if (exceptionForm.exceptionType !== 'REST' && (!exceptionForm.startTime || !exceptionForm.endTime || exceptionForm.startTime >= exceptionForm.endTime)) {
|
||||
toast.error('请填写正确的特殊日期时间')
|
||||
return
|
||||
}
|
||||
saving.value = true
|
||||
try {
|
||||
const payload: ShopScheduleException = {
|
||||
workDate: exceptionForm.workDate,
|
||||
exceptionType: exceptionForm.exceptionType,
|
||||
remark: exceptionForm.remark
|
||||
}
|
||||
if (exceptionForm.exceptionType !== 'REST') {
|
||||
payload.startTime = exceptionForm.startTime
|
||||
payload.endTime = exceptionForm.endTime
|
||||
}
|
||||
await managerShopApi.saveScheduleException(payload)
|
||||
exceptions.value = (await managerShopApi.scheduleExceptions()).map(normalizeException)
|
||||
toast.success('特殊日期已保存')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadInfo)
|
||||
</script>
|
||||
|
||||
@@ -150,4 +379,72 @@ onMounted(loadInfo)
|
||||
color: #504a43;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.preset-grid,
|
||||
.weekday-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.weekday-grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.preset-chip,
|
||||
.weekday-chip {
|
||||
min-height: 38px;
|
||||
border: 1px solid #e3ddd2;
|
||||
border-radius: 8px;
|
||||
background: #fffaf2;
|
||||
color: #5f564c;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.preset-chip.active,
|
||||
.weekday-chip.active {
|
||||
border-color: #75a78e;
|
||||
background: #e5f2eb;
|
||||
color: #2f6b55;
|
||||
}
|
||||
|
||||
.field-block {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.field-title {
|
||||
color: #6f665c;
|
||||
font-size: 13px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.section-action {
|
||||
width: 100%;
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.exception-list {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.exception-card__title {
|
||||
margin: 0;
|
||||
color: #2f2a25;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.exception-card__subtitle,
|
||||
.exception-card__remark {
|
||||
margin: 4px 0 0;
|
||||
color: #7b7167;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.preset-grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user