@pisell/pisellos 2.3.50 → 2.3.53
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/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +6 -8
- package/dist/modules/Order/index.js +165 -140
- package/dist/modules/Order/types.d.ts +21 -12
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Payment/types.d.ts +8 -0
- package/dist/modules/Payment/walletpass.d.ts +7 -1
- package/dist/modules/Payment/walletpass.js +155 -45
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.js +32 -56
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +0 -14
- package/dist/server/index.js +793 -907
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/order/index.d.ts +16 -0
- package/dist/server/modules/order/index.js +964 -776
- package/dist/server/modules/order/types.d.ts +14 -0
- package/dist/server/modules/order/types.js +6 -0
- package/dist/solution/BaseSales/index.d.ts +18 -13
- package/dist/solution/BaseSales/index.js +202 -178
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/dist/solution/BookingTicket/index.js +2 -2
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +739 -1142
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +841 -1167
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +6 -8
- package/lib/modules/Order/index.js +89 -38
- package/lib/modules/Order/types.d.ts +21 -12
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Payment/types.d.ts +8 -0
- package/lib/modules/Payment/walletpass.d.ts +7 -1
- package/lib/modules/Payment/walletpass.js +107 -9
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.js +32 -44
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +0 -14
- package/lib/server/index.js +15 -72
- package/lib/server/modules/index.d.ts +1 -1
- package/lib/server/modules/order/index.d.ts +16 -0
- package/lib/server/modules/order/index.js +140 -4
- package/lib/server/modules/order/types.d.ts +14 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/solution/BaseSales/index.d.ts +18 -13
- package/lib/solution/BaseSales/index.js +58 -35
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/lib/solution/BookingTicket/index.js +2 -10
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +182 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +110 -322
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1891
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1084
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -702,6 +702,36 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
702
702
|
return null;
|
|
703
703
|
return productId;
|
|
704
704
|
}
|
|
705
|
+
/**
|
|
706
|
+
* Change Time / customer reprice 必须沿用商品列表的渠道口径。
|
|
707
|
+
* SalesSdk Provider 通常将渠道存为 platform,因此不能只读取 otherParams.channel。
|
|
708
|
+
*/
|
|
709
|
+
getPriceQueryChannel(channel) {
|
|
710
|
+
var _a, _b, _c;
|
|
711
|
+
const strategyContext = ((_a = this.otherParams) == null ? void 0 : _a.strategy_context) && typeof this.otherParams.strategy_context === "object" ? this.otherParams.strategy_context : {};
|
|
712
|
+
const value = channel ?? strategyContext.channel ?? ((_b = this.otherParams) == null ? void 0 : _b.channel) ?? ((_c = this.otherParams) == null ? void 0 : _c.platform);
|
|
713
|
+
if (value === void 0 || value === null || String(value).trim() === "") {
|
|
714
|
+
return void 0;
|
|
715
|
+
}
|
|
716
|
+
return String(value).trim();
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* /product/query 的智能定价评估只读取 strategy_context;
|
|
720
|
+
* application_code 仅作为接口兼容字段,不能替代 channel / business_code。
|
|
721
|
+
*/
|
|
722
|
+
getPriceQueryStrategyContext(channel) {
|
|
723
|
+
var _a, _b, _c;
|
|
724
|
+
const inherited = ((_a = this.otherParams) == null ? void 0 : _a.strategy_context) && typeof this.otherParams.strategy_context === "object" ? this.otherParams.strategy_context : {};
|
|
725
|
+
const strategyContext = { ...inherited };
|
|
726
|
+
const resolvedChannel = this.getPriceQueryChannel(channel);
|
|
727
|
+
const businessCode = strategyContext.business_code ?? ((_b = this.otherParams) == null ? void 0 : _b.businessCode) ?? ((_c = this.otherParams) == null ? void 0 : _c.business_code);
|
|
728
|
+
if (resolvedChannel)
|
|
729
|
+
strategyContext.channel = resolvedChannel;
|
|
730
|
+
if (businessCode !== void 0 && businessCode !== null && String(businessCode).trim() !== "") {
|
|
731
|
+
strategyContext.business_code = String(businessCode).trim();
|
|
732
|
+
}
|
|
733
|
+
return strategyContext;
|
|
734
|
+
}
|
|
705
735
|
getPriceQuerySchedule(params) {
|
|
706
736
|
const booking = params.booking || {};
|
|
707
737
|
if (typeof booking.start_date === "string" && booking.start_date.trim()) {
|
|
@@ -729,13 +759,15 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
729
759
|
};
|
|
730
760
|
}
|
|
731
761
|
async loadProductsForPriceQuery(params) {
|
|
732
|
-
var _a
|
|
762
|
+
var _a;
|
|
733
763
|
const ids = Array.from(new Set(
|
|
734
764
|
params.ids.filter((id) => Number.isFinite(id))
|
|
735
765
|
));
|
|
736
766
|
const productsById = /* @__PURE__ */ new Map();
|
|
737
767
|
if (!ids.length || !this.request)
|
|
738
768
|
return productsById;
|
|
769
|
+
const channel = this.getPriceQueryChannel(params.channel);
|
|
770
|
+
const strategyContext = this.getPriceQueryStrategyContext(channel);
|
|
739
771
|
try {
|
|
740
772
|
const response = await this.request.post("/product/query", {
|
|
741
773
|
ids,
|
|
@@ -747,13 +779,14 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
747
779
|
customer_id: params.customerId,
|
|
748
780
|
schedule_date: params.schedule.schedule_date,
|
|
749
781
|
schedule_datetime: params.schedule.schedule_datetime,
|
|
750
|
-
application_code:
|
|
782
|
+
application_code: channel,
|
|
783
|
+
...Object.keys(strategyContext).length ? { strategy_context: strategyContext } : {}
|
|
751
784
|
}, {
|
|
752
785
|
osServer: true,
|
|
753
786
|
customToast: () => {
|
|
754
787
|
}
|
|
755
788
|
});
|
|
756
|
-
const list = ((
|
|
789
|
+
const list = ((_a = response == null ? void 0 : response.data) == null ? void 0 : _a.list) || (response == null ? void 0 : response.list) || [];
|
|
757
790
|
if (!Array.isArray(list))
|
|
758
791
|
return productsById;
|
|
759
792
|
list.forEach((item) => {
|
|
@@ -1008,7 +1041,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1008
1041
|
return isChanged;
|
|
1009
1042
|
}
|
|
1010
1043
|
async initialize(core, options = {}) {
|
|
1011
|
-
var _a, _b
|
|
1044
|
+
var _a, _b;
|
|
1012
1045
|
this.core = core;
|
|
1013
1046
|
this.initializeOptions = options || {};
|
|
1014
1047
|
this.paymentNumberDevicePrefix = null;
|
|
@@ -1019,9 +1052,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1019
1052
|
this.request = core.getPlugin("request");
|
|
1020
1053
|
this.appPlugin = core.getPlugin("app");
|
|
1021
1054
|
if (!this.appPlugin) {
|
|
1055
|
+
throw new Error("Checkout 解决方案需要 app 插件支持");
|
|
1022
1056
|
}
|
|
1023
|
-
const app =
|
|
1024
|
-
this.logger = app
|
|
1057
|
+
const app = this.appPlugin.getApp();
|
|
1058
|
+
this.logger = app.logger;
|
|
1025
1059
|
const targetCacheData = this.readSessionCacheData();
|
|
1026
1060
|
const moduleNames = this.getRegisteredModuleNames();
|
|
1027
1061
|
moduleNames.forEach((step) => {
|
|
@@ -1046,7 +1080,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1046
1080
|
if (this.store.schedule && !this.isScheduleListLoaded(this.store.schedule)) {
|
|
1047
1081
|
await this.store.schedule.loadAllSchedule();
|
|
1048
1082
|
}
|
|
1049
|
-
if (this.store.order && typeof ((
|
|
1083
|
+
if (this.store.order && typeof ((_b = this.otherParams) == null ? void 0 : _b.enableTempOrderPersist) === "boolean") {
|
|
1050
1084
|
this.store.order.setEnableTempOrderPersist(
|
|
1051
1085
|
this.otherParams.enableTempOrderPersist
|
|
1052
1086
|
);
|
|
@@ -1190,10 +1224,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1190
1224
|
const result = ((_a = this.store.order) == null ? void 0 : _a.getTempOrder()) || null;
|
|
1191
1225
|
return result;
|
|
1192
1226
|
}
|
|
1193
|
-
async replaceTempOrder(tempOrder) {
|
|
1227
|
+
async replaceTempOrder(tempOrder, options) {
|
|
1194
1228
|
if (!this.store.order)
|
|
1195
1229
|
throw new Error("order 模块未初始化");
|
|
1196
|
-
const nextTempOrder = await this.store.order.replaceTempOrder(tempOrder);
|
|
1230
|
+
const nextTempOrder = await this.store.order.replaceTempOrder(tempOrder, options);
|
|
1197
1231
|
await this.effectsEmit("onTempOrderReplaced", { tempOrder: nextTempOrder });
|
|
1198
1232
|
return nextTempOrder;
|
|
1199
1233
|
}
|
|
@@ -1900,7 +1934,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1900
1934
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1901
1935
|
}
|
|
1902
1936
|
const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
|
|
1903
|
-
const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
|
|
1904
1937
|
const submitParams = {
|
|
1905
1938
|
cacheId: this.cacheId,
|
|
1906
1939
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
@@ -1910,11 +1943,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1910
1943
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
|
|
1911
1944
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1912
1945
|
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1913
|
-
...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
|
|
1946
|
+
...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
|
|
1914
1947
|
...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
|
|
1915
1948
|
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1916
1949
|
};
|
|
1917
|
-
return this.
|
|
1950
|
+
return this.store.order.submitTempOrder(submitParams);
|
|
1918
1951
|
}
|
|
1919
1952
|
async saveSalesOrderDraft(params) {
|
|
1920
1953
|
var _a, _b, _c, _d;
|
|
@@ -1936,35 +1969,20 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1936
1969
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1937
1970
|
}
|
|
1938
1971
|
const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
|
|
1939
|
-
const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
|
|
1940
1972
|
const submitParams = {
|
|
1941
1973
|
cacheId: this.cacheId,
|
|
1942
1974
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
1943
1975
|
businessCode: ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code),
|
|
1944
1976
|
channel: this.getSubmitOrderSalesChannel(),
|
|
1945
1977
|
type: (_d = this.otherParams) == null ? void 0 : _d.type,
|
|
1946
|
-
request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
|
|
1947
1978
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1948
1979
|
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1949
|
-
...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
|
|
1980
|
+
...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
|
|
1950
1981
|
...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
|
|
1951
1982
|
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1952
1983
|
};
|
|
1953
1984
|
return this.store.order.submitTempOrderAsync(submitParams);
|
|
1954
1985
|
}
|
|
1955
|
-
/**
|
|
1956
|
-
* 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
|
|
1957
|
-
* otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
|
|
1958
|
-
*/
|
|
1959
|
-
shouldUseCheckoutSyncTask() {
|
|
1960
|
-
var _a;
|
|
1961
|
-
const configured = (_a = this.otherParams) == null ? void 0 : _a.checkoutSyncTaskEnabled;
|
|
1962
|
-
return typeof configured === "boolean" ? configured : true;
|
|
1963
|
-
}
|
|
1964
|
-
/** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
|
|
1965
|
-
getDefaultCheckoutSmallTicketDataFlag() {
|
|
1966
|
-
return void 0;
|
|
1967
|
-
}
|
|
1968
1986
|
async printLocalOrderReceipt(lookup) {
|
|
1969
1987
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1970
1988
|
if (!this.store.order) {
|
|
@@ -2024,7 +2042,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2024
2042
|
const channel = params.channel ?? this.getSubmitOrderSalesChannel();
|
|
2025
2043
|
const syncParams = {
|
|
2026
2044
|
...params,
|
|
2027
|
-
checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask(),
|
|
2028
2045
|
...businessCode !== void 0 ? { businessCode } : {},
|
|
2029
2046
|
...channel !== void 0 ? { channel } : {}
|
|
2030
2047
|
};
|
|
@@ -2551,6 +2568,12 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2551
2568
|
throw new Error("payment 模块未初始化");
|
|
2552
2569
|
return this.store.payment.wallet.exportWalletAssetsSnapshot();
|
|
2553
2570
|
}
|
|
2571
|
+
/** 配置仅影响 Wallet Assets,不改变 Promotion/Voucher 选择流程。 */
|
|
2572
|
+
configureWalletAssetsBehavior(options) {
|
|
2573
|
+
if (!this.store.payment)
|
|
2574
|
+
throw new Error("payment 模块未初始化");
|
|
2575
|
+
this.store.payment.wallet.configureWalletAssetsBehavior(options);
|
|
2576
|
+
}
|
|
2554
2577
|
/**
|
|
2555
2578
|
* 恢复 Shared Checkout 钱包快照,并把选择重新同步为订单 pending payment。
|
|
2556
2579
|
*/
|
|
@@ -3181,11 +3204,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
3181
3204
|
});
|
|
3182
3205
|
});
|
|
3183
3206
|
}
|
|
3184
|
-
async addProductToOrder(product, booking) {
|
|
3207
|
+
async addProductToOrder(product, booking, options) {
|
|
3185
3208
|
try {
|
|
3186
3209
|
if (!this.store.order)
|
|
3187
3210
|
throw new Error("order 模块未初始化");
|
|
3188
|
-
const products = await this.store.order.addProductToOrder(product, booking);
|
|
3211
|
+
const products = await this.store.order.addProductToOrder(product, booking, options);
|
|
3189
3212
|
return products;
|
|
3190
3213
|
} catch (error) {
|
|
3191
3214
|
throw error;
|
|
@@ -3261,17 +3284,17 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
3261
3284
|
* @example
|
|
3262
3285
|
* await baseSales.removeProductsFromOrder([identityA, identityB]);
|
|
3263
3286
|
*/
|
|
3264
|
-
async removeProductsFromOrder(identities) {
|
|
3287
|
+
async removeProductsFromOrder(identities, options) {
|
|
3265
3288
|
try {
|
|
3266
3289
|
if (!this.store.order)
|
|
3267
3290
|
throw new Error("order 模块未初始化");
|
|
3268
|
-
return await this.store.order.removeProductsFromOrder(identities);
|
|
3291
|
+
return await this.store.order.removeProductsFromOrder(identities, options);
|
|
3269
3292
|
} catch (error) {
|
|
3270
3293
|
throw error;
|
|
3271
3294
|
}
|
|
3272
3295
|
}
|
|
3273
|
-
async removeProductFromOrder(identity) {
|
|
3274
|
-
return this.removeProductsFromOrder([identity]);
|
|
3296
|
+
async removeProductFromOrder(identity, options) {
|
|
3297
|
+
return this.removeProductsFromOrder([identity], options);
|
|
3275
3298
|
}
|
|
3276
3299
|
// ─── 促销/赠品 透传(迁移自 booking usePromotion) ────────────────
|
|
3277
3300
|
/**
|
|
@@ -367,8 +367,11 @@ function getProductLineNoteSignature(product) {
|
|
|
367
367
|
return uid ? `note:${uid}` : `note:${normalizedNote}`;
|
|
368
368
|
}
|
|
369
369
|
function getPromotionLineMergeBoundary(product) {
|
|
370
|
-
var _a;
|
|
371
|
-
if (((_a = product == null ? void 0 : product.
|
|
370
|
+
var _a, _b;
|
|
371
|
+
if (Number(((_a = product == null ? void 0 : product.product_sku) == null ? void 0 : _a.open_sold_weight) || 0) === 1) {
|
|
372
|
+
return `weighing:${getOrderProductUid(product)}`;
|
|
373
|
+
}
|
|
374
|
+
if (((_b = product == null ? void 0 : product.metadata) == null ? void 0 : _b.is_edit_for_runtime) !== true)
|
|
372
375
|
return "";
|
|
373
376
|
return `edit:${getOrderProductUid(product)}`;
|
|
374
377
|
}
|
|
@@ -10,7 +10,6 @@ import { ITime } from '../../modules/Date/types';
|
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
12
12
|
import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
|
|
13
|
-
import { IAppendFormRecordParams } from '../../modules/Holder/types';
|
|
14
13
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
15
14
|
protected defaultName: string;
|
|
16
15
|
protected defaultVersion: string;
|
|
@@ -127,20 +126,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
127
126
|
* @param params
|
|
128
127
|
*/
|
|
129
128
|
fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* 获取 holder 表单 map
|
|
132
|
-
*/
|
|
133
|
-
getHolderFormMap(): import("../../modules").HolderFormMap;
|
|
134
|
-
/**
|
|
135
|
-
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
136
|
-
*/
|
|
137
|
-
refreshAllHolderFormRecords(params?: {
|
|
138
|
-
customer_id?: number;
|
|
139
|
-
}): Promise<import("../../modules").HolderFormMap>;
|
|
140
|
-
/**
|
|
141
|
-
* 添加表单记录
|
|
142
|
-
*/
|
|
143
|
-
appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
|
|
144
129
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
145
130
|
clearDateRange(): void;
|
|
146
131
|
getDateRange(): Promise<ITime[]>;
|
|
@@ -317,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
317
302
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
318
303
|
errorList: any[];
|
|
319
304
|
};
|
|
320
|
-
getTimeSlotByAllResources(resources_code: string
|
|
305
|
+
getTimeSlotByAllResources(resources_code: string): any[];
|
|
321
306
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
322
307
|
resources_code: string;
|
|
323
308
|
startDate: string;
|
|
@@ -326,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
311
|
date: string;
|
|
327
312
|
status: string;
|
|
328
313
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
330
315
|
}[]>;
|
|
331
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
317
|
private getScheduleDataByIds;
|
|
@@ -89,7 +89,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
89
89
|
}
|
|
90
90
|
const moduleArr = [
|
|
91
91
|
"accountList",
|
|
92
|
-
"holder",
|
|
93
92
|
"cart",
|
|
94
93
|
"schedule",
|
|
95
94
|
"summary",
|
|
@@ -380,27 +379,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
380
379
|
}
|
|
381
380
|
return this.store.accountList.fetchHolderAccounts(params);
|
|
382
381
|
}
|
|
383
|
-
/**
|
|
384
|
-
* 获取 holder 表单 map
|
|
385
|
-
*/
|
|
386
|
-
getHolderFormMap() {
|
|
387
|
-
return this.store.holder.getHolderFormMap();
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
391
|
-
*/
|
|
392
|
-
async refreshAllHolderFormRecords(params) {
|
|
393
|
-
return this.store.holder.refreshAllFormRecords({
|
|
394
|
-
customer_id: params == null ? void 0 : params.customer_id,
|
|
395
|
-
useCache: false
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* 添加表单记录
|
|
400
|
-
*/
|
|
401
|
-
appendFormRecord(params) {
|
|
402
|
-
return this.store.holder.appendFormRecord(params);
|
|
403
|
-
}
|
|
404
382
|
// 设置日期范围,注入到日期模块中
|
|
405
383
|
async setDateRange(dateRange) {
|
|
406
384
|
this.store.date.setDateRange(dateRange);
|
|
@@ -508,14 +486,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
508
486
|
date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
|
|
509
487
|
}
|
|
510
488
|
this.updateQuotationPriceAndCart(date);
|
|
511
|
-
try {
|
|
512
|
-
const customerId = Number(accountInfo.id);
|
|
513
|
-
await this.refreshAllHolderFormRecords({
|
|
514
|
-
customer_id: customerId
|
|
515
|
-
});
|
|
516
|
-
} catch (error) {
|
|
517
|
-
console.error("[BookingByStep] 登录后刷新 holder 表单失败", error);
|
|
518
|
-
}
|
|
519
489
|
}
|
|
520
490
|
} else {
|
|
521
491
|
throw new Error(`没有找到${accountId}账户`);
|
|
@@ -542,11 +512,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
542
512
|
}
|
|
543
513
|
// 购物车提交订单
|
|
544
514
|
async submitOrder(extraData) {
|
|
545
|
-
var _a;
|
|
546
515
|
const cartItems = this.store.cart.getItems();
|
|
547
516
|
const newCartItems = (0, import_lodash_es.cloneDeep)(cartItems);
|
|
548
517
|
newCartItems.forEach((item) => {
|
|
549
|
-
var
|
|
518
|
+
var _a;
|
|
550
519
|
if (item._origin.resources && item._origin.resources.length) {
|
|
551
520
|
item._origin.resources = item._origin.resources.map((n) => {
|
|
552
521
|
const newResourcesItem = (0, import_lodash_es.cloneDeep)(n);
|
|
@@ -556,7 +525,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
556
525
|
return { ...newResourcesItem };
|
|
557
526
|
});
|
|
558
527
|
const { currentCapacity, formatCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
559
|
-
if (!((
|
|
528
|
+
if (!((_a = item._origin) == null ? void 0 : _a.metadata)) {
|
|
560
529
|
item._origin.metadata = {};
|
|
561
530
|
}
|
|
562
531
|
item._origin.metadata.capacity = formatCapacity;
|
|
@@ -574,7 +543,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
574
543
|
cartItems: newCartItems,
|
|
575
544
|
type,
|
|
576
545
|
platform: this.platform,
|
|
577
|
-
business_code: (_a = this.otherParams) == null ? void 0 : _a.business_code,
|
|
578
546
|
extraData
|
|
579
547
|
}
|
|
580
548
|
});
|
|
@@ -660,15 +628,6 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
660
628
|
account = activeAccount;
|
|
661
629
|
}
|
|
662
630
|
}
|
|
663
|
-
try {
|
|
664
|
-
this.store.holder.ensureFormByProduct({
|
|
665
|
-
product: productData,
|
|
666
|
-
shop_id: (productData == null ? void 0 : productData.shop_id) || "",
|
|
667
|
-
useCache: true
|
|
668
|
-
});
|
|
669
|
-
} catch (error) {
|
|
670
|
-
console.error("[BookingByStep] 加载 holder 表单失败", error);
|
|
671
|
-
}
|
|
672
631
|
const flag = this.store.cart.mergeCartItemByRowKey({
|
|
673
632
|
rowKey,
|
|
674
633
|
quantity,
|
|
@@ -1191,7 +1150,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1191
1150
|
}
|
|
1192
1151
|
const totalCapacity = (countMap[n.id] || []).reduce(
|
|
1193
1152
|
(sum, item) => {
|
|
1194
|
-
const hasOverlap = (0, import_dayjs.default)(item.time.start_at).
|
|
1153
|
+
const hasOverlap = !(0, import_dayjs.default)(item.time.start_at).isAfter((0, import_dayjs.default)(timeSlots.start_at)) && !(0, import_dayjs.default)(item.time.end_at).isBefore((0, import_dayjs.default)(timeSlots.end_at));
|
|
1195
1154
|
return hasOverlap ? sum + item.pax : sum;
|
|
1196
1155
|
},
|
|
1197
1156
|
0
|
|
@@ -1273,10 +1232,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1273
1232
|
}
|
|
1274
1233
|
);
|
|
1275
1234
|
cartItems2.forEach((item, index) => {
|
|
1276
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l
|
|
1235
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1277
1236
|
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
1278
|
-
|
|
1279
|
-
if (hasOriginTimeSlot) {
|
|
1237
|
+
if (item._origin.start_time && !(timeSlots == null ? void 0 : timeSlots.start_time)) {
|
|
1280
1238
|
recordTimeSlots = {
|
|
1281
1239
|
start_time: item._origin.start_time,
|
|
1282
1240
|
end_time: item._origin.end_time,
|
|
@@ -1288,13 +1246,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1288
1246
|
const currentResourceConfig = (_c = (_b = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b.resources) == null ? void 0 : _c.find(
|
|
1289
1247
|
(n) => n.code === resources_code
|
|
1290
1248
|
);
|
|
1291
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct
|
|
1292
|
-
|
|
1293
|
-
let start_at = recordEndAt;
|
|
1294
|
-
let end_at = start_at.add(
|
|
1249
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct) {
|
|
1250
|
+
let start_at = (0, import_dayjs.default)(recordTimeSlots.end_time).add(
|
|
1295
1251
|
((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) || 10,
|
|
1296
1252
|
"minutes"
|
|
1297
1253
|
);
|
|
1254
|
+
let end_at = start_at.add(
|
|
1255
|
+
((_h = (_g = item._productOrigin) == null ? void 0 : _g.duration) == null ? void 0 : _h.value) || 10,
|
|
1256
|
+
"minutes"
|
|
1257
|
+
);
|
|
1298
1258
|
recordTimeSlots = {
|
|
1299
1259
|
start_time: start_at.format("HH:mm"),
|
|
1300
1260
|
end_time: end_at.format("HH:mm"),
|
|
@@ -1346,7 +1306,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1346
1306
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1347
1307
|
let selectedResources = [];
|
|
1348
1308
|
const resources2 = (0, import_lodash_es.cloneDeep)(
|
|
1349
|
-
((
|
|
1309
|
+
((_j = (_i = item._productOrigin) == null ? void 0 : _i.product_resource) == null ? void 0 : _j.resources) || []
|
|
1350
1310
|
);
|
|
1351
1311
|
const currentResourcesRenderList = [];
|
|
1352
1312
|
resources2.forEach((n) => {
|
|
@@ -1394,11 +1354,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1394
1354
|
return recordCount >= currentCapacity;
|
|
1395
1355
|
});
|
|
1396
1356
|
});
|
|
1397
|
-
const targetRenderList = (
|
|
1357
|
+
const targetRenderList = (_k = productResources.find(
|
|
1398
1358
|
(n) => n.code === resources_code
|
|
1399
|
-
)) == null ? void 0 :
|
|
1359
|
+
)) == null ? void 0 : _k.renderList;
|
|
1400
1360
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
1401
|
-
if ((
|
|
1361
|
+
if ((_l = item._origin.resources) == null ? void 0 : _l.some(
|
|
1402
1362
|
(n) => n.form_id === targetRenderList[0].form_id
|
|
1403
1363
|
)) {
|
|
1404
1364
|
return;
|
|
@@ -1406,9 +1366,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1406
1366
|
const fastestResource = (0, import_timeslots.findFastestAvailableResource)({
|
|
1407
1367
|
resources: targetRenderList,
|
|
1408
1368
|
currentCapacity,
|
|
1409
|
-
countMap: selectResourcesMap
|
|
1410
|
-
targetDate: (_k = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _k.date,
|
|
1411
|
-
durationMinutes: ((_l = item == null ? void 0 : item.duration) == null ? void 0 : _l.value) || ((_n = (_m = item == null ? void 0 : item._productOrigin) == null ? void 0 : _m.duration) == null ? void 0 : _n.value) || 10
|
|
1369
|
+
countMap: selectResourcesMap
|
|
1412
1370
|
});
|
|
1413
1371
|
const targetResource = fastestResource || targetRenderList[0];
|
|
1414
1372
|
targetResource.capacity = currentCapacity;
|
|
@@ -1445,7 +1403,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1445
1403
|
return { errorList };
|
|
1446
1404
|
}
|
|
1447
1405
|
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
1448
|
-
getTimeSlotByAllResources(resources_code
|
|
1406
|
+
getTimeSlotByAllResources(resources_code) {
|
|
1449
1407
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1450
1408
|
let dateRange = this.store.date.getDateRange();
|
|
1451
1409
|
const resources = [];
|
|
@@ -1603,7 +1561,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1603
1561
|
resourcesMap,
|
|
1604
1562
|
duration,
|
|
1605
1563
|
currentDate: dateRange[0].date,
|
|
1606
|
-
split,
|
|
1564
|
+
split: 10,
|
|
1607
1565
|
resourcesUseableMap,
|
|
1608
1566
|
capacity: maxCapacity,
|
|
1609
1567
|
cut_off_time: maxCutOffTime,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -16,7 +16,6 @@ export interface BookingByStepState {
|
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
17
|
salesSummary?: SalesSummaryModule;
|
|
18
18
|
scanOrderLogger?: ScanOrderLoggerModule;
|
|
19
|
-
holder: HolderModule;
|
|
20
19
|
}
|
|
21
20
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
22
21
|
export declare enum BookingByStepHooks {
|
|
@@ -81,11 +81,6 @@ function createModule(moduleName, solutionName, name, version) {
|
|
|
81
81
|
`${solutionName}_${name || moduleName}`,
|
|
82
82
|
version
|
|
83
83
|
);
|
|
84
|
-
case "holder":
|
|
85
|
-
return new import_modules.HolderModule(
|
|
86
|
-
`${solutionName}_${name || moduleName}`,
|
|
87
|
-
version
|
|
88
|
-
);
|
|
89
84
|
default:
|
|
90
85
|
throw new Error(`Unknown module type: ${moduleName}`);
|
|
91
86
|
}
|
|
@@ -49,27 +49,8 @@ var formatDefaultCapacitys = ({
|
|
|
49
49
|
const id = d.bundle_product_id;
|
|
50
50
|
const variantId = d.bundle_variant_id;
|
|
51
51
|
const item = ((capacity == null ? void 0 : capacity.package) || []).find(
|
|
52
|
-
(item2) => item2.product_id
|
|
52
|
+
(item2) => item2.product_id === id || item2.product_id === variantId
|
|
53
53
|
);
|
|
54
|
-
if (!item && (window == null ? void 0 : window.sendWarningLog)) {
|
|
55
|
-
window.sendWarningLog({
|
|
56
|
-
title: "未找到套餐 capacity 配置",
|
|
57
|
-
content: [
|
|
58
|
-
{
|
|
59
|
-
key: "product_id",
|
|
60
|
-
value: id
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
key: "variant_id",
|
|
64
|
-
value: variantId
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
key: "package",
|
|
68
|
-
value: JSON.stringify((capacity == null ? void 0 : capacity.package) || [])
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
54
|
return {
|
|
74
55
|
id,
|
|
75
56
|
value: item ? d.num || 0 : 0,
|
|
@@ -19,12 +19,10 @@ export declare function calculateResourceAvailableTime({ resource, timeSlots, cu
|
|
|
19
19
|
* @param countMap 已预约数量映射
|
|
20
20
|
* @returns 最快可用的资源
|
|
21
21
|
*/
|
|
22
|
-
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap,
|
|
22
|
+
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, }: {
|
|
23
23
|
resources: ResourceItem[];
|
|
24
24
|
currentCapacity?: number;
|
|
25
25
|
countMap?: Record<number, number>;
|
|
26
|
-
targetDate?: string | Dayjs;
|
|
27
|
-
durationMinutes?: number;
|
|
28
26
|
}): ResourceItem | null;
|
|
29
27
|
/**
|
|
30
28
|
* 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
|
|
@@ -77,15 +77,10 @@ function calculateResourceAvailableTime({
|
|
|
77
77
|
function findFastestAvailableResource({
|
|
78
78
|
resources,
|
|
79
79
|
currentCapacity = 1,
|
|
80
|
-
countMap = {}
|
|
81
|
-
targetDate,
|
|
82
|
-
durationMinutes = 30
|
|
80
|
+
countMap = {}
|
|
83
81
|
}) {
|
|
84
82
|
var _a, _b, _c;
|
|
85
83
|
const currentTime = (0, import_dayjs.default)();
|
|
86
|
-
const resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
|
|
87
|
-
const targetDay = targetDate ? (0, import_dayjs.default)(targetDate) : currentTime;
|
|
88
|
-
const isTargetDayToday = targetDay.isSame(currentTime, "day");
|
|
89
84
|
let fastestTime = null;
|
|
90
85
|
let fastestResources = [];
|
|
91
86
|
console.log("[TimeslotUtils] 查找最快可用资源:", {
|
|
@@ -95,22 +90,19 @@ function findFastestAvailableResource({
|
|
|
95
90
|
countMap
|
|
96
91
|
});
|
|
97
92
|
for (const resource of resources) {
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (!isTargetDayToday)
|
|
103
|
-
return true;
|
|
104
|
-
return (0, import_dayjs.default)(time.end_at).isAfter(currentTime);
|
|
93
|
+
const todayTimes = resource.times.filter((time) => {
|
|
94
|
+
const isToday = (0, import_dayjs.default)(time.start_at).isSame(currentTime, "day");
|
|
95
|
+
const isStillWorking = (0, import_dayjs.default)(time.end_at).isAfter(currentTime);
|
|
96
|
+
return isToday && isStillWorking;
|
|
105
97
|
});
|
|
106
|
-
if (
|
|
98
|
+
if (todayTimes.length === 0) {
|
|
107
99
|
console.log(`[TimeslotUtils] 资源 ${resource.id}(${resource.main_field}) 今日无可用时间段`);
|
|
108
100
|
continue;
|
|
109
101
|
}
|
|
110
|
-
for (const time of
|
|
102
|
+
for (const time of todayTimes) {
|
|
111
103
|
const workStartTime = (0, import_dayjs.default)(time.start_at);
|
|
112
104
|
const workEndTime = (0, import_dayjs.default)(time.end_at);
|
|
113
|
-
let nextAvailableTime =
|
|
105
|
+
let nextAvailableTime = currentTime.isBefore(workStartTime) ? workStartTime : currentTime;
|
|
114
106
|
console.log(`[TimeslotUtils] 检查资源 ${resource.id}(${resource.main_field}):`, {
|
|
115
107
|
workTime: `${workStartTime.format("HH:mm")}-${workEndTime.format("HH:mm")}`,
|
|
116
108
|
checkStartTime: nextAvailableTime.format("HH:mm:ss"),
|
|
@@ -134,7 +126,7 @@ function findFastestAvailableResource({
|
|
|
134
126
|
pax: event.pax || 1
|
|
135
127
|
});
|
|
136
128
|
if (resource.resourceType === "single" || (resource.capacity || 1) === 1) {
|
|
137
|
-
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(
|
|
129
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
|
|
138
130
|
finalAvailableTime = eventEnd;
|
|
139
131
|
console.log(`[TimeslotUtils] 发现时间冲突,调整到: ${finalAvailableTime.format("HH:mm:ss")}`);
|
|
140
132
|
}
|
|
@@ -142,7 +134,7 @@ function findFastestAvailableResource({
|
|
|
142
134
|
const totalCapacity = resource.capacity || 0;
|
|
143
135
|
const currentUsedCapacity = countMap[resource.id] || 0;
|
|
144
136
|
const eventUsedCapacity = event.pax || 1;
|
|
145
|
-
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(
|
|
137
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(30, "minute"))) {
|
|
146
138
|
const totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
|
|
147
139
|
if (totalRequiredCapacity > totalCapacity) {
|
|
148
140
|
finalAvailableTime = eventEnd;
|
|
@@ -151,7 +143,7 @@ function findFastestAvailableResource({
|
|
|
151
143
|
}
|
|
152
144
|
}
|
|
153
145
|
}
|
|
154
|
-
if (finalAvailableTime.
|
|
146
|
+
if (finalAvailableTime.isAfter(workEndTime)) {
|
|
155
147
|
console.log(`[TimeslotUtils] 资源 ${resource.id} 可用时间超出工作时间,跳过`);
|
|
156
148
|
continue;
|
|
157
149
|
}
|
|
@@ -445,19 +445,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
445
445
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
446
446
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
447
447
|
*/
|
|
448
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
449
|
-
action: "reloadCatalog";
|
|
450
|
-
} | {
|
|
451
|
-
action: "add";
|
|
452
|
-
cacheItem: any;
|
|
453
|
-
} | {
|
|
454
|
-
action: "requiresDetail";
|
|
455
|
-
payload: AddProductRequiresDetailPayload;
|
|
456
|
-
} | {
|
|
457
|
-
action: "requiresBookingEdit";
|
|
458
|
-
cacheItem: any;
|
|
459
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
460
|
-
};
|
|
448
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
461
449
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
462
450
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
463
451
|
/**
|