im 管理后台

This commit is contained in:
richjohnrambo
2026-08-11 23:13:51 +08:00
parent 0397fe5f22
commit 331a55751d
1407 changed files with 162069 additions and 2 deletions
@@ -0,0 +1,109 @@
<template>
<div ref="chartRef" :style="{ height, width }"></div>
</template>
<script lang="ts">
import { defineComponent, onMounted, ref, Ref } from 'vue';
import { useECharts } from '@/hooks/web/useECharts';
import { basicProps } from './props';
export default defineComponent({
props: basicProps,
setup() {
const chartRef = ref<HTMLDivElement | null>(null);
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>);
onMounted(() => {
setOptions({
tooltip: {
trigger: 'axis',
axisPointer: {
lineStyle: {
width: 1,
color: '#019680',
},
},
},
xAxis: {
type: 'category',
boundaryGap: false,
data: [
'6:00',
'7:00',
'8:00',
'9:00',
'10:00',
'11:00',
'12:00',
'13:00',
'14:00',
'15:00',
'16:00',
'17:00',
'18:00',
'19:00',
'20:00',
'21:00',
'22:00',
'23:00',
],
splitLine: {
show: true,
lineStyle: {
width: 1,
type: 'solid',
color: 'rgba(226,226,226,0.5)',
},
},
axisTick: {
show: false,
},
},
yAxis: [
{
type: 'value',
max: 80000,
splitNumber: 4,
axisTick: {
show: false,
},
splitArea: {
show: true,
areaStyle: {
color: ['rgba(255,255,255,0.2)', 'rgba(226,226,226,0.2)'],
},
},
},
],
grid: { left: '1%', right: '1%', top: '2 %', bottom: 0, containLabel: true },
series: [
{
smooth: true,
data: [
111, 222, 4000, 18000, 33333, 55555, 66666, 33333, 14000, 36000, 66666, 44444,
22222, 11111, 4000, 2000, 500, 333, 222, 111,
],
type: 'line',
areaStyle: {},
itemStyle: {
color: '#5ab1ef',
},
},
{
smooth: true,
data: [
33, 66, 88, 333, 3333, 5000, 18000, 3000, 1200, 13000, 22000, 11000, 2221, 1201,
390, 198, 60, 30, 22, 11,
],
type: 'line',
areaStyle: {},
itemStyle: {
color: '#019680',
},
},
],
});
});
return { chartRef };
},
});
</script>
@@ -0,0 +1,25 @@
import {
CaretUpOutlined,
CaretDownOutlined,
UsergroupAddOutlined,
BarChartOutlined,
ShoppingCartOutlined,
AccountBookOutlined,
CreditCardOutlined,
MailOutlined,
TagsOutlined,
SettingOutlined,
} from '@vicons/antd';
export default {
CaretUpOutlined,
CaretDownOutlined,
UsergroupAddOutlined,
BarChartOutlined,
ShoppingCartOutlined,
AccountBookOutlined,
CreditCardOutlined,
MailOutlined,
TagsOutlined,
SettingOutlined,
};
@@ -0,0 +1,36 @@
<template>
<div class="mt-4">
<NRow :gutter="24">
<NCol :span="24">
<n-card content-style="padding: 0;" :bordered="false">
<n-tabs
type="line"
size="large"
:tabs-padding="20"
pane-style="padding: 20px;"
default-value="FluxTrend"
>
<n-tab-pane name="FluxTrend" :tab="t('流量消耗趋势')">
<FluxTrend />
</n-tab-pane>
<n-tab-pane name="VisitAmount" :tab="t('客户端访问量')">
<VisitAmount />
</n-tab-pane>
</n-tabs>
</n-card>
</NCol>
</NRow>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import FluxTrend from './FluxTrend.vue';
import VisitAmount from './VisitAmount.vue';
export default defineComponent({
components: { FluxTrend, VisitAmount },
setup() {
return {};
},
});
</script>
@@ -0,0 +1,61 @@
<template>
<div ref="chartRef" :style="{ height, width }"></div>
</template>
<script lang="ts">
import { defineComponent, onMounted, ref, Ref } from 'vue';
import { useECharts } from '@/hooks/web/useECharts';
import { basicProps } from './props';
export default defineComponent({
props: basicProps,
setup() {
const chartRef = ref<HTMLDivElement | null>(null);
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>);
onMounted(() => {
setOptions({
tooltip: {
trigger: 'axis',
axisPointer: {
lineStyle: {
width: 1,
color: '#019680',
},
},
},
grid: { left: '1%', right: '1%', top: '2 %', bottom: 0, containLabel: true },
xAxis: {
type: 'category',
data: [
'1月',
'2月',
'3月',
'4月',
'5月',
'6月',
'7月',
'8月',
'9月',
'10月',
'11月',
'12月',
],
},
yAxis: {
type: 'value',
max: 8000,
splitNumber: 4,
},
series: [
{
data: [3000, 2000, 3333, 5000, 3200, 4200, 3200, 2100, 3000, 5100, 6000, 3200, 4800],
type: 'bar',
barMaxWidth: 80,
},
],
});
});
return { chartRef };
},
});
</script>
@@ -0,0 +1,17 @@
import { PropType } from 'vue';
export interface BasicProps {
width: string;
height: string;
}
export const basicProps = {
width: {
type: String as PropType<string>,
default: '100%',
},
height: {
type: String as PropType<string>,
default: '280px',
},
};
@@ -0,0 +1,24 @@
<template>
<div class="mt-2">
<Company v-if="userStore.isCompanyDept" />
<Tenant v-else-if="userStore.isTenantDept" />
<Merchant v-else-if="userStore.isMerchantDept" />
<User v-else-if="userStore.isUserDept" />
<template v-else>
<div class="n-layout-page-header">
<n-card :bordered="false" title="默认首页">
部门类型未配置首页:{{ userStore.info?.deptType }}
</n-card>
</div>
</template>
</div>
</template>
<script lang="ts" setup>
import Company from './console_company.vue';
import Merchant from './console_merchant.vue';
import User from './console_user.vue';
import Tenant from './console_tenant.vue';
import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
</script>
@@ -0,0 +1,343 @@
<template>
<div class="console">
<!--数据卡片-->
<n-grid cols="1 s:2 m:3 l:4 xl:4 2xl:4" responsive="screen" :x-gap="12" :y-gap="8">
<n-grid-item>
<NCard
:title="t('卡板量')"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false"
>
<template #header-extra>
<n-tag type="success">{{ t('日') }}</n-tag>
</template>
<div class="py-1 px-1 flex justify-between">
<n-skeleton v-if="loading" :width="100" size="medium" />
<CountTo v-else :startVal="1" :endVal="visits.dayVisits" class="text-3xl" />
</div>
<div class="py-1 px-1 flex justify-between">
<div class="text-sn">
<n-skeleton v-if="loading" :width="100" size="medium" />
<template v-else>
{{ t('日同比') }}
<CountTo :startVal="1" suffix="%" :endVal="visits.rise" />
<n-icon size="12" color="#00ff6f">
<CaretUpOutlined />
</n-icon>
</template>
</div>
<div class="text-sn">
<n-skeleton v-if="loading" :width="100" size="medium" />
<template v-else>
{{ t('周同比') }}
<CountTo :startVal="1" suffix="%" :endVal="visits.decline" />
<n-icon size="12" color="#ffde66">
<CaretDownOutlined />
</n-icon>
</template>
</div>
</div>
<template #footer>
<div class="flex justify-between">
<n-skeleton v-if="loading" text :repeat="2" />
<template v-else>
<div class="text-sn"> {{ t('总卡板量:') }} </div>
<div class="text-sn">
<CountTo :startVal="1" :endVal="visits.amount" />
</div>
</template>
</div>
</template>
</NCard>
</n-grid-item>
<n-grid-item>
<NCard
:title="t('激活卡板')"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false"
>
<template #header-extra>
<n-tag type="info">{{ t('周') }}</n-tag>
</template>
<div class="py-1 px-1 flex justify-between">
<n-skeleton v-if="loading" :width="100" size="medium" />
<CountTo
v-else
prefix="¥"
:startVal="1"
:endVal="saleroom.weekSaleroom"
class="text-3xl"
/>
</div>
<div class="py-2 px-2 flex justify-between">
<div class="text-sn flex-1">
<n-progress
type="line"
:percentage="saleroom.degree"
:indicator-placement="'inside'"
processing
/>
</div>
</div>
<template #footer>
<div class="flex justify-between">
<n-skeleton v-if="loading" :width="100" size="medium" />
<template v-else>
<div class="text-sn"> {{ t('总激活卡板:') }} </div>
<div class="text-sn">
<CountTo :startVal="1" :endVal="saleroom.amount" />
</div>
</template>
</div>
</template>
</NCard>
</n-grid-item>
<n-grid-item>
<NCard
:title="t('代理商')"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false"
>
<template #header-extra>
<n-tag type="warning">{{ t('周') }}</n-tag>
</template>
<div class="py-1 px-1 flex justify-between">
<n-skeleton v-if="loading" :width="100" size="medium" />
<CountTo v-else :startVal="1" :endVal="orderLarge.weekLarge" class="text-3xl" />
</div>
<div class="py-1 px-1 flex justify-between">
<div class="text-sn">
<n-skeleton v-if="loading" :width="100" size="medium" />
<template v-else>
{{ t('日同比') }}
<CountTo :startVal="1" suffix="%" :endVal="orderLarge.rise" />
<n-icon size="12" color="#00ff6f">
<CaretUpOutlined />
</n-icon>
</template>
</div>
<div class="text-sn">
<n-skeleton v-if="loading" :width="100" size="medium" />
<template v-else>
{{ t('周同比') }}
<CountTo :startVal="1" suffix="%" :endVal="orderLarge.rise" />
<n-icon size="12" color="#ffde66">
<CaretDownOutlined />
</n-icon>
</template>
</div>
</div>
<template #footer>
<div class="flex justify-between">
<n-skeleton v-if="loading" :width="100" size="medium" />
<template v-else>
<div class="text-sn"> {{ t('总代理商量:') }} </div>
<div class="text-sn">
<CountTo :startVal="1" suffix="%" :endVal="orderLarge.amount" />
</div>
</template>
</div>
</template>
</NCard>
</n-grid-item>
<n-grid-item>
<NCard
:title="t('提现佣金')"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false"
>
<template #header-extra>
<n-tag type="error">{{ t('月') }}</n-tag>
</template>
<div class="py-1 px-1 flex justify-between">
<n-skeleton v-if="loading" :width="100" size="medium" />
<CountTo v-else prefix="¥" :startVal="1" :endVal="volume.weekLarge" class="text-3xl" />
</div>
<div class="py-1 px-1 flex justify-between">
<div class="text-sn">
<n-skeleton v-if="loading" :width="100" size="medium" />
<template v-else>
{{ t('月同比') }}
<CountTo :startVal="1" suffix="%" :endVal="volume.rise" />
<n-icon size="12" color="#00ff6f">
<CaretUpOutlined />
</n-icon>
</template>
</div>
<div class="text-sn">
<n-skeleton v-if="loading" :width="100" size="medium" />
<template v-else>
{{ t('月同比') }}
<CountTo :startVal="1" suffix="%" :endVal="volume.decline" />
<n-icon size="12" color="#ffde66">
<CaretDownOutlined />
</n-icon>
</template>
</div>
</div>
<template #footer>
<div class="flex justify-between">
<n-skeleton v-if="loading" :width="100" size="medium" />
<template v-else>
<div class="text-sn"> {{ t('总提现额:') }} </div>
<div class="text-sn">
<CountTo prefix="¥" :startVal="1" :endVal="volume.amount" />
</div>
</template>
</div>
</template>
</NCard>
</n-grid-item>
</n-grid>
<!--导航卡片-->
<div class="mt-4">
<n-grid cols="1 s:2 m:3 l:8 xl:8 2xl:8" responsive="screen" :x-gap="16" :y-gap="8">
<n-grid-item v-for="(item, index) in iconList" :key="index" @click="item.eventObject || {}">
<NCard
content-style="padding-top: 0;"
size="small"
:bordered="false"
v-on="item.eventObject || {}"
>
<template #footer>
<n-skeleton v-if="loading" size="medium" />
<div class="cursor-pointer" v-else>
<p class="flex justify-center">
<span>
<n-icon :size="item.size" class="flex-1" :color="item.color">
<component :is="item.icon" />
</n-icon>
</span>
</p>
<p class="flex justify-center"
><span>{{ item.title }}</span></p
>
</div>
</template>
</NCard>
</n-grid-item>
</n-grid>
</div>
<!--访问量 | 流量趋势-->
<VisiTab />
</div>
</template>
<script lang="ts" setup>
import { getConsoleInfo } from '@/api/dashboard/console';
import VisiTab from './components/VisiTab.vue';
import { CountTo } from '@/components/CountTo';
import {
CaretUpOutlined,
CaretDownOutlined,
UsergroupAddOutlined,
BarChartOutlined,
ShoppingCartOutlined,
AccountBookOutlined,
CreditCardOutlined,
MailOutlined,
TagsOutlined,
SettingOutlined,
} from '@vicons/antd';
const loading = ref(true);
const visits = ref<any>({});
const saleroom = ref<any>({});
const orderLarge = ref<any>({});
const volume = ref({});
const router = useRouter();
// 图标列表
const iconList = computed(() => {
return [
{
icon: UsergroupAddOutlined,
size: '32',
title: t('用户'),
color: '#69c0ff',
eventObject: {
click: () => router.push({ name: 'user' }),
},
},
{
icon: BarChartOutlined,
size: '32',
title: t('分析'),
color: '#69c0ff',
eventObject: {
click: () => {},
},
},
{
icon: ShoppingCartOutlined,
size: '32',
title: t('商品'),
color: '#ff9c6e',
eventObject: {
click: () => {},
},
},
{
icon: AccountBookOutlined,
size: '32',
title: t('订单'),
color: '#b37feb',
eventObject: {
click: () => {},
},
},
{
icon: CreditCardOutlined,
size: '32',
title: t('票据'),
color: '#ffd666',
eventObject: {
click: () => {},
},
},
{
icon: MailOutlined,
size: '32',
title: t('消息'),
color: '#5cdbd3',
eventObject: {
click: () => {},
},
},
{
icon: TagsOutlined,
size: '32',
title: t('标签'),
color: '#ff85c0',
eventObject: {
click: () => {},
},
},
{
icon: SettingOutlined,
size: '32',
title: t('配置'),
color: '#ffc069',
eventObject: {
click: () => {},
},
},
];
});
onMounted(async () => {
const data = await getConsoleInfo();
visits.value = data.visits;
saleroom.value = data.saleroom;
orderLarge.value = data.orderLarge;
volume.value = data.volume;
loading.value = false;
});
</script>
<style lang="less" scoped></style>
@@ -0,0 +1,11 @@
<script setup lang="ts"></script>
<template>
<div>
<div class="n-layout-page-header">
<n-card :bordered="false" title="商户首页"> 这是商户的首页,如果需要,你可以定制TA </n-card>
</div>
</div>
</template>
<style scoped lang="less"></style>
@@ -0,0 +1,11 @@
<script setup lang="ts"></script>
<template>
<div>
<div class="n-layout-page-header">
<n-card :bordered="false" title="租户首页"> 这是租户的首页,如果需要,你可以定制TA </n-card>
</div>
</div>
</template>
<style scoped lang="less"></style>
@@ -0,0 +1,13 @@
<script setup lang="ts"></script>
<template>
<div>
<div class="n-layout-page-header">
<n-card :bordered="false" title="用户首页">
这是普通用户的首页,如果需要,你可以定制TA
</n-card>
</div>
</div>
</template>
<style scoped lang="less"></style>