hookehuyr

fix(plan): 修复计划书表单字段映射并统一术语

- 修复 smoking_status 字段映射(之前错误映射为 smoker)
- 删除未使用的 formatAmounts 函数
- 将所有"客户姓名"统一改为"申请人"
- 更新表单标签、占位符和错误提示

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
35 * @example 35 * @example
36 * <PlanFieldName 36 * <PlanFieldName
37 * v-model="form.customer_name" 37 * v-model="form.customer_name"
38 - * label="客户姓名" 38 + * label="申请人"
39 - * placeholder="请输入客户姓名" 39 + * placeholder="请输入申请人"
40 * :required="true" 40 * :required="true"
41 * /> 41 * />
42 */ 42 */
......
...@@ -228,30 +228,6 @@ const close = async () => { ...@@ -228,30 +228,6 @@ const close = async () => {
228 } 228 }
229 229
230 /** 230 /**
231 - * 格式化金额数据(分 → 元)
232 - * @description 将金额从"分"转换为"元"(带2位小数),便于调试和查看
233 - * @param {Object} data - 表单数据
234 - * @returns {Object} 格式化后的表单数据
235 - * @example
236 - * formatAmounts({ coverage: 10000 }) // 返回 { coverage: '100.00' }
237 - */
238 -const formatAmounts = (data) => {
239 - const formatted = { ...data }
240 -
241 - // 金额字段列表(单位:分)
242 - const amountFields = ['coverage', 'premium', 'amount', 'total_amount']
243 -
244 - for (const field of amountFields) {
245 - if (formatted[field] !== null && formatted[field] !== undefined) {
246 - // 分 → 元,保留2位小数
247 - formatted[field] = (formatted[field] / 100).toFixed(2)
248 - }
249 - }
250 -
251 - return formatted
252 -}
253 -
254 -/**
255 * 提交表单 231 * 提交表单
256 * @description 将表单数据和产品信息提交到后端 API 232 * @description 将表单数据和产品信息提交到后端 API
257 * 233 *
...@@ -284,17 +260,17 @@ const submit = async () => { ...@@ -284,17 +260,17 @@ const submit = async () => {
284 260
285 try { 261 try {
286 // 字段名映射:将表单字段名映射为 API 期望的字段名 262 // 字段名映射:将表单字段名映射为 API 期望的字段名
263 + // 根据 API 文档 (docs/api-specs/plan/add.md) 定义
287 const fieldMapping = { 264 const fieldMapping = {
288 - customer_name: 'customer_name', // 客户姓名(已直接使用) 265 + customer_name: 'customer_name', // 申请人(已直接使用)
289 gender: 'customer_gender', // 性别 → customer_gender 266 gender: 'customer_gender', // 性别 → customer_gender
290 age: 'customer_age', // 年龄 → customer_age 267 age: 'customer_age', // 年龄 → customer_age
291 birthday: 'customer_birthday', // 出生年月日 → customer_birthday 268 birthday: 'customer_birthday', // 出生年月日 → customer_birthday
292 - smoker: 'smoker', // 是否吸烟(保持不变) 269 + smoker: 'smoking_status', // 是否吸烟 → smoking_status
293 coverage: 'annual_premium', // 保额/年缴保费 → annual_premium 270 coverage: 'annual_premium', // 保额/年缴保费 → annual_premium
294 payment_period: 'payment_years', // 缴费年期 → payment_years 271 payment_period: 'payment_years', // 缴费年期 → payment_years
295 withdrawal_enabled: 'allow_reduce_amount', // 是否容许减少名义金额 272 withdrawal_enabled: 'allow_reduce_amount', // 是否容许减少名义金额
296 withdrawal_mode: 'withdrawal_option', // 提取选项 273 withdrawal_mode: 'withdrawal_option', // 提取选项
297 - specified_amount_type: null, // 提取方式(后端可能不需要)
298 withdrawal_start_age: 'withdrawal_start_age', // 提取开始年龄 274 withdrawal_start_age: 'withdrawal_start_age', // 提取开始年龄
299 withdrawal_period: 'withdrawal_period', // 提取期 275 withdrawal_period: 'withdrawal_period', // 提取期
300 currency_type: 'currency_type' // 币种类型 276 currency_type: 'currency_type' // 币种类型
......
1 <template> 1 <template>
2 <div v-if="config"> 2 <div v-if="config">
3 - <!-- 客户姓名 --> 3 + <!-- 申请人 -->
4 <PlanFieldName 4 <PlanFieldName
5 v-model="form.customer_name" 5 v-model="form.customer_name"
6 - label="客户姓名" 6 + label="申请人"
7 - placeholder="请输入客户姓名" 7 + placeholder="请输入申请人"
8 :required="true" 8 :required="true"
9 class="mb-5" 9 class="mb-5"
10 /> 10 />
...@@ -239,7 +239,7 @@ const onBirthdayChange = (birthday) => { ...@@ -239,7 +239,7 @@ const onBirthdayChange = (birthday) => {
239 */ 239 */
240 const validate = () => { 240 const validate = () => {
241 if (!form.customer_name || !form.customer_name.trim()) { 241 if (!form.customer_name || !form.customer_name.trim()) {
242 - Taro.showToast({ title: '请输入客户姓名', icon: 'none' }) 242 + Taro.showToast({ title: '请输入申请人', icon: 'none' })
243 return false 243 return false
244 } 244 }
245 if (!form.gender) { 245 if (!form.gender) {
......
1 <template> 1 <template>
2 <div v-if="config"> 2 <div v-if="config">
3 - <!-- 客户姓名 --> 3 + <!-- 申请人 -->
4 <PlanFieldName 4 <PlanFieldName
5 v-model="form.customer_name" 5 v-model="form.customer_name"
6 - label="客户姓名" 6 + label="申请人"
7 - placeholder="请输入客户姓名" 7 + placeholder="请输入申请人"
8 :required="true" 8 :required="true"
9 class="mb-5" 9 class="mb-5"
10 /> 10 />
...@@ -242,7 +242,7 @@ const onBirthdayChange = (birthday) => { ...@@ -242,7 +242,7 @@ const onBirthdayChange = (birthday) => {
242 */ 242 */
243 const validate = () => { 243 const validate = () => {
244 if (!form.customer_name || !form.customer_name.trim()) { 244 if (!form.customer_name || !form.customer_name.trim()) {
245 - Taro.showToast({ title: '请输入客户姓名', icon: 'none' }) 245 + Taro.showToast({ title: '请输入申请人', icon: 'none' })
246 return false 246 return false
247 } 247 }
248 if (!form.gender) { 248 if (!form.gender) {
......
1 <template> 1 <template>
2 <div v-if="config"> 2 <div v-if="config">
3 - <!-- 客户姓名 --> 3 + <!-- 申请人 -->
4 <PlanFieldName 4 <PlanFieldName
5 v-model="form.customer_name" 5 v-model="form.customer_name"
6 - label="客户姓名" 6 + label="申请人"
7 - placeholder="请输入客户姓名" 7 + placeholder="请输入申请人"
8 :required="true" 8 :required="true"
9 class="mb-5" 9 class="mb-5"
10 /> 10 />
...@@ -468,7 +468,7 @@ watch( ...@@ -468,7 +468,7 @@ watch(
468 const validate = () => { 468 const validate = () => {
469 // 基础字段校验 469 // 基础字段校验
470 if (!form.customer_name || !form.customer_name.trim()) { 470 if (!form.customer_name || !form.customer_name.trim()) {
471 - Taro.showToast({ title: '请输入客户姓名', icon: 'none' }) 471 + Taro.showToast({ title: '请输入申请人', icon: 'none' })
472 return false 472 return false
473 } 473 }
474 if (!form.gender) { 474 if (!form.gender) {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
11 <view class="px-[24rpx] py-[16rpx] bg-white"> 11 <view class="px-[24rpx] py-[16rpx] bg-white">
12 <SearchBar 12 <SearchBar
13 v-model="searchValue" 13 v-model="searchValue"
14 - placeholder="搜索计划书名称、客户姓名..." 14 + placeholder="搜索计划书名称、申请人..."
15 :show-clear="true" 15 :show-clear="true"
16 variant="rounded" 16 variant="rounded"
17 @search="onSearch" 17 @search="onSearch"
......