style(web): translate the comments in the src/views directory into English

This commit is contained in:
zhaoying
2026-02-03 18:38:04 +08:00
parent a191e32f71
commit 9e195ea63b
155 changed files with 4169 additions and 586 deletions

View File

@@ -1,3 +1,14 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:35:49
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:35:49
*/
/**
* Order Detail Component
* Modal displaying detailed order information including payment details
*/
import { forwardRef, useImperativeHandle, useState, useCallback } from 'react';
import { Descriptions } from 'antd';
import { useTranslation } from 'react-i18next';
@@ -14,11 +25,12 @@ const OrderDetail = forwardRef<OrderDetailRef, { getProductType: (type: string)
const [visible, setVisible] = useState(false);
const [data, setData] = useState({})
// 封装取消方法,添加关闭弹窗逻辑
/** Close modal */
const handleClose = () => {
setVisible(false);
};
/** Open modal and fetch order details */
const handleOpen = (order: Order) => {
setVisible(true);
getOrderDetail(order.order_no)
@@ -26,6 +38,7 @@ const OrderDetail = forwardRef<OrderDetailRef, { getProductType: (type: string)
setData(res as Order)
})
};
/** Format order information items */
const formatItems = useCallback(() => {
if (!data) return []
return ['order_no', 'product_type', 'payable_amount', 'status', 'pay_time', 'create_time'].map(key => {
@@ -43,6 +56,7 @@ const OrderDetail = forwardRef<OrderDetailRef, { getProductType: (type: string)
}
})
}, [data])
/** Format payment information items */
const formatPayItems = useCallback(() => {
if (!data) return []
return ['pay_txn_id', 'payer'].map(key => ({
@@ -52,13 +66,12 @@ const OrderDetail = forwardRef<OrderDetailRef, { getProductType: (type: string)
}))
}, [data])
// 暴露给父组件的方法
/** Expose methods to parent component */
useImperativeHandle(ref, () => ({
handleOpen,
handleClose
}));
// ['pay_txn_id', 'payer']
// ['pay_txn_id', 'payer']
return (
<RbModal
title={t('pricing.orderDetail')}

View File

@@ -1,3 +1,15 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:35:41
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:35:41
*/
/**
* Order History Page
* Displays order list with filtering by status, product type, and time range
* Supports order detail viewing
*/
import React, { useRef, useState, useEffect } from 'react';
import { Button, Space, Select, Flex } from 'antd';
import { useTranslation } from 'react-i18next';
@@ -12,9 +24,9 @@ import { formatDateTime } from '@/utils/format';
import type { Order, OrderDetailRef, Query } from './types'
import OrderDetail from './components/OrderDetail'
import SearchInput from '@/components/SearchInput'
import { PRICE_LIST } from '@/views/Pricing'
/** Order status mapping */
export const STATUS = {
100: {
status: 'warning',
@@ -64,6 +76,7 @@ const OrderHistory: React.FC = () => {
useEffect(() => {
getStatus()
}, [])
/** Fetch order status options */
const getStatus = () => {
getOrderStatus()
.then(res => {
@@ -80,6 +93,7 @@ const OrderHistory: React.FC = () => {
])
})
}
/** Handle status filter change */
const handleChangeStatus = (value: string) => {
if (value !== query.status) {
setQuery(prev => ({
@@ -88,6 +102,7 @@ const OrderHistory: React.FC = () => {
}))
}
}
/** Handle product type filter change */
const handleChangeType = (value: string) => {
if (value !== query.product_type) {
setQuery(prev => ({
@@ -96,6 +111,7 @@ const OrderHistory: React.FC = () => {
}))
}
}
/** Handle time range filter change */
const handleChangeTime = (value: string) => {
setTimeType(value)
let start_time = null;
@@ -129,6 +145,7 @@ const OrderHistory: React.FC = () => {
}))
}
/** Map product type to translation key */
const getProductType = (type: string) => {
const typeMap: Record<string, string> = {
'FREE': 'personal',
@@ -138,7 +155,7 @@ const OrderHistory: React.FC = () => {
};
return typeMap[type] || 'ENTERPRISE';
};
// 表格列配置
/** Table column configuration */
const columns: ColumnsType = [
{
title: t('pricing.order_no'),

View File

@@ -1,3 +1,12 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:35:32
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:35:32
*/
/**
* Order query parameters
*/
export interface Query {
product_type?: string | null;
status?: string | null;
@@ -8,6 +17,9 @@ export interface Query {
end_time?: number | null;
[key: string]: string | number | null | undefined;
}
/**
* Order data structure
*/
export interface Order {
order_no: string;
user_id: string;
@@ -38,6 +50,9 @@ export interface Order {
deleted: number;
}
/**
* Order detail component ref interface
*/
export interface OrderDetailRef {
handleOpen: (order: Order) => void;
}