Files
BMS/bms-front/src/views/monitor/billingTask/components/BillingTaskDetailDrawer.vue
T

132 lines
4.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<el-drawer v-model="open" size="600px" :title="drawerTitle" append-to-body destroy-on-close class="billing-task-drawer">
<div v-loading="loading" class="detail-wrap">
<el-empty v-if="!detail" description="暂无详情" />
<template v-else>
<div class="detail-header">
<el-tag :type="statusTag(detail.successStatus)" effect="light">{{ statusLabel(detail.successStatus) }}</el-tag>
<span class="detail-header-type">{{ billTypeLabel(detail.billType) }}</span>
<span class="detail-header-time">计费时间:{{ detail.billTime || '-' }}</span>
</div>
<el-descriptions :column="1" border size="small" class="detail-desc">
<el-descriptions-item label="任务ID">{{ detail.taskId }}</el-descriptions-item>
<el-descriptions-item label="客户代码">{{ detail.customerCode || '-' }}</el-descriptions-item>
<el-descriptions-item label="订单号">{{ detail.orderNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="运单号">{{ detail.trackingNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="转单号">{{ detail.transferNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="计费订单ID">{{ detail.orderId || '-' }}</el-descriptions-item>
<el-descriptions-item label="失败码">{{ detail.failCode || '-' }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ detail.createTime || '-' }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ detail.updateTime || '-' }}</el-descriptions-item>
</el-descriptions>
<div v-if="detail.errorMessage" class="err-block">
<div class="err-block-head">
<span class="err-block-title">失败原因</span>
<el-button link type="primary" size="small" icon="CopyDocument" @click="copyError">复制</el-button>
</div>
<div class="err-block-body">{{ detail.errorMessage }}</div>
</div>
</template>
</div>
</el-drawer>
</template>
<script setup>
import { getBillingTask } from '@/api/monitor/billingTask'
import { billTypeLabel, statusLabel, statusTag } from './billingTaskOptions'
const { proxy } = getCurrentInstance()
const open = ref(false)
const loading = ref(false)
const detail = ref(null)
const drawerTitle = ref('计费任务详情')
function openDrawer(row) {
if (!row || !row.taskId) return
drawerTitle.value = '计费任务 #' + row.taskId
open.value = true
loading.value = true
detail.value = null
getBillingTask(row.taskId).then(res => {
detail.value = res.data || row
}).finally(() => {
loading.value = false
})
}
function copyError() {
const text = detail.value?.errorMessage || ''
if (!text) return
navigator.clipboard.writeText(text).then(() => {
proxy.$modal.msgSuccess('已复制')
}).catch(() => {
proxy.$modal.msgError('复制失败')
})
}
defineExpose({ open: openDrawer })
</script>
<style scoped>
.detail-wrap {
padding: 0 4px;
}
.detail-header {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
margin-bottom: 16px;
background: #f8f9fb;
border-radius: 6px;
}
.detail-header-type {
font-size: 14px;
font-weight: 600;
color: #303133;
}
.detail-header-time {
margin-left: auto;
font-size: 12px;
color: #909399;
}
.detail-desc :deep(.el-descriptions__label) {
width: 96px;
min-width: 96px;
color: #909399;
}
.detail-desc :deep(.el-descriptions__content) {
word-break: break-all;
}
.err-block {
margin-top: 16px;
border: 1px solid #fde2e2;
border-radius: 6px;
overflow: hidden;
}
.err-block-head {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6px 12px;
background: #fef0f0;
}
.err-block-title {
font-size: 13px;
font-weight: 600;
color: #f56c6c;
}
.err-block-body {
max-height: 260px;
overflow-y: auto;
padding: 10px 12px;
font-size: 12px;
font-family: Consolas, Monaco, monospace;
line-height: 1.7;
color: #c45656;
word-break: break-all;
white-space: pre-wrap;
background: #fff;
}
</style>