Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
manulife-weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2026-02-14 02:24:19 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a583f5415f5f0f4ec2b280803adac3dfac4ec84f
a583f541
1 parent
01cb5cf0
fix(PlanTemplates): 修复提取方式切换时字段清空逻辑
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
23 deletions
src/components/plan/PlanTemplates/SavingsTemplate.vue
src/components/plan/PlanTemplates/SavingsTemplate.vue
View file @
a583f54
...
...
@@ -79,7 +79,6 @@
label
=
"提取选项"
:
options
=
"['指定提取金额', '最高固定提取金额']"
:
required
=
"true"
@change
=
"onWithdrawalModeChange"
class
=
"mb-5"
/>
...
...
@@ -181,7 +180,6 @@
* @description GS/GC/FA/LV2 等储蓄型保险产品的计划书录入表单
* - 表单字段:性别、出生年月日、是否吸烟、保额、缴费年期
* - 提取计划:指定提取金额(按年岁/按保单年度)、最高固定提取金额
* - 小程序端币种固定(使用配置中的默认币种)
* @author Claude Code
* @example
* <SavingsTemplate
...
...
@@ -189,7 +187,7 @@
* :config="templateConfig"
* />
*/
import
{
reactive
,
watch
,
computed
}
from
'
vue
'
import
{
reactive
,
watch
,
computed
,
nextTick
}
from
'
vue
'
import
Taro
from
'@tarojs
/
taro
'
import
PlanFieldName
from
'
..
/
PlanFields
/
NameInput
.
vue
'
import
PlanFieldAgePicker
from
'
..
/
PlanFields
/
AgePickerGlobal
.
vue
'
...
...
@@ -321,11 +319,38 @@ watch(
*/
watch
(
()
=>
form
,
(
newVal
)
=>
emit
(
'
update
:
modelValue
'
,
newVal
),
(
newVal
)
=>
{
emit
(
'
update
:
modelValue
'
,
newVal
)
}
,
{
deep
:
true
}
)
/**
* 监听提取模式变化,清空对应字段
*/
watch
(
()
=>
form
.
withdrawal_mode
,
(
newMode
,
oldMode
)
=>
{
// 每次切换模式时,只清空输入字段(保留模式选择字段)
if
(
newMode
===
'最高固定提取金额'
)
{
// 清空"指定提取金额"模式的输入字段
form
.
annual_withdrawal_amount
=
null
form
.
annual_increase_percentage
=
null
form
.
withdrawal_start_age
=
null
form
.
withdrawal_period
=
null
// 立即同步给父组件
emit
(
'
update
:
modelValue
'
,
{
...
form
}
)
}
else
if
(
newMode
===
'指定提取金额'
)
{
// 清空"最高固定提取金额"模式的输入字段
form
.
withdrawal_start_age
=
null
form
.
withdrawal_period
=
null
// 立即同步给父组件
emit
(
'
update
:
modelValue
'
,
{
...
form
}
)
}
}
)
/**
* 提取年期选项(从配置读取)
* @type {ComputedRef<Array<string>>}
*/
...
...
@@ -343,25 +368,6 @@ const withdrawalPeriods = computed(() => {
}
)
/**
* 提取模式变化时的处理
* @param {string} mode - 新的提取模式
*
* @description 当用户切换提取模式时,清除不相关的字段
* - 切换到"指定提取金额":保留字段,等待用户选择子选项
* - 切换到"最高固定金额":清除指定金额相关字段
*/
const
onWithdrawalModeChange
=
(
mode
)
=>
{
if
(
mode
===
'最高固定提取金额'
)
{
// 最高固定金额模式不需要指定金额的相关字段
delete
form
.
specified_amount_type
delete
form
.
annual_withdrawal_amount
delete
form
.
annual_increase_percentage
}
else
if
(
mode
===
'指定提取金额'
)
{
// 指定提取金额模式(按年岁),保留现有字段
}
}
/**
* 百分比输入限制(实时)
* @description 限制百分比输入为有效数值,最多2位小数
* 只允许输入数字和一个小数点
...
...
Please
register
or
login
to post a comment