feat(consignment): 内部现货占库进入赠送冷静期并闭环发布押金
打手发布冻结履约押金,驳回/作废退还,验收释放;内部匹配履约立刻占用库存并跳过打手资料进入冷静期,撤销回库时补冻押金。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import { CheckCircleOutlined, CloseCircleOutlined, EyeOutlined, ReloadOutlined } from '@ant-design/icons'
|
||||
import {
|
||||
CheckCircleOutlined,
|
||||
CloseCircleOutlined,
|
||||
EyeOutlined,
|
||||
ReloadOutlined,
|
||||
} from '@ant-design/icons'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import {
|
||||
Badge,
|
||||
|
||||
@@ -43,6 +43,7 @@ import { asRecord, formatMoney } from './shared'
|
||||
type FinanceConfigFormValues = {
|
||||
depositUnfreezeDays?: number
|
||||
rewardUnfreezeEnabled?: boolean
|
||||
consignmentPublishDepositYuan?: number
|
||||
recharge?: {
|
||||
enabled?: boolean
|
||||
channelName?: string
|
||||
@@ -169,6 +170,9 @@ export default function FinancePanel() {
|
||||
await saveAdminWorkerFinanceConfig({
|
||||
depositUnfreezeDays: Number(values.depositUnfreezeDays ?? 3),
|
||||
rewardUnfreezeEnabled: values.rewardUnfreezeEnabled !== false,
|
||||
consignmentPublishDepositFen: Math.round(
|
||||
Number(values.consignmentPublishDepositYuan ?? 20) * 100,
|
||||
),
|
||||
recharge: {
|
||||
enabled: values.recharge?.enabled !== false,
|
||||
channelName: String(values.recharge?.channelName || '').trim(),
|
||||
@@ -416,6 +420,13 @@ export default function FinancePanel() {
|
||||
>
|
||||
<InputNumber min={0} max={30} step={1} addonAfter="天" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="苏尔南寄卖发布押金"
|
||||
name="consignmentPublishDepositYuan"
|
||||
tooltip="打手发布寄卖时从可用余额冻结的履约押金;驳回或履约完成后释放"
|
||||
>
|
||||
<InputNumber min={0} max={10000} step={1} addonBefore="¥" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="报酬待解冻"
|
||||
name="rewardUnfreezeEnabled"
|
||||
@@ -676,6 +687,7 @@ function mapFinanceConfigToFormValues(config?: WorkerFinanceConfig): FinanceConf
|
||||
return {
|
||||
depositUnfreezeDays: Number(config?.depositUnfreezeDays ?? 3),
|
||||
rewardUnfreezeEnabled: config?.rewardUnfreezeEnabled !== false,
|
||||
consignmentPublishDepositYuan: Number(config?.consignmentPublishDepositFen ?? 2000) / 100,
|
||||
recharge: {
|
||||
enabled: config?.recharge.enabled !== false,
|
||||
channelName: config?.recharge.channelName || '',
|
||||
|
||||
@@ -161,6 +161,12 @@ type CancelSharingFormValues = {
|
||||
reason?: string
|
||||
}
|
||||
|
||||
function isInternalConsignmentOrder(row: WorkOrder) {
|
||||
const consignment = asRecord((row.material as Record<string, unknown> | undefined)?.consignment)
|
||||
if (consignment.fulfillmentType === 'worker_deposit' || consignment.workerId) return false
|
||||
return Boolean(consignment.inventoryId) && !row.worker
|
||||
}
|
||||
|
||||
export default function WorkOrdersPanel() {
|
||||
const { message, modal } = App.useApp()
|
||||
const navigate = useNavigate()
|
||||
@@ -715,7 +721,7 @@ export default function WorkOrdersPanel() {
|
||||
workOrderId: consignmentInterceptModal.order.workOrderId,
|
||||
inventoryId,
|
||||
})
|
||||
message.success('已使用内部寄售库存直接履约!工单已自动完成,无需打手接单佣金')
|
||||
message.success('已占用内部库存,跳过打手资料,进入赠送冷静期')
|
||||
setConsignmentInterceptModal({ open: false, order: null, matchData: null, submitting: false })
|
||||
await refreshAll()
|
||||
} catch (err: any) {
|
||||
@@ -1034,34 +1040,50 @@ export default function WorkOrdersPanel() {
|
||||
const cooldownHours = Number(row.gift?.cooldownHours || 72)
|
||||
const cooldownMinutes = Number(row.gift?.cooldownMinutes || 0)
|
||||
const cooldownLabel = cooldownMinutes > 0 ? `${cooldownMinutes} 分钟` : `${cooldownHours} 小时`
|
||||
const internal = isInternalConsignmentOrder(row)
|
||||
modal.confirm({
|
||||
title: '确认已添加打手为游戏好友?',
|
||||
title: internal ? '跳过打手资料,开始赠送冷却?' : '确认已添加打手为游戏好友?',
|
||||
content: (
|
||||
<div>
|
||||
<Typography.Paragraph>
|
||||
请先核对打手提交的昵称 / ID / 区服与主页截图,确认已在游戏内互为好友后再点击确认。
|
||||
</Typography.Paragraph>
|
||||
<Typography.Paragraph>
|
||||
确认后开始 {cooldownLabel}
|
||||
赠送冷却,冷却结束前打手不能提交赠送凭证;任务时限将顺延到冷却结束后重新起算。
|
||||
</Typography.Paragraph>
|
||||
{internal ? (
|
||||
<>
|
||||
<Typography.Paragraph>
|
||||
内部寄售履约没有打手交资料。确认后直接开始 {cooldownLabel}
|
||||
赠送冷却,冷却结束后再用库存账号给买家赠送并验收。
|
||||
</Typography.Paragraph>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Typography.Paragraph>
|
||||
请先核对打手提交的昵称 / ID / 区服与主页截图,确认已在游戏内互为好友后再点击确认。
|
||||
</Typography.Paragraph>
|
||||
<Typography.Paragraph>
|
||||
确认后开始 {cooldownLabel}
|
||||
赠送冷却,冷却结束前打手不能提交赠送凭证;任务时限将顺延到冷却结束后重新起算。
|
||||
</Typography.Paragraph>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
),
|
||||
okText: '已加好友,开始冷却',
|
||||
okText: internal ? '开始冷却' : '已加好友,开始冷却',
|
||||
cancelText: '取消',
|
||||
onOk: () =>
|
||||
runAction(
|
||||
() => confirmAdminWorkOrderFriend(row.workOrderId),
|
||||
`已确认加好友,${cooldownLabel} 冷却开始`,
|
||||
internal
|
||||
? `已跳过打手资料,${cooldownLabel} 冷却开始`
|
||||
: `已确认加好友,${cooldownLabel} 冷却开始`,
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
function completeGiftCooldown(row: WorkOrder) {
|
||||
const internal = isInternalConsignmentOrder(row)
|
||||
modal.confirm({
|
||||
title: '手动结束赠送冷却?',
|
||||
content:
|
||||
'确认后将立即允许打手提交赠送凭证与验收资料;订单任务时限将从当前时刻重新计算。此操作会记录在订单流转记录中。',
|
||||
content: internal
|
||||
? '确认后将立即进入可赠送,可用库存账号给买家赠送,然后直接验收。此操作会记录在订单流转记录中。'
|
||||
: '确认后将立即允许打手提交赠送凭证与验收资料;订单任务时限将从当前时刻重新计算。此操作会记录在订单流转记录中。',
|
||||
okText: '确认结束冷却',
|
||||
okButtonProps: { type: 'primary' },
|
||||
cancelText: '取消',
|
||||
@@ -1237,7 +1259,8 @@ export default function WorkOrdersPanel() {
|
||||
{row.acceptanceMode === 'friend_gift' ? <Tag color="purple">好友赠送</Tag> : null}
|
||||
{row.acceptanceMode === 'friend_gift' &&
|
||||
row.gift &&
|
||||
!['pending_material', 'unassigned', 'open'].includes(row.rawStatus || row.status) ? (
|
||||
(!['pending_material', 'unassigned', 'open'].includes(row.rawStatus || row.status) ||
|
||||
isInternalConsignmentOrder(row)) ? (
|
||||
<Tag color={resolveGiftPhaseColor(row.gift.phase)}>
|
||||
{formatGiftPhase(row.gift.phase)}
|
||||
</Tag>
|
||||
@@ -1459,7 +1482,9 @@ export default function WorkOrdersPanel() {
|
||||
icon={<UserAddOutlined />}
|
||||
onClick={() => confirmFriendAdded(row)}
|
||||
>
|
||||
确认加好友
|
||||
{isInternalConsignmentOrder(row) && row.gift?.phase === 'material_required'
|
||||
? '开始赠送冷却'
|
||||
: '确认加好友'}
|
||||
</Button>
|
||||
) : null}
|
||||
{row.capabilities?.canCompleteGiftCooldown && canManageProblem ? (
|
||||
@@ -1873,7 +1898,10 @@ export default function WorkOrdersPanel() {
|
||||
size="small"
|
||||
onClick={() => confirmFriendAdded(detailOrder)}
|
||||
>
|
||||
确认加好友
|
||||
{isInternalConsignmentOrder(detailOrder) &&
|
||||
detailOrder.gift?.phase === 'material_required'
|
||||
? '开始赠送冷却'
|
||||
: '确认加好友'}
|
||||
</Button>
|
||||
) : null}
|
||||
{detailOrder.capabilities?.canCompleteGiftCooldown && canManageProblem ? (
|
||||
@@ -2821,7 +2849,8 @@ export default function WorkOrdersPanel() {
|
||||
</div>
|
||||
<div style={{ color: '#389e0d', marginTop: 4 }}>
|
||||
若使用内部寄售库存履约,<strong>无需向外部打手支付佣金(打手支出 ¥0.00)</strong>
|
||||
,系统将自动核销工单并归档!
|
||||
。系统会立刻占用库存,并跳过「待打手提交资料」,直接进入默认 3
|
||||
天赠送冷静期;冷静期结束后再用库存账号赠送并验收。
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -2914,7 +2943,7 @@ export default function WorkOrdersPanel() {
|
||||
</div>
|
||||
|
||||
<div style={{ marginTop: 4, fontSize: 11, color: '#8c8c8c' }}>
|
||||
匹配分析: {m.matchReasons.join(' · ')}
|
||||
匹配分析: {(m.matchReasons || []).join(' · ') || m.reason || '规格匹配'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2935,7 +2964,7 @@ export default function WorkOrdersPanel() {
|
||||
loading={consignmentInterceptModal.submitting}
|
||||
onClick={() => handleFulfillWithConsignment(inv.id)}
|
||||
>
|
||||
内部现货直接核销
|
||||
内部现货履约
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user