@pisell/pisellos 0.0.552 → 0.0.554

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.
@@ -84,7 +84,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
84
84
  enhancePayload?: SubmitPayloadEnhancer;
85
85
  }): Promise<T>;
86
86
  createOrder(params: CommitOrderParams['query']): {
87
- type: "appointment_booking" | "virtual";
87
+ type: "virtual" | "appointment_booking";
88
88
  platform: string;
89
89
  sales_channel: string;
90
90
  order_sales_channel: string;
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 5 | 1 | 4 | 2 | 3 | 6;
329
+ weekNum: 0 | 1 | 5 | 3 | 2 | 4 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -1,6 +1,6 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../../modules/BaseModule';
3
- import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult, ScanOrderTempOrder } from './types';
3
+ import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult, ScanOrderTempOrder } from './types';
4
4
  import type { UpdateProductInOrderParams } from '../../modules/Order/types';
5
5
  import type { Discount } from '../../modules/Discount/types';
6
6
  import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
@@ -118,7 +118,8 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
118
118
  setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
119
119
  private normalizeResourceState;
120
120
  private resolveResourceSelectType;
121
- private fetchResourceOccupyDetailByResourceId;
121
+ private fetchResourceOccupyDetailsByResourceId;
122
+ private resolveAdditionalOrderFromOccupyDetail;
122
123
  checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
123
124
  getAdditionalOrderInfo(): Promise<{
124
125
  orderId: string;
@@ -142,6 +143,9 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
142
143
  clearUIState(): void;
143
144
  setEntryPaxNumber(number: number): Promise<void>;
144
145
  getEntryPaxNumber(): number | null;
146
+ syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
147
+ getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
148
+ checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
145
149
  getFulfillmentModes(): {
146
150
  enablePickup: boolean;
147
151
  enableTableService: boolean;
@@ -2569,9 +2569,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2569
2569
  return matched === null || matched === void 0 ? void 0 : matched.type;
2570
2570
  }
2571
2571
  }, {
2572
- key: "fetchResourceOccupyDetailByResourceId",
2572
+ key: "fetchResourceOccupyDetailsByResourceId",
2573
2573
  value: function () {
2574
- var _fetchResourceOccupyDetailByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId) {
2574
+ var _fetchResourceOccupyDetailsByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId) {
2575
2575
  var _this$otherParams10, _this$otherParams10$g, _response$data$occupy, _response$data;
2576
2576
  var formRecordId, shopId, response;
2577
2577
  return _regeneratorRuntime().wrap(function _callee36$(_context36) {
@@ -2607,18 +2607,56 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2607
2607
  }
2608
2608
  throw new Error((response === null || response === void 0 ? void 0 : response.message) || '获取资源占用详情失败');
2609
2609
  case 11:
2610
- return _context36.abrupt("return", (_response$data$occupy = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.occupy_details) === null || _response$data === void 0 ? void 0 : _response$data[0]) !== null && _response$data$occupy !== void 0 ? _response$data$occupy : null);
2610
+ return _context36.abrupt("return", (_response$data$occupy = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.occupy_details) !== null && _response$data$occupy !== void 0 ? _response$data$occupy : []);
2611
2611
  case 12:
2612
2612
  case "end":
2613
2613
  return _context36.stop();
2614
2614
  }
2615
2615
  }, _callee36, this);
2616
2616
  }));
2617
- function fetchResourceOccupyDetailByResourceId(_x18) {
2618
- return _fetchResourceOccupyDetailByResourceId.apply(this, arguments);
2617
+ function fetchResourceOccupyDetailsByResourceId(_x18) {
2618
+ return _fetchResourceOccupyDetailsByResourceId.apply(this, arguments);
2619
2619
  }
2620
- return fetchResourceOccupyDetailByResourceId;
2621
- }() // 检测当前链接是否可用
2620
+ return fetchResourceOccupyDetailsByResourceId;
2621
+ }()
2622
+ }, {
2623
+ key: "resolveAdditionalOrderFromOccupyDetail",
2624
+ value: function resolveAdditionalOrderFromOccupyDetail(detail, resourceSelectType) {
2625
+ var currentOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.order_id);
2626
+ if (currentOrderId) {
2627
+ return {
2628
+ matched: true,
2629
+ order_id: currentOrderId
2630
+ };
2631
+ }
2632
+ if (resourceSelectType !== 'single') {
2633
+ return {
2634
+ matched: false,
2635
+ reason: 'no_order'
2636
+ };
2637
+ }
2638
+ var orderListIds = (Array.isArray(detail === null || detail === void 0 ? void 0 : detail.order_list) ? (detail === null || detail === void 0 ? void 0 : detail.order_list) || [] : []).map(function (order) {
2639
+ return toPositiveString(order === null || order === void 0 ? void 0 : order.id);
2640
+ }).filter(Boolean);
2641
+ if (orderListIds.length === 1) {
2642
+ return {
2643
+ matched: true,
2644
+ order_id: orderListIds[0]
2645
+ };
2646
+ }
2647
+ if (orderListIds.length > 1) {
2648
+ return {
2649
+ matched: false,
2650
+ reason: 'multiple_orders'
2651
+ };
2652
+ }
2653
+ return {
2654
+ matched: false,
2655
+ reason: 'no_order'
2656
+ };
2657
+ }
2658
+
2659
+ // 检测当前链接是否可用
2622
2660
  // 通过 resource_id + 店铺配置
