Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): add billing center #1371

Merged
merged 10 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
591 changes: 591 additions & 0 deletions web/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"qrcode.react": "^3.1.0",
"react": "18.2.0",
"react-datepicker": "^4.11.0",
"react-day-picker": "^8.8.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.43.9",
"react-i18next": "^12.3.1",
Expand All @@ -44,6 +45,7 @@
"react-markdown": "^8.0.7",
"react-router-dom": "^6.11.2",
"react-syntax-highlighter": "^15.5.0",
"recharts": "^2.7.2",
"remark-gfm": "^3.0.1",
"remark-math": "^5.1.1",
"sass": "^1.62.1",
Expand Down
47 changes: 41 additions & 6 deletions web/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,19 @@
"UserName": "UserName",
"Email": "Email",
"PassWord": "PassWord",
"UserInvite": "UserInvite"
"UserInvite": "UserInvite",
"UserCenter": "User Center",
"CostOverview": "Cost Overview",
"CardRedemption": "Card Redemption",
"BillingDetails": "Billing Details",
"RechargeHistory": "Recharge History",
"PricingStandards": "Pricing Standards",
"EnterGiftCode": "Enter Gift Code",
"ExchangeSuccess": "Exchange Success",
"Domain": "Custom Domain",
"MyAccount": "My Account",
"CostTrend": "Cost Trend",
"Balance": "Balance"
},
"StoragePanel": {
"All": "Total Capacity",
Expand Down Expand Up @@ -244,7 +256,8 @@
"InstantUpload": "Instant Upload",
"parsing": "parsing",
"DomainUpdateSuccess": "Domain Update Success",
"DomainDeleteSuccess": "Domain Delete Success"
"DomainDeleteSuccess": "Domain Delete Success",
"CustomApplicationDomain": "Custom Application Domain"
},
"TriggerPanel": {
"AddTrigger": "Add Trigger",
Expand Down Expand Up @@ -447,7 +460,7 @@
"PleaseCloseApplicationFirst": "Please close your application first.",
"custom": "Custom",
"CostTime": "CostTime",
"Duration": "Duration",
"Duration": "Trade Time",
"State": "State",
"TotalAmount": "Total",
"AIWelcomeMessage": "Hello, I am Laf AI Development Assistant, how can I help you?",
Expand Down Expand Up @@ -529,7 +542,29 @@
"EditPasswordSuccess": "Edit Password Success",
"EditPhoneSuccess": "Edit Phone Success",
"EditAvatarSuccess": "Edit Avatar Success",
"Change": "Change"
"Change": "Change",
"InviteLink": "Invite Link",
"BonusDetails": "Bonus Details",
"Bonus": "Bonus",
"Channel": "Username",
"Time": "Time",
"InviteTips": "Copy the referral link and send it to others. When they click on this link to register, they will become your invited users, and you will immediately receive bonus."
},
"Reset": "Reset"
}
"Reset": "Reset",
"SettingModal": {
"Exchange": "Exange"
},
"MyIncomeandExpenses": "My Income and Expenses",
"Expenses": "Expenses",
"OrderNumber": "Order Number",
"Bonus amount": "Bonus amount",
"Total payment amount": "Total payment amount",
"Day": "Day",
"Week": "Week",
"Month": "Month",
"Year": "Year",
"Hour": "Hour",
"Core": "Core",
"No History": "No History",
"MyIncomeAndExpenses": "My Income And Expenses"
}
47 changes: 41 additions & 6 deletions web/public/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,19 @@
"UserName": "用户名",
"Email": "邮箱",
"PassWord": "密码",
"UserInvite": "我的推广"
"UserInvite": "我的推广",
"UserCenter": "用户中心",
"CostOverview": "成本总览",
"CardRedemption": "点卡兑换",
"BillingDetails": "账单明细",
"RechargeHistory": "充值记录",
"PricingStandards": "计价标准",
"EnterGiftCode": "输入卡密",
"ExchangeSuccess": "兑换成功",
"Domain": "域名设置",
"MyAccount": "我的账户",
"CostTrend": "成本趋势",
"Balance": "余额"
},
"StoragePanel": {
"All": "总容量",
Expand Down Expand Up @@ -244,7 +256,8 @@
"InstantUpload": "立即上传",
"RemoveHost": "取消静态托管",
"DomainUpdateSuccess": "域名修改成功",
"DomainDeleteSuccess": "域名删除成功"
"DomainDeleteSuccess": "域名删除成功",
"CustomApplicationDomain": "自定义应用域名"
},
"TriggerPanel": {
"AddTrigger": "新建触发器",
Expand Down Expand Up @@ -490,7 +503,7 @@
"PleaseCloseApplicationFirst": "请先关闭应用",
"custom": "自定义",
"CostTime": "扣费时间",
"Duration": "计费周期",
"Duration": "交易时间",
"State": "状态",
"TotalAmount": "总费用",
"AIWelcomeMessage": "你好,我是 Laf AI 开发助理,请问有什么可以帮助您的吗?",
Expand Down Expand Up @@ -529,7 +542,29 @@
"EditPasswordSuccess": "密码修改成功",
"EditPhoneSuccess": "电话号修改成功",
"EditAvatarSuccess": "头像更新成功",
"Change": "更改"
"Change": "更改",
"InviteLink": "推广链接",
"BonusDetails": "奖励明细",
"Bonus": "奖励",
"Channel": "用户名",
"Time": "时间",
"InviteTips": "复制推广链接,发送给其他人。当他们点击此链接注册后,将成为你的被邀请人,并且你可立刻获得佣金。"
},
"Reset": "重置"
}
"Reset": "重置",
"SettingModal": {
"Exchange": "兑换"
},
"MyIncomeandExpenses": "我的收支",
"Expenses": "支出",
"OrderNumber": "订单号",
"Bonus amount": "赠送金额",
"Total payment amount": "实付金额",
"Day": "天",
"Week": "周",
"Month": "月",
"Year": "年",
"Hour": "小时",
"Core": "核",
"No History": "暂无记录",
"MyIncomeAndExpenses": "我的收支"
}
47 changes: 41 additions & 6 deletions web/public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,19 @@
"UserName": "用户名",
"Email": "邮箱",
"PassWord": "密码",
"UserInvite": "我的推广"
"UserInvite": "我的推广",
"UserCenter": "用户中心",
"CostOverview": "成本总览",
"CardRedemption": "点卡兑换",
"BillingDetails": "账单明细",
"RechargeHistory": "充值记录",
"PricingStandards": "计价标准",
"EnterGiftCode": "输入卡密",
"ExchangeSuccess": "兑换成功",
"Domain": "域名设置",
"MyAccount": "我的账户",
"CostTrend": "成本趋势",
"Balance": "余额"
},
"StoragePanel": {
"All": "总容量",
Expand Down Expand Up @@ -244,7 +256,8 @@
"InstantUpload": "立即上传",
"RemoveHost": "取消静态托管",
"DomainUpdateSuccess": "域名修改成功",
"DomainDeleteSuccess": "域名删除成功"
"DomainDeleteSuccess": "域名删除成功",
"CustomApplicationDomain": "自定义应用域名"
},
"TriggerPanel": {
"AddTrigger": "新建触发器",
Expand Down Expand Up @@ -490,7 +503,7 @@
"PleaseCloseApplicationFirst": "请先关闭应用",
"custom": "自定义",
"CostTime": "扣费时间",
"Duration": "计费周期",
"Duration": "交易时间",
"State": "状态",
"TotalAmount": "总费用",
"AIWelcomeMessage": "你好,我是 Laf AI 开发助理,请问有什么可以帮助您的吗?",
Expand Down Expand Up @@ -529,7 +542,29 @@
"EditPasswordSuccess": "密码修改成功",
"EditPhoneSuccess": "电话号修改成功",
"EditAvatarSuccess": "头像更新成功",
"Change": "更改"
"Change": "更改",
"InviteLink": "推广链接",
"BonusDetails": "奖励明细",
"Bonus": "奖励",
"Channel": "用户名",
"Time": "时间",
"InviteTips": "复制推广链接,发送给其他人。当他们点击此链接注册后,将成为你的被邀请人,并且你可立刻获得佣金。"
},
"Reset": "重置"
}
"Reset": "重置",
"SettingModal": {
"Exchange": "兑换"
},
"MyIncomeandExpenses": "我的收支",
"Expenses": "支出",
"OrderNumber": "订单号",
"Bonus amount": "赠送金额",
"Total payment amount": "实付金额",
"Day": "天",
"Week": "周",
"Month": "月",
"Year": "年",
"Hour": "小时",
"Core": "核",
"No History": "暂无记录",
"MyIncomeAndExpenses": "我的收支"
}
5 changes: 5 additions & 0 deletions web/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@ a {
background: black;
}
}

