diff --git a/backend/internal/service/merchant_catalog.go b/backend/internal/service/merchant_catalog.go
index 8f70af8..995ea79 100644
--- a/backend/internal/service/merchant_catalog.go
+++ b/backend/internal/service/merchant_catalog.go
@@ -271,9 +271,12 @@ func ensureProduct(tx *gorm.DB, in CreateMerchantProductInput) (*model.Product,
// UpdateProductRouting 更新平台目录商品的履约渠道与优先级配置
func (s *MerchantService) UpdateProductRouting(catalogID uint, routing ProductRoutingConfig, actorUserID uint) error {
switch routing.RoutingMode {
- case RoutingModePriority, RoutingModeLewan, RoutingModeDLC:
+ case RoutingModePriority, RoutingModeLewan, RoutingModeDLC, RoutingModeRock:
default:
- return errors.New("routing_mode 仅支持 priority / lewan / dlc")
+ return errors.New("routing_mode 仅支持 priority / lewan / dlc / rock")
+ }
+ if routing.RoutingMode == RoutingModeRock {
+ routing.Priority = []string{ProviderRock}
}
if routing.RoutingMode == RoutingModePriority {
if len(routing.Priority) == 0 {
diff --git a/backend/internal/service/provider_test.go b/backend/internal/service/provider_test.go
index 32dbd54..614ff96 100644
--- a/backend/internal/service/provider_test.go
+++ b/backend/internal/service/provider_test.go
@@ -55,6 +55,11 @@ func TestParseProductRoutingConfig(t *testing.T) {
if cfg5.DLCGoodID != "682ef39ca8f40c4234c59f38" {
t.Fatalf("expected builtin DLC good id, got %s", cfg5.DLCGoodID)
}
+
+ cfgRock := ParseProductRoutingConfig(`{"routing_mode":"rock","priority":["rock"],"delivery_type":"LINK_BINDING"}`, "rock_black_tshirt")
+ if cfgRock.RoutingMode != RoutingModeRock || len(cfgRock.Priority) != 1 || cfgRock.Priority[0] != ProviderRock {
+ t.Fatalf("expected rock-only routing, got %+v", cfgRock)
+ }
}
func TestFulfillmentRouterResolution(t *testing.T) {
diff --git a/frontend/src/pages/PlatformProducts.tsx b/frontend/src/pages/PlatformProducts.tsx
index 307b080..190ae31 100644
--- a/frontend/src/pages/PlatformProducts.tsx
+++ b/frontend/src/pages/PlatformProducts.tsx
@@ -32,6 +32,7 @@ import {
SearchOutlined,
SettingOutlined,
SwapOutlined,
+ ThunderboltOutlined,
} from '@ant-design/icons'
import type { ColumnsType } from 'antd/es/table'
import { lewanApi, platformApi } from '../api'
@@ -79,7 +80,7 @@ export default function PlatformProducts() {
setLoading(true)
try {
const list = await platformApi.productCatalog()
- setCatalog(list || [])
+ setCatalog([...(list || [])].sort((a, b) => b.id - a.id))
} catch (e) {
message.error(e instanceof Error ? e.message : '加载商品目录失败')
} finally {
@@ -117,11 +118,13 @@ export default function PlatformProducts() {
let priorityCount = 0
let lewanOnlyCount = 0
let dlcOnlyCount = 0
+ let rockOnlyCount = 0
catalog.forEach((item) => {
const mode = item.routing?.routing_mode || 'dlc'
if (mode === 'priority') priorityCount++
else if (mode === 'lewan') lewanOnlyCount++
+ else if (mode === 'rock') rockOnlyCount++
else dlcOnlyCount++
})
@@ -130,6 +133,7 @@ export default function PlatformProducts() {
priorityCount,
lewanOnlyCount,
dlcOnlyCount,
+ rockOnlyCount,
}
}, [catalog])
@@ -156,7 +160,8 @@ export default function PlatformProducts() {
filterMode === 'all' ||
(filterMode === 'priority' && mode === 'priority') ||
(filterMode === 'lewan' && mode === 'lewan') ||
- (filterMode === 'dlc' && mode === 'dlc')
+ (filterMode === 'dlc' && mode === 'dlc') ||
+ (filterMode === 'rock' && mode === 'rock')
const matchCategory = filterCategory === 'all' || item.category === filterCategory
@@ -196,14 +201,16 @@ export default function PlatformProducts() {
: ['lewan', 'dlc']
: values.routing_mode === 'lewan'
? ['lewan']
+ : values.routing_mode === 'rock'
+ ? ['rock']
: ['dlc']
const payload: UpdateProductRoutingInput = {
routing_mode: values.routing_mode,
priority,
- dlc_good_id: values.dlc_good_id?.trim() || '',
- lewan_product_id: values.lewan_product_id?.trim() || '',
- lewan_name: values.lewan_name?.trim() || '',
+ dlc_good_id: values.routing_mode === 'rock' ? '' : values.dlc_good_id?.trim() || '',
+ lewan_product_id: values.routing_mode === 'rock' ? '' : values.lewan_product_id?.trim() || '',
+ lewan_name: values.routing_mode === 'rock' ? '' : values.lewan_name?.trim() || '',
delivery_type: values.delivery_type || 'LINK_BINDING',
}
@@ -379,6 +386,13 @@ export default function PlatformProducts() {
)
}
+ if (mode === 'rock') {
+ return (
+