From fdee8d8628ad48bdb2df36e0696a484c71f22329 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 10 Nov 2024 14:15:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E3=80=91=E5=95=86=E5=9F=8E:=20=E5=AE=A2=E6=9C=8D=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kefu/components/member/MemberInfo.vue | 54 +++++++++++ .../member/user/detail/UserAccountInfo.vue | 6 +- .../member/user/detail/UserBasicInfo.vue | 95 +++++++++++++++---- 3 files changed, 136 insertions(+), 19 deletions(-) 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 + } +}