From 675f3df5cbc8623058ae75ef5a4ca4a92334b8d0 Mon Sep 17 00:00:00 2001 From: owen Date: Sat, 30 Sep 2023 12:40:21 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BC=9A=E5=91=98=E8=AF=A6=E6=83=85?= =?UTF-8?q?=EF=BC=8C=E6=9F=A5=E8=AF=A2=E9=92=B1=E5=8C=85=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/pay/wallet/index.ts | 22 +++++++++ src/utils/constants.ts | 49 ++++++++++++------- .../member/user/detail/UserAccountInfo.vue | 35 +++++++++++-- 3 files changed, 83 insertions(+), 23 deletions(-) create mode 100644 src/api/pay/wallet/index.ts diff --git a/src/api/pay/wallet/index.ts b/src/api/pay/wallet/index.ts new file mode 100644 index 00000000..0e5469db --- /dev/null +++ b/src/api/pay/wallet/index.ts @@ -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({ url: `/pay/wallet/user-wallet`, params }) +} diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 80bb3e9d..8c57ecd3 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -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 - 交易模块 ========== /** * 分销关系绑定模式枚举 */ diff --git a/src/views/member/user/detail/UserAccountInfo.vue b/src/views/member/user/detail/UserAccountInfo.vue index 3a609fe0..80beae6d 100644 --- a/src/views/member/user/detail/UserAccountInfo.vue +++ b/src/views/member/user/detail/UserAccountInfo.vue @@ -24,31 +24,56 @@ {{ user.totalPoint || 0 }} - - {{ 0 }} + {{ wallet.balance || 0 }} - {{ 0 }} + {{ wallet.totalExpense || 0 }} - {{ 0 }} + {{ wallet.totalRecharge || 0 }} diff --git a/src/views/member/user/index.vue b/src/views/member/user/index.vue index 10ff8863..0ea47570 100644 --- a/src/views/member/user/index.vue +++ b/src/views/member/user/index.vue @@ -117,28 +117,56 @@ :formatter="dateFormatter" width="180px" /> - + @@ -155,6 +183,8 @@ + + @@ -166,8 +196,10 @@ import UserForm from './UserForm.vue' import MemberTagSelect from '@/views/member/tag/components/MemberTagSelect.vue' import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect.vue' import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue' -import UpdateLevelForm from '@/views/member/user/UpdateLevelForm.vue' +import UpdateLevelForm from './UpdateLevelForm.vue' +import UpdatePointForm from './UpdatePointForm.vue' import CouponSendForm from '@/views/mall/promotion/coupon/components/CouponSendForm.vue' +import { checkPermi } from '@/utils/permission' defineOptions({ name: 'MemberUser' }) @@ -189,6 +221,7 @@ const queryParams = reactive({ }) const queryFormRef = ref() // 搜索的表单 const updateLevelFormRef = ref() // 修改会员等级表单 +const updatePointFormRef = ref() // 修改会员积分表单 const selectedIds = ref([]) // 表格的选中 ID 数组 /** 查询列表 */ @@ -242,6 +275,26 @@ const openCoupon = () => { couponSendFormRef.value.open(selectedIds.value) } +/** 操作分发 */ +const handleCommand = (command: string, row: UserApi.UserVO) => { + switch (command) { + case 'handleUpdate': + openForm('update', row.id) + break + case 'handleUpdateLevel': + updateLevelFormRef.value.open(row.id) + break + case 'handleUpdatePoint': + updatePointFormRef.value.open(row.id) + break + case 'handleUpdateBlance': + // todo @jason:增加一个【修改余额】 + break + default: + break + } +} + /** 初始化 **/ onMounted(() => { getList() From 0066d79876b7c406bf70d4c03f4eeed2d3ede5e5 Mon Sep 17 00:00:00 2001 From: owen Date: Sun, 1 Oct 2023 09:53:52 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E7=AD=BE=E5=88=B0=EF=BC=9A=E7=AD=BE?= =?UTF-8?q?=E5=88=B0=E5=90=8E=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E3=80=81=E7=BB=8F=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/member/signin/config/index.ts | 9 ++-- .../member/signin/config/SignInConfigForm.vue | 45 +++++++++++++------ src/views/member/signin/config/index.vue | 3 +- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/src/api/member/signin/config/index.ts b/src/api/member/signin/config/index.ts index 558bdc70..50a7d63c 100644 --- a/src/api/member/signin/config/index.ts +++ b/src/api/member/signin/config/index.ts @@ -1,10 +1,11 @@ import request from '@/config/axios' export interface SignInConfigVO { - id: number - day: number | null - point: number | null - enable: boolean | null + id?: number + day?: number + point?: number + experience?: number + status?: number } // 查询积分签到规则列表 diff --git a/src/views/member/signin/config/SignInConfigForm.vue b/src/views/member/signin/config/SignInConfigForm.vue index 4d5c3d2d..616fd8fc 100644 --- a/src/views/member/signin/config/SignInConfigForm.vue +++ b/src/views/member/signin/config/SignInConfigForm.vue @@ -13,8 +13,11 @@ 只允许设置 1-7,默认签到 7 天为一个周期 - - + + + + + @@ -46,12 +49,30 @@ const dialogVisible = ref(false) // 弹窗的是否展示 const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 -const formData = ref({ - id: undefined, - day: undefined, - point: undefined +const formData = ref({} as SignInConfigApi.SignInConfigVO) +// 奖励校验规则 +const awardValidator = (rule: any, _value: any, callback: any) => { + if (!formData.value.point && !formData.value.experience) { + callback(new Error('奖励积分与奖励经验至少配置一个')) + return + } + + // 清除另一个字段的错误提示 + const otherAwardField = rule?.field === 'point' ? 'experience' : 'point' + formRef.value.validateField(otherAwardField, () => null) + callback() +} +const formRules = reactive({ + day: [{ required: true, message: '签到天数不能空', trigger: 'blur' }], + point: [ + { required: true, message: '奖励积分不能空', trigger: 'blur' }, + { validator: awardValidator, trigger: 'blur' } + ], + experience: [ + { required: true, message: '奖励经验不能空', trigger: 'blur' }, + { validator: awardValidator, trigger: 'blur' } + ] }) -const formRules = reactive({}) const formRef = ref() // 表单 Ref /** 打开弹窗 */ @@ -82,14 +103,11 @@ const submitForm = async () => { // 提交请求 formLoading.value = true try { - const data = formData.value as unknown as SignInConfigApi.SignInConfigVO if (formType.value === 'create') { - //默认新创建的自动启动 - data.enable = true - await SignInConfigApi.createSignInConfig(data) + await SignInConfigApi.createSignInConfig(formData.value) message.success(t('common.createSuccess')) } else { - await SignInConfigApi.updateSignInConfig(data) + await SignInConfigApi.updateSignInConfig(formData.value) message.success(t('common.updateSuccess')) } dialogVisible.value = false @@ -105,7 +123,8 @@ const resetForm = () => { formData.value = { id: undefined, day: undefined, - point: undefined, + point: 0, + experience: 0, status: CommonStatusEnum.ENABLE } formRef.value?.resetFields() diff --git a/src/views/member/signin/config/index.vue b/src/views/member/signin/config/index.vue index 71dc4c6f..da38dad6 100644 --- a/src/views/member/signin/config/index.vue +++ b/src/views/member/signin/config/index.vue @@ -20,7 +20,8 @@ prop="day" :formatter="(_, __, cellValue) => ['第', cellValue, '天'].join(' ')" /> - + +