Skip to content

Commit

Permalink
update distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
Germey committed Jan 1, 2024
1 parent ac2dcba commit 1edc63e
Show file tree
Hide file tree
Showing 32 changed files with 1,362 additions and 252 deletions.
19 changes: 12 additions & 7 deletions src/components/common/HelpEntry.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<template>
<div>
<el-tooltip effect="dark" :content="`${$t('common.message.helpWechat')}「sunbitty」`" placement="top-start">
<el-button type="primary" circle size="large">
<font-awesome-icon icon="fa-solid fa-question" />
</el-button>
</el-tooltip>
</div>
<el-tooltip
effect="dark"
:content="`<p>${$t('common.message.helpWechat')}: yuxingzou</p><p>${$t(
'common.message.helpWechat2'
)}: sunbitty</p>`"
placement="top-start"
raw-content
>
<el-button type="primary" circle size="large">
<font-awesome-icon icon="fa-solid fa-question" />
</el-button>
</el-tooltip>
</template>

<script lang="ts">
Expand Down
45 changes: 45 additions & 0 deletions src/components/common/HelpEntry2.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template>
<el-tooltip
effect="dark"
:content="`<p>${$t('common.message.helpWechat')}: yuxingzou</p><p>${$t(
'common.message.helpWechat2'
)}: sunbitty</p>`"
placement="top-start"
raw-content
>
<el-button class="button">
<font-awesome-icon icon="fa-solid fa-question" />
</el-button>
</el-tooltip>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { ElTooltip, ElButton } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
export default defineComponent({
name: 'HelpEntry',
components: {
ElTooltip,
ElButton,
FontAwesomeIcon
}
});
</script>

<style lang="scss" scoped>
.button {
width: 40px;
height: 40px;
border-radius: 10px;
border: none;
background-color: var(--el-bg-color-page);
&.active,
&:hover,
&:focus {
background-color: var(--el-button-hover-bg-color);
color: var(--el-button-active-text-color);
}
}
</style>
5 changes: 5 additions & 0 deletions src/components/common/Navigator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
</el-button>
</el-tooltip>
</div>
<div class="link">
<help-entry />
</div>
<div class="link">
<el-tooltip effect="dark" :content="$t('common.nav.logOut')" placement="right">
<el-button class="button" @click="onLogout">
Expand All @@ -48,11 +51,13 @@ import {
ROUTE_MIDJOURNEY_HISTORY,
ROUTE_MIDJOURNEY_INDEX
} from '@/router/constants';
import HelpEntry from './HelpEntry2.vue';
export default defineComponent({
name: 'Navigator',
components: {
ElButton,
HelpEntry,
ElTooltip,
FontAwesomeIcon
},
Expand Down
16 changes: 13 additions & 3 deletions src/components/console/SidePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@

<script lang="ts">
import { defineComponent } from 'vue';
import { ROUTE_CONSOLE_APPLICATION_LIST, ROUTE_CONSOLE_ORDER_LIST, ROUTE_INDEX } from '@/router';
import { ElRow, ElCol } from 'element-plus';
import {
ROUTE_CONSOLE_APPLICATION_LIST,
ROUTE_CONSOLE_ORDER_LIST,
ROUTE_INDEX,
ROUTE_CONSOLE_DISTRIBUTION_INDEX
} from '@/router';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
interface ILink {
Expand Down Expand Up @@ -67,6 +71,12 @@ export default defineComponent({
text: this.$t('console.menu.orderList'),
name: ROUTE_CONSOLE_ORDER_LIST,
icon: 'fa-solid fa-store'
},
{
key: 'distribution-index',
text: this.$t('console.menu.distributionIndex'),
name: ROUTE_CONSOLE_DISTRIBUTION_INDEX,
icon: 'fa-solid fa-coins'
}
];
return links;
Expand Down Expand Up @@ -99,7 +109,7 @@ $padding-left: 10px;
padding-left: $padding-left;
width: $width;
padding-top: 50px;
border-right: 1px solid var(--el-border-color);
// border-right: 1px solid var(--el-border-color);
height: 100%;
}
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/zh/common/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export default {
info: '温馨提示',
free: '免费',
startPrice: '起',
helpWechat: '客服微信',
helpWechat: '技术客服微信',
helpWechat2: '业务客服微信',
remainingCount: '剩余次数',
usedCount: '使用次数'
};
4 changes: 2 additions & 2 deletions src/i18n/zh/common/nav.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
chat: '问答',
midjourney: 'Midjourney',
chat: 'AI 问答',
midjourney: 'AI 绘画 - Midjourney',
editor: '编辑器',
setting: '设置',
home: '首页',
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/zh/common/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ export default {
allApplications: '所有申请',
allOrders: '所有订单',
orderInfo: '订单信息',
buyMore: '购买更多'
buyMore: '购买更多',
distribution: '分销赚钱',
distributionHistory: '分销历史',
invitee: '邀请人',
allUsages: '调用记录'
};
2 changes: 1 addition & 1 deletion src/i18n/zh/console/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
userProfile: '个人信息',
idVerify: '实名认证',
manageApplication: '申请管理',
distributionIndex: '分销推广',
distributionIndex: '分销赚钱',
usageList: '调用记录',
platformTokenIndex: '平台令牌',
manageOrder: '订单管理'
Expand Down
4 changes: 4 additions & 0 deletions src/i18n/zh/distribution/button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
detail: '查看详情',
withdrawal: '提现'
};
12 changes: 12 additions & 0 deletions src/i18n/zh/distribution/field.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default {
id: '分销ID',
percentage: '分成比例',
price: '订单金额',
reward: '分销奖励',
createdAt: '分销时间',
level: '级别',
threshold: '分销门槛',
inviteeId: '邀请人ID',
isVerified: '是否实名',
userId: '用户ID'
};
11 changes: 11 additions & 0 deletions src/i18n/zh/distribution/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import field from './field';
import title from './title';
import message from './message';
import button from './button';

export default {
field,
title,
message,
button
};
13 changes: 13 additions & 0 deletions src/i18n/zh/distribution/message.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
deltaPriceForNextLevel: '距离下一级别还差',
developingWithDrawal: '提现功能正在加急开发中,敬请期待!',
howToWithdrawal: '请添加客服处理提现,提现需扣除 5% 的所得税,提供发票可进行抵扣',
technicalDetail: '技术细节',
distributionQrDescription: '分销二维码(内容同链接)',
distributionDescription:
'您可通过链接邀请新客户注册,该客户会永久绑定为您的下级客户,该客户在该平台的所有消费订单会按照当前分成比例返还到您的账户中,并随时可提现。',
distributionLinkDescription:
'如果客户通过该链接或二维码注册本平台,该客户将永久被绑定为您的下级客户,该客户在该平台的所有消费订单会按照当前分成比例返还到您的账户中。',
distributionLinkDescription2:
'该链接中包含您的用户 ID,客户打开链接之后您的用户 ID 将以 Cookies 形式记录到客户的浏览器,有效期七天。在七天内,如果客户扫码注册本平台,您的用户 ID 将会随着 Cookies 上传至注册服务器,该客户便可绑定成为您的下游客户。'
};
13 changes: 13 additions & 0 deletions src/i18n/zh/distribution/title.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
price: '分销订单总金额',
reward: '分销总奖励',
level: '分销级别',
percentage: '分成比例',
currentLevel: '当前级别',
nextLevel: '下一级别',
currentPercentage: '当前分成比例',
nextPercentage: '下级分成比例',
levelInfo: '级别信息',
distributionLink: '分销链接',
inviteesCount: '累计邀请人数'
};
6 changes: 5 additions & 1 deletion src/i18n/zh/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ import midjourney from './midjourney';
import chat from './chat';
import console from './console';
import order from './order';
import distribution from './distribution';
import user from './user';

export default {
chat,
user,
order,
console,
common,
application,
api,
setting,
midjourney
midjourney,
distribution
};
7 changes: 7 additions & 0 deletions src/i18n/zh/user/field.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
id: '用户ID',
isVerified: '是否实名',
nickname: '昵称',
username: '用户名',
dateJoined: '注册时间'
};
5 changes: 5 additions & 0 deletions src/i18n/zh/user/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import field from './field';

export default {
field
};
2 changes: 1 addition & 1 deletion src/layouts/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineComponent({
.left {
width: 60px;
height: 100%;
border-right: 1px solid var(--el-border-color);
// border-right: 1px solid var(--el-border-color);
}
.main {
height: 100%;
Expand Down
2 changes: 2 additions & 0 deletions src/operators/distribution/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './operator';
export * from './models';
54 changes: 54 additions & 0 deletions src/operators/distribution/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { IOrder } from '../order';

export interface IDistributionHistory {
id: string;
user_id: string;
invitee_id: string;
order?: IOrder;
order_id?: string;
price: number;
reward: number;
percentage: number;
created_at?: string;
updated_at?: string;
}

export interface IDistributionLevel {
id: string;
level: number;
threshold: number;
percentage: number;
created_at?: string;
updated_at?: string;
}

export interface IDistributionStatus {
id: string;
user_id: string;
price: number;
reward: number;
level_id?: string;
level?: IDistributionLevel;
percentage: number;
created_at?: string;
updated_at?: string;
}

export interface IDistributionStatusListResponse {
count: number;
items: IDistributionStatus[];
}

export type IDistributionStatusDetailResponse = IDistributionStatus;

export interface IDistributionHistoryListResponse {
count: number;
items: IDistributionHistory[];
}

export type IDistributionHistoryDetailResponse = IDistributionHistory;

export interface IDistributionLevelListResponse {
count: number;
items: IDistributionLevel[];
}
57 changes: 57 additions & 0 deletions src/operators/distribution/operator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { AxiosResponse } from 'axios';
import { httpClient } from '../instance';
import {
IDistributionHistoryListResponse,
IDistributionLevelListResponse,
IDistributionStatusDetailResponse,
IDistributionStatusListResponse
} from './models';

export interface IDistributionHistoryQuery {
user_id?: string;
offset?: number;
limit?: number;
ordering: string;
}

class DistributionHistoryService {
key = 'distribution-histories';

async getAll(query: IDistributionHistoryQuery): Promise<AxiosResponse<IDistributionHistoryListResponse>> {
return await httpClient.get(`/${this.key}/`, {
params: query
});
}
}

export const distributionHistoryOperator = new DistributionHistoryService();

export interface IDistributionStatusQuery {
user_id?: string;
}

class DistributionStatusService {
key = 'distribution-statuses';

async getAll(query: IDistributionStatusQuery): Promise<AxiosResponse<IDistributionStatusListResponse>> {
return await httpClient.get(`/${this.key}/`, {
params: query
});
}

async initialize(): Promise<AxiosResponse<IDistributionStatusDetailResponse>> {
return await httpClient.post(`/${this.key}/initialize/`);
}
}

export const distributionStatusOperator = new DistributionStatusService();

class DistributionLevelService {
key = 'distribution-levels';

async getAll(): Promise<AxiosResponse<IDistributionLevelListResponse>> {
return await httpClient.get(`/${this.key}/`);
}
}

export const distributionLevelOperator = new DistributionLevelService();
Loading

0 comments on commit 1edc63e

Please sign in to comment.