2026-06-29 20:58:39 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<MobileShell title="新建预约">
|
|
|
|
|
|
<div v-if="draftSavedAtText" class="card draft-tip">
|
|
|
|
|
|
<span>{{ draftSavedAtText }}</span>
|
|
|
|
|
|
<button class="text-btn" type="button" @click="clearDraft">清空</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="card form-card">
|
2026-07-01 15:48:39 +08:00
|
|
|
|
<div class="field field--stack customer-combobox">
|
|
|
|
|
|
<label class="required">客户</label>
|
|
|
|
|
|
<div class="customer-control">
|
2026-07-01 18:01:45 +08:00
|
|
|
|
<button v-if="selectedCustomerReady" class="customer-selected-row" type="button" @click="openCustomerDropdown">
|
|
|
|
|
|
<span>{{ form.customerName || '未填写姓名' }}</span>
|
|
|
|
|
|
<strong>{{ form.phone || '未填写手机号' }}</strong>
|
|
|
|
|
|
</button>
|
2026-07-01 15:48:39 +08:00
|
|
|
|
<input
|
2026-07-01 18:01:45 +08:00
|
|
|
|
v-else
|
2026-07-01 15:48:39 +08:00
|
|
|
|
v-model.trim="customerSearchText"
|
|
|
|
|
|
placeholder="搜索客户姓名或手机号"
|
|
|
|
|
|
@focus="openCustomerDropdown"
|
|
|
|
|
|
@input="onCustomerSearchInput"
|
|
|
|
|
|
@keydown.escape="customerDropdownOpen = false"
|
|
|
|
|
|
/>
|
2026-07-01 18:01:45 +08:00
|
|
|
|
<button v-if="customerSearchText || selectedCustomerReady" class="customer-clear" type="button" @click="clearCustomerSelection">×</button>
|
2026-07-01 15:48:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="customerDropdownOpen" class="customer-dropdown">
|
|
|
|
|
|
<div v-if="customerSearching" class="customer-muted">正在搜索客户...</div>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
<button v-for="customer in customerOptions" :key="String(customer.id)" class="customer-option" type="button" @click="selectCustomer(customer)">
|
2026-07-01 18:01:45 +08:00
|
|
|
|
<strong>{{ customer.nickname || customer.account || customer.phone || customer.contactPhone }}</strong>
|
|
|
|
|
|
<span>{{ customer.phone || customer.contactPhone || '未填写手机号' }}</span>
|
2026-07-01 15:48:39 +08:00
|
|
|
|
</button>
|
|
|
|
|
|
<div v-if="customerOptions.length === 0" class="customer-muted">暂无匹配客户,可继续创建新客户</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<div class="customer-new">
|
|
|
|
|
|
<strong>新客户</strong>
|
|
|
|
|
|
<input v-model.trim="newCustomerName" placeholder="客户姓名" />
|
|
|
|
|
|
<input v-model.trim="newCustomerPhone" inputmode="numeric" placeholder="手机号" />
|
|
|
|
|
|
<button class="secondary-btn" type="button" @click="useNewCustomer">使用新客户</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-06-29 20:58:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="field"><label class="required">预约日期</label><input v-model="form.appointmentDate" type="date" @change="onDateChange" /></div>
|
|
|
|
|
|
<div class="field"><label class="required">预约作品</label><button class="field-value picker-value" type="button" @click="productModalVisible = true">{{ selectedProductTitle }}</button></div>
|
|
|
|
|
|
<div class="field"><label class="required">预计时长</label><input v-model.trim="form.durationMinutes" inputmode="numeric" placeholder="分钟" @input="refreshAvailableTimes" /></div>
|
|
|
|
|
|
<div class="field"><label class="required">指定员工</label><select v-model="form.artistId" @change="refreshAvailableTimes"><option value="">请选择员工</option><option v-for="artist in artists" :key="String(artist.id)" :value="String(artist.id)">{{ artist.name || artist.nickname }}</option></select></div>
|
|
|
|
|
|
<div class="field"><label class="required">预约时间</label><button class="field-value picker-value" type="button" @click="openTimeSheet">{{ form.appointmentTime || timeSelectTip }}</button></div>
|
|
|
|
|
|
<div class="field field--stack"><label>备注</label><textarea v-model.trim="form.remark" placeholder="请输入预约备注"></textarea></div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-if="conflictTip" class="conflict-tip" :class="`conflict-tip--${conflictLevel}`">{{ conflictTip }}</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="fixed-bottom">
|
|
|
|
|
|
<div class="fixed-bottom__inner button-row">
|
|
|
|
|
|
<button class="secondary-btn" type="button" @click="saveDraft">保存草稿</button>
|
|
|
|
|
|
<button class="primary-btn" type="button" :disabled="loading" @click="submit">{{ loading ? '提交中...' : '提交预约' }}</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-07-01 12:49:18 +08:00
|
|
|
|
<BaseModal
|
|
|
|
|
|
:model-value="productModalVisible"
|
|
|
|
|
|
title="选择预约作品"
|
|
|
|
|
|
:has-unsaved-changes="manualProductChanged"
|
|
|
|
|
|
@update:model-value="updateProductModalVisible"
|
|
|
|
|
|
>
|
2026-06-29 20:58:39 +08:00
|
|
|
|
<div class="product-modal">
|
2026-07-01 15:48:39 +08:00
|
|
|
|
<input v-model.trim="productKeyword" class="search-input" placeholder="搜索作品、标签、美甲师" @input="filterProducts" />
|
2026-06-29 20:58:39 +08:00
|
|
|
|
<div class="list">
|
|
|
|
|
|
<button v-for="product in filteredProducts" :key="String(product.id)" class="product-card" type="button" @click="selectProduct(product)">
|
|
|
|
|
|
<img v-if="product.coverImage" :src="product.coverImage" alt="" />
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<strong>{{ product.title }}</strong>
|
|
|
|
|
|
<span>{{ product.priceText }} · {{ product.durationText || '时长待定' }}</span>
|
|
|
|
|
|
<small>{{ product.artistText }}</small>
|
2026-07-01 15:48:39 +08:00
|
|
|
|
<div v-if="product.tagList.length > 0" class="tag-row">
|
|
|
|
|
|
<i v-for="tag in product.tagList" :key="tag">{{ tag }}</i>
|
|
|
|
|
|
</div>
|
2026-06-29 20:58:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</button>
|
2026-07-01 15:48:39 +08:00
|
|
|
|
<EmptyState v-if="filteredProducts.length === 0" title="暂无匹配作品" description="可以调整关键词或手动新增预约作品" />
|
2026-06-29 20:58:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<PageSection title="手动新增预约作品">
|
|
|
|
|
|
<div class="manual-form">
|
|
|
|
|
|
<input v-model.trim="form.manualProductTitle" class="search-input" placeholder="作品名称" />
|
|
|
|
|
|
<input v-model.trim="form.manualProductPrice" class="search-input" inputmode="decimal" placeholder="价格" />
|
|
|
|
|
|
<input v-model.trim="form.manualProductTags" class="search-input" placeholder="标签,逗号分隔" />
|
|
|
|
|
|
<textarea v-model.trim="form.manualProductDescription" class="search-input textarea" placeholder="作品说明"></textarea>
|
2026-07-01 15:48:39 +08:00
|
|
|
|
<input v-model.trim="form.manualProductTargetAudience" class="search-input" placeholder="适合人群(选填)" />
|
|
|
|
|
|
<input v-model.trim="form.manualProductPrecautions" class="search-input" placeholder="注意事项(选填)" />
|
|
|
|
|
|
<div class="manual-image-row">
|
|
|
|
|
|
<img v-if="form.manualProductImageUrl" :src="form.manualProductImageUrl" alt="" />
|
|
|
|
|
|
<div v-else class="manual-image-placeholder">图</div>
|
|
|
|
|
|
<label class="secondary-btn image-upload">
|
|
|
|
|
|
{{ manualImageUploading ? '上传中...' : '上传图片' }}
|
|
|
|
|
|
<input type="file" accept="image/*" :disabled="manualImageUploading" @change="uploadManualProductImage" />
|
|
|
|
|
|
</label>
|
|
|
|
|
|
<button v-if="form.manualProductImageUrl" class="text-btn" type="button" @click="removeManualProductImage">移除</button>
|
|
|
|
|
|
</div>
|
2026-06-29 20:58:39 +08:00
|
|
|
|
<button class="secondary-btn" type="button" @click="useManualProduct">使用手动作品</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</PageSection>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</BaseModal>
|
|
|
|
|
|
|
2026-07-01 12:49:18 +08:00
|
|
|
|
<BaseModal
|
|
|
|
|
|
:model-value="timeSheetVisible"
|
|
|
|
|
|
title="选择可约时间"
|
|
|
|
|
|
@update:model-value="updateTimeSheetVisible"
|
|
|
|
|
|
>
|
2026-06-29 20:58:39 +08:00
|
|
|
|
<div class="time-sheet">
|
|
|
|
|
|
<LoadingState v-if="timeLoading" text="正在计算可约时间" />
|
|
|
|
|
|
<EmptyState v-else-if="availableTimeGroups.length === 0" title="暂无可约时间" :description="timeSelectTip" />
|
|
|
|
|
|
<section v-for="group in availableTimeGroups" v-else :key="group.key">
|
|
|
|
|
|
<h3>{{ group.title }}</h3>
|
|
|
|
|
|
<div class="time-grid">
|
|
|
|
|
|
<button v-for="time in group.times" :key="time.value" type="button" @click="selectAvailableTime(time.value)">
|
|
|
|
|
|
<strong>{{ time.value }}</strong>
|
|
|
|
|
|
<span>{{ time.rangeText }}</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</BaseModal>
|
|
|
|
|
|
</MobileShell>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-07-01 12:49:18 +08:00
|
|
|
|
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
2026-06-29 20:58:39 +08:00
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
|
|
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 { managerCustomersApi } from '@/api/managerCustomers'
|
|
|
|
|
|
import { managerEmployeesApi } from '@/api/managerEmployees'
|
|
|
|
|
|
import { managerPlanningApi } from '@/api/managerPlanning'
|
|
|
|
|
|
import { managerProductsApi } from '@/api/managerProducts'
|
2026-07-01 15:48:39 +08:00
|
|
|
|
import { fileApi } from '@/api/file'
|
2026-06-29 20:58:39 +08:00
|
|
|
|
import type { AppointmentForm, Artist, Product } from '@/types/manager'
|
|
|
|
|
|
import type { UserInfo } from '@/types/common'
|
|
|
|
|
|
import { useSessionStore } from '@/stores/session'
|
|
|
|
|
|
import { useToastStore } from '@/stores/toast'
|
|
|
|
|
|
import { formatDate, minutesOfDay, timeFromMinutes } from '@/utils/date'
|
|
|
|
|
|
import { buildAvailableTimeGroups, type AvailableTimeGroup } from '@/utils/available-times'
|
|
|
|
|
|
import { buildClientRequestId, normalizeDuration } from '@/utils/planning'
|
|
|
|
|
|
import { readDraftForm, removeDraftForm, writeDraftForm } from '@/utils/appointment-draft'
|
2026-07-01 12:49:18 +08:00
|
|
|
|
import { readFormModalDraft, removeFormModalDraft, writeFormModalDraft } from '@/utils/form-modal-draft'
|
2026-06-29 20:58:39 +08:00
|
|
|
|
import { markPlanningRefresh } from '@/utils/storage'
|
|
|
|
|
|
|
|
|
|
|
|
interface ProductCard extends Product {
|
|
|
|
|
|
coverImage: string
|
|
|
|
|
|
priceText: string
|
|
|
|
|
|
durationText: string
|
|
|
|
|
|
artistText: string
|
2026-07-01 15:48:39 +08:00
|
|
|
|
tagList: string[]
|
2026-06-29 20:58:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 12:49:18 +08:00
|
|
|
|
interface AppointmentModalState {
|
|
|
|
|
|
productModalVisible: boolean
|
|
|
|
|
|
timeSheetVisible: boolean
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const APPOINTMENT_MODAL_STATE_DRAFT_NAME = 'appointment-modal-state'
|
|
|
|
|
|
|
2026-06-29 20:58:39 +08:00
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
const session = useSessionStore()
|
|
|
|
|
|
const toast = useToastStore()
|
|
|
|
|
|
const baseForm = readDraftForm(session.userInfo)
|
2026-07-01 12:49:18 +08:00
|
|
|
|
const modalStateDraft = readFormModalDraft<AppointmentModalState>(session.userInfo, APPOINTMENT_MODAL_STATE_DRAFT_NAME)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
const form = reactive<AppointmentForm>({
|
|
|
|
|
|
customerUserId: '',
|
|
|
|
|
|
customerName: String(route.query.customerName || baseForm?.customerName || ''),
|
|
|
|
|
|
phone: String(route.query.phone || baseForm?.phone || ''),
|
|
|
|
|
|
appointmentDate: String(route.query.date || baseForm?.appointmentDate || formatDate(new Date())),
|
|
|
|
|
|
appointmentTime: baseForm?.appointmentTime || '',
|
|
|
|
|
|
productId: baseForm?.productId || '',
|
|
|
|
|
|
manualProductTitle: baseForm?.manualProductTitle || '',
|
|
|
|
|
|
manualProductPrice: baseForm?.manualProductPrice || '',
|
|
|
|
|
|
manualProductDescription: baseForm?.manualProductDescription || '',
|
|
|
|
|
|
manualProductTags: baseForm?.manualProductTags || '',
|
|
|
|
|
|
manualProductTargetAudience: baseForm?.manualProductTargetAudience || '',
|
|
|
|
|
|
manualProductPrecautions: baseForm?.manualProductPrecautions || '',
|
|
|
|
|
|
manualProductImageFileIds: baseForm?.manualProductImageFileIds || '',
|
|
|
|
|
|
manualProductImageUrl: baseForm?.manualProductImageUrl || '',
|
|
|
|
|
|
durationMinutes: baseForm?.durationMinutes || '',
|
|
|
|
|
|
artistId: String(route.query.artistId || baseForm?.artistId || ''),
|
|
|
|
|
|
remark: baseForm?.remark || ''
|
|
|
|
|
|
})
|
|
|
|
|
|
const draftSavedAtText = ref(baseForm ? '已恢复本机草稿' : '')
|
|
|
|
|
|
const customerOptions = ref<UserInfo[]>([])
|
|
|
|
|
|
const customerTimer = ref<number | null>(null)
|
2026-07-01 15:48:39 +08:00
|
|
|
|
const customerSearchText = ref([form.customerName, form.phone].filter(Boolean).join(' '))
|
|
|
|
|
|
const customerDropdownOpen = ref(false)
|
|
|
|
|
|
const customerSearching = ref(false)
|
|
|
|
|
|
const newCustomerName = ref(form.customerName)
|
|
|
|
|
|
const newCustomerPhone = ref(form.phone)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
const products = ref<ProductCard[]>([])
|
|
|
|
|
|
const filteredProducts = ref<ProductCard[]>([])
|
|
|
|
|
|
const productKeyword = ref('')
|
2026-07-01 12:49:18 +08:00
|
|
|
|
const productModalVisible = ref(Boolean(modalStateDraft?.open && modalStateDraft.form.productModalVisible))
|
2026-06-29 20:58:39 +08:00
|
|
|
|
const artists = ref<Artist[]>([])
|
|
|
|
|
|
const selectedProduct = ref<ProductCard | null>(null)
|
2026-07-01 12:49:18 +08:00
|
|
|
|
const timeSheetVisible = ref(Boolean(modalStateDraft?.open && modalStateDraft.form.timeSheetVisible))
|
2026-06-29 20:58:39 +08:00
|
|
|
|
const availableTimeGroups = ref<AvailableTimeGroup[]>([])
|
|
|
|
|
|
const timeLoading = ref(false)
|
|
|
|
|
|
const timeSelectTip = ref('请先选择美甲师并填写时长')
|
|
|
|
|
|
const conflictTip = ref('')
|
|
|
|
|
|
const conflictLevel = ref<'free' | 'danger'>('free')
|
|
|
|
|
|
const loading = ref(false)
|
2026-07-01 15:48:39 +08:00
|
|
|
|
const manualImageUploading = ref(false)
|
2026-07-01 18:01:45 +08:00
|
|
|
|
const selectedCustomerReady = computed(() => {
|
|
|
|
|
|
return Boolean(form.customerName || form.phone)
|
|
|
|
|
|
})
|
2026-07-01 11:17:52 +08:00
|
|
|
|
const manualProductChanged = computed(() => {
|
|
|
|
|
|
return Boolean(
|
|
|
|
|
|
form.manualProductTitle
|
|
|
|
|
|
|| form.manualProductPrice
|
|
|
|
|
|
|| form.manualProductTags
|
|
|
|
|
|
|| form.manualProductDescription
|
2026-07-01 15:48:39 +08:00
|
|
|
|
|| form.manualProductTargetAudience
|
|
|
|
|
|
|| form.manualProductPrecautions
|
|
|
|
|
|
|| form.manualProductImageFileIds
|
|
|
|
|
|
|| form.manualProductImageUrl
|
2026-07-01 11:17:52 +08:00
|
|
|
|
)
|
|
|
|
|
|
})
|
2026-07-01 12:49:18 +08:00
|
|
|
|
const appointmentFormChanged = computed(() => {
|
|
|
|
|
|
return Boolean(
|
|
|
|
|
|
form.customerUserId
|
|
|
|
|
|
|| form.customerName
|
|
|
|
|
|
|| form.phone
|
|
|
|
|
|
|| form.appointmentTime
|
|
|
|
|
|
|| form.productId
|
|
|
|
|
|
|| form.manualProductTitle
|
|
|
|
|
|
|| form.manualProductPrice
|
|
|
|
|
|
|| form.manualProductDescription
|
|
|
|
|
|
|| form.manualProductTags
|
|
|
|
|
|
|| form.manualProductTargetAudience
|
|
|
|
|
|
|| form.manualProductPrecautions
|
|
|
|
|
|
|| form.manualProductImageFileIds
|
|
|
|
|
|
|| form.manualProductImageUrl
|
|
|
|
|
|
|| form.durationMinutes
|
|
|
|
|
|
|| form.artistId
|
|
|
|
|
|
|| form.remark
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const syncAppointmentDraft = (): void => {
|
|
|
|
|
|
if (!appointmentFormChanged.value) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
writeDraftForm(session.userInfo, { ...form })
|
|
|
|
|
|
if (!draftSavedAtText.value) {
|
|
|
|
|
|
draftSavedAtText.value = '草稿已自动保存到本机'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const syncAppointmentModalState = (): void => {
|
|
|
|
|
|
if (!productModalVisible.value && !timeSheetVisible.value) {
|
|
|
|
|
|
removeFormModalDraft(session.userInfo, APPOINTMENT_MODAL_STATE_DRAFT_NAME)
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
writeFormModalDraft(session.userInfo, APPOINTMENT_MODAL_STATE_DRAFT_NAME, {
|
|
|
|
|
|
productModalVisible: productModalVisible.value,
|
|
|
|
|
|
timeSheetVisible: timeSheetVisible.value
|
|
|
|
|
|
}, true)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const updateProductModalVisible = (value: boolean): void => {
|
|
|
|
|
|
productModalVisible.value = value
|
|
|
|
|
|
syncAppointmentModalState()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const updateTimeSheetVisible = (value: boolean): void => {
|
|
|
|
|
|
timeSheetVisible.value = value
|
|
|
|
|
|
syncAppointmentModalState()
|
|
|
|
|
|
}
|
2026-06-29 20:58:39 +08:00
|
|
|
|
|
|
|
|
|
|
const selectedProductTitle = computed(() => {
|
|
|
|
|
|
if (selectedProduct.value) {
|
|
|
|
|
|
return selectedProduct.value.title
|
|
|
|
|
|
}
|
|
|
|
|
|
if (form.manualProductTitle) {
|
|
|
|
|
|
return form.manualProductTitle
|
|
|
|
|
|
}
|
|
|
|
|
|
return '请选择作品'
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-07-01 15:48:39 +08:00
|
|
|
|
const parseProductTags = (product: Product): string[] => {
|
|
|
|
|
|
if (Array.isArray(product.tagList) && product.tagList.length > 0) {
|
|
|
|
|
|
return product.tagList.map(tag => String(tag || '').trim()).filter(Boolean)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (Array.isArray(product.tagInfos) && product.tagInfos.length > 0) {
|
|
|
|
|
|
return product.tagInfos.map(tag => String(tag.tagName || '').trim()).filter(Boolean)
|
|
|
|
|
|
}
|
|
|
|
|
|
return String(product.tags || '')
|
|
|
|
|
|
.split(/[;,,、]/)
|
|
|
|
|
|
.map(tag => tag.trim())
|
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const resolveProductArtistText = (product: Product, artistOptions: Artist[]): string => {
|
|
|
|
|
|
const artistIds = String(product.bookableArtists || '')
|
|
|
|
|
|
.split(',')
|
|
|
|
|
|
.map(id => id.trim())
|
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
|
if (artistIds.length === 0) {
|
|
|
|
|
|
return '全部美甲师'
|
|
|
|
|
|
}
|
|
|
|
|
|
const artistNames = artistIds
|
|
|
|
|
|
.map(id => artistOptions.find(artist => String(artist.id) === id))
|
|
|
|
|
|
.filter((artist): artist is Artist => Boolean(artist))
|
|
|
|
|
|
.map(artist => artist.name || artist.nickname || '')
|
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
|
return artistNames.length > 0 ? artistNames.join('、') : '指定美甲师'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const normalizeProduct = (product: Product, artistOptions: Artist[]): ProductCard => {
|
2026-06-29 20:58:39 +08:00
|
|
|
|
const imageUrls = Array.isArray(product.imageUrls) ? product.imageUrls : []
|
|
|
|
|
|
const durationText = product.approximateDuration || (product.serviceDurationMinutes ? `${product.serviceDurationMinutes}分钟` : '')
|
|
|
|
|
|
return {
|
|
|
|
|
|
...product,
|
|
|
|
|
|
coverImage: imageUrls[0] || '',
|
2026-07-01 15:48:39 +08:00
|
|
|
|
tagList: parseProductTags(product).slice(0, 4),
|
2026-06-29 20:58:39 +08:00
|
|
|
|
priceText: product.price || product.price === 0 ? `¥${product.price}` : '价格待定',
|
|
|
|
|
|
durationText,
|
2026-07-01 15:48:39 +08:00
|
|
|
|
artistText: resolveProductArtistText(product, artistOptions)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const filterProducts = (): void => {
|
|
|
|
|
|
const keyword = productKeyword.value.toLowerCase()
|
|
|
|
|
|
filteredProducts.value = products.value.filter(product => {
|
|
|
|
|
|
if (!keyword) {
|
|
|
|
|
|
return true
|
|
|
|
|
|
}
|
2026-07-01 15:48:39 +08:00
|
|
|
|
return [product.title, product.priceText, product.durationText, product.artistText, ...product.tagList]
|
|
|
|
|
|
.some(value => String(value || '').toLowerCase().includes(keyword))
|
2026-06-29 20:58:39 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const loadOptions = async (): Promise<void> => {
|
|
|
|
|
|
const [productData, employeeData] = await Promise.all([
|
|
|
|
|
|
managerProductsApi.list({ page: 1, size: 100 }),
|
|
|
|
|
|
managerEmployeesApi.list()
|
|
|
|
|
|
])
|
|
|
|
|
|
artists.value = employeeData
|
2026-07-01 15:48:39 +08:00
|
|
|
|
const productList = Array.isArray(productData) ? productData : productData.list
|
|
|
|
|
|
products.value = productList.map(product => normalizeProduct(product, artists.value))
|
|
|
|
|
|
filteredProducts.value = products.value
|
2026-06-29 20:58:39 +08:00
|
|
|
|
if (form.productId) {
|
|
|
|
|
|
selectedProduct.value = products.value.find(item => String(item.id) === String(form.productId)) || null
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const scheduleCustomerSearch = (): void => {
|
|
|
|
|
|
if (customerTimer.value !== null) {
|
|
|
|
|
|
window.clearTimeout(customerTimer.value)
|
|
|
|
|
|
}
|
|
|
|
|
|
customerTimer.value = window.setTimeout(() => {
|
|
|
|
|
|
void searchCustomers()
|
|
|
|
|
|
}, 250)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const searchCustomers = async (): Promise<void> => {
|
2026-07-01 15:48:39 +08:00
|
|
|
|
const keyword = customerSearchText.value.trim()
|
|
|
|
|
|
customerSearching.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
const data = await managerCustomersApi.list({ page: 1, size: 20, keyword })
|
|
|
|
|
|
customerOptions.value = data.list || []
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
customerSearching.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const openCustomerDropdown = (): void => {
|
|
|
|
|
|
customerDropdownOpen.value = true
|
|
|
|
|
|
if (customerOptions.value.length === 0) {
|
|
|
|
|
|
scheduleCustomerSearch()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const onCustomerSearchInput = (): void => {
|
|
|
|
|
|
form.customerUserId = ''
|
|
|
|
|
|
form.customerName = ''
|
|
|
|
|
|
form.phone = ''
|
|
|
|
|
|
newCustomerName.value = customerSearchText.value
|
|
|
|
|
|
customerDropdownOpen.value = true
|
|
|
|
|
|
scheduleCustomerSearch()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const clearCustomerSelection = (): void => {
|
|
|
|
|
|
form.customerUserId = ''
|
|
|
|
|
|
form.customerName = ''
|
|
|
|
|
|
form.phone = ''
|
|
|
|
|
|
customerSearchText.value = ''
|
|
|
|
|
|
newCustomerName.value = ''
|
|
|
|
|
|
newCustomerPhone.value = ''
|
|
|
|
|
|
customerOptions.value = []
|
|
|
|
|
|
customerDropdownOpen.value = true
|
2026-06-29 20:58:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const selectCustomer = (customer: UserInfo): void => {
|
|
|
|
|
|
form.customerUserId = String(customer.id)
|
|
|
|
|
|
form.customerName = customer.nickname || customer.account || ''
|
|
|
|
|
|
form.phone = customer.phone || customer.contactPhone || ''
|
2026-07-01 15:48:39 +08:00
|
|
|
|
customerSearchText.value = [form.customerName, form.phone].filter(Boolean).join(' ')
|
|
|
|
|
|
newCustomerName.value = form.customerName
|
|
|
|
|
|
newCustomerPhone.value = form.phone
|
2026-06-29 20:58:39 +08:00
|
|
|
|
customerOptions.value = []
|
2026-07-01 15:48:39 +08:00
|
|
|
|
customerDropdownOpen.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const useNewCustomer = (): void => {
|
|
|
|
|
|
const name = newCustomerName.value.trim()
|
|
|
|
|
|
const phone = newCustomerPhone.value.trim()
|
|
|
|
|
|
if (!name || !phone) {
|
|
|
|
|
|
toast.error('请填写新客户姓名和手机号')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
form.customerUserId = ''
|
|
|
|
|
|
form.customerName = name
|
|
|
|
|
|
form.phone = phone
|
|
|
|
|
|
customerSearchText.value = [name, phone].filter(Boolean).join(' ')
|
|
|
|
|
|
customerOptions.value = []
|
|
|
|
|
|
customerDropdownOpen.value = false
|
2026-06-29 20:58:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const onDateChange = async (): Promise<void> => {
|
|
|
|
|
|
form.appointmentTime = ''
|
|
|
|
|
|
await refreshAvailableTimes()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const selectProduct = (product: ProductCard): void => {
|
|
|
|
|
|
selectedProduct.value = product
|
|
|
|
|
|
form.productId = String(product.id)
|
|
|
|
|
|
form.manualProductTitle = ''
|
|
|
|
|
|
form.manualProductPrice = ''
|
2026-07-01 15:48:39 +08:00
|
|
|
|
form.manualProductDescription = ''
|
|
|
|
|
|
form.manualProductTags = ''
|
|
|
|
|
|
form.manualProductTargetAudience = ''
|
|
|
|
|
|
form.manualProductPrecautions = ''
|
|
|
|
|
|
form.manualProductImageFileIds = ''
|
|
|
|
|
|
form.manualProductImageUrl = ''
|
2026-06-29 20:58:39 +08:00
|
|
|
|
form.durationMinutes = String(Number.parseInt(product.approximateDuration || '', 10) || product.serviceDurationMinutes || form.durationMinutes)
|
2026-07-01 12:49:18 +08:00
|
|
|
|
updateProductModalVisible(false)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
void refreshAvailableTimes()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const useManualProduct = (): void => {
|
|
|
|
|
|
const title = form.manualProductTitle.trim()
|
|
|
|
|
|
const price = Number(form.manualProductPrice)
|
|
|
|
|
|
if (!title || Number.isNaN(price) || price < 0) {
|
|
|
|
|
|
toast.error('请填写手动预约作品名称和价格')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
form.productId = ''
|
|
|
|
|
|
selectedProduct.value = null
|
2026-07-01 12:49:18 +08:00
|
|
|
|
updateProductModalVisible(false)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 15:48:39 +08:00
|
|
|
|
const uploadManualProductImage = async (event: Event): Promise<void> => {
|
|
|
|
|
|
const input = event.target as HTMLInputElement
|
|
|
|
|
|
const file = input.files?.[0]
|
|
|
|
|
|
if (!file) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
manualImageUploading.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
const uploaded = await fileApi.uploadObjectFile(file)
|
|
|
|
|
|
form.manualProductImageFileIds = String(uploaded.id)
|
|
|
|
|
|
form.manualProductImageUrl = uploaded.primaryUrl || uploaded.fileUrl || ''
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
input.value = ''
|
|
|
|
|
|
manualImageUploading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const removeManualProductImage = (): void => {
|
|
|
|
|
|
form.manualProductImageFileIds = ''
|
|
|
|
|
|
form.manualProductImageUrl = ''
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-29 20:58:39 +08:00
|
|
|
|
const refreshAvailableTimes = async (): Promise<void> => {
|
|
|
|
|
|
const durationMinutes = normalizeDuration(form.durationMinutes)
|
|
|
|
|
|
if (!form.appointmentDate || !form.artistId || !durationMinutes) {
|
|
|
|
|
|
availableTimeGroups.value = []
|
|
|
|
|
|
timeSelectTip.value = '请先选择美甲师并填写时长'
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
timeLoading.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
const calendar = await managerPlanningApi.calendar({ startDate: form.appointmentDate, endDate: form.appointmentDate, artistId: form.artistId })
|
|
|
|
|
|
availableTimeGroups.value = buildAvailableTimeGroups(calendar, form)
|
|
|
|
|
|
timeSelectTip.value = availableTimeGroups.value.length > 0 ? '请选择预约时间' : '当前美甲师当天暂无可约时间'
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
timeLoading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const openTimeSheet = async (): Promise<void> => {
|
|
|
|
|
|
if (!form.appointmentDate || !form.artistId || !normalizeDuration(form.durationMinutes)) {
|
|
|
|
|
|
toast.error('请先选择美甲师并填写时长')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2026-07-01 12:49:18 +08:00
|
|
|
|
updateTimeSheetVisible(true)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
await refreshAvailableTimes()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const selectAvailableTime = (value: string): void => {
|
|
|
|
|
|
form.appointmentTime = value
|
2026-07-01 12:49:18 +08:00
|
|
|
|
updateTimeSheetVisible(false)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
void checkAvailability()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const checkAvailability = async (): Promise<{ ok: boolean; tip?: string }> => {
|
|
|
|
|
|
if (!form.appointmentDate || !form.appointmentTime || !form.artistId || !normalizeDuration(form.durationMinutes)) {
|
|
|
|
|
|
conflictTip.value = ''
|
|
|
|
|
|
return { ok: true }
|
|
|
|
|
|
}
|
|
|
|
|
|
const startMinute = minutesOfDay(form.appointmentTime)
|
|
|
|
|
|
const endMinute = startMinute + normalizeDuration(form.durationMinutes)
|
2026-07-01 02:08:51 +08: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}`
|
2026-06-29 20:58:39 +08:00
|
|
|
|
conflictLevel.value = 'danger'
|
|
|
|
|
|
return { ok: false, tip: conflictTip.value }
|
|
|
|
|
|
}
|
|
|
|
|
|
conflictTip.value = `当前时段 ${form.appointmentTime}-${timeFromMinutes(endMinute)} 可预约`
|
|
|
|
|
|
conflictLevel.value = 'free'
|
|
|
|
|
|
return { ok: true, tip: conflictTip.value }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const submit = async (): Promise<void> => {
|
|
|
|
|
|
const hasManualProduct = form.manualProductTitle.trim() && form.manualProductPrice.trim()
|
|
|
|
|
|
if (!form.customerName || !form.phone || (!form.productId && !hasManualProduct) || !form.artistId || !form.appointmentTime) {
|
|
|
|
|
|
toast.error('请补全预约信息')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
const durationMinutes = normalizeDuration(form.durationMinutes)
|
|
|
|
|
|
if (!durationMinutes) {
|
|
|
|
|
|
toast.error('请填写预约时长')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
const availability = await checkAvailability()
|
|
|
|
|
|
if (!availability.ok) {
|
|
|
|
|
|
toast.error(availability.tip || '该时段已被预约')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
const payload = {
|
|
|
|
|
|
...form,
|
|
|
|
|
|
customerUserId: form.customerUserId || undefined,
|
|
|
|
|
|
productId: form.productId || undefined,
|
|
|
|
|
|
artistId: form.artistId,
|
|
|
|
|
|
durationMinutes,
|
|
|
|
|
|
manualProductPrice: hasManualProduct ? Number(form.manualProductPrice) : undefined,
|
|
|
|
|
|
clientRequestId: buildClientRequestId('manager-appointment')
|
|
|
|
|
|
}
|
|
|
|
|
|
const result = await managerPlanningApi.createAppointment(payload)
|
|
|
|
|
|
removeDraftForm(session.userInfo)
|
2026-07-01 12:49:18 +08:00
|
|
|
|
removeFormModalDraft(session.userInfo, APPOINTMENT_MODAL_STATE_DRAFT_NAME)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
markPlanningRefresh()
|
|
|
|
|
|
toast.success('预约已创建')
|
|
|
|
|
|
await router.replace(`/appointments/${result.orderItemId}`)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const saveDraft = (): void => {
|
|
|
|
|
|
writeDraftForm(session.userInfo, { ...form })
|
|
|
|
|
|
draftSavedAtText.value = '草稿已保存到本机'
|
|
|
|
|
|
toast.success('草稿已保存')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const clearDraft = (): void => {
|
|
|
|
|
|
removeDraftForm(session.userInfo)
|
2026-07-01 12:49:18 +08:00
|
|
|
|
removeFormModalDraft(session.userInfo, APPOINTMENT_MODAL_STATE_DRAFT_NAME)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
draftSavedAtText.value = ''
|
|
|
|
|
|
toast.success('草稿已清空')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
await loadOptions()
|
|
|
|
|
|
await searchCustomers()
|
|
|
|
|
|
await refreshAvailableTimes()
|
|
|
|
|
|
})
|
2026-07-01 12:49:18 +08:00
|
|
|
|
|
|
|
|
|
|
watch(form, syncAppointmentDraft, { deep: true })
|
|
|
|
|
|
watch(productModalVisible, syncAppointmentModalState)
|
|
|
|
|
|
watch(timeSheetVisible, syncAppointmentModalState)
|
2026-06-29 20:58:39 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.draft-tip {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
|
padding: 10px 12px;
|
|
|
|
|
|
color: var(--accent);
|
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 15:48:39 +08:00
|
|
|
|
.customer-combobox {
|
|
|
|
|
|
position: relative;
|
2026-07-01 18:01:45 +08:00
|
|
|
|
z-index: 30;
|
2026-07-01 15:48:39 +08:00
|
|
|
|
overflow: visible;
|
2026-06-29 20:58:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 18:01:45 +08:00
|
|
|
|
.customer-combobox:focus-within {
|
|
|
|
|
|
z-index: 80;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 15:48:39 +08:00
|
|
|
|
.customer-control {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-control input {
|
|
|
|
|
|
padding-right: 42px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 18:01:45 +08:00
|
|
|
|
.customer-selected-row {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
min-height: 24px;
|
|
|
|
|
|
padding-right: 42px;
|
|
|
|
|
|
color: var(--ink);
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-selected-row span,
|
|
|
|
|
|
.customer-selected-row strong {
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-selected-row span {
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-selected-row strong {
|
|
|
|
|
|
flex: 0 0 auto;
|
|
|
|
|
|
max-width: 54%;
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 15:48:39 +08:00
|
|
|
|
.customer-clear {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
right: 8px;
|
|
|
|
|
|
width: 28px;
|
|
|
|
|
|
height: 28px;
|
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
background: var(--subtle);
|
|
|
|
|
|
color: var(--muted);
|
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
line-height: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-dropdown {
|
|
|
|
|
|
position: absolute;
|
2026-07-01 18:01:45 +08:00
|
|
|
|
z-index: 90;
|
2026-07-01 15:48:39 +08:00
|
|
|
|
top: calc(100% + 8px);
|
|
|
|
|
|
right: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
max-height: min(420px, 70vh);
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
padding: 10px;
|
|
|
|
|
|
border: 1px solid var(--border);
|
|
|
|
|
|
border-radius: 12px;
|
2026-07-01 18:01:45 +08:00
|
|
|
|
background: var(--card-bg);
|
2026-07-01 15:48:39 +08:00
|
|
|
|
box-shadow: 0 16px 36px rgba(19, 32, 24, 0.16);
|
2026-07-01 18:01:45 +08:00
|
|
|
|
isolation: isolate;
|
2026-07-01 15:48:39 +08:00
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-option {
|
2026-06-29 20:58:39 +08:00
|
|
|
|
display: flex;
|
2026-07-01 15:48:39 +08:00
|
|
|
|
align-items: center;
|
2026-06-29 20:58:39 +08:00
|
|
|
|
justify-content: space-between;
|
2026-07-01 15:48:39 +08:00
|
|
|
|
gap: 10px;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 9px 10px;
|
2026-06-29 20:58:39 +08:00
|
|
|
|
border-radius: 10px;
|
|
|
|
|
|
background: var(--subtle);
|
2026-07-01 15:48:39 +08:00
|
|
|
|
text-align: left;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-option strong,
|
2026-07-01 18:01:45 +08:00
|
|
|
|
.customer-option span {
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
2026-07-01 15:48:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 18:01:45 +08:00
|
|
|
|
.customer-option strong {
|
|
|
|
|
|
min-width: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-option span,
|
2026-07-01 15:48:39 +08:00
|
|
|
|
.customer-muted {
|
|
|
|
|
|
color: var(--muted);
|
|
|
|
|
|
font-size: 12px;
|
2026-07-01 18:01:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-option span {
|
|
|
|
|
|
flex: 0 0 auto;
|
|
|
|
|
|
max-width: 52%;
|
|
|
|
|
|
text-align: right;
|
2026-07-01 15:48:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.customer-new {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
padding-top: 8px;
|
|
|
|
|
|
border-top: 1px solid var(--border);
|
2026-06-29 20:58:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.picker-value {
|
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
|
color: var(--ink);
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.conflict-tip {
|
|
|
|
|
|
margin-top: 12px;
|
|
|
|
|
|
padding: 10px 12px;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
background: var(--accent-soft);
|
|
|
|
|
|
color: var(--accent);
|
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.conflict-tip--danger {
|
|
|
|
|
|
background: #fff0ee;
|
|
|
|
|
|
color: var(--danger);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-modal,
|
|
|
|
|
|
.time-sheet {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
padding: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-card {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: 72px 1fr;
|
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 10px;
|
|
|
|
|
|
border-radius: 14px;
|
|
|
|
|
|
background: var(--subtle);
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-card img {
|
|
|
|
|
|
width: 72px;
|
|
|
|
|
|
height: 72px;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-card strong,
|
|
|
|
|
|
.product-card span,
|
|
|
|
|
|
.product-card small {
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.product-card span,
|
|
|
|
|
|
.product-card small {
|
|
|
|
|
|
margin-top: 3px;
|
|
|
|
|
|
color: var(--muted);
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 15:48:39 +08:00
|
|
|
|
.tag-row {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
gap: 5px;
|
|
|
|
|
|
margin-top: 6px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.tag-row i {
|
|
|
|
|
|
padding: 2px 6px;
|
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
|
background: var(--accent-soft);
|
|
|
|
|
|
color: var(--accent);
|
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
|
font-style: normal;
|
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-29 20:58:39 +08:00
|
|
|
|
.manual-form {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-01 15:48:39 +08:00
|
|
|
|
.manual-image-row {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: 72px 1fr auto;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.manual-image-row img,
|
|
|
|
|
|
.manual-image-placeholder {
|
|
|
|
|
|
width: 72px;
|
|
|
|
|
|
height: 72px;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.manual-image-placeholder {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
place-items: center;
|
|
|
|
|
|
background: var(--subtle);
|
|
|
|
|
|
color: var(--muted);
|
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.image-upload {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
min-height: 40px;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.image-upload input {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
inset: 0;
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-29 20:58:39 +08:00
|
|
|
|
.textarea {
|
|
|
|
|
|
min-height: 88px;
|
|
|
|
|
|
padding: 12px;
|
|
|
|
|
|
resize: vertical;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.time-sheet h3 {
|
|
|
|
|
|
margin: 0 0 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.time-grid {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: repeat(3, 1fr);
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.time-grid button {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
gap: 2px;
|
|
|
|
|
|
padding: 10px 4px;
|
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
background: var(--accent-soft);
|
|
|
|
|
|
color: var(--accent);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.time-grid span {
|
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|