feat: 重构前端代码结构并添加Java后端支持

- 重构前端导入和组件结构,优化代码组织
- 添加Java后端基础框架和API实现
- 修复类型定义和接口兼容性问题
- 新增测试页面和工具函数
- 优化国际化支持和错误处理
- 更新依赖配置和构建脚本

新增Java后端模块:
- 实现基础认证、订单、支付等服务
- 添加Swagger API文档支持
- 配置数据库连接和缓存
- 实现国际化消息处理
- 添加安全过滤器和限流控制
This commit is contained in:
2026-03-30 16:51:18 +08:00
parent 1b14947e7b
commit e47beffaf9
199 changed files with 24719 additions and 958 deletions

View File

@@ -210,4 +210,127 @@ export const analyticsDataSource = {
throw new Error(error.message || '导出分析数据失败');
}
},
/**
* 获取所有分析数据
*/
async fetchAllData(): Promise<any> {
try {
// 模拟API调用延迟
await new Promise(resolve => setTimeout(resolve, 800));
return {
metrics: [
{ key: 'sales', label: '总销售额', value: 125000, unit: '元', change: 15.2, changeType: 'up', icon: 'BarChartOutlined', color: '#52c41a' },
{ key: 'orders', label: '订单数', value: 850, unit: '单', change: 8.7, changeType: 'up', icon: 'ShoppingOutlined', color: '#1890ff' },
{ key: 'visitors', label: '访客数', value: 12000, unit: '人', change: 5.3, changeType: 'up', icon: 'UserOutlined', color: '#faad14' },
{ key: 'conversion', label: '转化率', value: 7.1, unit: '%', change: -1.2, changeType: 'down', icon: 'LineChartOutlined', color: '#ff4d4f' },
],
chartData: Array.from({ length: 7 }, (_, i) => ({
date: `2026-03-${24 + i}`,
sales: 15000 + Math.random() * 10000,
orders: 80 + Math.random() * 50,
visitors: 1200 + Math.random() * 800,
conversion: 6 + Math.random() * 3,
})),
productAnalytics: [
{ productId: 'P001', productName: '无线蓝牙耳机', sales: 120, revenue: 24000, profit: 8400, conversionRate: 8.5 },
{ productId: 'P002', productName: '智能手表', sales: 85, revenue: 17000, profit: 5950, conversionRate: 6.2 },
{ productId: 'P003', productName: '便携充电宝', sales: 210, revenue: 16800, profit: 4200, conversionRate: 10.3 },
],
orderAnalytics: [
{ status: 'PENDING', count: 35, revenue: 7000, avgOrderValue: 200 },
{ status: 'CONFIRMED', count: 120, revenue: 24000, avgOrderValue: 200 },
{ status: 'SHIPPED', count: 210, revenue: 42000, avgOrderValue: 200 },
{ status: 'DELIVERED', count: 380, revenue: 76000, avgOrderValue: 200 },
{ status: 'COMPLETED', count: 85, revenue: 17000, avgOrderValue: 200 },
],
profitAnalytics: [
{ platform: 'AMAZON', revenue: 50000, cost: 35000, profit: 15000, profitMargin: 30 },
{ platform: 'SHOPEE', revenue: 35000, cost: 28000, profit: 7000, profitMargin: 20 },
{ platform: 'LAZADA', revenue: 20000, cost: 16000, profit: 4000, profitMargin: 20 },
{ platform: 'TikTok', revenue: 20000, cost: 14000, profit: 6000, profitMargin: 30 },
],
realtimeMetrics: {
activeUsers: 125,
currentSales: 8500,
currentOrders: 42,
conversionRate: 6.8,
avgSessionTime: 245,
},
alertRules: [
{ id: 'A001', name: '销售额下降', condition: 'sales < 5000', threshold: 5000, status: 'active', lastTriggered: '2026-03-26 14:30:00' },
{ id: 'A002', name: '订单量异常', condition: 'orders < 20', threshold: 20, status: 'inactive', lastTriggered: '2026-03-20 10:15:00' },
{ id: 'A003', name: '转化率低', condition: 'conversion < 5', threshold: 5, status: 'active', lastTriggered: '2026-03-25 09:45:00' },
],
dashboards: [
{ id: 'D001', name: '销售概览', widgets: ['sales', 'orders', 'visitors', 'conversion'], lastUpdated: '2026-03-27 10:00:00', createdBy: 'admin' },
{ id: 'D002', name: '产品分析', widgets: ['products', 'categories', 'brands'], lastUpdated: '2026-03-26 16:30:00', createdBy: 'manager' },
{ id: 'D003', name: '平台对比', widgets: ['platforms', 'regions', 'channels'], lastUpdated: '2026-03-25 14:00:00', createdBy: 'analyst' },
],
};
} catch (error: any) {
message.error(error.message || '获取分析数据失败');
return {
metrics: [],
chartData: [],
productAnalytics: [],
orderAnalytics: [],
profitAnalytics: [],
realtimeMetrics: {
activeUsers: 0,
currentSales: 0,
currentOrders: 0,
conversionRate: 0,
avgSessionTime: 0,
},
alertRules: [],
dashboards: [],
};
}
},
/**
* 获取实时数据
*/
async fetchRealtimeData(): Promise<any> {
try {
// 模拟API调用延迟
await new Promise(resolve => setTimeout(resolve, 300));
return {
activeUsers: 100 + Math.floor(Math.random() * 50),
currentSales: 5000 + Math.random() * 5000,
currentOrders: 20 + Math.floor(Math.random() * 30),
conversionRate: 5 + Math.random() * 3,
avgSessionTime: 200 + Math.random() * 100,
};
} catch (error: any) {
message.error(error.message || '获取实时数据失败');
return {
activeUsers: 0,
currentSales: 0,
currentOrders: 0,
conversionRate: 0,
avgSessionTime: 0,
};
}
},
/**
* 获取告警规则
*/
async fetchAlertRules(): Promise<any[]> {
try {
// 模拟API调用延迟
await new Promise(resolve => setTimeout(resolve, 400));
return [
{ id: 'A001', name: '销售额下降', condition: 'sales < 5000', threshold: 5000, status: 'active', lastTriggered: '2026-03-26 14:30:00' },
{ id: 'A002', name: '订单量异常', condition: 'orders < 20', threshold: 20, status: 'inactive', lastTriggered: '2026-03-20 10:15:00' },
{ id: 'A003', name: '转化率低', condition: 'conversion < 5', threshold: 5, status: 'active', lastTriggered: '2026-03-25 09:45:00' },
{ id: 'A004', name: '库存不足', condition: 'stock < 10', threshold: 10, status: 'active', lastTriggered: '2026-03-27 08:20:00' },
];
} catch (error: any) {
message.error(error.message || '获取告警规则失败');
return [];
}
},
};