2623
2661
  // hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
2624
2662
  }, {
@@ -2633,6 +2671,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2633
2671
  _this$otherParams12,
2634
2672
  _this$otherParams13,
2635
2673
  _this$otherParams13$g,
2674
+ _occupyDetails$,
2636
2675
  _occupyDetail$form_re,
2637
2676
  _occupyDetail$form_re2,
2638
2677
  _this$otherParams14,
@@ -2666,10 +2705,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2666
2705
  occupancyMinutes,
2667
2706
  paxBounds,
2668
2707
  error,
2708
+ occupyDetails,
2669
2709
  occupyDetail,
2670
2710
  resourceSelectType,
2711
+ additionalOrderResult,
2712
+ _occupyDetail$order_l,
2713
+ multipleOrdersState,
2714
+ _availabilityInfo,
2671
2715
  resourceState,
2716
+ additionalOrderId,
2672
2717
  availabilityInfo,
2718
+ isAdditionalOrderMode,
2673
2719
  _this$store$order7,
2674
2720
  _res$data,
2675
2721
  res,
@@ -2828,15 +2874,45 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2828
2874
  });
2829
2875
  }
2830
2876
 
2831
- // Step2: 请求新的资源占用详情接口
2877
+ // Step2: 请求新的资源占用详情接口。occupy_details 第一维是资源,不是订单。
2832
2878
  _context37.next = 50;
2833
- return this.fetchResourceOccupyDetailByResourceId(normalizedResourceId);
2879
+ return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
2834
2880
  case 50:
2835
- occupyDetail = _context37.sent;
2836
- // Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
2881
+ occupyDetails = _context37.sent;
2882
+ occupyDetail = (_occupyDetails$ = occupyDetails[0]) !== null && _occupyDetails$ !== void 0 ? _occupyDetails$ : null; // Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
2837
2883
  // 计算当前桌台的 resourceSelectType(single/multiple/capacity)
2838
- resourceSelectType = this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id)); // Step4: 用 occupyDetail + resourceSelectType 规整为 resourceState
2884
+ resourceSelectType = this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id));
2885
+ additionalOrderResult = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType);
2886
+ if (!(additionalOrderResult.reason === 'multiple_orders')) {
2887
+ _context37.next = 60;
2888
+ break;
2889
+ }
2890
+ multipleOrdersState = _objectSpread(_objectSpread({}, this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId)), {}, {
2891
+ mode: 'multiple_orders'
2892
+ });
2893
+ this.store.resource = multipleOrdersState;
2894
+ _availabilityInfo = {
2895
+ mode: 'multiple_orders',
2896
+ deskmate_valid: multipleOrdersState.deskmate_valid,
2897
+ relation_id: multipleOrdersState.relationId,
2898
+ table_form_id: multipleOrdersState.tableFormId,
2899
+ table_form_record: multipleOrdersState.table_form_record
2900
+ };
2901
+ this.logMethodSuccess('checkResourceAvailable', {
2902
+ resourceId: normalizedResourceId,
2903
+ mode: _availabilityInfo.mode,
2904
+ orderListCount: (occupyDetail === null || occupyDetail === void 0 || (_occupyDetail$order_l = occupyDetail.order_list) === null || _occupyDetail$order_l === void 0 ? void 0 : _occupyDetail$order_l.length) || 0,
2905
+ resourceSelectType: resourceSelectType
2906
+ });
2907
+ return _context37.abrupt("return", _availabilityInfo);
2908
+ case 60:
2909
+ // Step4: 用 occupyDetail + resourceSelectType 规整为 resourceState
2839
2910
  resourceState = this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId);
2911
+ additionalOrderId = additionalOrderResult.order_id;
2912
+ if (additionalOrderId) {
2913
+ resourceState.mode = 'additional_order';
2914
+ resourceState.order_id = additionalOrderId;
2915
+ }
2840
2916
  this.store.resource = resourceState;
2841
2917
 
2842
2918
  // Step5: 把预约规则商品阶段暂存的 requestEntryPax 等注入 store.resource
@@ -2872,23 +2948,23 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2872
2948
 
2873
2949
  // 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
2874
2950
  if (!(availabilityInfo.mode === 'idle')) {
2875
- _context37.next = 65;
2951
+ _context37.next = 75;
2876
2952
  break;
2877
2953
  }
2878
- _context37.next = 65;
2954
+ _context37.next = 75;
2879
2955
  return this.addNewOrder();
