f
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
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (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
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:
@@ -563,6 +563,16 @@ async function auditWithdrawal(params: AgentApi.AuditWithdrawalParams) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台升级代理等级(免费升级,遵守代理系统逻辑)
|
||||||
|
*/
|
||||||
|
async function upgradeAgent(params: {
|
||||||
|
agent_id: string;
|
||||||
|
to_level: number; // 2=黄金,3=钻石
|
||||||
|
}) {
|
||||||
|
return requestClient.post<{ success: boolean }>('/agent/upgrade', params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取代理奖励列表
|
* 获取代理奖励列表
|
||||||
*/
|
*/
|
||||||
@@ -591,4 +601,5 @@ export {
|
|||||||
getInviteCodeList,
|
getInviteCodeList,
|
||||||
updateAgentConfig,
|
updateAgentConfig,
|
||||||
updateAgentProductionConfig,
|
updateAgentProductionConfig,
|
||||||
|
upgradeAgent,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import Form from './modules/form.vue';
|
|||||||
import LinkModal from './modules/link-modal.vue';
|
import LinkModal from './modules/link-modal.vue';
|
||||||
import OrderModal from './modules/order-modal.vue';
|
import OrderModal from './modules/order-modal.vue';
|
||||||
import RebateModal from './modules/rebate-modal.vue';
|
import RebateModal from './modules/rebate-modal.vue';
|
||||||
|
import PlatformUpgradeModal from './modules/platform-upgrade-modal.vue';
|
||||||
import UpgradeModal from './modules/upgrade-modal.vue';
|
import UpgradeModal from './modules/upgrade-modal.vue';
|
||||||
import WithdrawalModal from './modules/withdrawal-modal.vue';
|
import WithdrawalModal from './modules/withdrawal-modal.vue';
|
||||||
|
|
||||||
@@ -58,6 +59,12 @@ const [UpgradeModalComponent, upgradeModalApi] = useVbenModal({
|
|||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 平台升级弹窗
|
||||||
|
const [PlatformUpgradeModalComponent, platformUpgradeModalApi] = useVbenModal({
|
||||||
|
connectedComponent: PlatformUpgradeModal,
|
||||||
|
destroyOnClose: true,
|
||||||
|
});
|
||||||
|
|
||||||
// 订单记录弹窗
|
// 订单记录弹窗
|
||||||
const [OrderModalComponent, orderModalApi] = useVbenModal({
|
const [OrderModalComponent, orderModalApi] = useVbenModal({
|
||||||
connectedComponent: OrderModal,
|
connectedComponent: OrderModal,
|
||||||
@@ -142,6 +149,10 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
|
|
||||||
// 更多操作菜单项
|
// 更多操作菜单项
|
||||||
const moreMenuItems = [
|
const moreMenuItems = [
|
||||||
|
{
|
||||||
|
key: 'platform-upgrade',
|
||||||
|
label: '平台升级',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'links',
|
key: 'links',
|
||||||
label: '推广链接',
|
label: '推广链接',
|
||||||
@@ -192,6 +203,10 @@ function onActionClick(
|
|||||||
onEdit(e.row);
|
onEdit(e.row);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'platform-upgrade': {
|
||||||
|
onPlatformUpgrade(e.row);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'links': {
|
case 'links': {
|
||||||
onViewLinks(e.row);
|
onViewLinks(e.row);
|
||||||
break;
|
break;
|
||||||
@@ -244,6 +259,13 @@ function onViewRebate(row: AgentApi.AgentListItem) {
|
|||||||
rebateModalApi.setData({ agentId: row.id }).open();
|
rebateModalApi.setData({ agentId: row.id }).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 平台升级
|
||||||
|
function onPlatformUpgrade(row: AgentApi.AgentListItem) {
|
||||||
|
platformUpgradeModalApi
|
||||||
|
.setData({ row, onSuccess: onRefresh })
|
||||||
|
.open();
|
||||||
|
}
|
||||||
|
|
||||||
// 查看升级记录
|
// 查看升级记录
|
||||||
function onViewUpgrade(row: AgentApi.AgentListItem) {
|
function onViewUpgrade(row: AgentApi.AgentListItem) {
|
||||||
upgradeModalApi.setData({ agentId: row.id }).open();
|
upgradeModalApi.setData({ agentId: row.id }).open();
|
||||||
@@ -271,6 +293,7 @@ function onRefresh() {
|
|||||||
<LinkModalComponent />
|
<LinkModalComponent />
|
||||||
<CommissionModalComponent />
|
<CommissionModalComponent />
|
||||||
<RebateModalComponent />
|
<RebateModalComponent />
|
||||||
|
<PlatformUpgradeModalComponent />
|
||||||
<UpgradeModalComponent />
|
<UpgradeModalComponent />
|
||||||
<OrderModalComponent />
|
<OrderModalComponent />
|
||||||
<WithdrawalModalComponent />
|
<WithdrawalModalComponent />
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import type { AgentApi } from '#/api/agent';
|
||||||
|
|
||||||
|
import { computed, ref, watch } from 'vue';
|
||||||
|
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
|
import { message, Select } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { getLevelName } from '#/utils/agent';
|
||||||
|
import { upgradeAgent } from '#/api/agent';
|
||||||
|
|
||||||
|
interface ModalData {
|
||||||
|
row: AgentApi.AgentListItem;
|
||||||
|
onSuccess?: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [Modal, modalApi] = useVbenModal({
|
||||||
|
title: '平台升级代理等级',
|
||||||
|
destroyOnClose: true,
|
||||||
|
onConfirm: () => handleSubmit(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const modalData = computed(() => modalApi.getData<ModalData>());
|
||||||
|
|
||||||
|
// 当前代理信息
|
||||||
|
const currentLevel = computed(() => modalData.value?.row?.level ?? 1);
|
||||||
|
const levelName = computed(() => getLevelName(currentLevel.value));
|
||||||
|
const agentId = computed(() => String(modalData.value?.row?.id ?? ''));
|
||||||
|
const mobile = computed(() => modalData.value?.row?.mobile ?? '');
|
||||||
|
|
||||||
|
// 可选目标等级:只能升级不能降级
|
||||||
|
const targetLevelOptions = computed(() => {
|
||||||
|
const options: { label: string; value: number }[] = [];
|
||||||
|
if (currentLevel.value < 2) {
|
||||||
|
options.push({ label: '黄金代理', value: 2 });
|
||||||
|
}
|
||||||
|
if (currentLevel.value < 3) {
|
||||||
|
options.push({ label: '钻石代理', value: 3 });
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
});
|
||||||
|
|
||||||
|
const selectedToLevel = ref<number>(targetLevelOptions.value[0]?.value ?? 0);
|
||||||
|
const canUpgrade = computed(() => targetLevelOptions.value.length > 0);
|
||||||
|
|
||||||
|
// 当可选目标等级变化时(如打开弹窗、切换代理),重置选中为第一项
|
||||||
|
watch(targetLevelOptions, (opts) => {
|
||||||
|
if (opts.length) {
|
||||||
|
selectedToLevel.value = opts[0].value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
if (!agentId.value || !selectedToLevel.value) {
|
||||||
|
message.warning('请选择目标等级');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (selectedToLevel.value <= currentLevel.value) {
|
||||||
|
message.warning('目标等级必须高于当前等级');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
modalApi.lock(true);
|
||||||
|
try {
|
||||||
|
await upgradeAgent({
|
||||||
|
agent_id: agentId.value,
|
||||||
|
to_level: selectedToLevel.value,
|
||||||
|
});
|
||||||
|
message.success('升级成功');
|
||||||
|
modalData.value?.onSuccess?.();
|
||||||
|
modalApi.close();
|
||||||
|
} catch (e: any) {
|
||||||
|
message.error(e?.message ?? '升级失败');
|
||||||
|
} finally {
|
||||||
|
modalApi.lock(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Modal class="w-[420px]" :ok-button-props="{ disabled: !canUpgrade }">
|
||||||
|
<div class="platform-upgrade-modal py-2">
|
||||||
|
<div v-if="!canUpgrade" class="text-warning mb-4">
|
||||||
|
当前已是最高等级(钻石代理),无需升级。
|
||||||
|
</div>
|
||||||
|
<template v-else>
|
||||||
|
<div class="mb-4">
|
||||||
|
<span class="text-gray-500">代理:</span>
|
||||||
|
<span>{{ mobile }}</span>
|
||||||
|
<span class="ml-2 text-gray-500">当前等级:</span>
|
||||||
|
<span>{{ levelName }}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="text-gray-500">升级为:</span>
|
||||||
|
<Select
|
||||||
|
v-model:value="selectedToLevel"
|
||||||
|
class="w-[160px] ml-2"
|
||||||
|
placeholder="请选择目标等级"
|
||||||
|
:options="targetLevelOptions"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="mt-4 text-gray-400 text-sm">
|
||||||
|
平台免费升级,将按代理系统规则处理(脱离/重连上级、团队首领等)。
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.platform-upgrade-modal {
|
||||||
|
min-height: 80px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user