feat: 迭代

This commit is contained in:
2026-05-14 09:55:25 +08:00
parent 6eed65baf2
commit c647f3c8cd
27 changed files with 2242 additions and 105 deletions
+2
View File
@@ -11,6 +11,8 @@
}, },
"dependencies": { "dependencies": {
"@ant-design/icons": "^5.5.0", "@ant-design/icons": "^5.5.0",
"@rent/shared-types": "workspace:*",
"@rent/shared-utils": "workspace:*",
"antd": "^5.22.0", "antd": "^5.22.0",
"axios": "^1.7.0", "axios": "^1.7.0",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Card, Row, Col, Statistic } from 'antd'; import { Card, Row, Col, Statistic } from 'antd';
import { formatMoney } from '@rent/shared-utils/format'; import { formatMoney } from '@rent/shared-utils';
import type { Account } from '@rent/shared-types/finance'; import type { Account } from '@rent/shared-types';
interface AccountCardProps { interface AccountCardProps {
account: Account; account: Account;
@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Tag } from 'antd'; import { Tag } from 'antd';
import type { SettlementStatus } from '@rent/shared-types/finance'; import type { SettlementStatus } from '@rent/shared-types';
import { SETTLEMENT_STATUS_MAP } from '@rent/shared-types/finance-constants'; import { SETTLEMENT_STATUS_MAP } from '@rent/shared-types';
interface SettlementStatusTagProps { interface SettlementStatusTagProps {
status: SettlementStatus; status: SettlementStatus;
@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import type { TransactionType } from '@rent/shared-types/finance'; import type { TransactionType } from '@rent/shared-types';
import { TRANSACTION_TYPE_MAP } from '@rent/shared-types/finance-constants'; import { TRANSACTION_TYPE_MAP } from '@rent/shared-types';
import { formatMoney } from '@rent/shared-utils/format'; import { formatMoney } from '@rent/shared-utils';
interface TransactionAmountProps { interface TransactionAmountProps {
type: TransactionType; type: TransactionType;
@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Tag } from 'antd'; import { Tag } from 'antd';
import type { WithdrawalStatus } from '@rent/shared-types/finance'; import type { WithdrawalStatus } from '@rent/shared-types';
import { WITHDRAWAL_STATUS_MAP } from '@rent/shared-types/finance-constants'; import { WITHDRAWAL_STATUS_MAP } from '@rent/shared-types';
interface WithdrawalStatusTagProps { interface WithdrawalStatusTagProps {
status: WithdrawalStatus; status: WithdrawalStatus;
+1 -1
View File
@@ -1,6 +1,6 @@
import { useState, useCallback } from 'react'; import { useState, useCallback } from 'react';
import { message } from 'antd'; import { message } from 'antd';
import type { ApprovalParams } from '@rent/shared-types/finance'; import type { ApprovalParams } from '@rent/shared-types';
interface UseApprovalOptions { interface UseApprovalOptions {
approveFn: (params: ApprovalParams) => Promise<void>; approveFn: (params: ApprovalParams) => Promise<void>;
@@ -1,5 +1,5 @@
import { useState, useEffect, useCallback } from 'react'; import { useState, useEffect, useCallback } from 'react';
import type { PaginatedResponse, FinanceQueryParams } from '@rent/shared-types/finance'; import type { PaginatedResponse, FinanceQueryParams } from '@rent/shared-types';
interface UseTableDataOptions<T> { interface UseTableDataOptions<T> {
fetchFn: (params: FinanceQueryParams) => Promise<PaginatedResponse<T>>; fetchFn: (params: FinanceQueryParams) => Promise<PaginatedResponse<T>>;
@@ -3,8 +3,8 @@ import { Card, Table, Button, Space, Modal, Descriptions, message } from 'antd';
import { EyeOutlined } from '@ant-design/icons'; import { EyeOutlined } from '@ant-design/icons';
import { getMerchantSettlements, getSettlementDetail, getSettlementItems } from '@/api/finance'; import { getMerchantSettlements, getSettlementDetail, getSettlementItems } from '@/api/finance';
import type { ColumnsType } from 'antd/es/table'; import type { ColumnsType } from 'antd/es/table';
import type { Settlement } from '@rent/shared-types/finance'; import type { Settlement } from '@rent/shared-types';
import { formatMoney, formatDateTime } from '@rent/shared-utils/format'; import { formatMoney, formatDateTime } from '@rent/shared-utils';
import { useTableData } from '@/hooks/useTableData'; import { useTableData } from '@/hooks/useTableData';
import { useModal } from '@/hooks/useModal'; import { useModal } from '@/hooks/useModal';
import { SettlementStatusTag } from '@/components/SettlementStatusTag'; import { SettlementStatusTag } from '@/components/SettlementStatusTag';
@@ -3,9 +3,9 @@ import { Card, Table, Form, Select, DatePicker, Button, Space, Modal, Descriptio
import { SearchOutlined, ReloadOutlined } from '@ant-design/icons'; import { SearchOutlined, ReloadOutlined } from '@ant-design/icons';
import { getMerchantTransactions, getTransactionDetail } from '@/api/finance'; import { getMerchantTransactions, getTransactionDetail } from '@/api/finance';
import type { ColumnsType } from 'antd/es/table'; import type { ColumnsType } from 'antd/es/table';
import type { Transaction } from '@rent/shared-types/finance'; import type { Transaction, TransactionType } from '@rent/shared-types';
import { TRANSACTION_TYPE_MAP, TRANSACTION_TYPE_OPTIONS } from '@rent/shared-types/finance-constants'; import { TRANSACTION_TYPE_MAP, TRANSACTION_TYPE_OPTIONS } from '@rent/shared-types';
import { formatMoney, formatDateTime } from '@rent/shared-utils/format'; import { formatMoney, formatDateTime } from '@rent/shared-utils';
import { useTableData } from '@/hooks/useTableData'; import { useTableData } from '@/hooks/useTableData';
import { useModal } from '@/hooks/useModal'; import { useModal } from '@/hooks/useModal';
import { TransactionAmount } from '@/components/TransactionAmount'; import { TransactionAmount } from '@/components/TransactionAmount';
@@ -95,7 +95,7 @@ const Transactions: React.FC = () => {
dataIndex: 'type', dataIndex: 'type',
key: 'type', key: 'type',
width: 120, width: 120,
render: (type: string) => TRANSACTION_TYPE_MAP[type]?.label || type, render: (type: string) => TRANSACTION_TYPE_MAP[type as TransactionType]?.label || type,
}, },
{ {
title: '金额', title: '金额',
@@ -2,9 +2,9 @@ import React, { useEffect, useState } from 'react';
import { Card, Button, Table, message } from 'antd'; import { Card, Button, Table, message } from 'antd';
import { getMerchantAccount, getMerchantTransactions } from '@/api/finance'; import { getMerchantAccount, getMerchantTransactions } from '@/api/finance';
import type { ColumnsType } from 'antd/es/table'; import type { ColumnsType } from 'antd/es/table';
import type { Account, Transaction } from '@rent/shared-types/finance'; import type { Account, Transaction, TransactionType } from '@rent/shared-types';
import { TRANSACTION_TYPE_MAP } from '@rent/shared-types/finance-constants'; import { TRANSACTION_TYPE_MAP } from '@rent/shared-types';
import { formatMoney, formatDateTime } from '@rent/shared-utils/format'; import { formatMoney, formatDateTime } from '@rent/shared-utils';
import { useTableData } from '@/hooks/useTableData'; import { useTableData } from '@/hooks/useTableData';
import { AccountCard } from '@/components/AccountCard'; import { AccountCard } from '@/components/AccountCard';
import { TransactionAmount } from '@/components/TransactionAmount'; import { TransactionAmount } from '@/components/TransactionAmount';
@@ -63,7 +63,7 @@ const Wallet: React.FC = () => {
dataIndex: 'type', dataIndex: 'type',
key: 'type', key: 'type',
width: 120, width: 120,
render: (type: string) => TRANSACTION_TYPE_MAP[type]?.label || type, render: (type: string) => TRANSACTION_TYPE_MAP[type as TransactionType]?.label || type,
}, },
{ {
title: '金额', title: '金额',
@@ -3,8 +3,8 @@ import { Card, Table, Button, Space, Modal, Form, Input, InputNumber, message, D
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { getMerchantWithdrawals, getWithdrawalDetail, applyWithdrawal, cancelWithdrawal } from '@/api/finance'; import { getMerchantWithdrawals, getWithdrawalDetail, applyWithdrawal, cancelWithdrawal } from '@/api/finance';
import type { ColumnsType } from 'antd/es/table'; import type { ColumnsType } from 'antd/es/table';
import type { Withdrawal } from '@rent/shared-types/finance'; import type { Withdrawal } from '@rent/shared-types';
import { formatMoney, formatDateTime } from '@rent/shared-utils/format'; import { formatMoney, formatDateTime } from '@rent/shared-utils';
import { useTableData } from '@/hooks/useTableData'; import { useTableData } from '@/hooks/useTableData';
import { useModal } from '@/hooks/useModal'; import { useModal } from '@/hooks/useModal';
import { WithdrawalStatusTag } from '@/components/WithdrawalStatusTag'; import { WithdrawalStatusTag } from '@/components/WithdrawalStatusTag';
+1
View File
@@ -0,0 +1 @@
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/auth.ts","./src/api/finance.ts","./src/api/order.ts","./src/api/review.ts","./src/api/room-calendar.ts","./src/api/room.ts","./src/api/statistics.ts","./src/components/accountcard.tsx","./src/components/settlementstatustag.tsx","./src/components/transactionamount.tsx","./src/components/withdrawalstatustag.tsx","./src/hooks/useapproval.ts","./src/hooks/usemodal.ts","./src/hooks/usetabledata.ts","./src/layouts/mainlayout.tsx","./src/pages/dashboard.tsx","./src/pages/login.tsx","./src/pages/orderdetail.tsx","./src/pages/orderlist.tsx","./src/pages/reviewlist.tsx","./src/pages/roomcalendar.tsx","./src/pages/roomform.tsx","./src/pages/roomlist.tsx","./src/pages/settings.tsx","./src/pages/finance/settlementdetail.tsx","./src/pages/finance/settlements.tsx","./src/pages/finance/transactions.tsx","./src/pages/finance/wallet.tsx","./src/pages/finance/withdrawals.tsx","./src/store/auth.ts","./src/utils/request.ts"],"version":"5.9.3"}
+2
View File
@@ -11,6 +11,8 @@
}, },
"dependencies": { "dependencies": {
"@ant-design/icons": "^5.5.0", "@ant-design/icons": "^5.5.0",
"@rent/shared-types": "workspace:*",
"@rent/shared-utils": "workspace:*",
"antd": "^5.22.0", "antd": "^5.22.0",
"axios": "^1.7.0", "axios": "^1.7.0",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Tag } from 'antd'; import { Tag } from 'antd';
import type { SettlementStatus } from '@rent/shared-types/finance'; import type { SettlementStatus } from '@rent/shared-types';
import { SETTLEMENT_STATUS_MAP } from '@rent/shared-types/finance-constants'; import { SETTLEMENT_STATUS_MAP } from '@rent/shared-types';
interface SettlementStatusTagProps { interface SettlementStatusTagProps {
status: SettlementStatus; status: SettlementStatus;
@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import type { TransactionType } from '@rent/shared-types/finance'; import type { TransactionType } from '@rent/shared-types';
import { TRANSACTION_TYPE_MAP } from '@rent/shared-types/finance-constants'; import { TRANSACTION_TYPE_MAP } from '@rent/shared-types';
import { formatMoney } from '@rent/shared-utils/format'; import { formatMoney } from '@rent/shared-utils';
interface TransactionAmountProps { interface TransactionAmountProps {
type: TransactionType; type: TransactionType;
@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Tag } from 'antd'; import { Tag } from 'antd';
import type { WithdrawalStatus } from '@rent/shared-types/finance'; import type { WithdrawalStatus } from '@rent/shared-types';
import { WITHDRAWAL_STATUS_MAP } from '@rent/shared-types/finance-constants'; import { WITHDRAWAL_STATUS_MAP } from '@rent/shared-types';
interface WithdrawalStatusTagProps { interface WithdrawalStatusTagProps {
status: WithdrawalStatus; status: WithdrawalStatus;
+1 -1
View File
@@ -1,6 +1,6 @@
import { useState, useCallback } from 'react'; import { useState, useCallback } from 'react';
import { message } from 'antd'; import { message } from 'antd';
import type { ApprovalParams } from '@rent/shared-types/finance'; import type { ApprovalParams } from '@rent/shared-types';
interface UseApprovalOptions { interface UseApprovalOptions {
approveFn: (params: ApprovalParams) => Promise<void>; approveFn: (params: ApprovalParams) => Promise<void>;
@@ -1,5 +1,5 @@
import { useState, useEffect, useCallback } from 'react'; import { useState, useEffect, useCallback } from 'react';
import type { PaginatedResponse, FinanceQueryParams } from '@rent/shared-types/finance'; import type { PaginatedResponse, FinanceQueryParams } from '@rent/shared-types';
interface UseTableDataOptions<T> { interface UseTableDataOptions<T> {
fetchFn: (params: FinanceQueryParams) => Promise<PaginatedResponse<T>>; fetchFn: (params: FinanceQueryParams) => Promise<PaginatedResponse<T>>;
@@ -3,8 +3,8 @@ import { Card, Table, Button, Space, Modal, Form, DatePicker, InputNumber, messa
import { PlusOutlined, EyeOutlined } from '@ant-design/icons'; import { PlusOutlined, EyeOutlined } from '@ant-design/icons';
import { getSettlements, getSettlementDetail, getSettlementItems, generateSettlement } from '@/api/finance'; import { getSettlements, getSettlementDetail, getSettlementItems, generateSettlement } from '@/api/finance';
import type { ColumnsType } from 'antd/es/table'; import type { ColumnsType } from 'antd/es/table';
import type { Settlement } from '@rent/shared-types/finance'; import type { Settlement } from '@rent/shared-types';
import { formatMoney, formatDateTime } from '@rent/shared-utils/format'; import { formatMoney, formatDateTime } from '@rent/shared-utils';
import { useTableData } from '@/hooks/useTableData'; import { useTableData } from '@/hooks/useTableData';
import { useModal } from '@/hooks/useModal'; import { useModal } from '@/hooks/useModal';
import { SettlementStatusTag } from '@/components/SettlementStatusTag'; import { SettlementStatusTag } from '@/components/SettlementStatusTag';
+1
View File
@@ -0,0 +1 @@
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/admin.ts","./src/api/config.ts","./src/api/coupon.ts","./src/api/finance.ts","./src/api/invite.ts","./src/api/order.ts","./src/api/review.ts","./src/api/room.ts","./src/components/settlementstatustag.tsx","./src/components/transactionamount.tsx","./src/components/withdrawalstatustag.tsx","./src/hooks/useapproval.ts","./src/hooks/usemodal.ts","./src/hooks/usetabledata.ts","./src/layouts/mainlayout.tsx","./src/pages/dashboard.tsx","./src/pages/invitemanage.tsx","./src/pages/login.tsx","./src/pages/merchantdetail.tsx","./src/pages/merchantlist.tsx","./src/pages/orderdetail.tsx","./src/pages/orderlist.tsx","./src/pages/orderstatistics.tsx","./src/pages/promotion.tsx","./src/pages/reviewmanage.tsx","./src/pages/roomaudit.tsx","./src/pages/storagesettings.tsx","./src/pages/systemsettings.tsx","./src/pages/userlist.tsx","./src/pages/coupon/couponform.tsx","./src/pages/coupon/couponlist.tsx","./src/pages/finance/accounts.tsx","./src/pages/finance/dashboard.tsx","./src/pages/finance/settlements.tsx","./src/pages/finance/withdrawals.tsx","./src/store/auth.ts","./src/utils/request.ts"],"errors":true,"version":"5.9.3"}
+4
View File
@@ -2,10 +2,14 @@
"name": "@rent/shared-types", "name": "@rent/shared-types",
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"type": "module",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"dev": "tsc --watch" "dev": "tsc --watch"
},
"devDependencies": {
"typescript": "^6.0.3"
} }
} }
+5
View File
@@ -293,3 +293,8 @@ export interface ISellerInfo {
merchantId?: number; merchantId?: number;
merchantStatus?: MerchantStatus; merchantStatus?: MerchantStatus;
} }
// ===================== 导出财务相关模块 =====================
export * from './finance';
export * from './finance-constants';
+3 -2
View File
@@ -1,14 +1,15 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2020", "target": "ES2020",
"module": "commonjs", "module": "ESNext",
"declaration": true, "declaration": true,
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src", "rootDir": "./src",
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true "forceConsistentCasingInFileNames": true,
"moduleResolution": "bundler"
}, },
"include": ["src"], "include": ["src"],
"exclude": ["node_modules", "dist"] "exclude": ["node_modules", "dist"]
+4
View File
@@ -2,10 +2,14 @@
"name": "@rent/shared-utils", "name": "@rent/shared-utils",
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"type": "module",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"dev": "tsc --watch" "dev": "tsc --watch"
},
"devDependencies": {
"typescript": "^6.0.3"
} }
} }
+4
View File
@@ -50,3 +50,7 @@ export function calcOrderAmount(roomPrice: number, nights: number, couponDiscoun
const payAmount = Math.max(0, totalAmount - couponDiscount); const payAmount = Math.max(0, totalAmount - couponDiscount);
return { totalAmount, payAmount }; return { totalAmount, payAmount };
} }
// ===================== 导出格式化工具 =====================
export * from './format';
+3 -2
View File
@@ -1,14 +1,15 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2020", "target": "ES2020",
"module": "commonjs", "module": "ESNext",
"declaration": true, "declaration": true,
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src", "rootDir": "./src",
"strict": true, "strict": true,
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true "forceConsistentCasingInFileNames": true,
"moduleResolution": "bundler"
}, },
"include": ["src"], "include": ["src"],
"exclude": ["node_modules", "dist"] "exclude": ["node_modules", "dist"]
+2179 -67
View File
File diff suppressed because it is too large Load Diff