Skip to content

Let's use AI to Earn!

收入相关

bulaienaofutuojiesenzhang7e897540efdb
diff --git a/src/app/[lng]/income/income.module.css b/src/app/[lng]/income/income.module.css
new file mode 100644
index 00000000..bb619070
--- /dev/null
+++ b/src/app/[lng]/income/income.module.css
@@ -0,0 +1,451 @@
+.container {
+ padding: 24px;
+ min-height: 100vh;
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
+}
+
+/* 页面头部样式 */
+.header {
+ margin-bottom: 24px;
+}
+
+.headerContent {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border-radius: 16px;
+ padding: 24px;
+ color: white;
+ box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
+ position: relative;
+ overflow: hidden;
+}
+
+.headerContent::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
+ animation: shimmer 3s ease-in-out infinite;
+}
+
+@keyframes shimmer {
+ 0%, 100% { transform: translateX(-100%); }
+ 50% { transform: translateX(100%); }
+}
+
+.headerLeft {
+ display: flex;
+ align-items: center;
+ gap: 16px;
+ position: relative;
+ z-index: 1;
+}
+
+.headerIcon {
+ width: 64px;
+ height: 64px;
+ background: rgba(255, 255, 255, 0.2);
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 28px;
+ backdrop-filter: blur(10px);
+ border: 2px solid rgba(255, 255, 255, 0.3);
+}
+
+.headerText {
+ flex: 1;
+}
+
+.headerTitle {
+ font-size: 28px;
+ font-weight: 700;
+ margin: 0 0 8px 0;
+ background: linear-gradient(135deg, #ffffff, #f0f0f0);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+}
+
+.headerSubtitle {
+ font-size: 16px;
+ margin: 0;
+ color: rgba(255, 255, 255, 0.9);
+ font-weight: 400;
+}
+
+.headerRight {
+ position: relative;
+ z-index: 1;
+}
+
+.balanceCard {
+ background: rgba(255, 255, 255, 0.15);
+ border-radius: 12px;
+ padding: 20px;
+ backdrop-filter: blur(10px);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ min-width: 200px;
+}
+
+.balanceIcon {
+ width: 48px;
+ height: 48px;
+ background: rgba(255, 255, 255, 0.2);
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 20px;
+ color: #fff;
+}
+
+.balanceInfo {
+ flex: 1;
+}
+
+.balanceLabel {
+ font-size: 14px;
+ color: rgba(255, 255, 255, 0.8);
+ margin-bottom: 4px;
+}
+
+.balanceAmount {
+ font-size: 24px;
+ font-weight: 700;
+ color: #fff;
+ text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
+}
+
+/* 主要内容样式 */
+.content {
+ background: rgba(255, 255, 255, 0.95);
+ border-radius: 16px;
+ padding: 24px;
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
+ backdrop-filter: blur(10px);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+}
+
+/* 标签页样式 */
+.content .ant-tabs > .ant-tabs-nav {
+ margin-bottom: 24px;
+ background: rgba(255, 255, 255, 0.5);
+ border-radius: 12px;
+ padding: 4px;
+ backdrop-filter: blur(10px);
+}
+
+.content .ant-tabs > .ant-tabs-nav .ant-tabs-tab {
+ padding: 12px 24px;
+ font-size: 16px;
+ font-weight: 600;
+ border-radius: 8px;
+ transition: all 0.3s ease;
+ margin: 0 4px;
+}
+
+.content .ant-tabs > .ant-tabs-nav .ant-tabs-tab-active {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ color: white;
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
+}
+
+.content .ant-tabs > .ant-tabs-nav .ant-tabs-tab:hover {
+ background: rgba(102, 126, 234, 0.1);
+ color: #667eea;
+}
+
+.content .ant-tabs > .ant-tabs-nav .ant-tabs-tab-active:hover {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ color: white;
+}
+
+/* 卡片样式 */
+.content .ant-card {
+ border-radius: 12px;
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
+ border: 1px solid rgba(0, 0, 0, 0.06);
+ overflow: hidden;
+}
+
+.content .ant-card-head {
+ background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
+ border-bottom: 1px solid rgba(0, 0, 0, 0.06);
+}
+
+.content .ant-card-head-title {
+ font-size: 18px;
+ font-weight: 600;
+ color: #495057;
+}
+
+/* 表格样式 */
+.content .ant-table-thead > tr > th {
+ background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
+ color: #495057;
+ font-weight: 600;
+ font-size: 14px;
+ padding: 16px 12px;
+ border-bottom: 2px solid #dee2e6;
+}
+
+.content .ant-table-tbody > tr:hover > td {
+ background-color: rgba(102, 126, 234, 0.05);
+}
+
+.content .ant-table-tbody > tr > td {
+ padding: 12px;
+ font-size: 14px;
+ border-bottom: 1px solid #f0f0f0;
+}
+
+.content .ant-table-tbody > tr:last-child > td {
+ border-bottom: none;
+}
+
+/* 按钮样式 */
+.content .ant-btn {
+ border-radius: 8px;
+ font-weight: 500;
+ transition: all 0.3s ease;
+ border: none;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+}
+
+.content .ant-btn-primary {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ color: white;
+}
+
+.content .ant-btn-primary:hover {
+ background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
+ transform: translateY(-2px);
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
+}
+
+.content .ant-btn-primary:disabled {
+ background: #d9d9d9;
+ color: rgba(0, 0, 0, 0.25);
+ transform: none;
+ box-shadow: none;
+}
+
+.content .ant-btn-default {
+ background: white;
+ color: #495057;
+ border: 1px solid #d9d9d9;
+}
+
+.content .ant-btn-default:hover {
+ background: #f8f9fa;
+ border-color: #667eea;
+ color: #667eea;
+ transform: translateY(-1px);
+}
+
+/* 标签样式 */
+.content .ant-tag {
+ border-radius: 6px;
+ font-size: 12px;
+ padding: 4px 8px;
+ font-weight: 500;
+ border: none;
+}
+
+/* 分页样式 */
+.content .ant-pagination {
+ margin-top: 24px;
+ text-align: center;
+}
+
+.content .ant-pagination .ant-pagination-item {
+ border-radius: 8px;
+ border: 1px solid #d9d9d9;
+}
+
+.content .ant-pagination .ant-pagination-item-active {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border-color: #667eea;
+}
+
+.content .ant-pagination .ant-pagination-item-active a {
+ color: white;
+}
+
+.content .ant-pagination .ant-pagination-prev,
+.content .ant-pagination .ant-pagination-next {
+ border-radius: 8px;
+ border: 1px solid #d9d9d9;
+}
+
+/* 提现弹窗样式 */
+.withdrawModalContent {
+ padding: 20px 0;
+}
+
+.withdrawInfo {
+ background: #f8f9fa;
+ border-radius: 12px;
+ padding: 20px;
+ margin-bottom: 20px;
+ border: 1px solid #e9ecef;
+}
+
+.withdrawItem {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 12px;
+ padding: 8px 0;
+ border-bottom: 1px solid #e9ecef;
+}
+
+.withdrawItem:last-child {
+ margin-bottom: 0;
+ border-bottom: none;
+}
+
+.withdrawLabel {
+ font-weight: 600;
+ color: #495057;
+ font-size: 14px;
+}
+
+.withdrawValue {
+ color: #6c757d;
+ font-size: 14px;
+ word-break: break-all;
+ max-width: 200px;
+ text-align: right;
+}
+
+.withdrawAmount {
+ color: #28a745;
+ font-weight: 700;
+ font-size: 16px;
+}
+
+.withdrawWarning {
+ background: #fff3cd;
+ border: 1px solid #ffeaa7;
+ border-radius: 8px;
+ padding: 16px;
+ color: #856404;
+}
+
+.withdrawWarning p {
+ margin: 0 0 8px 0;
+ font-size: 14px;
+ line-height: 1.5;
+}
+
+.withdrawWarning p:last-child {
+ margin-bottom: 0;
+}
+
+/* 移动端适配 */
+@media (max-width: 768px) {
+ .container {
+ padding: 12px;
+ }
+
+ .headerContent {
+ flex-direction: column;
+ gap: 20px;
+ padding: 20px;
+ text-align: center;
+ }
+
+ .headerLeft {
+ flex-direction: column;
+ gap: 12px;
+ }
+
+ .headerIcon {
+ width: 48px;
+ height: 48px;
+ font-size: 20px;
+ }
+
+ .headerTitle {
+ font-size: 24px;
+ }
+
+ .headerSubtitle {
+ font-size: 14px;
+ }
+
+ .balanceCard {
+ min-width: auto;
+ width: 100%;
+ justify-content: center;
+ }
+
+ .balanceAmount {
+ font-size: 20px;
+ }
+
+ .content {
+ padding: 16px;
+ }
+
+ .content .ant-tabs > .ant-tabs-nav .ant-tabs-tab {
+ padding: 8px 16px;
+ font-size: 14px;
+ }
+
+ .content .ant-table-thead > tr > th,
+ .content .ant-table-tbody > tr > td {
+ padding: 8px 6px;
+ font-size: 12px;
+ }
+
+ .content .ant-btn {
+ font-size: 12px;
+ padding: 4px 8px;
+ }
+
+ .withdrawItem {
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 4px;
+ }
+
+ .withdrawValue {
+ max-width: none;
+ text-align: left;
+ }
+}
+
+@media (max-width: 480px) {
+ .headerContent {
+ padding: 16px;
+ }
+
+ .headerTitle {
+ font-size: 20px;
+ }
+
+ .balanceCard {
+ padding: 16px;
+ }
+
+ .content {
+ padding: 12px;
+ }
+
+ .content .ant-tabs > .ant-tabs-nav .ant-tabs-tab {
+ padding: 6px 12px;
+ font-size: 12px;
+ }
+}
diff --git a/src/app/[lng]/income/page.tsx b/src/app/[lng]/income/page.tsx
new file mode 100644
index 00000000..073ff598
--- /dev/null
+++ b/src/app/[lng]/income/page.tsx
@@ -0,0 +1,418 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { Card, Table, Button, message, Modal, Tabs, Tag, Space, Popconfirm, Descriptions, Input, Select } from "antd";
+import { DollarOutlined, HistoryOutlined, WalletOutlined, CheckCircleOutlined, ClockCircleOutlined, CloseCircleOutlined } from "@ant-design/icons";
+import { useRouter } from "next/navigation";
+import { useUserStore } from "@/store/user";
+import { apiGetIncomeList, apiSubmitWithdraw } from "@/api/income";
+import { apiGetWithdrawRecordList } from "@/api/withdraw";
+import { IncomeRecord } from "@/api/types/income";
+import { WithdrawRecord, WithdrawRecordStatus } from "@/api/types/withdraw";
+import { useTransClient } from "@/app/i18n/client";
+import styles from "./income.module.css";
+
+const { TabPane } = Tabs;
+const { Option } = Select;
+
+export default function IncomePage() {
+ const router = useRouter();
+ const { userInfo, token } = useUserStore();
+ const { t } = useTransClient('income');
+
+ // 收入记录相关状态
+ const [incomeRecords, setIncomeRecords] = useState<IncomeRecord[]>([]);
+ const [incomeLoading, setIncomeLoading] = useState(false);
+ const [incomePagination, setIncomePagination] = useState({
+ current: 1,
+ pageSize: 10,
+ total: 0
+ });
+
+ // 提现记录相关状态
+ const [withdrawRecords, setWithdrawRecords] = useState<WithdrawRecord[]>([]);
+ const [withdrawLoading, setWithdrawLoading] = useState(false);
+ const [withdrawPagination, setWithdrawPagination] = useState({
+ current: 1,
+ pageSize: 10,
+ total: 0
+ });
+
+ // 提现申请状态
+ const [withdrawModalVisible, setWithdrawModalVisible] = useState(false);
+ const [selectedIncomeRecord, setSelectedIncomeRecord] = useState<IncomeRecord | null>(null);
+ const [withdrawSubmitting, setWithdrawSubmitting] = useState(false);
+
+ // 获取收入记录
+ const fetchIncomeRecords = async (page: number = 1, pageSize: number = 10) => {
+ setIncomeLoading(true);
+ try {
+ const response = await apiGetIncomeList({ pageNo: page, pageSize }, {});
+ if (response?.data) {
+ setIncomeRecords(response.data.list || []);
+ setIncomePagination({
+ current: page,
+ pageSize,
+ total: response.data.total || 0
+ });
+ } else {
+ message.error(t('messages.getIncomeRecordsFailed'));
+ }
+ } catch (error) {
+ message.error(t('messages.getIncomeRecordsFailed'));
+ } finally {
+ setIncomeLoading(false);
+ }
+ };
+
+ // 获取提现记录
+ const fetchWithdrawRecords = async (page: number = 1, pageSize: number = 10) => {
+ setWithdrawLoading(true);
+ try {
+ const response = await apiGetWithdrawRecordList({ pageNo: page, pageSize }, {});
+ if (response?.data) {
+ setWithdrawRecords(response.data.list || []);
+ setWithdrawPagination({
+ current: page,
+ pageSize,
+ total: response.data.total || 0
+ });
+ } else {
+ message.error(t('messages.getWithdrawRecordsFailed'));
+ }
+ } catch (error) {
+ message.error(t('messages.getWithdrawRecordsFailed'));
+ } finally {
+ setWithdrawLoading(false);
+ }
+ };
+
+ // 提交提现申请
+ const handleWithdraw = async (incomeRecord: IncomeRecord) => {
+ setSelectedIncomeRecord(incomeRecord);
+ setWithdrawModalVisible(true);
+ };
+
+ // 确认提现申请
+ const handleConfirmWithdraw = async () => {
+ if (!selectedIncomeRecord) return;
+
+ setWithdrawSubmitting(true);
+ try {
+ const response = await apiSubmitWithdraw(selectedIncomeRecord._id);
+ if (response) {
+ message.success(t('messages.withdrawSubmitted'));
+ setWithdrawModalVisible(false);
+ setSelectedIncomeRecord(null);
+ // 刷新提现记录
+ fetchWithdrawRecords(withdrawPagination.current, withdrawPagination.pageSize);
+ } else {
+ message.error(t('messages.withdrawFailed'));
+ }
+ } catch (error) {
+ message.error(t('messages.withdrawFailed'));
+ } finally {
+ setWithdrawSubmitting(false);
+ }
+ };
+
+ // 获取收入类型显示文本
+ const getIncomeTypeText = (type: string) => {
+ const typeMap: { [key: string]: { color: string; text: string } } = {
+ 'task': { color: 'green', text: t('incomeTypes.task') },
+ 'task_back': { color: 'orange', text: t('incomeTypes.task_back') },
+ 'reward_back': { color: 'blue', text: t('incomeTypes.reward_back') }
+ };
+ const config = typeMap[type] || { color: 'default', text: type };
+ return <Tag color={config.color}>{config.text}</Tag>;
+ };
+
+ // 获取提现状态显示
+ const getWithdrawStatusTag = (status: WithdrawRecordStatus) => {
+ const statusMap = {
+ [WithdrawRecordStatus.WAIT]: { color: 'orange', text: t('withdrawStatus.wait'), icon: <ClockCircleOutlined /> },
+ [WithdrawRecordStatus.SUCCESS]: { color: 'green', text: t('withdrawStatus.success'), icon: <CheckCircleOutlined /> },
+ [WithdrawRecordStatus.FAIL]: { color: 'red', text: t('withdrawStatus.fail'), icon: <CloseCircleOutlined /> }
+ };
+ const config = statusMap[status] || { color: 'default', text: '未知状态', icon: null };
+ return (
+ <Tag color={config.color} icon={config.icon}>
+ {config.text}
+ </Tag>
+ );
+ };
+
+ // 收入记录表格列
+ const incomeColumns = [
+ {
+ title: t('incomeId'),
+ dataIndex: '_id',
+ key: '_id',
+ ellipsis: true,
+ width: 200,
+ },
+ {
+ title: t('amount'),
+ dataIndex: 'amount',
+ key: 'amount',
+ render: (amount: number) => (
+ <span style={{ color: '#52c41a', fontWeight: 'bold' }}>
+ ${amount.toFixed(2)}
+ </span>
+ ),
+ },
+ {
+ title: t('type'),
+ dataIndex: 'type',
+ key: 'type',
+ render: (type: string) => getIncomeTypeText(type),
+ },
+ {
+ title: t('description'),
+ dataIndex: 'desc',
+ key: 'desc',
+ ellipsis: true,
+ },
+ {
+ title: t('createTime'),
+ dataIndex: 'createdAt',
+ key: 'createdAt',
+ render: (date: Date) => new Date(date).toLocaleString(),
+ },
+ {
+ title: t('actions'),
+ key: 'action',
+ render: (_: any, record: IncomeRecord) => (
+ <Space>
+ <Button
+ type="primary"
+ size="small"
+ onClick={() => handleWithdraw(record)}
+ disabled={record.type !== 'task'} // 只有任务收入可以提现
+ >
+ {t('applyWithdraw')}
+ </Button>
+ </Space>
+ ),
+ },
+ ];
+
+ // 提现记录表格列
+ const withdrawColumns = [
+ {
+ title: t('withdrawId'),
+ dataIndex: '_id',
+ key: '_id',
+ ellipsis: true,
+ width: 200,
+ },
+ {
+ title: t('amount'),
+ dataIndex: 'amount',
+ key: 'amount',
+ render: (amount: number) => (
+ <span style={{ color: '#1890ff', fontWeight: 'bold' }}>
+ ${amount.toFixed(2)}
+ </span>
+ ),
+ },
+ {
+ title: t('status'),
+ dataIndex: 'status',
+ key: 'status',
+ render: (status: WithdrawRecordStatus) => getWithdrawStatusTag(status),
+ },
+ {
+ title: t('description'),
+ dataIndex: 'desc',
+ key: 'desc',
+ ellipsis: true,
+ },
+ {
+ title: t('createTime'),
+ dataIndex: 'createdAt',
+ key: 'createdAt',
+ render: (date: Date) => new Date(date).toLocaleString(),
+ },
+ {
+ title: t('updateTime'),
+ dataIndex: 'updatedAt',
+ key: 'updatedAt',
+ render: (date: Date) => new Date(date).toLocaleString(),
+ },
+ ];
+
+ useEffect(() => {
+ if (!token) {
+ message.error(t('messages.pleaseLoginFirst'));
+ router.push('/login');
+ return;
+ }
+
+ // 初始加载数据
+ fetchIncomeRecords(1, 10);
+ fetchWithdrawRecords(1, 10);
+ }, [token, router]);
+
+ return (
+ <div className={styles.container}>
+ {/* 页面头部 */}
+ <div className={styles.header}>
+ <div className={styles.headerContent}>
+ <div className={styles.headerLeft}>
+ <div className={styles.headerIcon}>
+ <DollarOutlined />
+ </div>
+ <div className={styles.headerText}>
+ <h1 className={styles.headerTitle}>{t('title')}</h1>
+ <p className={styles.headerSubtitle}>{t('subtitle')}</p>
+ </div>
+ </div>
+ <div className={styles.headerRight}>
+ <div className={styles.balanceCard}>
+ <div className={styles.balanceIcon}>
+ <WalletOutlined />
+ </div>
+ <div className={styles.balanceInfo}>
+ <div className={styles.balanceLabel}>{t('currentBalance')}</div>
+ <div className={styles.balanceAmount}>${userInfo?.income || 0}</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ {/* 主要内容 */}
+ <div className={styles.content}>
+ <Tabs defaultActiveKey="income" size="large">
+ <TabPane
+ tab={
+ <span>
+ <DollarOutlined />
+ {t('incomeRecords')}
+ </span>
+ }
+ key="income"
+ >
+ <Card>
+ <Table
+ columns={incomeColumns}
+ dataSource={incomeRecords}
+ loading={incomeLoading}
+ rowKey="_id"
+ pagination={{
+ current: incomePagination.current,
+ pageSize: incomePagination.pageSize,
+ total: incomePagination.total,
+ onChange: (page, size) => {
+ fetchIncomeRecords(page, size || 10);
+ },
+ showSizeChanger: true,
+ showQuickJumper: true,
+ showTotal: (total) => t('messages.totalRecords', { total }),
+ pageSizeOptions: ['10', '20', '50'],
+ }}
+ scroll={{ x: 800 }}
+ locale={{
+ emptyText: incomeLoading ? t('messages.loading') : t('messages.noIncomeRecords')
+ }}
+ />
+ </Card>
+ </TabPane>
+
+ <TabPane
+ tab={
+ <span>
+ <HistoryOutlined />
+ {t('withdrawRecords')}
+ </span>
+ }
+ key="withdraw"
+ >
+ <Card>
+ <Table
+ columns={withdrawColumns}
+ dataSource={withdrawRecords}
+ loading={withdrawLoading}
+ rowKey="_id"
+ pagination={{
+ current: withdrawPagination.current,
+ pageSize: withdrawPagination.pageSize,
+ total: withdrawPagination.total,
+ onChange: (page, size) => {
+ fetchWithdrawRecords(page, size || 10);
+ },
+ showSizeChanger: true,
+ showQuickJumper: true,
+ showTotal: (total) => t('messages.totalRecords', { total }),
+ pageSizeOptions: ['10', '20', '50'],
+ }}
+ scroll={{ x: 800 }}
+ locale={{
+ emptyText: withdrawLoading ? t('messages.loading') : t('messages.noWithdrawRecords')
+ }}
+ />
+ </Card>
+ </TabPane>
+ </Tabs>
+ </div>
+
+ {/* 提现确认弹窗 */}
+ <Modal
+ title={t('confirmWithdraw')}
+ open={withdrawModalVisible}
+ onCancel={() => {
+ setWithdrawModalVisible(false);
+ setSelectedIncomeRecord(null);
+ }}
+ footer={[
+ <Button key="cancel" onClick={() => {
+ setWithdrawModalVisible(false);
+ setSelectedIncomeRecord(null);
+ }}>
+ {t('cancel')}
+ </Button>,
+ <Button
+ key="confirm"
+ type="primary"
+ loading={withdrawSubmitting}
+ onClick={handleConfirmWithdraw}
+ >
+ {t('confirm')}
+ </Button>
+ ]}
+ width={500}
+ centered
+ >
+ {selectedIncomeRecord && (
+ <div className={styles.withdrawModalContent}>
+ <div className={styles.withdrawInfo}>
+ <div className={styles.withdrawItem}>
+ <span className={styles.withdrawLabel}>{t('incomeId')}:</span>
+ <span className={styles.withdrawValue}>{selectedIncomeRecord._id}</span>
+ </div>
+ <div className={styles.withdrawItem}>
+ <span className={styles.withdrawLabel}>{t('withdrawAmount')}:</span>
+ <span className={styles.withdrawAmount}>${selectedIncomeRecord.amount.toFixed(2)}</span>
+ </div>
+ <div className={styles.withdrawItem}>
+ <span className={styles.withdrawLabel}>{t('incomeType')}:</span>
+ <span>{getIncomeTypeText(selectedIncomeRecord.type)}</span>
+ </div>
+ {selectedIncomeRecord.desc && (
+ <div className={styles.withdrawItem}>
+ <span className={styles.withdrawLabel}>{t('description')}:</span>
+ <span className={styles.withdrawValue}>{selectedIncomeRecord.desc}</span>
+ </div>
+ )}
+ </div>
+ <div className={styles.withdrawWarning}>
+ <p>{t('withdrawWarning')}</p>
+ <p>{t('withdrawWarning2')}</p>
+ </div>
+ </div>
+ )}
+ </Modal>
+ </div>
+ );
+}
diff --git a/src/app/[lng]/profile/page.tsx b/src/app/[lng]/profile/page.tsx
index 560575a9..0fec6e4f 100644
--- a/src/app/[lng]/profile/page.tsx
+++ b/src/app/[lng]/profile/page.tsx
@@ -778,7 +778,34 @@ export default function ProfilePage() {
</div>
</div>
-
+ {/* 余额显示卡片 */}
+ <div className={styles.incomeCard}>
+ <div className={styles.incomeContent}>
+ <div className={styles.incomeHeader}>
+ <div className={styles.incomeTitleSection}>
+ <span className={styles.incomeIcon}>
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
+ </svg>
+ </span>
+ <span className={styles.incomeTitle}>我的余额</span>
+ </div>
+ <span className={styles.incomeCount}>${userInfo?.income || 0}</span>
+ </div>
+ <p className={styles.incomeDescription}>
+ 通过完成任务获得的收入余额
+ </p>
+
+ <div className={styles.incomeActions}>
+ <button
+ className={styles.incomeButton}
+ onClick={() => router.push('/income')}
+ >
+ 查看详情
+ </button>
+ </div>
+ </div>
+ </div>
<Card
title={t('personalInfo')}
diff --git a/src/app/[lng]/profile/profile.module.css b/src/app/[lng]/profile/profile.module.css
index d6056151..2be8b8af 100644
--- a/src/app/[lng]/profile/profile.module.css
+++ b/src/app/[lng]/profile/profile.module.css
@@ -892,4 +892,134 @@
background: linear-gradient(135deg, #73d13d 0%, #95de64 100%);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(82, 196, 26, 0.4);
- }
\ No newline at end of file
+ }
+
+/* 余额卡片样式 */
+.incomeCard {
+ background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
+ border-radius: 12px;
+ padding: 20px;
+ margin-bottom: 20px;
+ color: #fff;
+ box-shadow: 0 4px 16px rgba(30, 58, 138, 0.2);
+ position: relative;
+ overflow: hidden;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+}
+
+.incomeCard::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
+ animation: shimmer 3s ease-in-out infinite;
+}
+
+.incomeContent {
+ position: relative;
+ z-index: 1;
+}
+
+.incomeHeader {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 12px;
+}
+
+.incomeTitleSection {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+
+.incomeIcon {
+ font-size: 20px;
+ color: #60a5fa;
+ background: rgba(96, 165, 250, 0.1);
+ border-radius: 50%;
+ width: 32px;
+ height: 32px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.incomeTitle {
+ font-size: 18px;
+ font-weight: 600;
+ color: #60a5fa;
+}
+
+.incomeCount {
+ font-size: 28px;
+ font-weight: bold;
+ color: #60a5fa;
+ text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
+ background: linear-gradient(135deg, #60a5fa, #93c5fd);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+}
+
+.incomeDescription {
+ font-size: 13px;
+ color: rgba(255, 255, 255, 0.8);
+ margin-bottom: 18px;
+ line-height: 1.4;
+}
+
+.incomeActions {
+ display: flex;
+ justify-content: center;
+}
+
+.incomeButton {
+ background: linear-gradient(135deg, #60a5fa 0%, #93c5fd 100%);
+ border: 2px solid rgba(96, 165, 250, 0.3);
+ color: #1e3a8a;
+ padding: 12px 24px;
+ border-radius: 8px;
+ font-size: 14px;
+ font-weight: 600;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ position: relative;
+ overflow: hidden;
+ box-shadow: 0 2px 8px rgba(96, 165, 250, 0.3);
+}
+
+.incomeButton::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: -100%;
+ width: 100%;
+ height: 100%;
+ background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
+ transition: left 0.6s ease;
+}
+
+.incomeButton:hover::before {
+ left: 100%;
+}
+
+.incomeButton:hover {
+ background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%);
+ transform: translateY(-2px);
+ box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
+ border-color: rgba(96, 165, 250, 0.6);
+}
+
+.incomeButton:active {
+ transform: translateY(-1px);
+ box-shadow: 0 2px 6px rgba(96, 165, 250, 0.3);
+}
+
+.incomeButton:focus {
+ outline: none;
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3), 0 2px 8px rgba(96, 165, 250, 0.3);
+}
\ No newline at end of file
diff --git a/src/app/i18n/locales/en/income.json b/src/app/i18n/locales/en/income.json
new file mode 100644
index 00000000..461a8cdf
--- /dev/null
+++ b/src/app/i18n/locales/en/income.json
@@ -0,0 +1,45 @@
+{
+ "title": "My Income",
+ "subtitle": "Manage your income records and withdrawal applications",
+ "currentBalance": "Current Balance",
+ "incomeRecords": "Income Records",
+ "withdrawRecords": "Withdrawal Records",
+ "incomeId": "Income ID",
+ "amount": "Amount",
+ "type": "Type",
+ "description": "Description",
+ "createTime": "Create Time",
+ "actions": "Actions",
+ "applyWithdraw": "Apply Withdrawal",
+ "withdrawId": "Withdrawal ID",
+ "status": "Status",
+ "updateTime": "Update Time",
+ "confirmWithdraw": "Confirm Withdrawal Application",
+ "cancel": "Cancel",
+ "confirm": "Confirm Withdrawal",
+ "withdrawAmount": "Withdrawal Amount",
+ "incomeType": "Income Type",
+ "withdrawWarning": "⚠️ After submitting your withdrawal application, we will process your request within 1-3 business days.",
+ "withdrawWarning2": "Please ensure your account information is correct. After successful withdrawal, the amount will be transferred to your designated account.",
+ "incomeTypes": {
+ "task": "Task Income",
+ "task_back": "Task Refund",
+ "reward_back": "Reward Refund"
+ },
+ "withdrawStatus": {
+ "wait": "Waiting",
+ "success": "Withdrawal Successful",
+ "fail": "Withdrawal Failed"
+ },
+ "messages": {
+ "getIncomeRecordsFailed": "Failed to get income records",
+ "getWithdrawRecordsFailed": "Failed to get withdrawal records",
+ "withdrawSubmitted": "Withdrawal application submitted successfully",
+ "withdrawFailed": "Failed to submit withdrawal application",
+ "pleaseLoginFirst": "Please login first",
+ "noIncomeRecords": "No income records",
+ "noWithdrawRecords": "No withdrawal records",
+ "loading": "Loading...",
+ "totalRecords": "Total {{total}} records"
+ }
+}
diff --git a/src/app/i18n/locales/zh-CN/income.json b/src/app/i18n/locales/zh-CN/income.json
new file mode 100644
index 00000000..2b5990a5
--- /dev/null
+++ b/src/app/i18n/locales/zh-CN/income.json
@@ -0,0 +1,45 @@
+{
+ "title": "我的收入",
+ "subtitle": "管理您的收入记录和提现申请",
+ "currentBalance": "当前余额",
+ "incomeRecords": "收入记录",
+ "withdrawRecords": "提现记录",
+ "incomeId": "收入ID",
+ "amount": "金额",
+ "type": "类型",
+ "description": "描述",
+ "createTime": "创建时间",
+ "actions": "操作",
+ "applyWithdraw": "申请提现",
+ "withdrawId": "提现ID",
+ "status": "状态",
+ "updateTime": "更新时间",
+ "confirmWithdraw": "确认提现申请",
+ "cancel": "取消",
+ "confirm": "确认提现",
+ "withdrawAmount": "提现金额",
+ "incomeType": "收入类型",
+ "withdrawWarning": "⚠️ 提现申请提交后,我们将在1-3个工作日内处理您的申请。",
+ "withdrawWarning2": "请确保您的账户信息正确,提现成功后金额将转入您的指定账户。",
+ "incomeTypes": {
+ "task": "任务收入",
+ "task_back": "任务回退",
+ "reward_back": "奖励回退"
+ },
+ "withdrawStatus": {
+ "wait": "等待处理",
+ "success": "提现成功",
+ "fail": "提现失败"
+ },
+ "messages": {
+ "getIncomeRecordsFailed": "获取收入记录失败",
+ "getWithdrawRecordsFailed": "获取提现记录失败",
+ "withdrawSubmitted": "提现申请提交成功",
+ "withdrawFailed": "提现申请提交失败",
+ "pleaseLoginFirst": "请先登录",
+ "noIncomeRecords": "暂无收入记录",
+ "noWithdrawRecords": "暂无提现记录",
+ "loading": "加载中...",
+ "totalRecords": "共 {{total}} 条记录"
+ }
+}
diff --git a/src/store/user.ts b/src/store/user.ts
index fd6fbbaa..fd60240e 100644
--- a/src/store/user.ts
+++ b/src/store/user.ts
@@ -14,6 +14,7 @@ export interface UserInfo {
avatar?: string;
isVip?: boolean;
score?: number;
+ income?: number; // 余额字段
popularizeCode?: string;
vipInfo?: {
id: string;