refactor(plan): 提取方式字段重命名
- 将 specified_amount_type 重命名为 withdrawal_method - 同步更新组件、文档和字段示例 - 保持"功能优先"的语义一致性 影响文件: - src/components/plan/PlanTemplates/SavingsTemplate.vue - docs/PLAN/plan-entry-architecture.md - docs/lessons-learned/plan-entry-module-summary.md - docs/CHANGELOG.md - README.md Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Showing
5 changed files
with
39 additions
and
16 deletions
| ... | @@ -45,6 +45,13 @@ pnpm lint | ... | @@ -45,6 +45,13 @@ pnpm lint |
| 45 | - ✅ **组件复用** - "第 3 次出现原则"抽取 Composables | 45 | - ✅ **组件复用** - "第 3 次出现原则"抽取 Composables |
| 46 | - ✅ **可复用组件** - TabBar、NavHeader、IconFont | 46 | - ✅ **可复用组件** - TabBar、NavHeader、IconFont |
| 47 | 47 | ||
| 48 | +## 🆕 最新更新(2026-02-14) | ||
| 49 | + | ||
| 50 | +### 字段命名优化 | ||
| 51 | +- ✅ **提取方式字段** - 统一将 specified_amount_type 重命名为 withdrawal_method | ||
| 52 | +- ✅ **文档同步** - 更新提取计划相关文档字段示例 | ||
| 53 | +- ✅ **优化建议** - 提取计划相关字段命名保持“功能优先”的语义一致性 | ||
| 54 | + | ||
| 48 | ## 🆕 最新更新(2026-02-13) | 55 | ## 🆕 最新更新(2026-02-13) |
| 49 | 56 | ||
| 50 | ### 权限与测试 | 57 | ### 权限与测试 | ... | ... |
| 1 | +## [2026-02-14] - 提取方式字段重命名 | ||
| 2 | + | ||
| 3 | +### 变更 | ||
| 4 | +- 将提取方式字段从 specified_amount_type 统一重命名为 withdrawal_method | ||
| 5 | +- 同步更新计划书模板与相关文档的字段描述 | ||
| 6 | + | ||
| 7 | +--- | ||
| 8 | + | ||
| 9 | +**详细信息**: | ||
| 10 | +- **影响文件**: src/components/plan/PlanTemplates/SavingsTemplate.vue, docs/plan/plan-entry-architecture.md, docs/lessons-learned/plan-entry-module-summary.md | ||
| 11 | +- **技术栈**: Vue 3, Taro 4 | ||
| 12 | +- **测试状态**: 待测试 | ||
| 13 | +- **备注**: 中文字段名保持为“提取方式” | ||
| 14 | + | ||
| 15 | +--- | ||
| 16 | + | ||
| 1 | ## [2026-02-14] - 修复文件扩展名解析逻辑 | 17 | ## [2026-02-14] - 修复文件扩展名解析逻辑 |
| 2 | 18 | ||
| 3 | ### 修复 | 19 | ### 修复 | ... | ... |
| ... | @@ -414,7 +414,7 @@ src/ | ... | @@ -414,7 +414,7 @@ src/ |
| 414 | { | 414 | { |
| 415 | withdrawal_enabled: '是', | 415 | withdrawal_enabled: '是', |
| 416 | withdrawal_mode: '指定提取金额', | 416 | withdrawal_mode: '指定提取金额', |
| 417 | - specified_amount_type: '按年岁', | 417 | + withdrawal_method: '按年岁', |
| 418 | withdrawal_start_age: 60, // 由几岁开始 | 418 | withdrawal_start_age: 60, // 由几岁开始 |
| 419 | withdrawal_period: '10年', // 提取期(年) | 419 | withdrawal_period: '10年', // 提取期(年) |
| 420 | increase_rate: '5' // 每年递增提取之百分比(%) | 420 | increase_rate: '5' // 每年递增提取之百分比(%) |
| ... | @@ -464,13 +464,13 @@ src/ | ... | @@ -464,13 +464,13 @@ src/ |
| 464 | <template v-if="form.withdrawal_mode === '指定提取金额'"> | 464 | <template v-if="form.withdrawal_mode === '指定提取金额'"> |
| 465 | <!-- 子选项:提取方式 --> | 465 | <!-- 子选项:提取方式 --> |
| 466 | <PlanFieldRadio | 466 | <PlanFieldRadio |
| 467 | - v-model="form.specified_amount_type" | 467 | + v-model="form.withdrawal_method" |
| 468 | label="提取方式" | 468 | label="提取方式" |
| 469 | :options="['按年岁']" | 469 | :options="['按年岁']" |
| 470 | /> | 470 | /> |
| 471 | 471 | ||
| 472 | <!-- 按年岁字段 --> | 472 | <!-- 按年岁字段 --> |
| 473 | - <template v-if="form.specified_amount_type === '按年岁'"> | 473 | + <template v-if="form.withdrawal_method === '按年岁'"> |
| 474 | <PlanFieldAgePicker | 474 | <PlanFieldAgePicker |
| 475 | v-model="form.withdrawal_start_age" | 475 | v-model="form.withdrawal_start_age" |
| 476 | label="由几岁开始" | 476 | label="由几岁开始" |
| ... | @@ -521,13 +521,13 @@ src/ | ... | @@ -521,13 +521,13 @@ src/ |
| 521 | const onWithdrawalModeChange = (mode) => { | 521 | const onWithdrawalModeChange = (mode) => { |
| 522 | if (mode === '最高固定提取金额') { | 522 | if (mode === '最高固定提取金额') { |
| 523 | // 最高固定金额模式不需要指定金额的相关字段 | 523 | // 最高固定金额模式不需要指定金额的相关字段 |
| 524 | - delete form.specified_amount_type | 524 | + delete form.withdrawal_method |
| 525 | delete form.increase_rate | 525 | delete form.increase_rate |
| 526 | } | 526 | } |
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | // 监听提取方式变化 | 529 | // 监听提取方式变化 |
| 530 | -watch(() => form.specified_amount_type, (newType) => { | 530 | +watch(() => form.withdrawal_method, (newType) => { |
| 531 | // 两种方式都不需要 annual_amount 和 increase_rate(小程序端不需要) | 531 | // 两种方式都不需要 annual_amount 和 increase_rate(小程序端不需要) |
| 532 | delete form.annual_amount | 532 | delete form.annual_amount |
| 533 | delete form.increase_rate | 533 | delete form.increase_rate | ... | ... |
| ... | @@ -115,9 +115,9 @@ withdrawal_mode: '指定提取金额' | '最高固定提取金额' | ... | @@ -115,9 +115,9 @@ withdrawal_mode: '指定提取金额' | '最高固定提取金额' |
| 115 | 115 | ||
| 116 | // 第三层:根据不同选项显示不同字段 | 116 | // 第三层:根据不同选项显示不同字段 |
| 117 | if (withdrawal_mode === '指定提取金额') { | 117 | if (withdrawal_mode === '指定提取金额') { |
| 118 | - specified_amount_type: '按年岁' | 118 | + withdrawal_method: '按年岁' |
| 119 | 119 | ||
| 120 | - if (specified_amount_type === '按年岁') { | 120 | + if (withdrawal_method === '按年岁') { |
| 121 | withdrawal_start_age: number // 由几岁开始 | 121 | withdrawal_start_age: number // 由几岁开始 |
| 122 | withdrawal_period: string // 提取期(年) | 122 | withdrawal_period: string // 提取期(年) |
| 123 | increase_rate: string // 每年递增提取之百分比(%) | 123 | increase_rate: string // 每年递增提取之百分比(%) |
| ... | @@ -145,7 +145,7 @@ watch( | ... | @@ -145,7 +145,7 @@ watch( |
| 145 | (mode) => { | 145 | (mode) => { |
| 146 | if (mode === '最高固定提取金额') { | 146 | if (mode === '最高固定提取金额') { |
| 147 | // 清除指定金额相关字段 | 147 | // 清除指定金额相关字段 |
| 148 | - delete form.specified_amount_type | 148 | + delete form.withdrawal_method |
| 149 | delete form.annual_amount | 149 | delete form.annual_amount |
| 150 | delete form.increase_rate | 150 | delete form.increase_rate |
| 151 | } | 151 | } |
| ... | @@ -154,7 +154,7 @@ watch( | ... | @@ -154,7 +154,7 @@ watch( |
| 154 | 154 | ||
| 155 | // 当切换指定金额类型时 | 155 | // 当切换指定金额类型时 |
| 156 | watch( | 156 | watch( |
| 157 | - () => form.specified_amount_type, | 157 | + () => form.withdrawal_method, |
| 158 | () => { | 158 | () => { |
| 159 | // 小程序端不需要这些字段 | 159 | // 小程序端不需要这些字段 |
| 160 | delete form.annual_amount | 160 | delete form.annual_amount |
| ... | @@ -169,7 +169,7 @@ watch( | ... | @@ -169,7 +169,7 @@ watch( |
| 169 | if (enabled === '否') { | 169 | if (enabled === '否') { |
| 170 | // 清除所有提取计划字段 | 170 | // 清除所有提取计划字段 |
| 171 | delete form.withdrawal_mode | 171 | delete form.withdrawal_mode |
| 172 | - delete form.specified_amount_type | 172 | + delete form.withdrawal_method |
| 173 | delete form.withdrawal_start_age | 173 | delete form.withdrawal_start_age |
| 174 | delete form.withdrawal_period | 174 | delete form.withdrawal_period |
| 175 | delete form.annual_amount | 175 | delete form.annual_amount | ... | ... |
| ... | @@ -86,7 +86,7 @@ | ... | @@ -86,7 +86,7 @@ |
| 86 | <template v-if="form.withdrawal_mode === '指定提取金额'"> | 86 | <template v-if="form.withdrawal_mode === '指定提取金额'"> |
| 87 | <!-- 提取方式:只有按年岁 --> | 87 | <!-- 提取方式:只有按年岁 --> |
| 88 | <PlanFieldRadio | 88 | <PlanFieldRadio |
| 89 | - v-model="form.specified_amount_type" | 89 | + v-model="form.withdrawal_method" |
| 90 | label="提取方式" | 90 | label="提取方式" |
| 91 | :options="['按年岁']" | 91 | :options="['按年岁']" |
| 92 | :required="true" | 92 | :required="true" |
| ... | @@ -94,7 +94,7 @@ | ... | @@ -94,7 +94,7 @@ |
| 94 | /> | 94 | /> |
| 95 | 95 | ||
| 96 | <!-- 按年岁 --> | 96 | <!-- 按年岁 --> |
| 97 | - <template v-if="form.specified_amount_type === '按年岁'"> | 97 | + <template v-if="form.withdrawal_method === '按年岁'"> |
| 98 | <!-- 每年提取金额 --> | 98 | <!-- 每年提取金额 --> |
| 99 | <PlanFieldAmount | 99 | <PlanFieldAmount |
| 100 | v-model="form.annual_withdrawal_amount" | 100 | v-model="form.annual_withdrawal_amount" |
| ... | @@ -269,7 +269,7 @@ const initializeForm = (value) => { | ... | @@ -269,7 +269,7 @@ const initializeForm = (value) => { |
| 269 | // 默认值 | 269 | // 默认值 |
| 270 | withdrawal_enabled: value.withdrawal_enabled || '否', | 270 | withdrawal_enabled: value.withdrawal_enabled || '否', |
| 271 | withdrawal_mode: value.withdrawal_mode || '指定提取金额', | 271 | withdrawal_mode: value.withdrawal_mode || '指定提取金额', |
| 272 | - specified_amount_type: value.specified_amount_type || '按年岁', | 272 | + withdrawal_method: value.withdrawal_method || '按年岁', |
| 273 | // 新字段默认值(使用 null 以匹配 AmountKeyboard 的 Number 类型) | 273 | // 新字段默认值(使用 null 以匹配 AmountKeyboard 的 Number 类型) |
| 274 | annual_withdrawal_amount: value.annual_withdrawal_amount ?? null, | 274 | annual_withdrawal_amount: value.annual_withdrawal_amount ?? null, |
| 275 | annual_increase_percentage: value.annual_increase_percentage ?? null | 275 | annual_increase_percentage: value.annual_increase_percentage ?? null |
| ... | @@ -303,7 +303,7 @@ watch( | ... | @@ -303,7 +303,7 @@ watch( |
| 303 | // 默认值 | 303 | // 默认值 |
| 304 | withdrawal_enabled: newVal.withdrawal_enabled || '否', | 304 | withdrawal_enabled: newVal.withdrawal_enabled || '否', |
| 305 | withdrawal_mode: newVal.withdrawal_mode || '指定提取金额', | 305 | withdrawal_mode: newVal.withdrawal_mode || '指定提取金额', |
| 306 | - specified_amount_type: newVal.specified_amount_type || '按年岁', | 306 | + withdrawal_method: newVal.withdrawal_method || '按年岁', |
| 307 | // 新字段默认值(使用 null 以匹配 AmountKeyboard 的 Number 类型) | 307 | // 新字段默认值(使用 null 以匹配 AmountKeyboard 的 Number 类型) |
| 308 | annual_withdrawal_amount: newVal.annual_withdrawal_amount ?? null, | 308 | annual_withdrawal_amount: newVal.annual_withdrawal_amount ?? null, |
| 309 | annual_increase_percentage: newVal.annual_increase_percentage ?? null | 309 | annual_increase_percentage: newVal.annual_increase_percentage ?? null |
| ... | @@ -448,7 +448,7 @@ const validate = () => { | ... | @@ -448,7 +448,7 @@ const validate = () => { |
| 448 | 448 | ||
| 449 | // 根据选择的提取模式进行校验 | 449 | // 根据选择的提取模式进行校验 |
| 450 | if (form.withdrawal_mode === '指定提取金额') { | 450 | if (form.withdrawal_mode === '指定提取金额') { |
| 451 | - if (!form.specified_amount_type) { | 451 | + if (!form.withdrawal_method) { |
| 452 | Taro.showToast({ title: '请选择提取方式', icon: 'none' }) | 452 | Taro.showToast({ title: '请选择提取方式', icon: 'none' }) |
| 453 | return false | 453 | return false |
| 454 | } | 454 | } |
| ... | @@ -463,7 +463,7 @@ const validate = () => { | ... | @@ -463,7 +463,7 @@ const validate = () => { |
| 463 | return false | 463 | return false |
| 464 | } | 464 | } |
| 465 | 465 | ||
| 466 | - if (form.specified_amount_type === '按年岁') { | 466 | + if (form.withdrawal_method === '按年岁') { |
| 467 | if (!form.annual_withdrawal_amount || form.annual_withdrawal_amount === '') { | 467 | if (!form.annual_withdrawal_amount || form.annual_withdrawal_amount === '') { |
| 468 | Taro.showToast({ title: '请输入每年提取金额', icon: 'none' }) | 468 | Taro.showToast({ title: '请输入每年提取金额', icon: 'none' }) |
| 469 | return false | 469 | return false | ... | ... |
-
Please register or login to post a comment