7-3 管理员成本核算增加计价过程列
- 后端_enrich_items_from_db补充formula_expr/formula_note字段 - 前端成本单价与成本金额之间显示公式计算过程 - 面积定价显示: 长×宽×数量×单价/㎡=总金额 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
57221bef12
commit
d05c08ab81
@ -290,6 +290,9 @@ class OrderService:
|
||||
item_dict["pricing_type"] = snapshot.get("pricing_type") or item_dict["pricing_type"]
|
||||
if calc_result.get("area_sqm"):
|
||||
item_dict["area_sqm"] = calc_result["area_sqm"]
|
||||
# 保存公式信息供前端展示
|
||||
item_dict["formula_expr"] = getattr(rule, "formula_expr", None)
|
||||
item_dict["formula_note"] = getattr(rule, "formula_note", None)
|
||||
# 回写数据库,避免下次重复计算
|
||||
try:
|
||||
item.cost_price = snapshot["cost_price"]
|
||||
|
||||
@ -322,6 +322,7 @@
|
||||
<th>数量</th>
|
||||
<th v-if="isEditing">销售单价</th>
|
||||
<th>成本单价</th>
|
||||
<th>计价过程</th>
|
||||
<th>成本金额</th>
|
||||
<th v-if="isEditing" style="width: 60px;">操作</th>
|
||||
</tr>
|
||||
@ -334,6 +335,23 @@
|
||||
<td>{{ item.unit || '-' }}</td>
|
||||
<td>{{ computeTotalDemand(item) || item.quantity }}</td>
|
||||
<td>¥{{ Number(item.cost_price || 0).toFixed(2) }}</td>
|
||||
<td style="font-size:12px;color:#666;white-space:nowrap;">
|
||||
<template v-if="item.pricing_type === 'area' && item.length_m && item.width_m">
|
||||
{{ Number(item.length_m).toFixed(2) }}m × {{ Number(item.width_m).toFixed(2) }}m
|
||||
<template v-if="item.quantity"> × {{ item.quantity }}</template>
|
||||
× ¥{{ Number(item.cost_price / ((Number(item.length_m) * Number(item.width_m)) || 1)).toFixed(2) }}/㎡
|
||||
= ¥{{ (Number(item.quantity || 0) * Number(item.cost_price || 0)).toFixed(2) }}
|
||||
</template>
|
||||
<template v-else-if="item.area_sqm">
|
||||
{{ Number(item.area_sqm).toFixed(4) }}㎡
|
||||
<template v-if="item.quantity"> × {{ item.quantity }}</template>
|
||||
× ¥{{ Number(item.cost_price / (item.area_sqm || 1)).toFixed(2) }}/㎡
|
||||
= ¥{{ (Number(item.quantity || 0) * Number(item.cost_price || 0)).toFixed(2) }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.quantity }} × ¥{{ Number(item.cost_price || 0).toFixed(2) }}
|
||||
</template>
|
||||
</td>
|
||||
<td class="money">¥{{ (Number(item.quantity || 0) * Number(item.cost_price || 0)).toFixed(2) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user