feat(接单): 好友赠送冷却支持分钟单位
This commit is contained in:
@@ -209,7 +209,11 @@ export default function ProductRulesPanel() {
|
||||
timeoutMinutes: rule.timeoutMinutes || 0,
|
||||
timeoutPolicy: rule.timeoutPolicy || 'reopen',
|
||||
acceptanceMode: rule.acceptanceMode || 'standard',
|
||||
giftCooldownHours: rule.giftCooldownHours || 72,
|
||||
giftCooldownUnit: Number(rule.giftCooldownMinutes || 0) > 0 ? 'minutes' : 'hours',
|
||||
giftCooldownValue:
|
||||
Number(rule.giftCooldownMinutes || 0) > 0
|
||||
? Number(rule.giftCooldownMinutes || 0)
|
||||
: Number(rule.giftCooldownHours ?? 72),
|
||||
fieldsText: formatRuleFields(rule.requirement?.fields || []),
|
||||
sortOrder: rule.sortOrder,
|
||||
enabled: rule.enabled,
|
||||
@@ -247,7 +251,8 @@ export default function ProductRulesPanel() {
|
||||
timeoutMinutes?: number
|
||||
timeoutPolicy?: string
|
||||
acceptanceMode?: string
|
||||
giftCooldownHours?: number
|
||||
giftCooldownUnit?: 'hours' | 'minutes'
|
||||
giftCooldownValue?: number
|
||||
fieldsText?: string
|
||||
enabled?: boolean
|
||||
autoCreate?: boolean
|
||||
@@ -265,13 +270,17 @@ export default function ProductRulesPanel() {
|
||||
? Number(values.sharingTotalQuantity || 0) > 0 ||
|
||||
Number(values.sharingUnitReward || 0) > 0
|
||||
: hasManualSharingInput(values.sharingTotalQuantity, values.sharingUnitReward)
|
||||
const { pricingMode: _pricingMode, ...payload } = values
|
||||
const { pricingMode: _pricingMode, giftCooldownUnit, giftCooldownValue, ...payload } = values
|
||||
const res = await saveAdminWorkProductRule({
|
||||
...payload,
|
||||
ruleId: editingRule?.ruleId,
|
||||
ruleKey: editingRule?.ruleKey || '',
|
||||
unitPrice: unitMode ? Number(values.unitPrice || 0) : 0,
|
||||
acceptanceMode: isFriendGift ? 'friend_gift' : 'standard',
|
||||
giftCooldownHours:
|
||||
isFriendGift && giftCooldownUnit !== 'minutes' ? Number(giftCooldownValue || 0) : 0,
|
||||
giftCooldownMinutes:
|
||||
isFriendGift && giftCooldownUnit === 'minutes' ? Number(giftCooldownValue || 0) : 0,
|
||||
sharingEnabled: isFriendGift ? false : values.sharingEnabled === true,
|
||||
sharingAutoFromOrder:
|
||||
unitMode && values.sharingEnabled === true && !hasManualSharingOverride,
|
||||
@@ -745,7 +754,8 @@ export default function ProductRulesPanel() {
|
||||
autoCreate: true,
|
||||
sharingEnabled: false,
|
||||
acceptanceMode: 'standard',
|
||||
giftCooldownHours: 72,
|
||||
giftCooldownUnit: 'hours',
|
||||
giftCooldownValue: 72,
|
||||
fieldsText:
|
||||
'gameId:游戏编号\ngameNickname:游戏昵称\nsystem:系统#安卓,苹果\nserverZone:区服#QQ区,微信区',
|
||||
}}
|
||||
@@ -838,19 +848,47 @@ export default function ProductRulesPanel() {
|
||||
<Form.Item noStyle shouldUpdate>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('acceptanceMode') === 'friend_gift' ? (
|
||||
<Form.Item
|
||||
label="赠送冷却"
|
||||
name="giftCooldownHours"
|
||||
rules={[{ required: true, message: '请填写冷却小时数' }]}
|
||||
extra="确认加好友后需冷却该时长才能赠送(默认 72 小时 = 3 天)"
|
||||
>
|
||||
<InputNumber
|
||||
min={1}
|
||||
max={720}
|
||||
step={1}
|
||||
addonAfter="小时"
|
||||
className="full-width"
|
||||
/>
|
||||
<Form.Item label="赠送冷却" required>
|
||||
<Space.Compact className="full-width">
|
||||
<Form.Item name="giftCooldownUnit" noStyle>
|
||||
<Select
|
||||
style={{ width: 100 }}
|
||||
options={[
|
||||
{ value: 'hours', label: '按小时' },
|
||||
{ value: 'minutes', label: '按分钟' },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(previous, current) =>
|
||||
previous.giftCooldownUnit !== current.giftCooldownUnit
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) => {
|
||||
const unit = getFieldValue('giftCooldownUnit')
|
||||
const isMinutes = unit === 'minutes'
|
||||
return (
|
||||
<Form.Item
|
||||
name="giftCooldownValue"
|
||||
noStyle
|
||||
rules={[{ required: true, message: '请填写冷却时长' }]}
|
||||
>
|
||||
<InputNumber
|
||||
min={1}
|
||||
max={isMinutes ? 43200 : 720}
|
||||
step={1}
|
||||
addonAfter={isMinutes ? '分钟' : '小时'}
|
||||
className="full-width"
|
||||
/>
|
||||
</Form.Item>
|
||||
)
|
||||
}}
|
||||
</Form.Item>
|
||||
</Space.Compact>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
|
||||
选择小时或分钟其中一种单位;最长 30 天(720 小时 / 43200 分钟)。
|
||||
</Typography.Text>
|
||||
</Form.Item>
|
||||
) : (
|
||||
<Form.Item label={<span />} />
|
||||
|
||||
@@ -861,6 +861,8 @@ export default function WorkOrdersPanel() {
|
||||
|
||||
function confirmFriendAdded(row: WorkOrder) {
|
||||
const cooldownHours = Number(row.gift?.cooldownHours || 72)
|
||||
const cooldownMinutes = Number(row.gift?.cooldownMinutes || 0)
|
||||
const cooldownLabel = cooldownMinutes > 0 ? `${cooldownMinutes} 分钟` : `${cooldownHours} 小时`
|
||||
modal.confirm({
|
||||
title: '确认已添加打手为游戏好友?',
|
||||
content: (
|
||||
@@ -869,8 +871,8 @@ export default function WorkOrdersPanel() {
|
||||
请先核对打手提交的昵称 / ID / 区服与主页截图,确认已在游戏内互为好友后再点击确认。
|
||||
</Typography.Paragraph>
|
||||
<Typography.Paragraph>
|
||||
确认后开始 {cooldownHours}{' '}
|
||||
小时赠送冷却,冷却结束前打手不能提交赠送凭证;任务时限将顺延到冷却结束后重新起算。
|
||||
确认后开始 {cooldownLabel}
|
||||
赠送冷却,冷却结束前打手不能提交赠送凭证;任务时限将顺延到冷却结束后重新起算。
|
||||
</Typography.Paragraph>
|
||||
</div>
|
||||
),
|
||||
@@ -879,7 +881,7 @@ export default function WorkOrdersPanel() {
|
||||
onOk: () =>
|
||||
runAction(
|
||||
() => confirmAdminWorkOrderFriend(row.workOrderId),
|
||||
`已确认加好友,${cooldownHours} 小时冷却开始`,
|
||||
`已确认加好友,${cooldownLabel} 冷却开始`,
|
||||
),
|
||||
})
|
||||
}
|
||||
@@ -1652,7 +1654,9 @@ export default function WorkOrdersPanel() {
|
||||
<div className="worker-order-detail-stack">
|
||||
<Descriptions column={{ xs: 1, md: 2 }} bordered size="small">
|
||||
<Descriptions.Item label="冷却时长">
|
||||
{detailOrder.gift.cooldownHours} 小时
|
||||
{detailOrder.gift.cooldownMinutes > 0
|
||||
? `${detailOrder.gift.cooldownMinutes} 分钟`
|
||||
: `${detailOrder.gift.cooldownHours} 小时`}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="打手资料提交">
|
||||
{formatAdminDateTime(detailOrder.gift.boosterMaterial?.submittedAt)}
|
||||
@@ -2399,20 +2403,20 @@ export default function WorkOrdersPanel() {
|
||||
) : (
|
||||
<Typography.Text type="secondary">待提交</Typography.Text>
|
||||
)}
|
||||
{canCancelShare ? (
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
icon={<UndoOutlined />}
|
||||
title="只撤销当前参与者的拼单份额,其他参与者不受影响"
|
||||
onClick={() => {
|
||||
setCancelShare(share)
|
||||
cancelShareForm.setFieldsValue({ reason: '' })
|
||||
}}
|
||||
>
|
||||
单人撤单
|
||||
</Button>
|
||||
) : null}
|
||||
{canCancelShare ? (
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
icon={<UndoOutlined />}
|
||||
title="只撤销当前参与者的拼单份额,其他参与者不受影响"
|
||||
onClick={() => {
|
||||
setCancelShare(share)
|
||||
cancelShareForm.setFieldsValue({ reason: '' })
|
||||
}}
|
||||
>
|
||||
单人撤单
|
||||
</Button>
|
||||
) : null}
|
||||
</Space>
|
||||
)
|
||||
},
|
||||
|
||||
@@ -207,7 +207,11 @@ function GiftProgressCard({ order }: { order: WorkOrder }) {
|
||||
]}
|
||||
/>
|
||||
<Descriptions column={{ xs: 1, md: 2 }} bordered size="small">
|
||||
<Descriptions.Item label="冷却时长">{gift.cooldownHours} 小时</Descriptions.Item>
|
||||
<Descriptions.Item label="冷却时长">
|
||||
{gift.cooldownMinutes > 0
|
||||
? `${gift.cooldownMinutes} 分钟`
|
||||
: `${gift.cooldownHours} 小时`}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="已加好友">
|
||||
{formatDateTime(gift.friendAddedAt)}
|
||||
</Descriptions.Item>
|
||||
|
||||
@@ -251,6 +251,7 @@ export function saveAdminWorkProductRule(payload: {
|
||||
timeoutPolicy?: string
|
||||
acceptanceMode?: 'standard' | 'friend_gift' | string
|
||||
giftCooldownHours?: number
|
||||
giftCooldownMinutes?: number
|
||||
fieldsText?: string
|
||||
sortOrder?: number
|
||||
}) {
|
||||
|
||||
@@ -376,6 +376,8 @@ export type WorkProductRule = {
|
||||
acceptanceMode?: 'standard' | 'friend_gift' | string
|
||||
/** 好友赠送冷却小时数(默认 72) */
|
||||
giftCooldownHours?: number
|
||||
/** 好友赠送按分钟配置时的总分钟数;非零时使用分钟单位。 */
|
||||
giftCooldownMinutes?: number
|
||||
sortOrder: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
@@ -514,6 +516,7 @@ export type WorkOrderGiftProgress = {
|
||||
phase: WorkOrderGiftPhase
|
||||
rawPhase: string
|
||||
cooldownHours: number
|
||||
cooldownMinutes: number
|
||||
friendAddedAt: string | null
|
||||
giftAvailableAt: string | null
|
||||
boosterMaterial: BoosterMaterial
|
||||
|
||||
Reference in New Issue
Block a user