Skip to content

Commit 1f3e5df

Browse files
authored
feat(web): add billing center (#1371)
* feat(web): initialize billing center * feat(web): add user-invite * refactor(web): change custom domain position * feat(web): add billing detail interface * feat(web): add recharge order details * fix(web): fix amount display * fix(web): fix gift code mutate data & recharge data * fix(web): fix recharge order * refactor(web): add user setting popover
1 parent d1423bb commit 1f3e5df

File tree

48 files changed

+2511
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2511
-456
lines changed

web/package-lock.json

+591
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"qrcode.react": "^3.1.0",
3737
"react": "18.2.0",
3838
"react-datepicker": "^4.11.0",
39+
"react-day-picker": "^8.8.0",
3940
"react-dom": "18.2.0",
4041
"react-hook-form": "^7.43.9",
4142
"react-i18next": "^12.3.1",
@@ -44,6 +45,7 @@
4445
"react-markdown": "^8.0.7",
4546
"react-router-dom": "^6.11.2",
4647
"react-syntax-highlighter": "^15.5.0",
48+
"recharts": "^2.7.2",
4749
"remark-gfm": "^3.0.1",
4850
"remark-math": "^5.1.1",
4951
"sass": "^1.62.1",

web/public/locales/en/translation.json

+41-6
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,19 @@
189189
"UserName": "UserName",
190190
"Email": "Email",
191191
"PassWord": "PassWord",
192-
"UserInvite": "UserInvite"
192+
"UserInvite": "UserInvite",
193+
"UserCenter": "User Center",
194+
"CostOverview": "Cost Overview",
195+
"CardRedemption": "Card Redemption",
196+
"BillingDetails": "Billing Details",
197+
"RechargeHistory": "Recharge History",
198+
"PricingStandards": "Pricing Standards",
199+
"EnterGiftCode": "Enter Gift Code",
200+
"ExchangeSuccess": "Exchange Success",
201+
"Domain": "Custom Domain",
202+
"MyAccount": "My Account",
203+
"CostTrend": "Cost Trend",
204+
"Balance": "Balance"
193205
},
194206
"StoragePanel": {
195207
"All": "Total Capacity",
@@ -244,7 +256,8 @@
244256
"InstantUpload": "Instant Upload",
245257
"parsing": "parsing",
246258
"DomainUpdateSuccess": "Domain Update Success",
247-
"DomainDeleteSuccess": "Domain Delete Success"
259+
"DomainDeleteSuccess": "Domain Delete Success",
260+
"CustomApplicationDomain": "Custom Application Domain"
248261
},
249262
"TriggerPanel": {
250263
"AddTrigger": "Add Trigger",
@@ -447,7 +460,7 @@
447460
"PleaseCloseApplicationFirst": "Please close your application first.",
448461
"custom": "Custom",
449462
"CostTime": "CostTime",
450-
"Duration": "Duration",
463+
"Duration": "Trade Time",
451464
"State": "State",
452465
"TotalAmount": "Total",
453466
"AIWelcomeMessage": "Hello, I am Laf AI Development Assistant, how can I help you?",
@@ -529,7 +542,29 @@
529542
"EditPasswordSuccess": "Edit Password Success",
530543
"EditPhoneSuccess": "Edit Phone Success",
531544
"EditAvatarSuccess": "Edit Avatar Success",
532-
"Change": "Change"
545+
"Change": "Change",
546+
"InviteLink": "Invite Link",
547+
"BonusDetails": "Bonus Details",
548+
"Bonus": "Bonus",
549+
"Channel": "Username",
550+
"Time": "Time",
551+
"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."
533552
},
534-
"Reset": "Reset"
535-
}
553+
"Reset": "Reset",
554+
"SettingModal": {
555+
"Exchange": "Exange"
556+
},
557+
"MyIncomeandExpenses": "My Income and Expenses",
558+
"Expenses": "Expenses",
559+
"OrderNumber": "Order Number",
560+
"Bonus amount": "Bonus amount",
561+
"Total payment amount": "Total payment amount",
562+
"Day": "Day",
563+
"Week": "Week",
564+
"Month": "Month",
565+
"Year": "Year",
566+
"Hour": "Hour",
567+
"Core": "Core",
568+
"No History": "No History",
569+
"MyIncomeAndExpenses": "My Income And Expenses"
570+
}

web/public/locales/zh-CN/translation.json

