【代码优化】MALL: 会员修改余额

pull/521/head
puhui999 2024-08-22 11:27:51 +08:00
parent 5dc11f844d
commit c45a5228e1
4 changed files with 1293 additions and 1292 deletions

File diff suppressed because it is too large Load Diff

View File

@ -46,8 +46,3 @@ export const updateUserLevel = async (data: any) => {
export const updateUserPoint = async (data: any) => {
return await request.put({ url: `/member/user/update-point`, data })
}
// 修改会员用户余额
export const updateUserBalance = async (data: any) => {
return await request.put({ url: `/member/user/update-balance`, data })
}

View File

@ -4,6 +4,7 @@ import request from '@/config/axios'
export interface PayWalletUserReqVO {
userId: number
}
/** 钱包 VO */
export interface WalletVO {
id: number
@ -20,7 +21,12 @@ export const getWallet = async (params: PayWalletUserReqVO) => {
return await request.get<WalletVO>({ url: `/pay/wallet/get`, params })
}
// 查询会员钱包列表
export const getWalletPage = async (params) => {
/** 查询会员钱包列表 */
export const getWalletPage = async (params: any) => {
return await request.get({ url: `/pay/wallet/page`, params })
}
/** 修改会员钱包余额 */
export const updateWalletBalance = async (data: any) => {
return await request.put({ url: `/pay/wallet/update-balance`, data })
}

View File

@ -14,7 +14,7 @@
<el-input v-model="formData.nickname" class="!w-240px" disabled />
</el-form-item>
<el-form-item label="变动前余额(元)" prop="balance">
<el-input-number v-model="formData.balance" class="!w-240px" disabled />
<el-input :model-value="formData.balance" class="!w-240px" disabled />
</el-form-item>
<el-form-item label="变动类型" prop="changeType">
<el-radio-group v-model="formData.changeType">
@ -32,7 +32,7 @@
/>
</el-form-item>
<el-form-item label="变动后余额(元)">
<el-input-number v-model="balanceResult" class="!w-240px" disabled />
<el-input :model-value="balanceResult" class="!w-240px" disabled />
</el-form-item>
</el-form>
<template #footer>
@ -57,7 +57,7 @@ const formLoading = ref(false) // 表单的加载中1修改时的数据加
const formData = ref({
id: undefined,
nickname: undefined,
balance: '0', // TODO @puhui999 el-input-number
balance: '0',
changeBalance: 0,
changeType: 1
})
@ -108,8 +108,8 @@ const submitForm = async () => {
//
formLoading.value = true
try {
await UserApi.updateUserBalance({
id: formData.value.id,
await WalletApi.updateWalletBalance({
userId: formData.value.id,
balance: convertToInteger(formData.value.changeBalance) * formData.value.changeType
})