fix(1895): pages/points/Transactions.tsx - TS/Lint fixes (ThunderboltOutlined/actions/typed/no-unused)
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Has been cancelled
CI/CD Pipeline / Check if frontend-only change (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / PR Build API Image (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Web Image (pull_request) Has been cancelled
AI Code Review / AI Code Review (pull_request) Has been cancelled
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been cancelled
PR Automation / Auto Approve on CI Green (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been cancelled
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
Preview Deploy / Deploy Preview Environment (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled

This commit is contained in:
2026-09-15 09:34:43 +08:00
parent 16699b4bdf
commit 4b994e80aa
+13 -17
View File
@@ -1,7 +1,6 @@
/**
* 积分明细页(/app/points/transactions)
* 分页展示积分流水,支持按类型/来源/日期/关键字筛选
* 日期筛选使用原生 Date,不引入额外依赖
* 分页展示积分流水,支持按类型/来源筛选
*/
import React, { useEffect, useState, useCallback } from "react"
import {
@@ -19,8 +18,8 @@ import {
} from "antd"
import { SearchOutlined, ReloadOutlined } from "@ant-design/icons"
import type { ColumnsType } from "antd/es/table"
import type { Dayjs } from "dayjs"
import { useNavigate } from "react-router-dom"
import dayjs from "dayjs"
import PageHead from "@/components/layout/PageHead"
import { getPointsTransactions } from "@/api/points"
import type { PointsTransaction, PointsTxType } from "@/api/points/types"
@@ -29,12 +28,6 @@ import "./Points.css"
const { Text } = Typography
const { RangePicker } = DatePicker
function formatDateTime(iso: string): string {
const d = new Date(iso)
const pad = (n: number) => String(n).padStart(2, "0")
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`
}
const TYPE_LABEL: Record<PointsTxType, { text: string; color: string }> = {
earn: { text: "获得", color: "green" },
spend: { text: "消耗", color: "red" },
@@ -67,13 +60,13 @@ const PointsTransactions: React.FC = () => {
const [pageSize, setPageSize] = useState(20)
const [type, setType] = useState<PointsTxType | "all">("all")
const [source, setSource] = useState<string>("all")
const [dateRange, setDateRange] = useState<[Dayjs | null, Dayjs | null] | null>(null)
const [dateRange, setDateRange] = useState<[dayjs.Dayjs | null, dayjs.Dayjs | null] | null>(null)
const [keyword, setKeyword] = useState("")
const load = useCallback(async () => {
setLoading(true)
try {
const params: Record<string, unknown> = { page, page_size: pageSize }
const params: Record<string, string | number> = { page, page_size: pageSize }
if (type !== "all") params.type = type
if (source !== "all") params.source = source
if (dateRange && dateRange[0] && dateRange[1]) {
@@ -106,7 +99,7 @@ const PointsTransactions: React.FC = () => {
title: "时间",
dataIndex: "created_at",
width: 180,
render: (v: string) => formatDateTime(v),
render: (v: string) => dayjs(v).format("YYYY-MM-DD HH:mm"),
},
{
title: "类型",
@@ -120,9 +113,11 @@ const PointsTransactions: React.FC = () => {
{
title: "来源/场景",
dataIndex: "source",
width: 160,
width: 150,
render: (s: string, r: PointsTransaction) => (
<Text>{r.source_name || SOURCE_LABEL[s] || s}</Text>
<Space>
<Text>{r.source_name || SOURCE_LABEL[s] || s}</Text>
</Space>
),
},
{
@@ -164,7 +159,8 @@ const PointsTransactions: React.FC = () => {
<PageHead
title="积分明细"
description="查看积分收入、消耗与退还记录"
extra={
actions={
<Space>
<Button icon={<ReloadOutlined />} onClick={load}>
刷新
@@ -199,7 +195,7 @@ const PointsTransactions: React.FC = () => {
setSource(v)
setPage(1)
}}
style={{ width: 170 }}
style={{ width: 160 }}
showSearch
options={[
{ value: "all", label: "全部来源" },
@@ -209,7 +205,7 @@ const PointsTransactions: React.FC = () => {
<RangePicker
value={dateRange ?? undefined}
onChange={(dates) => {
setDateRange(dates as [Dayjs | null, Dayjs | null] | null)
setDateRange(dates as [dayjs.Dayjs | null, dayjs.Dayjs | null] | null)
setPage(1)
}}
/>