@pisell/pisellos 2.1.154 → 2.1.156
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 +639 -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 +2 -1
- 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 +57 -250
- package/dist/solution/ScanOrder/types.d.ts +2 -20
- 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/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +401 -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 +2 -1
- 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 +47 -212
- package/lib/solution/ScanOrder/types.d.ts +2 -20
- 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 +1 -1
|
@@ -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
|
|
@@ -1717,54 +1669,15 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1717
1669
|
cacheId: this.cacheId
|
|
1718
1670
|
});
|
|
1719
1671
|
}
|
|
1720
|
-
const
|
|
1721
|
-
const occupyDetail = occupyDetails[0] ?? null;
|
|
1672
|
+
const occupyDetail = await this.fetchResourceOccupyDetailByResourceId(normalizedResourceId);
|
|
1722
1673
|
const resourceSelectType = this.resolveResourceSelectType(
|
|
1723
1674
|
(0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id)
|
|
1724
1675
|
);
|
|
1725
|
-
const allowAddItems = (0, import_utils.toBoolean)(dineInConfig == null ? void 0 : dineInConfig["sale.allow_add_items"]);
|
|
1726
|
-
const additionalOrderResult = this.resolveAdditionalOrderFromOccupyDetail(
|
|
1727
|
-
occupyDetail,
|
|
1728
|
-
resourceSelectType,
|
|
1729
|
-
allowAddItems
|
|
1730
|
-
);
|
|
1731
|
-
if (additionalOrderResult.reason === "multiple_orders") {
|
|
1732
|
-
const multipleOrdersState = {
|
|
1733
|
-
...this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId),
|
|
1734
|
-
mode: "multiple_orders"
|
|
1735
|
-
};
|
|
1736
|
-
this.store.resource = multipleOrdersState;
|
|
1737
|
-
const availabilityInfo2 = {
|
|
1738
|
-
mode: "multiple_orders",
|
|
1739
|
-
deskmate_valid: multipleOrdersState.deskmate_valid,
|
|
1740
|
-
relation_id: multipleOrdersState.relationId,
|
|
1741
|
-
table_form_id: multipleOrdersState.tableFormId,
|
|
1742
|
-
table_form_record: multipleOrdersState.table_form_record
|
|
1743
|
-
};
|
|
1744
|
-
this.logMethodSuccess("checkResourceAvailable", {
|
|
1745
|
-
resourceId: normalizedResourceId,
|
|
1746
|
-
mode: availabilityInfo2.mode,
|
|
1747
|
-
orderListCount: ((_e = occupyDetail == null ? void 0 : occupyDetail.order_list) == null ? void 0 : _e.length) || 0,
|
|
1748
|
-
resourceSelectType
|
|
1749
|
-
});
|
|
1750
|
-
return availabilityInfo2;
|
|
1751
|
-
}
|
|
1752
1676
|
const resourceState = this.normalizeResourceState(
|
|
1753
1677
|
occupyDetail,
|
|
1754
1678
|
resourceSelectType,
|
|
1755
1679
|
hasOrderId
|
|
1756
1680
|
);
|
|
1757
|
-
const additionalOrderId = additionalOrderResult.order_id;
|
|
1758
|
-
if (additionalOrderId) {
|
|
1759
|
-
resourceState.mode = "additional_order";
|
|
1760
|
-
resourceState.order_id = additionalOrderId;
|
|
1761
|
-
} else if (additionalOrderResult.reason === "add_items_disabled") {
|
|
1762
|
-
resourceState.mode = "resource_busy";
|
|
1763
|
-
resourceState.order_id = "0";
|
|
1764
|
-
} else if (resourceSelectType === "multiple" && resourceState.isFull) {
|
|
1765
|
-
resourceState.mode = "resource_busy";
|
|
1766
|
-
resourceState.order_id = "0";
|
|
1767
|
-
}
|
|
1768
1681
|
this.store.resource = resourceState;
|
|
1769
1682
|
if (pendingRequestEntryPax !== void 0) {
|
|
1770
1683
|
this.store.resource.requestEntryPax = pendingRequestEntryPax;
|
|
@@ -1782,35 +1695,34 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1782
1695
|
table_form_id: resourceState.tableFormId,
|
|
1783
1696
|
deskmate_valid: resourceState.deskmate_valid,
|
|
1784
1697
|
table_form_record: resourceState.table_form_record,
|
|
1785
|
-
policy: (
|
|
1786
|
-
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,
|
|
1787
1700
|
...this.store.resource.requestEntryPax !== void 0 ? { requestEntryPax: this.store.resource.requestEntryPax } : {},
|
|
1788
1701
|
...this.store.resource.requestPaxMin !== void 0 ? { requestPaxMin: this.store.resource.requestPaxMin } : {},
|
|
1789
1702
|
...this.store.resource.requestPaxMax !== void 0 ? { requestPaxMax: this.store.resource.requestPaxMax } : {}
|
|
1790
1703
|
};
|
|
1791
|
-
tempOrder.relation_id = normalizedResourceId || ((
|
|
1704
|
+
tempOrder.relation_id = normalizedResourceId || ((_g = this.otherParams) == null ? void 0 : _g.relation_id);
|
|
1792
1705
|
tempOrder.table_form_id = resourceState.tableFormId;
|
|
1793
1706
|
tempOrder.resource_id = normalizedResourceId;
|
|
1794
|
-
(
|
|
1707
|
+
(_h = this.store.order) == null ? void 0 : _h.persistTempOrder();
|
|
1795
1708
|
if (availabilityInfo.mode === "idle") {
|
|
1796
1709
|
await this.addNewOrder();
|
|
1797
1710
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
tempOrder.order_id = additionalOrderId;
|
|
1711
|
+
if (availabilityInfo.mode === "additional_order" || availabilityInfo.mode === "additional_order_with_code") {
|
|
1712
|
+
tempOrder.order_id = resourceState.lastOrderId;
|
|
1801
1713
|
}
|
|
1802
1714
|
if (tempOrder.order_id) {
|
|
1803
|
-
const res = await ((
|
|
1804
|
-
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) => {
|
|
1805
1717
|
var _a2;
|
|
1806
1718
|
return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
|
|
1807
|
-
})) == null ? void 0 :
|
|
1719
|
+
})) == null ? void 0 : _l.metadata) == null ? void 0 : _m.collect_pax;
|
|
1808
1720
|
if (entryPaxNumber) {
|
|
1809
1721
|
await this.setEntryPaxNumber(entryPaxNumber);
|
|
1810
1722
|
}
|
|
1811
1723
|
}
|
|
1812
|
-
const lastOrderInfo = (
|
|
1813
|
-
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) => {
|
|
1814
1726
|
if (typeof (p == null ? void 0 : p.product_id) !== "number")
|
|
1815
1727
|
return acc;
|
|
1816
1728
|
acc.push({
|
|
@@ -1821,8 +1733,8 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1821
1733
|
return acc;
|
|
1822
1734
|
}, []) : [];
|
|
1823
1735
|
await this.setItemRuleRuntimeConfig({
|
|
1824
|
-
serviceType: (
|
|
1825
|
-
submissionIndex:
|
|
1736
|
+
serviceType: (_p = this.otherParams) == null ? void 0 : _p.businessCode,
|
|
1737
|
+
submissionIndex: hasOrderId ? 1 : 0,
|
|
1826
1738
|
historicalItems
|
|
1827
1739
|
});
|
|
1828
1740
|
if (outsideOperatingHours && closedBehaviorValue === "show_menu_disabled") {
|
|
@@ -1995,83 +1907,6 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
1995
1907
|
getEntryPaxNumber() {
|
|
1996
1908
|
return this.store.entryPaxNumber;
|
|
1997
1909
|
}
|
|
1998
|
-
async syncAdditionalOrderFromResource(resourceId) {
|
|
1999
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2000
|
-
const tempOrder = this.ensureTempOrder();
|
|
2001
|
-
const normalizedResourceId = String(
|
|
2002
|
-
resourceId ?? tempOrder.resource_id ?? ((_a = this.store.resource) == null ? void 0 : _a.relationId) ?? ((_b = this.store.resource) == null ? void 0 : _b.relation_id) ?? ""
|
|
2003
|
-
).trim();
|
|
2004
|
-
this.logMethodStart("syncAdditionalOrderFromResource", {
|
|
2005
|
-
resourceId: normalizedResourceId
|
|
2006
|
-
});
|
|
2007
|
-
if (!normalizedResourceId) {
|
|
2008
|
-
const result2 = {
|
|
2009
|
-
matched: false,
|
|
2010
|
-
reason: "missing_resource_id"
|
|
2011
|
-
};
|
|
2012
|
-
this.logMethodSuccess("syncAdditionalOrderFromResource", result2);
|
|
2013
|
-
return result2;
|
|
2014
|
-
}
|
|
2015
|
-
const occupyDetails = await this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
2016
|
-
const occupyDetail = occupyDetails[0] ?? null;
|
|
2017
|
-
const resourceSelectType = ((_c = this.store.resource) == null ? void 0 : _c.resourceSelectType) || this.resolveResourceSelectType((0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id));
|
|
2018
|
-
const allowAddItems = (0, import_utils.toBoolean)(
|
|
2019
|
-
(_e = (_d = this.otherParams) == null ? void 0 : _d.dineInConfig) == null ? void 0 : _e["sale.allow_add_items"]
|
|
2020
|
-
);
|
|
2021
|
-
const result = this.resolveAdditionalOrderFromOccupyDetail(
|
|
2022
|
-
occupyDetail,
|
|
2023
|
-
resourceSelectType,
|
|
2024
|
-
allowAddItems
|
|
2025
|
-
);
|
|
2026
|
-
if (!result.matched || !result.order_id) {
|
|
2027
|
-
this.logMethodSuccess("syncAdditionalOrderFromResource", {
|
|
2028
|
-
...result,
|
|
2029
|
-
resourceId: normalizedResourceId,
|
|
2030
|
-
resourceSelectType,
|
|
2031
|
-
allowAddItems
|
|
2032
|
-
});
|
|
2033
|
-
return result;
|
|
2034
|
-
}
|
|
2035
|
-
tempOrder.order_id = result.order_id;
|
|
2036
|
-
tempOrder.resource_id = normalizedResourceId;
|
|
2037
|
-
tempOrder.relation_id = (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
|
|
2038
|
-
tempOrder.table_form_id = (0, import_utils.toPositiveString)(occupyDetail == null ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
|
|
2039
|
-
(_f = this.store.order) == null ? void 0 : _f.persistTempOrder();
|
|
2040
|
-
this.logMethodSuccess("syncAdditionalOrderFromResource", {
|
|
2041
|
-
...result,
|
|
2042
|
-
resourceId: normalizedResourceId,
|
|
2043
|
-
resourceSelectType,
|
|
2044
|
-
allowAddItems
|
|
2045
|
-
});
|
|
2046
|
-
return result;
|
|
2047
|
-
}
|
|
2048
|
-
// 读取预约规则商品的资源选择类型:single=单个预约,multiple=多个预约,capacity=容量型预约
|
|
2049
|
-
// 依赖 checkResourceAvailable 已根据预约规则商品与 occupy-detail 的 form_id 计算并缓存 store.resource
|
|
2050
|
-
getReservationResourceSelectType() {
|
|
2051
|
-
var _a;
|
|
2052
|
-
this.logMethodStart("getReservationResourceSelectType");
|
|
2053
|
-
const resourceSelectType = (_a = this.store.resource) == null ? void 0 : _a.resourceSelectType;
|
|
2054
|
-
const result = {
|
|
2055
|
-
...resourceSelectType ? { resourceSelectType } : {},
|
|
2056
|
-
isSingleReservation: resourceSelectType === "single",
|
|
2057
|
-
isMultipleReservation: resourceSelectType === "multiple",
|
|
2058
|
-
isCapacityReservation: resourceSelectType === "capacity"
|
|
2059
|
-
};
|
|
2060
|
-
this.logMethodSuccess("getReservationResourceSelectType", result);
|
|
2061
|
-
return result;
|
|
2062
|
-
}
|
|
2063
|
-
// 判定后台是否开启允许加餐
|
|
2064
|
-
// 依赖 checkResourceAvailable 已缓存的 dineInConfig
|
|
2065
|
-
checkAllowAddItems() {
|
|
2066
|
-
var _a;
|
|
2067
|
-
this.logMethodStart("checkAllowAddItems");
|
|
2068
|
-
const dineInConfig = ((_a = this.otherParams) == null ? void 0 : _a.dineInConfig) || {};
|
|
2069
|
-
const result = {
|
|
2070
|
-
enabled: (0, import_utils.toBoolean)(dineInConfig["sale.allow_add_items"])
|
|
2071
|
-
};
|
|
2072
|
-
this.logMethodSuccess("checkAllowAddItems", result);
|
|
2073
|
-
return result;
|
|
2074
|
-
}
|
|
2075
1910
|
// 读取取餐/送餐开关
|
|
2076
1911
|
// 依赖 checkResourceAvailable 已缓存的 dineInConfig
|
|
2077
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;
|
|
@@ -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;
|