From 5af109fc88ce11e578c0780ed3d31bf03437d772 Mon Sep 17 00:00:00 2001 From: menxipeng Date: Sun, 30 Nov 2025 22:44:50 +0800 Subject: [PATCH] shangc --- src/components/pages/InventoryPage.tsx | 29 +++++++----------- src/components/pages/MerchantsPage.tsx | 16 +++++----- src/components/pages/StatisticsPage.tsx | 6 ++-- src/components/pages/UsersPage.tsx | 24 +++++++-------- src/components/pages/WorkOrdersPage.tsx | 8 ++--- src/components/pages/salePage.tsx | 22 +++++++------- src/components/ui/table.tsx | 4 +-- src/index.css | 39 +++++++++++++++++++++++++ 8 files changed, 90 insertions(+), 58 deletions(-) diff --git a/src/components/pages/InventoryPage.tsx b/src/components/pages/InventoryPage.tsx index fd6b494..4701c3e 100644 --- a/src/components/pages/InventoryPage.tsx +++ b/src/components/pages/InventoryPage.tsx @@ -324,10 +324,10 @@ export default function InventoryPage() { - + */} {/* Desktop Table View */} @@ -714,16 +714,9 @@ function AddInventoryForm({ categories, onClose, onSuccess }: { categories: any; userId: "1" } - const response = await fetch('/back/inventory', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(requestData) - }) + const result = await apiPost('/back/inventory', requestData) - if (response.ok) { - const result = await response.json() + if (result.code === 200) { console.log('库存添加成功:', result) if (onSuccess) { onSuccess() @@ -731,8 +724,8 @@ function AddInventoryForm({ categories, onClose, onSuccess }: { categories: any; onClose() } } else { - const error = await response.json() - console.error('添加库存失败:', error) + console.error('添加库存失败:', result) + alert('添加库存失败:' + (result.msg || '未知错误')) } } catch (error) { console.error('请求失败:', error) @@ -1189,7 +1182,7 @@ function LogisticsTracking() { 状态 订单价值 时间 - 操作 + {/* 操作 */} @@ -1258,11 +1251,11 @@ function LogisticsTracking() { - + {/* - + */} )) )} @@ -1342,11 +1335,11 @@ function LogisticsTracking() { - -
+ {/*
-
+
*/} )) diff --git a/src/components/pages/MerchantsPage.tsx b/src/components/pages/MerchantsPage.tsx index 803a4b7..f3a1c4f 100644 --- a/src/components/pages/MerchantsPage.tsx +++ b/src/components/pages/MerchantsPage.tsx @@ -376,8 +376,8 @@ export default function MerchantsPage() { if (isEditMerchantOpen && editMerchant.mall && malls.length > 0 && !loadingMalls) { // 如果 mallUserId 为空,尝试根据 mallId 找到对应的 mallUser if (!editMerchant.mallUserId) { - const foundMall = malls.find(m => - m.mallId === editMerchant.mall || + const foundMall = malls.find(m => + m.mallId === editMerchant.mall || m.id === editMerchant.mall || (m.mallId && editMerchant.mall && m.mallId.toString() === editMerchant.mall.toString()) ) @@ -586,7 +586,7 @@ export default function MerchantsPage() { // 调用导出接口 await apiExportFile('/back/merchants/export', exportParams, `商户列表_${new Date().toISOString().split('T')[0]}.xlsx`) - + console.log('导出商户数据成功') } catch (error) { console.error('导出商户数据失败:', error) @@ -665,7 +665,7 @@ export default function MerchantsPage() { if (statusFilter === "all") { return merchants } - + return merchants.filter((merchant) => { switch (statusFilter) { case "normal": @@ -744,7 +744,7 @@ export default function MerchantsPage() {
- @@ -763,10 +763,10 @@ export default function MerchantsPage() { 已到期 {loadingUserEquipmentCount ? '' : `(${userEquipmentCount.countExpire})`} - + */} - + */}
- {/* 1. 所有地区设备总数 */} + { /* 1. 所有地区设备总数 */} 所有地区设备总数 diff --git a/src/components/pages/UsersPage.tsx b/src/components/pages/UsersPage.tsx index 8b4c9fd..d0c8b67 100644 --- a/src/components/pages/UsersPage.tsx +++ b/src/components/pages/UsersPage.tsx @@ -43,24 +43,24 @@ export default function UsersPage() { try { setIsLoading(true) const result = await apiGet("/back/user/list?loginRole=normal") - + console.log("用户列表API返回结果:", result) if (result && result.code === 200) { // 处理不同的响应格式 const userList = result.rows || result.data || [] - + // 调试:打印第一条用户数据,查看实际字段名 if (userList.length > 0) { console.log("API 返回的用户数据示例:", userList[0]) } - + // 将 API 返回的用户数据映射到显示格式 const mappedUsers: DisplayUser[] = userList.map((user: any) => { // 尝试多种可能的字段名(处理大小写和命名差异) const nickName = user.nickName || user.nickname || user.nick_name || "" const userName = user.userName || user.username || user.user_name || "" - + return { id: user.userId || `CU${user.userId?.slice(-3) || '000'}`, name: nickName || userName || "未知用户", @@ -75,7 +75,7 @@ export default function UsersPage() { totalSpent: 0, // API 可能不包含此字段,需要后续补充 } }) - + setUsers(mappedUsers) } else { console.error("获取用户列表失败:", result?.msg || "未知错误") @@ -184,10 +184,10 @@ export default function UsersPage() { - + */}
{/* Loading State */} @@ -284,7 +284,7 @@ export default function UsersPage() { {getStatusBadge(user.status)} - +
联系方式
@@ -293,7 +293,7 @@ export default function UsersPage() { {formatPhone(user.phone)}
- +
地址
@@ -301,7 +301,7 @@ export default function UsersPage() { {user.address}
- +
注册时间
@@ -312,7 +312,7 @@ export default function UsersPage() {
{user.lastActive}
- +
订单/消费
@@ -320,7 +320,7 @@ export default function UsersPage() { ¥{user.totalSpent}
- +
+ */}
{/* Desktop Table View */} -
- +
+
工单信息 diff --git a/src/components/pages/salePage.tsx b/src/components/pages/salePage.tsx index 599983b..17498da 100644 --- a/src/components/pages/salePage.tsx +++ b/src/components/pages/salePage.tsx @@ -42,7 +42,7 @@ export default function SalePage() { const [total, setTotal] = useState(0) const [currentPage, setCurrentPage] = useState(1) const [pageSize, setPageSize] = useState(10) - + // 新增业务员对话框状态 const [isAddDialogOpen, setIsAddDialogOpen] = useState(false) const [isEditDialogOpen, setIsEditDialogOpen] = useState(false) @@ -386,10 +386,10 @@ export default function SalePage() { - + */} {/* Desktop Table View */} @@ -506,23 +506,23 @@ export default function SalePage() { - +
用户ID
{user.userId}
- +
手机号
{user.phonenumber}
- +
邮箱
{user.email || '未设置'}
- +
创建时间
{user.createTime}
@@ -669,8 +669,8 @@ export default function SalePage() { > 取消 - -