diff --git a/src/api/inbox/inbox.ts b/src/api/inbox/inbox.ts index f32b5de1..bd5b9904 100644 --- a/src/api/inbox/inbox.ts +++ b/src/api/inbox/inbox.ts @@ -193,7 +193,7 @@ export function inboxGroupDisable(data: InboxGroupDisableParams) { export interface InboxGroupUpdateParams { id: number // 群记录主键ID groupType?: string // 群类型:store(货主) / warehouse(仓库) / express(快递) - subType?: string // 群子类型:after_sales(售后) / finance(财务) / receiving(收货) + subType?: string // 群子类型,值取决于groupType。store→after_sales/finance/receiving。warehouse→receiving/production/stockout/finance/all/customer_service/exception。express→pickup/after_sales storeId?: number // 关联货主ID expressInterfaces?: number[] // 快递接口ID数组,仅groupType=express时生效 systemExpressCode?: string // 系统快递编码,groupType=express时必填 diff --git a/src/views/inbox/group/index.vue b/src/views/inbox/group/index.vue index ed892fba..9d137d08 100644 --- a/src/views/inbox/group/index.vue +++ b/src/views/inbox/group/index.vue @@ -148,11 +148,14 @@ - + - - - + @@ -244,12 +247,42 @@ import { safeInvoke } from '@/utils/safe-invoke' const groupTypeLabelMap: Record = { store: '货主群', warehouse: '仓库群', express: '快递群' } const groupTypeTagTypeMap: Record = { store: 'primary', warehouse: 'warning', express: 'success' } -const subTypeLabelMap: Record = { after_sales: '售后', finance: '财务', receiving: '收货' } +const subTypeLabelMap: Record = { + after_sales: '售后', finance: '财务', receiving: '收货', + production: '生产', stockout: '出库', all: '全体', customer_service: '客服', exception: '异常', + pickup: '揽收', +} function groupTypeLabel(t: string) { return groupTypeLabelMap[t] ?? t ?? '-' } function groupTypeTagType(t: string) { return groupTypeTagTypeMap[t] ?? 'info' } function subTypeLabel(s: string) { return subTypeLabelMap[s] ?? s ?? '-' } +/** 子类型选项,受群类型约束 */ +const subTypeConfigMap: Record> = { + store: [ + { label: '售后', value: 'after_sales' }, + { label: '财务', value: 'finance' }, + { label: '收货', value: 'receiving' }, + ], + warehouse: [ + { label: '收货', value: 'receiving' }, + { label: '生产', value: 'production' }, + { label: '出库', value: 'stockout' }, + { label: '财务', value: 'finance' }, + { label: '全体', value: 'all' }, + { label: '客服', value: 'customer_service' }, + { label: '异常', value: 'exception' }, + ], + express: [ + { label: '揽收', value: 'pickup' }, + { label: '售后', value: 'after_sales' }, + ], +} + +function getSubTypeOptions(groupType: string) { + return subTypeConfigMap[groupType] ?? [] +} + // ==================== 配置 ==================== const availableFields = groupAvailableFields @@ -484,6 +517,7 @@ function onSystemExpressCodeChange() { } function onEditGroupTypeChange() { + editForm.subType = '' if (editForm.groupType !== 'express') { editForm.expressInterfaces = []; editForm.systemExpressCode = '' } if (editForm.groupType !== 'store') editForm.storeId = null if (editForm.groupType === 'express') { loadExpressCodes(); loadExpressInterfacesByCode() } @@ -496,7 +530,7 @@ async function handleSubmitEdit() { try { const params: any = { id: editingRow.value.id } if (editForm.groupType) params.groupType = editForm.groupType - if (editForm.groupType !== 'express' && editForm.subType) params.subType = editForm.subType + if (editForm.subType) params.subType = editForm.subType if (editForm.groupType === 'store' && editForm.storeId) params.storeId = editForm.storeId if (editForm.groupType === 'express') { params.expressInterfaces = editForm.expressInterfaces; params.systemExpressCode = editForm.systemExpressCode } params.aiEnabled = editForm.aiEnabled