@pisell/pisellos 2.2.277 → 2.2.279
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- 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/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +32 -4
- package/dist/modules/Order/index.js +868 -675
- package/dist/modules/Order/types.d.ts +22 -1
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +71 -34
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +48 -13
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -13
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.js +153 -56
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +20 -0
- package/dist/server/index.js +1101 -909
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +261 -96
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +10 -1
- package/dist/solution/BaseSales/index.js +201 -148
- package/dist/solution/BaseSales/utils/cartPromotion.js +19 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +16 -1
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +6 -2
- package/dist/solution/BookingTicket/index.js +125 -77
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1142 -739
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +97 -45
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +204 -0
- package/dist/solution/UnifiedBookingSales/index.js +2211 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +150 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1167 -841
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.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/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +32 -4
- package/lib/modules/Order/index.js +372 -156
- package/lib/modules/Order/types.d.ts +22 -1
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +39 -6
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +27 -1
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +49 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.js +117 -25
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +20 -0
- package/lib/server/index.js +124 -19
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +75 -5
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +10 -1
- package/lib/solution/BaseSales/index.js +73 -29
- package/lib/solution/BaseSales/utils/cartPromotion.js +18 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +16 -1
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +6 -2
- package/lib/solution/BookingTicket/index.js +63 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -182
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +60 -18
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +204 -0
- package/lib/solution/UnifiedBookingSales/index.js +1273 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +150 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +322 -110
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -73,8 +73,11 @@ function isRejectedSalesSubmitResult(result) {
|
|
|
73
73
|
return candidates.some((candidate) => {
|
|
74
74
|
if (!candidate || typeof candidate !== "object")
|
|
75
75
|
return false;
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
if (candidate.code !== void 0 && candidate.code !== 200 && candidate.code !== "200") {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
const statusCode = Number(candidate.statusCode);
|
|
80
|
+
if (Number.isFinite(statusCode) && statusCode >= 400)
|
|
78
81
|
return true;
|
|
79
82
|
if (candidate.status === false || candidate.success === false || candidate.result === false) {
|
|
80
83
|
return true;
|
|
@@ -84,9 +87,9 @@ function isRejectedSalesSubmitResult(result) {
|
|
|
84
87
|
);
|
|
85
88
|
});
|
|
86
89
|
}
|
|
87
|
-
function getSalesSubmitErrorMessage(result) {
|
|
90
|
+
function getSalesSubmitErrorMessage(result, fallbackMessage) {
|
|
88
91
|
var _a, _b;
|
|
89
|
-
return (result == null ? void 0 : result.message) || (result == null ? void 0 : result.msg) || ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.message) || ((_b = result == null ? void 0 : result.data) == null ? void 0 : _b.msg) ||
|
|
92
|
+
return (result == null ? void 0 : result.message) || (result == null ? void 0 : result.msg) || ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.message) || ((_b = result == null ? void 0 : result.data) == null ? void 0 : _b.msg) || fallbackMessage;
|
|
90
93
|
}
|
|
91
94
|
function toWalletFundValue(value) {
|
|
92
95
|
try {
|
|
@@ -588,7 +591,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
588
591
|
});
|
|
589
592
|
});
|
|
590
593
|
}
|
|
591
|
-
async hydrateLatestLoadedSalesDetail(record, loadSequence) {
|
|
594
|
+
async hydrateLatestLoadedSalesDetail(record, loadSequence, hydrateSource) {
|
|
592
595
|
let hydratedSales = null;
|
|
593
596
|
let skippedBeforeHydrate = false;
|
|
594
597
|
const hydrateTask = async () => {
|
|
@@ -598,9 +601,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
598
601
|
}
|
|
599
602
|
if (!this.store.order)
|
|
600
603
|
throw new Error("order 模块未初始化");
|
|
601
|
-
const sales = await this.store.order.hydrateTempOrderFromRecord(
|
|
602
|
-
|
|
603
|
-
|
|
604
|
+
const sales = await this.store.order.hydrateTempOrderFromRecord(
|
|
605
|
+
record,
|
|
606
|
+
hydrateSource === "sessionStorage" ? { recalcOnHydrate: true, source: "sessionStorage" } : { recalcOnHydrate: false }
|
|
607
|
+
);
|
|
604
608
|
hydratedSales = sales;
|
|
605
609
|
if (loadSequence !== this.salesDetailLoadSequence)
|
|
606
610
|
return;
|
|
@@ -924,12 +928,18 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
924
928
|
* const params = this.buildSubModuleOtherParams();
|
|
925
929
|
* this.core.registerModule(orderModule, { otherParams: params });
|
|
926
930
|
*/
|
|
927
|
-
|
|
931
|
+
isSessionStoragePersistEnabled() {
|
|
932
|
+
return Boolean(this.cacheId);
|
|
933
|
+
}
|
|
934
|
+
shouldUseSessionStorageForSubModule(_moduleName) {
|
|
935
|
+
return this.isSessionStoragePersistEnabled();
|
|
936
|
+
}
|
|
937
|
+
buildSubModuleOtherParams(moduleName) {
|
|
928
938
|
return {
|
|
929
939
|
...this.otherParams,
|
|
930
940
|
salesSummaryModuleName: `${this.name}_salesSummary`,
|
|
931
941
|
fatherModule: this.name,
|
|
932
|
-
openCache: this.
|
|
942
|
+
openCache: this.shouldUseSessionStorageForSubModule(moduleName),
|
|
933
943
|
cacheId: this.cacheId
|
|
934
944
|
};
|
|
935
945
|
}
|
|
@@ -940,7 +950,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
940
950
|
* await this.syncOtherParamsToSubModules({ channel: 'pos' });
|
|
941
951
|
*/
|
|
942
952
|
async syncOtherParamsToSubModules(changedParams, { cover = false } = {}) {
|
|
943
|
-
const nextSubModuleOtherParams = this.buildSubModuleOtherParams();
|
|
944
953
|
await Promise.all(
|
|
945
954
|
Object.entries(this.store).map(async ([moduleName, subModule]) => {
|
|
946
955
|
if (this.reusedSharedSubModuleNames.has(moduleName)) {
|
|
@@ -950,6 +959,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
950
959
|
if (!targetModule || typeof targetModule.updateOtherParams !== "function") {
|
|
951
960
|
return;
|
|
952
961
|
}
|
|
962
|
+
const nextSubModuleOtherParams = this.buildSubModuleOtherParams(moduleName);
|
|
953
963
|
await targetModule.updateOtherParams(nextSubModuleOtherParams, {
|
|
954
964
|
changedParams,
|
|
955
965
|
cover
|
|
@@ -962,14 +972,16 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
962
972
|
* sessionStorage 损坏时静默忽略,按空状态注册。
|
|
963
973
|
*/
|
|
964
974
|
readSessionCacheData() {
|
|
965
|
-
|
|
975
|
+
const cacheId = this.cacheId;
|
|
976
|
+
if (!cacheId || !this.isSessionStoragePersistEnabled() || !this.window) {
|
|
966
977
|
return {};
|
|
978
|
+
}
|
|
967
979
|
try {
|
|
968
980
|
const sessionData = this.window.sessionStorage.getItem(this.name);
|
|
969
981
|
if (!sessionData)
|
|
970
982
|
return {};
|
|
971
983
|
const data = JSON.parse(sessionData);
|
|
972
|
-
return data && data[
|
|
984
|
+
return data && data[cacheId] || {};
|
|
973
985
|
} catch {
|
|
974
986
|
return {};
|
|
975
987
|
}
|
|
@@ -1041,7 +1053,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1041
1053
|
return isChanged;
|
|
1042
1054
|
}
|
|
1043
1055
|
async initialize(core, options = {}) {
|
|
1044
|
-
var _a, _b;
|
|
1056
|
+
var _a, _b, _c, _d;
|
|
1045
1057
|
this.core = core;
|
|
1046
1058
|
this.initializeOptions = options || {};
|
|
1047
1059
|
this.paymentNumberDevicePrefix = null;
|
|
@@ -1052,10 +1064,9 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1052
1064
|
this.request = core.getPlugin("request");
|
|
1053
1065
|
this.appPlugin = core.getPlugin("app");
|
|
1054
1066
|
if (!this.appPlugin) {
|
|
1055
|
-
throw new Error("Checkout 解决方案需要 app 插件支持");
|
|
1056
1067
|
}
|
|
1057
|
-
const app = this.appPlugin.getApp();
|
|
1058
|
-
this.logger = app.logger;
|
|
1068
|
+
const app = (_c = (_b = this.appPlugin) == null ? void 0 : _b.getApp) == null ? void 0 : _c.call(_b);
|
|
1069
|
+
this.logger = app == null ? void 0 : app.logger;
|
|
1059
1070
|
const targetCacheData = this.readSessionCacheData();
|
|
1060
1071
|
const moduleNames = this.getRegisteredModuleNames();
|
|
1061
1072
|
moduleNames.forEach((step) => {
|
|
@@ -1072,15 +1083,15 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1072
1083
|
const hooks = this.getSubModuleHooks(step);
|
|
1073
1084
|
this.store[step] = targetModule;
|
|
1074
1085
|
this.core.registerModule(targetModule, {
|
|
1075
|
-
initialState: (targetCacheData == null ? void 0 : targetCacheData[targetModule.name]) || {},
|
|
1086
|
+
initialState: this.shouldUseSessionStorageForSubModule(step) ? (targetCacheData == null ? void 0 : targetCacheData[targetModule.name]) || {} : {},
|
|
1076
1087
|
...hooks ? { hooks } : {},
|
|
1077
|
-
otherParams: this.buildSubModuleOtherParams()
|
|
1088
|
+
otherParams: this.buildSubModuleOtherParams(step)
|
|
1078
1089
|
});
|
|
1079
1090
|
});
|
|
1080
1091
|
if (this.store.schedule && !this.isScheduleListLoaded(this.store.schedule)) {
|
|
1081
1092
|
await this.store.schedule.loadAllSchedule();
|
|
1082
1093
|
}
|
|
1083
|
-
if (this.store.order && typeof ((
|
|
1094
|
+
if (this.store.order && typeof ((_d = this.otherParams) == null ? void 0 : _d.enableTempOrderPersist) === "boolean") {
|
|
1084
1095
|
this.store.order.setEnableTempOrderPersist(
|
|
1085
1096
|
this.otherParams.enableTempOrderPersist
|
|
1086
1097
|
);
|
|
@@ -1141,17 +1152,21 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1141
1152
|
const message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || `加载销售详情失败: ${lookup}`;
|
|
1142
1153
|
throw new Error(message);
|
|
1143
1154
|
}
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1146
|
-
);
|
|
1155
|
+
const loadedSalesDetail = preloadedSalesDetail ?? loadedRecord.data;
|
|
1156
|
+
const shouldFilterPendingPayments = params.hydrateSource !== "sessionStorage";
|
|
1157
|
+
const remoteRecord = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(loadedSalesDetail) : loadedSalesDetail;
|
|
1147
1158
|
const currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
1148
1159
|
const mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(
|
|
1149
1160
|
currentTempOrder,
|
|
1150
1161
|
remoteRecord,
|
|
1151
1162
|
"preserve-local"
|
|
1152
1163
|
) : remoteRecord;
|
|
1153
|
-
const record = filterPendingPaymentsFromLoadedSalesDetail(mergedRecord);
|
|
1154
|
-
return await this.hydrateLatestLoadedSalesDetail(
|
|
1164
|
+
const record = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(mergedRecord) : mergedRecord;
|
|
1165
|
+
return await this.hydrateLatestLoadedSalesDetail(
|
|
1166
|
+
record,
|
|
1167
|
+
loadSequence,
|
|
1168
|
+
params.hydrateSource
|
|
1169
|
+
);
|
|
1155
1170
|
} finally {
|
|
1156
1171
|
this.salesDetailLoadInFlightCount = Math.max(
|
|
1157
1172
|
0,
|
|
@@ -1934,6 +1949,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1934
1949
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1935
1950
|
}
|
|
1936
1951
|
const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
|
|
1952
|
+
const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
|
|
1937
1953
|
const submitParams = {
|
|
1938
1954
|
cacheId: this.cacheId,
|
|
1939
1955
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
@@ -1943,11 +1959,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1943
1959
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
|
|
1944
1960
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1945
1961
|
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1946
|
-
...
|
|
1962
|
+
...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
|
|
1947
1963
|
...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
|
|
1948
1964
|
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1949
1965
|
};
|
|
1950
|
-
return this.store.order.submitTempOrder(submitParams);
|
|
1966
|
+
return this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams);
|
|
1951
1967
|
}
|
|
1952
1968
|
async saveSalesOrderDraft(params) {
|
|
1953
1969
|
var _a, _b, _c, _d;
|
|
@@ -1969,20 +1985,35 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1969
1985
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1970
1986
|
}
|
|
1971
1987
|
const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
|
|
1988
|
+
const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
|
|
1972
1989
|
const submitParams = {
|
|
1973
1990
|
cacheId: this.cacheId,
|
|
1974
1991
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
1975
1992
|
businessCode: ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code),
|
|
1976
1993
|
channel: this.getSubmitOrderSalesChannel(),
|
|
1977
1994
|
type: (_d = this.otherParams) == null ? void 0 : _d.type,
|
|
1995
|
+
request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
|
|
1978
1996
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1979
1997
|
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1980
|
-
...
|
|
1998
|
+
...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
|
|
1981
1999
|
...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
|
|
1982
2000
|
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1983
2001
|
};
|
|
1984
2002
|
return this.store.order.submitTempOrderAsync(submitParams);
|
|
1985
2003
|
}
|
|
2004
|
+
/**
|
|
2005
|
+
* 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
|
|
2006
|
+
* otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
|
|
2007
|
+
*/
|
|
2008
|
+
shouldUseCheckoutSyncTask() {
|
|
2009
|
+
var _a;
|
|
2010
|
+
const configured = (_a = this.otherParams) == null ? void 0 : _a.checkoutSyncTaskEnabled;
|
|
2011
|
+
return typeof configured === "boolean" ? configured : true;
|
|
2012
|
+
}
|
|
2013
|
+
/** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
|
|
2014
|
+
getDefaultCheckoutSmallTicketDataFlag() {
|
|
2015
|
+
return void 0;
|
|
2016
|
+
}
|
|
1986
2017
|
async printLocalOrderReceipt(lookup) {
|
|
1987
2018
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1988
2019
|
if (!this.store.order) {
|
|
@@ -2042,6 +2073,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2042
2073
|
const channel = params.channel ?? this.getSubmitOrderSalesChannel();
|
|
2043
2074
|
const syncParams = {
|
|
2044
2075
|
...params,
|
|
2076
|
+
checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask(),
|
|
2045
2077
|
...businessCode !== void 0 ? { businessCode } : {},
|
|
2046
2078
|
...channel !== void 0 ? { channel } : {}
|
|
2047
2079
|
};
|
|
@@ -2786,7 +2818,9 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2786
2818
|
confirmPendingVoucherPayments: true
|
|
2787
2819
|
});
|
|
2788
2820
|
if (isRejectedSalesSubmitResult(submitResult)) {
|
|
2789
|
-
throw new Error(
|
|
2821
|
+
throw new Error(
|
|
2822
|
+
getSalesSubmitErrorMessage(submitResult, "Wallet 支付确认失败")
|
|
2823
|
+
);
|
|
2790
2824
|
}
|
|
2791
2825
|
} catch (error) {
|
|
2792
2826
|
this.store.order.setOrderPayments(beforePayments);
|
|
@@ -2889,6 +2923,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2889
2923
|
smallTicketDataFlag: 1,
|
|
2890
2924
|
confirmPendingVoucherPayments: true
|
|
2891
2925
|
});
|
|
2926
|
+
if (isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
2927
|
+
throw new Error(
|
|
2928
|
+
getSalesSubmitErrorMessage(syncResult.submitResult, "订单提交失败")
|
|
2929
|
+
);
|
|
2930
|
+
}
|
|
2892
2931
|
if (this.store.payment) {
|
|
2893
2932
|
const committed = this.getCommittedWalletAssets();
|
|
2894
2933
|
const walletState = this.store.payment.wallet.setCommittedWalletAssets(
|
|
@@ -2999,6 +3038,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2999
3038
|
smallTicketDataFlag: 1,
|
|
3000
3039
|
confirmPendingVoucherPayments: true
|
|
3001
3040
|
});
|
|
3041
|
+
if (isRejectedSalesSubmitResult(syncResult.submitResult)) {
|
|
3042
|
+
throw new Error(
|
|
3043
|
+
getSalesSubmitErrorMessage(syncResult.submitResult, "订单提交失败")
|
|
3044
|
+
);
|
|
3045
|
+
}
|
|
3002
3046
|
if (this.store.payment) {
|
|
3003
3047
|
const committed = this.getCommittedWalletAssets();
|
|
3004
3048
|
const walletState = this.store.payment.wallet.setCommittedWalletAssets(
|
|
@@ -366,11 +366,29 @@ function getProductLineNoteSignature(product) {
|
|
|
366
366
|
const uid = getOrderProductUid(product);
|
|
367
367
|
return uid ? `note:${uid}` : `note:${normalizedNote}`;
|
|
368
368
|
}
|
|
369
|
+
function hasGoodPassDiscount(product) {
|
|
370
|
+
var _a, _b;
|
|
371
|
+
const productBundle = Array.isArray(product == null ? void 0 : product.product_bundle) ? product.product_bundle : [];
|
|
372
|
+
const extendedBundle = Array.isArray((_b = (_a = product == null ? void 0 : product._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) ? product._extend.other.bundle : [];
|
|
373
|
+
const discountLists = [
|
|
374
|
+
product == null ? void 0 : product.discount_list,
|
|
375
|
+
...productBundle.map((item) => item == null ? void 0 : item.discount_list),
|
|
376
|
+
...extendedBundle.map((item) => item == null ? void 0 : item.discount_list)
|
|
377
|
+
];
|
|
378
|
+
return discountLists.some(
|
|
379
|
+
(discountList) => Array.isArray(discountList) && discountList.some(
|
|
380
|
+
(item) => (item == null ? void 0 : item.type) === "good_pass" || (item == null ? void 0 : item.tag) === "good_pass"
|
|
381
|
+
)
|
|
382
|
+
);
|
|
383
|
+
}
|
|
369
384
|
function getPromotionLineMergeBoundary(product) {
|
|
370
385
|
var _a, _b;
|
|
371
386
|
if ((product == null ? void 0 : product.product_id) === void 0 || (product == null ? void 0 : product.product_id) === null) {
|
|
372
387
|
return `custom:${getOrderProductUid(product)}`;
|
|
373
388
|
}
|
|
389
|
+
if (hasGoodPassDiscount(product)) {
|
|
390
|
+
return `good-pass:${getOrderProductUid(product)}`;
|
|
391
|
+
}
|
|
374
392
|
if (Number(((_a = product == null ? void 0 : product.product_sku) == null ? void 0 : _a.open_sold_weight) || 0) === 1) {
|
|
375
393
|
return `weighing:${getOrderProductUid(product)}`;
|
|
376
394
|
}
|
|
@@ -230,6 +230,7 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
230
230
|
},
|
|
231
231
|
product_bundle: productBundle,
|
|
232
232
|
discount_list: manualDiscountList,
|
|
233
|
+
...payload.bundle_edit !== void 0 ? { bundle_edit: payload.bundle_edit } : {},
|
|
233
234
|
// 折后行价由 normalizeOrderProduct 按 main + bundle 合成;手动改价时 bundle 已为分摊后单价
|
|
234
235
|
selling_price: lineCompositeTotal,
|
|
235
236
|
original_price: lineOriginalPrice,
|
|
@@ -60,33 +60,44 @@ function createEmptySummary() {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
63
|
+
const normalizeOptions = (options) => {
|
|
64
|
+
const optionArr = Array.isArray(options) ? options : [];
|
|
65
|
+
return optionArr.map((item) => ({
|
|
66
|
+
option_group_item_id: Number(item == null ? void 0 : item.option_group_item_id) || 0,
|
|
67
|
+
option_group_id: Number(item == null ? void 0 : item.option_group_id) || 0,
|
|
68
|
+
num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
69
|
+
price: String((item == null ? void 0 : item.add_price) ?? (item == null ? void 0 : item.price) ?? "")
|
|
70
|
+
})).sort((p, q) => {
|
|
71
|
+
if (p.option_group_item_id !== q.option_group_item_id) {
|
|
72
|
+
return p.option_group_item_id - q.option_group_item_id;
|
|
73
|
+
}
|
|
74
|
+
if (p.option_group_id !== q.option_group_id) {
|
|
75
|
+
return p.option_group_id - q.option_group_id;
|
|
76
|
+
}
|
|
77
|
+
if (p.num !== q.num)
|
|
78
|
+
return p.num - q.num;
|
|
79
|
+
return p.price.localeCompare(q.price);
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const normalizedOpts = normalizeOptions(productOptionItem);
|
|
79
83
|
const bundleArr = Array.isArray(productBundle) ? productBundle : [];
|
|
80
84
|
const normalizedBundles = bundleArr.map((item) => ({
|
|
81
85
|
bundle_id: Number((item == null ? void 0 : item.bundle_id) ?? (item == null ? void 0 : item.id) ?? 0) || 0,
|
|
82
86
|
product_id: Number(item == null ? void 0 : item.product_id) || 0,
|
|
83
|
-
|
|
87
|
+
product_variant_id: Number((item == null ? void 0 : item.bundle_variant_id) ?? (item == null ? void 0 : item.product_variant_id)) || 0,
|
|
88
|
+
num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
89
|
+
option: normalizeOptions(item == null ? void 0 : item.option)
|
|
84
90
|
})).sort((p, q) => {
|
|
85
91
|
if (p.bundle_id !== q.bundle_id)
|
|
86
92
|
return p.bundle_id - q.bundle_id;
|
|
87
93
|
if (p.product_id !== q.product_id)
|
|
88
94
|
return p.product_id - q.product_id;
|
|
89
|
-
|
|
95
|
+
if (p.product_variant_id !== q.product_variant_id) {
|
|
96
|
+
return p.product_variant_id - q.product_variant_id;
|
|
97
|
+
}
|
|
98
|
+
if (p.num !== q.num)
|
|
99
|
+
return p.num - q.num;
|
|
100
|
+
return JSON.stringify(p.option).localeCompare(JSON.stringify(q.option));
|
|
90
101
|
});
|
|
91
102
|
return JSON.stringify([normalizedOpts, normalizedBundles]);
|
|
92
103
|
}
|
|
@@ -10,6 +10,7 @@ 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';
|
|
13
14
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
14
15
|
protected defaultName: string;
|
|
15
16
|
protected defaultVersion: string;
|
|
@@ -126,6 +127,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
126
127
|
* @param params
|
|
127
128
|
*/
|
|
128
129
|
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;
|
|
129
144
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
130
145
|
clearDateRange(): void;
|
|
131
146
|
getDateRange(): Promise<ITime[]>;
|
|
@@ -302,7 +317,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
317
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
318
|
errorList: any[];
|
|
304
319
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
320
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
321
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
322
|
resources_code: string;
|
|
308
323
|
startDate: string;
|
|
@@ -89,6 +89,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
89
89
|
}
|
|
90
90
|
const moduleArr = [
|
|
91
91
|
"accountList",
|
|
92
|
+
"holder",
|
|
92
93
|
"cart",
|
|
93
94
|
"schedule",
|
|
94
95
|
"summary",
|
|
@@ -379,6 +380,27 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
379
380
|
}
|
|
380
381
|
return this.store.accountList.fetchHolderAccounts(params);
|
|
381
382
|
}
|
|
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
|
+
}
|
|
382
404
|
// 设置日期范围,注入到日期模块中
|
|
383
405
|
async setDateRange(dateRange) {
|
|
384
406
|
this.store.date.setDateRange(dateRange);
|
|
@@ -486,6 +508,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
486
508
|
date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
|
|
487
509
|
}
|
|
488
510
|
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
|
+
}
|
|
489
519
|
}
|
|
490
520
|
} else {
|
|
491
521
|
throw new Error(`没有找到${accountId}账户`);
|
|
@@ -512,10 +542,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
512
542
|
}
|
|
513
543
|
// 购物车提交订单
|
|
514
544
|
async submitOrder(extraData) {
|
|
545
|
+
var _a;
|
|
515
546
|
const cartItems = this.store.cart.getItems();
|
|
516
547
|
const newCartItems = (0, import_lodash_es.cloneDeep)(cartItems);
|
|
517
548
|
newCartItems.forEach((item) => {
|
|
518
|
-
var
|
|
549
|
+
var _a2;
|
|
519
550
|
if (item._origin.resources && item._origin.resources.length) {
|
|
520
551
|
item._origin.resources = item._origin.resources.map((n) => {
|
|
521
552
|
const newResourcesItem = (0, import_lodash_es.cloneDeep)(n);
|
|
@@ -525,7 +556,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
525
556
|
return { ...newResourcesItem };
|
|
526
557
|
});
|
|
527
558
|
const { currentCapacity, formatCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
528
|
-
if (!((
|
|
559
|
+
if (!((_a2 = item._origin) == null ? void 0 : _a2.metadata)) {
|
|
529
560
|
item._origin.metadata = {};
|
|
530
561
|
}
|
|
531
562
|
item._origin.metadata.capacity = formatCapacity;
|
|
@@ -543,6 +574,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
543
574
|
cartItems: newCartItems,
|
|
544
575
|
type,
|
|
545
576
|
platform: this.platform,
|
|
577
|
+
business_code: (_a = this.otherParams) == null ? void 0 : _a.business_code,
|
|
546
578
|
extraData
|
|
547
579
|
}
|
|
548
580
|
});
|
|
@@ -628,6 +660,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
628
660
|
account = activeAccount;
|
|
629
661
|
}
|
|
630
662
|
}
|
|
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
|
+
}
|
|
631
672
|
const flag = this.store.cart.mergeCartItemByRowKey({
|
|
632
673
|
rowKey,
|
|
633
674
|
quantity,
|
|
@@ -1150,7 +1191,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1150
1191
|
}
|
|
1151
1192
|
const totalCapacity = (countMap[n.id] || []).reduce(
|
|
1152
1193
|
(sum, item) => {
|
|
1153
|
-
const hasOverlap =
|
|
1194
|
+
const hasOverlap = (0, import_dayjs.default)(item.time.start_at).isBefore((0, import_dayjs.default)(timeSlots.end_at)) && (0, import_dayjs.default)(item.time.end_at).isAfter((0, import_dayjs.default)(timeSlots.start_at));
|
|
1154
1195
|
return hasOverlap ? sum + item.pax : sum;
|
|
1155
1196
|
},
|
|
1156
1197
|
0
|
|
@@ -1232,9 +1273,10 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1232
1273
|
}
|
|
1233
1274
|
);
|
|
1234
1275
|
cartItems2.forEach((item, index) => {
|
|
1235
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1276
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
1236
1277
|
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
1237
|
-
|
|
1278
|
+
const hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots == null ? void 0 : timeSlots.start_time);
|
|
1279
|
+
if (hasOriginTimeSlot) {
|
|
1238
1280
|
recordTimeSlots = {
|
|
1239
1281
|
start_time: item._origin.start_time,
|
|
1240
1282
|
end_time: item._origin.end_time,
|
|
@@ -1246,13 +1288,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1246
1288
|
const currentResourceConfig = (_c = (_b = (_a2 = item._productOrigin) == null ? void 0 : _a2.product_resource) == null ? void 0 : _b.resources) == null ? void 0 : _c.find(
|
|
1247
1289
|
(n) => n.code === resources_code
|
|
1248
1290
|
);
|
|
1249
|
-
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct) {
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
"minutes"
|
|
1253
|
-
);
|
|
1291
|
+
if (index !== 0 && recordTimeSlots && (currentResourceConfig == null ? void 0 : currentResourceConfig.type) === "single" && ((_d = item._productOrigin) == null ? void 0 : _d.duration) && !hasFlexibleProduct && !hasOriginTimeSlot) {
|
|
1292
|
+
const recordEndAt = recordTimeSlots.end_at ? (0, import_dayjs.default)(recordTimeSlots.end_at) : (0, import_dayjs.default)(`${item.start_date} ${recordTimeSlots.end_time}`);
|
|
1293
|
+
let start_at = recordEndAt;
|
|
1254
1294
|
let end_at = start_at.add(
|
|
1255
|
-
((
|
|
1295
|
+
((_f = (_e = item._productOrigin) == null ? void 0 : _e.duration) == null ? void 0 : _f.value) || 10,
|
|
1256
1296
|
"minutes"
|
|
1257
1297
|
);
|
|
1258
1298
|
recordTimeSlots = {
|
|
@@ -1306,7 +1346,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1306
1346
|
const allCartItems = (0, import_lodash_es.cloneDeep)(this.store.cart.getItems());
|
|
1307
1347
|
let selectedResources = [];
|
|
1308
1348
|
const resources2 = (0, import_lodash_es.cloneDeep)(
|
|
1309
|
-
((
|
|
1349
|
+
((_h = (_g = item._productOrigin) == null ? void 0 : _g.product_resource) == null ? void 0 : _h.resources) || []
|
|
1310
1350
|
);
|
|
1311
1351
|
const currentResourcesRenderList = [];
|
|
1312
1352
|
resources2.forEach((n) => {
|
|
@@ -1354,11 +1394,11 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1354
1394
|
return recordCount >= currentCapacity;
|
|
1355
1395
|
});
|
|
1356
1396
|
});
|
|
1357
|
-
const targetRenderList = (
|
|
1397
|
+
const targetRenderList = (_i = productResources.find(
|
|
1358
1398
|
(n) => n.code === resources_code
|
|
1359
|
-
)) == null ? void 0 :
|
|
1399
|
+
)) == null ? void 0 : _i.renderList;
|
|
1360
1400
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
1361
|
-
if ((
|
|
1401
|
+
if ((_j = item._origin.resources) == null ? void 0 : _j.some(
|
|
1362
1402
|
(n) => n.form_id === targetRenderList[0].form_id
|
|
1363
1403
|
)) {
|
|
1364
1404
|
return;
|
|
@@ -1366,7 +1406,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1366
1406
|
const fastestResource = (0, import_timeslots.findFastestAvailableResource)({
|
|
1367
1407
|
resources: targetRenderList,
|
|
1368
1408
|
currentCapacity,
|
|
1369
|
-
countMap: selectResourcesMap
|
|
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
|
|
1370
1412
|
});
|
|
1371
1413
|
const targetResource = fastestResource || targetRenderList[0];
|
|
1372
1414
|
targetResource.capacity = currentCapacity;
|
|
@@ -1403,7 +1445,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1403
1445
|
return { errorList };
|
|
1404
1446
|
}
|
|
1405
1447
|
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
1406
|
-
getTimeSlotByAllResources(resources_code) {
|
|
1448
|
+
getTimeSlotByAllResources(resources_code, split = 10) {
|
|
1407
1449
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1408
1450
|
let dateRange = this.store.date.getDateRange();
|
|
1409
1451
|
const resources = [];
|
|
@@ -1561,7 +1603,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1561
1603
|
resourcesMap,
|
|
1562
1604
|
duration,
|
|
1563
1605
|
currentDate: dateRange[0].date,
|
|
1564
|
-
split
|
|
1606
|
+
split,
|
|
1565
1607
|
resourcesUseableMap,
|
|
1566
1608
|
capacity: maxCapacity,
|
|
1567
1609
|
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 } from '../../modules';
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -16,6 +16,7 @@ export interface BookingByStepState {
|
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
17
|
salesSummary?: SalesSummaryModule;
|
|
18
18
|
scanOrderLogger?: ScanOrderLoggerModule;
|
|
19
|
+
holder: HolderModule;
|
|
19
20
|
}
|
|
20
21
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
21
22
|
export declare enum BookingByStepHooks {
|
|
@@ -81,6 +81,11 @@ 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
|
+
);
|
|
84
89
|
default:
|
|
85
90
|
throw new Error(`Unknown module type: ${moduleName}`);
|
|
86
91
|
}
|
|
@@ -49,8 +49,27 @@ 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
|
+
}
|
|
54
73
|
return {
|
|
55
74
|
id,
|
|
56
75
|
value: item ? d.num || 0 : 0,
|