@pisell/pisellos 2.2.162 → 2.2.164

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 (116) hide show
  1. package/dist/modules/BookingContext/index.d.ts +37 -0
  2. package/dist/modules/BookingContext/index.js +436 -0
  3. package/dist/modules/BookingContext/types.d.ts +102 -0
  4. package/dist/modules/BookingContext/types.js +51 -0
  5. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  6. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +157 -0
  7. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  8. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +107 -0
  9. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
  10. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +191 -0
  11. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  12. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  13. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  14. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  15. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  16. package/dist/modules/BookingContext/utils/index.js +11 -0
  17. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  18. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  19. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  20. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  21. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  22. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  23. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  24. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  25. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  26. package/dist/modules/BookingContext/utils/resources.js +486 -0
  27. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  28. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  29. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  30. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  31. package/dist/modules/Customer/index.js +23 -22
  32. package/dist/modules/Discount/index.js +4 -3
  33. package/dist/modules/Order/index.d.ts +17 -6
  34. package/dist/modules/Order/index.js +474 -287
  35. package/dist/modules/Order/types.d.ts +32 -12
  36. package/dist/modules/Order/utils.js +9 -8
  37. package/dist/modules/SalesSummary/index.js +4 -2
  38. package/dist/modules/index.d.ts +1 -0
  39. package/dist/modules/index.js +2 -1
  40. package/dist/solution/BaseSales/index.d.ts +38 -7
  41. package/dist/solution/BaseSales/index.js +797 -310
  42. package/dist/solution/BaseSales/types.d.ts +48 -1
  43. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  44. package/dist/solution/BaseSales/utils/quotationPrice.js +159 -0
  45. package/dist/solution/BookingByStep/index.d.ts +2 -2
  46. package/dist/solution/BookingTicket/index.d.ts +121 -1
  47. package/dist/solution/BookingTicket/index.js +401 -72
  48. package/dist/solution/BookingTicket/types.d.ts +2 -0
  49. package/dist/solution/BookingTicket/types.js +3 -0
  50. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
  51. package/dist/solution/BookingTicket/utils/addProductDecision.js +326 -0
  52. package/dist/solution/ScanOrder/index.d.ts +9 -3
  53. package/dist/solution/ScanOrder/index.js +231 -128
  54. package/dist/solution/VenueBooking/index.d.ts +4 -2
  55. package/dist/solution/VenueBooking/index.js +103 -55
  56. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  57. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  58. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  59. package/lib/modules/BookingContext/index.d.ts +37 -0
  60. package/lib/modules/BookingContext/index.js +297 -0
  61. package/lib/modules/BookingContext/types.d.ts +102 -0
  62. package/lib/modules/BookingContext/types.js +34 -0
  63. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  64. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +174 -0
  65. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  66. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +115 -0
  67. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
  68. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +177 -0
  69. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  70. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  71. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  72. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  73. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  74. package/lib/modules/BookingContext/utils/index.js +43 -0
  75. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  76. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  77. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  78. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  79. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  80. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  81. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  82. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  83. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  84. package/lib/modules/BookingContext/utils/resources.js +377 -0
  85. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  86. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  87. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  88. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  89. package/lib/modules/Customer/index.js +8 -8
  90. package/lib/modules/Discount/index.js +5 -1
  91. package/lib/modules/Order/index.d.ts +17 -6
  92. package/lib/modules/Order/index.js +164 -68
  93. package/lib/modules/Order/types.d.ts +32 -12
  94. package/lib/modules/Order/utils.js +8 -6
  95. package/lib/modules/SalesSummary/index.js +4 -2
  96. package/lib/modules/index.d.ts +1 -0
  97. package/lib/modules/index.js +3 -1
  98. package/lib/solution/BaseSales/index.d.ts +38 -7
  99. package/lib/solution/BaseSales/index.js +304 -14
  100. package/lib/solution/BaseSales/types.d.ts +48 -1
  101. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  102. package/lib/solution/BaseSales/utils/quotationPrice.js +201 -0
  103. package/lib/solution/BookingByStep/index.d.ts +2 -2
  104. package/lib/solution/BookingTicket/index.d.ts +121 -1
  105. package/lib/solution/BookingTicket/index.js +207 -2
  106. package/lib/solution/BookingTicket/types.d.ts +2 -0
  107. package/lib/solution/BookingTicket/types.js +6 -0
  108. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
  109. package/lib/solution/BookingTicket/utils/addProductDecision.js +300 -0
  110. package/lib/solution/ScanOrder/index.d.ts +9 -3
  111. package/lib/solution/ScanOrder/index.js +147 -66
  112. package/lib/solution/VenueBooking/index.d.ts +4 -2
  113. package/lib/solution/VenueBooking/index.js +50 -14
  114. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  115. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  116. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLoggerModule as BaseSalesLoggerModule, ScheduleModule } from '../../modules';
