feat(consignment): 未售出时长支持一位小数,改价上限按当前模板价实时计算

This commit is contained in:
2026-11-08 12:23:33 +08:00
parent 1773fe7837
commit ac2411ab6e
8 changed files with 151 additions and 13 deletions
@@ -1865,13 +1865,14 @@ export default function ConsignmentConfigPanel() {
{priceDropEnabled ? (
<>
<Form.Item
label="未售出时长(小时)"
label="未售出时长(小时,可填一位小数)"
name={['priceDrop', 'hours']}
style={{ marginBottom: 0 }}
>
<InputNumber
min={1}
precision={0}
min={0.1}
step={0.5}
precision={1}
style={{ width: '100%' }}
addonAfter="小时"
/>
@@ -1920,6 +1920,15 @@ function ConsignmentRecordCard({
{record.priceCapFen && record.priceCapFen > 0 ? (
<Typography.Text type="secondary" style={{ display: 'block', marginTop: 8 }}>
最高不能超过系统建议单价 ¥{(record.priceCapFen / 100).toFixed(2)}
(按当前模板价实时计算)
</Typography.Text>
) : null}
{record.priceCapFen &&
record.priceCapFen > 0 &&
Number(record.salePriceFen ?? record.askingPriceFen) > record.priceCapFen ? (
<Typography.Text type="warning" style={{ display: 'block', marginTop: 4 }}>
当前售价 ¥{((record.salePriceFen ?? record.askingPriceFen) / 100).toFixed(2)}
高于最新模板价,保存前请先下调到 ¥{(record.priceCapFen / 100).toFixed(2)} 以内
</Typography.Text>
) : null}
{Number(record.quantity || 1) > 1 ? (
@@ -115,3 +115,12 @@ test('打手端:动态规格 + 系统建议价 + 改价不得高于建议价',
assert.ok(page.includes('specValues'), '发布必须提交动态规格值')
assert.ok(page.includes('config.pricing.allowWorkerPrice'), '改价能力必须按配置')
})
test('寄卖配置:未售出时长支持一位小数', () => {
const panel = read('../src/pages/admin/panels/ConsignmentConfigPanel.tsx')
const start = panel.indexOf("name={['priceDrop', 'hours']}")
assert.ok(start > 0, '必须存在未售出时长配置')
const block = panel.slice(start, panel.indexOf('</Form.Item>', start))
assert.ok(block.includes('precision={1}'), '未售出时长必须支持一位小数')
assert.ok(block.includes('min={0.1}'), '未售出时长下限应为 0.1 小时')
})
@@ -115,4 +115,6 @@ test('打手端价格按单价展示并给出合计,避免把单价误读成
page.includes('最高不能超过系统建议单价'),
'改价上限提示必须按单价口径,不能再说成整单建议价',
)
assert.ok(page.includes('按当前模板价实时计算'), '改价上限必须标明按当前模板价实时计算')
assert.ok(page.includes('高于最新模板价'), '当前售价高于模板价时必须提示先下调')
})