diff --git a/src/views/mall/promotion/kefu/components/member/MemberInfo.vue b/src/views/mall/promotion/kefu/components/member/MemberInfo.vue index 952d34c8..15192808 100644 --- a/src/views/mall/promotion/kefu/components/member/MemberInfo.vue +++ b/src/views/mall/promotion/kefu/components/member/MemberInfo.vue @@ -25,6 +25,21 @@ +
+ + + + + + + + + +
@@ -45,11 +60,17 @@ import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation' import { isEmpty } from '@/utils/is' import { debounce } from 'lodash-es' import { ElScrollbar as ElScrollbarType } from 'element-plus/es/components/scrollbar/index' +import { CardTitle } from '@/components/Card' +import UserBasicInfo from '@/views/member/user/detail/UserBasicInfo.vue' +import UserAccountInfo from '@/views/member/user/detail/UserAccountInfo.vue' +import * as UserApi from '@/api/member/user' +import * as WalletApi from '@/api/pay/wallet/balance' defineOptions({ name: 'MemberBrowsingHistory' }) const activeTab = ref('会员信息') const tabActivation = computed(() => (tab: string) => activeTab.value === tab) + /** tab 切换 */ const productBrowsingHistoryRef = ref>() const orderBrowsingHistoryRef = ref>() @@ -63,6 +84,8 @@ const handleClick = async (tab: string) => { const getHistoryList = async () => { switch (activeTab.value) { case '会员信息': + await getUserData() + await getUserWallet() break case '最近浏览': await productBrowsingHistoryRef.value?.getHistoryList(conversation.value) @@ -110,6 +133,37 @@ const handleScroll = debounce(() => { loadMore() } }, 200) + +/* 用户钱包相关信息 */ +const WALLET_INIT_DATA = { + balance: 0, + totalExpense: 0, + totalRecharge: 0 +} as WalletApi.WalletVO // 钱包初始化数据 +const wallet = ref(WALLET_INIT_DATA) // 钱包信息 + +/** 查询用户钱包信息 */ +const getUserWallet = async () => { + if (!conversation.value.userId) { + wallet.value = WALLET_INIT_DATA + return + } + const params = { userId: conversation.value.userId } + wallet.value = (await WalletApi.getWallet(params)) || WALLET_INIT_DATA +} + +const loading = ref(true) // 加载中 +const user = ref({} as UserApi.UserVO) + +/** 获得用户 */ +const getUserData = async () => { + loading.value = true + try { + user.value = await UserApi.getUser(conversation.value.userId) + } finally { + loading.value = false + } +}