fix(consignment): 寄卖改价上限按单价计算并补充单价/合计提示
This commit is contained in:
@@ -279,6 +279,17 @@ export default function WorkerConsignmentPage() {
|
||||
)
|
||||
const publishDepositYuan = publishDepositFen / 100
|
||||
const manualPriceAllowed = selectedProfile?.config.pricing.allowWorkerPrice !== false
|
||||
const watchedAskingPrice = Form.useWatch('askingPrice', form)
|
||||
// 寄售价格是「单价」:数量只决定库存件数,合计单独展示,避免把单价误读成整单总价
|
||||
const unitPriceForTotalYuan = manualPriceAllowed
|
||||
? Number(watchedAskingPrice ?? 0)
|
||||
: priceState.status === 'matched'
|
||||
? priceState.fen / 100
|
||||
: 0
|
||||
const totalPriceYuan =
|
||||
Number.isFinite(unitPriceForTotalYuan) && unitPriceForTotalYuan > 0
|
||||
? unitPriceForTotalYuan * quantityForDeposit
|
||||
: 0
|
||||
const availableAmount = Number(worker?.wallet?.availableAmount || 0)
|
||||
const canPublish = availableAmount >= publishDepositFen
|
||||
const canConsign = canWorkerPublishConsignment({
|
||||
@@ -899,11 +910,16 @@ export default function WorkerConsignmentPage() {
|
||||
|
||||
<div className="worker-consignment-price-grid">
|
||||
<Form.Item
|
||||
label="寄售价格"
|
||||
label="寄售单价(元/件)"
|
||||
tooltip={
|
||||
manualPriceAllowed
|
||||
? `不能高于系统建议价;最低 ¥${priceMinYuan.toFixed(2)}。`
|
||||
: '由后台寄卖配置自动带出,卖家不可修改;需要调整请联系客服。'
|
||||
? `按每件计算,不能高于系统建议价;最低 ¥${priceMinYuan.toFixed(2)}。`
|
||||
: '按每件计算,由后台寄卖配置自动带出,卖家不可修改;需要调整请联系客服。'
|
||||
}
|
||||
extra={
|
||||
totalPriceYuan > 0
|
||||
? `合计 ¥${totalPriceYuan.toFixed(2)}(${quantityForDeposit} 件)`
|
||||
: undefined
|
||||
}
|
||||
className="worker-consignment-spec-card is-price"
|
||||
>
|
||||
@@ -929,7 +945,7 @@ export default function WorkerConsignmentPage() {
|
||||
<Spin size="small" /> 计算建议价…
|
||||
</span>
|
||||
) : priceState.status === 'matched' ? (
|
||||
<span className="is-amount">¥{(priceState.fen / 100).toFixed(2)}</span>
|
||||
<span className="is-amount">¥{(priceState.fen / 100).toFixed(2)} / 件</span>
|
||||
) : priceState.status === 'empty' ? (
|
||||
<span className="is-empty">该规格暂无价格,请联系客服</span>
|
||||
) : (
|
||||
@@ -1663,7 +1679,7 @@ function ConsignmentRecordCard({
|
||||
)}
|
||||
<div className="worker-consignment-record-meta">
|
||||
<span>
|
||||
寄售价{' '}
|
||||
单价{' '}
|
||||
<strong>¥{((record.salePriceFen ?? record.askingPriceFen) / 100).toFixed(2)}</strong>
|
||||
</span>
|
||||
{record.allocationId && Number(record.allocatedQuantity || 0) > 0 ? (
|
||||
@@ -1679,6 +1695,18 @@ function ConsignmentRecordCard({
|
||||
</strong>
|
||||
</span>
|
||||
) : null}
|
||||
{Number(record.quantity || 1) > 1 ? (
|
||||
<span>
|
||||
合计{' '}
|
||||
<strong>
|
||||
¥
|
||||
{(
|
||||
((record.salePriceFen ?? record.askingPriceFen) * Number(record.quantity || 1)) /
|
||||
100
|
||||
).toFixed(2)}
|
||||
</strong>
|
||||
</span>
|
||||
) : null}
|
||||
<span>
|
||||
押金 <strong>¥{(Number(record.depositAmountFen || 0) / 100).toFixed(2)}</strong>
|
||||
</span>
|
||||
@@ -1694,7 +1722,7 @@ function ConsignmentRecordCard({
|
||||
setPriceOpen(true)
|
||||
}}
|
||||
>
|
||||
修改售价
|
||||
修改单价
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
@@ -1855,7 +1883,7 @@ function ConsignmentRecordCard({
|
||||
{formatDateTime(record.createdAt)}
|
||||
</Typography.Text>
|
||||
<Modal
|
||||
title="修改寄卖售价"
|
||||
title="修改寄卖单价"
|
||||
open={priceOpen}
|
||||
onCancel={() => setPriceOpen(false)}
|
||||
confirmLoading={savingPrice}
|
||||
@@ -1870,7 +1898,7 @@ function ConsignmentRecordCard({
|
||||
setSavingPrice(true)
|
||||
try {
|
||||
await updateWorkerConsignmentPrice(record.submissionId, nextPriceFen)
|
||||
message.success('寄卖售价已更新')
|
||||
message.success('寄卖单价已更新')
|
||||
setPriceOpen(false)
|
||||
await queryClient.invalidateQueries({ queryKey: ['worker-my-consignments'] })
|
||||
} catch (error) {
|
||||
@@ -1891,7 +1919,12 @@ function ConsignmentRecordCard({
|
||||
/>
|
||||
{record.priceCapFen && record.priceCapFen > 0 ? (
|
||||
<Typography.Text type="secondary" style={{ display: 'block', marginTop: 8 }}>
|
||||
最高不能超过系统建议价 ¥{(record.priceCapFen / 100).toFixed(2)}
|
||||
最高不能超过系统建议单价 ¥{(record.priceCapFen / 100).toFixed(2)}
|
||||
</Typography.Text>
|
||||
) : null}
|
||||
{Number(record.quantity || 1) > 1 ? (
|
||||
<Typography.Text type="secondary" style={{ display: 'block', marginTop: 4 }}>
|
||||
数量 {record.quantity} 件,合计 ¥{(priceYuan * Number(record.quantity || 1)).toFixed(2)}
|
||||
</Typography.Text>
|
||||
) : null}
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user