.rdp-day_selected {
background-color: #00A9A6 !important;
color: white !important;
}
98 changes: 98 additions & 0 deletions web/src/apis/v1/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ export async function AccountControllerFindOne(
});
}

/**
* Get charge order total amount
*/
export async function AccountControllerGetChargeOrderAmount(
params: Paths.AccountControllerGetChargeOrderAmount.BodyParameters,
): Promise<{
error: string;
data: Definitions.Number;
}> {
// /v1/accounts/charge-order/amount
let _params: { [key: string]: any } = {
appid: useGlobalStore.getState().currentApp?.appid || "",
...params,
};
return request(`/v1/accounts/charge-order/amount`, {
method: "GET",
params: params,
});
}

/**
* Get charge order
*/
Expand All @@ -50,6 +70,26 @@ export async function AccountControllerGetChargeOrder(
});
}

/**
* get all charge order
*/
export async function AccountControllerChargeRecord(
params: Paths.AccountControllerChargeRecord.BodyParameters,
): Promise<{
error: string;
data: Paths.AccountControllerChargeRecord.Responses;
}> {
// /v1/accounts/charge-orders
let _params: { [key: string]: any } = {
appid: useGlobalStore.getState().currentApp?.appid || "",
...params,
};
return request(`/v1/accounts/charge-orders`, {
method: "GET",
params: params,
});
}

