feat(consignment): 寄售数量支持关闭修改,固定为 1

This commit is contained in:
2026-11-07 13:46:28 +08:00
parent 6e3eb9669b
commit 8758270591
6 changed files with 105 additions and 19 deletions
@@ -1134,11 +1134,12 @@ export default function ConsignmentConfigPanel() {
<Input placeholder="展示在发布页顶部的一句话说明" />
</Form.Item>
<Form.Item
label="显示寄售数量"
label="允许修改寄售数量"
name={['fields', 'quantity']}
valuePropName="checked"
extra="关闭后打手端数量固定为 1,输入框禁用"
>
<Switch checkedChildren="显示" unCheckedChildren="隐藏" />
<Switch checkedChildren="可改" unCheckedChildren="固定 1" />
</Form.Item>
</div>
<Form.Item
@@ -245,7 +245,9 @@ export default function WorkerConsignmentPage() {
finished: 0,
}
const watchedQuantity = Form.useWatch('quantity', form)
const quantityForDeposit = Math.max(1, Number(watchedQuantity || 1))
// 「允许修改寄售数量」关闭时:数量固定 1、输入框禁用,价格/押金一律按 1 件计算。
const quantityLocked = selectedProfile?.config.fields.quantity === false
const quantityForDeposit = quantityLocked ? 1 : Math.max(1, Number(watchedQuantity || 1))
const publishDepositFen = selectedProfile?.config.deposit.enabled
? selectedProfile.config.deposit.mode === 'per_quantity'
? Math.max(0, selectedProfile.config.deposit.unitAmountFen) * quantityForDeposit
@@ -862,11 +864,7 @@ export default function WorkerConsignmentPage() {
})}
</div>
<div
className={`worker-consignment-price-grid${
selectedProfile?.config.fields.quantity === false ? ' is-two' : ''
}`}
>
<div className="worker-consignment-price-grid">
<Form.Item
label="寄售价格"
tooltip={
@@ -907,16 +905,21 @@ export default function WorkerConsignmentPage() {
</div>
)}
</Form.Item>
{selectedProfile?.config.fields.quantity !== false ? (
<Form.Item
label="寄售数量"
name="quantity"
initialValue={1}
className="worker-consignment-spec-card is-price"
>
<InputNumber min={1} precision={0} addonAfter="件" style={{ width: '100%' }} />
</Form.Item>
) : null}
<Form.Item
label="寄售数量"
name="quantity"
initialValue={1}
className="worker-consignment-spec-card is-price"
extra={quantityLocked ? '该分类数量固定为 1,不可修改' : undefined}
>
<InputNumber
min={1}
precision={0}
addonAfter="件"
style={{ width: '100%' }}
disabled={quantityLocked}
/>
</Form.Item>
<Form.Item
label="履约押金"
tooltip="平台统一配置。发布成功后暂扣,驳回或履约完成后释放。"