shangc
This commit is contained in:
@@ -324,10 +324,10 @@ export default function InventoryPage() {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Button variant="outline" className="w-full sm:w-auto">
|
||||
{/*<Button variant="outline" className="w-full sm:w-auto">
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
导出
|
||||
</Button>
|
||||
</Button>*/}
|
||||
</div>
|
||||
|
||||
{/* 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() {
|
||||
<TableHead>状态</TableHead>
|
||||
<TableHead>订单价值</TableHead>
|
||||
<TableHead>时间</TableHead>
|
||||
<TableHead>操作</TableHead>
|
||||
{/* <TableHead>操作</TableHead> */}
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
@@ -1258,11 +1251,11 @@ function LogisticsTracking() {
|
||||
</div>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{/*<TableCell>
|
||||
<Button variant="outline" size="sm">
|
||||
查看详情
|
||||
</Button>
|
||||
</TableCell>
|
||||
</TableCell>*/}
|
||||
</TableRow>
|
||||
))
|
||||
)}
|
||||
@@ -1342,11 +1335,11 @@ function LogisticsTracking() {
|
||||
<span className="font-medium text-green-600">-</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="pt-2 border-t">
|
||||
{/*<div className="pt-2 border-t">
|
||||
<Button variant="outline" size="sm" className="w-full">
|
||||
查看详情
|
||||
</Button>
|
||||
</div>
|
||||
</div>*/}
|
||||
</CardContent>
|
||||
</Card>
|
||||
))
|
||||
|
||||
@@ -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() {
|
||||
</div>
|
||||
<div className="flex flex-col sm:flex-row gap-4">
|
||||
|
||||
<Select value={statusFilter} onValueChange={handleStatusFilterChange}>
|
||||
{/*<Select value={statusFilter} onValueChange={handleStatusFilterChange}>
|
||||
<SelectTrigger className="w-full sm:w-48">
|
||||
<Filter className="h-4 w-4 mr-2" />
|
||||
<SelectValue placeholder="筛选状态" />
|
||||
@@ -763,10 +763,10 @@ export default function MerchantsPage() {
|
||||
已到期 {loadingUserEquipmentCount ? '' : `(${userEquipmentCount.countExpire})`}
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</Select>*/}
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleExportMerchants}
|
||||
disabled={isExporting}
|
||||
>
|
||||
|
||||
@@ -259,15 +259,15 @@ export default function StatisticsPage() {
|
||||
<SelectItem value="year">本年</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button variant="outline">
|
||||
{/* <Button variant="outline">
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
导出报表
|
||||
</Button>
|
||||
</Button> */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||
{/* 1. 所有地区设备总数 */}
|
||||
{ /* 1. 所有地区设备总数 */}
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">所有地区设备总数</CardTitle>
|
||||
|
||||
@@ -43,24 +43,24 @@ export default function UsersPage() {
|
||||
try {
|
||||
setIsLoading(true)
|
||||
const result = await apiGet<any>("/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() {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Button variant="outline">
|
||||
{/*<Button variant="outline">
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
导出
|
||||
</Button>
|
||||
</Button>*/}
|
||||
</div>
|
||||
|
||||
{/* Loading State */}
|
||||
@@ -284,7 +284,7 @@ export default function UsersPage() {
|
||||
</div>
|
||||
{getStatusBadge(user.status)}
|
||||
</div>
|
||||
|
||||
|
||||
<div className="border-t pt-3 space-y-2">
|
||||
<div>
|
||||
<div className="text-xs text-gray-500 mb-1">联系方式</div>
|
||||
@@ -293,7 +293,7 @@ export default function UsersPage() {
|
||||
{formatPhone(user.phone)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<div className="text-xs text-gray-500 mb-1">地址</div>
|
||||
<div className="flex items-start text-sm">
|
||||
@@ -301,7 +301,7 @@ export default function UsersPage() {
|
||||
<span>{user.address}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="grid grid-cols-2 gap-2 text-xs">
|
||||
<div>
|
||||
<div className="text-gray-500 mb-1">注册时间</div>
|
||||
@@ -312,7 +312,7 @@ export default function UsersPage() {
|
||||
<div className="text-gray-600">{user.lastActive}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<div className="text-xs text-gray-500 mb-1">订单/消费</div>
|
||||
<div className="text-sm">
|
||||
@@ -320,7 +320,7 @@ export default function UsersPage() {
|
||||
<span className="text-gray-500 ml-2">¥{user.totalSpent}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="flex space-x-2 pt-2">
|
||||
<Button variant="outline" size="sm" className="flex-1">
|
||||
<Eye className="h-4 w-4 mr-1" />
|
||||
|
||||
@@ -422,15 +422,15 @@ export default function WorkOrdersPage() {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Button variant="outline">
|
||||
{/*<Button variant="outline">
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
导出
|
||||
</Button>
|
||||
</Button>*/}
|
||||
</div>
|
||||
|
||||
{/* Desktop Table View */}
|
||||
<div className="hidden md:block rounded-md border overflow-x-hidden hover:overflow-x-auto transition-all">
|
||||
<Table>
|
||||
<div className="hidden md:block rounded-md border">
|
||||
<Table className="min-w-[1200px]" containerClassName="work-order-table-scroll">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>工单信息</TableHead>
|
||||
|
||||
@@ -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() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button variant="outline" onClick={handleExport}>
|
||||
{/*<Button variant="outline" onClick={handleExport}>
|
||||
<Download className="h-4 w-4 mr-2" />
|
||||
导出
|
||||
</Button>
|
||||
</Button> */}
|
||||
</div>
|
||||
|
||||
{/* Desktop Table View */}
|
||||
@@ -506,23 +506,23 @@ export default function SalePage() {
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="border-t pt-3 space-y-2">
|
||||
<div>
|
||||
<div className="text-xs text-gray-500 mb-1">用户ID</div>
|
||||
<div className="text-sm font-medium">{user.userId}</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<div className="text-xs text-gray-500 mb-1">手机号</div>
|
||||
<div className="text-sm">{user.phonenumber}</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<div className="text-xs text-gray-500 mb-1">邮箱</div>
|
||||
<div className="text-sm truncate">{user.email || '未设置'}</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<div className="text-xs text-gray-500 mb-1">创建时间</div>
|
||||
<div className="text-sm">{user.createTime}</div>
|
||||
@@ -669,8 +669,8 @@ export default function SalePage() {
|
||||
>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleSubmitAdd}
|
||||
<Button
|
||||
onClick={handleSubmitAdd}
|
||||
disabled={isSubmitting}
|
||||
className="w-full sm:w-auto text-sm sm:text-base"
|
||||
>
|
||||
@@ -761,8 +761,8 @@ export default function SalePage() {
|
||||
>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleSubmitEdit}
|
||||
<Button
|
||||
onClick={handleSubmitEdit}
|
||||
disabled={isSubmitting}
|
||||
className="w-full sm:w-auto text-sm sm:text-base"
|
||||
>
|
||||
|
||||
@@ -4,11 +4,11 @@ import * as React from "react"
|
||||
|
||||
import { cn } from "@/utils"
|
||||
|
||||
function Table({ className, ...props }: React.ComponentProps<"table">) {
|
||||
function Table({ className, containerClassName, ...props }: React.ComponentProps<"table"> & { containerClassName?: string }) {
|
||||
return (
|
||||
<div
|
||||
data-slot="table-container"
|
||||
className="relative w-full overflow-x-auto"
|
||||
className={cn("relative w-full overflow-x-auto", containerClassName)}
|
||||
>
|
||||
<table
|
||||
data-slot="table"
|
||||
|
||||
@@ -58,4 +58,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* 工单表格滚动条样式 - 直接应用到Table组件内部的滚动容器 */
|
||||
.work-order-table-scroll {
|
||||
/* 默认隐藏滚动条但保持滚动功能 */
|
||||
-ms-overflow-style: none !important; /* IE and Edge */
|
||||
scrollbar-width: none !important; /* Firefox */
|
||||
}
|
||||
|
||||
.work-order-table-scroll::-webkit-scrollbar {
|
||||
display: none !important; /* Chrome, Safari and Opera */
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
|
||||
/* 悬停时显示滚动条 */
|
||||
.work-order-table-scroll:hover {
|
||||
-ms-overflow-style: auto !important; /* IE and Edge */
|
||||
scrollbar-width: thin !important; /* Firefox */
|
||||
}
|
||||
|
||||
.work-order-table-scroll:hover::-webkit-scrollbar {
|
||||
display: block !important; /* Chrome, Safari and Opera */
|
||||
height: 8px !important;
|
||||
width: 8px !important;
|
||||
}
|
||||
|
||||
.work-order-table-scroll:hover::-webkit-scrollbar-track {
|
||||
background: #f1f1f1 !important;
|
||||
border-radius: 4px !important;
|
||||
}
|
||||
|
||||
.work-order-table-scroll:hover::-webkit-scrollbar-thumb {
|
||||
background: #c1c1c1 !important;
|
||||
border-radius: 4px !important;
|
||||
}
|
||||
|
||||
.work-order-table-scroll:hover::-webkit-scrollbar-thumb:hover {
|
||||
background: #a8a8a8 !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user