【代码优化】分支合并

This commit is contained in:
puhui999
2024-08-19 16:38:15 +08:00
48 changed files with 1316 additions and 462 deletions

View File

@ -20,7 +20,7 @@
<template #header>
<CardTitle title="账户信息" />
</template>
<UserAccountInfo :user="user" />
<UserAccountInfo :user="user" :wallet="wallet" />
</el-card>
</el-col>
<!-- 下边账户明细 -->
@ -40,7 +40,7 @@
<UserExperienceRecordList :user-id="id" />
</el-tab-pane>
<el-tab-pane label="余额" lazy>
<WalletTransactionList :user-id="id" />
<UserBalanceList :wallet-id="wallet.id" />
</el-tab-pane>
<el-tab-pane label="收货地址" lazy>
<UserAddressList :user-id="id" />
@ -49,7 +49,7 @@
<UserOrderList :user-id="id" />
</el-tab-pane>
<el-tab-pane label="售后管理" lazy>
<TradeAfterSale :user-id="id" />
<UserAfterSaleList :user-id="id" />
</el-tab-pane>
<el-tab-pane label="收藏记录" lazy>
<UserFavoriteList :user-id="id" />
@ -69,6 +69,7 @@
<UserForm ref="formRef" @success="getUserData(id)" />
</template>
<script lang="ts" setup>
import * as WalletApi from '@/api/pay/wallet/balance'
import * as UserApi from '@/api/member/user'
import { useTagsViewStore } from '@/store/modules/tagsView'
import UserForm from '@/views/member/user/UserForm.vue'
@ -82,8 +83,8 @@ import UserOrderList from './UserOrderList.vue'
import UserPointList from './UserPointList.vue'
import UserSignList from './UserSignList.vue'
import UserFavoriteList from './UserFavoriteList.vue'
import WalletTransactionList from '@/views/pay/wallet/transaction/WalletTransactionList.vue'
import TradeAfterSale from '@/views/mall/trade/afterSale/index.vue'
import UserAfterSaleList from './UserAftersaleList.vue'
import UserBalanceList from './UserBalanceList.vue'
import { CardTitle } from '@/components/Card/index'
import { ElMessage } from 'element-plus'
@ -113,6 +114,24 @@ const { currentRoute } = useRouter() // 路由
const { delView } = useTagsViewStore() // 视图操作
const route = useRoute()
const id = Number(route.params.id)
/* 用户钱包相关信息 */
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 (!id) {
wallet.value = WALLET_INIT_DATA
return
}
const params = { userId: id }
wallet.value = (await WalletApi.getWallet(params)) || WALLET_INIT_DATA
}
onMounted(() => {
if (!id) {
ElMessage.warning('参数错误,会员编号不能为空!')
@ -120,6 +139,7 @@ onMounted(() => {
return
}
getUserData(id)
getUserWallet()
})
</script>
<style lang="css" scoped>