2880
- case 65:
2881
- // 如果是加单模式,tempOrder 需要记录 lastOrderId,提交的时候走加单接口
2882
- if (availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code') {
2883
- tempOrder.order_id = resourceState.lastOrderId;
2956
+ case 75:
2957
+ isAdditionalOrderMode = availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code'; // 如果是加单模式,tempOrder 里需要记录目标订单 id,提交的时候走加单接口
2958
+ if (isAdditionalOrderMode) {
2959
+ tempOrder.order_id = additionalOrderId;
2884
2960
  }
2885
2961
  if (!tempOrder.order_id) {
2886
- _context37.next = 74;
2962
+ _context37.next = 85;
2887
2963
  break;
2888
2964
  }
2889
- _context37.next = 69;
2965
+ _context37.next = 80;
2890
2966
  return (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getOrderInfoByRemote(tempOrder.order_id);
2891
- case 69:
2967
+ case 80:
2892
2968
  res = _context37.sent;
2893
2969
  // 找到下单的时候输入的 entryPaxNumber
2894
2970
  entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
@@ -2896,14 +2972,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2896
2972
  return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
2897
2973
  })) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
2898
2974
  if (!entryPaxNumber) {
2899
- _context37.next = 74;
2975
+ _context37.next = 85;
2900
2976
  break;
2901
2977
  }
2902
- _context37.next = 74;
2978
+ _context37.next = 85;
2903
2979
  return this.setEntryPaxNumber(entryPaxNumber);
2904
- case 74:
2980
+ case 85:
2905
2981
  lastOrderInfo = (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || (_this$store$order8$ge = _this$store$order8.getLastOrderInfo) === null || _this$store$order8$ge === void 0 ? void 0 : _this$store$order8$ge.call(_this$store$order8);
2906
- historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
2982
+ historicalItems = isAdditionalOrderMode && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
2907
2983
  if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
2908
2984
  acc.push(_objectSpread({
2909
2985
  product_id: p.product_id,
@@ -2913,13 +2989,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2913
2989
  } : {}));
2914
2990
  return acc;
2915
2991
  }, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
2916
- _context37.next = 78;
2992
+ _context37.next = 89;
2917
2993
  return this.setItemRuleRuntimeConfig({
2918
2994
  serviceType: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.businessCode,
2919
- submissionIndex: hasOrderId ? 1 : 0,
2995
+ submissionIndex: isAdditionalOrderMode ? 1 : 0,
2920
2996
  historicalItems: historicalItems
2921
2997
  });
2922
- case 78:
2998
+ case 89:
2923
2999
  // operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
2924
3000
  // 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
2925
3001
  if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
@@ -2941,18 +3017,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2941
3017
  isFull: resourceState.isFull
2942
3018
  });
2943
3019
  return _context37.abrupt("return", availabilityInfo);
2944
- case 83:
2945
- _context37.prev = 83;
3020
+ case 94:
3021
+ _context37.prev = 94;
2946
3022
  _context37.t0 = _context37["catch"](3);
2947
3023
  this.logMethodError('checkResourceAvailable', _context37.t0.message, {
2948
3024
  resourceId: normalizedResourceId
2949
3025
  });
2950
3026
  throw _context37.t0;
2951
- case 87:
3027
+ case 98:
2952
3028
  case "end":
2953
3029
  return _context37.stop();
2954
3030
  }
2955
- }, _callee37, this, [[3, 83]]);
3031
+ }, _callee37, this, [[3, 94]]);
2956
3032
  }));
