@pisell/pisellos 0.0.552 → 0.0.553
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.
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.js +72 -29
- package/dist/solution/ScanOrder/types.d.ts +5 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.js +40 -8
- package/lib/solution/ScanOrder/types.d.ts +5 -1
- package/package.json +1 -1
|
@@ -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: "
|
|
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 |
|
|
329
|
+
weekNum: 0 | 1 | 5 | 3 | 2 | 4 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -118,7 +118,7 @@ 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
|
|
121
|
+
private fetchResourceOccupyDetailsByResourceId;
|
|
122
122
|
checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
|
|
123
123
|
getAdditionalOrderInfo(): Promise<{
|
|
124
124
|
orderId: string;
|
|
@@ -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: "
|
|
2572
|
+
key: "fetchResourceOccupyDetailsByResourceId",
|
|
2573
2573
|
value: function () {
|
|
2574
|
-
var
|
|
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,17 +2607,17 @@ 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
|
|
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
|
|
2618
|
-
return
|
|
2617
|
+
function fetchResourceOccupyDetailsByResourceId(_x18) {
|
|
2618
|
+
return _fetchResourceOccupyDetailsByResourceId.apply(this, arguments);
|
|
2619
2619
|
}
|
|
2620
|
-
return
|
|
2620
|
+
return fetchResourceOccupyDetailsByResourceId;
|
|
2621
2621
|
}() // 检测当前链接是否可用
|
|
2622
2622
|
// 通过 resource_id + 店铺配置
|
|
2623
2623
|
// hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
|
|
@@ -2633,6 +2633,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2633
2633
|
_this$otherParams12,
|
|
2634
2634
|
_this$otherParams13,
|
|
2635
2635
|
_this$otherParams13$g,
|
|
2636
|
+
_occupyDetails$,
|
|
2636
2637
|
_occupyDetail$form_re,
|
|
2637
2638
|
_occupyDetail$form_re2,
|
|
2638
2639
|
_this$otherParams14,
|
|
@@ -2666,10 +2667,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2666
2667
|
occupancyMinutes,
|
|
2667
2668
|
paxBounds,
|
|
2668
2669
|
error,
|
|
2670
|
+
occupyDetails,
|
|
2669
2671
|
occupyDetail,
|
|
2672
|
+
currentOrderId,
|
|
2673
|
+
orderListIds,
|
|
2674
|
+
multipleOrdersState,
|
|
2675
|
+
_availabilityInfo,
|
|
2670
2676
|
resourceSelectType,
|
|
2671
2677
|
resourceState,
|
|
2678
|
+
additionalOrderId,
|
|
2672
2679
|
availabilityInfo,
|
|
2680
|
+
isAdditionalOrderMode,
|
|
2673
2681
|
_this$store$order7,
|
|
2674
2682
|
_res$data,
|
|
2675
2683
|
res,
|
|
@@ -2828,15 +2836,50 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2828
2836
|
});
|
|
2829
2837
|
}
|
|
2830
2838
|
|
|
2831
|
-
// Step2:
|
|
2839
|
+
// Step2: 请求新的资源占用详情接口。occupy_details 第一维是资源,不是订单。
|
|
2832
2840
|
_context37.next = 50;
|
|
2833
|
-
return this.
|
|
2841
|
+
return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
2834
2842
|
case 50:
|
|
2835
|
-
|
|
2843
|
+
occupyDetails = _context37.sent;
|
|
2844
|
+
occupyDetail = (_occupyDetails$ = occupyDetails[0]) !== null && _occupyDetails$ !== void 0 ? _occupyDetails$ : null;
|
|
2845
|
+
currentOrderId = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.order_id);
|
|
2846
|
+
orderListIds = (Array.isArray(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.order_list) ? (occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.order_list) || [] : []).map(function (order) {
|
|
2847
|
+
return toPositiveString(order === null || order === void 0 ? void 0 : order.id);
|
|
2848
|
+
}).filter(Boolean);
|
|
2849
|
+
if (!(!currentOrderId && orderListIds.length > 1)) {
|
|
2850
|
+
_context37.next = 60;
|
|
2851
|
+
break;
|
|
2852
|
+
}
|
|
2853
|
+
multipleOrdersState = _objectSpread(_objectSpread({}, this.normalizeResourceState(occupyDetail, undefined, hasOrderId)), {}, {
|
|
2854
|
+
mode: 'multiple_orders'
|
|
2855
|
+
});
|
|
2856
|
+
this.store.resource = multipleOrdersState;
|
|
2857
|
+
_availabilityInfo = {
|
|
2858
|
+
mode: 'multiple_orders',
|
|
2859
|
+
deskmate_valid: multipleOrdersState.deskmate_valid,
|
|
2860
|
+
relation_id: multipleOrdersState.relationId,
|
|
2861
|
+
table_form_id: multipleOrdersState.tableFormId,
|
|
2862
|
+
table_form_record: multipleOrdersState.table_form_record
|
|
2863
|
+
};
|
|
2864
|
+
this.logMethodSuccess('checkResourceAvailable', {
|
|
2865
|
+
resourceId: normalizedResourceId,
|
|
2866
|
+
mode: _availabilityInfo.mode,
|
|
2867
|
+
orderListCount: orderListIds.length
|
|
2868
|
+
});
|
|
2869
|
+
return _context37.abrupt("return", _availabilityInfo);
|
|
2870
|
+
case 60:
|
|
2836
2871
|
// Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
|
|
2837
2872
|
// 计算当前桌台的 resourceSelectType(single/multiple/capacity)
|
|
2838
2873
|
resourceSelectType = this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id)); // Step4: 用 occupyDetail + resourceSelectType 规整为 resourceState
|
|
2839
2874
|
resourceState = this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId);
|
|
2875
|
+
additionalOrderId = currentOrderId || orderListIds[0];
|
|
2876
|
+
if (additionalOrderId) {
|
|
2877
|
+
resourceState.mode = 'additional_order';
|
|
2878
|
+
resourceState.order_id = additionalOrderId;
|
|
2879
|
+
} else if (!currentOrderId && orderListIds.length === 0) {
|
|
2880
|
+
resourceState.mode = 'idle';
|
|
2881
|
+
resourceState.order_id = undefined;
|
|
2882
|
+
}
|
|
2840
2883
|
this.store.resource = resourceState;
|
|
2841
2884
|
|
|
2842
2885
|
// Step5: 把预约规则商品阶段暂存的 requestEntryPax 等注入 store.resource
|
|
@@ -2872,23 +2915,23 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2872
2915
|
|
|
2873
2916
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
2874
2917
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
2875
|
-
_context37.next =
|
|
2918
|
+
_context37.next = 76;
|
|
2876
2919
|
break;
|
|
2877
2920
|
}
|
|
2878
|
-
_context37.next =
|
|
2921
|
+
_context37.next = 76;
|
|
2879
2922
|
return this.addNewOrder();
|
|
2880
|
-
case
|
|
2881
|
-
// 如果是加单模式,tempOrder
|
|
2882
|
-
if (
|
|
2883
|
-
tempOrder.order_id =
|
|
2923
|
+
case 76:
|
|
2924
|
+
isAdditionalOrderMode = availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code'; // 如果是加单模式,tempOrder 里需要记录目标订单 id,提交的时候走加单接口
|
|
2925
|
+
if (isAdditionalOrderMode) {
|
|
2926
|
+
tempOrder.order_id = additionalOrderId;
|
|
2884
2927
|
}
|
|
2885
2928
|
if (!tempOrder.order_id) {
|
|
2886
|
-
_context37.next =
|
|
2929
|
+
_context37.next = 86;
|
|
2887
2930
|
break;
|
|
2888
2931
|
}
|
|
2889
|
-
_context37.next =
|
|
2932
|
+
_context37.next = 81;
|
|
2890
2933
|
return (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getOrderInfoByRemote(tempOrder.order_id);
|
|
2891
|
-
case
|
|
2934
|
+
case 81:
|
|
2892
2935
|
res = _context37.sent;
|
|
2893
2936
|
// 找到下单的时候输入的 entryPaxNumber
|
|
2894
2937
|
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 +2939,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2896
2939
|
return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
|
|
2897
2940
|
})) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
|
|
2898
2941
|
if (!entryPaxNumber) {
|
|
2899
|
-
_context37.next =
|
|
2942
|
+
_context37.next = 86;
|
|
2900
2943
|
break;
|
|
2901
2944
|
}
|
|
2902
|
-
_context37.next =
|
|
2945
|
+
_context37.next = 86;
|
|
2903
2946
|
return this.setEntryPaxNumber(entryPaxNumber);
|
|
2904
|
-
case
|
|
2947
|
+
case 86:
|
|
2905
2948
|
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 =
|
|
2949
|
+
historicalItems = isAdditionalOrderMode && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
|
|
2907
2950
|
if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
|
|
2908
2951
|
acc.push(_objectSpread({
|
|
2909
2952
|
product_id: p.product_id,
|
|
@@ -2913,13 +2956,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2913
2956
|
} : {}));
|
|
2914
2957
|
return acc;
|
|
2915
2958
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
2916
|
-
_context37.next =
|
|
2959
|
+
_context37.next = 90;
|
|
2917
2960
|
return this.setItemRuleRuntimeConfig({
|
|
2918
2961
|
serviceType: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.businessCode,
|
|
2919
|
-
submissionIndex:
|
|
2962
|
+
submissionIndex: isAdditionalOrderMode ? 1 : 0,
|
|
2920
2963
|
historicalItems: historicalItems
|
|
2921
2964
|
});
|
|
2922
|
-
case
|
|
2965
|
+
case 90:
|
|
2923
2966
|
// operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
|
|
2924
2967
|
// 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
|
|
2925
2968
|
if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
|
|
@@ -2941,18 +2984,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2941
2984
|
isFull: resourceState.isFull
|
|
2942
2985
|
});
|
|
2943
2986
|
return _context37.abrupt("return", availabilityInfo);
|
|
2944
|
-
case
|
|
2945
|
-
_context37.prev =
|
|
2987
|
+
case 95:
|
|
2988
|
+
_context37.prev = 95;
|
|
2946
2989
|
_context37.t0 = _context37["catch"](3);
|
|
2947
2990
|
this.logMethodError('checkResourceAvailable', _context37.t0.message, {
|
|
2948
2991
|
resourceId: normalizedResourceId
|
|
2949
2992
|
});
|
|
2950
2993
|
throw _context37.t0;
|
|
2951
|
-
case
|
|
2994
|
+
case 99:
|
|
2952
2995
|
case "end":
|
|
2953
2996
|
return _context37.stop();
|
|
2954
2997
|
}
|
|
2955
|
-
}, _callee37, this, [[3,
|
|
2998
|
+
}, _callee37, this, [[3, 95]]);
|
|
2956
2999
|
}));
|
|
2957
3000
|
function checkResourceAvailable(_x19) {
|
|
2958
3001
|
return _checkResourceAvailable.apply(this, arguments);
|
|
@@ -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;
|
|
@@ -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: "
|
|
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 |
|
|
329
|
+
weekNum: 0 | 1 | 5 | 3 | 2 | 4 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -118,7 +118,7 @@ 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
|
|
121
|
+
private fetchResourceOccupyDetailsByResourceId;
|
|
122
122
|
checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
|
|
123
123
|
getAdditionalOrderInfo(): Promise<{
|
|
124
124
|
orderId: string;
|
|
@@ -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
|
|
1528
|
-
var _a, _b, _c
|
|
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,7 +1547,7 @@ 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 ((
|
|
1550
|
+
return ((_c = response == null ? void 0 : response.data) == null ? void 0 : _c.occupy_details) ?? [];
|
|
1551
1551
|
}
|
|
1552
1552
|
// 检测当前链接是否可用
|
|
1553
1553
|
// 通过 resource_id + 店铺配置
|
|
@@ -1669,7 +1669,30 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1669
1669
|
cacheId: this.cacheId
|
|
1670
1670
|
});
|
|
1671
1671
|
}
|
|
1672
|
-
const
|
|
1672
|
+
const occupyDetails = await this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
1673
|
+
const occupyDetail = occupyDetails[0] ?? null;
|
|
1674
|
+
const currentOrderId = (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.order_id);
|
|
1675
|
+
const orderListIds = (Array.isArray(occupyDetail == null ? void 0 : occupyDetail.order_list) ? (occupyDetail == null ? void 0 : occupyDetail.order_list) || [] : []).map((order) => (0, import_utils.toPositiveString)(order == null ? void 0 : order.id)).filter(Boolean);
|
|
1676
|
+
if (!currentOrderId && orderListIds.length > 1) {
|
|
1677
|
+
const multipleOrdersState = {
|
|
1678
|
+
...this.normalizeResourceState(occupyDetail, void 0, hasOrderId),
|
|
1679
|
+
mode: "multiple_orders"
|
|
1680
|
+
};
|
|
1681
|
+
this.store.resource = multipleOrdersState;
|
|
1682
|
+
const availabilityInfo2 = {
|
|
1683
|
+
mode: "multiple_orders",
|
|
1684
|
+
deskmate_valid: multipleOrdersState.deskmate_valid,
|
|
1685
|
+
relation_id: multipleOrdersState.relationId,
|
|
1686
|
+
table_form_id: multipleOrdersState.tableFormId,
|
|
1687
|
+
table_form_record: multipleOrdersState.table_form_record
|
|
1688
|
+
};
|
|
1689
|
+
this.logMethodSuccess("checkResourceAvailable", {
|
|
1690
|
+
resourceId: normalizedResourceId,
|
|
1691
|
+
mode: availabilityInfo2.mode,
|
|
1692
|
+
orderListCount: orderListIds.length
|
|
1693
|
+
});
|
|
1694
|
+
return availabilityInfo2;
|
|
1695
|
+
}
|
|
1673
1696
|
const resourceSelectType = this.resolveResourceSelectType(
|
|
1674
1697
|
(0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id)
|
|
1675
1698
|
);
|
|
@@ -1678,6 +1701,14 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1678
1701
|
resourceSelectType,
|
|
1679
1702
|
hasOrderId
|
|
1680
1703
|
);
|
|
1704
|
+
const additionalOrderId = currentOrderId || orderListIds[0];
|
|
1705
|
+
if (additionalOrderId) {
|
|
1706
|
+
resourceState.mode = "additional_order";
|
|
1707
|
+
resourceState.order_id = additionalOrderId;
|
|
1708
|
+
} else if (!currentOrderId && orderListIds.length === 0) {
|
|
1709
|
+
resourceState.mode = "idle";
|
|
1710
|
+
resourceState.order_id = void 0;
|
|
1711
|
+
}
|
|
1681
1712
|
this.store.resource = resourceState;
|
|
1682
1713
|
if (pendingRequestEntryPax !== void 0) {
|
|
1683
1714
|
this.store.resource.requestEntryPax = pendingRequestEntryPax;
|
|
@@ -1708,8 +1739,9 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1708
1739
|
if (availabilityInfo.mode === "idle") {
|
|
1709
1740
|
await this.addNewOrder();
|
|
1710
1741
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1742
|
+
const isAdditionalOrderMode = availabilityInfo.mode === "additional_order" || availabilityInfo.mode === "additional_order_with_code";
|
|
1743
|
+
if (isAdditionalOrderMode) {
|
|
1744
|
+
tempOrder.order_id = additionalOrderId;
|
|
1713
1745
|
}
|
|
1714
1746
|
if (tempOrder.order_id) {
|
|
1715
1747
|
const res = await ((_i = this.store.order) == null ? void 0 : _i.getOrderInfoByRemote(tempOrder.order_id));
|
|
@@ -1722,7 +1754,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1722
1754
|
}
|
|
1723
1755
|
}
|
|
1724
1756
|
const lastOrderInfo = (_o = (_n = this.store.order) == null ? void 0 : _n.getLastOrderInfo) == null ? void 0 : _o.call(_n);
|
|
1725
|
-
const historicalItems =
|
|
1757
|
+
const historicalItems = isAdditionalOrderMode && Array.isArray(lastOrderInfo == null ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce((acc, p) => {
|
|
1726
1758
|
if (typeof (p == null ? void 0 : p.product_id) !== "number")
|
|
1727
1759
|
return acc;
|
|
1728
1760
|
acc.push({
|
|
@@ -1734,7 +1766,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1734
1766
|
}, []) : [];
|
|
1735
1767
|
await this.setItemRuleRuntimeConfig({
|
|
1736
1768
|
serviceType: (_p = this.otherParams) == null ? void 0 : _p.businessCode,
|
|
1737
|
-
submissionIndex:
|
|
1769
|
+
submissionIndex: isAdditionalOrderMode ? 1 : 0,
|
|
1738
1770
|
historicalItems
|
|
1739
1771
|
});
|
|
1740
1772
|
if (outsideOperatingHours && closedBehaviorValue === "show_menu_disabled") {
|
|
@@ -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;
|