修复 没有可用电子凭证数据
This commit is contained in:
@@ -149,6 +149,10 @@
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.voucher-missing-alert {
|
||||
margin-bottom: var(--space-3);
|
||||
}
|
||||
|
||||
.section-copy {
|
||||
margin: 0 0 var(--space-3);
|
||||
color: var(--text-secondary);
|
||||
|
||||
@@ -124,7 +124,6 @@ onMounted(loadDetail)
|
||||
/>
|
||||
|
||||
<AdminTaskKuaishouIndustryVoucherSection
|
||||
v-if="detail.kuaishouIndustryVoucher"
|
||||
:detail="detail"
|
||||
:action-loading="actionLoading"
|
||||
@resend-industry-code="submitKuaishouIndustryResendCode"
|
||||
|
||||
+58
-16
@@ -1,4 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
|
||||
import AdminStatusTag from '@/components/admin/AdminStatusTag.vue'
|
||||
import type { AdminTaskDetail } from '@/types/admin'
|
||||
import { formatAdminDateTime } from '@/utils/admin-time'
|
||||
@@ -8,13 +10,30 @@ interface Props {
|
||||
actionLoading: boolean
|
||||
}
|
||||
|
||||
defineProps<Props>()
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
resendIndustryCode: []
|
||||
consumeIndustryVoucher: []
|
||||
}>()
|
||||
|
||||
const voucher = computed(() => props.detail.kuaishouIndustryVoucher)
|
||||
const shouldShowSection = computed(() => Boolean(voucher.value || hasKuaishouIndustrySignal()))
|
||||
const missingReason = computed(() => {
|
||||
const message = props.detail.task.lastError || props.detail.task.resultMessage || ''
|
||||
return message || '未找到电子凭证记录'
|
||||
})
|
||||
|
||||
function hasKuaishouIndustrySignal() {
|
||||
const signal = [
|
||||
props.detail.task.resultCode,
|
||||
props.detail.task.resultMessage,
|
||||
props.detail.task.lastError,
|
||||
].join(' ')
|
||||
|
||||
return /电子凭证|核销码|发码回调|kuaishou_industry/.test(signal)
|
||||
}
|
||||
|
||||
function formatConsumeDetailTime(value: unknown) {
|
||||
const parsed = Number(value || 0)
|
||||
if (Number.isFinite(parsed) && parsed > 0) {
|
||||
@@ -38,10 +57,10 @@ function formatValue(value: unknown) {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-card v-if="detail.kuaishouIndustryVoucher" shadow="never" class="section-card">
|
||||
<el-card v-if="shouldShowSection" shadow="never" class="section-card">
|
||||
<div class="section-headline">
|
||||
<h3>电子凭证与核销</h3>
|
||||
<div class="section-actions">
|
||||
<div v-if="voucher" class="section-actions">
|
||||
<el-button
|
||||
v-if="detail.operations.canResendKuaishouIndustryVoucherCode"
|
||||
:loading="actionLoading"
|
||||
@@ -63,47 +82,48 @@ function formatValue(value: unknown) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="voucher">
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="平台订单号">
|
||||
{{ detail.kuaishouIndustryVoucher.oid || '-' }}
|
||||
{{ voucher.oid || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="券序号">
|
||||
{{ detail.kuaishouIndustryVoucher.unitIndex || '-' }}
|
||||
{{ voucher.unitIndex || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="核销码">
|
||||
{{ detail.kuaishouIndustryVoucher.voucherCode || '-' }}
|
||||
{{ voucher.voucherCode || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="券状态">
|
||||
<AdminStatusTag :status="detail.kuaishouIndustryVoucher.status || ''" />
|
||||
<AdminStatusTag :status="voucher.status || ''" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="发码回调">
|
||||
<AdminStatusTag :status="detail.kuaishouIndustryVoucher.sendCallbackStatus || ''" />
|
||||
<AdminStatusTag :status="voucher.sendCallbackStatus || ''" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="回调次数">
|
||||
{{ detail.kuaishouIndustryVoucher.sendCallbackAttemptCount || 0 }}
|
||||
{{ voucher.sendCallbackAttemptCount || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="回调时间">
|
||||
{{ formatAdminDateTime(detail.kuaishouIndustryVoucher.sendCallbackSentAt) }}
|
||||
{{ formatAdminDateTime(voucher.sendCallbackSentAt) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="回调异常">
|
||||
{{ detail.kuaishouIndustryVoucher.sendCallbackLastError || '-' }}
|
||||
{{ voucher.sendCallbackLastError || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="核销流水">
|
||||
{{ detail.kuaishouIndustryVoucher.consumeSerialNum || '-' }}
|
||||
{{ voucher.consumeSerialNum || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="核销时间">
|
||||
{{ formatAdminDateTime(detail.kuaishouIndustryVoucher.consumedAt) }}
|
||||
{{ formatAdminDateTime(voucher.consumedAt) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="销毁时间">
|
||||
{{ formatAdminDateTime(detail.kuaishouIndustryVoucher.destroyedAt) }}
|
||||
{{ formatAdminDateTime(voucher.destroyedAt) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<div class="voucher-detail-block">
|
||||
<h4>核销明细</h4>
|
||||
<el-table
|
||||
v-if="detail.kuaishouIndustryVoucher.consumeDetails.length > 0"
|
||||
:data="detail.kuaishouIndustryVoucher.consumeDetails"
|
||||
v-if="voucher.consumeDetails.length > 0"
|
||||
:data="voucher.consumeDetails"
|
||||
size="small"
|
||||
>
|
||||
<el-table-column label="流水号" min-width="160">
|
||||
@@ -131,6 +151,28 @@ function formatValue(value: unknown) {
|
||||
</el-table>
|
||||
<el-empty v-else description="暂无核销明细" :image-size="64" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<el-alert
|
||||
title="未找到电子凭证记录"
|
||||
type="warning"
|
||||
show-icon
|
||||
:closable="false"
|
||||
class="voucher-missing-alert"
|
||||
/>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="平台订单号">
|
||||
{{ detail.task.platformOrderId || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="结果代码">
|
||||
{{ detail.task.resultCode || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="最近错误" :span="2">
|
||||
{{ missingReason }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user