This commit is contained in:
2026-04-23 11:49:28 +08:00
parent 1e82051ca5
commit 59471a655c
9 changed files with 112 additions and 437 deletions

View File

@@ -11,8 +11,8 @@
<div class="border-b border-gray-200">
<wd-input v-model="price" type="number" label="¥" label-width="28px" size="large"
:placeholder="`${productConfig.price_range_min} - ${productConfig.price_range_max}`"
@blur="onBlurPrice" custom-class="wd-input" />
:placeholder="priceRangePlaceholder" @blur="onBlurPrice"
custom-class="wd-input" />
</div>
<div class="flex items-center justify-between mt-2">
<div>推广收益为<span class="text-orange-500"> {{ promotionRevenue }} </span></div>
@@ -26,8 +26,8 @@
<div>我的成本 = 提价成本 + 底价成本</div>
<div class="mt-1">提价成本超过平台标准定价部分平台会收取部分成本价</div>
<div class="">设定范围<span class="text-orange-500">{{
productConfig.price_range_min }}</span> - <span class="text-orange-500">{{
productConfig.price_range_max }}</span></div>
productConfig?.price_range_min ?? '--' }}</span> - <span class="text-orange-500">{{
productConfig?.price_range_max ?? '--' }}</span></div>
</div>
<div class="px-4 pb-4">
<wd-button class="w-full" round type="primary" size="large" @click="onConfirm">确认</wd-button>
@@ -60,6 +60,13 @@ watch(show, () => {
price.value = defaultPrice.value
})
const priceRangePlaceholder = computed(() => {
const min = productConfig.value?.price_range_min
const max = productConfig.value?.price_range_max
if (min === undefined || max === undefined) return '请输入价格'
return `${min} - ${max}`
})
const costPrice = computed(() => {
if (!productConfig.value) return 0.00
// 平台定价成本
@@ -88,6 +95,9 @@ const promotionRevenue = computed(() => {
// 价格校验与修正逻辑
const validatePrice = (currentPrice) => {
if (!productConfig.value) {
return { newPrice: Number(defaultPrice.value || 0), message: '当前产品配置不可用,请重新选择报告类型' }
}
const min = productConfig.value.price_range_min;
const max = productConfig.value.price_range_max;
let newPrice = Number(currentPrice);
@@ -108,7 +118,7 @@ const validatePrice = (currentPrice) => {
newPrice = parseFloat(safeTruncate(newPrice));
message = '价格已自动格式化为两位小数';
}
} catch {}
} catch { }
// 范围校验(基于可能格式化后的值)
if (newPrice < min) {
@@ -159,17 +169,22 @@ const onBlurPrice = () => {
display: flex !important;
align-items: center !important;
justify-content: center !important;
:deep(.wd-input__label-inner) {
font-size: 24px !important; /* 增大label字体 */
font-size: 24px !important;
/* 增大label字体 */
}
:deep(.wd-input__inner) {
font-size: 24px !important; /* 增大输入框内字体 */
font-size: 24px !important;
/* 增大输入框内字体 */
}
:deep(.wd-input) {
height: auto !important; /* 确保高度自适应 */
padding: 8px 0 !important; /* 增加垂直内边距 */
height: auto !important;
/* 确保高度自适应 */
padding: 8px 0 !important;
/* 增加垂直内边距 */
}
}
</style>