refactor: 优化跨标签会话同步、引入强类型安全JSON解析工具及Seller样式重构
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
type PublishSalePriceConfig,
|
||||
} from '@/api/listingOptions'
|
||||
import { updateSystemConfig, type SystemConfig } from '@/api/systemConfigs'
|
||||
import { safeParseJSON } from '@/utils/json'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
@@ -35,13 +36,8 @@ watch(
|
||||
)
|
||||
|
||||
function parseSalePriceConfig(raw: string) {
|
||||
try {
|
||||
const parsed = raw.trim() ? JSON.parse(raw) : emptyListingSalePriceConfig
|
||||
return cloneSalePriceConfig(mergeListingSalePriceConfig(parsed))
|
||||
} catch {
|
||||
ElMessage.warning('出售定价规则 JSON 解析失败,已清空草稿')
|
||||
return cloneSalePriceConfig(emptyListingSalePriceConfig)
|
||||
}
|
||||
const parsed = safeParseJSON(raw, emptyListingSalePriceConfig)
|
||||
return cloneSalePriceConfig(mergeListingSalePriceConfig(parsed))
|
||||
}
|
||||
|
||||
function cloneSalePriceConfig(config: PublishSalePriceConfig) {
|
||||
|
||||
Reference in New Issue
Block a user