@pisell/pisellos 2.1.121 → 2.1.123

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.
@@ -598,24 +598,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
598
598
  case 58:
599
599
  this.injectScheduleResolverToQuotation();
600
600
  case 59:
601
- this.loadQuotations();
602
- _context6.next = 62;
601
+ _context6.next = 61;
603
602
  return this.refreshItemRuleQuantityLimits();
604
- case 62:
603
+ case 61:
605
604
  this.store.status = 'ready';
606
605
  console.log('[VenueBooking] 初始化完成');
607
- _context6.next = 66;
606
+ _context6.next = 65;
608
607
  return this.core.effects.emit(VenueBookingHooks.onInited, {
609
608
  status: this.store.status
610
609
  });
611
- case 66:
610
+ case 65:
612
611
  this.logMethodSuccess('initialize', {
613
612
  status: this.store.status
614
613
  });
615
- _context6.next = 76;
614
+ _context6.next = 75;
616
615
  break;
617
- case 69:
618
- _context6.prev = 69;
616
+ case 68:
617
+ _context6.prev = 68;
619
618
  _context6.t0 = _context6["catch"](49);
620
619
  this.store.status = 'error';
621
620
  this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : '初始化失败';
@@ -624,11 +623,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
624
623
  status: this.store.status
625
624
  });
626
625
  throw _context6.t0;
627
- case 76:
626
+ case 75:
628
627
  case "end":
629
628
  return _context6.stop();
630
629
  }
631
- }, _callee6, this, [[49, 69]]);
630
+ }, _callee6, this, [[49, 68]]);
632
631
  }));
633
632
  function initialize(_x5) {
634
633
  return _initialize.apply(this, arguments);
@@ -1964,7 +1963,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1964
1963
  key: "submitOrder",
1965
1964
  value: function () {
1966
1965
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1967
- var _tempOrder$products2, result, tempOrder;
1966
+ var _this$otherParams7, _this$otherParams8, _this$otherParams9, _this$otherParams10, _tempOrder$products2, result, tempOrder;
1968
1967
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1969
1968
  while (1) switch (_context24.prev = _context24.next) {
1970
1969
  case 0:
@@ -1981,7 +1980,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1981
1980
  case 6:
1982
1981
  _context24.next = 8;
1983
1982
  return this.store.order.submitTempOrder({
1984
- cacheId: this.cacheId
1983
+ cacheId: this.cacheId,
1984
+ platform: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.platform,
1985
+ businessCode: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.businessCode,
1986
+ channel: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel,
1987
+ type: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.type
1985
1988
  });
1986
1989
  case 8:
1987
1990
  result = _context24.sent;
@@ -2896,6 +2899,65 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2896
2899
  return this.otherParams;
2897
2900
  }
2898
2901
 
2902
+ // ─── UI 状态缓存(按 cacheId 分桶,sessionStorage) ───
2903
+ //
2904
+ // 用于物料层持久化 UI 层面的轻量状态(如当前步骤、登录回跳意图等)。
2905
+ // 桶键:pisell.venueBooking.uiState:<cacheId>;内部以 JSON object 形式存储多个字段。
2906
+ // 无 cacheId 时所有方法自动降级为 no-op,上层不用判空。
2907
+ }, {
2908
+ key: "getUIStateBucketKey",
2909
+ value: function getUIStateBucketKey() {
2910
+ if (!this.cacheId) return null;
2911
+ return "".concat(VenueBookingImpl.UI_STATE_KEY_PREFIX).concat(this.cacheId);
2912
+ }
2913
+ }, {
2914
+ key: "readUIStateBucket",
2915
+ value: function readUIStateBucket() {
2916
+ var _this$window;
2917
+ var key = this.getUIStateBucketKey();
2918
+ if (!key || !((_this$window = this.window) !== null && _this$window !== void 0 && _this$window.sessionStorage)) return {};
2919
+ try {
2920
+ var raw = this.window.sessionStorage.getItem(key) || '{}';
2921
+ var parsed = JSON.parse(raw);
2922
+ return parsed && _typeof(parsed) === 'object' ? parsed : {};
2923
+ } catch (_unused2) {
2924
+ return {};
2925
+ }
2926
+ }
2927
+ }, {
2928
+ key: "writeUIStateBucket",
2929
+ value: function writeUIStateBucket(bucket) {
2930
+ var _this$window2;
2931
+ var key = this.getUIStateBucketKey();
2932
+ if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.sessionStorage)) return;
2933
+ this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
2934
+ }
2935
+ }, {
2936
+ key: "setUIState",
2937
+ value: function setUIState(key, value) {
2938
+ if (!this.getUIStateBucketKey()) return;
2939
+ var bucket = this.readUIStateBucket();
2940
+ bucket[key] = value;
2941
+ this.writeUIStateBucket(bucket);
2942
+ }
2943
+ }, {
2944
+ key: "getUIState",
2945
+ value: function getUIState(key) {
2946
+ if (!this.getUIStateBucketKey()) return undefined;
2947
+ var bucket = this.readUIStateBucket();
2948
+ return bucket[key];
2949
+ }
2950
+ }, {
2951
+ key: "deleteUIState",
2952
+ value: function deleteUIState(key) {
2953
+ if (!this.getUIStateBucketKey()) return;
2954
+ var bucket = this.readUIStateBucket();
2955
+ if (key in bucket) {
2956
+ delete bucket[key];
2957
+ this.writeUIStateBucket(bucket);
2958
+ }
2959
+ }
2960
+
2899
2961
  // ─── OpenData 可用性 ───
2900
2962
  }, {
2901
2963
  key: "checkOpenDataAvailability",
@@ -2925,7 +2987,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2925
2987
  }
