会员详情,查询钱包信息

This commit is contained in:
owen 2023-09-30 12:40:21 +08:00
parent 6475f81534
commit 675f3df5cb
3 changed files with 83 additions and 23 deletions

View File

@ -0,0 +1,22 @@
import request from '@/config/axios'
/** 用户钱包查询参数 */
export interface PayWalletUserReqVO {
userId: number
userType: number
}
/** 钱包 VO */
export interface WalletVO {
id: number
userId: number
userType: number
balance: number
totalExpense: number
totalRecharge: number
freezePrice: number
}
/** 查询用户钱包详情 */
export const getUserWallet = async (params: PayWalletUserReqVO) => {
return await request.get<WalletVO>({ url: `/pay/wallet/user-wallet`, params })
}

View File

@ -4,12 +4,20 @@
*
*/
// ========== COMMON 模块 ==========
// 全局通用状态枚举
export const CommonStatusEnum = {
ENABLE: 0, // 开启
DISABLE: 1 // 禁用
}
// 全局用户类型枚举
export const UserTypeEnum = {
MEMBER: 1, // 会员
ADMIN: 2 // 管理员
}
// ========== SYSTEM 模块 ==========
/**
*
*/
@ -38,6 +46,25 @@ export const SystemDataScopeEnum = {
DEPT_SELF: 5 // 仅本人数据权限
}
/**
*
*/
export const SystemUserSocialTypeEnum = {
DINGTALK: {
title: '钉钉',
type: 20,
source: 'dingtalk',
img: 'https://s1.ax1x.com/2022/05/22/OzMDRs.png'
},
WECHAT_ENTERPRISE: {
title: '企业微信',
type: 30,
source: 'wechat_enterprise',
img: 'https://s1.ax1x.com/2022/05/22/OzMrzn.png'
}
}
// ========== INFRA 模块 ==========
/**
*
*/
@ -65,24 +92,7 @@ export const InfraApiErrorLogProcessStatusEnum = {
IGNORE: 2 // 已忽略
}
/**
*
*/
export const SystemUserSocialTypeEnum = {
DINGTALK: {
title: '钉钉',
type: 20,
source: 'dingtalk',
img: 'https://s1.ax1x.com/2022/05/22/OzMDRs.png'
},
WECHAT_ENTERPRISE: {
title: '企业微信',
type: 30,
source: 'wechat_enterprise',
img: 'https://s1.ax1x.com/2022/05/22/OzMrzn.png'
}
}
// ========== PAY 模块 ==========
/**
*
*/
@ -177,6 +187,7 @@ export const PayOrderStatusEnum = {
}
}
// ========== MALL - 商品模块 ==========
/**
* SPU
*/
@ -195,6 +206,7 @@ export const ProductSpuStatusEnum = {
}
}
// ========== MALL - 营销模块 ==========
/**
*
*/
@ -273,6 +285,7 @@ export const PromotionDiscountTypeEnum = {
}
}
// ========== MALL - 交易模块 ==========
/**
*
*/

View File

@ -24,31 +24,56 @@
</template>
{{ user.totalPoint || 0 }}
</el-descriptions-item>
<!-- TODO @疯狂 wallet 读取下对应字段 -->
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 当前余额 " icon="svg-icon:member_balance" />
</template>
{{ 0 }}
{{ wallet.balance || 0 }}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 支出金额 " icon="svg-icon:member_expenditure_balance" />
</template>
{{ 0 }}
{{ wallet.totalExpense || 0 }}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
<descriptions-item-label label=" 充值金额 " icon="svg-icon:member_recharge_balance" />
</template>
{{ 0 }}
{{ wallet.totalRecharge || 0 }}
</el-descriptions-item>
</el-descriptions>
</template>
<script setup lang="ts">
import { DescriptionsItemLabel } from '@/components/Descriptions'
import * as UserApi from '@/api/member/user'
const { user } = defineProps<{ user: UserApi.UserVO }>()
import * as WalletApi from '@/api/pay/wallet'
import { UserTypeEnum } from '@/utils/constants'
const props = defineProps<{ user: UserApi.UserVO }>() //
const WALLET_INIT_DATA = {
balance: 0,
totalExpense: 0,
totalRecharge: 0
} as WalletApi.WalletVO //
const wallet = ref<WalletApi.WalletVO>(WALLET_INIT_DATA) //
/** 查询用户钱包信息 */
const getUserWallet = async () => {
if (!props.user.id) {
wallet.value = WALLET_INIT_DATA
return
}
const params = { userId: props.user.id, userType: UserTypeEnum.MEMBER }
wallet.value = (await WalletApi.getUserWallet(params)) || WALLET_INIT_DATA
}
/** 监听用户编号变化 */
watch(
() => props.user.id,
() => getUserWallet(),
{ immediate: true }
)
</script>
<style scoped lang="scss">
.cell-item {