View File

@@ -0,0 +1,93 @@
// 统一导出所有服务和 DataSource
// API 服务
export * from './api';
// 基础服务
export { http } from './http';
export { DataSourceFactory, BaseDataSource, BaseMockDataSource, __MOCK__, __DATA_SOURCE_TYPE__ } from './dataSourceFactory';
// 数据源服务
export { abTestDataSource } from './abTestDataSource';
export { adOptimizationDataSource } from './adOptimizationDataSource';
export { afterSalesDataSource } from './afterSalesDataSource';
export { aiActionTaskDataSource } from './aiActionTaskDataSource';
export { aiSuggestionDataSource } from './aiSuggestionDataSource';
export { analyticsDataSource } from './analyticsDataSource';
export { arbitrageDataSource } from './arbitrageDataSource';
export { AuditDataSource } from './auditDataSource';
export { autoExecutionDataSource } from './autoExecutionDataSource';
export { b2bTradeDataSource } from './b2bTradeDataSource';
export { batchOperationDataSource } from './batchOperationDataSource';
export { blacklistDataSource } from './blacklistDataSource';
export { certificateDataSource } from './certificateDataSource';
export { ChatbotDataSource } from './chatbotDataSource';
export { clientDataSource } from './clientDataSource';
export { CommandDataSource } from './commandDataSource';
export { CreativeDataSource } from './creativeDataSource';
export { crossBorderIntegrationDataSource } from './crossBorderIntegrationDataSource';
export { CustomerDataSource } from './customerDataSource';
export { dashboardDataSource } from './dashboardDataSource';
export { dynamicPricingDataSource } from './dynamicPricingDataSource';
export { exchangeDataSource } from './exchangeDataSource';
export { executionResultDataSource } from './executionResultDataSource';
export { financeDataSource } from './financeDataSource';
export { GovernanceDataSource } from './governanceDataSource';
export { humanApprovalDataSource } from './humanApprovalDataSource';
export { independentSiteDataSource } from './independentSiteDataSource';
export { instanceDataSource } from './instanceDataSource';
export { inventoryDataSource } from './inventoryDataSource';
export { leaderboardDataSource } from './leaderboardDataSource';
export { logisticsDataSource } from './logisticsDataSource';
export { marketingDataSource } from './marketingDataSource';
export { materialProcessingDataSource } from './materialProcessingDataSource';
export { merchantDataSource } from './merchantDataSource';
export { MonitoringDataSource } from './monitoringDataSource';
export { NLPDataSource } from './nlpDataSource';
export { omnichannelCommunicationDataSource } from './omnichannelCommunicationDataSource';
export { OmnichannelDataSource } from './omnichannelDataSource';
export { omnichannelMarketingDataSource } from './omnichannelMarketingDataSource';
export { operationAgentDataSource } from './operationAgentDataSource';
export { OperationLogDataSource } from './operationLogDataSource';
export { orderDataSource } from './orderDataSource';
export { createOrderManagementDataSource } from './orderManagementDataSource';
export { platformAuthDataSource } from './platformAuthDataSource';
export { procurementDataSource } from './procurementDataSource';
export { productDataSource } from './productDataSource';
export { createProductManagementDataSource } from './productManagementDataSource';
export { productSelectionDataSource } from './productSelectionDataSource';
export { RecommendationDataSource } from './recommendationDataSource';
export { reportsDataSource } from './reportsDataSource';
export { returnDataSource } from './returnDataSource';
export * from './roleDataSource';
export { saasTenantDataSource } from './saasTenantDataSource';
export { serviceManagerDataSource } from './serviceManagerDataSource';
export { settingsDataSource } from './settingsDataSource';
export { shopDataSource } from './shopDataSource';
export { shopReportDataSource } from './shopReportDataSource';
export { SovereigntyDataSource } from './sovereigntyDataSource';
export { storeCreationDataSource } from './storeCreationDataSource';
export { suppliersDataSource } from './suppliersDataSource';
export { SyncDataSource } from './syncDataSource';
export { systemStatusDataSource } from './systemStatusDataSource';
export { taskCenterDataSource } from './taskCenterDataSource';
export { TelemetryDataSource } from './telemetryDataSource';
export { unifiedFulfillmentDataSource } from './unifiedFulfillmentDataSource';
export { userAssetDataSource } from './userAssetDataSource';
export { userDataSource } from './userDataSource';
export { TraceDataSource } from './traceDataSource';
export { VaultDataSource } from './vaultDataSource';
export { WebhookDataSource } from './webhookDataSource';
// 其他服务
export { lightweightClientService } from './lightweightClientService';
export { cloudService } from './cloud-service';
export * from './merchantService';
export * from './merchantOrderService';
export * from './merchantSettlementService';
export * from './merchantShopService';
export { default as behaviorAnalyticsService } from './behaviorAnalyticsService';
export { default as errorMonitorService } from './errorMonitorService';
export { notificationService } from './notificationService';
export { performanceMonitor } from './performanceMonitorService';
export { orderInventoryService } from './orderInventoryService';

