feat(M08-B): 补微信转账预检拦截
This commit is contained in:
@@ -268,13 +268,43 @@
|
||||
<el-radio-button label="MOCK">MOCK</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-alert
|
||||
v-if="transferDialog.mode === 'API'"
|
||||
class="transfer-preflight-alert"
|
||||
:title="transferPreflightTitle"
|
||||
:type="transferDialog.preflight?.ready ? 'success' : 'warning'"
|
||||
show-icon
|
||||
:closable="false"
|
||||
/>
|
||||
<el-table
|
||||
v-if="transferDialog.mode === 'API' && transferDialog.preflight"
|
||||
:data="transferDialog.preflight.checks"
|
||||
size="small"
|
||||
class="preflight-table"
|
||||
max-height="220"
|
||||
>
|
||||
<el-table-column prop="key" label="检查项" width="160" />
|
||||
<el-table-column prop="status" label="状态" width="90">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="preflightTag(row.status)" effect="light">{{ row.status }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="message" label="说明" min-width="220" />
|
||||
</el-table>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="transferDialog.note" type="textarea" :rows="3" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="transferDialog.open = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitTransfer">发起</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="transferDialog.preflightLoading"
|
||||
:disabled="!transferCanSubmit"
|
||||
@click="submitTransfer"
|
||||
>
|
||||
发起
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -496,7 +526,9 @@ const transferDialog = reactive({
|
||||
open: false,
|
||||
settlementId: '',
|
||||
mode: 'API' as TransferMode,
|
||||
note: ''
|
||||
note: '',
|
||||
preflightLoading: false,
|
||||
preflight: null as WechatTransferPreflight | null
|
||||
});
|
||||
|
||||
watch(
|
||||
@@ -547,6 +579,18 @@ const candidatePageRewardCents = computed(() => candidateDialog.items
|
||||
const selectedSyncableSettlements = computed(() => selectedSettlements.value
|
||||
.filter((settlement) => settlement.status === 'CONFIRMED'));
|
||||
const selectedSyncableCount = computed(() => selectedSyncableSettlements.value.length);
|
||||
const transferCanSubmit = computed(() => {
|
||||
if (transferDialog.mode === 'MOCK') return true;
|
||||
return !transferDialog.preflightLoading && Boolean(transferDialog.preflight?.ready);
|
||||
});
|
||||
const transferPreflightTitle = computed(() => {
|
||||
if (transferDialog.preflightLoading) return '正在执行真实转账预检';
|
||||
if (!transferDialog.preflight) return '请等待预检完成后再发起真实转账';
|
||||
if (transferDialog.preflight.ready) return '真实转账前置条件已通过';
|
||||
const failedCount = transferDialog.preflight.checks
|
||||
.filter((check) => check.status === 'FAIL').length;
|
||||
return `仍有 ${failedCount} 个阻断项需要处理`;
|
||||
});
|
||||
|
||||
function settlementTag(status: SettlementStatus) {
|
||||
if (status === 'PAID') return 'success';
|
||||
@@ -601,11 +645,20 @@ function submitGenerate() {
|
||||
generateDialog.open = false;
|
||||
}
|
||||
|
||||
function openTransfer(row: CleaningSettlement) {
|
||||
async function openTransfer(row: CleaningSettlement) {
|
||||
transferDialog.open = true;
|
||||
transferDialog.settlementId = row.id;
|
||||
transferDialog.mode = 'API';
|
||||
transferDialog.note = '';
|
||||
transferDialog.preflight = null;
|
||||
transferDialog.preflightLoading = true;
|
||||
try {
|
||||
transferDialog.preflight = await preflightWechatTransfer(props.session, row.id);
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : '微信转账预检失败');
|
||||
} finally {
|
||||
transferDialog.preflightLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
function submitTransfer() {
|
||||
|
||||
@@ -342,6 +342,10 @@ textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.transfer-preflight-alert {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.dialog-stack {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
|
||||
Reference in New Issue
Block a user