修正预约客户下拉层展示

This commit is contained in:
2026-07-01 18:01:45 +08:00
parent c647172c80
commit f86fda8252
@@ -9,24 +9,26 @@
<div class="field field--stack customer-combobox">
<label class="required">客户</label>
<div class="customer-control">
<button v-if="selectedCustomerReady" class="customer-selected-row" type="button" @click="openCustomerDropdown">
<span>{{ form.customerName || '未填写姓名' }}</span>
<strong>{{ form.phone || '未填写手机号' }}</strong>
</button>
<input
v-else
v-model.trim="customerSearchText"
placeholder="搜索客户姓名或手机号"
@focus="openCustomerDropdown"
@input="onCustomerSearchInput"
@keydown.escape="customerDropdownOpen = false"
/>
<button v-if="customerSearchText" class="customer-clear" type="button" @click="clearCustomerSelection">×</button>
<button v-if="customerSearchText || selectedCustomerReady" class="customer-clear" type="button" @click="clearCustomerSelection">×</button>
</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)">
<span>
<strong>{{ customer.nickname || customer.account || customer.phone || customer.contactPhone }}</strong>
<small>{{ customer.phone || customer.contactPhone || '未填写手机号' }}</small>
</span>
<em>选择</em>
<strong>{{ customer.nickname || customer.account || customer.phone || customer.contactPhone }}</strong>
<span>{{ customer.phone || customer.contactPhone || '未填写手机号' }}</span>
</button>
<div v-if="customerOptions.length === 0" class="customer-muted">暂无匹配客户,可继续创建新客户</div>
</template>
@@ -208,6 +210,9 @@ const conflictTip = ref('')
const conflictLevel = ref<'free' | 'danger'>('free')
const loading = ref(false)
const manualImageUploading = ref(false)
const selectedCustomerReady = computed(() => {
return Boolean(form.customerName || form.phone)
})
const manualProductChanged = computed(() => {
return Boolean(
form.manualProductTitle
@@ -610,9 +615,14 @@ watch(timeSheetVisible, syncAppointmentModalState)
.customer-combobox {
position: relative;
z-index: 30;
overflow: visible;
}
.customer-combobox:focus-within {
z-index: 80;
}
.customer-control {
position: relative;
width: 100%;
@@ -622,6 +632,37 @@ watch(timeSheetVisible, syncAppointmentModalState)
padding-right: 42px;
}
.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;
}
.customer-clear {
position: absolute;
top: 50%;
@@ -638,7 +679,7 @@ watch(timeSheetVisible, syncAppointmentModalState)
.customer-dropdown {
position: absolute;
z-index: 20;
z-index: 90;
top: calc(100% + 8px);
right: 0;
left: 0;
@@ -649,8 +690,9 @@ watch(timeSheetVisible, syncAppointmentModalState)
padding: 10px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface);
background: var(--card-bg);
box-shadow: 0 16px 36px rgba(19, 32, 24, 0.16);
isolation: isolate;
-webkit-overflow-scrolling: touch;
}
@@ -666,18 +708,27 @@ watch(timeSheetVisible, syncAppointmentModalState)
text-align: left;
}
.customer-option span,
.customer-option strong,
.customer-option small {
display: block;
.customer-option span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.customer-option small,
.customer-option em,
.customer-option strong {
min-width: 0;
}
.customer-option span,
.customer-muted {
color: var(--muted);
font-size: 12px;
font-style: normal;
}
.customer-option span {
flex: 0 0 auto;
max-width: 52%;
text-align: right;
}
.customer-new {