2957
3033
  function checkResourceAvailable(_x19) {
2958
3034
  return _checkResourceAvailable.apply(this, arguments);
@@ -3214,15 +3290,110 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3214
3290
  value: function getEntryPaxNumber() {
3215
3291
  return this.store.entryPaxNumber;
3216
3292
  }
3293
+ }, {
3294
+ key: "syncAdditionalOrderFromResource",
3295
+ value: function () {
3296
+ var _syncAdditionalOrderFromResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(resourceId) {
3297
+ var _ref10, _ref11, _ref12, _this$store$resource2, _this$store$resource3, _occupyDetails$2, _this$store$resource4, _this$store$order9;
3298
+ var tempOrder, normalizedResourceId, _result, occupyDetails, occupyDetail, resourceSelectType, result;
3299
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3300
+ while (1) switch (_context42.prev = _context42.next) {
3301
+ case 0:
3302
+ tempOrder = this.ensureTempOrder();
3303
+ normalizedResourceId = String((_ref10 = (_ref11 = (_ref12 = resourceId !== null && resourceId !== void 0 ? resourceId : tempOrder.resource_id) !== null && _ref12 !== void 0 ? _ref12 : (_this$store$resource2 = this.store.resource) === null || _this$store$resource2 === void 0 ? void 0 : _this$store$resource2.relationId) !== null && _ref11 !== void 0 ? _ref11 : (_this$store$resource3 = this.store.resource) === null || _this$store$resource3 === void 0 ? void 0 : _this$store$resource3.relation_id) !== null && _ref10 !== void 0 ? _ref10 : '').trim();
3304
+ this.logMethodStart('syncAdditionalOrderFromResource', {
3305
+ resourceId: normalizedResourceId
3306
+ });
3307
+ if (normalizedResourceId) {
3308
+ _context42.next = 7;
3309
+ break;
3310
+ }
3311
+ _result = {
3312
+ matched: false,
3313
+ reason: 'missing_resource_id'
3314
+ };
3315
+ this.logMethodSuccess('syncAdditionalOrderFromResource', _result);
3316
+ return _context42.abrupt("return", _result);
3317
+ case 7:
3318
+ _context42.next = 9;
3319
+ return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
3320
+ case 9:
3321
+ occupyDetails = _context42.sent;
3322
+ occupyDetail = (_occupyDetails$2 = occupyDetails[0]) !== null && _occupyDetails$2 !== void 0 ? _occupyDetails$2 : null;
3323
+ resourceSelectType = ((_this$store$resource4 = this.store.resource) === null || _this$store$resource4 === void 0 ? void 0 : _this$store$resource4.resourceSelectType) || this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id));
3324
+ result = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType);
3325
+ if (!(!result.matched || !result.order_id)) {
3326
+ _context42.next = 16;
3327
+ break;
3328
+ }
3329
+ this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
3330
+ resourceId: normalizedResourceId,
3331
+ resourceSelectType: resourceSelectType
3332
+ }));
3333
+ return _context42.abrupt("return", result);
3334
+ case 16:
3335
+ tempOrder.order_id = result.order_id;
3336
+ tempOrder.resource_id = normalizedResourceId;
3337
+ tempOrder.relation_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
3338
+ tempOrder.table_form_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
3339
+ (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 || _this$store$order9.persistTempOrder();
3340
+ this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
3341
+ resourceId: normalizedResourceId,
3342
+ resourceSelectType: resourceSelectType
3343
+ }));
3344
+ return _context42.abrupt("return", result);
3345
+ case 23:
3346
+ case "end":
3347
+ return _context42.stop();
3348
+ }
3349
+ }, _callee42, this);
3350
+ }));
3351
+ function syncAdditionalOrderFromResource(_x22) {
3352
+ return _syncAdditionalOrderFromResource.apply(this, arguments);
3353
+ }
3354
+ return syncAdditionalOrderFromResource;
3355
+ }() // 读取预约规则商品的资源选择类型:single=单个预约,multiple=多个预约,capacity=容量型预约
3356
+ // 依赖 checkResourceAvailable 已根据预约规则商品与 occupy-detail 的 form_id 计算并缓存 store.resource
3357
+ }, {
3358
+ key: "getReservationResourceSelectType",
3359
+ value: function getReservationResourceSelectType() {
3360
+ var _this$store$resource5;
3361
+ this.logMethodStart('getReservationResourceSelectType');
3362
+ var resourceSelectType = (_this$store$resource5 = this.store.resource) === null || _this$store$resource5 === void 0 ? void 0 : _this$store$resource5.resourceSelectType;
3363
+ var result = _objectSpread(_objectSpread({}, resourceSelectType ? {
3364
+ resourceSelectType: resourceSelectType
3365
+ } : {}), {}, {
3366
+ isSingleReservation: resourceSelectType === 'single',
3367
+ isMultipleReservation: resourceSelectType === 'multiple',
3368
+ isCapacityReservation: resourceSelectType === 'capacity'
3369
+ });
3370
+ this.logMethodSuccess('getReservationResourceSelectType', result);
3371
+ return result;
3372
+ }
3373
+
3374
+ // 判定后台是否开启允许加餐
3375
+ // 依赖 checkResourceAvailable 已缓存的 dineInConfig
3376
+ }, {
3377
+ key: "checkAllowAddItems",
3378
+ value: function checkAllowAddItems() {
3379
+ var _this$otherParams17;
3380
+ this.logMethodStart('checkAllowAddItems');
3381
+ var dineInConfig = ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.dineInConfig) || {};
3382
+ var result = {
3383
+ enabled: toBoolean(dineInConfig['sale.allow_add_items'])
3384
+ };
3385
+ this.logMethodSuccess('checkAllowAddItems', result);
3386
+ return result;
3387
+ }
3217
3388
 
3218
3389
  // 读取取餐/送餐开关
3219
3390
  // 依赖 checkResourceAvailable 已缓存的 dineInConfig
