2023-08-22 16:14:25 +08:00
|
|
|
<template>
|
|
|
|
<el-descriptions :column="2">
|
|
|
|
<el-descriptions-item>
|
|
|
|
<template #label>
|
2023-08-26 13:48:43 +08:00
|
|
|
<descriptions-item-label label=" 等级 " icon="svg-icon:member_level" />
|
2023-08-22 16:14:25 +08:00
|
|
|
</template>
|
2023-08-26 20:57:22 +08:00
|
|
|
{{ user.levelName || '无' }}
|
2023-08-22 16:14:25 +08:00
|
|
|
</el-descriptions-item>
|
|
|
|
<el-descriptions-item>
|
|
|
|
<template #label>
|
2023-08-26 13:48:43 +08:00
|
|
|
<descriptions-item-label label=" 成长值 " icon="ep:suitcase" />
|
2023-08-22 16:14:25 +08:00
|
|
|
</template>
|
2023-08-26 13:48:43 +08:00
|
|
|
{{ user.experience || 0 }}
|
2023-08-22 16:14:25 +08:00
|
|
|
</el-descriptions-item>
|
|
|
|
<el-descriptions-item>
|
|
|
|
<template #label>
|
2023-08-26 13:48:43 +08:00
|
|
|
<descriptions-item-label label=" 当前积分 " icon="ep:coin" />
|
2023-08-22 16:14:25 +08:00
|
|
|
</template>
|
2023-08-26 13:48:43 +08:00
|
|
|
{{ user.point || 0 }}
|
2023-08-22 16:14:25 +08:00
|
|
|
</el-descriptions-item>
|
|
|
|
<el-descriptions-item>
|
|
|
|
<template #label>
|
2023-08-26 13:48:43 +08:00
|
|
|
<descriptions-item-label label=" 总积分 " icon="ep:coin" />
|
2023-08-23 01:41:25 +08:00
|
|
|
</template>
|
2023-08-26 20:57:22 +08:00
|
|
|
{{ user.totalPoint || 0 }}
|
2023-08-23 01:41:25 +08:00
|
|
|
</el-descriptions-item>
|
|
|
|
<el-descriptions-item>
|
|
|
|
<template #label>
|
2023-08-26 13:48:43 +08:00
|
|
|
<descriptions-item-label label=" 当前余额 " icon="svg-icon:member_balance" />
|
2023-08-23 01:41:25 +08:00
|
|
|
</template>
|
2023-10-01 23:44:38 +08:00
|
|
|
{{ fenToYuan(wallet.balance || 0) }}
|
2023-08-23 01:41:25 +08:00
|
|
|
</el-descriptions-item>
|
|
|
|
<el-descriptions-item>
|
|
|
|
<template #label>
|
2023-08-26 13:48:43 +08:00
|
|
|
<descriptions-item-label label=" 支出金额 " icon="svg-icon:member_expenditure_balance" />
|
2023-08-23 01:41:25 +08:00
|
|
|
</template>
|
2023-10-01 23:44:38 +08:00
|
|
|
{{ fenToYuan(wallet.totalExpense || 0) }}
|
2023-08-23 01:41:25 +08:00
|
|
|
</el-descriptions-item>
|
|
|
|
<el-descriptions-item>
|
|
|
|
<template #label>
|
2023-08-26 13:48:43 +08:00
|
|
|
<descriptions-item-label label=" 充值金额 " icon="svg-icon:member_recharge_balance" />
|
2023-08-22 16:14:25 +08:00
|
|
|
</template>
|
2023-10-01 23:44:38 +08:00
|
|
|
{{ fenToYuan(wallet.totalRecharge || 0) }}
|
2023-08-22 16:14:25 +08:00
|
|
|
</el-descriptions-item>
|
|
|
|
</el-descriptions>
|
|
|
|
</template>
|
2023-08-26 13:48:43 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { DescriptionsItemLabel } from '@/components/Descriptions'
|
|
|
|
import * as UserApi from '@/api/member/user'
|
2023-10-15 17:47:36 +08:00
|
|
|
import * as WalletApi from '@/api/pay/wallet/balance'
|
2023-09-30 12:40:21 +08:00
|
|
|
import { UserTypeEnum } from '@/utils/constants'
|
2023-10-01 23:44:38 +08:00
|
|
|
import { fenToYuan } from '@/utils'
|
2023-09-30 12:40:21 +08:00
|
|
|
|
|
|
|
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 }
|
2023-10-01 23:44:38 +08:00
|
|
|
wallet.value = (await WalletApi.getWallet(params)) || WALLET_INIT_DATA
|
2023-09-30 12:40:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** 监听用户编号变化 */
|
|
|
|
watch(
|
|
|
|
() => props.user.id,
|
|
|
|
() => getUserWallet(),
|
|
|
|
{ immediate: true }
|
|
|
|
)
|
2023-08-26 13:48:43 +08:00
|
|
|
</script>
|
2023-08-22 16:14:25 +08:00
|
|
|
<style scoped lang="scss">
|
|
|
|
.cell-item {
|
|
|
|
display: inline;
|
|
|
|
}
|
2023-09-11 17:08:39 +08:00
|
|
|
|
2023-08-22 16:14:25 +08:00
|
|
|
.cell-item::after {
|
|
|
|
content: ':';
|
|
|
|
}
|
|
|
|
</style>
|