add button
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
CI / CI OK (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
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
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
CI / CI OK (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
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
This commit is contained in:
@@ -354,6 +354,19 @@ export interface GetAgentLinkProductStatisticsParams {}
|
|||||||
balance: number; // 修改后的余额
|
balance: number; // 修改后的余额
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 系统配置相关接口
|
||||||
|
export interface SystemConfig {
|
||||||
|
commission_safe_mode: boolean; // 佣金安全防御模式
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateSystemConfigReq {
|
||||||
|
commission_safe_mode: boolean; // 佣金安全防御模式:true-冻结模式,false-直接结算模式
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateSystemConfigResp {
|
||||||
|
success: boolean; // 是否成功
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -611,6 +624,25 @@ async function updateAgentWalletBalance(params: AgentApi.UpdateAgentWalletBalanc
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取系统配置
|
||||||
|
*/
|
||||||
|
async function getSystemConfig() {
|
||||||
|
return requestClient.get<AgentApi.SystemConfig>(
|
||||||
|
'/agent/system-config',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新系统配置
|
||||||
|
*/
|
||||||
|
async function updateSystemConfig(params: AgentApi.UpdateSystemConfigReq) {
|
||||||
|
return requestClient.post<AgentApi.UpdateSystemConfigResp>(
|
||||||
|
'/agent/system-config',
|
||||||
|
params,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -635,4 +667,6 @@ export {
|
|||||||
updateAgentMembershipConfig,
|
updateAgentMembershipConfig,
|
||||||
updateAgentProductionConfig,
|
updateAgentProductionConfig,
|
||||||
updateAgentWalletBalance,
|
updateAgentWalletBalance,
|
||||||
|
getSystemConfig,
|
||||||
|
updateSystemConfig,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { computed, h, onMounted, ref } from 'vue';
|
import { computed, h, onMounted, ref } from 'vue';
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
import { Button, message, Modal, Select } from 'ant-design-vue';
|
import { Button, message, Modal, Select, Switch, Tooltip } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
@@ -11,6 +11,8 @@ import {
|
|||||||
getAgentList,
|
getAgentList,
|
||||||
getAgentWallet,
|
getAgentWallet,
|
||||||
updateAgentCommissionStatus,
|
updateAgentCommissionStatus,
|
||||||
|
getSystemConfig,
|
||||||
|
updateSystemConfig,
|
||||||
} from '#/api/agent';
|
} from '#/api/agent';
|
||||||
import type { AgentApi } from '#/api';
|
import type { AgentApi } from '#/api';
|
||||||
|
|
||||||
@@ -25,6 +27,10 @@ const props = defineProps<Props>();
|
|||||||
// 用于一键解冻筛选的代理商ID
|
// 用于一键解冻筛选的代理商ID
|
||||||
const unfreezeAgentId = ref<number | undefined>();
|
const unfreezeAgentId = ref<number | undefined>();
|
||||||
|
|
||||||
|
// 佣金安全防御模式配置
|
||||||
|
const commissionSafeMode = ref<boolean>(false);
|
||||||
|
const safeModeLoading = ref<boolean>(false);
|
||||||
|
|
||||||
// 代理商列表(完整列表)
|
// 代理商列表(完整列表)
|
||||||
const allAgentList = ref<AgentApi.AgentListItem[]>([]);
|
const allAgentList = ref<AgentApi.AgentListItem[]>([]);
|
||||||
|
|
||||||
@@ -86,11 +92,41 @@ function getNotFoundContent() {
|
|||||||
return '暂无代理商';
|
return '暂无代理商';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面加载时获取代理商列表
|
// 页面加载时获取代理商列表和系统配置
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
loadAgentList();
|
loadAgentList();
|
||||||
|
await loadSystemConfig();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 加载系统配置
|
||||||
|
async function loadSystemConfig() {
|
||||||
|
try {
|
||||||
|
const config = await getSystemConfig();
|
||||||
|
commissionSafeMode.value = config.commission_safe_mode;
|
||||||
|
} catch (error: any) {
|
||||||
|
console.error('加载系统配置失败:', error);
|
||||||
|
message.error('加载系统配置失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换安全防御模式
|
||||||
|
async function onSafeModeChange(checked: boolean | string | number) {
|
||||||
|
const isChecked = Boolean(checked);
|
||||||
|
safeModeLoading.value = true;
|
||||||
|
try {
|
||||||
|
await updateSystemConfig({ commission_safe_mode: isChecked });
|
||||||
|
commissionSafeMode.value = isChecked;
|
||||||
|
message.success(`佣金安全防御模式已${isChecked ? '开启' : '关闭'}`);
|
||||||
|
} catch (error: any) {
|
||||||
|
const errorMsg = error?.response?.data?.msg || error?.message || '操作失败,请重试';
|
||||||
|
message.error(errorMsg);
|
||||||
|
// 恢复原状态
|
||||||
|
commissionSafeMode.value = !isChecked;
|
||||||
|
} finally {
|
||||||
|
safeModeLoading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 操作处理函数
|
// 操作处理函数
|
||||||
function onActionClick({ code, row }: { code: string; row: any }) {
|
function onActionClick({ code, row }: { code: string; row: any }) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
@@ -348,11 +384,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async ({ page, form, sort }: any, formValues: Record<string, any>) => {
|
query: async ({ page, form, sort }: any, formValues: Record<string, any>) => {
|
||||||
console.log('=== 佣金列表查询参数 ===');
|
|
||||||
console.log('第一个参数 (params):', { page, form, sort });
|
|
||||||
console.log('第二个参数 (formValues):', formValues);
|
|
||||||
console.log(' queryParams.value:', queryParams.value);
|
|
||||||
|
|
||||||
return await getAgentCommissionList({
|
return await getAgentCommissionList({
|
||||||
...queryParams.value,
|
...queryParams.value,
|
||||||
...formValues,
|
...formValues,
|
||||||
@@ -375,34 +406,49 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
<Page :auto-content-height="!agentId">
|
<Page :auto-content-height="!agentId">
|
||||||
<Grid :table-title="agentId ? '佣金记录列表' : '所有佣金记录'">
|
<Grid :table-title="agentId ? '佣金记录列表' : '所有佣金记录'">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center">
|
||||||
<span class="text-sm text-gray-600">选择代理商:</span>
|
<Tooltip placement="top" title="开启后,佣金结算时将先冻结到钱包冻结余额,需要手动解冻才能使用;关闭后,佣金将直接结算到可用余额">
|
||||||
<Select
|
<div class="flex items-center gap-2 mr-4">
|
||||||
v-model:value="unfreezeAgentId"
|
<span class="text-sm text-gray-600">安全防御模式:</span>
|
||||||
placeholder="全部代理商 / 输入代理ID或手机号"
|
<Switch
|
||||||
:allow-clear="true"
|
v-model:checked="commissionSafeMode"
|
||||||
:loading="agentList.length === 0"
|
:loading="safeModeLoading"
|
||||||
style="width: 260px"
|
checked-children="开启"
|
||||||
show-search
|
un-checked-children="关闭"
|
||||||
:filter-option="false"
|
@change="onSafeModeChange"
|
||||||
:show-arrow="true"
|
/>
|
||||||
:not-found-content="getNotFoundContent()"
|
</div>
|
||||||
@search="onAgentSearch"
|
</Tooltip>
|
||||||
@change="onAgentSelect"
|
<div class="w-px h-6 bg-gray-300 mx-2"></div>
|
||||||
>
|
<div class="flex items-center gap-2">
|
||||||
<Select.Option
|
<span class="text-sm text-gray-600">选择代理商:</span>
|
||||||
v-for="agent in agentList"
|
<Select
|
||||||
:key="agent.id"
|
v-model:value="unfreezeAgentId"
|
||||||
:value="agent.id"
|
placeholder="全部代理商 / 输入代理ID或手机号"
|
||||||
:label="`${agent.real_name || agent.mobile} (ID: ${agent.id})`"
|
:allow-clear="true"
|
||||||
|
:loading="agentList.length === 0"
|
||||||
|
style="width: 260px"
|
||||||
|
show-search
|
||||||
|
:filter-option="false"
|
||||||
|
:show-arrow="true"
|
||||||
|
:not-found-content="getNotFoundContent()"
|
||||||
|
@search="onAgentSearch"
|
||||||
|
@change="onAgentSelect"
|
||||||
>
|
>
|
||||||
{{ agent.real_name || agent.mobile }} (ID: {{ agent.id }})
|
<Select.Option
|
||||||
</Select.Option>
|
v-for="agent in agentList"
|
||||||
</Select>
|
:key="agent.id"
|
||||||
<Button type="primary" @click="onBatchUnfreeze">
|
:value="agent.id"
|
||||||
<span class="mr-1">⚡</span>
|
:label="`${agent.real_name || agent.mobile} (ID: ${agent.id})`"
|
||||||
一键解冻
|
>
|
||||||
</Button>
|
{{ agent.real_name || agent.mobile }} (ID: {{ agent.id }})
|
||||||
|
</Select.Option>
|
||||||
|
</Select>
|
||||||
|
<Button type="primary" @click="onBatchUnfreeze">
|
||||||
|
<span class="mr-1">⚡</span>
|
||||||
|
一键解冻
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user