hurx 1 tháng trước cách đây
mục cha
commit
9d3729652c

+ 17 - 1
src/views/customer/customerFile/customerInfo/add.vue

@@ -856,6 +856,13 @@ const handleEditContact = (row: CustomerContactForm, index: number) => {
 
 // 确认添加/编辑联系人
 const handleContactConfirm = (data: CustomerContactForm) => {
+  // 如果新增/编辑的是主联系人(isPrimary === '0'),将其他所有联系人设置为非主联系人
+  if (data.isPrimary === '0') {
+    contactList.value.forEach((item) => {
+      item.isPrimary = '1';
+    });
+  }
+
   if (currentContactIndex.value >= 0) {
     // 编辑
     contactList.value[currentContactIndex.value] = data;
@@ -881,7 +888,9 @@ const removeContact = (index: number) => {
 
 // 打开添加开票信息对话框
 const handleAddInvoice = () => {
-  currentInvoice.value = undefined;
+  currentInvoice.value = {};
+  currentInvoice.value.taxId = businessForm.socialCreditCode;
+  currentInvoice.value.address = businessForm.businessAddress;
   currentInvoiceIndex.value = -1;
   invoiceDialogVisible.value = true;
 };
@@ -895,6 +904,13 @@ const handleEditInvoice = (row: InvoiceInfoForm, index: number) => {
 
 // 确认添加/编辑开票信息
 const handleInvoiceConfirm = (data: InvoiceInfoForm) => {
+  // 如果新增/编辑的是主账号(isPrimaryAccount === '0'),将其他所有账号设置为非主账号
+  if (data.isPrimaryAccount === '0') {
+    invoiceList.value.forEach((item) => {
+      item.isPrimaryAccount = '1';
+    });
+  }
+
   if (currentInvoiceIndex.value >= 0) {
     // 编辑
     invoiceList.value[currentInvoiceIndex.value] = data;

+ 7 - 0
src/views/customer/customerFile/customerInfo/components/addContactDialog.vue

@@ -149,6 +149,12 @@ watch(
   (newVal) => {
     if (newVal) {
       Object.assign(form, newVal);
+      // 回显地址选择器
+      if (newVal.addressProvince && newVal.addressCity && newVal.addressCounty) {
+        codeArr.value = [newVal.addressProvince, newVal.addressCity, newVal.addressCounty] as any;
+      } else {
+        codeArr.value = [];
+      }
     }
   },
   { immediate: true, deep: true }
@@ -224,6 +230,7 @@ onMounted(() => {
 // 关闭
 const handleClose = () => {
   formRef.value?.resetFields();
+  codeArr.value = [];
   Object.assign(form, {
     contactName: '',
     phone: '',