3220
3391
  }, {
3221
3392
  key: "getFulfillmentModes",
3222
3393
  value: function getFulfillmentModes() {
3223
- var _this$otherParams17;
3394
+ var _this$otherParams18;
3224
3395
  this.logMethodStart('getFulfillmentModes');
3225
- var dineInConfig = ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.dineInConfig) || {};
3396
+ var dineInConfig = ((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.dineInConfig) || {};
3226
3397
  var result = {
3227
3398
  enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
3228
3399
  enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
@@ -3236,9 +3407,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3236
3407
  }, {
3237
3408
  key: "checkManualPickupRef",
3238
3409
  value: function checkManualPickupRef() {
3239
- var _this$otherParams18;
3410
+ var _this$otherParams19;
3240
3411
  this.logMethodStart('checkManualPickupRef');
3241
- var dineInConfig = ((_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.dineInConfig) || {};
3412
+ var dineInConfig = ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.dineInConfig) || {};
3242
3413
  var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
3243
3414
  var manualInputType = dineInConfig['fulfillment.manual_input_type'];
3244
3415
  var enabled = refMode === 'manual_input';
@@ -186,7 +186,7 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
186
186
  }>;
187
187
  products: ScanOrderSubmitProduct[];
188
188
  }
189
- export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
189
+ export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'multiple_orders' | 'additional_order_with_code' | 'additional_order';
190
190
  export interface ScanOrderTableFormRecord {
191
191
  policy?: string | null;
192
192
  partyroom_booking?: string | null;
@@ -229,6 +229,10 @@ export interface ScanOrderResourceOccupyDetail {
229
229
  form_id?: number | string | null;
230
230
  order_id?: number | string | null;
231
231
  last_order_id?: number | string | null;
232
+ order_list?: Array<{
233
+ id?: number | string | null;
234
+ [key: string]: any;
235
+ }> | null;
232
236
  resource_capacity?: ScanOrderResourceCapacity[] | null;
233
237
  form_record?: ScanOrderTableFormRecord | null;
234
238
  [key: string]: any;
@@ -242,6 +246,21 @@ export interface ScanOrderResourceOccupyDetailApiResponse {
242
246
  } | null;
243
247
  }
244
248
  export type ScanOrderResourceSelectType = 'single' | 'multiple' | 'capacity';
249
+ export interface ScanOrderReservationResourceSelectInfo {
250
+ resourceSelectType?: ScanOrderResourceSelectType;
251
+ isSingleReservation: boolean;
252
+ isMultipleReservation: boolean;
253
+ isCapacityReservation: boolean;
254
+ }
255
+ export interface ScanOrderAllowAddItemsInfo {
256
+ enabled: boolean;
257
+ }
258
+ export type ScanOrderSyncAdditionalOrderReason = 'missing_resource_id' | 'no_order' | 'multiple_orders' | 'invalid_order_id';
259
+ export interface ScanOrderSyncAdditionalOrderResult {
260
+ matched: boolean;
261
+ order_id?: string;
262
+ reason?: ScanOrderSyncAdditionalOrderReason;
263
+ }
245
264
  export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
246
265
  relationId?: string;
247
266
  tableFormId?: string;
@@ -84,7 +84,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
84
84
  enhancePayload?: SubmitPayloadEnhancer;
85
85
  }): Promise<T>;
86
86
  createOrder(params: CommitOrderParams['query']): {
87
- type: "appointment_booking" | "virtual";
87
+ type: "virtual" | "appointment_booking";
88
88
  platform: string;
89
89
  sales_channel: string;
90
90
  order_sales_channel: string;
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 5 | 1 | 4 | 2 | 3 | 6;
329
+ weekNum: 0 | 1 | 5 | 3 | 2 | 4 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -1,6 +1,6 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../../modules/BaseModule';
3
- import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult, ScanOrderTempOrder } from './types';
3
+ import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult, ScanOrderTempOrder } from './types';
4
4
  import type { UpdateProductInOrderParams } from '../../modules/Order/types';
5
5
  import type { Discount } from '../../modules/Discount/types';
6
6
  import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
@@ -118,7 +118,8 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
118
118
  setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
119
119
  private normalizeResourceState;
120
120
  private resolveResourceSelectType;
121
- private fetchResourceOccupyDetailByResourceId;
121
+ private fetchResourceOccupyDetailsByResourceId;
122
+ private resolveAdditionalOrderFromOccupyDetail;
122
123
  checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