View File

@@ -60,7 +60,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'AMAZON',
accountName: 'Amazon美国主店',
accountId: 'amazon_us_001',
status: 'active',
status: 'ACTIVE',
lastSyncAt: '2024-01-15T10:30:00Z',
createdAt: '2024-01-01T00:00:00Z',
updatedAt: '2024-01-15T10:30:00Z',
@@ -71,7 +71,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'SHOPIFY',
accountName: 'my-brand.myshopify.com',
accountId: 'shopify_456',
status: 'active',
status: 'ACTIVE',
lastSyncAt: '2024-01-15T09:15:00Z',
createdAt: '2024-01-01T00:00:00Z',
updatedAt: '2024-01-15T09:15:00Z',
@@ -82,7 +82,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'SHOPEE',
accountName: 'Shopee新加坡旗舰店',
accountId: 'shopee_sg_789',
status: 'expired',
status: 'EXPIRED',
lastSyncAt: '2023-12-01T08:00:00Z',
createdAt: '2023-06-01T00:00:00Z',
updatedAt: '2024-01-01T08:00:00Z',
@@ -93,7 +93,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'EBAY',
accountName: 'eBay全球店',
accountId: 'ebay_global_101',
status: 'inactive',
status: 'INACTIVE',
createdAt: '2024-01-10T00:00:00Z',
updatedAt: '2024-01-10T00:00:00Z',
},
@@ -103,7 +103,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'TIKTOK',
accountName: 'TikTok Shop官方店',
accountId: 'tiktok_official_202',
status: 'active',
status: 'ACTIVE',
lastSyncAt: '2024-01-15T14:20:00Z',
createdAt: '2023-12-15T00:00:00Z',
updatedAt: '2024-01-15T14:20:00Z',
@@ -114,7 +114,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'LAZADA',
accountName: 'Lazada泰国店',
accountId: 'lazada_th_303',
status: 'active',
status: 'ACTIVE',
lastSyncAt: '2024-01-14T16:45:00Z',
createdAt: '2023-11-20T00:00:00Z',
updatedAt: '2024-01-14T16:45:00Z',
@@ -125,7 +125,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'TEMU_FULL',
accountName: 'Temu全托管旗舰店',
accountId: 'temu_full_404',
status: 'active',
status: 'ACTIVE',
lastSyncAt: '2024-01-15T11:00:00Z',
createdAt: '2023-10-01T00:00:00Z',
updatedAt: '2024-01-15T11:00:00Z',
@@ -136,7 +136,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'SHEIN',
accountName: 'SHEIN官方店',
accountId: 'shein_official_505',
status: 'error',
status: 'ERROR',
lastSyncAt: '2024-01-10T09:30:00Z',
createdAt: '2023-09-15T00:00:00Z',
updatedAt: '2024-01-12T10:00:00Z',
@@ -147,7 +147,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'ALIEXPRESS',
accountName: '速卖通俄罗斯店',
accountId: 'aliexpress_ru_606',
status: 'active',
status: 'ACTIVE',
lastSyncAt: '2024-01-15T08:20:00Z',
createdAt: '2023-08-01T00:00:00Z',
updatedAt: '2024-01-15T08:20:00Z',
@@ -158,7 +158,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'WALMART',
accountName: 'Walmart美国店',
accountId: 'walmart_us_707',
status: 'inactive',
status: 'INACTIVE',
createdAt: '2024-01-05T00:00:00Z',
updatedAt: '2024-01-05T00:00:00Z',
},
@@ -168,7 +168,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'OZON',
accountName: 'Ozon俄罗斯店',
accountId: 'ozon_ru_808',
status: 'active',
status: 'ACTIVE',
lastSyncAt: '2024-01-15T07:15:00Z',
createdAt: '2023-07-01T00:00:00Z',
updatedAt: '2024-01-15T07:15:00Z',
@@ -179,7 +179,7 @@ export class PlatformAuthMockDataSource implements PlatformAuthDataSource {
platform: 'COUPANG',
accountName: 'Coupang韩国店',
accountId: 'coupang_kr_909',
status: 'expired',
status: 'EXPIRED',
lastSyncAt: '2023-11-15T06:00:00Z',
createdAt: '2023-05-01T00:00:00Z',
updatedAt: '2023-12-01T00:00:00Z',

View File

@@ -5,35 +5,10 @@
import moment from 'moment';
import { BaseDataSource, DataSourceFactory } from './baseDataSource';
import type { ExtendedProduct, ProductManagementStatus, Shop } from '../../../server/src/shared/schemas/productManagement.schema';
export interface Product {
id: string;
sku: string;
name: string;
image: string;
category: string;
price: number;
costPrice: number;
profit: number;
roi: number;
stock: number;
status: 'DRAFT' | 'PRICED' | 'LISTED' | 'SYNCING' | 'LIVE' | 'SYNC_FAILED' | 'OFFLINE';
platformStatus: Record<string, string>;
shopId: string;
shopName: string;
platform: string;
createdAt: string;
updatedAt: string;
}
export interface Shop {
id: string;
name: string;
platform: string;
status: 'ACTIVE' | 'INACTIVE' | 'SUSPENDED';
region: string;
currency: string;
}
export type Product = ExtendedProduct;
export type ProductStatus = ProductManagementStatus;
export interface ProductFilter {
keyword?: string;
@@ -123,286 +98,331 @@ const MOCK_PRODUCTS: Product[] = [
id: '1',
sku: 'TP-TEMP-001',
name: '工业温度传感器 Pro',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '工业自动化',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['工业自动化'],
price: 89.99,
costPrice: 45.00,
profit: 44.99,
roi: 99.98,
stock: 256,
description: '工业级温度传感器,高精度测量',
attributes: {},
status: 'LIVE',
platformStatus: { Amazon: 'LIVE', eBay: 'LIVE', Shopee: 'PENDING' },
shopId: 'shop-amazon-1',
shopName: 'Amazon美国店',
platform: 'Amazon',
createdAt: '2025-12-15',
updatedAt: '2026-03-18',
managementStatus: 'LIVE',
createdAt: '2025-12-15T00:00:00Z',
updatedAt: '2026-03-18T00:00:00Z',
},
{
id: '2',
sku: 'TP-PRES-002',
name: '压力传感器 Digital',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '工业自动化',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['工业自动化'],
price: 129.99,
costPrice: 65.00,
profit: 64.99,
roi: 99.98,
stock: 128,
description: '数字压力传感器,高精度测量',
attributes: {},
status: 'DRAFT',
platformStatus: {},
shopId: 'shop-tiktok-1',
shopName: 'TikTok旗舰店',
platform: 'TikTok',
createdAt: '2026-03-10',
updatedAt: '2026-03-10',
managementStatus: 'DRAFT',
createdAt: '2026-03-10T00:00:00Z',
updatedAt: '2026-03-10T00:00:00Z',
},
{
id: '3',
sku: 'TP-FLOW-003',
name: '流量计 Ultra',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '仪器仪表',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['仪器仪表'],
price: 299.99,
costPrice: 150.00,
profit: 149.99,
roi: 99.99,
stock: 64,
description: '高精度流量计,适用于工业环境',
attributes: {},
status: 'PRICED',
platformStatus: {},
shopId: 'shop-shopee-1',
shopName: 'Shopee官方店',
platform: 'Shopee',
createdAt: '2026-03-15',
updatedAt: '2026-03-16',
managementStatus: 'PRICED',
createdAt: '2026-03-15T00:00:00Z',
updatedAt: '2026-03-16T00:00:00Z',
},
{
id: '4',
sku: 'TP-MOTR-004',
name: '步进电机 57型',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '工业自动化',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['工业自动化'],
price: 59.99,
costPrice: 30.00,
profit: 29.99,
roi: 99.97,
stock: 512,
description: '57型步进电机高扭矩',
attributes: {},
status: 'LISTED',
platformStatus: { Amazon: 'LISTED' },
shopId: 'shop-amazon-2',
shopName: 'Amazon欧洲店',
platform: 'Amazon',
createdAt: '2026-03-01',
updatedAt: '2026-03-17',
managementStatus: 'LISTED',
createdAt: '2026-03-01T00:00:00Z',
updatedAt: '2026-03-17T00:00:00Z',
},
{
id: '5',
sku: 'TP-CTRL-005',
name: 'PLC控制器 Mini',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '工业自动化',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['工业自动化'],
price: 199.99,
costPrice: 100.00,
profit: 99.99,
roi: 99.99,
stock: 32,
description: '小型PLC控制器适用于自动化控制',
attributes: {},
status: 'SYNCING',
platformStatus: { Amazon: 'SYNCING', eBay: 'SYNCING' },
shopId: 'shop-ebay-1',
shopName: 'eBay全球店',
platform: 'eBay',
createdAt: '2026-03-18',
updatedAt: '2026-03-18',
managementStatus: 'SYNCING',
createdAt: '2026-03-18T00:00:00Z',
updatedAt: '2026-03-18T00:00:00Z',
},
{
id: '6',
sku: 'TP-SENS-006',
name: '光电传感器',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '工业自动化',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['工业自动化'],
price: 39.99,
costPrice: 20.00,
profit: 19.99,
roi: 99.95,
stock: 0,
description: '光电传感器,用于检测物体',
attributes: {},
status: 'SYNC_FAILED',
platformStatus: { Amazon: 'FAILED' },
shopId: 'shop-temu-1',
shopName: 'Temu旗舰店',
platform: 'TemuFull',
createdAt: '2026-03-05',
updatedAt: '2026-03-18',
managementStatus: 'SYNC_FAILED',
createdAt: '2026-03-05T00:00:00Z',
updatedAt: '2026-03-18T00:00:00Z',
},
{
id: '7',
sku: 'TP-VALV-007',
name: '电磁阀 24V',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '工具设备',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['工具设备'],
price: 79.99,
costPrice: 40.00,
profit: 39.99,
roi: 99.98,
stock: 200,
description: '24V电磁阀用于流体控制',
attributes: {},
status: 'OFFLINE',
platformStatus: { Amazon: 'OFFLINE', eBay: 'OFFLINE' },
shopId: 'shop-shein-1',
shopName: 'SHEIN官方店',
platform: 'Shein',
createdAt: '2025-11-20',
updatedAt: '2026-02-28',
managementStatus: 'OFFLINE',
createdAt: '2025-11-20T00:00:00Z',
updatedAt: '2026-02-28T00:00:00Z',
},
{
id: '8',
sku: 'TP-LEVEL-008',
name: '液位传感器',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '工业自动化',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['工业自动化'],
price: 69.99,
costPrice: 35.00,
profit: 34.99,
roi: 99.97,
stock: 150,
description: '液位传感器,用于检测液体 level',
attributes: {},
status: 'LIVE',
platformStatus: { Amazon: 'LIVE', TikTok: 'LIVE' },
shopId: 'shop-amazon-3',
shopName: 'Amazon日本店',
platform: 'Amazon',
createdAt: '2026-03-08',
updatedAt: '2026-03-18',
managementStatus: 'LIVE',
createdAt: '2026-03-08T00:00:00Z',
updatedAt: '2026-03-18T00:00:00Z',
},
{
id: '9',
sku: 'TP-RELAY-009',
name: '继电器模块',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '电子元器件',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['电子元器件'],
price: 29.99,
costPrice: 15.00,
profit: 14.99,
roi: 99.93,
stock: 1000,
description: '继电器模块,用于电路控制',
attributes: {},
status: 'LIVE',
platformStatus: { Shopee: 'LIVE', Lazada: 'LIVE' },
shopId: 'shop-shopee-2',
shopName: 'Shopee官方店B',
platform: 'Shopee',
createdAt: '2026-03-12',
updatedAt: '2026-03-17',
managementStatus: 'LIVE',
createdAt: '2026-03-12T00:00:00Z',
updatedAt: '2026-03-17T00:00:00Z',
},
{
id: '10',
sku: 'TP-FUSE-010',
name: '熔断器',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '电子元器件',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['电子元器件'],
price: 19.99,
costPrice: 10.00,
profit: 9.99,
roi: 99.90,
stock: 2000,
description: '熔断器,用于电路保护',
attributes: {},
status: 'LIVE',
platformStatus: { eBay: 'LIVE', AliExpress: 'LIVE' },
shopId: 'shop-ebay-2',
shopName: 'eBay全球店B',
platform: 'eBay',
createdAt: '2026-03-05',
updatedAt: '2026-03-16',
managementStatus: 'LIVE',
createdAt: '2026-03-05T00:00:00Z',
updatedAt: '2026-03-16T00:00:00Z',
},
{
id: '11',
sku: 'TP-METER-011',
name: '万用表 Digital',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '仪器仪表',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['仪器仪表'],
price: 149.99,
costPrice: 75.00,
profit: 74.99,
roi: 99.99,
stock: 80,
description: '数字万用表,用于电气测量',
attributes: {},
status: 'PRICED',
platformStatus: {},
shopId: 'shop-lazada-1',
shopName: 'Lazada官方店A',
platform: 'Lazada',
createdAt: '2026-03-14',
updatedAt: '2026-03-15',
managementStatus: 'PRICED',
createdAt: '2026-03-14T00:00:00Z',
updatedAt: '2026-03-15T00:00:00Z',
},
{
id: '12',
sku: 'TP-TOOL-012',
name: '电动螺丝刀套装',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '工具设备',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['工具设备'],
price: 89.99,
costPrice: 45.00,
profit: 44.99,
roi: 99.98,
stock: 120,
description: '电动螺丝刀套装,多规格批头',
attributes: {},
status: 'LISTED',
platformStatus: { Amazon: 'LISTED' },
shopId: 'shop-amazon-4',
shopName: 'Amazon欧洲店D',
platform: 'Amazon',
createdAt: '2026-03-03',
updatedAt: '2026-03-17',
managementStatus: 'LISTED',
createdAt: '2026-03-03T00:00:00Z',
updatedAt: '2026-03-17T00:00:00Z',
},
{
id: '13',
sku: 'TP-CAM-013',
name: '安防摄像头',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '安防设备',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['安防设备'],
price: 199.99,
costPrice: 100.00,
profit: 99.99,
roi: 99.99,
stock: 50,
description: '安防摄像头,高清监控',
attributes: {},
status: 'DRAFT',
platformStatus: {},
shopId: 'shop-tiktok-2',
shopName: 'TikTok旗舰店B',
platform: 'TikTok',
createdAt: '2026-03-16',
updatedAt: '2026-03-16',
managementStatus: 'DRAFT',
createdAt: '2026-03-16T00:00:00Z',
updatedAt: '2026-03-16T00:00:00Z',
},
{
id: '14',
sku: 'TP-ALARM-014',
name: '烟雾报警器',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '安防设备',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['安防设备'],
price: 49.99,
costPrice: 25.00,
profit: 24.99,
roi: 99.96,
stock: 180,
description: '烟雾报警器,火灾预警',
attributes: {},
status: 'LIVE',
platformStatus: { Shopee: 'LIVE', TemuFull: 'LIVE' },
shopId: 'shop-temu-2',
shopName: 'Temu旗舰店B',
platform: 'TemuFull',
createdAt: '2026-03-07',
updatedAt: '2026-03-18',
managementStatus: 'LIVE',
createdAt: '2026-03-07T00:00:00Z',
updatedAt: '2026-03-18T00:00:00Z',
},
{
id: '15',
sku: 'TP-SENSOR-015',
name: '湿度传感器',
image: 'https://via.placeholder.com/80x80?text=Product',
category: '工业自动化',
images: ['https://via.placeholder.com/80x80?text=Product'],
categories: ['工业自动化'],
price: 59.99,
costPrice: 30.00,
profit: 29.99,
roi: 99.97,
stock: 200,
description: '湿度传感器,用于环境监测',
attributes: {},
status: 'SYNCING',
platformStatus: { Amazon: 'SYNCING' },
shopId: 'shop-amazon-5',
shopName: 'Amazon日本店E',
platform: 'Amazon',
createdAt: '2026-03-17',
updatedAt: '2026-03-18',
managementStatus: 'SYNCING',
createdAt: '2026-03-17T00:00:00Z',
updatedAt: '2026-03-18T00:00:00Z',
},
];
@@ -502,8 +522,8 @@ export class ProductDataSourceImpl extends BaseDataSource implements ProductData
const newProduct: Product = {
...product,
id: `${Date.now()}`,
createdAt: moment().format('YYYY-MM-DD'),
updatedAt: moment().format('YYYY-MM-DD'),
createdAt: moment().toISOString(),
updatedAt: moment().toISOString(),
};
this.products.unshift(newProduct);
return newProduct;
@@ -523,7 +543,7 @@ export class ProductDataSourceImpl extends BaseDataSource implements ProductData
this.products[index] = {
...this.products[index],
...product,
updatedAt: moment().format('YYYY-MM-DD'),
updatedAt: moment().toISOString(),
};
return this.products[index];
@@ -557,9 +577,10 @@ export class ProductDataSourceImpl extends BaseDataSource implements ProductData
sku: `${originalProduct.sku}-COPY`,
name: `${originalProduct.name} (复制)`,
status: 'DRAFT',
managementStatus: 'DRAFT',
platformStatus: {},
createdAt: moment().format('YYYY-MM-DD'),
updatedAt: moment().format('YYYY-MM-DD'),
createdAt: moment().toISOString(),
updatedAt: moment().toISOString(),
};
this.products.unshift(newProduct);