refactor(PaymentAgreementModal): 移除冗余的return语句并优化loading状态处理
移除handleBindJeePay函数中不必要的return语句,保持代码简洁 优化三个异步函数中的loading状态处理,保持一致性
Showing
1 changed file
with
3 additions
and
6 deletions
| ... | @@ -208,7 +208,7 @@ const checkBindStatus = async () => { | ... | @@ -208,7 +208,7 @@ const checkBindStatus = async () => { |
| 208 | try { | 208 | try { |
| 209 | // 设置loading状态,禁用用户操作 | 209 | // 设置loading状态,禁用用户操作 |
| 210 | isLoading.value = true | 210 | isLoading.value = true |
| 211 | - | 211 | + |
| 212 | const result = await bindJeePayAPI() | 212 | const result = await bindJeePayAPI() |
| 213 | 213 | ||
| 214 | if (result.code && result.data) { | 214 | if (result.code && result.data) { |
| ... | @@ -246,7 +246,7 @@ const handleAgree = async () => { | ... | @@ -246,7 +246,7 @@ const handleAgree = async () => { |
| 246 | try { | 246 | try { |
| 247 | // 设置loading状态 | 247 | // 设置loading状态 |
| 248 | isLoading.value = true | 248 | isLoading.value = true |
| 249 | - | 249 | + |
| 250 | // 调用API更新用户协议状态 | 250 | // 调用API更新用户协议状态 |
| 251 | const result = await updateProfileAPI({ | 251 | const result = await updateProfileAPI({ |
| 252 | is_signed: true | 252 | is_signed: true |
| ... | @@ -281,7 +281,7 @@ const handleConfirm = async () => { | ... | @@ -281,7 +281,7 @@ const handleConfirm = async () => { |
| 281 | try { | 281 | try { |
| 282 | // 设置loading状态 | 282 | // 设置loading状态 |
| 283 | isLoading.value = true | 283 | isLoading.value = true |
| 284 | - | 284 | + |
| 285 | // 调用绑定接口 | 285 | // 调用绑定接口 |
| 286 | await handleBindJeePay() | 286 | await handleBindJeePay() |
| 287 | } catch (error) { | 287 | } catch (error) { |
| ... | @@ -326,7 +326,6 @@ const handleBindJeePay = async () => { | ... | @@ -326,7 +326,6 @@ const handleBindJeePay = async () => { |
| 326 | } | 326 | } |
| 327 | } | 327 | } |
| 328 | }) | 328 | }) |
| 329 | - return | ||
| 330 | } | 329 | } |
| 331 | 330 | ||
| 332 | // 2. 如果返回 auth_sign_url 非空时,需要跳转到签约网页 | 331 | // 2. 如果返回 auth_sign_url 非空时,需要跳转到签约网页 |
| ... | @@ -345,7 +344,6 @@ const handleBindJeePay = async () => { | ... | @@ -345,7 +344,6 @@ const handleBindJeePay = async () => { |
| 345 | } | 344 | } |
| 346 | } | 345 | } |
| 347 | }) | 346 | }) |
| 348 | - return | ||
| 349 | } | 347 | } |
| 350 | 348 | ||
| 351 | // 3. 如果返回 is_wait_audit 为 true,则提示用户签约正在等待审核 | 349 | // 3. 如果返回 is_wait_audit 为 true,则提示用户签约正在等待审核 |
| ... | @@ -356,7 +354,6 @@ const handleBindJeePay = async () => { | ... | @@ -356,7 +354,6 @@ const handleBindJeePay = async () => { |
| 356 | showCancel: false, | 354 | showCancel: false, |
| 357 | confirmText: '关闭' | 355 | confirmText: '关闭' |
| 358 | }) | 356 | }) |
| 359 | - return | ||
| 360 | } | 357 | } |
| 361 | 358 | ||
| 362 | // 4. 如果返回 is_finish 为 true 则绑定成功,可以卖车 | 359 | // 4. 如果返回 is_finish 为 true 则绑定成功,可以卖车 | ... | ... |
-
Please register or login to post a comment