feat(结账页面): 添加编辑个人信息按钮及处理逻辑
添加编辑按钮允许用户修改已提交的个人信息 实现handleEditInfo方法处理编辑逻辑,构建编辑URL并显示弹窗
Showing
1 changed file
with
28 additions
and
0 deletions
| ... | @@ -91,6 +91,17 @@ | ... | @@ -91,6 +91,17 @@ |
| 91 | scrolling="no" | 91 | scrolling="no" |
| 92 | @load="adjustIframeHeight" | 92 | @load="adjustIframeHeight" |
| 93 | ></iframe> | 93 | ></iframe> |
| 94 | + | ||
| 95 | + <!-- 编辑按钮 --> | ||
| 96 | + <!-- <div v-if="!showInfoEntry && iframeInfoSrc" class="mt-3 text-center"> --> | ||
| 97 | + <div class="mt-3 text-center"> | ||
| 98 | + <div | ||
| 99 | + @click="handleEditInfo" | ||
| 100 | + class="px-4 py-2 bg-green-500 text-white rounded-lg text-sm hover:bg-green-600" | ||
| 101 | + > | ||
| 102 | + 编辑信息 | ||
| 103 | + </div> | ||
| 104 | + </div> | ||
| 94 | </FrostedGlass> | 105 | </FrostedGlass> |
| 95 | 106 | ||
| 96 | <FrostedGlass class="rounded-xl p-4 mb-6"> | 107 | <FrostedGlass class="rounded-xl p-4 mb-6"> |
| ... | @@ -468,6 +479,23 @@ const handleInfoEntryComplete = async (data) => { | ... | @@ -468,6 +479,23 @@ const handleInfoEntryComplete = async (data) => { |
| 468 | } | 479 | } |
| 469 | } | 480 | } |
| 470 | 481 | ||
| 482 | +// 处理编辑个人信息 | ||
| 483 | +const handleEditInfo = () => { | ||
| 484 | + // cartItems是数组,需要找到包含form_url的项目 | ||
| 485 | + const itemWithForm = cartItems.value.find(item => item.form_url) | ||
| 486 | + if (itemWithForm && itemWithForm.form_url && formData.value.customize_id) { | ||
| 487 | + // 构建编辑URL,添加page_type=edit和data_id参数 | ||
| 488 | + const editUrl = itemWithForm.form_url + '&page_type=edit' + '&data_id=' + formData.value.customize_id | ||
| 489 | + console.log('打开编辑个人信息弹窗,URL:', editUrl) | ||
| 490 | + | ||
| 491 | + // 设置iframe地址并显示弹窗 | ||
| 492 | + iframeSrc.value = editUrl | ||
| 493 | + showInfoEntry.value = true | ||
| 494 | + } else { | ||
| 495 | + console.log('无法编辑:未找到form_url或customize_id') | ||
| 496 | + } | ||
| 497 | +} | ||
| 498 | + | ||
| 471 | // 处理个人信息录入关闭 | 499 | // 处理个人信息录入关闭 |
| 472 | const handleInfoEntryClose = () => { | 500 | const handleInfoEntryClose = () => { |
| 473 | showInfoEntry.value = false | 501 | showInfoEntry.value = false | ... | ... |
-
Please register or login to post a comment