财务状态bug修复

This commit is contained in:
jhd
2026-05-25 14:13:54 +08:00
parent cd099f2e6b
commit 85bb87e9fb
3 changed files with 66 additions and 33 deletions

View File

@@ -180,15 +180,16 @@ export default {
},
immediate: true,
},
currentCustomerId: {
handler(newVal) {
if (newVal) {
this.queryParams.customerId = newVal;
this.getList();
}
},
immediate: true,
}
// 移除 customerId 查询条件,只根据 orderId 查询收款明细
// currentCustomerId: {
// handler(newVal) {
// if (newVal) {
// this.queryParams.customerId = newVal;
// this.getList();
// }
// },
// immediate: true,
// }
},
data() {
return {

View File

@@ -6,8 +6,8 @@
<CustomerSelect v-model="queryParams.customerId" bindField="customerId" @change="handleCustomerChange"
:style="{ width: '240px' }" />
</el-form-item>
<el-form-item label="合同编号" prop="contractCode">
<el-select v-model="queryParams.contractCode" placeholder="请选择合同编号" filterable clearable style="width: 240px;">
<el-form-item label="合同编号" prop="orderId">
<el-select v-model="queryParams.orderId" placeholder="请选择合同编号" filterable clearable style="width: 240px;">
<el-option v-for="item in contractOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
@@ -70,8 +70,8 @@
<CustomerSelect v-model="form.customerId" bindField="customerId" @change="handleFormCustomerChange"
:style="{ width: '100%' }" />
</el-form-item>
<el-form-item label="合同编号" prop="contractCode">
<el-select v-model="form.contractCode" placeholder="请选择合同编号" filterable clearable style="width: 100%;">
<el-form-item label="合同编号" prop="orderId">
<el-select v-model="form.orderId" placeholder="请选择合同编号" filterable clearable style="width: 100%;">
<el-option v-for="item in formContractOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
@@ -151,7 +151,7 @@ export default {
},
created() {
this.getList();
this.loadContracts(); // 加载所有合同编号,支持独立查询
this.loadContracts(); // 加载所有合同编号,作为独立筛选条件
},
methods: {
getList() {
@@ -173,30 +173,30 @@ export default {
this.reset();
},
handleCustomerChange(customer) {
// 根据客户ID获取合同列表可选
// 客户和合同编号是独立的筛选条件,互不关联
if (customer && customer.customerId) {
this.loadContracts(customer.customerId);
this.queryParams.customerId = customer.customerId;
} else {
// 不传客户ID加载所有合同
this.loadContracts();
this.queryParams.customerId = undefined;
}
},
loadContracts(customerId) {
listOrder({ customerId: customerId || undefined, pageNum: 1, pageSize: 100 }).then(res => {
loadContracts() {
// 加载所有合同编号不根据客户ID过滤
listOrder({ pageNum: 1, pageSize: 100 }).then(res => {
this.contractOptions = (res.rows || []).map(item => ({
value: item.contractCode,
value: item.orderId,
label: item.contractCode
}));
});
},
handleFormCustomerChange(customer) {
// 清空合同选择
this.form.contractCode = undefined;
this.form.orderId = undefined;
// 根据客户ID获取合同列表
if (customer && customer.customerId) {
listOrder({ customerId: customer.customerId, pageNum: 1, pageSize: 100 }).then(res => {
this.formContractOptions = (res.rows || []).map(item => ({
value: item.contractCode,
value: item.orderId,
label: item.contractCode
}));
});

View File

@@ -86,7 +86,7 @@
<KLPTable v-loading="loading" :data="financeList" @selection-change="handleFinanceSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="客户" align="center" prop="customerName" />
<el-table-column label="合同编号" align="center" prop="contractCode" />
<el-table-column label="合同编号" align="center" prop="orderCode" />
<el-table-column label="收款日期" align="center" prop="dueDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.dueDate, '{y}-{m}-{d}') }}</span>
@@ -186,8 +186,11 @@
<el-form-item label="客户" prop="customerName">
<el-input v-model="financeForm.customerName" disabled />
</el-form-item>
<el-form-item label="合同编号" prop="contractCode">
<el-input v-model="financeForm.contractCode" placeholder="请输入合同编号" />
<el-form-item label="合同编号" prop="orderId">
<el-select v-model="financeForm.orderId" placeholder="请选择合同" clearable>
<el-option v-for="item in orderList" :key="item.orderId" :value="item.orderId"
:label="item.contractCode" />
</el-select>
</el-form-item>
<el-form-item label="收款日期" prop="dueDate">
<el-date-picker clearable v-model="financeForm.dueDate" type="datetime"
@@ -220,8 +223,9 @@ import ChinaAreaSelect from '@/components/ChinaAreaSelect/index.vue'
import CoilTable from '../components/CoilTable.vue'
import DeliveryTable from '../components/DeliveryTable.vue'
import { listCustomer, addCustomer, updateCustomer, delCustomer, listCoilByCustomerId, listFinanceByCustomerId } from '@/api/crm/customer'
import { getReceivable, delReceivable, addReceivable, updateReceivable } from '@/api/finance/receivable'
import { listCustomer, addCustomer, updateCustomer, delCustomer, listCoilByCustomerId } from '@/api/crm/customer'
import { listReceivable, getReceivable, delReceivable, addReceivable, updateReceivable } from '@/api/finance/receivable'
import { listOrder } from '@/api/crm/order'
export default {
name: 'CustomerPage',
@@ -243,6 +247,7 @@ export default {
wmsDeliveryWaybills: [],
objectionList: [],
coilList: [],
orderList: [], // 客户订单列表
showQuery: false,
queryParams: {
industry: '',
@@ -297,15 +302,31 @@ export default {
// 获取客户财务状态
getFinanceList() {
if (!this.currentCustomerId) return;
listFinanceByCustomerId(this.currentCustomerId).then(response => {
this.financeList = response.data.financeList || [];
this.objectionList = response.data.oobjectionList || [];
this.wmsDeliveryWaybills = response.data.wmsDeliveryWaybills || [];
listReceivable({
pageNum: 1,
pageSize: 100,
customerId: this.currentCustomerId
}).then(response => {
this.financeList = response.rows || [];
}).catch(() => {
this.$message.error('获取客户财务状态失败');
});
},
// 获取客户订单列表
getOrderList() {
if (!this.currentCustomerId) return;
listOrder({
pageNum: 1,
pageSize: 100,
customerId: this.currentCustomerId
}).then(response => {
this.orderList = response.rows || [];
}).catch(() => {
this.$message.error('获取客户订单列表失败');
});
},
/** 查询合同配卷列表 */
getCoilList() {
listCoilByCustomerId(this.currentCustomerId).then(response => {
@@ -371,6 +392,7 @@ export default {
this.currentCustomer = { ...item };
this.getFinanceList();
this.getCoilList();
this.getOrderList();
this.activeTab = 'detail';
},
@@ -449,7 +471,8 @@ export default {
handleFinanceAdd() {
this.financeForm = {
customerId: this.currentCustomerId,
customerName: this.currentCustomer.companyName
customerName: this.currentCustomer.companyName,
orderId: undefined
};
this.financeTitle = "添加收款记录";
this.financeOpen = true;
@@ -458,10 +481,19 @@ export default {
const receivableId = row.receivableId || this.financeIds;
getReceivable(receivableId).then(response => {
this.financeForm = response.data;
// 将 contractCode 转换为 orderId 用于显示
this.financeForm.orderId = response.data.orderId;
this.financeTitle = "修改收款记录";
this.financeOpen = true;
});
},
// 根据 orderId 获取合同编号
getContractCode(orderId) {
if (!orderId) return '-';
const order = this.orderList.find(item => item.orderId === orderId);
return order ? order.contractCode : orderId;
},
handleFinanceDelete(row) {
const receivableIds = row.receivableId || this.financeIds;
this.$modal.confirm('是否确认删除收款记录?').then(() => {