实现扣减额度功能
This commit is contained in:
@@ -31,6 +31,12 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="业务ID">{{ detail.bizId || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="写入时间">{{ detail.updateTime || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item v-if="detail.logType === 'CREDIT'" label="扣减动作">
|
||||
{{ creditActionLabel(detail) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="detail.logType === 'CREDIT'" label="金额">
|
||||
{{ creditAmountLabel(detail) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="detail.errorMessage" label="错误信息" :span="2">
|
||||
<span class="err-text">{{ detail.errorMessage }}</span>
|
||||
</el-descriptions-item>
|
||||
@@ -66,7 +72,8 @@ const drawerTitle = ref('ES日志详情')
|
||||
|
||||
const typeOptions = [
|
||||
{ label: '计费', value: 'BILL' },
|
||||
{ label: '试算', value: 'QUOTE' }
|
||||
{ label: '试算', value: 'QUOTE' },
|
||||
{ label: '扣减额度', value: 'CREDIT' }
|
||||
]
|
||||
|
||||
const statusOptions = [
|
||||
@@ -97,9 +104,31 @@ function typeLabel(type) {
|
||||
return found ? found.label : (type || '-')
|
||||
}
|
||||
|
||||
function parseReq(detail) {
|
||||
if (!detail || !detail.requestJson) return {}
|
||||
try {
|
||||
return typeof detail.requestJson === 'object' ? detail.requestJson : JSON.parse(detail.requestJson)
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
function creditActionLabel(detail) {
|
||||
const req = parseReq(detail)
|
||||
const map = { OCCUPY: '占用', RELEASE: '释放', SKIP: '跳过' }
|
||||
return map[req.action] || req.action || '-'
|
||||
}
|
||||
|
||||
function creditAmountLabel(detail) {
|
||||
const req = parseReq(detail)
|
||||
if (req.amount == null || req.amount === '') return '-'
|
||||
return String(req.amount) + (req.currency ? (' ' + req.currency) : '')
|
||||
}
|
||||
|
||||
function typeTag(type) {
|
||||
if (type === 'BILL') return 'success'
|
||||
if (type === 'QUOTE') return 'warning'
|
||||
if (type === 'CREDIT') return 'danger'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user