2926
2988
  return checkOpenDataAvailability;
2927
2989
  }()
2990
+ }, {
2991
+ key: "setOtherParams",
2992
+ value: function () {
2993
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
2994
+ var _ref7,
2995
+ _ref7$cover,
2996
+ cover,
2997
+ _args43 = arguments;
2998
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
2999
+ while (1) switch (_context43.prev = _context43.next) {
3000
+ case 0:
3001
+ _ref7 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
3002
+ if (cover) {
3003
+ this.otherParams = params;
3004
+ } else {
3005
+ this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
3006
+ }
3007
+ case 2:
3008
+ case "end":
3009
+ return _context43.stop();
3010
+ }
3011
+ }, _callee43, this);
3012
+ }));
3013
+ function setOtherParams(_x19) {
3014
+ return _setOtherParams.apply(this, arguments);
3015
+ }
3016
+ return setOtherParams;
3017
+ }()
2928
3018
  }]);
2929
3019
  return VenueBookingImpl;
2930
3020
  }(BaseModule);
2931
- _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3021
+ _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3022
+ _defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');
@@ -1,49 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/model/strategy/adapter/promotion/index.ts
30
- var promotion_exports = {};
31
- __export(promotion_exports, {
32
- BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
- PromotionAdapter: () => import_adapter.PromotionAdapter,
34
- PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
- X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
- default: () => import_adapter2.default
37
- });
38
- module.exports = __toCommonJS(promotion_exports);
39
- var import_evaluator = require("./evaluator");
40
- var import_adapter = require("./adapter");
41
- var import_adapter2 = __toESM(require("./adapter"));
42
- var import_examples = require("./examples");
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- BUY_X_GET_Y_FREE_STRATEGY,
46
- PromotionAdapter,
47
- PromotionEvaluator,
48
- X_ITEMS_FOR_Y_PRICE_STRATEGY
49
- });
@@ -76,6 +76,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
76
76
  removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
77
77
  submitTempOrder<T = any>(params?: {
78
78
  cacheId?: string;
79
+ platform?: string;
80
+ businessCode?: string;
81
+ channel?: string;
82
+ type?: string;
79
83
  }): Promise<T>;
