@pisell/pisellos 2.1.155 → 2.1.158
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/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/Order/index.d.ts +1 -0
- package/dist/modules/Order/index.js +18 -1
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +35 -3
- package/dist/modules/Product/types.d.ts +7 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.d.ts +16 -1
- package/dist/solution/BookingByStep/index.js +276 -204
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/ScanOrder/index.d.ts +2 -6
- package/dist/solution/ScanOrder/index.js +62 -259
- package/dist/solution/ScanOrder/types.d.ts +2 -20
- package/dist/solution/ScanOrder/utils.d.ts +0 -5
- package/dist/solution/ScanOrder/utils.js +23 -55
- package/dist/solution/VenueBooking/index.d.ts +19 -0
- package/dist/solution/VenueBooking/index.js +963 -733
- package/dist/solution/VenueBooking/types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/Order/index.d.ts +1 -0
- package/lib/modules/Order/index.js +14 -0
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +36 -5
- package/lib/modules/Product/types.d.ts +7 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.d.ts +16 -1
- package/lib/solution/BookingByStep/index.js +39 -0
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/ScanOrder/index.d.ts +2 -6
- package/lib/solution/ScanOrder/index.js +51 -221
- package/lib/solution/ScanOrder/types.d.ts +2 -20
- package/lib/solution/ScanOrder/utils.d.ts +0 -5
- package/lib/solution/ScanOrder/utils.js +0 -23
- package/lib/solution/VenueBooking/index.d.ts +19 -0
- package/lib/solution/VenueBooking/index.js +134 -16
- package/lib/solution/VenueBooking/types.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -867,13 +867,13 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
867
867
|
const ruleProduct = this.enabledReservationRuleProducts[0];
|
|
868
868
|
const resourceState = this.store.resource;
|
|
869
869
|
const resourceSelectType = resourceState == null ? void 0 : resourceState.resourceSelectType;
|
|
870
|
-
const
|
|
870
|
+
const resolveResourceCapacity = () => {
|
|
871
871
|
var _a;
|
|
872
872
|
if (resourceSelectType === "single") {
|
|
873
873
|
const raw = (_a = resourceState == null ? void 0 : resourceState.table_form_record) == null ? void 0 : _a.capacity;
|
|
874
874
|
const num = Number(raw);
|
|
875
875
|
if (Number.isFinite(num) && num > 0)
|
|
876
|
-
return
|
|
876
|
+
return num;
|
|
877
877
|
return 1;
|
|
878
878
|
}
|
|
879
879
|
return 1;
|
|
@@ -892,8 +892,8 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
892
892
|
};
|
|
893
893
|
}
|
|
894
894
|
const rawCollectPax = (_a = tempOrder.metadata) == null ? void 0 : _a.collect_pax;
|
|
895
|
-
const
|
|
896
|
-
const
|
|
895
|
+
const hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== void 0 && rawCollectPax !== "";
|
|
896
|
+
const resourceCapacityValue = hasCollectPaxForCapacity ? (0, import_utils2.normalizeSubmitCollectPaxValue)(rawCollectPax) : resolveResourceCapacity();
|
|
897
897
|
const pickOriginal = (value) => {
|
|
898
898
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
899
899
|
const original = value.original;
|
|
@@ -909,42 +909,35 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
909
909
|
main_field: mainField,
|
|
910
910
|
form_id: resourceState.tableFormId,
|
|
911
911
|
relation_id: resourceState.relationId ?? resourceId,
|
|
912
|
-
capacity:
|
|
912
|
+
capacity: resourceCapacityValue,
|
|
913
913
|
metadata: this.buildScanOrderResourceMetadata({
|
|
914
914
|
resourceState,
|
|
915
915
|
resourceName: mainField
|
|
916
916
|
})
|
|
917
917
|
} : void 0;
|
|
918
918
|
const ruleProductUid = ruleProduct ? (0, import_utils2.createUuidV4)() : void 0;
|
|
919
|
+
const bookingCapacityValue = resourceCapacityValue;
|
|
919
920
|
const bookingCapacityDimensionId = (0, import_utils.pickFirstCustomCapacityDimensionId)(this.enabledReservationRuleProducts) ?? 0;
|
|
920
|
-
const nextBookings = (payload.bookings || []).map((booking, idx) => {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
}
|
|
941
|
-
]
|
|
942
|
-
} : {}
|
|
943
|
-
},
|
|
944
|
-
...idx === 0 && resourceEntry ? { resources: [resourceEntry] } : {},
|
|
945
|
-
...idx === 0 && ruleProductUid ? { product_uid: ruleProductUid } : {}
|
|
946
|
-
};
|
|
947
|
-
});
|
|
921
|
+
const nextBookings = (payload.bookings || []).map((booking, idx) => ({
|
|
922
|
+
...booking,
|
|
923
|
+
number: bookingCapacityValue,
|
|
924
|
+
appointment_status: "started",
|
|
925
|
+
metadata: {
|
|
926
|
+
...booking.metadata || {},
|
|
927
|
+
...resourceSelectType ? { resource_select_type: resourceSelectType } : {},
|
|
928
|
+
...resourceSelectType ? {
|
|
929
|
+
capacity: [
|
|
930
|
+
{
|
|
931
|
+
id: bookingCapacityDimensionId,
|
|
932
|
+
value: bookingCapacityValue,
|
|
933
|
+
name: ""
|
|
934
|
+
}
|
|
935
|
+
]
|
|
936
|
+
} : {}
|
|
937
|
+
},
|
|
938
|
+
...idx === 0 && resourceEntry ? { resources: [resourceEntry] } : {},
|
|
939
|
+
...idx === 0 && ruleProductUid ? { product_uid: ruleProductUid } : {}
|
|
940
|
+
}));
|
|
948
941
|
const nextProducts = [...payload.products || []];
|
|
949
942
|
if (ruleProduct && ruleProductUid && !tempOrder.order_id) {
|
|
950
943
|
const sellingPrice = String(ruleProduct.price ?? "0.00");
|
|
@@ -981,7 +974,10 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
981
974
|
if (!this.store.order) {
|
|
982
975
|
throw new Error("scanOrder解决方案需要 order 模块支持");
|
|
983
976
|
}
|
|
977
|
+
const pax = (0, import_utils2.normalizeSubmitCollectPaxValue)(this.store.entryPaxNumber);
|
|
978
|
+
this.store.entryPaxNumber = pax;
|
|
984
979
|
const tempOrderForSubmit = this.store.order.ensureTempOrder();
|
|
980
|
+
tempOrderForSubmit.metadata = { ...tempOrderForSubmit.metadata, collect_pax: pax };
|
|
985
981
|
tempOrderForSubmit.delivery_type = "shop_service";
|
|
986
982
|
const resourceTableName = (_b = (_a = this.store.resource) == null ? void 0 : _a.table_form_record) == null ? void 0 : _b.name;
|
|
987
983
|
if (resourceTableName && typeof resourceTableName === "object") {
|
|
@@ -1528,8 +1524,8 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1528
1524
|
const matched = resources.find((r) => Number(r == null ? void 0 : r.id) === numericFormId);
|
|
1529
1525
|
return matched == null ? void 0 : matched.type;
|
|
1530
1526
|
}
|
|
1531
|
-
async
|
|
1532
|
-
var _a, _b, _c;
|
|
1527
|
+
async fetchResourceOccupyDetailByResourceId(resourceId) {
|
|
1528
|
+
var _a, _b, _c, _d;
|
|
1533
1529
|
const formRecordId = Number(resourceId);
|
|
1534
1530
|
if (!Number.isFinite(formRecordId) || formRecordId <= 0) {
|
|
1535
1531
|
throw new Error(`[ScanOrder] 非法桌台 resourceId: ${resourceId}`);
|
|
@@ -1551,57 +1547,13 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1551
1547
|
if (!(response == null ? void 0 : response.status)) {
|
|
1552
1548
|
throw new Error((response == null ? void 0 : response.message) || "获取资源占用详情失败");
|
|
1553
1549
|
}
|
|
1554
|
-
return ((_c = response == null ? void 0 : response.data) == null ? void 0 : _c.occupy_details)
|
|
1555
|
-
}
|
|
1556
|
-
resolveAdditionalOrderFromOccupyDetail(detail, resourceSelectType, allowAddItems) {
|
|
1557
|
-
const currentOrderId = (0, import_utils.toPositiveString)(detail == null ? void 0 : detail.order_id);
|
|
1558
|
-
if (currentOrderId) {
|
|
1559
|
-
return {
|
|
1560
|
-
matched: true,
|
|
1561
|
-
order_id: currentOrderId
|
|
1562
|
-
};
|
|
1563
|
-
}
|
|
1564
|
-
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);
|
|
1565
|
-
if (resourceSelectType !== "single") {
|
|
1566
|
-
return {
|
|
1567
|
-
matched: false,
|
|
1568
|
-
reason: "no_order"
|
|
1569
|
-
};
|
|
1570
|
-
}
|
|
1571
|
-
if (!orderListIds.length) {
|
|
1572
|
-
return {
|
|
1573
|
-
matched: false,
|
|
1574
|
-
reason: "no_order"
|
|
1575
|
-
};
|
|
1576
|
-
}
|
|
1577
|
-
if (!allowAddItems) {
|
|
1578
|
-
return {
|
|
1579
|
-
matched: false,
|
|
1580
|
-
reason: "add_items_disabled"
|
|
1581
|
-
};
|
|
1582
|
-
}
|
|
1583
|
-
if (orderListIds.length === 1) {
|
|
1584
|
-
return {
|
|
1585
|
-
matched: true,
|
|
1586
|
-
order_id: orderListIds[0]
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
if (orderListIds.length > 1) {
|
|
1590
|
-
return {
|
|
1591
|
-
matched: false,
|
|
1592
|
-
reason: "multiple_orders"
|
|
1593
|
-
};
|
|
1594
|
-
}
|
|
1595
|
-
return {
|
|
1596
|
-
matched: false,
|
|
1597
|
-
reason: "no_order"
|
|
1598
|
-
};
|
|
1550
|
+
return ((_d = (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.occupy_details) == null ? void 0 : _d[0]) ?? null;
|
|
1599
1551
|
}
|
|
1600
1552
|
// 检测当前链接是否可用
|
|
1601
1553
|
// 通过 resource_id + 店铺配置
|
|
1602
1554
|
// hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
|
|
1603
1555
|
async checkResourceAvailable(resourceId, hasOrderId = false) {
|
|
1604
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p
|
|
1556
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1605
1557
|
const normalizedResourceId = String(resourceId ?? "").trim();
|
|
1606
1558
|
this.logMethodStart("checkResourceAvailable", {
|
|
1607
1559
|
resourceId: normalizedResourceId
|
|
@@ -1693,19 +1645,14 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1693
1645
|
cacheId: this.cacheId
|
|
1694
1646
|
});
|
|
1695
1647
|
if (Array.isArray(loaded)) {
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
normalizedResourceId
|
|
1699
|
-
);
|
|
1700
|
-
const ruleProductsForResource = matchedRuleProduct ? [matchedRuleProduct] : [];
|
|
1701
|
-
this.enabledReservationRuleProducts = ruleProductsForResource;
|
|
1702
|
-
const occupancyMinutes = (0, import_utils.pickFirstDurationMinutesFromProducts)(ruleProductsForResource);
|
|
1648
|
+
this.enabledReservationRuleProducts = loaded;
|
|
1649
|
+
const occupancyMinutes = (0, import_utils.pickFirstDurationMinutesFromProducts)(loaded);
|
|
1703
1650
|
if (occupancyMinutes !== void 0) {
|
|
1704
1651
|
tempOrder.metadata.table_occupancy_duration = occupancyMinutes;
|
|
1705
1652
|
}
|
|
1706
|
-
if ((0, import_utils.hasCustomCapacityProduct)(
|
|
1653
|
+
if ((0, import_utils.hasCustomCapacityProduct)(loaded)) {
|
|
1707
1654
|
pendingRequestEntryPax = 1;
|
|
1708
|
-
const paxBounds = (0, import_utils.pickFirstCustomCapacityPaxBounds)(
|
|
1655
|
+
const paxBounds = (0, import_utils.pickFirstCustomCapacityPaxBounds)(loaded);
|
|
1709
1656
|
if ((paxBounds == null ? void 0 : paxBounds.min) !== void 0)
|
|
1710
1657
|
pendingRequestPaxMin = paxBounds.min;
|
|
1711
1658
|
if ((paxBounds == null ? void 0 : paxBounds.max) !== void 0)
|
|
@@ -1722,54 +1669,15 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1722
1669
|
cacheId: this.cacheId
|
|
1723
1670
|
});
|
|
1724
1671
|
}
|
|
1725
|
-
const
|
|
1726
|
-
const occupyDetail = occupyDetails[0] ?? null;
|
|
1672
|
+
const occupyDetail = await this.fetchResourceOccupyDetailByResourceId(normalizedResourceId);
|
|
1727
1673
|
const resourceSelectType = this.resolveResourceSelectType(
|
|
1728
1674
|
(0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id)
|
|
1729
1675
|
);
|
|
1730
|
-
const allowAddItems = (0, import_utils.toBoolean)(dineInConfig == null ? void 0 : dineInConfig["sale.allow_add_items"]);
|
|
1731
|
-
const additionalOrderResult = this.resolveAdditionalOrderFromOccupyDetail(
|
|
1732
|
-
occupyDetail,
|
|
1733
|
-
resourceSelectType,
|
|
1734
|
-
allowAddItems
|
|
1735
|
-
);
|
|
1736
|
-
if (additionalOrderResult.reason === "multiple_orders") {
|
|
1737
|
-
const multipleOrdersState = {
|
|
1738
|
-
...this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId),
|
|
1739
|
-
mode: "multiple_orders"
|
|
1740
|
-
};
|
|
1741
|
-
this.store.resource = multipleOrdersState;
|
|
1742
|
-
const availabilityInfo2 = {
|
|
1743
|
-
mode: "multiple_orders",
|
|
1744
|
-
deskmate_valid: multipleOrdersState.deskmate_valid,
|
|
1745
|
-
relation_id: multipleOrdersState.relationId,
|
|
1746
|
-
table_form_id: multipleOrdersState.tableFormId,
|
|
1747
|
-
table_form_record: multipleOrdersState.table_form_record
|
|
1748
|
-
};
|
|
1749
|
-
this.logMethodSuccess("checkResourceAvailable", {
|
|
1750
|
-
resourceId: normalizedResourceId,
|
|
1751
|
-
mode: availabilityInfo2.mode,
|
|
1752
|
-
orderListCount: ((_e = occupyDetail == null ? void 0 : occupyDetail.order_list) == null ? void 0 : _e.length) || 0,
|
|
1753
|
-
resourceSelectType
|
|
1754
|
-
});
|
|
1755
|
-
return availabilityInfo2;
|
|
1756
|
-
}
|
|
1757
1676
|
const resourceState = this.normalizeResourceState(
|
|
1758
1677
|
occupyDetail,
|
|
1759
1678
|
resourceSelectType,
|
|
1760
1679
|
hasOrderId
|
|
1761
1680
|
);
|
|
1762
|
-
const additionalOrderId = additionalOrderResult.order_id;
|
|
1763
|
-
if (additionalOrderId) {
|
|
1764
|
-
resourceState.mode = "additional_order";
|
|
1765
|
-
resourceState.order_id = additionalOrderId;
|
|
1766
|
-
} else if (additionalOrderResult.reason === "add_items_disabled") {
|
|
1767
|
-
resourceState.mode = "resource_busy";
|
|
1768
|
-
resourceState.order_id = "0";
|
|
1769
|
-
} else if (resourceSelectType === "multiple" && resourceState.isFull) {
|
|
1770
|
-
resourceState.mode = "resource_busy";
|
|
1771
|
-
resourceState.order_id = "0";
|
|
1772
|
-
}
|
|
1773
1681
|
this.store.resource = resourceState;
|
|
1774
1682
|
if (pendingRequestEntryPax !== void 0) {
|
|
1775
1683
|
this.store.resource.requestEntryPax = pendingRequestEntryPax;
|
|
@@ -1787,35 +1695,34 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1787
1695
|
table_form_id: resourceState.tableFormId,
|
|
1788
1696
|
deskmate_valid: resourceState.deskmate_valid,
|
|
1789
1697
|
table_form_record: resourceState.table_form_record,
|
|
1790
|
-
policy: (
|
|
1791
|
-
partyroom_booking: (
|
|
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,
|
|
1792
1700
|
...this.store.resource.requestEntryPax !== void 0 ? { requestEntryPax: this.store.resource.requestEntryPax } : {},
|
|
1793
1701
|
...this.store.resource.requestPaxMin !== void 0 ? { requestPaxMin: this.store.resource.requestPaxMin } : {},
|
|
1794
1702
|
...this.store.resource.requestPaxMax !== void 0 ? { requestPaxMax: this.store.resource.requestPaxMax } : {}
|
|
1795
1703
|
};
|
|
1796
|
-
tempOrder.relation_id = normalizedResourceId || ((
|
|
1704
|
+
tempOrder.relation_id = normalizedResourceId || ((_g = this.otherParams) == null ? void 0 : _g.relation_id);
|
|
1797
1705
|
tempOrder.table_form_id = resourceState.tableFormId;
|
|
1798
1706
|
tempOrder.resource_id = normalizedResourceId;
|
|
1799
|
-
(
|
|
1707
|
+
(_h = this.store.order) == null ? void 0 : _h.persistTempOrder();
|
|
1800
1708
|
if (availabilityInfo.mode === "idle") {
|
|
1801
1709
|
await this.addNewOrder();
|
|
1802
1710
|
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
tempOrder.order_id = additionalOrderId;
|
|
1711
|
+
if (availabilityInfo.mode === "additional_order" || availabilityInfo.mode === "additional_order_with_code") {
|
|
1712
|
+
tempOrder.order_id = resourceState.lastOrderId;
|
|
1806
1713
|
}
|
|
1807
1714
|
if (tempOrder.order_id) {
|
|
1808
|
-
const res = await ((
|
|
1809
|
-
const entryPaxNumber = (
|
|
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) => {
|
|
1810
1717
|
var _a2;
|
|
1811
1718
|
return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
|
|
1812
|
-
})) == null ? void 0 :
|
|
1719
|
+
})) == null ? void 0 : _l.metadata) == null ? void 0 : _m.collect_pax;
|
|
1813
1720
|
if (entryPaxNumber) {
|
|
1814
1721
|
await this.setEntryPaxNumber(entryPaxNumber);
|
|
1815
1722
|
}
|
|
1816
1723
|
}
|
|
1817
|
-
const lastOrderInfo = (
|
|
1818
|
-
const historicalItems =
|
|
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) => {
|
|
1819
1726
|
if (typeof (p == null ? void 0 : p.product_id) !== "number")
|
|
1820
1727
|
return acc;
|
|
1821
1728
|
acc.push({
|
|
@@ -1826,8 +1733,8 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1826
1733
|
return acc;
|
|
1827
1734
|
}, []) : [];
|
|
1828
1735
|
await this.setItemRuleRuntimeConfig({
|
|
1829
|
-
serviceType: (
|
|
1830
|
-
submissionIndex:
|
|
1736
|
+
serviceType: (_p = this.otherParams) == null ? void 0 : _p.businessCode,
|
|
1737
|
+
submissionIndex: hasOrderId ? 1 : 0,
|
|
1831
1738
|
historicalItems
|
|
1832
1739
|
});
|
|
1833
1740
|
if (outsideOperatingHours && closedBehaviorValue === "show_menu_disabled") {
|
|
@@ -2000,83 +1907,6 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
2000
1907
|
getEntryPaxNumber() {
|
|
2001
1908
|
return this.store.entryPaxNumber;
|
|
2002
1909
|
}
|
|
2003
|
-
async syncAdditionalOrderFromResource(resourceId) {
|
|
2004
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2005
|
-
const tempOrder = this.ensureTempOrder();
|
|
2006
|
-
const normalizedResourceId = String(
|
|
2007
|
-
resourceId ?? tempOrder.resource_id ?? ((_a = this.store.resource) == null ? void 0 : _a.relationId) ?? ((_b = this.store.resource) == null ? void 0 : _b.relation_id) ?? ""
|
|
2008
|
-
).trim();
|
|
2009
|
-
this.logMethodStart("syncAdditionalOrderFromResource", {
|
|
2010
|
-
resourceId: normalizedResourceId
|
|
2011
|
-
});
|
|
2012
|
-
if (!normalizedResourceId) {
|
|
2013
|
-
const result2 = {
|
|
2014
|
-
matched: false,
|
|
2015
|
-
reason: "missing_resource_id"
|
|
2016
|
-
};
|
|
2017
|
-
this.logMethodSuccess("syncAdditionalOrderFromResource", result2);
|
|
2018
|
-
return result2;
|
|
2019
|
-
}
|
|
2020
|
-
const occupyDetails = await this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
2021
|
-
const occupyDetail = occupyDetails[0] ?? null;
|
|
2022
|
-
const resourceSelectType = ((_c = this.store.resource) == null ? void 0 : _c.resourceSelectType) || this.resolveResourceSelectType((0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id));
|
|
2023
|
-
const allowAddItems = (0, import_utils.toBoolean)(
|
|
2024
|
-
(_e = (_d = this.otherParams) == null ? void 0 : _d.dineInConfig) == null ? void 0 : _e["sale.allow_add_items"]
|
|
2025
|
-
);
|
|
2026
|
-
const result = this.resolveAdditionalOrderFromOccupyDetail(
|
|
2027
|
-
occupyDetail,
|
|
2028
|
-
resourceSelectType,
|
|
2029
|
-
allowAddItems
|
|
2030
|
-
);
|
|
2031
|
-
if (!result.matched || !result.order_id) {
|
|
2032
|
-
this.logMethodSuccess("syncAdditionalOrderFromResource", {
|
|
2033
|
-
...result,
|
|
2034
|
-
resourceId: normalizedResourceId,
|
|
2035
|
-
resourceSelectType,
|
|
2036
|
-
allowAddItems
|
|
2037
|
-
});
|
|
2038
|
-
return result;
|
|
2039
|
-
}
|
|
2040
|
-
tempOrder.order_id = result.order_id;
|
|
2041
|
-
tempOrder.resource_id = normalizedResourceId;
|
|
2042
|
-
tempOrder.relation_id = (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
|
|
2043
|
-
tempOrder.table_form_id = (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
|
|
2044
|
-
(_f = this.store.order) == null ? void 0 : _f.persistTempOrder();
|
|
2045
|
-
this.logMethodSuccess("syncAdditionalOrderFromResource", {
|
|
2046
|
-
...result,
|
|
2047
|
-
resourceId: normalizedResourceId,
|
|
2048
|
-
resourceSelectType,
|
|
2049
|
-
allowAddItems
|
|
2050
|
-
});
|
|
2051
|
-
return result;
|
|
2052
|
-
}
|
|
2053
|
-
// 读取预约规则商品的资源选择类型:single=单个预约,multiple=多个预约,capacity=容量型预约
|
|
2054
|
-
// 依赖 checkResourceAvailable 已根据预约规则商品与 occupy-detail 的 form_id 计算并缓存 store.resource
|
|
2055
|
-
getReservationResourceSelectType() {
|
|
2056
|
-
var _a;
|
|
2057
|
-
this.logMethodStart("getReservationResourceSelectType");
|
|
2058
|
-
const resourceSelectType = (_a = this.store.resource) == null ? void 0 : _a.resourceSelectType;
|
|
2059
|
-
const result = {
|
|
2060
|
-
...resourceSelectType ? { resourceSelectType } : {},
|
|
2061
|
-
isSingleReservation: resourceSelectType === "single",
|
|
2062
|
-
isMultipleReservation: resourceSelectType === "multiple",
|
|
2063
|
-
isCapacityReservation: resourceSelectType === "capacity"
|
|
2064
|
-
};
|
|
2065
|
-
this.logMethodSuccess("getReservationResourceSelectType", result);
|
|
2066
|
-
return result;
|
|
2067
|
-
}
|
|
2068
|
-
// 判定后台是否开启允许加餐
|
|
2069
|
-
// 依赖 checkResourceAvailable 已缓存的 dineInConfig
|
|
2070
|
-
checkAllowAddItems() {
|
|
2071
|
-
var _a;
|
|
2072
|
-
this.logMethodStart("checkAllowAddItems");
|
|
2073
|
-
const dineInConfig = ((_a = this.otherParams) == null ? void 0 : _a.dineInConfig) || {};
|
|
2074
|
-
const result = {
|
|
2075
|
-
enabled: (0, import_utils.toBoolean)(dineInConfig["sale.allow_add_items"])
|
|
2076
|
-
};
|
|
2077
|
-
this.logMethodSuccess("checkAllowAddItems", result);
|
|
2078
|
-
return result;
|
|
2079
|
-
}
|
|
2080
1910
|
// 读取取餐/送餐开关
|
|
2081
1911
|
// 依赖 checkResourceAvailable 已缓存的 dineInConfig
|
|
2082
1912
|
getFulfillmentModes() {
|
|
@@ -34,6 +34,7 @@ export interface ScanOrderOrderProductIdentity {
|
|
|
34
34
|
/** 参与合并/匹配;与 remove 通配语义见 isSkuOnlyDeleteIdentity */
|
|
35
35
|
product_option_item?: any[];
|
|
36
36
|
product_bundle?: any[];
|
|
37
|
+
shop_id?: number | string;
|
|
37
38
|
}
|
|
38
39
|
export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
|
|
39
40
|
order_detail_id: number | null;
|
|
@@ -185,7 +186,7 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
|
|
|
185
186
|
}>;
|
|
186
187
|
products: ScanOrderSubmitProduct[];
|
|
187
188
|
}
|
|
188
|
-
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | '
|
|
189
|
+
export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'submit_disabled' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
|
|
189
190
|
export interface ScanOrderTableFormRecord {
|
|
190
191
|
policy?: string | null;
|
|
191
192
|
partyroom_booking?: string | null;
|
|
@@ -228,10 +229,6 @@ export interface ScanOrderResourceOccupyDetail {
|
|
|
228
229
|
form_id?: number | string | null;
|
|
229
230
|
order_id?: number | string | null;
|
|
230
231
|
last_order_id?: number | string | null;
|
|
231
|
-
order_list?: Array<{
|
|
232
|
-
id?: number | string | null;
|
|
233
|
-
[key: string]: any;
|
|
234
|
-
}> | null;
|
|
235
232
|
resource_capacity?: ScanOrderResourceCapacity[] | null;
|
|
236
233
|
form_record?: ScanOrderTableFormRecord | null;
|
|
237
234
|
[key: string]: any;
|
|
@@ -245,21 +242,6 @@ export interface ScanOrderResourceOccupyDetailApiResponse {
|
|
|
245
242
|
} | null;
|
|
246
243
|
}
|
|
247
244
|
export type ScanOrderResourceSelectType = 'single' | 'multiple' | 'capacity';
|
|
248
|
-
export interface ScanOrderReservationResourceSelectInfo {
|
|
249
|
-
resourceSelectType?: ScanOrderResourceSelectType;
|
|
250
|
-
isSingleReservation: boolean;
|
|
251
|
-
isMultipleReservation: boolean;
|
|
252
|
-
isCapacityReservation: boolean;
|
|
253
|
-
}
|
|
254
|
-
export interface ScanOrderAllowAddItemsInfo {
|
|
255
|
-
enabled: boolean;
|
|
256
|
-
}
|
|
257
|
-
export type ScanOrderSyncAdditionalOrderReason = 'missing_resource_id' | 'no_order' | 'multiple_orders' | 'add_items_disabled' | 'invalid_order_id';
|
|
258
|
-
export interface ScanOrderSyncAdditionalOrderResult {
|
|
259
|
-
matched: boolean;
|
|
260
|
-
order_id?: string;
|
|
261
|
-
reason?: ScanOrderSyncAdditionalOrderReason;
|
|
262
|
-
}
|
|
263
245
|
export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
|
|
264
246
|
relationId?: string;
|
|
265
247
|
tableFormId?: string;
|
|
@@ -134,11 +134,6 @@ export declare function normalizeOrderProduct(product: Partial<ScanOrderOrderPro
|
|
|
134
134
|
* 从 reservation.enabled_reservation_rules 中收集 type=link 的商品 id。
|
|
135
135
|
*/
|
|
136
136
|
export declare function collectLinkProductIdsFromReservationRules(rules: unknown): number[];
|
|
137
|
-
/**
|
|
138
|
-
* 找到第一个归属指定桌台的预约规则商品。
|
|
139
|
-
* 归属判断基于商品资源中的 default_resource / optional_resource。
|
|
140
|
-
*/
|
|
141
|
-
export declare function findReservationRuleProductByResourceId(products: ProductData[], resourceId: string | number | null | undefined): ProductData | undefined;
|
|
142
137
|
/**
|
|
143
138
|
* 返回列表中第一个带有效 duration.value(分钟)的商品时长。
|
|
144
139
|
*/
|
|
@@ -39,7 +39,6 @@ __export(utils_exports, {
|
|
|
39
39
|
computeResourceIsFull: () => computeResourceIsFull,
|
|
40
40
|
createEmptySummary: () => createEmptySummary,
|
|
41
41
|
extractStrategyModelIdsFromTableConfig: () => extractStrategyModelIdsFromTableConfig,
|
|
42
|
-
findReservationRuleProductByResourceId: () => findReservationRuleProductByResourceId,
|
|
43
42
|
getProductIdentityIndex: () => getProductIdentityIndex,
|
|
44
43
|
getSafeProductNum: () => getSafeProductNum,
|
|
45
44
|
getTopLevelProductId: () => getTopLevelProductId,
|
|
@@ -511,27 +510,6 @@ function collectLinkProductIdsFromReservationRules(rules) {
|
|
|
511
510
|
}
|
|
512
511
|
return [...new Set(ids)];
|
|
513
512
|
}
|
|
514
|
-
function findReservationRuleProductByResourceId(products, resourceId) {
|
|
515
|
-
var _a;
|
|
516
|
-
const numericResourceId = Number(resourceId);
|
|
517
|
-
if (!Number.isFinite(numericResourceId) || numericResourceId <= 0)
|
|
518
|
-
return void 0;
|
|
519
|
-
for (const product of products) {
|
|
520
|
-
const resources = (_a = product == null ? void 0 : product.product_resource) == null ? void 0 : _a.resources;
|
|
521
|
-
if (!Array.isArray(resources))
|
|
522
|
-
continue;
|
|
523
|
-
const hasMatchedResource = resources.some((resource) => {
|
|
524
|
-
const defaultResources = Array.isArray(resource == null ? void 0 : resource.default_resource) ? resource.default_resource : [];
|
|
525
|
-
const optionalResources = Array.isArray(resource == null ? void 0 : resource.optional_resource) ? resource.optional_resource : [];
|
|
526
|
-
return [...defaultResources, ...optionalResources].some(
|
|
527
|
-
(id) => Number(id) === numericResourceId
|
|
528
|
-
);
|
|
529
|
-
});
|
|
530
|
-
if (hasMatchedResource)
|
|
531
|
-
return product;
|
|
532
|
-
}
|
|
533
|
-
return void 0;
|
|
534
|
-
}
|
|
535
513
|
function pickFirstDurationMinutesFromProducts(products) {
|
|
536
514
|
var _a;
|
|
537
515
|
for (const product of products) {
|
|
@@ -635,7 +613,6 @@ function pickFirstCustomCapacityDimensionId(products) {
|
|
|
635
613
|
computeResourceIsFull,
|
|
636
614
|
createEmptySummary,
|
|
637
615
|
extractStrategyModelIdsFromTableConfig,
|
|
638
|
-
findReservationRuleProductByResourceId,
|
|
639
616
|
getProductIdentityIndex,
|
|
640
617
|
getSafeProductNum,
|
|
641
618
|
getTopLevelProductId,
|
|
@@ -7,6 +7,7 @@ import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
|
|
|
7
7
|
import type { ProductData } from '../../modules/Product/types';
|
|
8
8
|
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
9
9
|
import type { StrategyConfig } from '../../model/strategy/type';
|
|
10
|
+
import type { IAppendFormRecordParams, IRefreshAllFormRecordsParams } from '../../modules/Holder/types';
|
|
10
11
|
export * from './types';
|
|
11
12
|
interface VenueBookingItemRuleRuntimeConfig {
|
|
12
13
|
strategyConfigs?: StrategyConfig[];
|
|
@@ -52,6 +53,12 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
52
53
|
constructor(name?: string, version?: string);
|
|
53
54
|
private normalizeCustomerId;
|
|
54
55
|
private resolveCustomerIdFromLoginPayload;
|
|
56
|
+
private resolveHolderCustomerId;
|
|
57
|
+
/**
|
|
58
|
+
* 按商品 holder_config 预加载表单数据到 holderMap。
|
|
59
|
+
* appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
|
|
60
|
+
*/
|
|
61
|
+
private preloadHolderForms;
|
|
55
62
|
private clearLoginEffectListeners;
|
|
56
63
|
private registerLoginEffect;
|
|
57
64
|
private registerCustomerLoginListeners;
|
|
@@ -194,6 +201,18 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
194
201
|
getUIState<T = any>(key: string): T | undefined;
|
|
195
202
|
deleteUIState(key: string): void;
|
|
196
203
|
setBookingHolder(bookingUid: string, holder: any): void;
|
|
204
|
+
/**
|
|
205
|
+
* 获取 holder 表单 map
|
|
206
|
+
*/
|
|
207
|
+
getHolderFormMap(): import("../../modules/Holder").HolderFormMap;
|
|
208
|
+
/**
|
|
209
|
+
* UI 层触发:按当前 holderMap 批量刷新所有表单的 records
|
|
210
|
+
*/
|
|
211
|
+
refreshAllHolderFormRecords(params?: Pick<IRefreshAllFormRecordsParams, 'customer_id' | 'useCache' | 'recordsUrl' | 'num' | 'skip'>): Promise<import("../../modules/Holder").HolderFormMap>;
|
|
212
|
+
/**
|
|
213
|
+
* 添加表单记录
|
|
214
|
+
*/
|
|
215
|
+
appendFormRecord(params: IAppendFormRecordParams): import("../../modules/Holder").IFormRecord;
|
|
197
216
|
checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
|
|
198
217
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
199
218
|
cover?: boolean;
|