3 Commits

Author SHA1 Message Date
刘泉佳 f067518c0e fix: 付款申请批量同步金蝶失败时展示失败原因
- 批量同步后解析返回结果,按"同步失败"标识区分成功与失败条目
- 部分失败时以 warning 提示成功/失败条数及具体失败原因(停留8秒),全部成功仍提示已同步条数
2026-09-18 11:58:00 +08:00
刘泉佳 11460f3378 付款管理新增同步付款结果按钮并扩展金蝶单据状态选项 2026-09-18 11:57:59 +08:00
刘泉佳 7f543937fb 结算单新增时自动查询BFI汇率
- currency.js: 新增getBfiExchangeRate接口调用
- pre-settlement-editor.vue:
  - 选择合同后同步结算币种并自动查询当天BFI汇率
  - 汇率日期变更时自动查询BFI汇率并回填结算汇率
  - 新增时自动设置当天日期并查询汇率
- formal-settlement-editor.vue:
  - 选择合同后同步结算币种并自动查询当天BFI汇率
  - 汇率日期变更时自动查询BFI汇率并回填结算汇率
  - 新增时自动查询当天BFI汇率
2026-09-16 14:14:53 +08:00
5 changed files with 92 additions and 4 deletions
+11
View File
@@ -58,3 +58,14 @@ export const changeStatus = (id, status) => {
}, },
}); });
}; };
export const getBfiExchangeRate = (currencyCode, effectdate) => {
return request({
url: '/blade-transport/bfi/exchange-rate',
method: 'get',
params: {
currencyCode,
effectdate,
},
});
};
+5
View File
@@ -20,6 +20,8 @@ export const syncKingdee = id =>
request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id } }); request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id } });
export const syncKingdeeBatch = ids => export const syncKingdeeBatch = ids =>
request({ url: `${baseUrl}/sync-kingdee-batch`, method: 'post', data: ids }); request({ url: `${baseUrl}/sync-kingdee-batch`, method: 'post', data: ids });
export const syncKingdeeResult = () =>
request({ url: `${baseUrl}/sync-kingdee-result`, method: 'post' });
export const paymentTypeOptions = [ export const paymentTypeOptions = [
{ label: '项目预付', value: 'project_advance' }, { label: '项目预付', value: 'project_advance' },
@@ -36,5 +38,8 @@ export const approvalStatusOptions = [
export const kingdeeStatusOptions = [ export const kingdeeStatusOptions = [
{ label: '未生成', value: 'unsynced' }, { label: '未生成', value: 'unsynced' },
{ label: '已生成', value: 'synced' }, { label: '已生成', value: 'synced' },
{ label: '付款中', value: 'paying' },
{ label: '已付款', value: 'paid' },
{ label: '已关闭', value: 'closed' },
{ label: '生成失败', value: 'failed' }, { label: '生成失败', value: 'failed' },
]; ];
+23 -2
View File
@@ -84,6 +84,13 @@
@click="handleSync" @click="handleSync"
>批量同步</el-button >批量同步</el-button
> >
<el-button
v-if="hasPermission('payment_application_sync')"
type="primary"
plain
@click="handleSyncResult"
>同步付款结果</el-button
>
<el-button <el-button
v-if="hasPermission('payment_application_add')" v-if="hasPermission('payment_application_add')"
type="primary" type="primary"
@@ -396,8 +403,22 @@ export default {
this.$message.warning('请选择至少一条审批通过的付款申请'); this.$message.warning('请选择至少一条审批通过的付款申请');
return; return;
} }
await api.syncKingdeeBatch(rows.map(row => row.id)); const data = this.unwrapData(await api.syncKingdeeBatch(rows.map(row => row.id))) || [];
this.$message.success(`已同步${rows.length}条付款申请`); const failedList = data.filter(item => String(item).includes('同步失败'));
if (failedList.length) {
this.$message({
type: 'warning',
message: `同步完成:成功${data.length - failedList.length}条,失败${failedList.length}条。${failedList.join('')}`,
duration: 8000,
});
} else {
this.$message.success(`已同步${data.length}条付款申请`);
}
this.loadTable();
},
async handleSyncResult() {
const data = this.unwrapData(await api.syncKingdeeResult());
this.$message.success(data || '金蝶付款结果回写完成');
this.loadTable(); this.loadTable();
}, },
handleExport() { handleExport() {
@@ -22,6 +22,7 @@
type="date" type="date"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择" placeholder="请选择"
@change="fetchBfiExchangeRate"
/> />
<el-select <el-select
v-else-if="field.type === 'project' && editable" v-else-if="field.type === 'project' && editable"
@@ -947,6 +948,7 @@ import {
getDetailFees as getPreSettlementDetailFees, getDetailFees as getPreSettlementDetailFees,
} from '@/api/settlement/preSettlement'; } from '@/api/settlement/preSettlement';
import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail'; import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail';
import { getBfiExchangeRate } from '@/api/base/currency';
import { import {
createFormalSettlementForm, createFormalSettlementForm,
formalSettlementFormFields, formalSettlementFormFields,
@@ -1250,6 +1252,7 @@ export default {
if (this.initialData) await this.applyInitialData(); if (this.initialData) await this.applyInitialData();
Object.assign(this.form, newRecordAudit); Object.assign(this.form, newRecordAudit);
await this.refreshFormalSettlementNo(); await this.refreshFormalSettlementNo();
await this.fetchBfiExchangeRate();
return; return;
} }
this.loading = true; this.loading = true;
@@ -1482,6 +1485,7 @@ export default {
(settlementType === 'receivable' ? contract.partyA : contract.partyB), (settlementType === 'receivable' ? contract.partyA : contract.partyB),
settlementType, settlementType,
settlementTypeName: settlementType === 'receivable' ? '应收' : '应付', settlementTypeName: settlementType === 'receivable' ? '应收' : '应付',
currency: contract.settlementCurrency || 'RMB',
}); });
this.sources = []; this.sources = [];
this.details = []; this.details = [];
@@ -1489,6 +1493,23 @@ export default {
this.form.sourcePreSettlementIds = []; this.form.sourcePreSettlementIds = [];
this.form.sourceDetailIds = []; this.form.sourceDetailIds = [];
if (refreshSettlementNo) this.refreshFormalSettlementNo(); if (refreshSettlementNo) this.refreshFormalSettlementNo();
if (this.form.currency !== 'RMB') this.fetchBfiExchangeRate();
},
async fetchBfiExchangeRate() {
const currency = this.form.currency;
if (!currency || currency === 'RMB') return;
if (!this.form.exchangeRateDate) return;
try {
const { data } = await getBfiExchangeRate(currency, this.form.exchangeRateDate);
const rateData = data?.data;
if (rateData?.excval != null) {
this.form.exchangeRate = Number(rateData.excval);
} else {
this.$message.warning(`未查询到 ${currency} 的BFI汇率数据`);
}
} catch (e) {
this.$message.warning('查询BFI汇率失败,请手动输入结算汇率');
}
}, },
openCandidateDialog() { openCandidateDialog() {
this.candidate.visible = true; this.candidate.visible = true;
@@ -42,7 +42,7 @@
format="YYYY-MM-DD" format="YYYY-MM-DD"
:disabled="!editable || form.currency === 'RMB'" :disabled="!editable || form.currency === 'RMB'"
placeholder="请选择" placeholder="请选择"
@change="recalculateLocalAmount" @change="handleExchangeRateDateChange"
/> />
<el-input-number <el-input-number
v-else-if="field.type === 'number'" v-else-if="field.type === 'number'"
@@ -934,6 +934,7 @@ import {
submit, submit,
} from '@/api/settlement/preSettlement'; } from '@/api/settlement/preSettlement';
import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail'; import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail';
import { getBfiExchangeRate } from '@/api/base/currency';
import { getDictionary } from '@/api/system/dictbiz'; import { getDictionary } from '@/api/system/dictbiz';
import { import {
emptyPreSettlementForm, emptyPreSettlementForm,
@@ -1242,7 +1243,11 @@ export default {
await this.loadFeeCategoryOptions(); await this.loadFeeCategoryOptions();
await this.loadTransportTypeOptions(); await this.loadTransportTypeOptions();
if (this.recordId) await this.loadDetail(); if (this.recordId) await this.loadDetail();
else if (this.initialData) await this.applyInitialData(); else if (this.initialData) {
await this.applyInitialData();
this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD');
await this.fetchBfiExchangeRate();
}
}, },
async applyInitialData() { async applyInitialData() {
const rows = Array.isArray(this.initialData?.rows) ? this.initialData.rows : []; const rows = Array.isArray(this.initialData?.rows) ? this.initialData.rows : [];
@@ -1527,7 +1532,12 @@ export default {
this.form.settlementType = contract.settlementType || 'payable'; this.form.settlementType = contract.settlementType || 'payable';
this.form.payerName = contract.partyA; this.form.payerName = contract.partyA;
this.form.payeeName = contract.partyB; this.form.payeeName = contract.partyB;
this.form.currency = contract.settlementCurrency || 'RMB';
this.summaryFees = []; this.summaryFees = [];
if (this.form.currency !== 'RMB') {
this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD');
this.fetchBfiExchangeRate();
}
}, },
async saveDraft(shouldSubmit) { async saveDraft(shouldSubmit) {
await this.$refs.formRef?.validate(); await this.$refs.formRef?.validate();
@@ -1794,6 +1804,26 @@ export default {
.toFixed(2) .toFixed(2)
); );
}, },
handleExchangeRateDateChange() {
this.fetchBfiExchangeRate();
this.recalculateLocalAmount();
},
async fetchBfiExchangeRate() {
if (!this.form.currency || this.form.currency === 'RMB') return;
if (!this.form.exchangeRateDate) return;
try {
const { data } = await getBfiExchangeRate(this.form.currency, this.form.exchangeRateDate);
const rateData = data?.data;
if (rateData?.excval != null) {
this.form.exchangeRate = Number(rateData.excval);
this.recalculateLocalAmount();
} else {
this.$message.warning(`未查询到 ${this.form.currency} 的BFI汇率数据`);
}
} catch (e) {
this.$message.warning('查询BFI汇率失败,请手动输入结算汇率');
}
},
recalculateLocalAmount() { recalculateLocalAmount() {
const rate = this.form.currency === 'RMB' ? 1 : Number(this.form.exchangeRate || 0); const rate = this.form.currency === 'RMB' ? 1 : Number(this.form.exchangeRate || 0);
this.form.localSettlementAmount = (Number(this.form.settlementAmount || 0) * rate).toFixed(2); this.form.localSettlementAmount = (Number(this.form.settlementAmount || 0) * rate).toFixed(2);