fix introducer save fail

This commit is contained in:
Timi
2026-09-17 01:24:28 +08:00
parent 47723c6403
commit b6676877c3
+24 -10
View File
@@ -98,7 +98,6 @@
<t-input v-model.trim="formData.telephone" type="tel" placeholder="手机号" borderless :disabled="isCustomerBound" /> <t-input v-model.trim="formData.telephone" type="tel" placeholder="手机号" borderless :disabled="isCustomerBound" />
</t-form-item> </t-form-item>
<t-form-item label="介绍人"> <t-form-item label="介绍人">
<div class="referrer">
<div class="selector"> <div class="selector">
<t-input <t-input
:value="formData.introducerCustomer?.name" :value="formData.introducerCustomer?.name"
@@ -108,6 +107,14 @@
:disabled="isCustomerBound" :disabled="isCustomerBound"
/> />
<div class="actions"> <div class="actions">
<t-button
v-if="introducerCustomerId"
variant="text"
theme="danger"
size="extra-small"
:disabled="isCustomerBound"
@click="clearIntroducer"
>清除</t-button>
<t-button <t-button
theme="primary" theme="primary"
variant="outline" variant="outline"
@@ -117,12 +124,12 @@
>选择客户</t-button> >选择客户</t-button>
</div> </div>
</div> </div>
</t-form-item>
<t-form-item v-if="formData.introducerCustomer" label-width="0">
<customer-profile-card <customer-profile-card
v-if="formData.introducerCustomer" class="introducer-profile"
class="profile"
:customer="formData.introducerCustomer" :customer="formData.introducerCustomer"
/> />
</div>
</t-form-item> </t-form-item>
<t-form-item label="调理部位" :arrow="!isCustomerBound" @click="openBodyAreaPicker"> <t-form-item label="调理部位" :arrow="!isCustomerBound" @click="openBodyAreaPicker">
<div class="picker-text" v-text="selectedAreaText" /> <div class="picker-text" v-text="selectedAreaText" />
@@ -332,6 +339,15 @@ async function handleIntroducerChange(id: string): Promise<void> {
formData.introducerCustomer = customer; formData.introducerCustomer = customer;
} }
function clearIntroducer(): void {
if (isCustomerBound.value) {
return;
}
introducerCustomerId.value = "";
formData.introducerCustomerId = "";
formData.introducerCustomer = undefined;
}
// ---------- 表单 ---------- // ---------- 表单 ----------
const formData = reactive<Customer>({ const formData = reactive<Customer>({
@@ -743,15 +759,9 @@ function buildAttachmentList(): Attachment[] {
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.referrer {
gap: .75rem;
display: flex;
flex-direction: column;
.selector { .selector {
gap: .75rem; gap: .75rem;
display: flex; display: flex;
}
.actions { .actions {
gap: .5rem; gap: .5rem;
@@ -760,6 +770,10 @@ function buildAttachmentList(): Attachment[] {
} }
} }
.introducer-profile {
flex: 1;
}
.sex { .sex {
gap: .5rem; gap: .5rem;
display: flex; display: flex;