1
+ import { OrderModule, ProductList, QuotationModule, SalesSummaryModule, ScanOrderLoggerModule as BaseSalesLoggerModule, ScheduleModule } from '../../modules';
2
2
  import type { ScanOrderLogInput as BaseSalesLogInput, ScanOrderLoggerProviderConfig as BaseSalesLoggerProviderConfig, ScanOrderLoggerProviderType as BaseSalesLoggerProviderType } from '../../modules/ScanOrderLogger/types';
3
3
  import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
4
4
  /**
@@ -203,6 +203,52 @@ export interface BaseSalesSubmitPayload extends Omit<BaseSalesTempOrder, 'platfo
203
203
  }>;
204
204
  products: BaseSalesSubmitProduct[];
205
205
  }
206
+ export interface BaseSalesQuotationDurationConfig {
207
+ type: string;
208
+ value: number;
209
+ flexible_config?: {
210
+ is_enable_minimum_duration?: 0 | 1;
211
+ warning_threshold?: number;
212
+ block_threshold?: number;
213
+ };
214
+ }
215
+ export interface BaseSalesCalculateProductBookingPriceParams {
216
+ product: Record<string, any>;
217
+ booking?: {
218
+ start_date?: string;
219
+ start_time?: string;
220
+ end_date?: string;
221
+ end_time?: string;
222
+ [key: string]: any;
223
+ };
224
+ duration?: BaseSalesQuotationDurationConfig;
225
+ customer_id?: number | string;
226
+ fallback_price?: number | string;
227
+ datetime?: string;
228
+ channel?: string;
229
+ }
230
+ export type BaseSalesProductBookingPriceSegmentSource = 'quotation' | 'fallback';
231
+ export interface BaseSalesProductBookingPriceSegment {
232
+ start_datetime: string;
233
+ end_datetime?: string;
234
+ time_point: string;
235
+ unit_price: string;
236
+ quantity: number;
237
+ total_price: string;
238
+ quotation_shelf_id: number;
239
+ source: BaseSalesProductBookingPriceSegmentSource;
240
+ }
241
+ export interface BaseSalesProductBookingPriceResult {
242
+ product_id: number | null;
243
+ product_variant_id: number;
244
+ customer_id?: number | string;
245
+ unit_price: string;
246
+ total_price: string;
247
+ quantity: number;
248
+ duration?: BaseSalesQuotationDurationConfig;
249
+ quotation_shelf_id: number;
250
+ segments: BaseSalesProductBookingPriceSegment[];
251
+ }
206
252
  export type BaseSalesAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
207
253
  export interface BaseSalesTableFormRecord {
208
254
  policy?: string | null;
@@ -281,6 +327,7 @@ export interface BaseSalesState {
281
327
  error: string | null;
282
328
  products?: ProductList;
283
329
  order?: OrderModule;
330
+ quotation?: QuotationModule;
284
331
  salesSummary?: SalesSummaryModule;
285
332
  baseSalesLogger?: BaseSalesLoggerModule;
286
333
  schedule?: ScheduleModule;
@@ -0,0 +1,7 @@
1
+ import type { QuotationModule } from '../../../modules/Quotation';
2
+ import type { BaseSalesCalculateProductBookingPriceParams, BaseSalesProductBookingPriceResult } from '../types';
3
+ interface BuildBaseSalesQuotationPriceParams extends BaseSalesCalculateProductBookingPriceParams {
4
+ quotation?: Pick<QuotationModule, 'getPriceForProduct' | 'getQuotationShelfId'> | null;
5
+ }
6
+ export declare function calculateBaseSalesProductBookingPrice(params: BuildBaseSalesQuotationPriceParams): BaseSalesProductBookingPriceResult;
7
+ export {};
@@ -0,0 +1,159 @@
1
+ import dayjs from 'dayjs';
2
+ import Decimal from 'decimal.js';
3
+ function toFiniteNumber(value) {
4
+ var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
5
+ var parsedValue = Number(value);
6
+ if (!Number.isFinite(parsedValue)) return fallback;
7
+ return parsedValue;
8
+ }
9
+ function toPositiveInt(value) {
10
+ var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
11
+ var parsedValue = Math.floor(Number(value));
12
+ if (!Number.isFinite(parsedValue) || parsedValue < 1) return fallback;
13
+ return parsedValue;
14
+ }
15
+ function toPriceString(value) {
16
+ return new Decimal(Number(value) || 0).toDecimalPlaces(2).toFixed(2);
17
+ }
18
+ function normalizeDateTime(value) {
19
+ if (typeof value !== 'string' || !value.trim()) return null;
20
+ var normalized = value.includes(':') ? value : "".concat(value, " 00:00:00");
21
+ var datetime = dayjs(normalized);
22
+ if (!datetime.isValid()) return null;
23
+ return datetime;
24
+ }
25
+ function buildBookingDateTime(date, time) {
26
+ if (typeof date !== 'string' || !date.trim()) return null;
27
+ var timeText = typeof time === 'string' && time.trim() ? time.trim() : '00:00';
28
+ var datetime = dayjs("".concat(date.trim(), " ").concat(timeText));
29
+ if (!datetime.isValid()) return null;
30
+ return datetime;
31
+ }
32
+ function getDurationUnit(type) {
33
+ var normalizedType = String(type || '').toLowerCase();
34
+ if (normalizedType === 'day' || normalizedType === 'days') return 'day';
35
+ if (normalizedType === 'minute' || normalizedType === 'minutes') return 'minute';
36
+ return null;
37
+ }
38
+ function getProductId(product) {
39
+ var _product$product_id;
40
+ var productId = toFiniteNumber((_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id, NaN);
41
+ if (!Number.isFinite(productId)) return null;
42
+ return productId;
43
+ }
44
+ function getProductVariantId(product) {
45
+ var _product$product_vari;
46
+ var variantId = toFiniteNumber((_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id, 0);
47
+ if (!Number.isFinite(variantId) || variantId <= 0) return undefined;
48
+ return variantId;
49
+ }
50
+ function getFallbackPrice(params) {
51
+ var _ref, _ref2, _ref3, _params$fallback_pric;
52
+ var product = params.product || {};
53
+ return toPriceString((_ref = (_ref2 = (_ref3 = (_params$fallback_pric = params.fallback_price) !== null && _params$fallback_pric !== void 0 ? _params$fallback_pric : product.price) !== null && _ref3 !== void 0 ? _ref3 : product.selling_price) !== null && _ref2 !== void 0 ? _ref2 : product.original_price) !== null && _ref !== void 0 ? _ref : 0);
54
+ }
55
+ function getProductQuantity(product) {
56
+ var _product$num;
57
+ return toPositiveInt((_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity, 1);
58
+ }
59
+ function shouldSplitByDuration(duration, start, end) {
60
+ if (!duration) return false;
61
+ if (!start || !end || !end.isAfter(start)) return false;
62
+ var unit = getDurationUnit(duration.type);
63
+ var value = toFiniteNumber(duration.value);
64
+ return !!unit && value > 0;
65
+ }
66
+ function buildTimeSegments(params) {
67
+ var booking = params.booking || {};
68
+ var explicitDatetime = normalizeDateTime(params.datetime);
69
+ var bookingStart = buildBookingDateTime(booking.start_date, booking.start_time);
70
+ var start = bookingStart || explicitDatetime || dayjs();
71
+ var bookingEnd = buildBookingDateTime(booking.end_date, booking.end_time);
72
+ if (!shouldSplitByDuration(params.duration, start, bookingEnd)) {
73
+ return [{
74
+ start: start
75
+ }];
76
+ }
77
+ var unit = getDurationUnit(params.duration.type);
78
+ var value = toFiniteNumber(params.duration.value);
79
+ var segments = [];
80
+ var cursor = start;
81
+ var guard = 0;
82
+ while (cursor.isBefore(bookingEnd) && guard < 10000) {
83
+ var next = cursor.add(value, unit);
84
+ segments.push({
85
+ start: cursor,
86
+ end: next.isBefore(bookingEnd) ? next : bookingEnd !== null && bookingEnd !== void 0 ? bookingEnd : undefined
87
+ });
88
+ cursor = next;
89
+ guard += 1;
90
+ }
91
+ return segments.length ? segments : [{
92
+ start: start
93
+ }];
94
+ }
95
+ function formatTimePoint(datetime) {
96
+ return datetime.format('YYYY-MM-DD HH:mm:ss');
97
+ }
98
+ function buildPriceSegment(params) {
99
+ var timePoint = formatTimePoint(params.segment.start);
100
+ var quotedPrice = params.quotation && params.productId !== null ? params.quotation.getPriceForProduct({
101
+ productId: params.productId,
102
+ variantId: params.variantId,
103
+ datetime: timePoint,
104
+ customer_id: params.customerId
105
+ }) : null;
106
+ var unitPrice = toPriceString(quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : params.fallbackPrice);
107
+ var quotationShelfId = quotedPrice !== null && params.quotation && params.productId !== null ? params.quotation.getQuotationShelfId({
108
+ productId: params.productId,
109
+ variantId: params.variantId,
110
+ datetime: timePoint,
111
+ customer_id: params.customerId
112
+ }) : 0;
113
+ return {
114
+ start_datetime: timePoint,
115
+ end_datetime: params.segment.end ? formatTimePoint(params.segment.end) : undefined,
116
+ time_point: timePoint,
117
+ unit_price: unitPrice,
118
+ quantity: 1,
119
+ total_price: unitPrice,
120
+ quotation_shelf_id: quotationShelfId,
121
+ source: quotedPrice !== null ? 'quotation' : 'fallback'
122
+ };
123
+ }
124
+ export function calculateBaseSalesProductBookingPrice(params) {
125
+ var _segments$find;
126
+ var product = params.product || {};
127
+ var productId = getProductId(product);
128
+ var variantId = getProductVariantId(product);
129
+ var productQuantity = getProductQuantity(product);
130
+ var fallbackPrice = getFallbackPrice(params);
131
+ var segments = buildTimeSegments(params).map(function (segment) {
132
+ return buildPriceSegment({
133
+ quotation: params.quotation,
134
+ productId: productId,
135
+ variantId: variantId,
136
+ customerId: params.customer_id,
137
+ fallbackPrice: fallbackPrice,
138
+ segment: segment
139
+ });
140
+ });
141
+ var unitPrice = segments.reduce(function (total, segment) {
142
+ return total.plus(segment.total_price);
143
+ }, new Decimal(0));
144
+ var totalPrice = unitPrice.times(productQuantity);
145
+ var quotationShelfId = ((_segments$find = segments.find(function (segment) {
146
+ return segment.quotation_shelf_id;
147
+ })) === null || _segments$find === void 0 ? void 0 : _segments$find.quotation_shelf_id) || 0;
148
+ return {
149
+ product_id: productId,
150
+ product_variant_id: variantId !== null && variantId !== void 0 ? variantId : 0,
151
+ customer_id: params.customer_id,
152
+ unit_price: unitPrice.toDecimalPlaces(2).toFixed(2),
153
+ total_price: totalPrice.toDecimalPlaces(2).toFixed(2),
154
+ quantity: productQuantity,
155
+ duration: params.duration,
156
+ quotation_shelf_id: quotationShelfId,
157
+ segments: segments
158
+ };
159
+ }
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 1 | 5 | 4 | 2 | 3 | 6;
314
+ weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -330,7 +330,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
330
330
  count: number;
331
331
  left: number;
332
332
  summaryCount: number;
333
- status: "sold_out" | "lots_of_space" | "filling_up_fast";
333
+ status: "lots_of_space" | "filling_up_fast" | "sold_out";
334
334
  }[];
335
335
  /**
336
336
  * 找到多个资源的公共可用时间段
@@ -1,10 +1,15 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BookingTicketCartView, BookingTicketProductCatalogView, BookingTicketState, IGetCustomerListParams, ICustomer, ILoadProductsParams, ILoadProductDetailParams, IScanResult } from './types';
3
3
  import type { ProductData } from '../../modules';
4
+ import { type BookingContextConfig, type BookingContextDateInput, type BookingContextResource, type BookingContextResourceMap, type BookingContextState, type InitBookingContextParams, type LoadBookingConfigParams, type LoadBookingResourcesParams, type ResourceError, type BookingCalcContext } from '../../modules/BookingContext';
4
5
  import type { OrderCustomerView } from '../../modules/Order/types';
5
6
  import { BaseSalesImpl } from '../BaseSales';
6
7
  import type { ISalesDetail } from '../BaseSales/utils/parseSalesResponse';
7
8
  import type { LoadSalesDetailParams } from '../../modules/Order/types';
9
+ import { AddProductDecideContext, AddProductRequiresDetailPayload } from './utils/addProductDecision';
10
+ import { type BuildCacheItemFromOrderLineInput } from '../../modules/BookingContext/utils/buildCacheItemFromOrderLine';
11
+ import { type BuildNormalProductCacheItemFromOrderLineInput } from '../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine';
12
+ import type { AddProductBookingInput, OrderProduct, OrderProductIdentity, UpdateOrderProductParams } from '../../modules/Order/types';
8
13
  export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
9
14
  protected defaultName: string;
10
15
  protected defaultVersion: string;
@@ -17,9 +22,11 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
17
22
  private scan;
18
23
  private productCatalog;
19
24
  /**
20
- * 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer。
25
+ * 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext
26
+ * bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
21
27
  */
