增加修改客户重新同步功能
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="app-container billing-task-page">
|
||||
<div v-if="retryFloatVisible" class="retry-status-float">
|
||||
<el-tooltip :content="retryFloatTooltip" placement="bottom">
|
||||
<el-button class="retry-status-button" type="primary" plain size="small" @click="filterRetryRef.open()">
|
||||
<span class="retry-progress-ring" :style="{ '--retry-progress': retryProgressDegree + 'deg' }" aria-hidden="true">
|
||||
<span class="retry-progress-value">{{ retryProgressText }}</span>
|
||||
</span>
|
||||
<span class="retry-status-text">
|
||||
<strong>{{ retryFloatTitle }}</strong>
|
||||
<small>{{ retryFloatSummary }}</small>
|
||||
</span>
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
<basic-table
|
||||
ref="tableRef"
|
||||
:columns="columns"
|
||||
@@ -15,11 +29,20 @@
|
||||
type="primary"
|
||||
plain
|
||||
icon="Refresh"
|
||||
v-hasPermi="['monitor:billingTask:retry']"
|
||||
@click="filterRetryRef.open()"
|
||||
>批量重新同步</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Refresh"
|
||||
:disabled="!ids.length"
|
||||
:loading="batchLoading"
|
||||
v-hasPermi="['monitor:billingTask:retry']"
|
||||
@click="handleBatchRetry(ids)"
|
||||
>批量重新同步</el-button>
|
||||
>同步选中</el-button>
|
||||
</el-col>
|
||||
</template>
|
||||
<template #col-billType="{ row }">
|
||||
@@ -32,7 +55,7 @@
|
||||
<span class="err-text" :title="row.errorMessage || ''">{{ row.errorMessage || '-' }}</span>
|
||||
</template>
|
||||
<template #col-action="{ row }">
|
||||
<el-button link type="primary" icon="View" @click="handleView(row)" v-hasPermi="['monitor:billingTask:list']">查看</el-button>
|
||||
<el-button link type="primary" icon="View" @click="detailRef.open(row)" v-hasPermi="['monitor:billingTask:list']">查看</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
@@ -44,87 +67,38 @@
|
||||
</template>
|
||||
</basic-table>
|
||||
|
||||
<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.billId || '-' }}</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>
|
||||
<billing-task-detail-drawer ref="detailRef" />
|
||||
<billing-task-filter-retry-dialog
|
||||
ref="filterRetryRef"
|
||||
@progress="onFilterRetryProgress"
|
||||
@success="onFilterRetrySuccess"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="BillingTaskMonitor">
|
||||
import { listBillingTask, getBillingTask, retryBillingTask, retryBillingTaskBatch } from '@/api/monitor/billingTask'
|
||||
import { listBillingTask, retryBillingTask, retryBillingTaskBatch } from '@/api/monitor/billingTask'
|
||||
import BillingTaskDetailDrawer from './components/BillingTaskDetailDrawer.vue'
|
||||
import BillingTaskFilterRetryDialog from './components/BillingTaskFilterRetryDialog.vue'
|
||||
import {
|
||||
statusOptions,
|
||||
billTypeOptions,
|
||||
failCodeOptions,
|
||||
billTypeLabel,
|
||||
statusLabel,
|
||||
statusTag
|
||||
} from './components/billingTaskOptions'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const tableRef = ref()
|
||||
const open = ref(false)
|
||||
const loading = ref(false)
|
||||
const detail = ref(null)
|
||||
const drawerTitle = ref('计费任务详情')
|
||||
const detailRef = ref()
|
||||
const filterRetryRef = ref()
|
||||
const retryingId = ref(null)
|
||||
const batchLoading = ref(false)
|
||||
const retryFloat = ref(null)
|
||||
|
||||
const defaultParams = { successStatus: 'FAILED' }
|
||||
|
||||
const statusOptions = [
|
||||
{ label: '失败', value: 'FAILED' },
|
||||
{ label: '待处理', value: 'WAITING' },
|
||||
{ label: '成功', value: 'SUCCESS' },
|
||||
{ label: '全部', value: 'ALL' }
|
||||
]
|
||||
|
||||
const failCodeOptions = [
|
||||
{ label: 'NO_CUSTOMER_PACKAGE', value: 'NO_CUSTOMER_PACKAGE' },
|
||||
{ label: 'NO_ACTIVE_PACKAGE_VERSION', value: 'NO_ACTIVE_PACKAGE_VERSION' },
|
||||
{ label: 'ALREADY_IN_AR_BILL', value: 'ALREADY_IN_AR_BILL' },
|
||||
{ label: 'PRODUCT_ARCHIVE_MISSING', value: 'PRODUCT_ARCHIVE_MISSING' },
|
||||
{ label: 'PRICE_NOT_HIT', value: 'PRICE_NOT_HIT' },
|
||||
{ label: 'ZONE_PRICE_NOT_HIT', value: 'ZONE_PRICE_NOT_HIT' },
|
||||
{ label: 'POSTCODE_REQUIRED', value: 'POSTCODE_REQUIRED' },
|
||||
{ label: 'POSTCODE_ZONE_NOT_FOUND', value: 'POSTCODE_ZONE_NOT_FOUND' },
|
||||
{ label: 'ORACLE_ORDER_NOT_FOUND', value: 'ORACLE_ORDER_NOT_FOUND' },
|
||||
{ label: 'ORACLE_ORDERNO_EMPTY', value: 'ORACLE_ORDERNO_EMPTY' },
|
||||
{ label: 'ORACLE_CUSTOMER_EMPTY', value: 'ORACLE_CUSTOMER_EMPTY' },
|
||||
{ label: 'ORACLE_PRODUCT_EMPTY', value: 'ORACLE_PRODUCT_EMPTY' },
|
||||
{ label: 'ORACLE_WEIGHT_INVALID', value: 'ORACLE_WEIGHT_INVALID' },
|
||||
{ label: 'BILL_TIME_EMPTY', value: 'BILL_TIME_EMPTY' },
|
||||
{ label: 'REFUND_ORDER_UNRESOLVED', value: 'REFUND_ORDER_UNRESOLVED' },
|
||||
{ label: 'CUSTOMER_CODE_REQUIRED', value: 'CUSTOMER_CODE_REQUIRED' },
|
||||
{ label: 'CUSTOMER_DISABLED', value: 'CUSTOMER_DISABLED' },
|
||||
{ label: 'FREIGHT_MISSING', value: 'FREIGHT_MISSING' },
|
||||
{ label: 'UNKNOWN', value: 'UNKNOWN' }
|
||||
]
|
||||
const billTypeOptions = [
|
||||
{ label: '待计费', value: 'PENDING' },
|
||||
{ label: '重计费', value: 'REBILL' },
|
||||
{ label: '退费', value: 'REFUND' }
|
||||
]
|
||||
|
||||
const searchColumns = [
|
||||
{ label: '状态', prop: 'successStatus', component: 'select', options: statusOptions, placeholder: '请选择状态', width: '140px', props: { clearable: true } },
|
||||
{ label: '计费类型', prop: 'billType', component: 'select', options: billTypeOptions, placeholder: '请选择类型', width: '140px', props: { clearable: true } },
|
||||
@@ -151,39 +125,44 @@ const columns = [
|
||||
{ label: '操作', prop: 'action', align: 'center', width: 180, fixed: 'right', slot: 'action', showInToolbar: false }
|
||||
]
|
||||
|
||||
const retryFloatVisible = computed(() => {
|
||||
const p = retryFloat.value
|
||||
return !!(p && (p.loading || p.finished))
|
||||
})
|
||||
const retryProgressDegree = computed(() => Math.round(((retryFloat.value?.percent || 0) / 100) * 360))
|
||||
const retryProgressText = computed(() => (retryFloat.value?.percent || 0) + '%')
|
||||
const retryFloatTitle = computed(() => {
|
||||
const st = (retryFloat.value?.status || '').toUpperCase()
|
||||
if (retryFloat.value?.loading) return '异步重新计费中'
|
||||
if (st === 'SUCCESS') return '重新计费完成'
|
||||
if (st === 'FAIL') return '重新计费失败'
|
||||
return '异步重新计费'
|
||||
})
|
||||
const retryFloatSummary = computed(() => {
|
||||
const p = retryFloat.value || {}
|
||||
return '成功 ' + (p.ok || 0) + ' / 失败 ' + (p.fail || 0) + ' / 总数 ' + (p.total || 0)
|
||||
})
|
||||
const retryFloatTooltip = computed(() => retryFloat.value?.message || '点击查看详情')
|
||||
|
||||
function queryList(params) {
|
||||
const p = proxy.addDateRange({ ...params }, params.dateRange)
|
||||
delete p.dateRange
|
||||
return listBillingTask(p)
|
||||
}
|
||||
|
||||
function billTypeLabel(type) {
|
||||
const found = billTypeOptions.find(item => item.value === type)
|
||||
return found ? found.label : (type || '-')
|
||||
function onFilterRetryProgress(payload) {
|
||||
retryFloat.value = payload
|
||||
if (payload && payload.finished && !payload.loading) {
|
||||
window.setTimeout(() => {
|
||||
if (retryFloat.value && retryFloat.value.finished && !retryFloat.value.loading) {
|
||||
retryFloat.value = null
|
||||
}
|
||||
}, 8000)
|
||||
}
|
||||
}
|
||||
|
||||
function statusLabel(status) {
|
||||
const found = statusOptions.find(item => item.value === status)
|
||||
return found ? found.label : (status || '-')
|
||||
}
|
||||
|
||||
function statusTag(status) {
|
||||
if (status === 'SUCCESS') return 'success'
|
||||
if (status === 'FAILED') return 'danger'
|
||||
if (status === 'WAITING') return 'warning'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
function handleView(row) {
|
||||
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 onFilterRetrySuccess() {
|
||||
tableRef.value?.refresh()
|
||||
}
|
||||
|
||||
function handleRetry(row) {
|
||||
@@ -203,19 +182,9 @@ function handleRetry(row) {
|
||||
})
|
||||
}
|
||||
|
||||
function copyError() {
|
||||
const text = detail.value?.errorMessage || ''
|
||||
if (!text) return
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
proxy.$modal.msgSuccess('已复制')
|
||||
}).catch(() => {
|
||||
proxy.$modal.msgError('复制失败')
|
||||
})
|
||||
}
|
||||
|
||||
function handleBatchRetry(ids) {
|
||||
if (!ids || !ids.length) return
|
||||
proxy.$modal.confirm('确认批量重新同步选中的 ' + ids.length + ' 条任务?').then(() => {
|
||||
proxy.$modal.confirm('确认同步选中的 ' + ids.length + ' 条任务?').then(() => {
|
||||
batchLoading.value = true
|
||||
return retryBillingTaskBatch(ids)
|
||||
}).then(res => {
|
||||
@@ -234,73 +203,71 @@ function handleBatchRetry(ids) {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.detail-wrap {
|
||||
padding: 0 4px;
|
||||
.billing-task-page .retry-status-float {
|
||||
position: fixed;
|
||||
top: 92px;
|
||||
right: 24px;
|
||||
z-index: 3001;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
display: flex;
|
||||
.billing-task-page .retry-status-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
margin-bottom: 16px;
|
||||
background: #f8f9fb;
|
||||
border-radius: 6px;
|
||||
gap: 10px;
|
||||
min-width: 200px;
|
||||
min-height: 68px;
|
||||
padding: 6px 16px 6px 7px;
|
||||
border-radius: 36px;
|
||||
}
|
||||
|
||||
.detail-header-type {
|
||||
.billing-task-page .retry-progress-ring {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 54px;
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
border-radius: 50%;
|
||||
background: conic-gradient(
|
||||
var(--el-color-primary) 0deg var(--retry-progress, 45deg),
|
||||
var(--el-color-primary-light-8) var(--retry-progress, 45deg) 360deg
|
||||
);
|
||||
}
|
||||
|
||||
.billing-task-page .retry-progress-ring::after {
|
||||
position: absolute;
|
||||
inset: 5px;
|
||||
content: '';
|
||||
border-radius: 50%;
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
|
||||
.billing-task-page .retry-progress-value {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
color: var(--el-color-primary);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.billing-task-page .retry-status-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 3px;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.billing-task-page .retry-status-text strong {
|
||||
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;
|
||||
.billing-task-page .retry-status-text small {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 11px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user