统一金额分制重构

This commit is contained in:
yml
2026-06-09 19:04:11 +08:00
parent 87673288ef
commit 5cd3ead4bd
69 changed files with 886 additions and 1277 deletions
@@ -19,8 +19,8 @@ export interface Listing {
asset_summary?: Record<string, unknown>
screenshot_urls: string[]
cover_url: string
price: number
deposit_amount: number
price_cent: number
deposit_amount_cent: number
is_accelerated_sale?: boolean
in_transaction: boolean
status: ListingStatus
@@ -40,8 +40,8 @@ export interface ListingPayload {
haf_coin_amount: number
asset_summary?: Record<string, unknown>
screenshot_urls: string[]
price: number
deposit_amount: number
price_cent: number
deposit_amount_cent: number
agreed_virtual_asset_sale: boolean
agreed_seller_agreement: boolean
}
@@ -214,7 +214,7 @@ export async function approveListing(id: number) {
export interface AdminListingPriceAdjustPayload {
buyer_ratio?: number
buyer_total_price?: number
buyer_total_price_cent?: number
reason?: string
}
@@ -2,7 +2,7 @@
import { computed } from 'vue'
import { RouterLink } from 'vue-router'
import type { Listing } from '@/features/listings'
import { formatMoney } from '@/shared/utils/money'
import { formatCent, formatMoney } from '@/shared/utils/money'
import {
formatHafCoinM,
getCoinWan,
@@ -140,7 +140,7 @@ function formatStatNumber(value: number) {
</div>
<div class="price-item deposit">
<small>押金</small>
<span>¥{{ formatMoney(listing.deposit_amount) }}</span>
<span>¥{{ formatCent(listing.deposit_amount_cent) }}</span>
</div>
<div class="price-action">
<button class="rent-btn">立即租用</button>
@@ -11,7 +11,7 @@ import {
} from '@/features/orders/api/orders'
import { useSessionStore } from '@/stores/session'
import AuthImage from '@/shared/components/business/AuthImage.vue'
import { roundMoney, formatMoney } from '@/shared/utils/money'
import { roundMoney, formatMoney, formatCent } from '@/shared/utils/money'
import {
assetRegions,
formatEstimatedRentalDuration,
@@ -102,7 +102,7 @@ const detailMetrics = computed(() => {
tone: 'coin',
},
{ label: '价格', value: `¥${orderTotal.value}`, tone: 'price' },
{ label: '押金', value: `¥${formatMoney(listing.value.deposit_amount)}`, tone: '' },
{ label: '押金', value: `¥${formatCent(listing.value.deposit_amount_cent)}`, tone: '' },
]
})
@@ -465,7 +465,7 @@ function listingPrice(item: Listing) {
<strong>¥{{ formatMoney(orderPriceBreakdown.consumable) }}</strong>
</div>
</div>
<em>押金另付 ¥{{ formatMoney(listing.deposit_amount) }}</em>
<em>押金另付 ¥{{ formatCent(listing.deposit_amount_cent) }}</em>
</div>
<dl class="order-check-list">
<div>
@@ -6,7 +6,7 @@ import {
type ListingPublishOptions,
} from '@/features/listings/api/listingOptions'
import { fetchListings, type Listing } from '@/features/listings/api/listings'
import { formatMoney } from '@/shared/utils/money'
import { centToYuan, formatCent, formatMoney } from '@/shared/utils/money'
import {
defaultHomeAnnouncements,
defaultHomeBanners,
@@ -347,7 +347,7 @@ function matchesFilters(item: Listing) {
if (key === 'price') value = getListingDisplayPrice(item)
if (key === 'coin') value = getCoinM(item)
if (key === 'secretKd') value = readAssetNumber(item, 'secret_kd')
if (key === 'deposit') value = Number(item.deposit_amount || 0)
if (key === 'deposit') value = centToYuan(item.deposit_amount_cent)
if (key.startsWith('resource_')) {
value = getResourceQuantity(item, key.replace('resource_', ''))
}
@@ -622,7 +622,7 @@ function parseQuantityUnit(price: string) {
</div>
<div class="resource-price-box">
<strong>¥{{ formatMoney(getListingDisplayPrice(item)) }}</strong>
<span class="rent-sub">押金¥{{ formatMoney(item.deposit_amount) }}</span>
<span class="rent-sub">押金¥{{ formatCent(item.deposit_amount_cent) }}</span>
</div>
</RouterLink>
</div>
@@ -5,7 +5,7 @@ import { showToast } from 'vant'
import MobileBottomNav from '@/components/MobileBottomNav.vue'
import { ensureSupportChat } from '@/features/chats/api/chats'
import { formatMoney } from '@/shared/utils/money'
import { formatCent, formatMoney } from '@/shared/utils/money'
import {
emptyListingPublishOptions,
type ListingPublishOptions,
@@ -697,7 +697,7 @@ function chipTone(label: string) {
<div class="card-footer">
<div class="price-col">
<strong>¥{{ formatMoney(getListingDisplayPrice(item)) }}</strong>
<span class="rent-sub">押金 ¥{{ formatMoney(item.deposit_amount) }}</span>
<span class="rent-sub">押金 ¥{{ formatCent(item.deposit_amount_cent) }}</span>
</div>
</div>
</div>
@@ -11,7 +11,7 @@ import {
} from '@/features/orders/api/orders'
import { useSessionStore } from '@/stores/session'
import AuthImage from '@/shared/components/business/AuthImage.vue'
import { formatMoney } from '@/shared/utils/money'
import { formatCent, formatMoney } from '@/shared/utils/money'
import {
assetRegions,
formatHafCoinM,
@@ -95,7 +95,7 @@ const detailMetrics = computed(() => {
tone: 'coin',
},
{ label: '价格', value: `¥${formatMoney(getListingDisplayPrice(listing.value))}`, tone: 'price' },
{ label: '押金', value: `¥${formatMoney(listing.value.deposit_amount)}`, tone: '' },
{ label: '押金', value: `¥${formatCent(listing.value.deposit_amount_cent)}`, tone: '' },
]
})