123
124
  getAdditionalOrderInfo(): Promise<{
124
125
  orderId: string;
@@ -142,6 +143,9 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
142
143
  clearUIState(): void;
143
144
  setEntryPaxNumber(number: number): Promise<void>;
144
145
  getEntryPaxNumber(): number | null;
146
+ syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
147
+ getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
148
+ checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
145
149
  getFulfillmentModes(): {
146
150
  enablePickup: boolean;
147
151
  enableTableService: boolean;
@@ -1524,8 +1524,8 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1524
1524
  const matched = resources.find((r) => Number(r == null ? void 0 : r.id) === numericFormId);
1525
1525
  return matched == null ? void 0 : matched.type;
1526
1526
  }
1527
- async fetchResourceOccupyDetailByResourceId(resourceId) {
1528
- var _a, _b, _c, _d;
1527
+ async fetchResourceOccupyDetailsByResourceId(resourceId) {
1528
+ var _a, _b, _c;
1529
1529
  const formRecordId = Number(resourceId);
1530
1530
  if (!Number.isFinite(formRecordId) || formRecordId <= 0) {
1531
1531
  throw new Error(`[ScanOrder] 非法桌台 resourceId: ${resourceId}`);
@@ -1547,13 +1547,45 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1547
1547
  if (!(response == null ? void 0 : response.status)) {
1548
1548
  throw new Error((response == null ? void 0 : response.message) || "获取资源占用详情失败");
1549
1549
  }
1550
- return ((_d = (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.occupy_details) == null ? void 0 : _d[0]) ?? null;
1550
+ return ((_c = response == null ? void 0 : response.data) == null ? void 0 : _c.occupy_details) ?? [];
1551
+ }
1552
+ resolveAdditionalOrderFromOccupyDetail(detail, resourceSelectType) {
1553
+ const currentOrderId = (0, import_utils.toPositiveString)(detail == null ? void 0 : detail.order_id);
1554
+ if (currentOrderId) {
1555
+ return {
1556
+ matched: true,
1557
+ order_id: currentOrderId
1558
+ };
1559
+ }
1560
+ if (resourceSelectType !== "single") {
1561
+ return {
1562
+ matched: false,
1563
+ reason: "no_order"
1564
+ };
1565
+ }
1566
+ const orderListIds = (Array.isArray(detail == null ? void 0 : detail.order_list) ? (detail == null ? void 0 : detail.order_list) || [] : []).map((order) => (0, import_utils.toPositiveString)(order == null ? void 0 : order.id)).filter(Boolean);
1567
+ if (orderListIds.length === 1) {
1568
+ return {
1569
+ matched: true,
1570
+ order_id: orderListIds[0]
1571
+ };
1572
+ }
1573
+ if (orderListIds.length > 1) {
1574
+ return {
1575
+ matched: false,
1576
+ reason: "multiple_orders"
1577
+ };
1578
+ }
1579
+ return {
1580
+ matched: false,
1581
+ reason: "no_order"
1582
+ };
1551
1583
  }
1552
1584
  // 检测当前链接是否可用
1553
1585
  // 通过 resource_id + 店铺配置
1554
1586
  // hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
1555
1587
  async checkResourceAvailable(resourceId, hasOrderId = false) {
1556
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1588
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
1557
1589
  const normalizedResourceId = String(resourceId ?? "").trim();
1558
1590
  this.logMethodStart("checkResourceAvailable", {
1559
1591
  resourceId: normalizedResourceId
@@ -1669,15 +1701,46 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1669
1701
  cacheId: this.cacheId
1670
1702
  });
1671
1703
  }
1672
- const occupyDetail = await this.fetchResourceOccupyDetailByResourceId(normalizedResourceId);
1704
+ const occupyDetails = await this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
1705
+ const occupyDetail = occupyDetails[0] ?? null;
1673
1706
  const resourceSelectType = this.resolveResourceSelectType(
1674
1707
  (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id)
1675
1708
  );
1709
+ const additionalOrderResult = this.resolveAdditionalOrderFromOccupyDetail(
1710
+ occupyDetail,
1711
+ resourceSelectType
1712
+ );
1713
+ if (additionalOrderResult.reason === "multiple_orders") {
1714
+ const multipleOrdersState = {
1715
+ ...this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId),
1716
+ mode: "multiple_orders"
1717
+ };
1718
+ this.store.resource = multipleOrdersState;
1719
+ const availabilityInfo2 = {
1720
+ mode: "multiple_orders",
1721
+ deskmate_valid: multipleOrdersState.deskmate_valid,
1722
+ relation_id: multipleOrdersState.relationId,
1723
+ table_form_id: multipleOrdersState.tableFormId,
1724
+ table_form_record: multipleOrdersState.table_form_record
1725
+ };
1726
+ this.logMethodSuccess("checkResourceAvailable", {
1727
+ resourceId: normalizedResourceId,
1728
+ mode: availabilityInfo2.mode,
1729
+ orderListCount: ((_e = occupyDetail == null ? void 0 : occupyDetail.order_list) == null ? void 0 : _e.length) || 0,
1730
+ resourceSelectType
1731
+ });
1732
+ return availabilityInfo2;
1733
+ }
1676
1734
  const resourceState = this.normalizeResourceState(
1677
1735
  occupyDetail,
1678
1736
  resourceSelectType,
1679
1737
  hasOrderId
1680
1738
  );
1739
+ const additionalOrderId = additionalOrderResult.order_id;
1740
+ if (additionalOrderId) {
1741
+ resourceState.mode = "additional_order";
1742
+ resourceState.order_id = additionalOrderId;
1743
+ }
1681
1744
  this.store.resource = resourceState;
1682
1745
  if (pendingRequestEntryPax !== void 0) {
1683
1746
  this.store.resource.requestEntryPax = pendingRequestEntryPax;
@@ -1695,34 +1758,35 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1695
1758
  table_form_id: resourceState.tableFormId,
1696
1759
  deskmate_valid: resourceState.deskmate_valid,
1697
1760
  table_form_record: resourceState.table_form_record,
1698
- policy: (_e = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _e.policy,
1699
- partyroom_booking: (_f = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _f.partyroom_booking,
1761
+ policy: (_f = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _f.policy,
1762
+ partyroom_booking: (_g = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _g.partyroom_booking,
1700
1763
  ...this.store.resource.requestEntryPax !== void 0 ? { requestEntryPax: this.store.resource.requestEntryPax } : {},
1701
1764
  ...this.store.resource.requestPaxMin !== void 0 ? { requestPaxMin: this.store.resource.requestPaxMin } : {},
1702
1765
  ...this.store.resource.requestPaxMax !== void 0 ? { requestPaxMax: this.store.resource.requestPaxMax } : {}
1703
1766
  };
1704
- tempOrder.relation_id = normalizedResourceId || ((_g = this.otherParams) == null ? void 0 : _g.relation_id);
1767
+ tempOrder.relation_id = normalizedResourceId || ((_h = this.otherParams) == null ? void 0 : _h.relation_id);
1705
1768
  tempOrder.table_form_id = resourceState.tableFormId;
1706
1769
  tempOrder.resource_id = normalizedResourceId;
1707
- (_h = this.store.order) == null ? void 0 : _h.persistTempOrder();
1770
+ (_i = this.store.order) == null ? void 0 : _i.persistTempOrder();
1708
1771
  if (availabilityInfo.mode === "idle") {
1709
1772
  await this.addNewOrder();
1710
1773
  }
1711
- if (availabilityInfo.mode === "additional_order" || availabilityInfo.mode === "additional_order_with_code") {
1712
- tempOrder.order_id = resourceState.lastOrderId;
1774
+ const isAdditionalOrderMode = availabilityInfo.mode === "additional_order" || availabilityInfo.mode === "additional_order_with_code";
1775
+ if (isAdditionalOrderMode) {
1776
+ tempOrder.order_id = additionalOrderId;
1713
1777
  }
1714
1778
  if (tempOrder.order_id) {
1715
- const res = await ((_i = this.store.order) == null ? void 0 : _i.getOrderInfoByRemote(tempOrder.order_id));
1716
- const entryPaxNumber = (_m = (_l = (_k = (_j = res == null ? void 0 : res.data) == null ? void 0 : _j.bookings) == null ? void 0 : _k.find((p) => {
1779
+ const res = await ((_j = this.store.order) == null ? void 0 : _j.getOrderInfoByRemote(tempOrder.order_id));
1780
+ const entryPaxNumber = (_n = (_m = (_l = (_k = res == null ? void 0 : res.data) == null ? void 0 : _k.bookings) == null ? void 0 : _l.find((p) => {
1717
1781
  var _a2;
1718
1782
  return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
1719
- })) == null ? void 0 : _l.metadata) == null ? void 0 : _m.collect_pax;
1783
+ })) == null ? void 0 : _m.metadata) == null ? void 0 : _n.collect_pax;
1720
1784
  if (entryPaxNumber) {
1721
1785
  await this.setEntryPaxNumber(entryPaxNumber);
1722
1786
  }
1723
1787
  }
1724
- const lastOrderInfo = (_o = (_n = this.store.order) == null ? void 0 : _n.getLastOrderInfo) == null ? void 0 : _o.call(_n);
1725
- const historicalItems = hasOrderId && Array.isArray(lastOrderInfo == null ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce((acc, p) => {
1788
+ const lastOrderInfo = (_p = (_o = this.store.order) == null ? void 0 : _o.getLastOrderInfo) == null ? void 0 : _p.call(_o);
1789
+ const historicalItems = isAdditionalOrderMode && Array.isArray(lastOrderInfo == null ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce((acc, p) => {
1726
1790
  if (typeof (p == null ? void 0 : p.product_id) !== "number")
1727
1791
  return acc;
1728
1792
  acc.push({
@@ -1733,8 +1797,8 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1733
1797
  return acc;
1734
1798
  }, []) : [];
1735
1799
  await this.setItemRuleRuntimeConfig({
1736
- serviceType: (_p = this.otherParams) == null ? void 0 : _p.businessCode,
1737
- submissionIndex: hasOrderId ? 1 : 0,
1800
+ serviceType: (_q = this.otherParams) == null ? void 0 : _q.businessCode,
1801
+ submissionIndex: isAdditionalOrderMode ? 1 : 0,
1738
1802
  historicalItems
1739
1803
  });
1740
1804
  if (outsideOperatingHours && closedBehaviorValue === "show_menu_disabled") {
@@ -1907,6 +1971,77 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1907
1971
  getEntryPaxNumber() {
1908
1972
  return this.store.entryPaxNumber;
1909
1973
  }
1974
+ async syncAdditionalOrderFromResource(resourceId) {
1975
+ var _a, _b, _c, _d;
1976
+ const tempOrder = this.ensureTempOrder();
1977
+ const normalizedResourceId = String(
1978
+ resourceId ?? tempOrder.resource_id ?? ((_a = this.store.resource) == null ? void 0 : _a.relationId) ?? ((_b = this.store.resource) == null ? void 0 : _b.relation_id) ?? ""
1979
+ ).trim();
1980
+ this.logMethodStart("syncAdditionalOrderFromResource", {
1981
+ resourceId: normalizedResourceId
1982
+ });
1983
+ if (!normalizedResourceId) {
1984
+ const result2 = {
1985
+ matched: false,
1986
+ reason: "missing_resource_id"
1987
+ };
1988
+ this.logMethodSuccess("syncAdditionalOrderFromResource", result2);
1989
+ return result2;
1990
+ }
1991
+ const occupyDetails = await this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
1992
+ const occupyDetail = occupyDetails[0] ?? null;
1993
+ const resourceSelectType = ((_c = this.store.resource) == null ? void 0 : _c.resourceSelectType) || this.resolveResourceSelectType((0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id));
1994
+ const result = this.resolveAdditionalOrderFromOccupyDetail(
1995
+ occupyDetail,
1996
+ resourceSelectType
1997
+ );
1998
+ if (!result.matched || !result.order_id) {
1999
+ this.logMethodSuccess("syncAdditionalOrderFromResource", {
2000
+ ...result,
2001
+ resourceId: normalizedResourceId,
2002
+ resourceSelectType
2003
+ });
2004
+ return result;
2005
+ }
2006
+ tempOrder.order_id = result.order_id;
2007
+ tempOrder.resource_id = normalizedResourceId;
2008
+ tempOrder.relation_id = (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
2009
+ tempOrder.table_form_id = (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
2010
+ (_d = this.store.order) == null ? void 0 : _d.persistTempOrder();
2011
+ this.logMethodSuccess("syncAdditionalOrderFromResource", {
2012
+ ...result,
2013
+ resourceId: normalizedResourceId,
2014
+ resourceSelectType
2015
+ });
2016
+ return result;
2017
+ }
2018
+ // 读取预约规则商品的资源选择类型:single=单个预约,multiple=多个预约,capacity=容量型预约
2019
+ // 依赖 checkResourceAvailable 已根据预约规则商品与 occupy-detail 的 form_id 计算并缓存 store.resource
2020
+ getReservationResourceSelectType() {
2021
+ var _a;
2022
+ this.logMethodStart("getReservationResourceSelectType");
2023
+ const resourceSelectType = (_a = this.store.resource) == null ? void 0 : _a.resourceSelectType;
2024
+ const result = {
2025
+ ...resourceSelectType ? { resourceSelectType } : {},
2026
+ isSingleReservation: resourceSelectType === "single",
2027
+ isMultipleReservation: resourceSelectType === "multiple",
2028
+ isCapacityReservation: resourceSelectType === "capacity"
2029
+ };
2030
+ this.logMethodSuccess("getReservationResourceSelectType", result);
2031
+ return result;
2032
+ }
2033
+ // 判定后台是否开启允许加餐
2034
+ // 依赖 checkResourceAvailable 已缓存的 dineInConfig
2035
+ checkAllowAddItems() {
2036
+ var _a;
2037
+ this.logMethodStart("checkAllowAddItems");
2038
+ const dineInConfig = ((_a = this.otherParams) == null ? void 0 : _a.dineInConfig) || {};
2039
+ const result = {
2040
+ enabled: (0, import_utils.toBoolean)(dineInConfig["sale.allow_add_items"])
2041
+ };
2042
+ this.logMethodSuccess("checkAllowAddItems", result);
2043
+ return result;
2044
+ }
1910
2045
  // 读取取餐/送餐开关
1911
2046
  // 依赖 checkResourceAvailable 已缓存的 dineInConfig
1912
2047
  getFulfillmentModes() {
@@ -186,7 +186,7 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
186
186
  }>;
187
187
  products: ScanOrderSubmitProduct[];
188
188
  }
189
- export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
189
+ export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'multiple_orders' | 'additional_order_with_code' | 'additional_order';
190
190
  export interface ScanOrderTableFormRecord {
191
191
  policy?: string | null;
192
192
  partyroom_booking?: string | null;
@@ -229,6 +229,10 @@ export interface ScanOrderResourceOccupyDetail {
229
229
  form_id?: number | string | null;
230
230
  order_id?: number | string | null;
231
231
  last_order_id?: number | string | null;
232
+ order_list?: Array<{
233
+ id?: number | string | null;
234
+ [key: string]: any;
235
+ }> | null;
232
236
  resource_capacity?: ScanOrderResourceCapacity[] | null;
233
237
  form_record?: ScanOrderTableFormRecord | null;
234
238
  [key: string]: any;
@@ -242,6 +246,21 @@ export interface ScanOrderResourceOccupyDetailApiResponse {
242
246
  } | null;
243
247
  }
244
248
  export type ScanOrderResourceSelectType = 'single' | 'multiple' | 'capacity';
249
+ export interface ScanOrderReservationResourceSelectInfo {
250
+ resourceSelectType?: ScanOrderResourceSelectType;
251
+ isSingleReservation: boolean;
252
+ isMultipleReservation: boolean;
253
+ isCapacityReservation: boolean;
254
+ }
255
+ export interface ScanOrderAllowAddItemsInfo {
256
+ enabled: boolean;
257
+ }
258
+ export type ScanOrderSyncAdditionalOrderReason = 'missing_resource_id' | 'no_order' | 'multiple_orders' | 'invalid_order_id';
259
+ export interface ScanOrderSyncAdditionalOrderResult {
260
+ matched: boolean;
261
+ order_id?: string;
262
+ reason?: ScanOrderSyncAdditionalOrderReason;
263
+ }
245
264
  export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
246
265
  relationId?: string;
247
266
  tableFormId?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "0.0.552",
4
+ "version": "0.0.554",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",