/**
* Create charge order
*/
Expand Down Expand Up @@ -107,3 +147,61 @@ export async function AccountControllerWechatNotify(
data: params,
});
}

/**
* Use a gift code
*/
export async function AccountControllerGiftCode(params: Definitions.UseGiftCodeDto): Promise<{
error: string;
data: Definitions.Account;
}> {
// /v1/accounts/gift-code
let _params: { [key: string]: any } = {
appid: useGlobalStore.getState().currentApp?.appid || "",
...params,
};
return request(`/v1/accounts/gift-code`, {
method: "POST",
data: params,
});
}

/**
* get a invite code
*/
export async function AccountControllerInviteCode(
params: Paths.AccountControllerInviteCode.BodyParameters,
): Promise<{
error: string;
data: Definitions.InviteCode;
}> {
// /v1/accounts/invite-code
let _params: { [key: string]: any } = {
appid: useGlobalStore.getState().currentApp?.appid || "",
...params,
};
return request(`/v1/accounts/invite-code`, {
method: "GET",
params: params,
});
}

/**
* get invite code profit
*/
export async function AccountControllerInviteCodeProfit(
params: Paths.AccountControllerInviteCodeProfit.BodyParameters,
): Promise<{
error: string;
data: Paths.AccountControllerInviteCodeProfit.Responses;
}> {
// /v1/accounts/invite-profit
let _params: { [key: string]: any } = {
appid: useGlobalStore.getState().currentApp?.appid || "",
...params,
};
return request(`/v1/accounts/invite-profit`, {
method: "GET",
params: params,
});
}
Loading