22
28
  protected getRegisteredModuleNames(): readonly string[];
29
+ protected getSubmitOrderSalesChannel(): string;
23
30
  /**
24
31
  * 业务侧子模块工厂:BookingTicket 自带的 createBookingTicketModule 优先匹配;
25
32
  * 未识别的模块名(如 BookingByStep 公共类型)回退到父类工厂。
@@ -186,6 +193,16 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
186
193
  * 清空下单客户(协议字段 + snapshot)。
187
194
  */
188
195
  clearOrderCustomer(): void;
196
+ /**
197
+ * 重置 tempOrder,并同步清空下单客户运行态。
198
+ *
199
+ * OrderModule.restoreOrder 会重建空单(customer_id 已为 null),但不会:
200
+ * - emit BookingTicket `onOrderCustomerChange`
201
+ * - 重置 CustomerModule.selectedCustomer(老路 getActiveCustomer)
202
+ *
203
+ * 因此在 super.restoreOrder 之后显式清客户,保证 SalesSdk / ticketBooking 订阅方与 tempOrder 一致。
204
+ */
205
+ restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
189
206
  /** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
190
207
  private buildOrderCustomerPayload;
191
208
  /**
@@ -291,6 +308,109 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
291
308
  * @returns 其他参数
292
309
  */
