Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f067518c0e | |||
| 11460f3378 | |||
| 7f543937fb |
@@ -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,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -20,6 +20,8 @@ export const syncKingdee = id =>
|
||||
request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id } });
|
||||
export const syncKingdeeBatch = 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 = [
|
||||
{ label: '项目预付', value: 'project_advance' },
|
||||
@@ -36,5 +38,8 @@ export const approvalStatusOptions = [
|
||||
export const kingdeeStatusOptions = [
|
||||
{ label: '未生成', value: 'unsynced' },
|
||||
{ label: '已生成', value: 'synced' },
|
||||
{ label: '付款中', value: 'paying' },
|
||||
{ label: '已付款', value: 'paid' },
|
||||
{ label: '已关闭', value: 'closed' },
|
||||
{ label: '生成失败', value: 'failed' },
|
||||
];
|
||||
|
||||
@@ -84,6 +84,13 @@
|
||||
@click="handleSync"
|
||||
>批量同步</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasPermission('payment_application_sync')"
|
||||
type="primary"
|
||||
plain
|
||||
@click="handleSyncResult"
|
||||
>同步付款结果</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="hasPermission('payment_application_add')"
|
||||
type="primary"
|
||||
@@ -396,8 +403,22 @@ export default {
|
||||
this.$message.warning('请选择至少一条审批通过的付款申请');
|
||||
return;
|
||||
}
|
||||
await api.syncKingdeeBatch(rows.map(row => row.id));
|
||||
this.$message.success(`已同步${rows.length}条付款申请`);
|
||||
const data = this.unwrapData(await api.syncKingdeeBatch(rows.map(row => row.id))) || [];
|
||||
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();
|
||||
},
|
||||
handleExport() {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择"
|
||||
@change="fetchBfiExchangeRate"
|
||||
/>
|
||||
<el-select
|
||||
v-else-if="field.type === 'project' && editable"
|
||||
@@ -947,6 +948,7 @@ import {
|
||||
getDetailFees as getPreSettlementDetailFees,
|
||||
} from '@/api/settlement/preSettlement';
|
||||
import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail';
|
||||
import { getBfiExchangeRate } from '@/api/base/currency';
|
||||
import {
|
||||
createFormalSettlementForm,
|
||||
formalSettlementFormFields,
|
||||
@@ -1250,6 +1252,7 @@ export default {
|
||||
if (this.initialData) await this.applyInitialData();
|
||||
Object.assign(this.form, newRecordAudit);
|
||||
await this.refreshFormalSettlementNo();
|
||||
await this.fetchBfiExchangeRate();
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
@@ -1482,6 +1485,7 @@ export default {
|
||||
(settlementType === 'receivable' ? contract.partyA : contract.partyB),
|
||||
settlementType,
|
||||
settlementTypeName: settlementType === 'receivable' ? '应收' : '应付',
|
||||
currency: contract.settlementCurrency || 'RMB',
|
||||
});
|
||||
this.sources = [];
|
||||
this.details = [];
|
||||
@@ -1489,6 +1493,23 @@ export default {
|
||||
this.form.sourcePreSettlementIds = [];
|
||||
this.form.sourceDetailIds = [];
|
||||
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() {
|
||||
this.candidate.visible = true;
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
format="YYYY-MM-DD"
|
||||
:disabled="!editable || form.currency === 'RMB'"
|
||||
placeholder="请选择"
|
||||
@change="recalculateLocalAmount"
|
||||
@change="handleExchangeRateDateChange"
|
||||
/>
|
||||
<el-input-number
|
||||
v-else-if="field.type === 'number'"
|
||||
@@ -934,6 +934,7 @@ import {
|
||||
submit,
|
||||
} from '@/api/settlement/preSettlement';
|
||||
import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail';
|
||||
import { getBfiExchangeRate } from '@/api/base/currency';
|
||||
import { getDictionary } from '@/api/system/dictbiz';
|
||||
import {
|
||||
emptyPreSettlementForm,
|
||||
@@ -1242,7 +1243,11 @@ export default {
|
||||
await this.loadFeeCategoryOptions();
|
||||
await this.loadTransportTypeOptions();
|
||||
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() {
|
||||
const rows = Array.isArray(this.initialData?.rows) ? this.initialData.rows : [];
|
||||
@@ -1527,7 +1532,12 @@ export default {
|
||||
this.form.settlementType = contract.settlementType || 'payable';
|
||||
this.form.payerName = contract.partyA;
|
||||
this.form.payeeName = contract.partyB;
|
||||
this.form.currency = contract.settlementCurrency || 'RMB';
|
||||
this.summaryFees = [];
|
||||
if (this.form.currency !== 'RMB') {
|
||||
this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD');
|
||||
this.fetchBfiExchangeRate();
|
||||
}
|
||||
},
|
||||
async saveDraft(shouldSubmit) {
|
||||
await this.$refs.formRef?.validate();
|
||||
@@ -1794,6 +1804,26 @@ export default {
|
||||
.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() {
|
||||
const rate = this.form.currency === 'RMB' ? 1 : Number(this.form.exchangeRate || 0);
|
||||
this.form.localSettlementAmount = (Number(this.form.settlementAmount || 0) * rate).toFixed(2);
|
||||
|
||||
Reference in New Issue
Block a user