手续费: - 新增 fee_type 字段(rate/fixed),百分比与固定金额二选一,不再叠加 - calculateServiceFee 按 fee_type 分支计算 - 商户创建/更新校验 fee_type,订单落库快照 fee_type - 前端表单改为下拉选择手续费类型,动态显示对应输入框 - 测试拆为 TestFeeRate + TestFeeFixed 清理旧链路: - 删除旧 Skin/Order/ShipLog 模型及 OrderService/SkinService - Dashboard 迁移到 FulfillmentService - 上游 /api/open/v1 改为基于 FulfillmentOrder 实现,接口契约不变 - 推送留痕改用 AuditLog,不再建 ShipLog 表 - 删除前端 Skins/Orders/ShipLogs/Distributors 页面及路由、菜单、API、类型 - 新增迁移 003: 添加 fee_type 列并 DROP 旧表
72 lines
2.5 KiB
TypeScript
72 lines
2.5 KiB
TypeScript
import { useState } from 'react'
|
|
import { useNavigate, Link } from 'react-router-dom'
|
|
import { Card, Form, Input, Button, Typography, message, Space } from 'antd'
|
|
import { UserOutlined, LockOutlined } from '@ant-design/icons'
|
|
import { authApi } from '../api'
|
|
|
|
export default function Register() {
|
|
const navigate = useNavigate()
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
const onFinish = async (values: {
|
|
username: string
|
|
password: string
|
|
nickname?: string
|
|
}) => {
|
|
setLoading(true)
|
|
try {
|
|
await authApi.register(values)
|
|
message.success('注册成功,请登录')
|
|
navigate('/login')
|
|
} catch (e) {
|
|
message.error(e instanceof Error ? e.message : '注册失败')
|
|
} finally {
|
|
setLoading(false)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div
|
|
style={{
|
|
minHeight: '100vh',
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
background: 'linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%)',
|
|
}}
|
|
>
|
|
<Card style={{ width: 400, boxShadow: '0 8px 32px rgba(0,0,0,0.3)' }}>
|
|
<Space direction="vertical" size="middle" style={{ width: '100%' }}>
|
|
<div style={{ textAlign: 'center' }}>
|
|
<Typography.Title level={3} style={{ marginBottom: 4 }}>
|
|
注册商户账号
|
|
</Typography.Title>
|
|
<Typography.Text type="secondary">创建商户员工账号</Typography.Text>
|
|
</div>
|
|
<Form layout="vertical" onFinish={onFinish}>
|
|
<Form.Item name="username" rules={[{ required: true, min: 3, message: '用户名至少3位' }]}>
|
|
<Input prefix={<UserOutlined />} placeholder="用户名" size="large" />
|
|
</Form.Item>
|
|
<Form.Item name="nickname">
|
|
<Input prefix={<UserOutlined />} placeholder="昵称(可选)" size="large" />
|
|
</Form.Item>
|
|
<Form.Item name="password" rules={[{ required: true, min: 6, message: '密码至少6位' }]}>
|
|
<Input.Password prefix={<LockOutlined />} placeholder="密码" size="large" />
|
|
</Form.Item>
|
|
<Form.Item>
|
|
<Button type="primary" htmlType="submit" loading={loading} block size="large">
|
|
注册
|
|
</Button>
|
|
</Form.Item>
|
|
</Form>
|
|
<div style={{ textAlign: 'center' }}>
|
|
<Typography.Text type="secondary">
|
|
已有账号? <Link to="/login">去登录</Link>
|
|
</Typography.Text>
|
|
</div>
|
|
</Space>
|
|
</Card>
|
|
</div>
|
|
)
|
|
}
|