前端产品编辑表使用 contractPrice 作为价格字段发送给后端,但后端使用的是 businessPrice(商机价格)。两者是同一个概念,需要统一为 businessPrice。
src/views/crm/business/modules/form.vue)src/views/crm/product/components/edit-table.vue)src/views/crm/product/components/data.ts)| 方法 | 路径 | 说明 |
|---|---|---|
| PUT | /crm/business/update |
更新商机 |
| POST | /crm/business/create |
新增商机 |
请求体字段变更(products[] 内):
| 字段 | 变更 | 说明 |
|---|---|---|
contractPrice |
❌ 移除 | 改为 businessPrice |
businessPrice |
✅ 统一使用 | 商机价格 |
totalProductPrice |
✅ 已有 | 产品总价(后端已新增支持) |
totalPrice |
✅ 已有 | 商机总价(折后)(后端已新增支持) |
edit-table.vue — 字段名 contractPrice → businessPrice文件:src/views/crm/product/components/edit-table.vue
涉及 6 处:
| 行号 | 修改 |
|---|---|
| 55 | row.contractPrice → row.businessPrice |
| 57 | row.contractPrice → row.businessPrice |
| 63 | row.contractPrice → row.businessPrice |
| 70 | row.contractPrice → row.businessPrice |
| 132 | contractPrice → businessPrice(template slot name) |
| 134 | row.contractPrice → row.businessPrice(v-model) |
data.ts — 编辑表列定义文件:src/views/crm/product/components/data.ts
第 91-95 行,编辑表(非 business 视图)的列定义:
field: 'contractPrice' → field: 'businessPrice'
title: '合同价(元)' → title: '商机价格(元)'
slots: { default: 'contractPrice' } → slots: { default: 'businessPrice' }
| 场景 | 规则 |
|---|---|
更新商机时产品 businessPrice 为 null |
后端自动用旧数据的 businessPrice merge(无需前端处理) |
| 新增商机时 | businessPrice 必填,不可为 null |
产品 totalPrice |
前端可直接传计算好的值,后端优先使用;未传时后端用 businessPrice * count 自动计算 |
头级 totalProductPrice / totalPrice |
前端可直接传,后端不再覆盖 |
contract、statistics、report、saleTrace 中的 contractPrice 是其他业务概念,不用改id 字段后端已新增支持,更新时传 id 即可标识已有产品businessPrice 的初始化值来自 product.salesPrice(选中产品时的默认价)