- 取消
+ 同步
保存
@@ -368,6 +373,7 @@
@click="submitForm"
>提交
+ 返回
{
- const paidDate = this.$dayjs().subtract(index, 'day').format('YYYY-MM-DD');
+ syncPaymentRecords() {
+ const appliedCents = Math.max(0, Math.round(Number(this.form.appliedAmount || 0) * 100));
+ if (!appliedCents) {
+ this.$message.warning('请先填写申请付款金额');
+ return;
+ }
+ const maxCount = Math.min(5, appliedCents);
+ const minCount = Math.min(2, maxCount);
+ const recordCount = Math.floor(Math.random() * (maxCount - minCount + 1)) + minCount;
+ const minimumTotal = recordCount;
+ const randomTotal = Math.round(appliedCents * (0.5 + Math.random() * 0.5));
+ let remainingCents = Math.max(minimumTotal, Math.min(appliedCents, randomTotal));
+ const timestamp = this.$dayjs().format('YYYYMMDDHHmmss');
+ this.paymentRecords = Array.from({ length: recordCount }, (_unusedItem, index) => {
+ const remainingCount = recordCount - index - 1;
+ const maxCurrentCents = remainingCents - remainingCount;
+ const paidCents =
+ remainingCount === 0 ? remainingCents : Math.floor(Math.random() * maxCurrentCents) + 1;
+ remainingCents -= paidCents;
const sequence = String(index + 1).padStart(2, '0');
+ const paidDate = this.$dayjs()
+ .subtract(Math.floor(Math.random() * 30), 'day')
+ .format('YYYY-MM-DD');
return {
- paidAmount: Number((value / 100).toFixed(2)),
+ paidAmount: Number((paidCents / 100).toFixed(2)),
paidDate,
- paymentNo: `MOCK-${normalizedSettlementNo}-${sequence}`,
+ paymentNo: `MOCK-PAY-${timestamp}-${sequence}`,
voucherJson: '',
- kingdeeBillNo: `MOCK-KD${paidDate.replaceAll('-', '')}${sequence}`,
+ kingdeeBillNo: `MOCK-KD-${timestamp}-${sequence}`,
};
});
- },
- referencePaymentAmount(settlementAmount) {
- return Number(
- ((Number(settlementAmount || 0) * Number(this.form.paymentRatio || 0)) / 100).toFixed(2)
- );
+ this.$message.success(`同步成功,已生成${recordCount}条付款记录`);
},
applyTransferredPreSettlements(rows = []) {
if (!rows.length) return;
@@ -1246,7 +1263,7 @@ export default {
billType: '预结算单',
appliedAmount: Number(((settlementAmount * paymentRatio) / 100).toFixed(2)),
});
- this.createMockPaymentRecords(this.form.preSettlementNo, this.form.appliedAmount);
+ this.paymentRecords = [];
this.$nextTick(() => {
this.amountSyncing = false;
this.$refs.formRef?.clearValidate();
@@ -1957,10 +1974,7 @@ export default {
detail?.invoices,
detail?.formalSettlementNo || row.formalSettlementNo
);
- this.createMockPaymentRecords(
- row.formalSettlementNo,
- this.referencePaymentAmount(settlementAmount)
- );
+ this.paymentRecords = [];
await Promise.all([
this.loadReceiptAccountOptions(),
this.loadAttachmentRuleData(detail?.id ? [detail] : []),
@@ -2019,10 +2033,6 @@ export default {
});
this.referenceVisible = false;
this.refreshReferenceValidation();
- this.createMockPaymentRecords(
- row.preSettlementNo,
- this.referencePaymentAmount(settlementAmount)
- );
const detail = this.unwrapData(detailResponse);
await Promise.all([
this.loadReceiptAccountOptions(),
diff --git a/src/views/settlement/components/pre-settlement-editor.vue b/src/views/settlement/components/pre-settlement-editor.vue
index a616f2f..493383f 100644
--- a/src/views/settlement/components/pre-settlement-editor.vue
+++ b/src/views/settlement/components/pre-settlement-editor.vue
@@ -1300,18 +1300,41 @@ export default {
};
this.appliedDetailQuery = { ...this.detailQuery };
},
- async openAdjustDialog(row, readonly) {
- if (!row.id || row.id === row.sourceDetailId) {
- this.$message.warning('请先保存预结算单');
- return;
+ async persistDetailForAdjustment(row) {
+ const sourceDetailId = row.sourceDetailId || row.id;
+ const isPersistedDetail =
+ row.id && sourceDetailId && String(row.id) !== String(sourceDetailId);
+ if (isPersistedDetail) return row;
+
+ await this.$refs.formRef?.validate();
+ this.loading = true;
+ try {
+ const { data } = await save(this.buildSavePayload());
+ this.form.id = data?.data || this.form.id;
+ await this.loadDetail();
+ const savedRow = this.details.find(
+ item => String(item.sourceDetailId || '') === String(sourceDetailId || '')
+ );
+ if (!savedRow) {
+ this.$message.warning('结算明细保存失败,请重试');
+ return null;
+ }
+ this.$emit('success', this.form.id);
+ return savedRow;
+ } finally {
+ this.loading = false;
}
+ },
+ async openAdjustDialog(row, readonly) {
+ const detailRow = await this.persistDetailForAdjustment(row);
+ if (!detailRow) return;
this.adjustDialog.visible = true;
this.adjustDialog.loading = true;
this.adjustDialog.readonly = readonly;
- this.adjustDialog.detailId = row.id;
+ this.adjustDialog.detailId = detailRow.id;
this.adjustDialog.reason = '';
try {
- const { data } = await getDetailFees(row.id);
+ const { data } = await getDetailFees(detailRow.id);
this.adjustRows = (data?.data || []).map(item => ({
...item,
feeItems: this.parseFeeItems(item.feeItemsJson),
@@ -1545,6 +1568,7 @@ export default {
&--page &__content {
max-height: none;
+ padding-bottom: 72px;
overflow: visible;
}
diff --git a/vite.config.mjs b/vite.config.mjs
index 45a377c..1726a3c 100644
--- a/vite.config.mjs
+++ b/vite.config.mjs
@@ -47,26 +47,26 @@ export default ({ mode, command }) => {
__VUE_I18N_LEGACY_API__: true,
__INTLIFY_PROD_DEVTOOLS__: false,
},
- // server: {
- // port: 2888,
- // proxy: {
- // '/api': {
- // target: 'http://localhost',
- // //target: 'https://saber3.bladex.cn/api',
- // changeOrigin: true,
- // rewrite: path => path.replace(/^\/api/, ''),
- // },
- // },
- // },
server: {
- port: 2889,
+ port: 2888,
proxy: {
'/api': {
- target: 'http://172.16.203.228:8000',
+ target: 'http://localhost',
+ //target: 'https://saber3.bladex.cn/api',
changeOrigin: true,
+ rewrite: path => path.replace(/^\/api/, ''),
},
},
},
+ // server: {
+ // port: 2889,
+ // proxy: {
+ // '/api': {
+ // target: 'http://172.16.203.228:8000',
+ // changeOrigin: true,
+ // },
+ // },
+ // },
resolve: {
alias: {
'~': resolve(__dirname, './'),