feat(搜索转账代理): 调整接口和文件路径

This commit is contained in:
hzj 2025-11-12 12:25:45 +08:00
parent 5c4033611f
commit b1db3c8d01
5 changed files with 37 additions and 143 deletions

View File

@ -46,10 +46,17 @@ export function userBankTransfer(data) {
* 搜索用户资料
* @param {string} type - 用户类型 (AGENT/BD/ANCHOR)
* @param {string} account - 用户账号/ID
* @param {string} searchType - 搜索类型
* @returns {Promise} 返回用户资料
*/
export function userBankSearchUserProfile(account) {
return get(`/wallet/bank/search/user-profile?account=${account}&type=AGENT`)
export function userBankSearchUserProfile(account, searchType = '') {
if (searchType == '') {
return get(`/wallet/bank/search/user-profile?account=${account}&type=AGENT`)
} else {
return get(
`/wallet/bank/search/user-profile?account=${account}&type=AGENT&searchType=${searchType}`
)
}
}
/**

View File

@ -55,7 +55,7 @@ const router = createRouter({
{
path: '/transfer',
name: 'transfer',
component: () => import('../views/TransferView.vue'),
component: () => import('../views/Wallet/Transfer/TransferView.vue'),
meta: { requiresAuth: true },
},
{
@ -85,7 +85,7 @@ const router = createRouter({
{
path: '/search-payee',
name: 'search-payee',
component: () => import('../views/SearchPayeeView.vue'),
component: () => import('../views/Wallet/Transfer/SearchPayeeView.vue'),
meta: { requiresAuth: true },
},
{

View File

@ -910,7 +910,7 @@ const showDetails = () => {
//
const searchPayee = () => {
router.push('/search-payee')
router.push({ path: '/search-payee', query: { searchType: 'TRANSFER' } })
}
//

View File

@ -2,7 +2,7 @@
<div class="search-payee gradient-background-circles">
<!-- 使用 GeneralHeader 替换 MobileHeader -->
<GeneralHeader
:title="pageTitle"
:title="t('search_payee')"
:showBack="true"
:showLanguageList="true"
color="black"
@ -26,7 +26,7 @@
padding: 4px 12px;
"
>
<img src="../assets/icon/search.png" alt="" width="16px" style="opacity: 0.6" />
<img src="../../../assets/icon/search.png" alt="" width="16px" style="opacity: 0.6" />
<input
v-model="searchQuery"
type="text"
@ -123,21 +123,21 @@
<div style="display: flex; gap: 2px; margin-top: 8px; margin-left: 50px; height: 20px">
<img
v-if="user.isHost"
src="../assets/icon/host.png"
src="../../../assets/icon/host.png"
alt=""
height="100%"
style="object-fit: cover"
/>
<img
v-if="user.isAgency"
src="../assets/icon/agency.png"
src="../../../assets/icon/agency.png"
alt=""
height="100%"
style="object-fit: cover"
/>
<img
v-if="user.hasSalary"
src="../assets/icon/RA.png"
src="../../../assets/icon/RA.png"
alt=""
height="100%"
style="object-fit: cover"
@ -224,8 +224,8 @@ import { ref, computed, onMounted, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import GeneralHeader from '@/components/GeneralHeader.vue'
import { userBankCheckTransfer, userBankSearchUserProfile } from '../api/wallet.js'
import { setSelectedPayee } from '../utils/payeeStore.js'
import { userBankCheckTransfer, userBankSearchUserProfile } from '@/api/wallet.js'
import { setSelectedPayee } from '@/utils/payeeStore.js'
import { showError } from '@/utils/toast.js'
import maskLayer from '@/components/MaskLayer.vue'
import { setDocumentDirection } from '@/locales/i18n'
@ -237,11 +237,6 @@ const route = useRoute()
//
locale.value && setDocumentDirection(locale.value)
const fromLottery = computed(() => route.query?.from == 'lottery')
const pageTitle = computed(() =>
route.query?.from == 'lottery' ? t('add_recharge_agent') : t('search_payee')
)
const searchQuery = ref('')
const searchResults = ref([])
const isSearching = ref(false)
@ -249,105 +244,10 @@ const hasSearched = ref(false)
const userRole = ref('')
const isLoadingRole = ref(false)
const selectedUserType = ref('')
const showTypeSelector = ref(false)
const maskLayerShow = ref(false)
const selectedUser = ref({})
// -
const allUsers = {
TEAM_OWN: [
{
id: '1234567890',
name: 'Agent User',
type: 'AGENT',
isHost: false,
isAgency: true,
hasSalary: false,
},
{
id: '0987654321',
name: 'BD Manager',
type: 'BD',
isHost: false,
isAgency: true,
hasSalary: true,
},
{
id: '1122334455',
name: 'Host Anchor',
type: 'ANCHOR',
isHost: true,
isAgency: false,
hasSalary: true,
},
],
TEAM_MEMBER: [
{
id: '1234567890',
name: 'Team Agent',
type: 'AGENT',
isHost: false,
isAgency: true,
hasSalary: false,
},
{
id: '0987654321',
name: 'BD Manager',
type: 'BD',
isHost: false,
isAgency: true,
hasSalary: true,
},
],
BD: [
{
id: '1234567890',
name: 'Agent User',
type: 'AGENT',
isHost: false,
isAgency: true,
hasSalary: false,
},
],
default: [
{
id: '1234567890',
name: 'Default User',
type: 'USER',
isHost: false,
isAgency: false,
hasSalary: false,
},
],
}
//
const availableUsers = computed(() => {
return allUsers[userRole.value] || allUsers['default']
})
//
// const availableUserTypes = computed(() => {
// switch (userRole.value) {
// case 'TEAM_OWN':
// return [
// { label: 'Agent', value: 'AGENT' },
// { label: 'BD Manager', value: 'BD' },
// { label: 'Anchor', value: 'ANCHOR' },
// ]
// case 'TEAM_MEMBER':
// return [
// { label: 'Agent', value: 'AGENT' },
// { label: 'BD Manager', value: 'BD' },
// ]
// case 'BD':
// return [{ label: 'Agent', value: 'AGENT' }]
// default:
// return [{ label: 'User', value: 'USER' }]
// }
// })
//
const checkUserRole = async () => {
isLoadingRole.value = true
@ -391,7 +291,10 @@ const performSearch = async () => {
hasSearched.value = false
try {
const response = await userBankSearchUserProfile(searchQuery.value.trim())
const response = await userBankSearchUserProfile(
searchQuery.value.trim(),
route.query?.searchType || ''
)
if (response.status && response.body) {
// API
@ -435,11 +338,7 @@ const clearSearch = () => {
//
const selectUser = (user) => {
selectedUser.value = user
if (fromLottery.value) {
maskLayerShow.value = true
} else {
Confirm()
}
maskLayerShow.value = true
}
const Cancel = () => {
@ -450,26 +349,9 @@ const Cancel = () => {
const Confirm = () => {
//
setSelectedPayee({ ...selectedUser.value })
// Transfer
// router.push('/transfer')
router.go(-1)
}
//
const getRoleDescription = (role) => {
switch (role) {
case 'TEAM_OWN':
return 'Agents, BD Managers, Anchors'
case 'TEAM_MEMBER':
return 'Agents, BD Managers'
case 'BD':
return 'Agents'
default:
return 'Users'
}
}
watch(
() => searchQuery.value,
() => {

View File

@ -24,7 +24,7 @@
<div style="display: flex; align-items: center" @click="showDetails">
<div style="color: rgba(0, 0, 0, 0.4)">{{ t('details') }}</div>
<img
src="../assets/icon/arrow.png"
src="../../../assets/icon/arrow.png"
alt=""
width="16px"
style="margin-left: 4px"
@ -129,16 +129,21 @@
</div>
<!-- 身份 -->
<div style="margin-left: 62px; height: 20px; display: flex; gap: 5px">
<img v-if="selectedPayee.isHost" src="../assets/icon/host.png" alt="" height="100%" />
<img
v-if="selectedPayee.isHost"
src="../../../assets/icon/host.png"
alt=""
height="100%"
/>
<img
v-if="selectedPayee.isAgency"
src="../assets/icon/agency.png"
src="../../../assets/icon/agency.png"
alt=""
height="100%"
/>
<img
v-if="selectedPayee.hasSalary"
src="../assets/icon/RA.png"
src="../../../assets/icon/RA.png"
alt=""
height="100%"
/>
@ -181,7 +186,7 @@
@click="selectCoin(coin)"
:class="['coin-item', { selected: selectedCoin === coin.id }]"
>
<img src="../assets/icon/dollar.png" alt="" style="width: 40%" />
<img src="../../../assets/icon/dollar.png" alt="" style="width: 40%" />
<div style="font-weight: 500; color: #131111">${{ coin.price }}</div>
</div>
</div>
@ -208,8 +213,8 @@ import { ref, reactive, onMounted, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import GeneralHeader from '@/components/GeneralHeader.vue'
import { getBankBalance, userBankTransfer } from '../api/wallet.js'
import { getSelectedPayee, clearSelectedPayee } from '../utils/payeeStore.js'
import { getBankBalance, userBankTransfer } from '@/api/wallet.js'
import { getSelectedPayee, clearSelectedPayee } from '@/utils/payeeStore.js'
import { showError, showSuccess } from '@/utils/toast.js'
import { setDocumentDirection } from '@/locales/i18n'
@ -292,7 +297,7 @@ const showDetails = () => {
}
const searchPayee = () => {
router.push('/search-payee')
router.push({ path: '/search-payee', query: { searchType: 'TRANSFER' } })
}
//