+41-6
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,19 @@
189189
"UserName": "用户名",
190190
"Email": "邮箱",
191191
"PassWord": "密码",
192-
"UserInvite": "我的推广"
192+
"UserInvite": "我的推广",
193+
"UserCenter": "用户中心",
194+
"CostOverview": "成本总览",
195+
"CardRedemption": "点卡兑换",
196+
"BillingDetails": "账单明细",
197+
"RechargeHistory": "充值记录",
198+
"PricingStandards": "计价标准",
199+
"EnterGiftCode": "输入卡密",
200+
"ExchangeSuccess": "兑换成功",
201+
"Domain": "域名设置",
202+
"MyAccount": "我的账户",
203+
"CostTrend": "成本趋势",
204+
"Balance": "余额"
193205
},
194206
"StoragePanel": {
195207
"All": "总容量",
@@ -244,7 +256,8 @@
244256
"InstantUpload": "立即上传",
245257
"RemoveHost": "取消静态托管",
246258
"DomainUpdateSuccess": "域名修改成功",
247-
"DomainDeleteSuccess": "域名删除成功"
259+
"DomainDeleteSuccess": "域名删除成功",
260+
"CustomApplicationDomain": "自定义应用域名"
248261
},
249262
"TriggerPanel": {
250263
"AddTrigger": "新建触发器",
@@ -490,7 +503,7 @@
490503
"PleaseCloseApplicationFirst": "请先关闭应用",
491504
"custom": "自定义",
492505
"CostTime": "扣费时间",
493-
"Duration": "计费周期",
506+
"Duration": "交易时间",
494507
"State": "状态",
495508
"TotalAmount": "总费用",
496509
"AIWelcomeMessage": "你好,我是 Laf AI 开发助理,请问有什么可以帮助您的吗?",
@@ -529,7 +542,29 @@
529542
"EditPasswordSuccess": "密码修改成功",
530543
"EditPhoneSuccess": "电话号修改成功",
531544
"EditAvatarSuccess": "头像更新成功",
532-
"Change": "更改"
545+
"Change": "更改",
546+
"InviteLink": "推广链接",
547+
"BonusDetails": "奖励明细",
548+
"Bonus": "奖励",
549+
"Channel": "用户名",
550+
"Time": "时间",
551+
"InviteTips": "复制推广链接,发送给其他人。当他们点击此链接注册后,将成为你的被邀请人,并且你可立刻获得佣金。"
533552
},
534-
"Reset": "重置"
535-
}
553+
"Reset": "重置",
554+
"SettingModal": {
555+
"Exchange": "兑换"
556+
},
557+
"MyIncomeandExpenses": "我的收支",
558+
"Expenses": "支出",
559+
"OrderNumber": "订单号",
560+
"Bonus amount": "赠送金额",
561+
"Total payment amount": "实付金额",
562+
"Day": "",
563+
"Week": "",
564+
"Month": "",
565+
"Year": "",
566+
"Hour": "小时",
567+
"Core": "",
568+
"No History": "暂无记录",
569+
"MyIncomeAndExpenses": "我的收支"
570+
}

web/public/locales/zh/translation.json

+41-6
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,19 @@
189189
"UserName": "用户名",
190190
"Email": "邮箱",
191191
"PassWord": "密码",
192-
"UserInvite": "我的推广"
192+
"UserInvite": "我的推广",
193+
"UserCenter": "用户中心",
194+
"CostOverview": "成本总览",
195+
"CardRedemption": "点卡兑换",
196+
"BillingDetails": "账单明细",
197+
"RechargeHistory": "充值记录",
198+
"PricingStandards": "计价标准",
199+
"EnterGiftCode": "输入卡密",
200+
"ExchangeSuccess": "兑换成功",
201+
"Domain": "域名设置",
202+
"MyAccount": "我的账户",
203+
"CostTrend": "成本趋势",
204+
"Balance": "余额"
193205
},
194206
"StoragePanel": {
195207
"All": "总容量",
@@ -244,7 +256,8 @@
244256
"InstantUpload": "立即上传",
245257
"RemoveHost": "取消静态托管",
246258
"DomainUpdateSuccess": "域名修改成功",
247-
"DomainDeleteSuccess": "域名删除成功"
259+
"DomainDeleteSuccess": "域名删除成功",
260+
"CustomApplicationDomain": "自定义应用域名"
248261
},
249262
"TriggerPanel": {
250263
"AddTrigger": "新建触发器",
@@ -490,7 +503,7 @@
490503
"PleaseCloseApplicationFirst": "请先关闭应用",
491504
"custom": "自定义",
492505
"CostTime": "扣费时间",
493-
"Duration": "计费周期",
506+
"Duration": "交易时间",
494507
"State": "状态",
495508
"TotalAmount": "总费用",
496509
"AIWelcomeMessage": "你好,我是 Laf AI 开发助理,请问有什么可以帮助您的吗?",
@@ -529,7 +542,29 @@
529542
"EditPasswordSuccess": "密码修改成功",
530543
"EditPhoneSuccess": "电话号修改成功",
531544
"EditAvatarSuccess": "头像更新成功",
532-
"Change": "更改"
545+
"Change": "更改",
546+
"InviteLink": "推广链接",
547+
"BonusDetails": "奖励明细",
548+
"Bonus": "奖励",
549+
"Channel": "用户名",
550+
"Time": "时间",
551+
"InviteTips": "复制推广链接,发送给其他人。当他们点击此链接注册后,将成为你的被邀请人,并且你可立刻获得佣金。"
533552
},
534-
"Reset": "重置"
535-
}
553+
"Reset": "重置",
554+
"SettingModal": {
555+
"Exchange": "兑换"
556+
},
557+
"MyIncomeandExpenses": "我的收支",
558+
"Expenses": "支出",
559+
"OrderNumber": "订单号",
560+
"Bonus amount": "赠送金额",
561+
"Total payment amount": "实付金额",
562+
"Day": "",
563+
"Week": "",
564+
"Month": "",
565+
"Year": "",
566+
"Hour": "小时",
567+
"Core": "",
568+
"No History": "暂无记录",
569+
"MyIncomeAndExpenses": "我的收支"
570+
}

