@pisell/pisellos 0.0.501 → 0.0.503

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/Order/index.d.ts +4 -0
  3. package/dist/modules/Order/index.js +23 -3
  4. package/dist/modules/Order/types.d.ts +9 -1
  5. package/dist/modules/Order/utils.d.ts +8 -1
  6. package/dist/modules/Order/utils.js +28 -12
  7. package/dist/solution/BookingByStep/index.d.ts +2 -2
  8. package/dist/solution/ScanOrder/index.d.ts +15 -0
  9. package/dist/solution/ScanOrder/index.js +653 -375
  10. package/dist/solution/ScanOrder/types.d.ts +9 -3
  11. package/dist/solution/VenueBooking/index.d.ts +28 -5
  12. package/dist/solution/VenueBooking/index.js +472 -234
  13. package/dist/solution/VenueBooking/types.d.ts +23 -0
  14. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -1
  15. package/dist/solution/VenueBooking/utils/dateSummary.js +1 -1
  16. package/dist/solution/VenueBooking/utils/resource.d.ts +11 -1
  17. package/dist/solution/VenueBooking/utils/resource.js +57 -21
  18. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +5 -0
  19. package/dist/solution/VenueBooking/utils/slotMerge.js +33 -12
  20. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -1
  21. package/dist/solution/VenueBooking/utils/timeSlot.js +259 -62
  22. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  23. package/lib/modules/Order/index.d.ts +4 -0
  24. package/lib/modules/Order/index.js +21 -8
  25. package/lib/modules/Order/types.d.ts +9 -1
  26. package/lib/modules/Order/utils.d.ts +8 -1
  27. package/lib/modules/Order/utils.js +23 -13
  28. package/lib/solution/BookingByStep/index.d.ts +2 -2
  29. package/lib/solution/ScanOrder/index.d.ts +15 -0
  30. package/lib/solution/ScanOrder/index.js +218 -10
  31. package/lib/solution/ScanOrder/types.d.ts +9 -3
  32. package/lib/solution/VenueBooking/index.d.ts +28 -5
  33. package/lib/solution/VenueBooking/index.js +204 -58
  34. package/lib/solution/VenueBooking/types.d.ts +23 -0
  35. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -1
  36. package/lib/solution/VenueBooking/utils/dateSummary.js +1 -1
  37. package/lib/solution/VenueBooking/utils/resource.d.ts +11 -1
  38. package/lib/solution/VenueBooking/utils/resource.js +15 -4
  39. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +5 -0
  40. package/lib/solution/VenueBooking/utils/slotMerge.js +29 -12
  41. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -1
  42. package/lib/solution/VenueBooking/utils/timeSlot.js +182 -43
  43. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType } from '../../modules';
1
+ import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType, ScheduleModule } from '../../modules';
2
2
  import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
3
3
  /**
4
4
  * 扫码下单流程 hook
@@ -114,6 +114,9 @@ export interface ScanOrderTempOrder {
114
114
  shop_discount: string;
115
115
  surcharge_fee: string;
116
116
  note: string;
117
+ buzzer?: string;
118
+ delivery_type?: string;
119
+ table_number?: Record<string, any>;
117
120
  schedule_date: string;
118
121
  created_at: string;
119
122
  products: ScanOrderOrderProduct[];
@@ -134,11 +137,11 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
134
137
  request_unique_idempotency_token?: string;
135
138
  form_record_ids?: Array<{
136
139
  form_id: number | string;
137
- form_record_ids: Array<number | string>;
140
+ form_record_id: number | string;
138
141
  }>;
139
142
  products: ScanOrderSubmitProduct[];
140
143
  }
141
- export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'resource_block' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
144
+ export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_block' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
142
145
  export interface ScanOrderTableFormRecord {
143
146
  policy?: string | null;
144
147
  partyroom_booking?: string | null;
@@ -151,6 +154,8 @@ export interface ScanOrderAvailabilityInfo {
151
154
  table_form_id?: string;
152
155
  deskmate_valid?: boolean;
153
156
  errorTips?: string;
157
+ /** 透传 `availability.closed_behavior`,便于 UI 识别拦截类型(如 show_menu_disabled) */
158
+ closed_behavior?: string;
154
159
  /** `/order/dining/table/config` 返回的 `table_form_record` 原样透出 */
