import React from 'react'; import './dialog.less'; import { ProductDisplayPresetKey } from './components/ProductDisplayAdapter/types'; import { BaseResponsiveProps } from '../../responsive/type'; /** * 新建模式配置,与 order_id 互斥。 * 外部预选好部分数据后通过此配置直接唤起卖票弹窗的新建流程。 */ interface CreateModeConfig { /** 预填充的 modalState 片段(客户、商品、日期等任意字段) */ initialModalState?: Record; /** 必传,决定商品类型和子类型 */ bookingConfigParams: Record; /** 商品展示配置,默认 'sku-list-a2' */ productDisplayConfig?: ProductDisplayPresetKey; /** 业务编码 */ businessCode?: string; /** 餐牌 ID 列表,存在且非空时覆盖 getProducts 的 menu_list_ids */ associated_menu_list_ids?: number[]; /** * 入口订单类型意图;存在时 `formatValues` 最终将 `values.type` 设为该值(如桌位单 `table-order`)。 */ order_type?: string; } interface TicketBookingDialogProps extends BaseResponsiveProps { open: boolean; order_id?: number; onClose?: () => void; callback?: (result: any) => void; rulesHooks: any; /** * 无 `order_id` 时为新建模式必填配置; * 与 `order_id` 并存时视为编辑模式的覆盖项(bookingConfigParams / productDisplayConfig / businessCode / 餐牌等)。 */ createModeConfig?: CreateModeConfig; title?: string; /** * 预加载/常驻模式开关。 * 开启后: * - dialog 关闭时不会把 `editData` 置空(保留 TicketBooking 子树挂载,pisellos 模块/store 不丢); * - `preloadedEditData` 非空且无 `order_id` 时,跳过 `createModeConfig` 的同步组装分支,直接复用外部传入的 editData; * - 拉取详情(edit 模式)完成后会通过 `onEditDataReady` 回调暴露 editData,调用方可缓存。 * * 旧调用方不传该 prop 时,行为完全不变。 * * @example * */ preloaded?: boolean; /** * 外部预先组装好的 new 模式 editData(一般由宿主 CachedEditBookingPlugin 在 mount 时构建)。 * 调用方应在每次 open 前把最新的 `initialModalState` merge 进 `editModeInitialState.modalState`,再把新引用传进来,触发 store 重建。 */ preloadedEditData?: InitData; /** * edit 模式拿到详情、组装完 editData 后回调,便于调用方记录或埋点。 */ onEditDataReady?: (data: InitData) => void; } /** * 初始化数据,传给 TicketBooking 用于 store 初始化。 * 编辑模式和新建模式共用同一结构,区别在于 editModeInitialState 内部字段。 */ export interface InitData { bookingConfigParams: Record; productDisplayConfig: ProductDisplayPresetKey; businessCode: string; editModeInitialState: Record; } declare const _default: React.ForwardRefExoticComponent>; export default _default;