fix: show wheel resource prices
This commit is contained in:
parent
6d0daf6919
commit
9ce6b450c1
@ -186,6 +186,17 @@ function normalizeSourceItem(
|
||||
};
|
||||
}
|
||||
|
||||
function formatSourcePrice(amount: number | string | undefined) {
|
||||
if (amount === undefined || amount === null || String(amount).trim() === '') {
|
||||
return '-';
|
||||
}
|
||||
const value = Number(amount);
|
||||
if (Number.isFinite(value)) {
|
||||
return `${value.toLocaleString()} 金币`;
|
||||
}
|
||||
return `${amount} 金币`;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
(open) => {
|
||||
@ -342,6 +353,7 @@ function handleSelect(item: SourceItem) {
|
||||
</div>
|
||||
<div class="source-name">{{ item.name || '-' }}</div>
|
||||
<div class="source-meta">ID {{ item.id }}</div>
|
||||
<div class="source-price">价格 {{ formatSourcePrice(item.amount) }}</div>
|
||||
</button>
|
||||
</div>
|
||||
<Empty v-else description="暂无可选资源" />
|
||||
@ -401,10 +413,16 @@ function handleSelect(item: SourceItem) {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.source-meta {
|
||||
.source-meta,
|
||||
.source-price {
|
||||
color: #64748b;
|
||||
font-size: 12px;
|
||||
margin-top: 6px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.source-price {
|
||||
color: #0f172a;
|
||||
font-weight: 600;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -432,6 +432,7 @@ function normalizeSelectedResource(row: Record<string, any>, fallbackType = 'AVA
|
||||
'remark',
|
||||
]) || (resourceId ? `资源 ${resourceId}` : ''),
|
||||
),
|
||||
resourcePriceGold: Number(firstPresent(row, ['amount', 'giftCandy', 'price', 'goldAmount']) || 0),
|
||||
resourceType: String(
|
||||
firstPresent(row, ['type', 'resourceType', 'propsType']) || fallbackType || 'AVATAR_FRAME',
|
||||
),
|
||||
@ -500,7 +501,10 @@ function handleResourceSelect(row: Record<string, any>) {
|
||||
target.resourceName = selected.resourceName;
|
||||
target.resourceUrl = selected.resourceUrl;
|
||||
target.coverUrl = selected.coverUrl || target.coverUrl || '';
|
||||
target.displayGoldAmount = Number(target.displayGoldAmount || 0);
|
||||
target.displayGoldAmount =
|
||||
selected.resourcePriceGold > 0
|
||||
? selected.resourcePriceGold
|
||||
: Number(target.displayGoldAmount || 0);
|
||||
target.durationDays = Number(target.durationDays || 7);
|
||||
target.goldAmount = 0;
|
||||
closeResourcePicker();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user