feat(j提现转账的返回功能): 将相关页面的返回功能都设置成可携带参数返回
This commit is contained in:
parent
d1347f8bcc
commit
b781f2810e
@ -88,42 +88,61 @@
|
||||
<script setup>
|
||||
import { isInApp, closePage } from '@/utils/appBridge.js'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { computed, ref, onMounted, watch } from 'vue'
|
||||
import { computed, ref, onMounted, watch, nextTick } from 'vue'
|
||||
import { useLangStore } from '@/stores/lang'
|
||||
import { setLocale } from '@/locales/i18n'
|
||||
|
||||
// 定义props
|
||||
const props = defineProps({
|
||||
// 标题
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
||||
// 是否显示返回按钮
|
||||
showBack: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
|
||||
// 是否显示帮助按钮
|
||||
showHelp: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
// 是否为首页
|
||||
isHomePage: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
// 是否显示语言列表
|
||||
showLanguageList: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
// 标题颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: '#fff',
|
||||
},
|
||||
|
||||
// 返回图标
|
||||
backImg: {
|
||||
type: String,
|
||||
default: () => {
|
||||
return new URL('../assets/icon/arrowBack.png', import.meta.url).href
|
||||
},
|
||||
},
|
||||
|
||||
// 携带参数返回
|
||||
backQuery: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
})
|
||||
|
||||
// 定义emits
|
||||
@ -180,10 +199,24 @@ const handleBack = () => {
|
||||
if (isCurrentlyHomePage.value && isInApp()) {
|
||||
// 首页且在APP中:关闭页面
|
||||
console.log('home back')
|
||||
closePage() // 这个函数似乎未定义,需要确认
|
||||
closePage()
|
||||
} else {
|
||||
// 非首页或浏览器环境:正常返回
|
||||
router.go(-1)
|
||||
if (props.backQuery != null) {
|
||||
console.log('props.backQuery', props.backQuery)
|
||||
|
||||
// 使用 nextTick 确保上一步完成
|
||||
nextTick(() => {
|
||||
// 使用 replace 替换为带参数的版本
|
||||
router.replace({
|
||||
path: props.backQuery.from,
|
||||
query: {
|
||||
activeAction: props.backQuery.activeAction,
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1074,7 +1074,7 @@ const clearPayee = () => {
|
||||
|
||||
// 前往搜索代理页
|
||||
const searchPayee = () => {
|
||||
router.push({ path: '/search-payee', query: { from: 'lottery' } })
|
||||
router.push('/search-payee')
|
||||
}
|
||||
|
||||
// 前往提现页
|
||||
|
||||
@ -896,12 +896,15 @@ const fetchBankBalance = async () => {
|
||||
|
||||
// 前往提交个人资料
|
||||
const gotoKYC = () => {
|
||||
router.push('/KYC')
|
||||
router.push({ path: '/KYC', query: { from: '/available-income', activeAction: 'Cash out' } })
|
||||
}
|
||||
|
||||
// 前往选择提交方式
|
||||
const gotoselectBank = () => {
|
||||
router.push('/bank-card')
|
||||
router.push({
|
||||
path: '/bank-card',
|
||||
query: { from: '/available-income', activeAction: 'Cash out' },
|
||||
})
|
||||
}
|
||||
|
||||
// 跳转详情
|
||||
@ -911,7 +914,10 @@ const showDetails = () => {
|
||||
|
||||
// 跳转搜索收款人
|
||||
const searchPayee = () => {
|
||||
router.push({ path: '/search-payee', query: { searchType: 'TRANSFER' } })
|
||||
router.push({
|
||||
path: '/search-payee',
|
||||
query: { from: '/available-income', activeAction: 'Transfer' },
|
||||
})
|
||||
}
|
||||
|
||||
// 处理操作按钮点击
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
<template>
|
||||
<div class="fullPage">
|
||||
<GeneralHeader style="width: 100%" title="Bank Card" :showLanguageList="true" color="black" />
|
||||
<GeneralHeader
|
||||
style="width: 100%"
|
||||
title="Bank Card"
|
||||
:showLanguageList="true"
|
||||
color="black"
|
||||
:backQuery="backQuery"
|
||||
/>
|
||||
<div style="padding: 16px; display: flex; flex-direction: column; gap: 8px">
|
||||
<!-- 当前使用的银行卡 -->
|
||||
<div style="font-weight: 600">Currently In Use</div>
|
||||
@ -312,6 +318,7 @@
|
||||
<script setup>
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import GeneralHeader from '@/components/GeneralHeader.vue'
|
||||
import { showError, showWarning, showInfo, showSuccess } from '@/utils/toast.js'
|
||||
import { getUserId } from '@/utils/userStore'
|
||||
import {
|
||||
@ -322,6 +329,10 @@ import {
|
||||
useBankCard,
|
||||
} from '@/api/wallet'
|
||||
import maskLayer from '@/components/MaskLayer.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
const backQuery = ref(route.query || null)
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
<template>
|
||||
<div class="fullPage">
|
||||
<GeneralHeader style="width: 100%" :title="t('kyc')" :showLanguageList="true" color="black" />
|
||||
<GeneralHeader
|
||||
style="width: 100%"
|
||||
:title="t('kyc')"
|
||||
:showLanguageList="true"
|
||||
color="black"
|
||||
:backQuery="backQuery"
|
||||
/>
|
||||
|
||||
<div style="padding: 16px; display: flex; flex-direction: column; gap: 8px">
|
||||
<!-- 银行卡号 -->
|
||||
@ -191,9 +197,9 @@
|
||||
import { isInApp } from '@/utils/appBridge.js'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import GeneralHeader from '@/components/GeneralHeader.vue'
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { ref, onMounted, computed, nextTick } from 'vue'
|
||||
import { showError, showWarning, showInfo, showSuccess } from '@/utils/toast.js'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { uploadImg } from '@/api/upload.js'
|
||||
import { setDocumentDirection } from '@/locales/i18n'
|
||||
import { getWithdrawInfoList, addWithdrawInfo, updateWithdrawInfo } from '@/api/wallet'
|
||||
@ -203,6 +209,8 @@ import { storeToRefs } from 'pinia'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const backQuery = ref(route.query || null)
|
||||
const lastImgStore = useLastImgStore()
|
||||
// 初始化时从 localStorage 恢复数据
|
||||
lastImgStore.initFromStorage()
|
||||
@ -359,7 +367,24 @@ const Submit = () => {
|
||||
console.log('添加信息:', applyInfo.value)
|
||||
addWithdrawInfoData()
|
||||
}
|
||||
// router.go(-1)
|
||||
// 先返回到 availableIncome (原始状态)
|
||||
router.go(-1)
|
||||
|
||||
// 检查是否来自 availableIncome 页面
|
||||
if (route.query) {
|
||||
console.log('route.query:', route.query)
|
||||
|
||||
// 使用 nextTick 确保上一步完成
|
||||
nextTick(() => {
|
||||
// 然后使用 replace 替换为带参数的版本
|
||||
router.replace({
|
||||
path: route.query.from,
|
||||
query: {
|
||||
activeAction: route.query.activeAction,
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,7 +411,7 @@ const addWithdrawInfoData = async () => {
|
||||
const resAddWithdrawInfo = await addWithdrawInfo(applyInfo.value)
|
||||
if (resAddWithdrawInfo.status) {
|
||||
showSuccess(t('application_submitted'))
|
||||
getWithdrawInfoListData() // 重新获取提现信息列表
|
||||
// getWithdrawInfoListData() // 重新获取提现信息列表
|
||||
}
|
||||
} catch (error) {
|
||||
showError(error.response?.errorMsg)
|
||||
@ -400,7 +425,7 @@ const updateWithdrawInfoData = async () => {
|
||||
const resUpdateWithdrawInfo = await updateWithdrawInfo(applyInfo.value)
|
||||
if (resUpdateWithdrawInfo.status) {
|
||||
showSuccess(t('application_submitted'))
|
||||
getWithdrawInfoListData() // 重新获取提现信息列表
|
||||
// getWithdrawInfoListData() // 重新获取提现信息列表
|
||||
}
|
||||
} catch (error) {
|
||||
showError(error.response?.errorMsg)
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
:showLanguageList="true"
|
||||
color="black"
|
||||
style="box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); z-index: 999"
|
||||
:backQuery="backQuery"
|
||||
/>
|
||||
|
||||
<div class="content">
|
||||
@ -233,6 +234,7 @@ import { setDocumentDirection } from '@/locales/i18n'
|
||||
const { t, locale } = useI18n()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const backQuery = ref(route.query || null)
|
||||
|
||||
// 监听语言变化并设置文档方向
|
||||
locale.value && setDocumentDirection(locale.value)
|
||||
@ -291,10 +293,7 @@ const performSearch = async () => {
|
||||
hasSearched.value = false
|
||||
|
||||
try {
|
||||
const response = await userBankSearchUserProfile(
|
||||
searchQuery.value.trim(),
|
||||
route.query?.searchType || ''
|
||||
)
|
||||
const response = await userBankSearchUserProfile(searchQuery.value.trim(), 'TRANSFER')
|
||||
|
||||
if (response.status && response.body) {
|
||||
// 根据新的API返回数据结构进行映射
|
||||
|
||||
@ -297,7 +297,7 @@ const showDetails = () => {
|
||||
}
|
||||
|
||||
const searchPayee = () => {
|
||||
router.push({ path: '/search-payee', query: { searchType: 'TRANSFER' } })
|
||||
router.push('/search-payee')
|
||||
}
|
||||
|
||||
// 清除当前选中的收款人
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user