修复店务预约员工ID传参

This commit is contained in:
2026-07-01 23:27:24 +08:00
parent 2e41aaef70
commit b6386c97fb
3 changed files with 57 additions and 2 deletions
@@ -45,7 +45,7 @@
<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><select v-model="form.artistId" @change="refreshAvailableTimes"><option value="">请选择员工</option><option v-for="artist in artists" :key="String(resolveArtistUserId(artist))" :value="String(resolveArtistUserId(artist))">{{ 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>
@@ -146,6 +146,7 @@ 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 { findArtistByUserId, normalizeArtistSelectionId, resolveArtistUserId } from '@/utils/artist'
import { readDraftForm, removeDraftForm, writeDraftForm } from '@/utils/appointment-draft'
import { readFormModalDraft, removeFormModalDraft, writeFormModalDraft } from '@/utils/form-modal-draft'
import { markPlanningRefresh } from '@/utils/storage'
@@ -311,7 +312,7 @@ const resolveProductArtistText = (product: Product, artistOptions: Artist[]): st
return '全部美甲师'
}
const artistNames = artistIds
.map(id => artistOptions.find(artist => String(artist.id) === id))
.map(id => findArtistByUserId(artistOptions, id))
.filter((artist): artist is Artist => Boolean(artist))
.map(artist => artist.name || artist.nickname || '')
.filter(Boolean)
@@ -348,6 +349,7 @@ const loadOptions = async (): Promise<void> => {
managerEmployeesApi.list()
])
artists.value = employeeData
form.artistId = normalizeArtistSelectionId(form.artistId, artists.value)
const productList = Array.isArray(productData) ? productData : productData.list
products.value = productList.map(product => normalizeProduct(product, artists.value))
filteredProducts.value = products.value