80
84
  createOrder(params: CommitOrderParams['query']): {
81
85
  type: "virtual" | "appointment_booking";
@@ -108,4 +112,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
108
112
  createOrderByCheckout(params: CheckoutOrderParams): Promise<any>;
109
113
  submitScanOrder<T = any>(params: SubmitScanOrderParams): Promise<T>;
110
114
  scanOrderMore<T = any>(params: ScanOrderMoreParams): Promise<T>;
115
+ getOrderInfoByRemote(order_id: number): Promise<void>;
116
+ getLastOrderInfo(): Record<string, any> | undefined;
111
117
  }
@@ -487,7 +487,11 @@ var OrderModule = class extends import_BaseModule.BaseModule {
487
487
  const effectiveCacheId = (params == null ? void 0 : params.cacheId) ?? this.cacheId;
488
488
  const payload = (0, import_utils.buildSubmitPayload)({
489
489
  tempOrder,
490
- cacheId: effectiveCacheId
490
+ cacheId: effectiveCacheId,
491
+ platform: params == null ? void 0 : params.platform,
492
+ businessCode: params == null ? void 0 : params.businessCode,
493
+ channel: params == null ? void 0 : params.channel,
494
+ type: params == null ? void 0 : params.type
491
495
  });
492
496
  let result;
493
497
  if (tempOrder.order_id) {
@@ -728,6 +732,19 @@ var OrderModule = class extends import_BaseModule.BaseModule {
728
732
  };
729
733
  return this.request.put(fetchUrl, requestBody);
730
734
  }
735
+ // TODO 获取详情的接口
736
+ async getOrderInfoByRemote(order_id) {
737
+ const res = await this.request.get(`/order/sales/${order_id}`, {
738
+ with: ["products", "scheduleEvents"]
739
+ });
740
+ if (res.data.code === 200 && this.store.tempOrder) {
741
+ this.store.tempOrder.lastOrderInfo = res.data.data;
742
+ }
743
+ }
744
+ getLastOrderInfo() {
745
+ var _a, _b;
746
+ return (_b = (_a = this.store) == null ? void 0 : _a.tempOrder) == null ? void 0 : _b.lastOrderInfo;
747
+ }
731
748
  };
732
749
  // Annotate the CommonJS export names for ESM import in node:
