feat(consignment): 匹配弹窗增加付款金额与售价差价
一键查询待匹配订单与手动匹配寄卖新增「工单用户付款金额」列, 售价后括号显示「用户付款金额 - 售价」差价:正数绿、负数红、 0 黄;拼单不显示差价,付款未知显示 -。
This commit is contained in:
@@ -7,9 +7,11 @@ import { useMemo, useState } from 'react'
|
||||
import PercentTable from '@/components/common/PercentTable'
|
||||
import { fetchPendingPistolMatches } from '@/services/admin/consignment'
|
||||
import type { PendingPistolMatchPair } from '@/types/consignment'
|
||||
import { formatFenMoney } from '@/utils/consignment-payment-price-diff'
|
||||
import { formatDateTime } from '@/utils/date-time'
|
||||
import { resolveConsignmentPriorityTagColor } from '@/utils/consignment-match-priority'
|
||||
|
||||
import ConsignmentPriceWithDiff from './ConsignmentPriceWithDiff'
|
||||
import ConsignmentWorkOrderMatchModal from './ConsignmentWorkOrderMatchModal'
|
||||
|
||||
const { Text } = Typography
|
||||
@@ -219,6 +221,26 @@ export default function ConsignmentPendingMatchModal({
|
||||
</Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '工单用户付款金额',
|
||||
key: 'userPayment',
|
||||
width: 140,
|
||||
render: (_, record) => (
|
||||
<Text style={{ fontSize: 13 }}>{formatFenMoney(record.userPaymentFen)}</Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '售价',
|
||||
key: 'salePrice',
|
||||
width: 180,
|
||||
render: (_, record) => (
|
||||
<ConsignmentPriceWithDiff
|
||||
userPaymentFen={record.userPaymentFen}
|
||||
salePriceFen={record.salePriceFen}
|
||||
sharingEnabled={record.sharingEnabled}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '匹配说明',
|
||||
key: 'reason',
|
||||
@@ -285,7 +307,7 @@ export default function ConsignmentPendingMatchModal({
|
||||
: '匹配 · 待匹配订单 × 在库现货'
|
||||
}
|
||||
open={open}
|
||||
width="min(1320px, 94vw)"
|
||||
width="min(1480px, 96vw)"
|
||||
footer={null}
|
||||
destroyOnHidden
|
||||
onCancel={onClose}
|
||||
@@ -363,7 +385,7 @@ export default function ConsignmentPendingMatchModal({
|
||||
loading={query.isFetching}
|
||||
dataSource={pairs}
|
||||
columns={columns}
|
||||
scroll={{ y: 460 }}
|
||||
scroll={{ x: 1680, y: 460 }}
|
||||
pagination={{
|
||||
pageSize: 20,
|
||||
showSizeChanger: false,
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Typography } from 'antd'
|
||||
|
||||
import { formatFenMoney, resolvePaymentPriceDiff } from '@/utils/consignment-payment-price-diff'
|
||||
|
||||
/**
|
||||
* 寄售售价 + 差价:`¥110.00(+¥20.00)`。
|
||||
*
|
||||
* 差价 = 工单用户付款金额 - 售价;正数绿、负数红、0 黄。
|
||||
* 拼单(多份售价)或用户付款未知时不显示括号。
|
||||
*/
|
||||
export default function ConsignmentPriceWithDiff({
|
||||
userPaymentFen,
|
||||
salePriceFen,
|
||||
sharingEnabled = false,
|
||||
}: {
|
||||
userPaymentFen: number | null | undefined
|
||||
salePriceFen: number | null | undefined
|
||||
sharingEnabled?: boolean
|
||||
}) {
|
||||
const diff = resolvePaymentPriceDiff(userPaymentFen, salePriceFen, { sharingEnabled })
|
||||
return (
|
||||
<Typography.Text style={{ fontSize: 13 }}>
|
||||
{formatFenMoney(salePriceFen)}
|
||||
{diff ? <span style={{ color: diff.color }}>({diff.text})</span> : null}
|
||||
</Typography.Text>
|
||||
)
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
matchAdminConsignmentWorkOrder,
|
||||
} from '@/services/admin/consignment'
|
||||
import type { ConsignmentMatchCandidate } from '@/types/consignment'
|
||||
import { formatFenMoney } from '@/utils/consignment-payment-price-diff'
|
||||
import {
|
||||
computeConsignmentMatchScore,
|
||||
describeConsignmentMatch,
|
||||
@@ -15,9 +16,7 @@ import {
|
||||
} from '@/utils/consignment-match-coverage'
|
||||
import { resolveConsignmentPriorityTagColor } from '@/utils/consignment-match-priority'
|
||||
|
||||
function money(fen: number) {
|
||||
return `¥${((Number(fen || 0) || 0) / 100).toFixed(2)}`
|
||||
}
|
||||
import ConsignmentPriceWithDiff from './ConsignmentPriceWithDiff'
|
||||
|
||||
const EMPTY_INVENTORY_IDS: number[] = []
|
||||
|
||||
@@ -205,7 +204,7 @@ export default function ConsignmentWorkOrderMatchModal({
|
||||
title="手动匹配寄卖"
|
||||
open={open}
|
||||
onCancel={onClose}
|
||||
width="min(1180px, 96vw)"
|
||||
width="min(1280px, 96vw)"
|
||||
destroyOnHidden
|
||||
footer={
|
||||
<Space>
|
||||
@@ -331,7 +330,7 @@ export default function ConsignmentWorkOrderMatchModal({
|
||||
size="small"
|
||||
loading={candidatesQuery.isFetching}
|
||||
pagination={{ pageSize: 10, showSizeChanger: false }}
|
||||
scroll={{ x: 1210, y: 420 }}
|
||||
scroll={{ x: 1470, y: 420 }}
|
||||
dataSource={visibleOptions}
|
||||
rowSelection={{
|
||||
// 整单只能选一条;拼单可多选,必须覆盖剩余份数才能提交。
|
||||
@@ -417,11 +416,27 @@ export default function ConsignmentWorkOrderMatchModal({
|
||||
</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '工单用户付款金额',
|
||||
key: 'userPayment',
|
||||
width: 140,
|
||||
render: () => (
|
||||
<Typography.Text style={{ fontSize: 13 }}>
|
||||
{formatFenMoney(data?.userPaymentFen)}
|
||||
</Typography.Text>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '售价',
|
||||
key: 'price',
|
||||
width: 100,
|
||||
render: (_, item) => money(item.salePriceFen),
|
||||
width: 180,
|
||||
render: (_, item) => (
|
||||
<ConsignmentPriceWithDiff
|
||||
userPaymentFen={data?.userPaymentFen}
|
||||
salePriceFen={item.salePriceFen}
|
||||
sharingEnabled={sharingEnabled && totalQuantity > 1}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '匹配说明',
|
||||
|
||||
Reference in New Issue
Block a user