fix
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:
@@ -59,23 +59,47 @@ export function useCommissionColumns(
|
|||||||
onClick: onActionClick,
|
onClick: onActionClick,
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
code: 'freeze',
|
||||||
|
text: '冻结',
|
||||||
|
type: 'warning',
|
||||||
|
disabled: (row: AgentApi.AgentCommissionListItem) =>
|
||||||
|
row?.status !== 0,
|
||||||
|
class: (row: AgentApi.AgentCommissionListItem) =>
|
||||||
|
row?.status !== 0 ? '!text-gray-400 !cursor-not-allowed' : '',
|
||||||
|
tooltip: (row: AgentApi.AgentCommissionListItem) => {
|
||||||
|
if (row?.status === 1) return '该佣金已处于冻结中';
|
||||||
|
if (row?.status === 2) return '已取消的佣金无法操作';
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
code: 'unfreeze',
|
code: 'unfreeze',
|
||||||
text: '解冻',
|
text: '解冻',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
disabled: (row: AgentApi.AgentCommissionListItem) => row?.status !== 1,
|
disabled: (row: AgentApi.AgentCommissionListItem) =>
|
||||||
|
row?.status !== 1,
|
||||||
|
class: (row: AgentApi.AgentCommissionListItem) =>
|
||||||
|
row?.status !== 1 ? '!text-gray-400 !cursor-not-allowed' : '',
|
||||||
|
tooltip: (row: AgentApi.AgentCommissionListItem) => {
|
||||||
|
if (row?.status === 0) return '已结算的佣金无需解冻';
|
||||||
|
if (row?.status === 2) return '已取消的佣金无法解冻';
|
||||||
|
return '';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: 'cancel',
|
code: 'cancel',
|
||||||
text: '取消',
|
text: '取消',
|
||||||
type: 'default',
|
type: 'primary',
|
||||||
disabled: (row: AgentApi.AgentCommissionListItem) => row?.status !== 1,
|
disabled: (row: AgentApi.AgentCommissionListItem) =>
|
||||||
},
|
row?.status !== 1,
|
||||||
{
|
class: (row: AgentApi.AgentCommissionListItem) =>
|
||||||
code: 'settled',
|
row?.status !== 1 ? '!text-gray-400 !cursor-not-allowed' : '',
|
||||||
text: '已结算',
|
tooltip: (row: AgentApi.AgentCommissionListItem) => {
|
||||||
type: 'success',
|
if (row?.status === 0) return '只能取消冻结中的佣金';
|
||||||
disabled: (row: AgentApi.AgentCommissionListItem) => row?.status !== 0,
|
if (row?.status === 2) return '已取消的佣金无法再次取消';
|
||||||
|
return '';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ const queryParams = computed(() => ({
|
|||||||
// 操作处理函数
|
// 操作处理函数
|
||||||
function onActionClick({ code, row }: { code: string; row: any }) {
|
function onActionClick({ code, row }: { code: string; row: any }) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
case 'freeze':
|
||||||
|
onFreeze(row);
|
||||||
|
break;
|
||||||
case 'unfreeze':
|
case 'unfreeze':
|
||||||
onUnfreeze(row);
|
onUnfreeze(row);
|
||||||
break;
|
break;
|
||||||
@@ -41,14 +44,28 @@ function onActionClick({ code, row }: { code: string; row: any }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 冻结佣金
|
||||||
|
async function onFreeze(row: any) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '确认冻结',
|
||||||
|
content: `确定要冻结佣金金额 ¥${row.amount.toFixed(2)} 吗?冻结后将暂时无法提现。`,
|
||||||
|
okText: '确认冻结',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: async () => {
|
||||||
|
try {
|
||||||
|
await updateAgentCommissionStatus(row.id, 1);
|
||||||
|
message.success('佣金已冻结');
|
||||||
|
onRefresh();
|
||||||
|
} catch (error: any) {
|
||||||
|
const errorMsg = error?.response?.data?.msg || error?.message || '操作失败,请重试';
|
||||||
|
message.error(errorMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 解冻佣金到用户余额
|
// 解冻佣金到用户余额
|
||||||
async function onUnfreeze(row: any) {
|
async function onUnfreeze(row: any) {
|
||||||
if (row.status !== 1) {
|
|
||||||
message.warning('只有冻结中的佣金才能解冻');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '确认解冻',
|
title: '确认解冻',
|
||||||
content: `确定要解冻佣金金额 ¥${row.amount.toFixed(2)} 吗?解冻后将转入用户钱包余额。`,
|
content: `确定要解冻佣金金额 ¥${row.amount.toFixed(2)} 吗?解冻后将转入用户钱包余额。`,
|
||||||
@@ -59,8 +76,9 @@ async function onUnfreeze(row: any) {
|
|||||||
await updateAgentCommissionStatus(row.id, 0);
|
await updateAgentCommissionStatus(row.id, 0);
|
||||||
message.success('佣金已解冻并转入用户钱包余额');
|
message.success('佣金已解冻并转入用户钱包余额');
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
message.error('操作失败,请重试');
|
const errorMsg = error?.response?.data?.msg || error?.message || '操作失败,请重试';
|
||||||
|
message.error(errorMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -68,11 +86,6 @@ async function onUnfreeze(row: any) {
|
|||||||
|
|
||||||
// 取消佣金
|
// 取消佣金
|
||||||
async function onCancel(row: any) {
|
async function onCancel(row: any) {
|
||||||
if (row.status !== 1) {
|
|
||||||
message.warning('只有冻结中的佣金才能取消');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '确认取消',
|
title: '确认取消',
|
||||||
content: `确定要取消佣金金额 ¥${row.amount.toFixed(2)} 吗?取消后将无法恢复。`,
|
content: `确定要取消佣金金额 ¥${row.amount.toFixed(2)} 吗?取消后将无法恢复。`,
|
||||||
@@ -83,8 +96,9 @@ async function onCancel(row: any) {
|
|||||||
await updateAgentCommissionStatus(row.id, 2);
|
await updateAgentCommissionStatus(row.id, 2);
|
||||||
message.success('佣金已取消');
|
message.success('佣金已取消');
|
||||||
onRefresh();
|
onRefresh();
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
message.error('操作失败,请重试');
|
const errorMsg = error?.response?.data?.msg || error?.message || '操作失败,请重试';
|
||||||
|
message.error(errorMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user