733
750
  0 && (module.exports = {
@@ -212,6 +212,10 @@ export interface OrderModuleAPI {
212
212
  persistTempOrder: () => void;
213
213
  submitTempOrder: <T = any>(params?: {
214
214
  cacheId?: string;
215
+ platform?: string;
216
+ businessCode?: string;
217
+ channel?: string;
218
+ type?: string;
215
219
  }) => Promise<T>;
216
220
  loadDiscountConfig: (params: {
217
221
  customerId: number;
@@ -36,6 +36,10 @@ export declare function buildSubmitPayload(params: {
36
36
  tempOrder: ScanOrderTempOrder;
37
37
  cacheId?: string;
38
38
  now?: Date;
39
+ platform?: string;
40
+ businessCode?: string;
41
+ channel?: string;
42
+ type?: string;
39
43
  }): ScanOrderSubmitPayload;
40
44
  export declare function formatV1Product(products: ScanOrderSubmitProduct[]): {
41
45
  bundle: any[];
@@ -221,7 +221,15 @@ function createDefaultTempOrder(params) {
221
221
  };
222
222
  }
223
223
  function buildSubmitPayload(params) {
224
- const { tempOrder, cacheId, now = /* @__PURE__ */ new Date() } = params;
224
+ const {
225
+ tempOrder,
226
+ cacheId,
227
+ now = /* @__PURE__ */ new Date(),
228
+ platform,
229
+ businessCode,
230
+ channel,
231
+ type
232
+ } = params;
225
233
  const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
226
234
  const summary = tempOrder.summary || (0, import_utils.createEmptySummary)();
227
235
  const relationId = tempOrder.relation_id;
@@ -256,12 +264,12 @@ function buildSubmitPayload(params) {
256
264
  const { created_at: _createdAt, summary: _summary, surcharges: _surcharges, ...tempOrderRest } = tempOrder;
257
265
  return {
258
266
  ...tempOrderRest,
259
- platform: normalizeSubmitPlatform(tempOrder.platform),
267
+ platform: normalizeSubmitPlatform(platform ?? tempOrder.platform),
260
268
  request_unique_idempotency_token: cacheId,
261
- type: tempOrder.type || "table-order",
262
- business_code: tempOrder.business_code || "table-order",
269
+ type: type ?? tempOrder.type ?? "table-order",
270
+ business_code: businessCode ?? tempOrder.business_code ?? "table-order",
263
271
  sales_channel: tempOrder.sales_channel || "my_pisel",
264
- order_sales_channel: tempOrder.order_sales_channel || "online_store",
272
+ order_sales_channel: channel ?? tempOrder.order_sales_channel ?? "online_store",
265
273
  status: tempOrder.status || "normal",
266
274
  payment_status: tempOrder.payment_status || "payment_processing",
267
275
  // shipping_status: tempOrder.shipping_status || 'unfulfilled',
@@ -61,7 +61,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
61
61
  cacheId,
62
62
  with_schedule
63
63
  }) {
64
- var _a, _b;
64
+ var _a, _b, _c;
65
65
  let userPlugin = this.core.getPlugin("user");
66
66
  let customer_id = void 0;
67
67
  try {
@@ -95,7 +95,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
95
95
  with_count,
96
96
  // client_schedule_ids: schedule_ids,
97
97
  schedule_date,
98
- application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
98
+ application_code: ((_b = this.otherParams) == null ? void 0 : _b.channel) === "online_store" ? "online-store" : (_c = this.otherParams) == null ? void 0 : _c.channel,
99
99
  with_schedule,
100
100
  schedule_datetime,
101
101
  is_eject: 1
@@ -43,6 +43,9 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
43
43
  const query = {};
44
44
  if (params == null ? void 0 : params.channel)
45
45
  query.channel = params.channel;
46
+ if ((params == null ? void 0 : params.channel) === "online-store") {
47
+ query.channel = "online_store";
48
+ }
46
49
  const res = await this.request.get(
47
50
  "/quotation/available",
48
51
  query,
@@ -27,6 +27,8 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
27
27
  private itemRuleConfigsPromise;
28
28
  private itemRulePrefillApplied;
29
29
  private itemRuleRuntimeConfig;
30
+ /** 最近一次 checkResourceAvailable 从预约规则 link 拉取的商品快照 */
31
+ private enabledReservationRuleProducts;
30
32
  private getScanOrderLoggerContext;
31
33
  private serializeError;
32
34
  private addScanOrderLog;
@@ -37,6 +37,7 @@ var import_BaseModule = require("../../modules/BaseModule");
37
37
  var import_types = require("./types");
38
38
  var import_utils = require("./utils");
39
39
  var import_types2 = require("../BookingByStep/types");
40
+ var import_ProductList = require("../../modules/ProductList");
40
41
  var import_dayjs = __toESM(require("dayjs"));
41
42
  var import_itemRule = require("../../model/strategy/adapter/itemRule");
42
43
  __reExport(ScanOrder_exports, require("./types"), module.exports);
@@ -67,6 +68,8 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
67
68
  this.itemRuleConfigsPromise = null;
68
69
  this.itemRulePrefillApplied = false;
69
70
  this.itemRuleRuntimeConfig = {};
71
+ /** 最近一次 checkResourceAvailable 从预约规则 link 拉取的商品快照 */
72
+ this.enabledReservationRuleProducts = [];
70
73
  }
71
74
  getScanOrderLoggerContext() {
72
75
  return {
@@ -410,7 +413,7 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
410
413
  }
411
414
  }
412
415
  async submitScanOrder() {
413
- var _a;
416
+ var _a, _b, _c, _d, _e;
414
417
  this.logMethodStart("submitScanOrder");
415
418
  try {
416
419
  await this.validateBeforeSubmitByItemRule();
@@ -418,11 +421,15 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
418
421
  throw new Error("scanOrder解决方案需要 order 模块支持");
419
422
  }
420
423
  const result = await this.store.order.submitTempOrder({
421
- cacheId: this.cacheId
424
+ cacheId: this.cacheId,
425
+ platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
426
+ businessCode: (_b = this.otherParams) == null ? void 0 : _b.businessCode,
427
+ channel: (_c = this.otherParams) == null ? void 0 : _c.channel,
428
+ type: (_d = this.otherParams) == null ? void 0 : _d.type
422
429
  });
423
430
  const tempOrder = this.store.order.getTempOrder();
424
431
  this.logMethodSuccess("submitScanOrder", {
425
- productCount: ((_a = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _a.length) || 0
432
+ productCount: ((_e = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _e.length) || 0
426
433
  });
427
434
  return result;
428
435
  } catch (error) {
@@ -943,7 +950,7 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
943
950
  // 通过 resource_id + 店铺配置
944
951
  // hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
945
952
  async checkResourceAvailable(resourceId, hasOrderId) {
946
- var _a, _b, _c, _d, _e, _f;
953
+ var _a, _b, _c, _d, _e, _f, _g;
947
954
  this.logMethodStart("checkResourceAvailable", {
948
955
  resourceId
949
956
  });
@@ -988,6 +995,64 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
988
995
  tempOrder.relation_id = resourceId || ((_e = this.otherParams) == null ? void 0 : _e.relation_id);
989
996
  tempOrder.table_form_id = resourceState.tableFormId;
990
997
  tempOrder.resource_id = resourceId;
998
+ const reservationLinkIds = (0, import_utils.collectLinkProductIdsFromReservationRules)(
999
+ dineInConfig["reservation.enabled_reservation_rules"]
1000
+ );
1001
+ if (reservationLinkIds.length === 0) {
1002
+ this.enabledReservationRuleProducts = [];
1003
+ if (this.store.resource)
1004
+ delete this.store.resource.requestEntryPax;
1005
+ } else {
1006
+ tempOrder.metadata = { ...tempOrder.metadata || {} };
1007
+ delete tempOrder.metadata.table_occupancy_duration;
1008
+ const reservationProductList = new import_ProductList.ProductList(
1009
+ `${this.name}_reservationEnabledRules`,
1010
+ this.defaultVersion
1011
+ );
1012
+ await reservationProductList.initialize(this.core, {
1013
+ store: { list: [], selectProducts: [] },
1014
+ otherParams: {
1015
+ ...this.otherParams,
1016
+ fatherModule: this.name,
1017
+ openCache: Boolean(this.cacheId),
1018
+ cacheId: this.cacheId
1019
+ }
1020
+ });
1021
+ const scheduleDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
1022
+ const scheduleDatetime = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
1023
+ const loaded = await reservationProductList.loadProducts({
1024
+ product_ids: reservationLinkIds,
1025
+ schedule_date: scheduleDate,
1026
+ schedule_datetime: scheduleDatetime,
1027
+ cacheId: this.cacheId
1028
+ });
1029
+ if (Array.isArray(loaded)) {
1030
+ this.enabledReservationRuleProducts = loaded;
1031
+ const occupancyMinutes = (0, import_utils.pickFirstDurationMinutesFromProducts)(loaded);
1032
+ if (occupancyMinutes !== void 0) {
1033
+ tempOrder.metadata.table_occupancy_duration = occupancyMinutes;
1034
+ }
1035
+ if ((0, import_utils.hasCustomCapacityProduct)(loaded)) {
1036
+ availabilityInfo.requestEntryPax = 1;
1037
+ if (this.store.resource)
1038
+ this.store.resource.requestEntryPax = 1;
1039
+ } else if (this.store.resource) {
1040
+ delete this.store.resource.requestEntryPax;
1041
+ }
1042
+ } else {
1043
+ this.enabledReservationRuleProducts = [];
1044
+ if (this.store.resource)
1045
+ delete this.store.resource.requestEntryPax;
1046
+ void this.addScanOrderLog({
1047
+ level: "error",
1048
+ title: "[ScanOrder] enabled_reservation_rules product query failed",
1049
+ payload: {
1050
+ linkIds: reservationLinkIds,
1051
+ error: this.serializeError(loaded)
1052
+ }
1053
+ });
1054
+ }
1055
+ }
991
1056
  (_f = this.store.order) == null ? void 0 : _f.persistTempOrder();
992
1057
  if (availabilityInfo.mode === "idle") {
993
1058
  await this.addNewOrder();
@@ -995,6 +1060,9 @@ var ScanOrderImpl = class extends import_BaseModule.BaseModule {
995
1060
  if (availabilityInfo.mode === "additional_order" || availabilityInfo.mode === "additional_order_with_code") {
996
1061
  tempOrder.order_id = resourceState.lastOrderId;
997
1062
  }
1063
+ if (tempOrder.order_id) {
1064
+ await ((_g = this.store.order) == null ? void 0 : _g.getOrderInfoByRemote(tempOrder.order_id));
1065
+ }
998
1066
  await this.refreshItemRuleQuantityLimits();
999
1067
  await this.refreshCartValidationPassed();
1000
1068
  this.logMethodSuccess("checkResourceAvailable", {
@@ -121,6 +121,7 @@ export interface ScanOrderTempOrder {
121
121
  holder: Record<string, any> | null;
122
122
  summary: ScanOrderSummary;
123
123
  metadata: Record<string, any>;
124
+ lastOrderInfo?: Record<string, any>;
124
125
  }
125
126
  export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platform' | 'products' | 'created_at' | 'summary' | 'surcharges'> {
126
127
  platform: 'H5' | 'PC';
@@ -141,6 +142,8 @@ export interface ScanOrderAvailabilityInfo {
141
142
  errorTips?: string;
142
143
  policy?: string | null;
143
144
  partyroom_booking?: string | null;
145
+ /** 预约规则关联商品存在 custom 容量时,由 checkResourceAvailable 置为 1 */
146
+ requestEntryPax?: number;
144
147
  }
145
148
  export interface ScanOrderTableSnackConfig {
146
149
  snack?: boolean | number | string;
@@ -1,6 +1,7 @@
1
1
  import { ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderSummary, ScanOrderTempOrder } from './types';
2
2
  import type { CartItemSummary, ItemRuleBusinessData, PaxInfo, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
3
3
  import type { StrategyConfig } from '../../model/strategy/type';
4
+ import type { ProductData } from '../../modules/Product/types';
4
5
  /**
5
6
  * 构建金额全为 0 的空 summary。
6
7
  * 作为尚未计算金额时的兜底默认值,避免下游因 undefined 报错。
@@ -91,3 +92,13 @@ export declare function getProductIdentityIndex(products: ScanOrderOrderProduct[
91
92
  * - 保留 _origin 供后续业务流程(如促销规则)使用
92
93
  */
93
94
  export declare function normalizeOrderProduct(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): ScanOrderOrderProduct;
95
+ /**
96
+ * 从 reservation.enabled_reservation_rules 中收集 type=link 的商品 id。
97
+ */
98
+ export declare function collectLinkProductIdsFromReservationRules(rules: unknown): number[];
99
+ /**
100
+ * 返回列表中第一个带有效 duration.value(分钟)的商品时长。
101
+ */
102
+ export declare function pickFirstDurationMinutesFromProducts(products: ProductData[]): number | undefined;
103
+ /** 是否存在 capacity.type === 'custom' 的商品 */
104
+ export declare function hasCustomCapacityProduct(products: ProductData[]): boolean;
@@ -24,16 +24,19 @@ __export(utils_exports, {
24
24
  buildItemRuleBusinessData: () => buildItemRuleBusinessData,
25
25
  buildProductKey: () => buildProductKey,
26
26
  buildQuantityLimitIndex: () => buildQuantityLimitIndex,
27
+ collectLinkProductIdsFromReservationRules: () => collectLinkProductIdsFromReservationRules,
27
28
  createEmptySummary: () => createEmptySummary,
28
29
  extractStrategyModelIdsFromTableConfig: () => extractStrategyModelIdsFromTableConfig,
29
30
  getProductIdentityIndex: () => getProductIdentityIndex,
30
31
  getSafeProductNum: () => getSafeProductNum,
31
32
  getTopLevelProductId: () => getTopLevelProductId,
32
33
  getTopLevelVariantId: () => getTopLevelVariantId,
34
+ hasCustomCapacityProduct: () => hasCustomCapacityProduct,
33
35
  isIdentityMatch: () => isIdentityMatch,
34
36
  normalizeEnabledItemRuleIds: () => normalizeEnabledItemRuleIds,
35
37
  normalizeItemRuleStrategies: () => normalizeItemRuleStrategies,
36
38
  normalizeOrderProduct: () => normalizeOrderProduct,
39
+ pickFirstDurationMinutesFromProducts: () => pickFirstDurationMinutesFromProducts,
37
40
  resolveSkuMatchedQuantityLimits: () => resolveSkuMatchedQuantityLimits,
38
41
  toBoolean: () => toBoolean,
39
42
  toNonNegativeInt: () => toNonNegativeInt,
@@ -333,6 +336,42 @@ function normalizeOrderProduct(product) {
333
336
  _origin: product._origin
334
337
  };
335
338
  }
339
+ function collectLinkProductIdsFromReservationRules(rules) {
340
+ if (!Array.isArray(rules))
341
+ return [];
342
+ const ids = [];
343
+ for (const entry of rules) {
344
+ if (!entry || typeof entry !== "object")
345
+ continue;
346
+ const rec = entry;
347
+ if (rec.type !== "link")
348
+ continue;
349
+ if (!Array.isArray(rec.value))
350
+ continue;
351
+ for (const v of rec.value) {
352
+ const n = Number(v);
353
+ if (Number.isFinite(n) && n > 0)
354
+ ids.push(Math.floor(n));
355
+ }
356
+ }
357
+ return [...new Set(ids)];
358
+ }
359
+ function pickFirstDurationMinutesFromProducts(products) {
360
+ var _a;
361
+ for (const product of products) {
362
+ const value = (_a = product == null ? void 0 : product.duration) == null ? void 0 : _a.value;
363
+ const n = Number(value);
364
+ if (Number.isFinite(n) && n > 0)
365
+ return Math.floor(n);
366
+ }
367
+ return void 0;
368
+ }
369
+ function hasCustomCapacityProduct(products) {
370
+ return products.some((p) => {
371
+ var _a;
372
+ return ((_a = p == null ? void 0 : p.capacity) == null ? void 0 : _a.type) === "custom";
373
+ });
374
+ }
336
375
  // Annotate the CommonJS export names for ESM import in node:
337
376
  0 && (module.exports = {
338
377
  aggregateItemRuleLimit,
@@ -340,16 +379,19 @@ function normalizeOrderProduct(product) {
340
379
  buildItemRuleBusinessData,
341
380
  buildProductKey,
342
381
  buildQuantityLimitIndex,
382
+ collectLinkProductIdsFromReservationRules,
343
383
  createEmptySummary,
344
384
  extractStrategyModelIdsFromTableConfig,
345
385
  getProductIdentityIndex,
346
386
  getSafeProductNum,
347
387
  getTopLevelProductId,
348
388
  getTopLevelVariantId,
389
+ hasCustomCapacityProduct,
349
390
  isIdentityMatch,
350
391
  normalizeEnabledItemRuleIds,
351
392
  normalizeItemRuleStrategies,
352
393
  normalizeOrderProduct,
394
+ pickFirstDurationMinutesFromProducts,
353
395
  resolveSkuMatchedQuantityLimits,
354
396
  toBoolean,
355
397
  toNonNegativeInt,
@@ -159,5 +159,15 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
159
159
  private refreshCartValidationPassed;
160
160
  setItemRuleRuntimeConfig(config?: VenueBookingItemRuleRuntimeConfig): Promise<void>;
161
161
  getOtherParams(): Record<string, any>;
162
+ private static readonly UI_STATE_KEY_PREFIX;
163
+ private getUIStateBucketKey;
164
+ private readUIStateBucket;
165
+ private writeUIStateBucket;
166
+ setUIState(key: string, value: any): void;
167
+ getUIState<T = any>(key: string): T | undefined;
168
+ deleteUIState(key: string): void;
162
169
  checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
170
+ setOtherParams(params: Record<string, any>, { cover }?: {
171
+ cover?: boolean;
172
+ }): Promise<void>;
163
173
  }