feat(consignment): 寄卖规格与价格动态配置重构
This commit is contained in:
@@ -61,3 +61,37 @@ test('工单页:必须挂载内部库存匹配弹窗,并支持状态 interna
|
||||
assert.ok(shared.includes("internal_matching: '内部匹配中'"), '状态文案必须包含内部匹配中')
|
||||
assert.ok(shared.includes("internal_matching: 'magenta'"), '状态配色必须包含内部匹配中')
|
||||
})
|
||||
|
||||
test('寄卖配置面板:独立功能卡片、空字段初始状态与价格配置', () => {
|
||||
const panel = read('../src/pages/admin/panels/ConsignmentConfigPanel.tsx')
|
||||
for (const label of [
|
||||
'规格字段',
|
||||
'添加字段',
|
||||
'基础信息',
|
||||
'价格配置',
|
||||
'履约保证金',
|
||||
'服务费',
|
||||
'库存数量限制',
|
||||
'匹配设置',
|
||||
'超时与降价提示',
|
||||
'接单模板价打折',
|
||||
'固定价格',
|
||||
'模板折扣',
|
||||
'物品名模板',
|
||||
]) {
|
||||
assert.ok(panel.includes(label), `寄卖配置面板缺少「${label}」`)
|
||||
}
|
||||
assert.ok(!panel.includes('DEFAULT_SPEC_FIELDS'), '面板不能预置任何内置字段')
|
||||
assert.ok(panel.includes('useState<ConsignmentSpecField[]>([])'), '规格字段初始必须为空')
|
||||
assert.ok(panel.includes('specDrafts.map'), '规格字段必须可动态增删/排序')
|
||||
assert.ok(panel.includes('SPEC_FIELD_TYPE_OPTIONS'), '字段类型必须支持 6 种选项')
|
||||
})
|
||||
|
||||
test('打手端:动态规格 + 系统建议价 + 改价不得高于建议价', () => {
|
||||
const page = read('../src/pages/worker/WorkerConsignmentPage.tsx')
|
||||
assert.ok(page.includes('selectedSpecs.map'), '规格必须按配置动态渲染')
|
||||
assert.ok(page.includes('fetchWorkerConsignmentPricePreview'), '必须走动态价格预览')
|
||||
assert.ok(page.includes('不能高于系统建议价'), '前端必须提示改价上限')
|
||||
assert.ok(page.includes('specValues'), '发布必须提交动态规格值')
|
||||
assert.ok(page.includes('config.pricing.allowWorkerPrice'), '改价能力必须按配置')
|
||||
})
|
||||
|
||||
@@ -20,32 +20,26 @@ test('后台全量选项:系统含通用,区服含互通', () => {
|
||||
assert.ok(source.includes("value: '互通'"), '区服选项必须包含「互通」')
|
||||
})
|
||||
|
||||
test('苏尔南发布选项:系统只有苹果/安卓,区服唯一「互通」且为默认值', () => {
|
||||
const source = readFileSync(
|
||||
test('苏尔南默认配置:取消代码内置字段,由迁移 131 提供五个单选字段', () => {
|
||||
const utils = readFileSync(
|
||||
new URL('../src/utils/consignment-spec.ts', import.meta.url).pathname,
|
||||
'utf8',
|
||||
)
|
||||
const surnanSystem = source.slice(
|
||||
source.indexOf('SURNAN_PUBLISH_SYSTEM_OPTIONS'),
|
||||
source.indexOf('SURNAN_PUBLISH_ZONE_OPTIONS'),
|
||||
)
|
||||
assert.ok(!surnanSystem.includes("value: '通用'"), '苏尔南发布不允许再选系统「通用」')
|
||||
assert.ok(source.includes("export const SURNAN_DEFAULT_ZONE = '互通'"), '苏尔南区服默认「互通」')
|
||||
const surnanZone = source.slice(source.indexOf('SURNAN_PUBLISH_ZONE_OPTIONS'))
|
||||
assert.ok(
|
||||
!surnanZone.slice(0, surnanZone.indexOf('\n\n')).includes("value: '微信区'"),
|
||||
'苏尔南发布端区服只有互通一个选项',
|
||||
)
|
||||
assert.ok(!utils.includes('SURNAN_PUBLISH_SYSTEM_OPTIONS'), '前端不再写死苏尔南发布选项')
|
||||
assert.ok(!utils.includes('DEFAULT_SPEC_FIELDS'), '前端不再内置默认 5 个字段')
|
||||
assert.ok(utils.includes('SPEC_FIELD_TYPE_OPTIONS'), '字段类型选项必须集中维护')
|
||||
})
|
||||
|
||||
test('打手端发布表单:用苏尔南选项集 + 区服默认值,不引后台全量', () => {
|
||||
test('打手端发布表单:按寄卖配置动态渲规格,不再回退内置字段', () => {
|
||||
const source = readFileSync(
|
||||
new URL('../src/pages/worker/WorkerConsignmentPage.tsx', import.meta.url).pathname,
|
||||
'utf8',
|
||||
)
|
||||
assert.ok(source.includes('SURNAN_PUBLISH_SYSTEM_OPTIONS'))
|
||||
assert.ok(source.includes('SURNAN_PUBLISH_ZONE_OPTIONS'))
|
||||
assert.ok(source.includes('initialValue={SURNAN_DEFAULT_ZONE}'), '区服默认值要落到表单项上')
|
||||
assert.ok(source.includes('selectedSpecs.map'), '规格字段必须来自配置动态渲染')
|
||||
assert.ok(source.includes('config.specs'), '必须读取寄卖配置的 specs')
|
||||
assert.ok(!source.includes('DEFAULT_SPEC_FIELDS'), '空配置不能回退内置 5 项')
|
||||
assert.ok(source.includes('fetchWorkerConsignmentPricePreview'), '价格必须走动态预览接口')
|
||||
assert.ok(source.includes('buildSpecItemName'), '物品名必须按名称模板生成')
|
||||
assert.ok(!source.includes('[...CONSIGNMENT_'), '发布端不直接引用后台全量选项')
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user