Parcourir la source

fix: 修复前端phone与后端telephone字段名不匹配导致电话无法保存

- invoice-title.vue: editForm.phone → editForm.telephone
- invoice-form.vue: form.phone → form.telephone
- editTitle()兼容读取item.phone或item.telephone

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
skyline il y a 1 semaine
Parent
commit
8bb15837f9

+ 5 - 5
charge-front/src/pages-common/invoice/invoice-form.vue

@@ -82,7 +82,7 @@
         </view>
         <view class="form-item">
           <view class="fs-28 color-333 mb-12">公司电话</view>
-          <input class="input br-8 fs-28 p-20" v-model="form.phone" placeholder="请输入公司电话" />
+          <input class="input br-8 fs-28 p-20" v-model="form.telephone" placeholder="请输入公司电话" />
         </view>
         <view class="form-item">
           <view class="fs-28 color-333 mb-12">开户银行</view>
@@ -137,7 +137,7 @@ const form = reactive({
   invoiceTitle: "",
   taxId: "",
   address: "",
-  phone: "",
+  telephone: "",
   bankName: "",
   bankAccount: "",
   email: "",
@@ -166,7 +166,7 @@ const importWechatTitle = () => {
       form.invoiceTitle = res.title || '';
       form.taxId = res.taxNumber || '';
       form.address = res.companyAddress || '';
-      form.phone = res.telephone || '';
+      form.telephone = res.telephone || '';
       form.bankName = res.bankName || '';
       form.bankAccount = res.bankAccount || '';
     },
@@ -185,7 +185,7 @@ const selectTitle = (item: any) => {
   form.invoiceTitle = item.invoiceTitle || "";
   form.taxId = item.taxId || "";
   form.address = item.address || "";
-  form.phone = item.phone || item.telephone || "";
+  form.telephone = item.phone || item.telephone || "";
   form.bankName = item.bankName || "";
   form.bankAccount = item.bankAccount || "";
   form.email = item.email || "";
@@ -224,7 +224,7 @@ const submit = () => {
   if (form.invoiceType === "ORGANIZATION") {
     params.taxId = form.taxId.trim();
     params.address = form.address.trim();
-    params.phone = form.phone.trim();
+    params.phone = form.telephone.trim();
     params.bankName = form.bankName.trim();
     params.bankAccount = form.bankAccount.trim();
   }

+ 6 - 6
charge-front/src/pages-user/invoice-title.vue

@@ -102,7 +102,7 @@
               <view class="form-row"><input class="form-input" v-model="editForm.taxId" placeholder="请输入纳税人识别号" placeholder-class="input-placeholder" /></view>
             </view>
             <view class="form-group"><view class="form-label">公司地址</view><view class="form-row"><input class="form-input" v-model="editForm.address" placeholder="请输入注册地址" placeholder-class="input-placeholder" /></view></view>
-            <view class="form-group"><view class="form-label">公司电话</view><view class="form-row"><input class="form-input" v-model="editForm.phone" type="number" placeholder="请输入公司电话" placeholder-class="input-placeholder" /></view></view>
+            <view class="form-group"><view class="form-label">公司电话</view><view class="form-row"><input class="form-input" v-model="editForm.telephone" type="number" placeholder="请输入公司电话" placeholder-class="input-placeholder" /></view></view>
             <view class="form-group"><view class="form-label">开户银行</view><view class="form-row"><input class="form-input" v-model="editForm.bankName" placeholder="请输入开户行名称" placeholder-class="input-placeholder" /></view></view>
             <view class="form-group"><view class="form-label">银行账号</view><view class="form-row"><input class="form-input" v-model="editForm.bankAccount" type="number" placeholder="请输入银行账号" placeholder-class="input-placeholder" /></view></view>
           </template>
@@ -138,7 +138,7 @@ interface InvoiceTitleItem {
 
 interface EditForm {
   invoiceType: string; invoiceTitle: string; taxId: string; address: string;
-  phone: string; bankName: string; bankAccount: string; email: string; isDefault: boolean;
+  telephone: string; bankName: string; bankAccount: string; email: string; isDefault: boolean;
 }
 
 // --- swipe ---
@@ -192,7 +192,7 @@ const maxModalHeight = ref(600);
 
 const editForm = reactive<EditForm>({
   invoiceType: "ORGANIZATION", invoiceTitle: "", taxId: "", address: "",
-  phone: "", bankName: "", bankAccount: "", email: "", isDefault: false,
+  telephone: "", bankName: "", bankAccount: "", email: "", isDefault: false,
 });
 
 const loadList = () => { fetchTitleList().then((res: InvoiceTitleItem[]) => { titleList.value = res || []; if (titleList.value.length && !hintShown) playHint(); }).catch(() => {}); };
@@ -220,7 +220,7 @@ const importWechatTitle = () => {
       editForm.invoiceTitle = res.title || '';
       editForm.taxId = res.taxNumber || '';
       editForm.address = res.companyAddress || '';
-      editForm.phone = res.telephone || '';
+      editForm.telephone = res.telephone || '';
       editForm.bankName = res.bankName || '';
       editForm.bankAccount = res.bankAccount || '';
     },
@@ -239,14 +239,14 @@ const calcModalHeight = () => { maxModalHeight.value = (uni.getSystemInfoSync().
 
 const resetForm = () => {
   editId.value = 0; editForm.invoiceType = "ORGANIZATION"; editForm.invoiceTitle = "";
-  editForm.taxId = ""; editForm.address = ""; editForm.phone = ""; editForm.bankName = "";
+  editForm.taxId = ""; editForm.address = ""; editForm.telephone = ""; editForm.bankName = "";
   editForm.bankAccount = ""; editForm.email = ""; editForm.isDefault = false;
 };
 
 const editTitle = (item: InvoiceTitleItem) => {
   editId.value = item.id; editForm.invoiceType = item.invoiceType || "ORGANIZATION";
   editForm.invoiceTitle = item.invoiceTitle || ""; editForm.taxId = item.taxId || "";
-  editForm.address = item.address || ""; editForm.phone = item.phone || item.telephone || "";
+  editForm.address = item.address || ""; editForm.telephone = item.telephone || item.phone || "";
   editForm.bankName = item.bankName || ""; editForm.bankAccount = item.bankAccount || "";
   editForm.email = item.email || ""; editForm.isDefault = !!item.isDefault;
   showForm.value = true; calcModalHeight(); closeSwipe();