diff --git a/backend/app/routers/purchase.py b/backend/app/routers/purchase.py index 22c9322..eca800b 100644 --- a/backend/app/routers/purchase.py +++ b/backend/app/routers/purchase.py @@ -16,10 +16,12 @@ router = APIRouter(prefix="/api/purchase", tags=["认购"]) # ============ Schema ============ class PurchaseGroupCreate(BaseModel): - cycle_months: Optional[int] = None - start_date: Optional[str] = None name: str - description: Optional[str] = None + description: str + total_members: int + total_collections: int + cycle_months: int + start_date: str class PurchaseGroupResponse(BaseModel): cycle_months: Optional[int] = None @@ -238,6 +240,8 @@ def create_group( creator_id=current_user.f99_90_id, creator_name=current_user.f01_01_name, status="active", + total_members=data.total_members, + total_collections=data.total_collections, cycle_months=data.cycle_months, start_date=start_date ) diff --git a/config/CHANGELOG.md b/config/CHANGELOG.md index 976932c..6aedb3f 100644 --- a/config/CHANGELOG.md +++ b/config/CHANGELOG.md @@ -1,5 +1,23 @@ # 版本更新记录 +## v0.1.2 (2026-04-30) + +### 前端更新 +- **Home.jsx** + - 修复:我的认购入口字体颜色改为蓝色 #3b82f6 +- **Purchase.jsx** + - 新增:创建群表单6个必填字段 + - 认购群名称 + - 认购介绍(群介绍) + - 参与人数 + - 总认购数 + - 认购周期(月) + - 开始日期 + +### 后端更新 +- **purchase.py** + - 新增:创建群接口支持新字段 total_members、total_collections + ## v0.0.12 (2026-04-29) ### 前端更新 diff --git a/config/VERSION.json b/config/VERSION.json index 2facab0..1f355bd 100644 --- a/config/VERSION.json +++ b/config/VERSION.json @@ -1,16 +1,16 @@ { - "version": "0.1.1", - "updated": "2026-04-29", + "version": "0.1.2", + "updated": "2026-04-30", "modules": { "frontend": { - "version": "0.1.1", + "version": "0.1.2", "pages": { "Home": "0.1.0", - "Purchase": "0.1.2" + "Purchase": "0.0.2" } }, "backend": { - "version": "0.1.1", + "version": "0.1.2", "routers": { "purchase": "0.1.0" }, diff --git a/frontend/src/pages/Home.jsx b/frontend/src/pages/Home.jsx index 76bf281..1c3b650 100644 --- a/frontend/src/pages/Home.jsx +++ b/frontend/src/pages/Home.jsx @@ -238,7 +238,7 @@ export default function Home() { justifyContent: 'center', textAlign: 'center' }}> -
我的认购
+
我的认购
认购群入口
diff --git a/frontend/src/pages/Purchase.jsx b/frontend/src/pages/Purchase.jsx index 84b2dfc..817ec2c 100644 --- a/frontend/src/pages/Purchase.jsx +++ b/frontend/src/pages/Purchase.jsx @@ -1,7 +1,8 @@ /** * Purchase - 我的认购/团购页面 - * Version: 0.0.1 (2026-04-24) + * Version: 0.0.2 (2026-04-30) * 认购群管理、加入、查看详情 + * 更新:创建群表单新增6个字段(群名、介绍、人数、总数、周期、开始日期) */ import React, { useState, useEffect } from 'react' @@ -19,7 +20,14 @@ function Purchase() { const [groupMembers, setGroupMembers] = useState([]) const [groupCollections, setGroupCollections] = useState([]) const [showCollectionForm, setShowCollectionForm] = useState(false) - const [newGroup, setNewGroup] = useState({ name: '', description: '' }) + const [newGroup, setNewGroup] = useState({ + name: '', + description: '', + total_members: '', + total_collections: '', + cycle_months: '', + start_date: '' + }) const [newCollection, setNewCollection] = useState({ number: 'J0________', price: '' }) const [loading, setLoading] = useState(true) const [activeTab, setActiveTab] = useState('my') // my/all @@ -61,6 +69,11 @@ function Purchase() { const token = localStorage.getItem('token') if (!token) { alert('请先登录'); return } if (!newGroup.name.trim()) { alert('请输入认购群名称'); return } + if (!newGroup.description.trim()) { alert('请输入认购介绍'); return } + if (!newGroup.total_members) { alert('请输入参与人数'); return } + if (!newGroup.total_collections) { alert('请输入总认购数'); return } + if (!newGroup.cycle_months) { alert('请输入认购周期'); return } + if (!newGroup.start_date) { alert('请选择开始日期'); return } try { const res = await fetch(`${API_BASE}/api/purchase/groups`, { @@ -75,7 +88,7 @@ function Purchase() { if (res.ok) { alert('创建成功!') setShowCreate(false) - setNewGroup({ name: '', description: '' }) + setNewGroup({ name: '', description: '', total_members: '', total_collections: '', cycle_months: '', start_date: '' }) fetchGroups() } else { alert(data.detail || '创建失败') @@ -749,10 +762,12 @@ function Purchase() { maxWidth: '400px' }}>
创建认购群
+ + {/* 1. 认购群名称 */} setNewGroup({...newGroup, name: e.target.value})} - placeholder="认购群名称" + placeholder="* 认购群名称" style={{ width: '100%', background: 'rgba(255,255,255,0.1)', @@ -764,11 +779,13 @@ function Purchase() { marginBottom: '12px' }} /> + + {/* 2. 认购介绍 */}