feat(order-service): 支持自定义订单状态节点文案
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
-- 137_order_service_status_steps.sql
|
||||||
|
-- 客户订单状态进度的四个节点文案,可按分类独立配置。
|
||||||
|
|
||||||
|
ALTER TABLE order_service_profiles
|
||||||
|
ADD COLUMN IF NOT EXISTS status_steps_json JSONB NOT NULL DEFAULT '{}'::jsonb;
|
||||||
|
|
||||||
|
COMMENT ON COLUMN order_service_profiles.status_steps_json IS
|
||||||
|
'客户状态进度文案:submitted/scheduled/processing/completed 的 title 与 description';
|
||||||
@@ -13,6 +13,7 @@ export type OrderServiceProfileRow = {
|
|||||||
screenshots_json: Record<string, unknown>
|
screenshots_json: Record<string, unknown>
|
||||||
auto_publish_json: Record<string, unknown>
|
auto_publish_json: Record<string, unknown>
|
||||||
material_confirmation_json: Record<string, unknown>
|
material_confirmation_json: Record<string, unknown>
|
||||||
|
status_steps_json: Record<string, unknown>
|
||||||
submit_text: string
|
submit_text: string
|
||||||
success_text: string
|
success_text: string
|
||||||
post_submit_text: string
|
post_submit_text: string
|
||||||
@@ -101,6 +102,7 @@ export async function upsertOrderServiceProfile(input: {
|
|||||||
screenshots: Record<string, unknown>
|
screenshots: Record<string, unknown>
|
||||||
autoPublish: Record<string, unknown>
|
autoPublish: Record<string, unknown>
|
||||||
materialConfirmation: Record<string, unknown>
|
materialConfirmation: Record<string, unknown>
|
||||||
|
statusSteps: Record<string, unknown>
|
||||||
submitText: string
|
submitText: string
|
||||||
successText: string
|
successText: string
|
||||||
postSubmitText: string
|
postSubmitText: string
|
||||||
@@ -111,12 +113,12 @@ export async function upsertOrderServiceProfile(input: {
|
|||||||
INSERT INTO order_service_profiles (
|
INSERT INTO order_service_profiles (
|
||||||
category_id, name, title, description,
|
category_id, name, title, description,
|
||||||
guide_image_json, fields_json, screenshots_json, auto_publish_json,
|
guide_image_json, fields_json, screenshots_json, auto_publish_json,
|
||||||
material_confirmation_json,
|
material_confirmation_json, status_steps_json,
|
||||||
submit_text, success_text, post_submit_text, status, created_by_admin_user_id
|
submit_text, success_text, post_submit_text, status, created_by_admin_user_id
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4,
|
$1, $2, $3, $4,
|
||||||
$5::jsonb, $6::jsonb, $7::jsonb, $8::jsonb, $9::jsonb,
|
$5::jsonb, $6::jsonb, $7::jsonb, $8::jsonb, $9::jsonb, $10::jsonb,
|
||||||
$10, $11, $12, 'draft', $13
|
$11, $12, $13, 'draft', $14
|
||||||
)
|
)
|
||||||
ON CONFLICT (category_id) DO UPDATE SET
|
ON CONFLICT (category_id) DO UPDATE SET
|
||||||
name = EXCLUDED.name,
|
name = EXCLUDED.name,
|
||||||
@@ -127,6 +129,7 @@ export async function upsertOrderServiceProfile(input: {
|
|||||||
screenshots_json = EXCLUDED.screenshots_json,
|
screenshots_json = EXCLUDED.screenshots_json,
|
||||||
auto_publish_json = EXCLUDED.auto_publish_json,
|
auto_publish_json = EXCLUDED.auto_publish_json,
|
||||||
material_confirmation_json = EXCLUDED.material_confirmation_json,
|
material_confirmation_json = EXCLUDED.material_confirmation_json,
|
||||||
|
status_steps_json = EXCLUDED.status_steps_json,
|
||||||
submit_text = EXCLUDED.submit_text,
|
submit_text = EXCLUDED.submit_text,
|
||||||
success_text = EXCLUDED.success_text,
|
success_text = EXCLUDED.success_text,
|
||||||
post_submit_text = EXCLUDED.post_submit_text,
|
post_submit_text = EXCLUDED.post_submit_text,
|
||||||
@@ -148,6 +151,7 @@ export async function upsertOrderServiceProfile(input: {
|
|||||||
JSON.stringify(input.screenshots),
|
JSON.stringify(input.screenshots),
|
||||||
JSON.stringify(input.autoPublish),
|
JSON.stringify(input.autoPublish),
|
||||||
JSON.stringify(input.materialConfirmation),
|
JSON.stringify(input.materialConfirmation),
|
||||||
|
JSON.stringify(input.statusSteps),
|
||||||
input.submitText,
|
input.submitText,
|
||||||
input.successText,
|
input.successText,
|
||||||
input.postSubmitText,
|
input.postSubmitText,
|
||||||
|
|||||||
@@ -94,6 +94,31 @@ test('订单服务提交后说明:旧配置使用默认文案,新配置支
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('客户状态进度:四个节点支持独立标题和说明,旧配置使用默认文案', () => {
|
||||||
|
assert.deepEqual(config().statusSteps, {
|
||||||
|
submitted: { title: '提交资料', description: '' },
|
||||||
|
scheduled: { title: '客服安排', description: '' },
|
||||||
|
processing: { title: '订单处理', description: '' },
|
||||||
|
completed: { title: '交付完成', description: '' },
|
||||||
|
})
|
||||||
|
assert.deepEqual(
|
||||||
|
config({
|
||||||
|
statusSteps: {
|
||||||
|
submitted: { title: '资料已交', description: '请保持联系方式畅通' },
|
||||||
|
scheduled: { title: '客服受理', description: '客服正在核对订单' },
|
||||||
|
processing: { title: '正在安排', description: '请耐心等待接单' },
|
||||||
|
completed: { title: '处理完成', description: '请检查邮箱' },
|
||||||
|
},
|
||||||
|
}).statusSteps,
|
||||||
|
{
|
||||||
|
submitted: { title: '资料已交', description: '请保持联系方式畅通' },
|
||||||
|
scheduled: { title: '客服受理', description: '客服正在核对订单' },
|
||||||
|
processing: { title: '正在安排', description: '请耐心等待接单' },
|
||||||
|
completed: { title: '处理完成', description: '请检查邮箱' },
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
test('订单服务提交确认:旧配置默认展示不可修改与资料错误免责声明', () => {
|
test('订单服务提交确认:旧配置默认展示不可修改与资料错误免责声明', () => {
|
||||||
const normalized = config()
|
const normalized = config()
|
||||||
assert.deepEqual(normalized.materialConfirmation, {
|
assert.deepEqual(normalized.materialConfirmation, {
|
||||||
|
|||||||
@@ -57,6 +57,13 @@ export type OrderServiceMaterialConfirmation = {
|
|||||||
cancelText: string
|
cancelText: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type OrderServiceStatusSteps = {
|
||||||
|
submitted: { title: string; description: string }
|
||||||
|
scheduled: { title: string; description: string }
|
||||||
|
processing: { title: string; description: string }
|
||||||
|
completed: { title: string; description: string }
|
||||||
|
}
|
||||||
|
|
||||||
export type OrderServiceProfileConfig = {
|
export type OrderServiceProfileConfig = {
|
||||||
name: string
|
name: string
|
||||||
title: string
|
title: string
|
||||||
@@ -66,6 +73,7 @@ export type OrderServiceProfileConfig = {
|
|||||||
screenshots: OrderServiceScreenshots
|
screenshots: OrderServiceScreenshots
|
||||||
autoPublish: OrderServiceAutoPublish
|
autoPublish: OrderServiceAutoPublish
|
||||||
materialConfirmation: OrderServiceMaterialConfirmation
|
materialConfirmation: OrderServiceMaterialConfirmation
|
||||||
|
statusSteps: OrderServiceStatusSteps
|
||||||
submitText: string
|
submitText: string
|
||||||
successText: string
|
successText: string
|
||||||
postSubmitText: string
|
postSubmitText: string
|
||||||
@@ -99,6 +107,13 @@ export const DEFAULT_ORDER_SERVICE_MATERIAL_CONFIRMATION: OrderServiceMaterialCo
|
|||||||
|
|
||||||
export const DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT = '资料提交后如需修改,请联系客服。'
|
export const DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT = '资料提交后如需修改,请联系客服。'
|
||||||
|
|
||||||
|
export const DEFAULT_ORDER_SERVICE_STATUS_STEPS: OrderServiceStatusSteps = {
|
||||||
|
submitted: { title: '提交资料', description: '' },
|
||||||
|
scheduled: { title: '客服安排', description: '' },
|
||||||
|
processing: { title: '订单处理', description: '' },
|
||||||
|
completed: { title: '交付完成', description: '' },
|
||||||
|
}
|
||||||
|
|
||||||
export async function listAdminOrderServiceProfiles() {
|
export async function listAdminOrderServiceProfiles() {
|
||||||
const [categories, profiles] = await Promise.all([
|
const [categories, profiles] = await Promise.all([
|
||||||
listAllWorkCategories(),
|
listAllWorkCategories(),
|
||||||
@@ -141,6 +156,7 @@ export async function saveAdminOrderServiceProfile(payload: JsonObject = {}) {
|
|||||||
const materialConfirmation = normalizeMaterialConfirmation(
|
const materialConfirmation = normalizeMaterialConfirmation(
|
||||||
payload.materialConfirmation ?? payload.material_confirmation_json,
|
payload.materialConfirmation ?? payload.material_confirmation_json,
|
||||||
)
|
)
|
||||||
|
const statusSteps = normalizeStatusSteps(payload.statusSteps ?? payload.status_steps_json)
|
||||||
const guideImage = normalizeGuideImage(payload.guideImage ?? payload.guide_image_json)
|
const guideImage = normalizeGuideImage(payload.guideImage ?? payload.guide_image_json)
|
||||||
const adminUserId = Number(payload.adminUserId ?? payload.admin_user_id ?? 0) || null
|
const adminUserId = Number(payload.adminUserId ?? payload.admin_user_id ?? 0) || null
|
||||||
|
|
||||||
@@ -154,6 +170,7 @@ export async function saveAdminOrderServiceProfile(payload: JsonObject = {}) {
|
|||||||
screenshots,
|
screenshots,
|
||||||
autoPublish,
|
autoPublish,
|
||||||
materialConfirmation,
|
materialConfirmation,
|
||||||
|
statusSteps,
|
||||||
submitText: text(payload.submitText, 30) || '提交资料',
|
submitText: text(payload.submitText, 30) || '提交资料',
|
||||||
successText: text(payload.successText, 80) || '资料已提交,请等待处理',
|
successText: text(payload.successText, 80) || '资料已提交,请等待处理',
|
||||||
postSubmitText: text(payload.postSubmitText, 500) || DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
postSubmitText: text(payload.postSubmitText, 500) || DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
||||||
@@ -233,6 +250,7 @@ function mapAdminProfile(row: OrderServiceProfileRow) {
|
|||||||
screenshots: row.screenshots_json,
|
screenshots: row.screenshots_json,
|
||||||
autoPublish: row.auto_publish_json,
|
autoPublish: row.auto_publish_json,
|
||||||
materialConfirmation: normalizeMaterialConfirmation(row.material_confirmation_json),
|
materialConfirmation: normalizeMaterialConfirmation(row.material_confirmation_json),
|
||||||
|
statusSteps: normalizeStatusSteps(row.status_steps_json),
|
||||||
submitText: row.submit_text,
|
submitText: row.submit_text,
|
||||||
successText: row.success_text,
|
successText: row.success_text,
|
||||||
postSubmitText: buildProfileConfig(row).postSubmitText,
|
postSubmitText: buildProfileConfig(row).postSubmitText,
|
||||||
@@ -253,6 +271,7 @@ export function buildProfileConfig(row: {
|
|||||||
screenshots_json: unknown
|
screenshots_json: unknown
|
||||||
auto_publish_json: unknown
|
auto_publish_json: unknown
|
||||||
material_confirmation_json: unknown
|
material_confirmation_json: unknown
|
||||||
|
status_steps_json: unknown
|
||||||
submit_text: string
|
submit_text: string
|
||||||
success_text: string
|
success_text: string
|
||||||
post_submit_text: string
|
post_submit_text: string
|
||||||
@@ -266,6 +285,7 @@ export function buildProfileConfig(row: {
|
|||||||
screenshots: normalizeScreenshots(row.screenshots_json),
|
screenshots: normalizeScreenshots(row.screenshots_json),
|
||||||
autoPublish: normalizeAutoPublish(row.auto_publish_json),
|
autoPublish: normalizeAutoPublish(row.auto_publish_json),
|
||||||
materialConfirmation: normalizeMaterialConfirmation(row.material_confirmation_json),
|
materialConfirmation: normalizeMaterialConfirmation(row.material_confirmation_json),
|
||||||
|
statusSteps: normalizeStatusSteps(row.status_steps_json),
|
||||||
submitText: row.submit_text || '提交资料',
|
submitText: row.submit_text || '提交资料',
|
||||||
successText: row.success_text || '资料已提交,请等待处理',
|
successText: row.success_text || '资料已提交,请等待处理',
|
||||||
postSubmitText: text(row.post_submit_text, 500) || DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
postSubmitText: text(row.post_submit_text, 500) || DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
||||||
@@ -319,6 +339,7 @@ export function normalizeProfileConfig(value: JsonObject): OrderServiceProfileCo
|
|||||||
screenshots: normalizeScreenshots(value.screenshots),
|
screenshots: normalizeScreenshots(value.screenshots),
|
||||||
autoPublish: normalizeAutoPublish(value.autoPublish),
|
autoPublish: normalizeAutoPublish(value.autoPublish),
|
||||||
materialConfirmation: normalizeMaterialConfirmation(value.materialConfirmation),
|
materialConfirmation: normalizeMaterialConfirmation(value.materialConfirmation),
|
||||||
|
statusSteps: normalizeStatusSteps(value.statusSteps),
|
||||||
submitText: text(value.submitText, 30) || '提交资料',
|
submitText: text(value.submitText, 30) || '提交资料',
|
||||||
successText: text(value.successText, 80) || '资料已提交,请等待处理',
|
successText: text(value.successText, 80) || '资料已提交,请等待处理',
|
||||||
postSubmitText: text(value.postSubmitText, 500) || DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
postSubmitText: text(value.postSubmitText, 500) || DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
||||||
@@ -417,6 +438,27 @@ function normalizeMaterialConfirmation(value: unknown): OrderServiceMaterialConf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeStatusSteps(value: unknown): OrderServiceStatusSteps {
|
||||||
|
const source = value && typeof value === 'object' ? (value as JsonObject) : {}
|
||||||
|
return {
|
||||||
|
submitted: normalizeStatusStep(source.submitted, DEFAULT_ORDER_SERVICE_STATUS_STEPS.submitted),
|
||||||
|
scheduled: normalizeStatusStep(source.scheduled, DEFAULT_ORDER_SERVICE_STATUS_STEPS.scheduled),
|
||||||
|
processing: normalizeStatusStep(
|
||||||
|
source.processing,
|
||||||
|
DEFAULT_ORDER_SERVICE_STATUS_STEPS.processing,
|
||||||
|
),
|
||||||
|
completed: normalizeStatusStep(source.completed, DEFAULT_ORDER_SERVICE_STATUS_STEPS.completed),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeStatusStep(value: unknown, fallback: { title: string; description: string }) {
|
||||||
|
const source = value && typeof value === 'object' ? (value as JsonObject) : {}
|
||||||
|
return {
|
||||||
|
title: text(source.title, 20) || fallback.title,
|
||||||
|
description: text(source.description, 80),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeGuideImage(value: unknown): Record<string, unknown> {
|
function normalizeGuideImage(value: unknown): Record<string, unknown> {
|
||||||
const normalized = normalizeUploadedFiles([value])[0]
|
const normalized = normalizeUploadedFiles([value])[0]
|
||||||
return normalized ? { ...normalized } : {}
|
return normalized ? { ...normalized } : {}
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import {
|
|||||||
import {
|
import {
|
||||||
DEFAULT_ORDER_SERVICE_MATERIAL_CONFIRMATION,
|
DEFAULT_ORDER_SERVICE_MATERIAL_CONFIRMATION,
|
||||||
DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
||||||
|
DEFAULT_ORDER_SERVICE_STATUS_STEPS,
|
||||||
|
getPublishedOrderServiceProfileSnapshotByCategory,
|
||||||
getOrderServiceProfileSnapshotByVersion,
|
getOrderServiceProfileSnapshotByVersion,
|
||||||
normalizeProfileConfig,
|
normalizeProfileConfig,
|
||||||
type OrderServiceField,
|
type OrderServiceField,
|
||||||
@@ -85,6 +87,7 @@ export type OrderServicePublicItem = {
|
|||||||
canSubmit: boolean
|
canSubmit: boolean
|
||||||
blockedReason: string
|
blockedReason: string
|
||||||
materialConfirmation?: OrderServiceProfileConfig['materialConfirmation']
|
materialConfirmation?: OrderServiceProfileConfig['materialConfirmation']
|
||||||
|
statusSteps: OrderServiceProfileConfig['statusSteps']
|
||||||
fields?: OrderServiceField[]
|
fields?: OrderServiceField[]
|
||||||
values?: Record<string, string>
|
values?: Record<string, string>
|
||||||
screenshots?: Array<Record<string, unknown>>
|
screenshots?: Array<Record<string, unknown>>
|
||||||
@@ -412,6 +415,9 @@ async function resolveTarget(platformOrderId: string, workOrderIdInput: unknown)
|
|||||||
async function mapPublicOrderItem(order: WorkOrderRow): Promise<OrderServicePublicItem> {
|
async function mapPublicOrderItem(order: WorkOrderRow): Promise<OrderServicePublicItem> {
|
||||||
const state = resolvePublicMaterialOrderState(order)
|
const state = resolvePublicMaterialOrderState(order)
|
||||||
const profile = await resolveProfileConfig(order)
|
const profile = await resolveProfileConfig(order)
|
||||||
|
const currentPresentationProfile = order.category_id
|
||||||
|
? await getPublishedOrderServiceProfileSnapshotByCategory(Number(order.category_id))
|
||||||
|
: null
|
||||||
const material = safeParseJson(order.material_json)
|
const material = safeParseJson(order.material_json)
|
||||||
const collect = material.collect && typeof material.collect === 'object' ? material.collect : {}
|
const collect = material.collect && typeof material.collect === 'object' ? material.collect : {}
|
||||||
const values = normalizeSubmittedFields(collect.fields || {})
|
const values = normalizeSubmittedFields(collect.fields || {})
|
||||||
@@ -434,7 +440,10 @@ async function mapPublicOrderItem(order: WorkOrderRow): Promise<OrderServicePubl
|
|||||||
description: profile?.description || '',
|
description: profile?.description || '',
|
||||||
submitText: profile?.submitText || '提交资料',
|
submitText: profile?.submitText || '提交资料',
|
||||||
successText: profile?.successText || '资料已提交,请等待处理',
|
successText: profile?.successText || '资料已提交,请等待处理',
|
||||||
postSubmitText: profile?.postSubmitText || DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
postSubmitText:
|
||||||
|
currentPresentationProfile?.config.postSubmitText ||
|
||||||
|
profile?.postSubmitText ||
|
||||||
|
DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
||||||
state: order.status,
|
state: order.status,
|
||||||
stateLabel: resolveOrderServiceStatusLabel(order.status, state.statusLabel),
|
stateLabel: resolveOrderServiceStatusLabel(order.status, state.statusLabel),
|
||||||
message: resolveOrderServiceStatusMessage({
|
message: resolveOrderServiceStatusMessage({
|
||||||
@@ -451,6 +460,10 @@ async function mapPublicOrderItem(order: WorkOrderRow): Promise<OrderServicePubl
|
|||||||
...(profile?.materialConfirmation
|
...(profile?.materialConfirmation
|
||||||
? { materialConfirmation: profile.materialConfirmation }
|
? { materialConfirmation: profile.materialConfirmation }
|
||||||
: {}),
|
: {}),
|
||||||
|
statusSteps:
|
||||||
|
currentPresentationProfile?.config.statusSteps ||
|
||||||
|
profile?.statusSteps ||
|
||||||
|
DEFAULT_ORDER_SERVICE_STATUS_STEPS,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!state.canSubmit) return base
|
if (!state.canSubmit) return base
|
||||||
@@ -512,6 +525,7 @@ async function resolveProfileConfig(
|
|||||||
},
|
},
|
||||||
autoPublish: { enabled: false, requireVoucherConsume: true, retryMax: 3 },
|
autoPublish: { enabled: false, requireVoucherConsume: true, retryMax: 3 },
|
||||||
materialConfirmation: DEFAULT_ORDER_SERVICE_MATERIAL_CONFIRMATION,
|
materialConfirmation: DEFAULT_ORDER_SERVICE_MATERIAL_CONFIRMATION,
|
||||||
|
statusSteps: DEFAULT_ORDER_SERVICE_STATUS_STEPS,
|
||||||
submitText: '提交资料',
|
submitText: '提交资料',
|
||||||
successText: '资料已提交,请等待处理',
|
successText: '资料已提交,请等待处理',
|
||||||
postSubmitText: DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
postSubmitText: DEFAULT_ORDER_SERVICE_POST_SUBMIT_TEXT,
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import {
|
|||||||
type AdminOrderServiceProfile,
|
type AdminOrderServiceProfile,
|
||||||
type OrderServiceField,
|
type OrderServiceField,
|
||||||
type OrderServiceMaterialConfirmation,
|
type OrderServiceMaterialConfirmation,
|
||||||
|
type OrderServiceStatusSteps,
|
||||||
} from '@/services/admin/worker-platform'
|
} from '@/services/admin/worker-platform'
|
||||||
import { uploadFile } from '@/services/files'
|
import { uploadFile } from '@/services/files'
|
||||||
import type { UploadedFile } from '@/types/worker-platform'
|
import type { UploadedFile } from '@/types/worker-platform'
|
||||||
@@ -76,6 +77,7 @@ type OrderServiceFormValues = {
|
|||||||
screenshots: ScreenshotForm
|
screenshots: ScreenshotForm
|
||||||
autoPublish: AutoPublishForm
|
autoPublish: AutoPublishForm
|
||||||
materialConfirmation: OrderServiceMaterialConfirmation
|
materialConfirmation: OrderServiceMaterialConfirmation
|
||||||
|
statusSteps: OrderServiceStatusSteps
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_SCREENSHOTS: ScreenshotForm = {
|
const DEFAULT_SCREENSHOTS: ScreenshotForm = {
|
||||||
@@ -104,6 +106,23 @@ const DEFAULT_MATERIAL_CONFIRMATION: OrderServiceMaterialConfirmation = {
|
|||||||
|
|
||||||
const DEFAULT_POST_SUBMIT_TEXT = '资料提交后如需修改,请联系客服。'
|
const DEFAULT_POST_SUBMIT_TEXT = '资料提交后如需修改,请联系客服。'
|
||||||
|
|
||||||
|
const DEFAULT_STATUS_STEPS: OrderServiceStatusSteps = {
|
||||||
|
submitted: { title: '提交资料', description: '' },
|
||||||
|
scheduled: { title: '客服安排', description: '' },
|
||||||
|
processing: { title: '订单处理', description: '' },
|
||||||
|
completed: { title: '交付完成', description: '' },
|
||||||
|
}
|
||||||
|
|
||||||
|
const STATUS_STEP_OPTIONS: Array<{
|
||||||
|
key: keyof OrderServiceStatusSteps
|
||||||
|
label: string
|
||||||
|
}> = [
|
||||||
|
{ key: 'submitted', label: '第 1 步 · 提交资料' },
|
||||||
|
{ key: 'scheduled', label: '第 2 步 · 客服安排' },
|
||||||
|
{ key: 'processing', label: '第 3 步 · 订单处理' },
|
||||||
|
{ key: 'completed', label: '第 4 步 · 交付完成' },
|
||||||
|
]
|
||||||
|
|
||||||
type FieldPreset = Omit<OrderServiceField, 'sortOrder'>
|
type FieldPreset = Omit<OrderServiceField, 'sortOrder'>
|
||||||
|
|
||||||
const FIELD_PRESETS: Record<string, FieldPreset> = {
|
const FIELD_PRESETS: Record<string, FieldPreset> = {
|
||||||
@@ -287,6 +306,7 @@ export default function OrderServicePanel() {
|
|||||||
screenshots: nextProfile?.screenshots || DEFAULT_SCREENSHOTS,
|
screenshots: nextProfile?.screenshots || DEFAULT_SCREENSHOTS,
|
||||||
autoPublish: nextProfile?.autoPublish || DEFAULT_AUTO_PUBLISH,
|
autoPublish: nextProfile?.autoPublish || DEFAULT_AUTO_PUBLISH,
|
||||||
materialConfirmation: nextProfile?.materialConfirmation || DEFAULT_MATERIAL_CONFIRMATION,
|
materialConfirmation: nextProfile?.materialConfirmation || DEFAULT_MATERIAL_CONFIRMATION,
|
||||||
|
statusSteps: nextProfile?.statusSteps || DEFAULT_STATUS_STEPS,
|
||||||
})
|
})
|
||||||
setFields(
|
setFields(
|
||||||
normalizeFieldOrder(
|
normalizeFieldOrder(
|
||||||
@@ -395,6 +415,7 @@ export default function OrderServicePanel() {
|
|||||||
screenshots: values.screenshots,
|
screenshots: values.screenshots,
|
||||||
autoPublish: values.autoPublish,
|
autoPublish: values.autoPublish,
|
||||||
materialConfirmation: values.materialConfirmation,
|
materialConfirmation: values.materialConfirmation,
|
||||||
|
statusSteps: values.statusSteps,
|
||||||
submitText: values.submitText,
|
submitText: values.submitText,
|
||||||
successText: values.successText,
|
successText: values.successText,
|
||||||
postSubmitText: values.postSubmitText,
|
postSubmitText: values.postSubmitText,
|
||||||
@@ -687,6 +708,39 @@ export default function OrderServicePanel() {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section className="order-service-section">
|
||||||
|
<div className="order-service-section-head">
|
||||||
|
<div>
|
||||||
|
<Text strong>客户状态进度文案</Text>
|
||||||
|
<Text type="secondary">
|
||||||
|
四个节点独立展示;标题保持简短,补充说明可填写引导文案。
|
||||||
|
</Text>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="order-service-status-step-grid">
|
||||||
|
{STATUS_STEP_OPTIONS.map((step) => (
|
||||||
|
<div className="order-service-status-step-card" key={step.key}>
|
||||||
|
<Text strong>{step.label}</Text>
|
||||||
|
<Form.Item
|
||||||
|
label="节点标题"
|
||||||
|
name={['statusSteps', step.key, 'title']}
|
||||||
|
rules={[
|
||||||
|
{ required: true, whitespace: true, message: '请填写节点标题' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input maxLength={20} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label="补充说明"
|
||||||
|
name={['statusSteps', step.key, 'description']}
|
||||||
|
>
|
||||||
|
<Input maxLength={80} placeholder="选填,显示在节点标题下方" />
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section className="order-service-section">
|
<section className="order-service-section">
|
||||||
<div className="order-service-section-head">
|
<div className="order-service-section-head">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -51,12 +51,12 @@ const STATUS_STEP_INDEX: Record<string, number> = {
|
|||||||
accepted: 3,
|
accepted: 3,
|
||||||
problem: 2,
|
problem: 2,
|
||||||
}
|
}
|
||||||
const STATUS_STEP_ITEMS = [
|
const DEFAULT_STATUS_STEPS: OrderServiceItem['statusSteps'] = {
|
||||||
{ title: '提交资料' },
|
submitted: { title: '提交资料', description: '' },
|
||||||
{ title: '客服安排' },
|
scheduled: { title: '客服安排', description: '' },
|
||||||
{ title: '订单处理' },
|
processing: { title: '订单处理', description: '' },
|
||||||
{ title: '交付完成' },
|
completed: { title: '交付完成', description: '' },
|
||||||
]
|
}
|
||||||
const STATUS_TAG_COLORS: Record<string, string> = {
|
const STATUS_TAG_COLORS: Record<string, string> = {
|
||||||
pending_material: 'orange',
|
pending_material: 'orange',
|
||||||
unassigned: 'blue',
|
unassigned: 'blue',
|
||||||
@@ -399,6 +399,7 @@ function OrderServiceStatusCard({ item }: { item: OrderServiceItem }) {
|
|||||||
].filter((row): row is { label: string; value: string } => Boolean(row?.value))
|
].filter((row): row is { label: string; value: string } => Boolean(row?.value))
|
||||||
const acceptanceImageUrls = item.acceptanceImageUrls || []
|
const acceptanceImageUrls = item.acceptanceImageUrls || []
|
||||||
const showSteps = item.state !== 'cancelled'
|
const showSteps = item.state !== 'cancelled'
|
||||||
|
const statusSteps = item.statusSteps || DEFAULT_STATUS_STEPS
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card size="small" className="collect-link-status-card">
|
<Card size="small" className="collect-link-status-card">
|
||||||
@@ -412,7 +413,24 @@ function OrderServiceStatusCard({ item }: { item: OrderServiceItem }) {
|
|||||||
<Steps
|
<Steps
|
||||||
className="collect-link-status-steps"
|
className="collect-link-status-steps"
|
||||||
current={currentStep}
|
current={currentStep}
|
||||||
items={STATUS_STEP_ITEMS}
|
items={[
|
||||||
|
{
|
||||||
|
title: statusSteps.submitted.title,
|
||||||
|
description: statusSteps.submitted.description || undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: statusSteps.scheduled.title,
|
||||||
|
description: statusSteps.scheduled.description || undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: statusSteps.processing.title,
|
||||||
|
description: statusSteps.processing.description || undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: statusSteps.completed.title,
|
||||||
|
description: statusSteps.completed.description || undefined,
|
||||||
|
},
|
||||||
|
]}
|
||||||
responsive
|
responsive
|
||||||
size="small"
|
size="small"
|
||||||
status={
|
status={
|
||||||
|
|||||||
@@ -1129,6 +1129,13 @@ export type OrderServiceMaterialConfirmation = {
|
|||||||
cancelText: string
|
cancelText: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type OrderServiceStatusSteps = {
|
||||||
|
submitted: { title: string; description: string }
|
||||||
|
scheduled: { title: string; description: string }
|
||||||
|
processing: { title: string; description: string }
|
||||||
|
completed: { title: string; description: string }
|
||||||
|
}
|
||||||
|
|
||||||
export type AdminOrderServiceProfile = {
|
export type AdminOrderServiceProfile = {
|
||||||
id: number
|
id: number
|
||||||
categoryId: number
|
categoryId: number
|
||||||
@@ -1151,6 +1158,7 @@ export type AdminOrderServiceProfile = {
|
|||||||
retryMax: number
|
retryMax: number
|
||||||
}
|
}
|
||||||
materialConfirmation: OrderServiceMaterialConfirmation
|
materialConfirmation: OrderServiceMaterialConfirmation
|
||||||
|
statusSteps: OrderServiceStatusSteps
|
||||||
submitText: string
|
submitText: string
|
||||||
successText: string
|
successText: string
|
||||||
postSubmitText: string
|
postSubmitText: string
|
||||||
@@ -1199,6 +1207,7 @@ export function saveAdminOrderServiceProfile(payload: {
|
|||||||
retryMax: number
|
retryMax: number
|
||||||
}
|
}
|
||||||
materialConfirmation: OrderServiceMaterialConfirmation
|
materialConfirmation: OrderServiceMaterialConfirmation
|
||||||
|
statusSteps: OrderServiceStatusSteps
|
||||||
submitText?: string
|
submitText?: string
|
||||||
successText?: string
|
successText?: string
|
||||||
postSubmitText?: string
|
postSubmitText?: string
|
||||||
|
|||||||
@@ -585,6 +585,13 @@ export type OrderServiceMaterialConfirmation = {
|
|||||||
cancelText: string
|
cancelText: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type OrderServiceStatusSteps = {
|
||||||
|
submitted: { title: string; description: string }
|
||||||
|
scheduled: { title: string; description: string }
|
||||||
|
processing: { title: string; description: string }
|
||||||
|
completed: { title: string; description: string }
|
||||||
|
}
|
||||||
|
|
||||||
export type OrderServiceItem = {
|
export type OrderServiceItem = {
|
||||||
workOrderId: number
|
workOrderId: number
|
||||||
productName: string
|
productName: string
|
||||||
@@ -600,6 +607,7 @@ export type OrderServiceItem = {
|
|||||||
canSubmit: boolean
|
canSubmit: boolean
|
||||||
blockedReason: '' | 'already_submitted' | 'status' | 'assigned' | 'shares'
|
blockedReason: '' | 'already_submitted' | 'status' | 'assigned' | 'shares'
|
||||||
materialConfirmation?: OrderServiceMaterialConfirmation
|
materialConfirmation?: OrderServiceMaterialConfirmation
|
||||||
|
statusSteps: OrderServiceStatusSteps
|
||||||
fields?: OrderServiceField[]
|
fields?: OrderServiceField[]
|
||||||
values?: Record<string, string>
|
values?: Record<string, string>
|
||||||
screenshots?: UploadedFile[]
|
screenshots?: UploadedFile[]
|
||||||
|
|||||||
@@ -1843,6 +1843,25 @@
|
|||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.order-service-status-step-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-service-status-step-card {
|
||||||
|
display: grid;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 12px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #e5eaf1;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-service-status-step-card .ant-form-item {
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.order-service-confirmation-preview {
|
.order-service-confirmation-preview {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
@@ -2083,7 +2102,8 @@
|
|||||||
|
|
||||||
.order-service-field-extra,
|
.order-service-field-extra,
|
||||||
.order-service-switch-grid,
|
.order-service-switch-grid,
|
||||||
.order-service-switch-grid.is-auto-publish {
|
.order-service-switch-grid.is-auto-publish,
|
||||||
|
.order-service-status-step-grid {
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2096,4 +2116,8 @@
|
|||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
grid-row: auto;
|
grid-row: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.order-service-status-step-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -534,6 +534,13 @@
|
|||||||
font-size: 12px !important;
|
font-size: 12px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.collect-link-status-steps .ant-steps-item-description {
|
||||||
|
max-width: 140px;
|
||||||
|
font-size: 11px !important;
|
||||||
|
line-height: 1.45;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
.collect-link-status-message {
|
.collect-link-status-message {
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
color: #475569;
|
color: #475569;
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ work_orders.service_profile_snapshot_json
|
|||||||
- 图片截图规则,必填时最少 1 张。
|
- 图片截图规则,必填时最少 1 张。
|
||||||
- 提交后禁止再次修改。
|
- 提交后禁止再次修改。
|
||||||
- 客户页底部可配置多行“提交后说明”,旧配置默认显示资料修改需联系客服。
|
- 客户页底部可配置多行“提交后说明”,旧配置默认显示资料修改需联系客服。
|
||||||
|
- 客户状态进度固定为四个节点,每个节点支持独立标题和补充说明。
|
||||||
- 每 15 秒、页面重新可见或窗口重新聚焦时刷新状态。
|
- 每 15 秒、页面重新可见或窗口重新聚焦时刷新状态。
|
||||||
|
|
||||||
客户状态文案:
|
客户状态文案:
|
||||||
|
|||||||
Reference in New Issue
Block a user