管理员界面订单详情优化,增加比例和额外物品

This commit is contained in:
yml2213
2026-06-22 19:05:41 +08:00
parent 23dbe9af22
commit d7c5701cc0
@@ -102,6 +102,25 @@ const paidOrderPayment = computed(() =>
const currentSnapshot = computed(() => readSnapshot(order.value)) const currentSnapshot = computed(() => readSnapshot(order.value))
const snapshotHafCoinM = computed(() => getSnapshotHafCoinM(order.value)) const snapshotHafCoinM = computed(() => getSnapshotHafCoinM(order.value))
const snapshotResources = computed(() => readSnapshotResources(order.value).slice(0, 6)) const snapshotResources = computed(() => readSnapshotResources(order.value).slice(0, 6))
const assetSummary = computed(() => {
const snapshot = order.value?.account_snapshot
if (typeof snapshot !== 'object' || snapshot === null) return null
const summary = (snapshot as Record<string, unknown>).asset_summary
if (typeof summary !== 'object' || summary === null) return null
return summary as Record<string, unknown>
})
const snapshotRatio = computed(() => {
const breakdown = assetSummary.value?.price_breakdown
if (typeof breakdown !== 'object' || breakdown === null) return null
const row = breakdown as Record<string, unknown>
const sellerRatio = Number(row.seller_ratio || 0)
const buyerRatio = Number(row.buyer_ratio || 0)
const publishRatio = Number(assetSummary.value?.publish_ratio || 0)
return {
recycleRatio: sellerRatio > 0 ? sellerRatio : publishRatio > 0 ? publishRatio : 0,
sellRatio: buyerRatio > 0 ? buyerRatio : 0,
}
})
const snapshotSeasonTags = computed(() => { const snapshotSeasonTags = computed(() => {
const tags = currentSnapshot.value?.season_tags const tags = currentSnapshot.value?.season_tags
return Array.isArray(tags) ? tags.map(item => String(item)).filter(Boolean) : [] return Array.isArray(tags) ? tags.map(item => String(item)).filter(Boolean) : []
@@ -371,6 +390,11 @@ function quantity(value: unknown) {
}) })
} }
function formatRatioNumber(value: number) {
const rounded = Math.round(value * 100) / 100
return Number.isInteger(rounded) ? `${rounded}` : rounded.toFixed(2)
}
function paymentPaidAt(record: AdminPayment) { function paymentPaidAt(record: AdminPayment) {
return record.paid_at || record.updated_at || record.created_at return record.paid_at || record.updated_at || record.created_at
} }
@@ -741,6 +765,16 @@ function paymentPaidAt(record: AdminPayment) {
<dd>{{ item.value }}</dd> <dd>{{ item.value }}</dd>
</div> </div>
</dl> </dl>
<div v-if="snapshotRatio && (snapshotRatio.recycleRatio > 0 || snapshotRatio.sellRatio > 0)" class="ratio-row">
<div v-if="snapshotRatio.recycleRatio > 0" class="ratio-item">
<span class="ratio-label">回收比例</span>
<strong class="ratio-value">1:{{ formatRatioNumber(snapshotRatio.recycleRatio) }}</strong>
</div>
<div v-if="snapshotRatio.sellRatio > 0" class="ratio-item">
<span class="ratio-label">售卖比例</span>
<strong class="ratio-value">1:{{ formatRatioNumber(snapshotRatio.sellRatio) }}</strong>
</div>
</div>
<div v-if="snapshotSeasonTags.length" class="snapshot-tags"> <div v-if="snapshotSeasonTags.length" class="snapshot-tags">
<el-tag v-for="tag in snapshotSeasonTags" :key="tag" size="small" effect="plain"> <el-tag v-for="tag in snapshotSeasonTags" :key="tag" size="small" effect="plain">
{{ tag }} {{ tag }}
@@ -959,6 +993,34 @@ function paymentPaidAt(record: AdminPayment) {
margin-bottom: 14px; 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 { .snapshot-tags {
justify-content: flex-start; justify-content: flex-start;
margin-bottom: 14px; margin-bottom: 14px;