feat(搜索转账对象页): 更新UI
This commit is contained in:
parent
83f05c0d3a
commit
a0ebc76f9f
@ -3,21 +3,6 @@
|
|||||||
<MobileHeader title="Search Payee" />
|
<MobileHeader title="Search Payee" />
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<!-- 用户类型选择 -->
|
|
||||||
<!-- <div v-if="!isLoadingRole && availableUserTypes.length > 1" class="user-type-selector">
|
|
||||||
<label>搜索类型:</label>
|
|
||||||
<div class="type-buttons">
|
|
||||||
<button
|
|
||||||
v-for="type in availableUserTypes"
|
|
||||||
:key="type.value"
|
|
||||||
@click="selectedUserType = type.value"
|
|
||||||
:class="['type-btn', { active: selectedUserType === type.value }]"
|
|
||||||
>
|
|
||||||
{{ type.label }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<!-- 搜索框 -->
|
<!-- 搜索框 -->
|
||||||
<div style="display: flex; gap: 4px">
|
<div style="display: flex; gap: 4px">
|
||||||
<div
|
<div
|
||||||
@ -53,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
v-if="!searchQuery"
|
v-if="!hasSearched && searchQuery"
|
||||||
class="search-btn"
|
class="search-btn"
|
||||||
style="
|
style="
|
||||||
border: none;
|
border: none;
|
||||||
@ -150,13 +135,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 空状态 -->
|
|
||||||
<div v-else-if="searchQuery && !isSearching && !isLoadingRole" class="empty-state">
|
|
||||||
<div class="empty-icon">🔍</div>
|
|
||||||
<p>No users found</p>
|
|
||||||
<span>Try searching with a different keyword</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 加载状态 -->
|
<!-- 加载状态 -->
|
||||||
<div v-if="isSearching" class="loading-state">
|
<div v-if="isSearching" class="loading-state">
|
||||||
<div class="loading-spinner"></div>
|
<div class="loading-spinner"></div>
|
||||||
@ -167,7 +145,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted, watch } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import MobileHeader from '../components/MobileHeader.vue'
|
import MobileHeader from '../components/MobileHeader.vue'
|
||||||
import { userBankCheckTransfer, userBankSearchUserProfile } from '../api/wallet.js'
|
import { userBankCheckTransfer, userBankSearchUserProfile } from '../api/wallet.js'
|
||||||
@ -179,6 +157,7 @@ const router = useRouter()
|
|||||||
const searchQuery = ref('')
|
const searchQuery = ref('')
|
||||||
const searchResults = ref([])
|
const searchResults = ref([])
|
||||||
const isSearching = ref(false)
|
const isSearching = ref(false)
|
||||||
|
const hasSearched = ref(false)
|
||||||
const userRole = ref('')
|
const userRole = ref('')
|
||||||
const isLoadingRole = ref(false)
|
const isLoadingRole = ref(false)
|
||||||
const selectedUserType = ref('')
|
const selectedUserType = ref('')
|
||||||
@ -318,6 +297,7 @@ const performSearch = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isSearching.value = true
|
isSearching.value = true
|
||||||
|
hasSearched.value = false
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await userBankSearchUserProfile(searchQuery.value.trim())
|
const response = await userBankSearchUserProfile(searchQuery.value.trim())
|
||||||
@ -350,11 +330,13 @@ const performSearch = async () => {
|
|||||||
showError('User not found or search failed')
|
showError('User not found or search failed')
|
||||||
} finally {
|
} finally {
|
||||||
isSearching.value = false
|
isSearching.value = false
|
||||||
|
hasSearched.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除搜索
|
// 清除搜索
|
||||||
const clearSearch = () => {
|
const clearSearch = () => {
|
||||||
|
hasSearched.value = false
|
||||||
searchQuery.value = ''
|
searchQuery.value = ''
|
||||||
searchResults.value = []
|
searchResults.value = []
|
||||||
}
|
}
|
||||||
@ -391,6 +373,15 @@ const getRoleDescription = (role) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => searchQuery.value,
|
||||||
|
() => {
|
||||||
|
if (hasSearched.value) {
|
||||||
|
hasSearched.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// 页面加载时检查用户角色
|
// 页面加载时检查用户角色
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
checkUserRole()
|
checkUserRole()
|
||||||
@ -575,22 +566,4 @@ onMounted(() => {
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 360px) {
|
|
||||||
* {
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 360px) {
|
|
||||||
* {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
|
||||||
* {
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user