fix(admin): 恢复接单模板计价配置并统一成本价格链路

This commit is contained in:
yml2213
2026-11-02 17:57:49 +08:00
parent d871b93fde
commit a7bac9c1d8
27 changed files with 304 additions and 83 deletions
@@ -28,6 +28,7 @@ export function resolveWorkOrderRulePricing(input: {
skuQuantity: number
unitPriceFen: number
fixedRewardAmount: number
pricingMode: 'fixed' | 'unit' | string
sharingEnabled: boolean
sharingAutoFromOrder: boolean
sharingTotalQuantity: number
@@ -43,7 +44,7 @@ export function resolveWorkOrderRulePricing(input: {
: Math.max(0, Number(input.sharingUnitReward) || 0)
const rewardAmount = input.sharingEnabled
? sharingTotalQuantity * sharingUnitReward
: unitPriceFen > 0
: input.pricingMode === 'unit'
? unitPriceFen * skuQuantity
: Math.max(0, Number(input.fixedRewardAmount) || 0)
@@ -68,6 +68,7 @@ function buildRule(overrides: Partial<WorkProductRuleRow> = {}): WorkProductRule
auto_create: true,
reward_amount: 0,
unit_price_fen: 0,
pricing_mode: 'fixed',
required_deposit_amount: 0,
deposit_threshold_amount: 20000,
sharing_enabled: false,
@@ -141,6 +142,7 @@ const commanderRule = buildRule({
rule_key: 'bb',
product_name: '指挥官密钥',
unit_price_fen: 950,
pricing_mode: 'unit',
sharing_enabled: true,
sharing_auto_from_order: true,
})
@@ -199,6 +201,7 @@ test('抖音:命中指挥官模板后按数量计价并开拼单(9.5 元/个
skuQuantity,
unitPriceFen: commanderRule.unit_price_fen,
fixedRewardAmount: commanderRule.reward_amount,
pricingMode: commanderRule.pricing_mode,
sharingEnabled: commanderRule.sharing_enabled === true,
sharingAutoFromOrder: commanderRule.sharing_auto_from_order === true,
sharingTotalQuantity: commanderRule.sharing_total_quantity,