293
310
  getOtherParams(): Promise<Record<string, any>>;
311
+ /** 拉取 board config 并写入 BookingContext。 */
312
+ loadBookingConfig(params?: LoadBookingConfigParams): Promise<BookingContextConfig | null>;
313
+ /** 拉取资源全集并写入 BookingContext。 */
314
+ loadBookingResources(params?: LoadBookingResourcesParams): Promise<BookingContextResource[]>;
315
+ /** 初始化 BookingContext(date + config + resources)。 */
316
+ initBookingContext(params?: InitBookingContextParams): Promise<BookingContextState>;
317
+ /** 当前 store 是否已具备与入参等价的 config / resources(无需再请求接口)。 */
318
+ isBookingContextReady(params?: InitBookingContextParams): boolean;
319
+ /** 写入 booking config(来源:`/core/board/management/config`)。 */
320
+ setBookingConfig(config: BookingContextConfig | null): void;
321
+ /** 读取当前 booking config。 */
322
+ getBookingConfig(): BookingContextConfig | null;
323
+ /** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
324
+ setResources(resources: BookingContextResource[] | null | undefined): void;
325
+ /** 读取资源全集(浅克隆)。 */
326
+ getResourcesOrigin(): BookingContextResource[];
327
+ /** 读取资源全集 map(id → resource)。 */
328
+ getResourcesOriginMap(): BookingContextResourceMap;
329
+ /** 写入当前选择的日期;支持 dayjs / Date / string。 */
330
+ setBookingDate(date: BookingContextDateInput): void;
331
+ /** 读取当前选择的日期(统一 string)。 */
332
+ getBookingDate(): string | null;
333
+ /** 读取 BookingContext 完整 store(调试 / 测试 / 透传给 SDK 使用)。 */
334
+ getBookingContextState(): BookingContextState;
335
+ /** 清空 BookingContext(切租户 / destroy 场景)。 */
336
+ clearBookingContext(): void;
337
+ /**
338
+ * 构造 BookingContext 计算上下文(供 getProductExtend / getResourceByIds 等读 API 复用)。
339
+ */
340
+ private buildBookingCalcContext;
341
+ /**
342
+ * 取商品当前可选资源列表(透传 OS BookingContext utils#getResourceByIds)。
343
+ * `extraResources` 用于把拖入未绑定的资源也展示出来。
344
+ */
345
+ getResourcesForProduct(product: any, options?: {
346
+ extraResources?: Array<{
347
+ form_id: number | string;
348
+ id: number;
349
+ }>;
350
+ }): any[];
351
+ /**
352
+ * 拼装 cacheItem 的 _extend / _data(资源 / 容量 / timeObj),与 info2 `getProductExtend` 等价。
353
+ */
354
+ getProductExtend(cacheItem: any, extra?: Partial<BookingCalcContext>): any;
355
+ /**
356
+ * 取资源不可用原因列表(结构化 enum + params,i18n 文案由 UI 渲染)。
357
+ */
358
+ getResourceErrors(resource: any, cacheItem: any): ResourceError[];
359
+ /**
360
+ * 拼装 addProductDecision 通用上下文(从 store 自取)。
361
+ */
362
+ private buildAddProductCtx;
363
+ /**
364
+ * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
365
+ * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
366
+ */
367
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
368
+ /** 规格弹窗 callback 后的第二段决策。 */
369
+ decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
370
+ /**
371
+ * @deprecated 请用 `decideAddProduct`;`autoClose=true` 仅当 action=add。
372
+ */
373
+ decideAutoClose(item: any, options?: Partial<AddProductDecideContext>): {
374
+ autoClose: boolean;
375
+ cacheItem?: any;
376
+ };
377
+ /** 替代 info2 `getIsEject`:商品是否需要弹窗(0/1)。 */
378
+ getIsEject(item: any, type?: 'select' | 'detail'): 0 | 1;
379
+ /** 仅 session 商品(无 variant/option/package)→ true。 */
380
+ getIsOnlySession(item: any): boolean;
381
+ /**
382
+ * 拼装 requiresDetail payload(给 SDK 直接 return 给 UI 用)。
383
+ */
384
+ buildRequiresDetailPayload(item: any, options?: Partial<AddProductDecideContext>): AddProductRequiresDetailPayload;
385
+ /**
386
+ * 把 detail 弹窗回调结果(e, extension_type, detail)转换为 `(product, booking)` 入参。
387
+ * 内部会先拼 cacheItem,再走 cacheItemToBookingInput 严格协议对齐。
388
+ */
389
+ transformDetailToProductAndBooking(input: {
390
+ item: any;
391
+ cacheItem?: any;
392
+ detailResult?: {
393
+ e: any;
394
+ extension_type?: any;
395
+ detail?: any;
396
+ };
397
+ options?: Partial<AddProductDecideContext>;
398
+ }): {
399
+ product: Partial<OrderProduct> & OrderProductIdentity;
400
+ booking?: AddProductBookingInput;
401
+ cacheItem: any;
402
+ };
403
+ /**
404
+ * 从已加车的 order line + booking 反查资源编辑抽屉所需的 cacheItem。
405
+ * 供 SalesSdk「编辑资源」等场景使用;字段语义与 buildCacheItemFromDetail 产出对齐。
406
+ */
407
+ buildCacheItemFromOrderLine(input: BuildCacheItemFromOrderLineInput): Record<string, any>;
408
+ /**
409
+ * 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
410
+ */
411
+ buildNormalProductCacheItemFromOrderLine(input: BuildNormalProductCacheItemFromOrderLineInput): Record<string, any>;
412
+ /** 文档别名:与 OrderModule.updateOrderProduct 一致。 */
413
+ updateProductInOrder(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
294
414
  /**
295
415
  * 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
296
416
  * 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。