调整 合同、运力、基础配置、客商
This commit is contained in:
@@ -246,6 +246,18 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="是否广西百强" prop="guangxiTop100">
|
||||
<el-select v-model="archiveForm.guangxiTop100" placeholder="请选择" clearable>
|
||||
<el-option
|
||||
v-for="item in guangxiTop100Options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="统一社会信用代码" prop="unifiedCreditCode">
|
||||
<el-input
|
||||
@@ -379,6 +391,22 @@
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="网络货运平台" prop="networkFreightPlatform">
|
||||
<el-select
|
||||
v-model="archiveForm.networkFreightPlatform"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in networkFreightPlatformOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</section-card>
|
||||
|
||||
@@ -626,18 +654,20 @@
|
||||
</div>
|
||||
<el-table :data="invoiceTableData" border class="invoice-table">
|
||||
<el-table-column label="序号" prop="__index" width="90" align="center" />
|
||||
<el-table-column label="收票方名称" prop="invoiceTitle" min-width="180" />
|
||||
<el-table-column label="发票类型" prop="invoiceType" min-width="150" />
|
||||
<el-table-column label="企业全称" prop="invoiceTitle" min-width="180" />
|
||||
<el-table-column label="纳税人识别号" prop="taxNo" min-width="180" />
|
||||
<el-table-column label="开户行名称" prop="bankName" min-width="180" />
|
||||
<el-table-column label="注册电话" prop="registeredPhone" min-width="150" />
|
||||
<el-table-column label="银行账号" prop="bankAccount" min-width="180" />
|
||||
<el-table-column label="注册地址" min-width="220">
|
||||
<template #default="{ row }">
|
||||
<span>{{ formatInvoiceRegisteredAddress(row) || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="邮箱" prop="email" min-width="180" />
|
||||
<el-table-column label="邮箱" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<span>{{ formatInvoiceEmails(row) || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
width="130"
|
||||
@@ -1067,10 +1097,11 @@
|
||||
<el-row :gutter="34">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="纳税人识别号" prop="taxNo">
|
||||
<el-input v-model="invoiceForm.taxNo" maxlength="30" />
|
||||
</el-form-item>
|
||||
<el-form-item label="注册电话" prop="registeredPhone">
|
||||
<el-input v-model="invoiceForm.registeredPhone" maxlength="20" />
|
||||
<el-input
|
||||
v-model="invoiceForm.taxNo"
|
||||
maxlength="30"
|
||||
placeholder="默认客商统一社会信用代码,可编辑"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="注册地址" prop="registeredRegionName">
|
||||
<el-cascader
|
||||
@@ -1078,12 +1109,24 @@
|
||||
v-model="invoiceForm.registeredRegionPath"
|
||||
:options="regionOptions"
|
||||
:props="regionCascaderProps"
|
||||
:placeholder="invoiceForm.registeredRegionName || '请选择省市区'"
|
||||
:placeholder="invoiceForm.registeredRegionName || '默认客商地址 可编辑'"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleInvoiceRegisteredRegionChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="开户行名称" prop="bankName">
|
||||
<el-input v-model="invoiceForm.bankName" maxlength="100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="企业全称" prop="invoiceTitle">
|
||||
<el-input
|
||||
v-model="invoiceForm.invoiceTitle"
|
||||
maxlength="100"
|
||||
placeholder="默认客商名称 可编辑"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="详细地址" prop="registeredDetailAddress">
|
||||
<el-tooltip
|
||||
:content="invoiceForm.registeredDetailAddress"
|
||||
@@ -1095,25 +1138,11 @@
|
||||
ref="invoiceDetailInput"
|
||||
v-model="invoiceForm.registeredDetailAddress"
|
||||
maxlength="255"
|
||||
placeholder="请输入详细地址"
|
||||
placeholder="默认客商地址 可编辑"
|
||||
@input="checkOverflow('invoiceDetailInput', 'invoiceDetailOverflow')"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="收票方名称" prop="invoiceTitle">
|
||||
<el-input v-model="invoiceForm.invoiceTitle" maxlength="100" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发票类型" prop="invoiceType">
|
||||
<el-select v-model="invoiceForm.invoiceType" clearable placeholder="请选择">
|
||||
<el-option label="增值税专用发票" value="增值税专用发票" />
|
||||
<el-option label="普通发票" value="普通发票" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开户行名称" prop="bankName">
|
||||
<el-input v-model="invoiceForm.bankName" maxlength="100" />
|
||||
</el-form-item>
|
||||
<el-form-item label="银行账号" prop="bankAccount">
|
||||
<el-input v-model="invoiceForm.bankAccount" maxlength="50" />
|
||||
</el-form-item>
|
||||
@@ -1121,38 +1150,67 @@
|
||||
</el-row>
|
||||
</section-card>
|
||||
|
||||
<section-card title="邮寄信息">
|
||||
<el-row :gutter="34">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="收件人姓名" prop="receiverName">
|
||||
<el-input v-model="invoiceForm.receiverName" maxlength="30" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收件人地址" prop="receiverAddress">
|
||||
<el-tooltip
|
||||
:content="invoiceForm.receiverAddress"
|
||||
placement="top"
|
||||
:disabled="!invoiceReceiverOverflow"
|
||||
style="display: block; width: 100%"
|
||||
<section-card>
|
||||
<template #title>联系信息</template>
|
||||
<template #extra>
|
||||
<el-button v-if="!readonly" type="primary" @click="addInvoiceContact">添加</el-button>
|
||||
</template>
|
||||
<el-table :data="invoiceForm.contacts || []" border class="invoice-contact-table">
|
||||
<el-table-column type="index" label="序号" width="70" align="center" />
|
||||
<el-table-column label="联系人" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.contactName" maxlength="30" :disabled="readonly" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="联系电话" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.contactPhone" maxlength="20" :disabled="readonly" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="邮箱地址" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.email" maxlength="100" :disabled="readonly" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所属部门" min-width="200">
|
||||
<template #default="{ row }">
|
||||
<el-input
|
||||
v-if="!isInternalCustomer"
|
||||
:model-value="row.deptNames"
|
||||
disabled
|
||||
/>
|
||||
<el-select
|
||||
v-else
|
||||
v-model="row.deptIdList"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
filterable
|
||||
clearable
|
||||
:disabled="readonly"
|
||||
placeholder="请选择所属部门"
|
||||
@change="() => handleInvoiceContactDeptChange(row)"
|
||||
>
|
||||
<el-input
|
||||
ref="invoiceReceiverInput"
|
||||
v-model="invoiceForm.receiverAddress"
|
||||
maxlength="255"
|
||||
placeholder="请输入收件人地址"
|
||||
@input="checkOverflow('invoiceReceiverInput', 'invoiceReceiverOverflow')"
|
||||
<el-option
|
||||
v-for="item in invoiceDeptOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="收件人电话" prop="receiverPhone">
|
||||
<el-input v-model="invoiceForm.receiverPhone" maxlength="20" />
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="invoiceForm.email" maxlength="100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" min-width="160">
|
||||
<template #default="{ row }">
|
||||
<el-input v-model="row.remark" maxlength="200" :disabled="readonly" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="!readonly" label="操作" width="80" align="center" fixed="right">
|
||||
<template #default="{ $index }">
|
||||
<el-link type="danger" @click="removeInvoiceContact($index)">删除</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</section-card>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -1653,7 +1711,6 @@ export default {
|
||||
invoiceForm: this.emptyInvoice(),
|
||||
registeredDetailOverflow: false,
|
||||
invoiceDetailOverflow: false,
|
||||
invoiceReceiverOverflow: false,
|
||||
qualificationFiles: [],
|
||||
qualificationUploadFiles: [],
|
||||
ocrQualificationUploadFiles: [],
|
||||
@@ -1684,6 +1741,14 @@ export default {
|
||||
external: '外部客商',
|
||||
internal: '内部组织',
|
||||
},
|
||||
networkFreightPlatformOptions: [
|
||||
{ label: '是', value: 1 },
|
||||
{ label: '否', value: 0 },
|
||||
],
|
||||
guangxiTop100Options: [
|
||||
{ label: '是', value: 1 },
|
||||
{ label: '否', value: 0 },
|
||||
],
|
||||
businessScopeOptions: [],
|
||||
qualificationTypeOptions: [],
|
||||
creditLevelOptions: ['A', 'B', 'C', 'D', 'E', 'F'].map(item => ({
|
||||
@@ -1761,9 +1826,7 @@ export default {
|
||||
},
|
||||
invoiceRules: {
|
||||
taxNo: [{ required: true, message: '请输入纳税人识别号', trigger: 'blur' }],
|
||||
invoiceTitle: [{ required: true, message: '请输入收票方名称', trigger: 'blur' }],
|
||||
invoiceType: [{ required: true, message: '请选择发票类型', trigger: 'change' }],
|
||||
registeredPhone: [{ required: true, message: '请输入注册电话', trigger: 'blur' }],
|
||||
invoiceTitle: [{ required: true, message: '请输入企业全称', trigger: 'blur' }],
|
||||
bankName: [{ required: true, message: '请输入开户行名称', trigger: 'blur' }],
|
||||
registeredRegionName: [{ required: true, message: '请选择注册地址', trigger: 'change' }],
|
||||
registeredDetailAddress: [
|
||||
@@ -1771,8 +1834,6 @@ export default {
|
||||
{ max: 255, message: '详细地址最多255个字符', trigger: 'blur' },
|
||||
],
|
||||
bankAccount: [{ required: true, message: '请输入银行账号', trigger: 'blur' }],
|
||||
receiverAddress: [{ max: 255, message: '收件人地址最多255个字符', trigger: 'blur' }],
|
||||
email: [{ type: 'email', message: '请输入正确的邮箱', trigger: 'blur' }],
|
||||
},
|
||||
option: {
|
||||
height: 'auto',
|
||||
@@ -1859,6 +1920,21 @@ export default {
|
||||
{ label: '个体工商户', value: '个体工商户' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '是否广西百强',
|
||||
prop: 'guangxiTop100',
|
||||
type: 'select',
|
||||
minWidth: 130,
|
||||
dicData: [
|
||||
{ label: '是', value: 1 },
|
||||
{ label: '否', value: 0 },
|
||||
],
|
||||
formatter: row => {
|
||||
if (row.guangxiTop100 === 1) return '是';
|
||||
if (row.guangxiTop100 === 0) return '否';
|
||||
return '';
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '统一信用代码',
|
||||
prop: 'unifiedCreditCode',
|
||||
@@ -2046,6 +2122,15 @@ export default {
|
||||
invoiceDialogTitle() {
|
||||
return this.invoiceIndex > -1 ? '编辑发票信息' : '新增发票信息';
|
||||
},
|
||||
isInternalCustomer() {
|
||||
return this.archiveForm.customerKind === 'internal';
|
||||
},
|
||||
invoiceDeptOptions() {
|
||||
return this.flattenDept(this.deptTree).map(item => ({
|
||||
label: item.rawLabel,
|
||||
value: String(item.value),
|
||||
}));
|
||||
},
|
||||
isTemporaryToFormal() {
|
||||
return (
|
||||
Boolean(this.archiveForm.id) &&
|
||||
@@ -2129,9 +2214,6 @@ export default {
|
||||
'invoiceForm.registeredDetailAddress'() {
|
||||
this.$nextTick(() => this.checkOverflow('invoiceDetailInput', 'invoiceDetailOverflow'));
|
||||
},
|
||||
'invoiceForm.receiverAddress'() {
|
||||
this.$nextTick(() => this.checkOverflow('invoiceReceiverInput', 'invoiceReceiverOverflow'));
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
hasPermission(code) {
|
||||
@@ -2155,6 +2237,8 @@ export default {
|
||||
customerType: [],
|
||||
businessScope: [],
|
||||
businessTermType: '固定期限',
|
||||
networkFreightPlatform: null,
|
||||
guangxiTop100: null,
|
||||
registeredRegionPath: [],
|
||||
registeredRegionName: '',
|
||||
registeredDetailAddress: '',
|
||||
@@ -2277,11 +2361,13 @@ export default {
|
||||
customerType: '客商分类',
|
||||
customerKind: '客商类型',
|
||||
customerNature: '客户性质',
|
||||
guangxiTop100: '是否广西百强',
|
||||
unifiedCreditCode: '统一信用代码',
|
||||
deptName: '所属组织',
|
||||
approvedTime: '审核通过时间',
|
||||
status: '状态',
|
||||
businessTermType: '营业期限类型',
|
||||
networkFreightPlatform: '网络货运平台',
|
||||
registeredRegionName: '注册地址',
|
||||
registeredDetailAddress: '详细地址',
|
||||
invoiceType: '发票类型',
|
||||
@@ -2481,6 +2567,7 @@ export default {
|
||||
状态: 'status',
|
||||
客户类型: 'customerType',
|
||||
客商材料: 'qualificationAttachments',
|
||||
是否广西百强: 'guangxiTop100',
|
||||
}[field] || field;
|
||||
if (['qualificationAttachments', 'customerAttachments'].includes(normalizedField)) {
|
||||
return this.formatAttachmentChangeValue(value);
|
||||
@@ -2498,6 +2585,8 @@ export default {
|
||||
},
|
||||
status: { 1: '启用', 2: '停用', 0: '停用' },
|
||||
customerKind: { external: '外部客商', internal: '内部组织' },
|
||||
networkFreightPlatform: { 1: '是', 0: '否' },
|
||||
guangxiTop100: { 1: '是', 0: '否' },
|
||||
};
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(item => this.formatChangeFieldValue(normalizedField, item)).join('、');
|
||||
@@ -2589,19 +2678,14 @@ export default {
|
||||
emptyInvoice() {
|
||||
return {
|
||||
invoiceTitle: '',
|
||||
invoiceType: '',
|
||||
taxNo: '',
|
||||
bankName: '',
|
||||
registeredPhone: '',
|
||||
bankAccount: '',
|
||||
registeredRegionPath: [],
|
||||
registeredRegionName: '',
|
||||
registeredDetailAddress: '',
|
||||
registeredAddress: '',
|
||||
email: '',
|
||||
receiverName: '',
|
||||
receiverPhone: '',
|
||||
receiverAddress: '',
|
||||
contacts: [],
|
||||
isDefault: 0,
|
||||
};
|
||||
},
|
||||
@@ -2977,14 +3061,12 @@ export default {
|
||||
.join('');
|
||||
return address || row.registeredAddress || '';
|
||||
},
|
||||
formatInvoiceReceiverAddress(row = {}) {
|
||||
const address = String(row.receiverAddress || '').trim();
|
||||
if (address) return address;
|
||||
// 历史数据中收件人地址拆分为行政区划 + 详细地址两个字段
|
||||
return [row.receiverRegionName, row.receiverDetailAddress]
|
||||
.map(item => String(item || '').trim())
|
||||
formatInvoiceEmails(row = {}) {
|
||||
const contacts = row.contacts || row.__raw?.contacts || [];
|
||||
return (contacts || [])
|
||||
.map(item => String(item.email || '').trim())
|
||||
.filter(Boolean)
|
||||
.join('');
|
||||
.join(';');
|
||||
},
|
||||
normalizeContact(contact = {}) {
|
||||
const contactAddress =
|
||||
@@ -3354,15 +3436,13 @@ export default {
|
||||
.catch(() => {});
|
||||
},
|
||||
normalizeInvoice(invoice = {}) {
|
||||
// receiverRegionName / receiverDetailAddress 为历史拆分字段,现已合并为单一的收件人地址
|
||||
const { receiverRegionName, receiverDetailAddress, ...rest } = invoice;
|
||||
const registeredDetailAddress =
|
||||
invoice.registeredDetailAddress ||
|
||||
(invoice.registeredRegionName ? '' : invoice.registeredAddress) ||
|
||||
'';
|
||||
return {
|
||||
...this.emptyInvoice(),
|
||||
...rest,
|
||||
...invoice,
|
||||
registeredRegionPath: Array.isArray(invoice.registeredRegionPath)
|
||||
? invoice.registeredRegionPath
|
||||
: [],
|
||||
@@ -3371,21 +3451,92 @@ export default {
|
||||
...invoice,
|
||||
registeredDetailAddress,
|
||||
}),
|
||||
receiverAddress: this.formatInvoiceReceiverAddress({
|
||||
receiverRegionName,
|
||||
receiverDetailAddress,
|
||||
receiverAddress: invoice.receiverAddress,
|
||||
}),
|
||||
contacts: (invoice.contacts || []).map(item => this.normalizeInvoiceContact(item)),
|
||||
};
|
||||
},
|
||||
normalizeInvoiceContact(contact = {}) {
|
||||
const deptIds = String(contact.deptIds || '')
|
||||
.split(/[,,、]/)
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean);
|
||||
const deptIdList = Array.isArray(contact.deptIdList)
|
||||
? contact.deptIdList.map(item => String(item)).filter(Boolean)
|
||||
: deptIds;
|
||||
const contactRow = {
|
||||
contactName: contact.contactName || '',
|
||||
contactPhone: contact.contactPhone || '',
|
||||
email: contact.email || '',
|
||||
deptIds: contact.deptIds || deptIdList.join(','),
|
||||
deptNames: contact.deptNames || '',
|
||||
deptIdList,
|
||||
remark: contact.remark || '',
|
||||
};
|
||||
if (!this.isInternalCustomer) {
|
||||
contactRow.deptIds = this.externalInvoiceDeptIds();
|
||||
contactRow.deptNames = this.externalInvoiceDeptName();
|
||||
contactRow.deptIdList = contactRow.deptIds
|
||||
? String(contactRow.deptIds)
|
||||
.split(/[,,]/)
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
} else if (!contactRow.deptNames && deptIdList.length) {
|
||||
contactRow.deptNames = deptIdList.map(id => this.findDeptLabel(id)).filter(Boolean).join('、');
|
||||
}
|
||||
return contactRow;
|
||||
},
|
||||
emptyInvoiceContact() {
|
||||
const contact = {
|
||||
contactName: '',
|
||||
contactPhone: '',
|
||||
email: '',
|
||||
deptIds: '',
|
||||
deptNames: '',
|
||||
deptIdList: [],
|
||||
remark: '',
|
||||
};
|
||||
if (!this.isInternalCustomer) {
|
||||
contact.deptIds = this.externalInvoiceDeptIds();
|
||||
contact.deptNames = this.externalInvoiceDeptName();
|
||||
contact.deptIdList = contact.deptIds
|
||||
? String(contact.deptIds)
|
||||
.split(/[,,]/)
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
}
|
||||
return contact;
|
||||
},
|
||||
externalInvoiceDeptName() {
|
||||
return this.archiveForm.fullName || this.archiveForm.deptName || '';
|
||||
},
|
||||
externalInvoiceDeptIds() {
|
||||
if (this.archiveForm.deptIds) return String(this.archiveForm.deptIds);
|
||||
if (Array.isArray(this.archiveForm.deptId)) return this.archiveForm.deptId.filter(Boolean).join(',');
|
||||
return this.archiveForm.deptId ? String(this.archiveForm.deptId) : '';
|
||||
},
|
||||
defaultInvoice() {
|
||||
const archive = this.archiveForm || {};
|
||||
return {
|
||||
...this.emptyInvoice(),
|
||||
invoiceTitle: archive.fullName || '',
|
||||
taxNo: archive.unifiedCreditCode || '',
|
||||
registeredRegionPath: Array.isArray(archive.registeredRegionPath)
|
||||
? [...archive.registeredRegionPath]
|
||||
: [],
|
||||
registeredRegionName: archive.registeredRegionName || '',
|
||||
registeredDetailAddress: archive.registeredDetailAddress || '',
|
||||
registeredAddress: this.formatArchiveAddress(archive),
|
||||
contacts: [],
|
||||
};
|
||||
},
|
||||
openInvoice(row, index = -1) {
|
||||
this.invoiceIndex = index;
|
||||
this.invoiceForm = row ? this.normalizeInvoice(row) : this.emptyInvoice();
|
||||
this.invoiceForm = row ? this.normalizeInvoice(row) : this.defaultInvoice();
|
||||
this.invoiceBox = true;
|
||||
this.$nextTick(() => {
|
||||
this.$nextTick(() => {
|
||||
this.checkOverflow('invoiceDetailInput', 'invoiceDetailOverflow');
|
||||
this.checkOverflow('invoiceReceiverInput', 'invoiceReceiverOverflow');
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -3394,10 +3545,75 @@ export default {
|
||||
this.invoiceForm = this.emptyInvoice();
|
||||
this.$refs.invoiceForm?.clearValidate();
|
||||
},
|
||||
addInvoiceContact() {
|
||||
if (!Array.isArray(this.invoiceForm.contacts)) {
|
||||
this.invoiceForm.contacts = [];
|
||||
}
|
||||
this.invoiceForm.contacts.push(this.emptyInvoiceContact());
|
||||
},
|
||||
removeInvoiceContact(index) {
|
||||
this.invoiceForm.contacts.splice(index, 1);
|
||||
},
|
||||
handleInvoiceContactDeptChange(row) {
|
||||
const ids = Array.isArray(row.deptIdList) ? row.deptIdList.map(item => String(item)) : [];
|
||||
row.deptIds = ids.join(',');
|
||||
row.deptNames = ids.map(id => this.findDeptLabel(id)).filter(Boolean).join('、');
|
||||
},
|
||||
isBlankInvoiceContact(contact = {}) {
|
||||
return ![
|
||||
contact.contactName,
|
||||
contact.contactPhone,
|
||||
contact.email,
|
||||
contact.deptIds,
|
||||
contact.deptNames,
|
||||
...(Array.isArray(contact.deptIdList) ? contact.deptIdList : []),
|
||||
contact.remark,
|
||||
].some(item => String(item || '').trim());
|
||||
},
|
||||
validateInvoiceContacts(contacts = []) {
|
||||
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
for (let index = 0; index < contacts.length; index += 1) {
|
||||
const contact = contacts[index];
|
||||
if (this.isBlankInvoiceContact(contact)) continue;
|
||||
if (!String(contact.contactName || '').trim()) {
|
||||
this.$message.warning(`请填写第${index + 1}行联系人`);
|
||||
return false;
|
||||
}
|
||||
if (!String(contact.contactPhone || '').trim()) {
|
||||
this.$message.warning(`请填写第${index + 1}行联系电话`);
|
||||
return false;
|
||||
}
|
||||
const email = String(contact.email || '').trim();
|
||||
if (email && !emailPattern.test(email)) {
|
||||
this.$message.warning(`第${index + 1}行邮箱格式不正确`);
|
||||
return false;
|
||||
}
|
||||
if (String(contact.remark || '').length > 200) {
|
||||
this.$message.warning(`第${index + 1}行备注最多200个字`);
|
||||
return false;
|
||||
}
|
||||
if (this.isInternalCustomer && !(contact.deptIdList || []).length) {
|
||||
this.$message.warning(`内部组织客商请选择第${index + 1}行所属部门`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
saveInvoice() {
|
||||
this.$refs.invoiceForm.validate(valid => {
|
||||
if (!valid) return;
|
||||
const invoice = this.normalizeInvoice(this.invoiceForm);
|
||||
if (!this.validateInvoiceContacts(invoice.contacts)) return;
|
||||
invoice.contacts = (invoice.contacts || [])
|
||||
.filter(item => !this.isBlankInvoiceContact(item))
|
||||
.map(item => {
|
||||
const contact = { ...item };
|
||||
if (this.isInternalCustomer) {
|
||||
this.handleInvoiceContactDeptChange(contact);
|
||||
}
|
||||
delete contact.deptIdList;
|
||||
return contact;
|
||||
});
|
||||
if (this.invoiceIndex > -1) {
|
||||
this.archiveForm.invoices.splice(this.invoiceIndex, 1, invoice);
|
||||
} else {
|
||||
@@ -3790,6 +4006,12 @@ export default {
|
||||
applyCreditLimit: this.normalizeOptionalAmount(detail.applyCreditLimit),
|
||||
businessScope,
|
||||
businessTermType: detail.businessTermType || '固定期限',
|
||||
networkFreightPlatform:
|
||||
detail.networkFreightPlatform === 0 || detail.networkFreightPlatform === 1
|
||||
? detail.networkFreightPlatform
|
||||
: null,
|
||||
guangxiTop100:
|
||||
detail.guangxiTop100 === 0 || detail.guangxiTop100 === 1 ? detail.guangxiTop100 : null,
|
||||
registeredRegionPath: Array.isArray(detail.registeredRegionPath)
|
||||
? detail.registeredRegionPath
|
||||
: [],
|
||||
@@ -3983,6 +4205,12 @@ export default {
|
||||
archive.businessScope = Array.isArray(archive.businessScope)
|
||||
? archive.businessScope.join(',')
|
||||
: archive.businessScope;
|
||||
archive.networkFreightPlatform =
|
||||
archive.networkFreightPlatform === 0 || archive.networkFreightPlatform === 1
|
||||
? archive.networkFreightPlatform
|
||||
: null;
|
||||
archive.guangxiTop100 =
|
||||
archive.guangxiTop100 === 0 || archive.guangxiTop100 === 1 ? archive.guangxiTop100 : null;
|
||||
const deptIds = Array.isArray(archive.deptId)
|
||||
? archive.deptId
|
||||
: archive.deptId
|
||||
@@ -4012,6 +4240,16 @@ export default {
|
||||
.map(item => {
|
||||
const invoice = this.normalizeInvoice(item);
|
||||
delete invoice.registeredRegionPath;
|
||||
invoice.contacts = (invoice.contacts || [])
|
||||
.filter(contact => !this.isBlankInvoiceContact(contact))
|
||||
.map(contact => {
|
||||
const row = { ...contact };
|
||||
if (this.isInternalCustomer) {
|
||||
this.handleInvoiceContactDeptChange(row);
|
||||
}
|
||||
delete row.deptIdList;
|
||||
return row;
|
||||
});
|
||||
return invoice;
|
||||
})
|
||||
.filter(item => item.invoiceTitle || item.taxNo || item.bankAccount);
|
||||
@@ -4053,6 +4291,8 @@ export default {
|
||||
return;
|
||||
}
|
||||
const archive = this.normalizeArchive();
|
||||
// 仅提交时落变更记录;保存不记录
|
||||
archive.recordChange = true;
|
||||
if (!this.validateFormalForApproval(archive)) return;
|
||||
submit(archive).then(res => {
|
||||
const data = res.data.data;
|
||||
@@ -5168,6 +5408,15 @@ export default {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.invoice-contact-table {
|
||||
width: 100%;
|
||||
|
||||
:deep(.el-input),
|
||||
:deep(.el-select) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.contact-form__address {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
|
||||
Reference in New Issue
Block a user