fix(核算): 对齐抵顶口径并完善界面细节
回款确认时间收敛到秒级;抵顶回款不再自动折算并保留标记。补齐公式模板角色标签与提示、指导成本登记入口及基础布局、分页、设置等响应式细节。同步忽略本地排查产物。
This commit is contained in:
1 parent
35fea3802f
commit
b3de35c2ec
53 files changed
+1381
-362
No files matched your search
@@ -43,12 +43,18 @@ class CalcTemplateOptionOut(BaseModel):
|
||||
|
||||
|
||||
class FormulaOptionOut(BaseModel):
|
||||
"""公式骨架下拉项(新增模板时选择,受控集合)。"""
|
||||
"""公式骨架下拉项(新增模板时选择,受控集合)。
|
||||
|
||||
role_labels / role_hints 把英文角色键翻译成业务可读的中文标签与提示,
|
||||
模板表单据此渲染每个参数槽位的标签与 placeholder。
|
||||
"""
|
||||
|
||||
code: str
|
||||
name: str
|
||||
description: str
|
||||
roles: list[str]
|
||||
role_labels: dict[str, str] = Field(default_factory=dict)
|
||||
role_hints: dict[str, str] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class CalcTemplateCreateIn(BaseModel):
|
||||
|
||||
@@ -45,7 +45,6 @@ from app.schemas.calc import CalcReceiptOut
|
||||
from app.services import audit_service, param_service, personnel_service
|
||||
from app.services.audit_service import AuditRecord, RequestMeta
|
||||
from app.services.formula import (
|
||||
apply_barter,
|
||||
clamp_weight_r,
|
||||
converted_profit,
|
||||
payment_days,
|
||||
@@ -366,12 +365,10 @@ def _compose_amounts(
|
||||
performance = (
|
||||
Decimal("0") if decision.manager_pending else performance_amount(converted, decision.rate)
|
||||
)
|
||||
barter_applied = receipt.is_barter == 1
|
||||
barter_applied = False
|
||||
# 以物抵顶口径(2026-11-03 决策):抵顶回款线下核算绩效,系统不做自动折算。
|
||||
# 原回款的 is_barter 标记保留;barter_applied=False 表示没有执行折算。
|
||||
base_amount = performance
|
||||
if barter_applied:
|
||||
discount = parse_fraction(snapshot.get("barter.discount", role_code=role_code_of(person)))
|
||||
base_amount = apply_barter(performance, discount)
|
||||
|
||||
received_total = business.total_received_amount or Decimal("0")
|
||||
start_ratio = parse_fraction(
|
||||
snapshot.get("payment.start.ratio", role_code=role_code_of(person))
|
||||
|
||||
@@ -75,7 +75,14 @@ def list_templates(session) -> PageResult[CalcTemplateOut]:
|
||||
def list_formula_options() -> list[dict]:
|
||||
"""骨架下拉(受控集合)。"""
|
||||
return [
|
||||
{"code": spec.code, "name": spec.name, "description": spec.description, "roles": list(spec.roles)}
|
||||
{
|
||||
"code": spec.code,
|
||||
"name": spec.name,
|
||||
"description": spec.description,
|
||||
"roles": list(spec.roles),
|
||||
"role_labels": dict(spec.role_labels),
|
||||
"role_hints": dict(spec.role_hints),
|
||||
}
|
||||
for spec in FORMULAS.values()
|
||||
]
|
||||
|
||||
|
||||
@@ -12,11 +12,17 @@ from sqlalchemy.orm import Session
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class FormulaSpec:
|
||||
"""公式骨架元数据:参数角色 → 模板参数映射键。"""
|
||||
"""公式骨架元数据:参数角色 → 模板参数映射键。
|
||||
|
||||
role_labels 把英文角色键翻译成业务可读的中文标签(模板表单展示),
|
||||
role_hints 进一步解释该槽位承载的口径(placeholder 提示)。
|
||||
"""
|
||||
|
||||
code: str
|
||||
name: str
|
||||
roles: tuple[str, ...]
|
||||
role_labels: dict[str, str]
|
||||
role_hints: dict[str, str]
|
||||
description: str
|
||||
|
||||
|
||||
@@ -26,30 +32,40 @@ FORMULAS: dict[str, FormulaSpec] = {
|
||||
code="linear_decay",
|
||||
name="天数线性递减",
|
||||
roles=("start", "slope", "floor", "boundary"),
|
||||
role_labels={"start": "起始比例", "slope": "日递减斜率", "floor": "下限比例", "boundary": "递减截止天数"},
|
||||
role_hints={"start": "回款第 1 天适用的计提比例", "slope": "每延后一天递减的幅度", "floor": "超过截止天数后固定使用的比例", "boundary": "按日递减的天数上限"},
|
||||
description="按回款天数线性递减,超过截止天数取下限比例",
|
||||
),
|
||||
"fixed_profit": FormulaSpec(
|
||||
code="fixed_profit",
|
||||
name="折算毛利固定比例",
|
||||
roles=("rate",),
|
||||
role_labels={"rate": "计提比例"},
|
||||
role_hints={"rate": "折算毛利润额乘以的固定比例"},
|
||||
description="折算毛利润额 × 固定比例",
|
||||
),
|
||||
"fixed_sales": FormulaSpec(
|
||||
code="fixed_sales",
|
||||
name="销售额固定比例",
|
||||
roles=("rate",),
|
||||
role_labels={"rate": "计提比例"},
|
||||
role_hints={"rate": "本人销售额乘以的固定比例"},
|
||||
description="本人销售额 × 固定比例",
|
||||
),
|
||||
"manager_share": FormulaSpec(
|
||||
code="manager_share",
|
||||
name="经理团队分成",
|
||||
roles=("team", "company"),
|
||||
role_labels={"team": "团队分成比例", "company": "全公司分成比例"},
|
||||
role_hints={"team": "本团队业务员绩效乘以的比例", "company": "全公司业务员绩效乘以的比例"},
|
||||
description="本团队绩效 × 团队比例 + 全公司绩效 × 公司比例",
|
||||
),
|
||||
"prepay_fixed": FormulaSpec(
|
||||
code="prepay_fixed",
|
||||
name="预付款固定比例",
|
||||
roles=("rate",),
|
||||
role_labels={"rate": "计提比例"},
|
||||
role_hints={"rate": "预付回款额乘以的固定比例"},
|
||||
description="预付回款额 × 固定比例",
|
||||
),
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ def confirm_receipt(session, receipt_id, payload, *, operator, meta=None) -> Rec
|
||||
if not receipt_confirmation.is_confirmed(receipt):
|
||||
receipt.confirmation_status = 1
|
||||
receipt.confirmed_by = operator.username
|
||||
receipt.confirmed_at = datetime.now()
|
||||
receipt.confirmed_at = datetime.now().replace(microsecond=0)
|
||||
receipt.confirmed_revision = payload.expected_revision
|
||||
out = get_detail(session, receipt_id)
|
||||
session.commit()
|
||||
|
||||
Reference in new issue
Block a user