feat: mall brokerage withdraw
parent
f0d221ebf9
commit
bcabc4d6d0
|
@ -2,8 +2,6 @@
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { MallBrokerageUserApi } from '#/api/mall/trade/brokerage/user';
|
import type { MallBrokerageUserApi } from '#/api/mall/trade/brokerage/user';
|
||||||
|
|
||||||
import { onMounted } from 'vue';
|
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
import { useAccess } from '@vben/access';
|
||||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
@ -143,11 +141,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<MallBrokerageUserApi.BrokerageUser>,
|
} as VxeTableGridOptions<MallBrokerageUserApi.BrokerageUser>,
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 初始化 */
|
|
||||||
onMounted(() => {
|
|
||||||
// 表格初始化时会自动查询,无需手动调用
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
|
/** 列表的搜索表单 */
|
||||||
|
export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
fieldName: 'userId',
|
||||||
|
label: '用户编号',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入用户编号',
|
||||||
|
clearable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'type',
|
||||||
|
label: '提现类型',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择提现类型',
|
||||||
|
clearable: true,
|
||||||
|
options: getDictOptions(DICT_TYPE.BROKERAGE_WITHDRAW_TYPE, 'number'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'userAccount',
|
||||||
|
label: '账号',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入账号',
|
||||||
|
clearable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'userName',
|
||||||
|
label: '真实名字',
|
||||||
|
component: 'Input',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请输入真实名字',
|
||||||
|
clearable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'bankName',
|
||||||
|
label: '提现银行',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择提现银行',
|
||||||
|
clearable: true,
|
||||||
|
options: getDictOptions(DICT_TYPE.BROKERAGE_BANK_NAME, 'string'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'status',
|
||||||
|
label: '状态',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
placeholder: '请选择状态',
|
||||||
|
clearable: true,
|
||||||
|
options: getDictOptions(DICT_TYPE.BROKERAGE_WITHDRAW_STATUS, 'number'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'createTime',
|
||||||
|
label: '申请时间',
|
||||||
|
component: 'RangePicker',
|
||||||
|
componentProps: {
|
||||||
|
...getRangePickerDefaultProps(),
|
||||||
|
clearable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 列表的字段 */
|
||||||
|
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
field: 'id',
|
||||||
|
title: '编号',
|
||||||
|
minWidth: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'userId',
|
||||||
|
title: '用户编号:',
|
||||||
|
minWidth: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'userNickname',
|
||||||
|
title: '用户昵称:',
|
||||||
|
minWidth: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'price',
|
||||||
|
title: '提现金额',
|
||||||
|
minWidth: 80,
|
||||||
|
formatter: 'formatAmount2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'feePrice',
|
||||||
|
title: '提现手续费',
|
||||||
|
minWidth: 80,
|
||||||
|
formatter: 'formatAmount2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'type',
|
||||||
|
title: '提现方式',
|
||||||
|
minWidth: 120,
|
||||||
|
cellRender: {
|
||||||
|
name: 'CellDict',
|
||||||
|
props: { type: DICT_TYPE.BROKERAGE_WITHDRAW_TYPE },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '提现信息',
|
||||||
|
minWidth: 200,
|
||||||
|
slots: { default: 'withdraw-info' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createTime',
|
||||||
|
title: '申请时间',
|
||||||
|
minWidth: 180,
|
||||||
|
formatter: 'formatDateTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
minWidth: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
minWidth: 200,
|
||||||
|
slots: { default: 'status-info' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 150,
|
||||||
|
fixed: 'right',
|
||||||
|
slots: { default: 'actions' },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,32 +1,195 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { DocAlert, Page } from '@vben/common-ui';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
import type { MallBrokerageWithdrawApi } from '#/api/mall/trade/brokerage/withdraw';
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
import { h } from 'vue';
|
||||||
|
|
||||||
|
import { confirm, Page, prompt } from '@vben/common-ui';
|
||||||
|
import { formatDateTime } from '@vben/utils';
|
||||||
|
|
||||||
|
import { Input, message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
|
import {
|
||||||
|
approveBrokerageWithdraw,
|
||||||
|
getBrokerageWithdrawPage,
|
||||||
|
rejectBrokerageWithdraw,
|
||||||
|
} from '#/api/mall/trade/brokerage/withdraw';
|
||||||
|
import { DictTag } from '#/components/dict-tag';
|
||||||
|
import { $t } from '#/locales';
|
||||||
|
import {
|
||||||
|
BrokerageWithdrawStatusEnum,
|
||||||
|
BrokerageWithdrawTypeEnum,
|
||||||
|
DICT_TYPE,
|
||||||
|
} from '#/utils';
|
||||||
|
|
||||||
|
import { useGridColumns, useGridFormSchema } from './data';
|
||||||
|
|
||||||
|
/** 分销佣金提现 */
|
||||||
|
defineOptions({ name: 'BrokerageWithdraw' });
|
||||||
|
|
||||||
|
/** 刷新表格 */
|
||||||
|
function onRefresh() {
|
||||||
|
gridApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 审核通过 */
|
||||||
|
async function handleApprove(row: MallBrokerageWithdrawApi.BrokerageWithdraw) {
|
||||||
|
try {
|
||||||
|
await confirm('确定要审核通过吗?');
|
||||||
|
await approveBrokerageWithdraw(row.id);
|
||||||
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
|
onRefresh();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('审核失败:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 审核驳回 */
|
||||||
|
function handleReject(row: MallBrokerageWithdrawApi.BrokerageWithdraw) {
|
||||||
|
prompt({
|
||||||
|
component: () => {
|
||||||
|
return h(Input, {
|
||||||
|
placeholder: '请输入驳回原因',
|
||||||
|
allowClear: true,
|
||||||
|
rules: [{ required: true, message: '请输入驳回原因' }],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
content: '请输入驳回原因',
|
||||||
|
title: '驳回',
|
||||||
|
modelPropName: 'value',
|
||||||
|
}).then(async (val) => {
|
||||||
|
if (val) {
|
||||||
|
await rejectBrokerageWithdraw({
|
||||||
|
id: row.id as number,
|
||||||
|
auditReason: val,
|
||||||
|
});
|
||||||
|
onRefresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重新转账 */
|
||||||
|
async function handleRetryTransfer(
|
||||||
|
row: MallBrokerageWithdrawApi.BrokerageWithdraw,
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
await confirm('确定要重新转账吗?');
|
||||||
|
await approveBrokerageWithdraw(row.id);
|
||||||
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
|
onRefresh();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('重新转账失败:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
formOptions: {
|
||||||
|
schema: useGridFormSchema(),
|
||||||
|
},
|
||||||
|
gridOptions: {
|
||||||
|
columns: useGridColumns(),
|
||||||
|
height: 'auto',
|
||||||
|
keepSource: true,
|
||||||
|
cellConfig: {
|
||||||
|
height: 80,
|
||||||
|
},
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }, formValues) => {
|
||||||
|
return await getBrokerageWithdrawPage({
|
||||||
|
pageNo: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
|
toolbarConfig: {
|
||||||
|
refresh: { code: 'query' },
|
||||||
|
search: true,
|
||||||
|
},
|
||||||
|
} as VxeTableGridOptions<MallBrokerageWithdrawApi.BrokerageWithdraw>,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page>
|
<Page auto-content-height>
|
||||||
<DocAlert
|
<Grid table-title="佣金提现列表">
|
||||||
title="【交易】分销返佣"
|
<template #withdraw-info="{ row }">
|
||||||
url="https://doc.iocoder.cn/mall/trade-brokerage/"
|
<div v-if="row.type === BrokerageWithdrawTypeEnum.WALLET.type">-</div>
|
||||||
/>
|
<div v-else>
|
||||||
<Button
|
<div v-if="row.userAccount">账号:{{ row.userAccount }}</div>
|
||||||
danger
|
<div v-if="row.userName">真实姓名:{{ row.userName }}</div>
|
||||||
type="link"
|
<template v-if="row.type === BrokerageWithdrawTypeEnum.BANK.type">
|
||||||
target="_blank"
|
<div v-if="row.bankName">银行名称:{{ row.bankName }}</div>
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
<div v-if="row.bankAddress">开户地址:{{ row.bankAddress }}</div>
|
||||||
>
|
</template>
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
<div v-if="row.qrCodeUrl" class="mt-2">
|
||||||
</Button>
|
<div>收款码:</div>
|
||||||
<br />
|
<img :src="row.qrCodeUrl" class="mt-1 h-10 w-10" />
|
||||||
<Button
|
</div>
|
||||||
type="link"
|
</div>
|
||||||
target="_blank"
|
</template>
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/mall/trade/brokerage/withdraw/index"
|
|
||||||
>
|
<template #status-info="{ row }">
|
||||||
可参考
|
<div>
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/mall/trade/brokerage/withdraw/index
|
<DictTag
|
||||||
代码,pull request 贡献给我们!
|
:value="row.status"
|
||||||
</Button>
|
:type="DICT_TYPE.BROKERAGE_WITHDRAW_STATUS"
|
||||||
|
/>
|
||||||
|
<div v-if="row.auditTime" class="mt-1 text-xs text-gray-500">
|
||||||
|
时间:{{ formatDateTime(row.auditTime) }}
|
||||||
|
</div>
|
||||||
|
<div v-if="row.auditReason" class="mt-1 text-xs text-gray-500">
|
||||||
|
审核原因:{{ row.auditReason }}
|
||||||
|
</div>
|
||||||
|
<div v-if="row.transferErrorMsg" class="mt-1 text-xs text-red-500">
|
||||||
|
转账失败原因:{{ row.transferErrorMsg }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #actions="{ row }">
|
||||||
|
<TableAction
|
||||||
|
:actions="[
|
||||||
|
// 审核中状态且没有支付转账编号,显示通过和驳回按钮
|
||||||
|
{
|
||||||
|
label: '通过',
|
||||||
|
type: 'link' as const,
|
||||||
|
icon: ACTION_ICON.EDIT,
|
||||||
|
auth: ['trade:brokerage-withdraw:audit'],
|
||||||
|
ifShow:
|
||||||
|
row.status === BrokerageWithdrawStatusEnum.AUDITING.status &&
|
||||||
|
!row.payTransferId,
|
||||||
|
onClick: () => handleApprove(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '驳回',
|
||||||
|
type: 'link' as const,
|
||||||
|
danger: true,
|
||||||
|
icon: ACTION_ICON.DELETE,
|
||||||
|
auth: ['trade:brokerage-withdraw:audit'],
|
||||||
|
ifShow:
|
||||||
|
row.status === BrokerageWithdrawStatusEnum.AUDITING.status &&
|
||||||
|
!row.payTransferId,
|
||||||
|
onClick: () => handleReject(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '重新转账',
|
||||||
|
type: 'link' as const,
|
||||||
|
icon: ACTION_ICON.REFRESH,
|
||||||
|
auth: ['trade:brokerage-withdraw:audit'],
|
||||||
|
ifShow:
|
||||||
|
row.status === BrokerageWithdrawStatusEnum.WITHDRAW_FAIL.status,
|
||||||
|
onClick: () => handleRetryTransfer(row),
|
||||||
|
},
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue