发布界面优化
This commit is contained in:
@@ -46,14 +46,19 @@ export function getRatioValue(item: Listing) {
|
||||
}
|
||||
|
||||
export function formatRatio(item: Listing) {
|
||||
const ratio = getRatioValue(item);
|
||||
return ratio > 0 ? `1:${Math.round(ratio)}` : "--";
|
||||
const pricePerM = getPricePerM(item);
|
||||
return pricePerM > 0 ? `1M=¥${formatMoney(pricePerM)}` : "--";
|
||||
}
|
||||
|
||||
export function getValuePerYuanText(item: Listing) {
|
||||
const price = getListingDisplayPrice(item);
|
||||
if (price <= 0) return "";
|
||||
return `1元=${Math.round(getCoinWan(item) / price)}w哈夫币`;
|
||||
const pricePerM = getPricePerM(item);
|
||||
return pricePerM > 0 ? `1M=¥${formatMoney(pricePerM)}` : "";
|
||||
}
|
||||
|
||||
export function getPricePerM(item: Listing) {
|
||||
const coinM = getCoinM(item);
|
||||
if (coinM <= 0) return 0;
|
||||
return roundMoney(getListingDisplayPrice(item) / coinM);
|
||||
}
|
||||
|
||||
export function getLoginMethod(item: Listing) {
|
||||
@@ -219,3 +224,8 @@ function formatResourceShort(item: Listing, key: string, label: string) {
|
||||
function roundMoney(value: number) {
|
||||
return Math.round(value * 100) / 100;
|
||||
}
|
||||
|
||||
function formatMoney(value: number) {
|
||||
const rounded = roundMoney(value);
|
||||
return Number.isInteger(rounded) ? `${rounded}` : rounded.toFixed(2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user