详情页面kd 展示,发布时间必填

This commit is contained in:
yml2213
2026-06-12 21:24:13 +08:00
parent f6ea3e29a6
commit 7c2f5e34c3
11 changed files with 148 additions and 5 deletions
@@ -15,6 +15,7 @@ import AuthImage from '@/shared/components/business/AuthImage.vue'
import { roundMoney, formatMoney, formatCent } from '@/shared/utils/money'
import {
assetRegions,
formatAssetNumber,
formatEstimatedRentalDuration,
formatHafCoinM,
formatListingCode,
@@ -31,6 +32,7 @@ import {
getOnlineTimeText,
getLoginMethod,
getServerRegion,
readAssetNumber,
readAssetString,
} from '@/shared/utils/listingDisplay'
@@ -95,8 +97,14 @@ const coverURL = computed(() => {
const detailMetrics = computed(() => {
if (!listing.value) return []
const dailyLoss = getDailyLoss(listing.value)
const secretKD = readAssetNumber(listing.value, 'secret_kd')
return [
{ label: '纯币', value: formatHafCoinM(getCoinWan(listing.value)), tone: 'coin' },
{
label: '绝密KD',
value: secretKD > 0 ? formatAssetNumber(secretKD) : '--',
tone: 'coin',
},
{
label: '日损耗',
value: dailyLoss ? `${dailyLoss}/天` : '--',
@@ -164,10 +172,12 @@ const detailSkinGroups = computed(() => {
const accountRows = computed(() => {
if (!listing.value) return []
const regions = assetRegions(listing.value)
const secretKD = readAssetNumber(listing.value, 'secret_kd')
return [
{ label: '所属区服', value: getServerRegion(listing.value) || '--' },
{ label: '上号方式', value: getLoginMethod(listing.value) || '--' },
{ label: '游戏段位', value: listing.value.rank_level || '--' },
{ label: '绝密KD', value: secretKD > 0 ? formatAssetNumber(secretKD) : '--' },
{ label: 'M单价', value: formatRatio(listing.value) },
{ label: '方便上号', value: getOnlineTimeText(listing.value) || '--' },
{ label: '预计可租', value: formatEstimatedRentalDuration(listing.value) },
@@ -649,7 +659,7 @@ function listingPrice(item: Listing) {
.detail-summary-row {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 14px;
}
@@ -15,6 +15,7 @@ import AuthImage from '@/shared/components/business/AuthImage.vue'
import { formatCent, formatMoney } from '@/shared/utils/money'
import {
assetRegions,
formatAssetNumber,
formatHafCoinM,
formatListingCode,
formatRatio,
@@ -29,6 +30,7 @@ import {
getListingTitle,
getLoginMethod,
getServerRegion,
readAssetNumber,
readAssetString,
} from '@/shared/utils/listingDisplay'
@@ -88,8 +90,14 @@ const orderPriceBreakdown = computed(() => {
const detailMetrics = computed(() => {
if (!listing.value) return []
const dailyLoss = getDailyLoss(listing.value)
const secretKD = readAssetNumber(listing.value, 'secret_kd')
return [
{ label: '纯币', value: formatHafCoinM(getCoinWan(listing.value)), tone: 'coin' },
{
label: '绝密KD',
value: secretKD > 0 ? formatAssetNumber(secretKD) : '--',
tone: 'coin',
},
{
label: '日损耗',
value: dailyLoss ? `${dailyLoss}/天` : '--',
@@ -345,6 +353,16 @@ async function copyListingCode() {
<span class="info-label">M单价</span>
<span class="info-text">{{ formatRatio(listing) }}</span>
</div>
<div class="info-line">
<span class="info-label">绝密KD</span>
<span class="info-text">
{{
readAssetNumber(listing, 'secret_kd') > 0
? formatAssetNumber(readAssetNumber(listing, 'secret_kd'))
: '--'
}}
</span>
</div>
<div class="info-line">
<span class="info-label">常用登录地</span>
<span class="info-text">{{ assetRegions(listing).join('、') || '--' }}</span>
@@ -642,7 +660,7 @@ async function copyListingCode() {
/* ========== 资产指标 ========== */
.metric-row {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 8px;
padding: 0 12px;
}
@@ -650,7 +668,7 @@ async function copyListingCode() {
.metric-item {
background: #fff;
border-radius: 10px;
padding: 10px 6px;
padding: 10px 4px;
text-align: center;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
@@ -357,6 +357,7 @@ function selectRadio<T extends string>(value: T, setter: (value: T) => void) {
<van-field
v-model="form.online_start"
label="在线开始"
required
type="time"
class="publish-field time-field"
@update:model-value="handleOnlineStartChange"
@@ -390,6 +391,7 @@ function selectRadio<T extends string>(value: T, setter: (value: T) => void) {
<van-field
v-model="form.online_end"
label="在线结束"
required
type="time"
class="publish-field time-field"
@update:model-value="handleOnlineEndChange"
@@ -98,6 +98,7 @@
.field-row label span,
.input-block b,
.time-preset-row strong span,
.quantity-meta span,
.upload-copy span {
color: var(--color-danger);
@@ -322,7 +322,7 @@ function selectDailyLoss(value: string | number) {
<div class="time-preset-panel">
<div class="time-preset-row">
<strong>在线开始</strong>
<strong>在线开始<span>*</span></strong>
<div class="time-preset-content">
<el-time-picker
v-model="form.online_start"
@@ -352,7 +352,7 @@ function selectDailyLoss(value: string | number) {
</div>
</div>
<div class="time-preset-row">
<strong>在线结束</strong>
<strong>在线结束<span>*</span></strong>
<div class="time-preset-content">
<el-time-picker
v-model="form.online_end"
@@ -41,6 +41,11 @@ export function formatHafCoinM(amountWan: number) {
return `${Number.isInteger(rounded) ? rounded : rounded.toFixed(1)}M`
}
export function formatAssetNumber(value: number) {
const rounded = Math.round(value * 10) / 10
return Number.isInteger(rounded) ? String(rounded) : rounded.toFixed(1)
}
export function getListingDisplayPrice(item: Listing) {
return centToYuan(item.price_cent)
}