fix: 选票客商下拉改取客商发票信息抬头/税号(票池税号是开票税号,非统一信用代码)
This commit is contained in:
@@ -193,6 +193,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import request from '@/axios';
|
||||||
import { getList as getCustomerList } from '@/api/vehicle/customer-archive';
|
import { getList as getCustomerList } from '@/api/vehicle/customer-archive';
|
||||||
import {
|
import {
|
||||||
downloadKingdeeInvoiceFile,
|
downloadKingdeeInvoiceFile,
|
||||||
@@ -326,7 +327,8 @@ export default {
|
|||||||
this.query = this.emptyQuery();
|
this.query = this.emptyQuery();
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
// 客商名称远程搜索:含 18 位社会信用代码特征(数字+大写字母)时按裸税号直查,否则搜客商档案带出税号
|
// 客商名称远程搜索:含 18 位社会信用代码特征(数字+大写字母)时按裸税号直查;
|
||||||
|
// 否则搜客商档案,取客商发票信息(blade_customer_invoice_info)的抬头/税号作选项——票池税号是开票税号,非统一信用代码
|
||||||
async searchCustomers(keyword, side) {
|
async searchCustomers(keyword, side) {
|
||||||
const text = String(keyword || '').trim();
|
const text = String(keyword || '').trim();
|
||||||
if (!text) return;
|
if (!text) return;
|
||||||
@@ -337,9 +339,23 @@ export default {
|
|||||||
this.customerLoading[side] = true;
|
this.customerLoading[side] = true;
|
||||||
try {
|
try {
|
||||||
const data = this.unwrap(await getCustomerList(1, 20, { fullName: text }));
|
const data = this.unwrap(await getCustomerList(1, 20, { fullName: text }));
|
||||||
this.customerOptions[side] = (data.records || [])
|
const customers = (data.records || []).filter(item => item.id);
|
||||||
.filter(item => item.unifiedCreditCode)
|
if (!customers.length) {
|
||||||
.map(item => ({ label: `${item.fullName}(${item.unifiedCreditCode})`, value: item.unifiedCreditCode }));
|
this.customerOptions[side] = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 列表接口不带发票信息,逐户取 detail(detail 组装 invoices,每户一张发票信息)
|
||||||
|
const options = await Promise.all(
|
||||||
|
customers.map(async customer => {
|
||||||
|
const detail = this.unwrap(await request({ url: '/blade-transport/customer-archive/detail', method: 'get', params: { id: customer.id } }));
|
||||||
|
return (detail?.invoices || [])
|
||||||
|
.filter(invoice => invoice.taxNo)
|
||||||
|
.map(invoice => ({ label: `${invoice.invoiceTitle || customer.fullName}(${invoice.taxNo})`, value: invoice.taxNo }));
|
||||||
|
})
|
||||||
|
);
|
||||||
|
this.customerOptions[side] = options.flat().filter(
|
||||||
|
(option, index, list) => list.findIndex(item => item.value === option.value) === index
|
||||||
|
);
|
||||||
} finally {
|
} finally {
|
||||||
this.customerLoading[side] = false;
|
this.customerLoading[side] = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user