Skip to content

Commit 854acf6

Browse files
committed
trade: 分销业务 - 佣金提现后台管理
1 parent 18b6c70 commit 854acf6

File tree

5 files changed

+423
-0
lines changed

5 files changed

+423
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import request from '@/config/axios'
2+
3+
export interface BrokerageWithdrawVO {
4+
id: number
5+
userId: number
6+
price: number
7+
feePrice: number
8+
totalPrice: number
9+
type: number
10+
name: string
11+
accountNo: string
12+
bankName: string
13+
bankAddress: string
14+
accountQrCodeUrl: string
15+
status: number
16+
auditReason: string
17+
auditTime: Date
18+
remark: string
19+
}
20+
21+
// 查询佣金提现列表
22+
export const getBrokerageWithdrawPage = async (params: any) => {
23+
return await request.get({ url: `/trade/brokerage-withdraw/page`, params })
24+
}
25+
26+
// 查询佣金提现详情
27+
export const getBrokerageWithdraw = async (id: number) => {
28+
return await request.get({ url: `/trade/brokerage-withdraw/get?id=` + id })
29+
}
30+
31+
// 佣金提现 - 通过申请
32+
export const approveBrokerageWithdraw = async (id: number) => {
33+
return await request.put({ url: `/trade/brokerage-withdraw/approve?id=` + id })
34+
}
35+
36+
// 审核佣金提现 - 驳回申请
37+
export const rejectBrokerageWithdraw = async (data: BrokerageWithdrawVO) => {
38+
return await request.put({ url: `/trade/brokerage-withdraw/reject`, data })
39+
}

src/utils/constants.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,3 +312,49 @@ export const BrokerageRecordBizTypeEnum = {
312312
name: '提现申请'
313313
}
314314
}
315+
/**
316+
* 佣金提现状态枚举
317+
*/
318+
export const BrokerageWithdrawStatusEnum = {
319+
AUDITING: {
320+
status: 0,
321+
name: '审核中'
322+
},
323+
AUDIT_SUCCESS: {
324+
status: 10,
325+
name: '审核通过'
326+
},
327+
AUDIT_FAIL: {
328+
status: 20,
329+
name: '审核不通过'
330+
},
331+
WITHDRAW_SUCCESS: {
332+
status: 11,
333+
name: '提现成功'
334+
},
335+
WITHDRAW_FAIL: {
336+
status: 21,
337+
name: '提现失败'
338+
}
339+
}
340+
/**
341+
* 佣金提现类型枚举
342+
*/
343+
export const BrokerageWithdrawTypeEnum = {
344+
WALLET: {
345+
type: 1,
346+
name: '钱包'
347+
},
348+
BANK: {
349+
type: 2,
350+
name: '银行卡'
351+
},
352+
WECHAT: {
353+
type: 3,
354+
name: '微信'
355+
},
356+
ALIPAY: {
357+
type: 4,
358+
name: '支付宝'
359+
}
360+
}

src/utils/dict.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export enum DICT_TYPE {
171171
BROKERAGE_WITHDRAW_TYPE = 'brokerage_withdraw_type', // 佣金冻结时间
172172
BROKERAGE_RECORD_BIZ_TYPE = 'brokerage_record_biz_type', // 佣金业务类型
173173
BROKERAGE_RECORD_STATUS = 'brokerage_record_status', // 佣金状态
174+
BROKERAGE_WITHDRAW_STATUS = 'brokerage_withdraw_status', // 佣金提现状态
174175

175176
// ========== MALL - 营销模块 ==========
176177
PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<template>
2+
<Dialog title="审核" v-model="dialogVisible">
3+
<el-form
4+
ref="formRef"
5+
:model="formData"
6+
:rules="formRules"
7+
label-width="100px"
8+
v-loading="formLoading"
9+
>
10+
<el-form-item label="驳回原因" prop="auditReason">
11+
<el-input v-model="formData.auditReason" type="textarea" placeholder="请输入驳回原因" />
12+
</el-form-item>
13+
</el-form>
14+
<template #footer>
15+
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
16+
<el-button @click="dialogVisible = false">取 消</el-button>
17+
</template>
18+
</Dialog>
19+
</template>
20+
<script setup lang="ts">
21+
import * as BrokerageWithdrawApi from '@/api/mall/trade/brokerage/withdraw'
22+
23+
const message = useMessage() // 消息弹窗
24+
25+
const dialogVisible = ref(false) // 弹窗的是否展示
26+
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
27+
const formData = ref({
28+
id: undefined,
29+
auditReason: undefined
30+
})
31+
const formRules = reactive({
32+
auditReason: [{ required: true, message: '驳回原因不能为空', trigger: 'blur' }]
33+
})
34+
const formRef = ref() // 表单 Ref
35+
36+
/** 打开弹窗 */
37+
const open = async (id: number) => {
38+
dialogVisible.value = true
39+
resetForm()
40+
formData.value.id = id
41+
}
42+
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
43+
44+
/** 提交表单 */
45+
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
46+
const submitForm = async () => {
47+
// 校验表单
48+
if (!formRef) return
49+
const valid = await formRef.value.validate()
50+
if (!valid) return
51+
// 提交请求
52+
formLoading.value = true
53+
try {
54+
const data = formData.value as unknown as BrokerageWithdrawApi.BrokerageWithdrawVO
55+
await BrokerageWithdrawApi.rejectBrokerageWithdraw(data)
56+
message.success('驳回成功')
57+
dialogVisible.value = false
58+
// 发送操作成功的事件
59+
emit('success')
60+
} finally {
61+
formLoading.value = false
62+
}
63+
}
64+
65+
/** 重置表单 */
66+
const resetForm = () => {
67+
formData.value = {
68+
id: undefined,
69+
auditReason: undefined
70+
}
71+
formRef.value?.resetFields()
72+
}
73+
</script>

0 commit comments

Comments
 (0)