hookehuyr

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>
......@@ -45,6 +45,13 @@ pnpm lint
-**组件复用** - "第 3 次出现原则"抽取 Composables
-**可复用组件** - TabBar、NavHeader、IconFont
## 🆕 最新更新(2026-02-14)
### 字段命名优化
-**提取方式字段** - 统一将 specified_amount_type 重命名为 withdrawal_method
-**文档同步** - 更新提取计划相关文档字段示例
-**优化建议** - 提取计划相关字段命名保持“功能优先”的语义一致性
## 🆕 最新更新(2026-02-13)
### 权限与测试
......
## [2026-02-14] - 提取方式字段重命名
### 变更
- 将提取方式字段从 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
- **技术栈**: Vue 3, Taro 4
- **测试状态**: 待测试
- **备注**: 中文字段名保持为“提取方式”
---
## [2026-02-14] - 修复文件扩展名解析逻辑
### 修复
......
......@@ -414,7 +414,7 @@ src/
{
withdrawal_enabled: '是',
withdrawal_mode: '指定提取金额',
specified_amount_type: '按年岁',
withdrawal_method: '按年岁',
withdrawal_start_age: 60, // 由几岁开始
withdrawal_period: '10年', // 提取期(年)
increase_rate: '5' // 每年递增提取之百分比(%)
......@@ -464,13 +464,13 @@ src/
<template v-if="form.withdrawal_mode === '指定提取金额'">
<!-- 子选项:提取方式 -->
<PlanFieldRadio
v-model="form.specified_amount_type"
v-model="form.withdrawal_method"
label="提取方式"
:options="['按年岁']"
/>
<!-- 按年岁字段 -->
<template v-if="form.specified_amount_type === '按年岁'">
<template v-if="form.withdrawal_method === '按年岁'">
<PlanFieldAgePicker
v-model="form.withdrawal_start_age"
label="由几岁开始"
......@@ -521,13 +521,13 @@ src/
const onWithdrawalModeChange = (mode) => {
if (mode === '最高固定提取金额') {
// 最高固定金额模式不需要指定金额的相关字段
delete form.specified_amount_type
delete form.withdrawal_method
delete form.increase_rate
}
}
// 监听提取方式变化
watch(() => form.specified_amount_type, (newType) => {
watch(() => form.withdrawal_method, (newType) => {
// 两种方式都不需要 annual_amount 和 increase_rate(小程序端不需要)
delete form.annual_amount
delete form.increase_rate
......
......@@ -115,9 +115,9 @@ withdrawal_mode: '指定提取金额' | '最高固定提取金额'
// 第三层:根据不同选项显示不同字段
if (withdrawal_mode === '指定提取金额') {
specified_amount_type: '按年岁'
withdrawal_method: '按年岁'
if (specified_amount_type === '按年岁') {
if (withdrawal_method === '按年岁') {
withdrawal_start_age: number // 由几岁开始
withdrawal_period: string // 提取期(年)
increase_rate: string // 每年递增提取之百分比(%)
......@@ -145,7 +145,7 @@ watch(
(mode) => {
if (mode === '最高固定提取金额') {
// 清除指定金额相关字段
delete form.specified_amount_type
delete form.withdrawal_method
delete form.annual_amount
delete form.increase_rate
}
......@@ -154,7 +154,7 @@ watch(
// 当切换指定金额类型时
watch(
() => form.specified_amount_type,
() => form.withdrawal_method,
() => {
// 小程序端不需要这些字段
delete form.annual_amount
......@@ -169,7 +169,7 @@ watch(
if (enabled === '否') {
// 清除所有提取计划字段
delete form.withdrawal_mode
delete form.specified_amount_type
delete form.withdrawal_method
delete form.withdrawal_start_age
delete form.withdrawal_period
delete form.annual_amount
......
......@@ -86,7 +86,7 @@
<template v-if="form.withdrawal_mode === '指定提取金额'">
<!-- 提取方式:只有按年岁 -->
<PlanFieldRadio
v-model="form.specified_amount_type"
v-model="form.withdrawal_method"
label="提取方式"
:options="['按年岁']"
:required="true"
......@@ -94,7 +94,7 @@
/>
<!-- 按年岁 -->
<template v-if="form.specified_amount_type === '按年岁'">
<template v-if="form.withdrawal_method === '按年岁'">
<!-- 每年提取金额 -->
<PlanFieldAmount
v-model="form.annual_withdrawal_amount"
......@@ -269,7 +269,7 @@ const initializeForm = (value) => {
// 默认值
withdrawal_enabled: value.withdrawal_enabled || '否',
withdrawal_mode: value.withdrawal_mode || '指定提取金额',
specified_amount_type: value.specified_amount_type || '按年岁',
withdrawal_method: value.withdrawal_method || '按年岁',
// 新字段默认值(使用 null 以匹配 AmountKeyboard 的 Number 类型)
annual_withdrawal_amount: value.annual_withdrawal_amount ?? null,
annual_increase_percentage: value.annual_increase_percentage ?? null
......@@ -303,7 +303,7 @@ watch(
// 默认值
withdrawal_enabled: newVal.withdrawal_enabled || '否',
withdrawal_mode: newVal.withdrawal_mode || '指定提取金额',
specified_amount_type: newVal.specified_amount_type || '按年岁',
withdrawal_method: newVal.withdrawal_method || '按年岁',
// 新字段默认值(使用 null 以匹配 AmountKeyboard 的 Number 类型)
annual_withdrawal_amount: newVal.annual_withdrawal_amount ?? null,
annual_increase_percentage: newVal.annual_increase_percentage ?? null
......@@ -448,7 +448,7 @@ const validate = () => {
// 根据选择的提取模式进行校验
if (form.withdrawal_mode === '指定提取金额') {
if (!form.specified_amount_type) {
if (!form.withdrawal_method) {
Taro.showToast({ title: '请选择提取方式', icon: 'none' })
return false
}
......@@ -463,7 +463,7 @@ const validate = () => {
return false
}
if (form.specified_amount_type === '按年岁') {
if (form.withdrawal_method === '按年岁') {
if (!form.annual_withdrawal_amount || form.annual_withdrawal_amount === '') {
Taro.showToast({ title: '请输入每年提取金额', icon: 'none' })
return false
......