Merge remote-tracking branch 'origin/0.8.X' into 0.8.X

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

View File

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

View File

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

View File

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