web/src/App.css

+5
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,8 @@ a {
7171
background: black;
7272
}
7373
}
74+
75+
.rdp-day_selected {
76+
background-color: #00A9A6 !important;
77+
color: white !important;
78+
}

web/src/apis/v1/accounts.ts

+98
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ export async function AccountControllerFindOne(
3030
});
3131
}
3232

33+
/**
34+
* Get charge order total amount
35+
*/
36+
export async function AccountControllerGetChargeOrderAmount(
37+
params: Paths.AccountControllerGetChargeOrderAmount.BodyParameters,
38+
): Promise<{
39+
error: string;
40+
data: Definitions.Number;
41+
}> {
42+
// /v1/accounts/charge-order/amount
43+
let _params: { [key: string]: any } = {
44+
appid: useGlobalStore.getState().currentApp?.appid || "",
45+
...params,
46+
};
47+
return request(`/v1/accounts/charge-order/amount`, {
48+
method: "GET",
49+
params: params,
50+
});
51+
}
52+
3353
/**
3454
* Get charge order
3555
*/
@@ -50,6 +70,26 @@ export async function AccountControllerGetChargeOrder(
5070
});
5171
}
5272

73+
/**
74+
* get all charge order
75+
*/
76+
export async function AccountControllerChargeRecord(
77+
params: Paths.AccountControllerChargeRecord.BodyParameters,
78+
): Promise<{
79+
error: string;
80+
data: Paths.AccountControllerChargeRecord.Responses;
81+
}> {
82+
// /v1/accounts/charge-orders
83+
let _params: { [key: string]: any } = {
84+
appid: useGlobalStore.getState().currentApp?.appid || "",
85+
...params,
86+
};
87+
return request(`/v1/accounts/charge-orders`, {
88+
method: "GET",
89+
params: params,
90+
});
91+
}
92+
5393
/**
5494
* Create charge order
5595
*/
@@ -107,3 +147,61 @@ export async function AccountControllerWechatNotify(
107147
data: params,
108148
});
109149
}
150+
151+
/**
152+
* Use a gift code
153+
*/
154+
export async function AccountControllerGiftCode(params: Definitions.UseGiftCodeDto): Promise<{
155+
error: string;
156+
data: Definitions.Account;
157+
}> {
158+
// /v1/accounts/gift-code
159+
let _params: { [key: string]: any } = {
160+
appid: useGlobalStore.getState().currentApp?.appid || "",
161+
...params,
162+
};
163+
return request(`/v1/accounts/gift-code`, {
164+
method: "POST",
165+
data: params,
166+
});
167+
}
168+
169+
/**
170+
* get a invite code
171+
*/
172+
export async function AccountControllerInviteCode(
173+
params: Paths.AccountControllerInviteCode.BodyParameters,
174+
): Promise<{
175+
error: string;
176+
data: Definitions.InviteCode;
177+
}> {
178+
// /v1/accounts/invite-code
179+
let _params: { [key: string]: any } = {
180+
appid: useGlobalStore.getState().currentApp?.appid || "",
181+
...params,
182+
};
183+
return request(`/v1/accounts/invite-code`, {
184+
method: "GET",
185+
params: params,
186+
});
187+
}
188+
189+
/**
190+
* get invite code profit
191+
*/
192+
export async function AccountControllerInviteCodeProfit(
193+
params: Paths.AccountControllerInviteCodeProfit.BodyParameters,
194+
): Promise<{
195+
error: string;
196+
data: Paths.AccountControllerInviteCodeProfit.Responses;
197+
}> {
198+
// /v1/accounts/invite-profit
199+
let _params: { [key: string]: any } = {
200+
appid: useGlobalStore.getState().currentApp?.appid || "",
201+
...params,
202+
};
203+
return request(`/v1/accounts/invite-profit`, {
204+
method: "GET",
205+
params: params,
206+
});
207+
}

0 commit comments

Comments
 (0)