155
160
  table_form_record?: ScanOrderTableFormRecord | null;
156
161
  policy?: string | null;
@@ -212,6 +217,7 @@ export interface ScanOrderState {
212
217
  order?: OrderModule;
213
218
  salesSummary?: SalesSummaryModule;
214
219
  scanOrderLogger?: ScanOrderLoggerModule;
220
+ schedule?: ScheduleModule;
215
221
  itemRuleQuantityLimits: QuantityLimitResult[];
216
222
  cartValidation: {
217
223
  passed: boolean | null;
@@ -92,25 +92,48 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
92
92
  /**
93
93
  * 切换单个时段的选中状态(选中/取消)。
94
94
  * 内部自动处理连续时段的合并与拆分,订单是唯一真相源。
95
+ *
96
+ * slot.productId 指定当前操作针对的是该 resourceId 下的哪一个商品。
97
+ * 同一资源下不同 productId 之间互相隔离,不会相互合并。
95
98
  */
96
99
  toggleSlot(slot: VenueSlotSelection): Promise<ScanOrderOrderProduct[]>;
97
100
  /**
98
101
  * 获取某资源当前选中的所有独立时段(从订单中解析)。
102
+ * 不传 productId 时返回该资源下所有商品的选中时段;传了则精确匹配。
99
103
  */
100
- getSelectedSlotsForResource(resourceId: number | string): VenueSlotSelection[];
104
+ getSelectedSlotsForResource(resourceId: number | string, productId?: number): VenueSlotSelection[];
105
+ /** getSelectedSlotsForResource 的 (resourceId, productId) 精确版,内部使用。 */
106
+ private getSelectedSlotsForResourceProduct;
101
107
  /**
102
108
  * 判断某个时段是否已选中。
109
+ * 不传 productId 时:只要该资源下任一商品在 startTime 被选中即返回 true;传了则精确匹配。
103
110
  */
104
- isSlotSelected(resourceId: number | string, startTime: string): boolean;
111
+ isSlotSelected(resourceId: number | string, startTime: string, productId?: number): boolean;
105
112
  /**
106
- * 获取所有已选时段(按资源分组)。
113
+ * 判断指定 (resourceId, productId, startTime) 格子是否应因其它已选项而被禁用。
114
+ * 规则:
115
+ * 1) 同一 resourceId 下若已选了另一个 productId 的同 startTime → 禁用
116
+ * 2) 当前 resource 是组合资源:若其任一 child resource 在 startTime 被选中 → 禁用
117
+ * 3) 当前 resource 是某些组合资源的 child:若该组合资源在 startTime 被选中 → 禁用
118
+ * 4) 两个组合资源的 child 集合有交集,且对方在该 startTime 被选中 → 禁用
119
+ */
120
+ isSlotDisabledBySelection(params: {
121
+ resourceId: number | string;
122
+ productId: number;
123
+ startTime: string;
124
+ }): boolean;
125
+ /**
126
+ * 获取所有已选时段(按资源分组)。每个 slot 上带 productId,便于 UI 做 per-product 判定。
107
127
  */
108
128
  getAllSelectedSlots(): Map<number | string, VenueSlotSelection[]>;
109
129
  /**
110
- * 对指定资源的订单商品进行 reconcile:
130
+ * 对指定 (resourceId, productId) 的订单商品进行 reconcile:
111
131
  * 清除旧商品 → 合并连续时段 → 重新写入。
132
+ * 同一场地下不同商品互不干扰,各自单独 reconcile。
112
133
  */
113
- private reconcileOrderForResource;
134
+ private reconcileOrderForResourceProduct;
135
+ /** 给定一个父 rawResource,返回其 combined_resource.resource_ids 对应的子 rawResource 列表。 */
136
+ private getCombinedChildRawResources;
114
137
  setSlotConfig(config: Partial<VenueBookingSlotConfig>): void;
115
138
  getSlotConfig(): VenueBookingSlotConfig;
116
139
  loadSchedules(): Promise<void>;