修正预约客户下拉层展示

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