实现扣减额度功能

This commit is contained in:
wuweihua
2026-09-17 16:05:46 +08:00
parent 5dbee51a3a
commit 78f2da431b
7 changed files with 174 additions and 11 deletions
@@ -934,7 +934,9 @@ const payMethodOptions = [
]
const bizTypeOptions = [
{ value: 'RECEIPT', label: '收款' },
{ value: 'BILL_PAY', label: '账单支付' },
{ value: 'AR_BILL', label: '应收账单' },
{ value: 'BILL_PAY', label: '账单核销' },
{ value: 'ORDER', label: '计费订单' },
{ value: 'REFUND', label: '退款' },
{ value: 'ADJUST', label: '手工调整' },
{ value: 'FREEZE', label: '冻结' },
@@ -964,7 +966,7 @@ function receiptStatusTag(v) {
return { PENDING: 'warning', CONFIRMED: 'success', CANCELLED: 'danger' }[v] || 'info'
}
const bizTypeTag = function(v) {
return { RECEIPT: 'success', BILL_PAY: 'danger', REFUND: 'warning', ADJUST: 'info', FREEZE: 'info', UNFREEZE: '' }[v] || 'info'
return { RECEIPT: 'success', AR_BILL: 'primary', BILL_PAY: 'danger', ORDER: 'warning', REFUND: 'warning', ADJUST: 'info', FREEZE: 'info', UNFREEZE: '' }[v] || 'info'
}
/* ================= 额度相关枚举 ================= */
+30 -1
View File
@@ -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'
}