完善本地质量门禁与资金链路测试
This commit is contained in:
@@ -46,7 +46,10 @@ import {
|
||||
} from '@/shared/utils/statusLabels'
|
||||
import { formatDateTime } from '@/shared/utils/time'
|
||||
import { formatGameName, formatListingNo } from '@/shared/utils/listingDisplay'
|
||||
import AdminOrderMetrics, { type AdminOrderMetric } from '../components/AdminOrderMetrics.vue'
|
||||
import AdminOrderPaymentRecords from '../components/AdminOrderPaymentRecords.vue'
|
||||
import ProcessTimeline from '../components/ProcessTimeline.vue'
|
||||
import { estimateOrderEndAt, paymentStatusLabel } from '../utils/adminOrderPresentation'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
@@ -255,6 +258,63 @@ const latestPayment = computed(() => {
|
||||
const paidOrderPayment = computed(() =>
|
||||
paymentRecords.value.find(item => item.biz_type === 'order_pay' && item.status === 'paid')
|
||||
)
|
||||
const orderMetricRows = computed<AdminOrderMetric[]>(() => {
|
||||
const current = order.value
|
||||
if (!current) return []
|
||||
const rows: AdminOrderMetric[] = [
|
||||
{
|
||||
key: 'order-status',
|
||||
label: '订单状态',
|
||||
value: orderStatusLabel(current.status),
|
||||
detail: orderHandoffStatusLabel(current),
|
||||
},
|
||||
{
|
||||
key: 'settlement-status',
|
||||
label: '结算状态',
|
||||
value: settlementStatusLabel(current.settlement_status),
|
||||
detail: `更新 ${formatDateTime(current.updated_at)}`,
|
||||
},
|
||||
]
|
||||
if (isPlatformManaged.value) {
|
||||
rows.push({
|
||||
key: 'offline-settlement',
|
||||
label: '线下结算',
|
||||
value: offlineSettlementStatusLabel(offlineSettlementStatus.value),
|
||||
detail: moneyCent(current.offline_settlement_amount_cent),
|
||||
})
|
||||
}
|
||||
rows.push(
|
||||
{
|
||||
key: 'total',
|
||||
label: '订单总额',
|
||||
value: moneyCent(orderTotalCent.value),
|
||||
detail: `租金 ${moneyCent(current.rent_amount_cent)} / 押金 ${moneyCent(current.deposit_amount_cent)}`,
|
||||
},
|
||||
{
|
||||
key: 'payment',
|
||||
label: '支付状态',
|
||||
value: latestPayment.value ? paymentStatusLabel(latestPayment.value.status) : '暂无流水',
|
||||
detail: paidOrderPayment.value
|
||||
? `支付 ${moneyCent(paidOrderPayment.value.amount_cent)}`
|
||||
: '尚未支付',
|
||||
},
|
||||
{
|
||||
key: 'refund',
|
||||
label: '退款状态',
|
||||
value: refundStatusLabel(refundStatus.value?.refund_status || ''),
|
||||
detail: refundStatus.value?.refund_amount_cent
|
||||
? moneyCent(refundStatus.value.refund_amount_cent)
|
||||
: '暂无退款金额',
|
||||
},
|
||||
{
|
||||
key: 'estimated-end',
|
||||
label: '预计截止',
|
||||
value: formatDateTime(orderEstimatedEndAt(), '未设置'),
|
||||
detail: `${current.estimated_duration_hours} 小时`,
|
||||
}
|
||||
)
|
||||
return rows
|
||||
})
|
||||
const currentSnapshot = computed(() => readSnapshot(order.value))
|
||||
const snapshotHafCoinM = computed(() => getSnapshotHafCoinM(order.value))
|
||||
const checkoutRemainingHafCoinM = computed(() => {
|
||||
@@ -695,12 +755,11 @@ function orderRentedAt() {
|
||||
}
|
||||
|
||||
function orderEstimatedEndAt() {
|
||||
if (!order.value) return undefined
|
||||
if (order.value.estimated_end_at) return order.value.estimated_end_at
|
||||
const rentedAt = orderRentedAt()
|
||||
const durationHours = Number(order.value.estimated_duration_hours || 0)
|
||||
if (!rentedAt || durationHours <= 0) return undefined
|
||||
return new Date(new Date(rentedAt).getTime() + durationHours * 60 * 60 * 1000).toISOString()
|
||||
return estimateOrderEndAt(
|
||||
order.value?.estimated_end_at,
|
||||
orderRentedAt(),
|
||||
Number(order.value?.estimated_duration_hours || 0)
|
||||
)
|
||||
}
|
||||
|
||||
async function handleRefund() {
|
||||
@@ -739,39 +798,6 @@ async function confirmRefund() {
|
||||
await handleRefund()
|
||||
}
|
||||
|
||||
function paymentStatusLabel(status: string) {
|
||||
const map: Record<string, string> = {
|
||||
created: '已创建',
|
||||
paying: '支付中',
|
||||
paid: '已支付',
|
||||
refunding: '退款中',
|
||||
refunded: '已退款',
|
||||
failed: '失败',
|
||||
}
|
||||
return map[status] || status
|
||||
}
|
||||
|
||||
function paymentStatusType(status: string) {
|
||||
if (['paid', 'refunded'].includes(status)) return 'success'
|
||||
if (status === 'failed') return 'danger'
|
||||
if (['paying', 'refunding'].includes(status)) return 'warning'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
function paymentBizTypeLabel(type: string) {
|
||||
const map: Record<string, string> = {
|
||||
order_pay: '订单支付',
|
||||
checkout_refund: '结账退款',
|
||||
arbitration_refund: '仲裁退款',
|
||||
admin_refund: '人工退款',
|
||||
cancel_refund: '取消退款',
|
||||
admin_close_refund: '客服关闭退款',
|
||||
admin_seal_refund: '封存退款',
|
||||
deposit_refund: '暂扣押金归还',
|
||||
}
|
||||
return map[type] || type
|
||||
}
|
||||
|
||||
function moneyCent(value: number | undefined | null) {
|
||||
return formatCentWithSymbol(Number(value || 0))
|
||||
}
|
||||
@@ -943,10 +969,6 @@ function formatRatioNumber(value: number) {
|
||||
const rounded = Math.round(value * 100) / 100
|
||||
return Number.isInteger(rounded) ? `${rounded}` : rounded.toFixed(2)
|
||||
}
|
||||
|
||||
function paymentPaidAt(record: AdminPayment) {
|
||||
return record.paid_at || record.updated_at || record.created_at
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -1053,48 +1075,7 @@ function paymentPaidAt(record: AdminPayment) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="order" class="metric-grid dashboard-metrics order-metrics">
|
||||
<div class="metric-card">
|
||||
<span>订单状态</span>
|
||||
<strong>{{ orderStatusLabel(order.status) }}</strong>
|
||||
<small>{{ orderHandoffStatusLabel(order) }}</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>结算状态</span>
|
||||
<strong>{{ settlementStatusLabel(order.settlement_status) }}</strong>
|
||||
<small>更新 {{ formatDateTime(order.updated_at) }}</small>
|
||||
</div>
|
||||
<div v-if="isPlatformManaged" class="metric-card">
|
||||
<span>线下结算</span>
|
||||
<strong>{{ offlineSettlementStatusLabel(offlineSettlementStatus) }}</strong>
|
||||
<small>{{ moneyCent(order.offline_settlement_amount_cent) }}</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>订单总额</span>
|
||||
<strong>{{ moneyCent(orderTotalCent) }}</strong>
|
||||
<small
|
||||
>租金 {{ moneyCent(order.rent_amount_cent) }} / 押金
|
||||
{{ moneyCent(order.deposit_amount_cent) }}</small
|
||||
>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>支付状态</span>
|
||||
<strong>{{ latestPayment ? paymentStatusLabel(latestPayment.status) : '暂无流水' }}</strong>
|
||||
<small v-if="paidOrderPayment">支付 {{ moneyCent(paidOrderPayment.amount_cent) }}</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>退款状态</span>
|
||||
<strong>{{ refundStatusLabel(refundStatus?.refund_status || '') }}</strong>
|
||||
<small v-if="refundStatus?.refund_amount_cent">
|
||||
{{ moneyCent(refundStatus.refund_amount_cent) }}
|
||||
</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>预计截止</span>
|
||||
<strong>{{ formatDateTime(orderEstimatedEndAt(), '未设置') }}</strong>
|
||||
<small>{{ order.estimated_duration_hours }} 小时</small>
|
||||
</div>
|
||||
</div>
|
||||
<AdminOrderMetrics v-if="order" :rows="orderMetricRows" />
|
||||
|
||||
<div v-if="order" class="order-detail-grid">
|
||||
<section class="dashboard-panel detail-panel">
|
||||
@@ -1409,38 +1390,7 @@ function paymentPaidAt(record: AdminPayment) {
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="dashboard-panel detail-panel order-wide-panel">
|
||||
<div class="panel-heading">
|
||||
<h2>支付与退款流水</h2>
|
||||
<span class="panel-subtitle">共 {{ paymentRecords.length }} 条</span>
|
||||
</div>
|
||||
<el-empty v-if="paymentRecords.length === 0" description="暂无支付流水" />
|
||||
<div v-else class="record-list">
|
||||
<article v-for="record in paymentRecords" :key="record.id" class="record-item">
|
||||
<div class="record-main">
|
||||
<strong>
|
||||
{{ paymentBizTypeLabel(record.biz_type) }} · {{ moneyCent(record.amount_cent) }}
|
||||
</strong>
|
||||
<el-tag :type="paymentStatusType(record.status)" size="small" effect="light">
|
||||
{{ paymentStatusLabel(record.status) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="record-meta">
|
||||
<span>流水号:{{ record.payment_no }}</span>
|
||||
<span>用户:{{ record.user_phone || record.user_id }}</span>
|
||||
<span>渠道:{{ record.provider || '-' }}</span>
|
||||
<span>商户:{{ record.merchant_id || '-' }}</span>
|
||||
<span>三方单号:{{ record.third_order_id || '-' }}</span>
|
||||
<span>渠道单号:{{ record.provider_order_id || '-' }}</span>
|
||||
<span>创建:{{ formatDateTime(record.created_at) }}</span>
|
||||
<span>完成:{{ formatDateTime(paymentPaidAt(record), '-') }}</span>
|
||||
</div>
|
||||
<p v-if="record.error_message" class="danger-text">
|
||||
{{ record.error_code }} {{ record.error_message }}
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
<AdminOrderPaymentRecords :records="paymentRecords" />
|
||||
|
||||
<section class="dashboard-panel detail-panel order-wide-panel">
|
||||
<div class="panel-heading">
|
||||
@@ -1754,323 +1704,4 @@ function paymentPaidAt(record: AdminPayment) {
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.order-metrics {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.order-metrics .metric-card strong {
|
||||
font-size: 20px;
|
||||
line-height: 1.25;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.metric-card small {
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
color: #8f9bba;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.platform-handoff-button {
|
||||
min-width: 96px;
|
||||
border-color: #2563eb;
|
||||
background: #2563eb;
|
||||
color: #ffffff;
|
||||
font-weight: 700;
|
||||
box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
|
||||
}
|
||||
|
||||
.platform-handoff-button:hover,
|
||||
.platform-handoff-button:focus {
|
||||
border-color: #1d4ed8;
|
||||
background: #1d4ed8;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.platform-handoff-button:active {
|
||||
border-color: #1e40af;
|
||||
background: #1e40af;
|
||||
}
|
||||
|
||||
.order-detail-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
|
||||
gap: 20px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.detail-panel {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.order-wide-panel {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.panel-heading {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.panel-heading h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.panel-subtitle {
|
||||
color: #8f9bba;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.status-tags,
|
||||
.snapshot-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.detail-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px 18px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.detail-list div {
|
||||
min-width: 0;
|
||||
border-top: 1px solid #f0f2f5;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.detail-list .wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.detail-list dt {
|
||||
margin-bottom: 5px;
|
||||
color: #8f9bba;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.detail-list dd {
|
||||
margin: 0;
|
||||
color: #1b2559;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
line-height: 1.5;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.money-list {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.money-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
border-top: 1px solid #f0f2f5;
|
||||
padding-top: 9px;
|
||||
color: #52616f;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.money-row strong {
|
||||
color: #1b2559;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.money-row.total {
|
||||
margin-top: 4px;
|
||||
border-top-color: #d8e2f0;
|
||||
color: #1b2559;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.money-row.total strong {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.record-list {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.record-item {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
border: 1px solid #eef2f7;
|
||||
border-radius: 8px;
|
||||
background: #fbfcff;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.record-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.record-main strong {
|
||||
color: #1b2559;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.record-main span {
|
||||
color: #8f9bba;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.record-meta {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||
gap: 6px 12px;
|
||||
color: #52616f;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.record-item p {
|
||||
margin: 0;
|
||||
color: #52616f;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.snapshot-detail-list {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.ratio-row {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
margin-bottom: 14px;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid #eef2f7;
|
||||
border-radius: 8px;
|
||||
background: #fbfcff;
|
||||
}
|
||||
|
||||
.ratio-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.ratio-label {
|
||||
font-size: 12px;
|
||||
color: #8f9bba;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ratio-value {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #1b2559;
|
||||
}
|
||||
|
||||
.snapshot-tags {
|
||||
justify-content: flex-start;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.snapshot-resources {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||
gap: 10px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.resource-item {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
border: 1px solid #eef2f7;
|
||||
border-radius: 8px;
|
||||
background: #fbfcff;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.resource-item strong {
|
||||
color: #1b2559;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.resource-item span {
|
||||
color: #52616f;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.snapshot-json {
|
||||
overflow-x: auto;
|
||||
max-height: 360px;
|
||||
margin: 0;
|
||||
border-radius: 8px;
|
||||
background: #111827;
|
||||
color: #dbe4ee;
|
||||
padding: 14px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.dialog-body {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.dialog-body p {
|
||||
margin: 0;
|
||||
color: #52616f;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.form-grid label {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
color: #52616f;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.form-grid :deep(.el-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.order-detail-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.panel-heading,
|
||||
.record-main {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.detail-list {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.status-tags {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style scoped src="./AdminOrderDetailView.css"></style>
|
||||
|
||||
Reference in New Issue
Block a user