f add
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled

This commit is contained in:
2026-01-07 16:50:52 +08:00
parent 90353094ab
commit 1bba187cf3
4 changed files with 274 additions and 1 deletions

View File

@@ -354,6 +354,36 @@ export interface GetAgentLinkProductStatisticsParams {}
balance: number; // 修改后的余额
}
// 代理钱包流水相关接口
export interface WalletTransactionListItem {
id: number;
agent_id: number;
transaction_type: string;
amount: number;
balance_before: number;
balance_after: number;
frozen_balance_before: number;
frozen_balance_after: number;
transaction_id?: string;
related_user_id?: number;
remark?: string;
create_time: string;
}
export interface WalletTransactionList {
total: number;
items: WalletTransactionListItem[];
}
export interface GetWalletTransactionListParams {
page: number;
pageSize: number;
agent_id: number;
transaction_type?: string;
create_time_start?: string;
create_time_end?: string;
}
// 系统配置相关接口
export interface SystemConfig {
commission_safe_mode: boolean; // 佣金安全防御模式
@@ -643,6 +673,18 @@ async function updateSystemConfig(params: AgentApi.UpdateSystemConfigReq) {
);
}
/**
* 获取代理钱包流水列表
*/
async function getWalletTransactionList(
params: AgentApi.GetWalletTransactionListParams,
) {
return requestClient.get<AgentApi.WalletTransactionList>(
'/agent/wallet-transaction/list',
{ params },
);
}
export {
@@ -669,4 +711,5 @@ export {
updateAgentWalletBalance,
getSystemConfig,
updateSystemConfig,
getWalletTransactionList,
};

View File

@@ -26,6 +26,7 @@ import PlatformDeductionModal from './modules/platform-deduction-modal.vue';
import RewardModal from './modules/reward-modal.vue';
import WithdrawalModal from './modules/withdrawal-modal.vue';
import BalanceModal from './modules/balance-modal.vue';
import WalletTransactionModal from './modules/wallet-transaction-modal.vue';
const route = useRoute();
const router = useRouter();
@@ -80,6 +81,12 @@ const [BalanceModalComponent, balanceModalApi] = useVbenModal({
destroyOnClose: true,
});
// 钱包流水记录弹窗
const [WalletTransactionModalComponent, walletTransactionModalApi] = useVbenModal({
connectedComponent: WalletTransactionModal,
destroyOnClose: true,
});
// 历史佣金记录弹窗
const [CommissionHistoryModalComponent, commissionHistoryModalApi] = useVbenModal({
connectedComponent: CommissionHistoryModal,
@@ -166,6 +173,10 @@ const moreMenuItems = [
key: 'commission-history',
label: '历史佣金记录',
},
{
key: 'wallet-transaction',
label: '钱包流水记录',
},
{
key: 'links',
label: '推广链接',
@@ -258,6 +269,10 @@ function onActionClick(
onViewWithdrawal(e.row);
break;
}
case 'wallet-transaction': {
onViewWalletTransaction(e.row);
break;
}
}
}
@@ -276,6 +291,11 @@ function onUpdateBalance(row: AgentApi.AgentListItem) {
balanceModalApi.setData({ agentId: row.id }).open();
}
// 查看钱包流水记录
function onViewWalletTransaction(row: AgentApi.AgentListItem) {
walletTransactionModalApi.setData({ agentId: row.id }).open();
}
// 查看佣金记录
function onViewCommission(row: AgentApi.AgentListItem) {
commissionModalApi.setData({ agentId: row.id }).open();
@@ -323,6 +343,7 @@ function onRefresh() {
<RewardModalComponent />
<WithdrawalModalComponent />
<BalanceModalComponent @success="onRefresh" />
<WalletTransactionModalComponent />
<!-- 上级代理信息卡片 -->
<Card v-if="parentAgentId" class="mb-4">

View File

@@ -156,8 +156,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
sortable: true,
},
],
height: 'auto',
height: 600,
maxHeight: 800,
keepSource: true,
pagerConfig: {
enabled: true,
pageSize: 20,
pageSizes: [10, 20, 50, 100],
layouts: ['Total', 'Sizes', 'PrevJump', 'Number', 'NextJump', 'FullJump'],
},
rowConfig: {
keyField: 'id',
},

View File

@@ -0,0 +1,202 @@
<script lang="ts" setup>
import { computed, h } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getWalletTransactionList } from '#/api/agent';
interface ModalData {
agentId: number;
}
const [Modal, modalApi] = useVbenModal({
title: '钱包流水记录',
destroyOnClose: true,
});
const modalData = computed(() => modalApi.getData<ModalData>());
// 交易类型映射
const transactionTypeMap: Record<string, { label: string; color: string }> = {
commission: { label: '佣金收入', color: 'green' },
withdraw: { label: '提现', color: 'red' },
freeze: { label: '冻结', color: 'orange' },
unfreeze: { label: '解冻', color: 'blue' },
reward: { label: '奖励', color: 'green' },
refund: { label: '退款', color: 'purple' },
adjust: { label: '调整', color: 'cyan' },
};
// 获取交易类型标签
function getTransactionTypeTag(type: string) {
const config = transactionTypeMap[type] || { label: type, color: 'default' };
return h(Tag, { color: config.color }, config.label);
}
// 获取金额显示
function getAmountCellRender(params: any) {
const amount = params.row.amount;
const isPositive = amount >= 0;
const color = isPositive ? '#52c41a' : '#ff4d4f';
const sign = isPositive ? '+' : '';
return h('span', { style: { color, fontWeight: 'bold' } }, `${sign}${amount.toFixed(2)}`);
}
// 表格列配置
const columns = [
{
field: 'id',
title: '流水ID',
width: 80,
},
{
field: 'transaction_type',
title: '交易类型',
width: 120,
cellRender: {
name: 'CustomRender',
render: getTransactionTypeTag,
},
},
{
field: 'amount',
title: '变动金额',
width: 120,
cellRender: {
name: 'CustomRender',
render: getAmountCellRender,
},
},
{
field: 'balance_before',
title: '变动前余额',
width: 120,
formatter: ({ cellValue }: any) => `¥${Number(cellValue || 0).toFixed(2)}`,
},
{
field: 'balance_after',
title: '变动后余额',
width: 120,
formatter: ({ cellValue }: any) => `¥${Number(cellValue || 0).toFixed(2)}`,
},
{
field: 'frozen_balance_before',
title: '变动前冻结',
width: 120,
formatter: ({ cellValue }: any) => `¥${Number(cellValue || 0).toFixed(2)}`,
},
{
field: 'frozen_balance_after',
title: '变动后冻结',
width: 120,
formatter: ({ cellValue }: any) => `¥${Number(cellValue || 0).toFixed(2)}`,
},
{
field: 'transaction_id',
title: '关联交易ID',
width: 150,
formatter: ({ cellValue }: any) => cellValue || '-',
},
{
field: 'remark',
title: '备注',
width: 200,
formatter: ({ cellValue }: any) => cellValue || '-',
},
{
field: 'create_time',
title: '创建时间',
width: 180,
},
];
const [Grid] = useVbenVxeGrid({
formOptions: {
schema: [
{
component: 'Input',
fieldName: 'transaction_type',
label: '交易类型',
help: '如: commission, withdraw, freeze, unfreeze, reward, refund, adjust',
},
{
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm:ss',
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'create_time_start',
label: '开始时间',
},
{
component: 'DatePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm:ss',
showTime: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'create_time_end',
label: '结束时间',
},
],
submitOnChange: true,
},
gridOptions: {
columns,
height: 600,
maxHeight: 800,
keepSource: true,
pagerConfig: {
enabled: true,
pageSize: 20,
pageSizes: [10, 20, 50, 100],
layouts: ['Total', 'Sizes', 'PrevJump', 'Number', 'NextJump', 'FullJump'],
},
proxyConfig: {
ajax: {
query: async ({ page }: { page: { currentPage: number; pageSize: number } }, formValues: Record<string, any>) => {
return await getWalletTransactionList({
agent_id: modalData.value?.agentId || 0,
...formValues,
page: page.currentPage,
pageSize: page.pageSize,
});
},
},
props: {
result: 'items',
total: 'total',
},
autoLoad: true,
},
rowConfig: {
keyField: 'id',
},
toolbarConfig: {
custom: true,
export: false,
refresh: { code: 'query' },
search: true,
zoom: true,
},
},
});
</script>
<template>
<Modal class="w-[calc(100vw-200px)]" :footer="false">
<div class="wallet-transaction-modal">
<Grid table-title="钱包流水记录" />
</div>
</Modal>
</template>
<style lang="less" scoped>
.wallet-transaction-modal {
padding: 16px;
}
</style>