总价分开展示,展示纯币价格+额外消耗价格

This commit is contained in:
yml2213
2026-05-23 18:59:07 +08:00
parent d661a22b8a
commit 9cec71ab1a
3 changed files with 43 additions and 5 deletions
@@ -84,7 +84,7 @@ func DefaultPublishOptions() PublishOptionsDTO {
FireLevelMin: 38, FireLevelMin: 38,
PriceConfig: PublishPriceConfig{ PriceConfig: PublishPriceConfig{
DepositPlaceholder: "温馨提示:本押金用于保障账号安全。若买家在租用期间,使用非纯币类道具/资源(如消耗品、材料等)或导致账号被封禁,相关损失将直接从押金中扣除进行赔付。押金过高会延长出租等待时间(请自行衡量)感谢理解。", DepositPlaceholder: "温馨提示:本押金用于保障账号安全。若买家在租用期间,使用非纯币类道具/资源(如消耗品、材料等)或导致账号被封禁,相关损失将直接从押金中扣除进行赔付。押金过高会延长出租等待时间(请自行衡量)感谢理解。",
PricePlaceholder: "填写币数、保险、体力和负重后自动计算", PricePlaceholder: "填写币数、保险、体力和负重后自动计算;发布总价=纯币基础价+额外消耗品",
RatioDescription: "1:xx 表示 1 元人民币(RMB)等价兑换 xx 万哈夫币", RatioDescription: "1:xx 表示 1 元人民币(RMB)等价兑换 xx 万哈夫币",
}, },
RatioConfig: PublishRatioConfig{ RatioConfig: PublishRatioConfig{
@@ -498,6 +498,17 @@
font-weight: 800; font-weight: 800;
} }
.total-price-field :deep(.van-field__control) {
font-size: 16px;
}
.price-breakdown-hint {
margin: -2px 0 10px;
color: #858c96;
font-size: 11px;
line-height: 1.5;
}
.publish-actions { .publish-actions {
display: grid; display: grid;
grid-template-columns: 92px minmax(0, 1fr); grid-template-columns: 92px minmax(0, 1fr);
@@ -128,10 +128,13 @@ const screenshotUrls = computed(() =>
const coinMAmount = computed(() => Number(form.haf_coin_amount || 0)); const coinMAmount = computed(() => Number(form.haf_coin_amount || 0));
const coinWanAmount = computed(() => coinMAmount.value * 100); const coinWanAmount = computed(() => coinMAmount.value * 100);
const calculatedRatio = computed(() => calculatePublishRatio()); const calculatedRatio = computed(() => calculatePublishRatio());
const calculatedCoinBasePrice = computed(() =>
calculatedRatio.value > 0 ? roundMoney(coinWanAmount.value / calculatedRatio.value) : 0
);
const calculatedConsumablePrice = computed(() => calculateConsumablePrice()); const calculatedConsumablePrice = computed(() => calculateConsumablePrice());
const calculatedFinalPrice = computed(() => const calculatedFinalPrice = computed(() =>
calculatedRatio.value > 0 calculatedRatio.value > 0
? roundMoney(coinWanAmount.value / calculatedRatio.value + calculatedConsumablePrice.value) ? roundMoney(calculatedCoinBasePrice.value + calculatedConsumablePrice.value)
: 0 : 0
); );
const calculatedRatioText = computed(() => const calculatedRatioText = computed(() =>
@@ -439,12 +442,19 @@ function buildAssetSummary() {
secret_kd: form.secret_kd, secret_kd: form.secret_kd,
fire_level: Number(form.fire_level), fire_level: Number(form.fire_level),
publish_ratio: calculatedRatio.value, publish_ratio: calculatedRatio.value,
price_breakdown: {
coin_base_price: calculatedCoinBasePrice.value,
consumable_price: calculatedConsumablePrice.value,
final_price: calculatedFinalPrice.value,
ratio: calculatedRatio.value,
},
season_insurance: form.season_insurance, season_insurance: form.season_insurance,
stamina_level: form.stamina_level, stamina_level: form.stamina_level,
load_level: form.load_level, load_level: form.load_level,
resources: quantityItems.value.map((item) => ({ resources: quantityItems.value.map((item) => ({
key: item.key, key: item.key,
label: item.label, label: item.label,
price: item.price,
quantity: Number(quantityValues[item.key] || 0), quantity: Number(quantityValues[item.key] || 0),
mode: quantityModes[item.key] || "收费", mode: quantityModes[item.key] || "收费",
})), })),
@@ -921,18 +931,35 @@ function readError(error: unknown, fallback: string) {
</template> </template>
</van-field> </van-field>
<van-field <van-field
:model-value="calculatedFinalPrice ? `¥${calculatedFinalPrice}` : ''" :model-value="calculatedCoinBasePrice ? `¥${calculatedCoinBasePrice}` : ''"
label="价" label="纯币基础价"
readonly readonly
required required
:placeholder="priceConfig.price_placeholder" :placeholder="priceConfig.price_placeholder"
class="publish-field result-field" class="publish-field result-field"
> >
<template #label> <template #label>
<span class="hint-label" :data-hint="priceConfig.price_placeholder" tabindex="0"></span> <span class="hint-label" :data-hint="priceConfig.price_placeholder" tabindex="0">纯币基础</span>
</template> </template>
</van-field> </van-field>
<van-field
:model-value="`¥${calculatedConsumablePrice}`"
label="额外消耗品"
readonly
class="publish-field result-field"
/>
<van-field
:model-value="calculatedFinalPrice ? `¥${calculatedFinalPrice}` : ''"
label="发布总价"
readonly
required
:placeholder="priceConfig.price_placeholder"
class="publish-field result-field total-price-field"
/>
</div> </div>
<p class="price-breakdown-hint">
发布总价 = 纯币基础价 + 额外消耗品只有标记为收费的消耗品会计入价格
</p>
<van-field <van-field
v-model="form.remark" v-model="form.remark"