@pisell/pisellos 2.2.278 → 2.2.280
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/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 +21 -7
- 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/solution/BaseSales/index.d.ts +20 -1
- package/dist/solution/BaseSales/index.js +989 -881
- 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 +17 -2
- 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 +21 -3
- package/dist/solution/BookingTicket/index.js +312 -226
- 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 +0 -51
- 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 +12 -0
- 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/solution/BaseSales/index.d.ts +20 -1
- package/lib/solution/BaseSales/index.js +105 -31
- 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 +17 -2
- 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 +21 -3
- package/lib/solution/BookingTicket/index.js +75 -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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType, DateModule, ScheduleModule, QuotationModule, OpenDataModule } from '../../modules';
|
|
2
2
|
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
3
|
+
import { HolderModule } from '../../modules/Holder';
|
|
3
4
|
export type { ScanOrderOrderProductIdentity, ScanOrderOrderProduct, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder, ScanOrderSubmitPayload, } from '../ScanOrder/types';
|
|
4
5
|
export declare enum VenueBookingHooks {
|
|
5
6
|
onInited = "venueBooking:onInited",
|
|
@@ -96,6 +97,7 @@ export interface VenueResourceRawData {
|
|
|
96
97
|
export interface ResourceProductMapping {
|
|
97
98
|
productId: number;
|
|
98
99
|
productTitle: string;
|
|
100
|
+
formName?: string;
|
|
99
101
|
resourceName: string;
|
|
100
102
|
formId: number | string;
|
|
101
103
|
price: string;
|
|
@@ -144,6 +146,7 @@ export interface VenueBookingState {
|
|
|
144
146
|
passed: boolean | null;
|
|
145
147
|
failures: QuantityCheckResult[];
|
|
146
148
|
};
|
|
149
|
+
holder?: HolderModule;
|
|
147
150
|
}
|
|
148
151
|
export interface VenueBookingLoggerRuntimeConfig {
|
|
149
152
|
provider?: ScanOrderLoggerProviderType;
|
|
@@ -12,10 +12,6 @@ export declare function buildPriceBreakdown(params: {
|
|
|
12
12
|
}) => number;
|
|
13
13
|
};
|
|
14
14
|
}): PriceBreakdownEntry[];
|
|
15
|
-
export declare function buildVenueResourceMetadata(params: {
|
|
16
|
-
mapping: ResourceProductMapping;
|
|
17
|
-
rawResource: VenueResourceRawData | undefined;
|
|
18
|
-
}): Record<string, any>;
|
|
19
15
|
export interface BuildVenueBookingParams {
|
|
20
16
|
group: MergedSlotGroup;
|
|
21
17
|
resourceId: number | string;
|
|
@@ -29,6 +25,10 @@ export interface BuildVenueBookingParams {
|
|
|
29
25
|
*/
|
|
30
26
|
childResources?: VenueResourceRawData[];
|
|
31
27
|
}
|
|
28
|
+
export declare function buildVenueResourceMetadata(params: {
|
|
29
|
+
mapping: ResourceProductMapping;
|
|
30
|
+
rawResource: VenueResourceRawData | undefined;
|
|
31
|
+
}): Record<string, any>;
|
|
32
32
|
export declare function buildVenueBookingEntry(params: BuildVenueBookingParams): Record<string, any>;
|
|
33
33
|
/**
|
|
34
34
|
* 从一条已合并的订单商品还原出独立的时段列表。
|
|
@@ -90,13 +90,15 @@ export function buildPriceBreakdown(params) {
|
|
|
90
90
|
return entries;
|
|
91
91
|
}
|
|
92
92
|
export function buildVenueResourceMetadata(params) {
|
|
93
|
-
var
|
|
93
|
+
var _mapping$formName, _rawResource$main_fie;
|
|
94
94
|
var mapping = params.mapping,
|
|
95
95
|
rawResource = params.rawResource;
|
|
96
|
+
var combined = rawResource === null || rawResource === void 0 ? void 0 : rawResource.combined_resource;
|
|
97
|
+
var isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
|
|
96
98
|
return {
|
|
97
|
-
form_name: (
|
|
98
|
-
resource_name: (
|
|
99
|
-
combined_resource:
|
|
99
|
+
form_name: (_mapping$formName = mapping.formName) !== null && _mapping$formName !== void 0 ? _mapping$formName : mapping.resourceName,
|
|
100
|
+
resource_name: (_rawResource$main_fie = rawResource === null || rawResource === void 0 ? void 0 : rawResource.main_field) !== null && _rawResource$main_fie !== void 0 ? _rawResource$main_fie : mapping.resourceName,
|
|
101
|
+
combined_resource: isCombined ? combined : null
|
|
100
102
|
};
|
|
101
103
|
}
|
|
102
104
|
export function buildVenueBookingEntry(params) {
|
|
@@ -119,7 +121,10 @@ export function buildVenueBookingEntry(params) {
|
|
|
119
121
|
form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
|
|
120
122
|
relation_id: resourceId,
|
|
121
123
|
capacity: 1,
|
|
122
|
-
metadata: {
|
|
124
|
+
metadata: buildVenueResourceMetadata({
|
|
125
|
+
mapping: mapping,
|
|
126
|
+
rawResource: rawResource
|
|
127
|
+
})
|
|
123
128
|
};
|
|
124
129
|
if (childResources && childResources.length) {
|
|
125
130
|
resourceEntry.children = childResources.map(function (child) {
|
package/dist/solution/index.d.ts
CHANGED
package/dist/solution/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
|
|
34
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
35
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
36
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
37
|
-
default: () => import_adapter2.default
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
40
|
-
var import_evaluator = require("./evaluator");
|
|
41
|
-
var import_adapter = require("./adapter");
|
|
42
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
43
|
-
var import_examples = require("./examples");
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
47
|
-
ITEM_REWARD_STRATEGY,
|
|
48
|
-
PromotionAdapter,
|
|
49
|
-
PromotionEvaluator,
|
|
50
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
51
|
-
});
|
|
@@ -8,6 +8,7 @@ export declare class BaseModule {
|
|
|
8
8
|
protected core: PisellCore;
|
|
9
9
|
constructor(name?: string, version?: string);
|
|
10
10
|
destroy(): void;
|
|
11
|
+
private isRecord;
|
|
11
12
|
checkSaveCache({ cacheId, fatherModule, store, cacheKey, }: {
|
|
12
13
|
cacheId: string | undefined;
|
|
13
14
|
fatherModule: string | undefined;
|
|
@@ -34,6 +34,9 @@ var BaseModule = class {
|
|
|
34
34
|
this.core.effects.offByModuleDestroy(this.name);
|
|
35
35
|
this.core.unregisterModule(this);
|
|
36
36
|
}
|
|
37
|
+
isRecord(value) {
|
|
38
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
39
|
+
}
|
|
37
40
|
// 提供统一的缓存 module 里的数据的方法
|
|
38
41
|
checkSaveCache({
|
|
39
42
|
cacheId,
|
|
@@ -41,45 +44,29 @@ var BaseModule = class {
|
|
|
41
44
|
store,
|
|
42
45
|
cacheKey
|
|
43
46
|
}) {
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
if (!cacheId)
|
|
48
|
+
return;
|
|
49
|
+
try {
|
|
50
|
+
const window = this.core.getPlugin("window");
|
|
51
|
+
const sessionStorage = window == null ? void 0 : window.sessionStorage;
|
|
52
|
+
if (!sessionStorage)
|
|
53
|
+
return;
|
|
54
|
+
const storageKey = fatherModule || cacheId;
|
|
55
|
+
const rawCacheData = sessionStorage.getItem(storageKey);
|
|
56
|
+
const parsedCacheData = rawCacheData ? JSON.parse(rawCacheData) : {};
|
|
57
|
+
if (!this.isRecord(parsedCacheData))
|
|
58
|
+
return;
|
|
59
|
+
const cacheBucket = fatherModule ? this.isRecord(parsedCacheData[cacheId]) ? parsedCacheData[cacheId] : {} : parsedCacheData;
|
|
60
|
+
const moduleBucket = this.isRecord(cacheBucket[this.name]) ? cacheBucket[this.name] : {};
|
|
61
|
+
cacheKey.forEach((key) => {
|
|
62
|
+
moduleBucket[key] = store == null ? void 0 : store[key];
|
|
63
|
+
});
|
|
64
|
+
cacheBucket[this.name] = moduleBucket;
|
|
46
65
|
if (fatherModule) {
|
|
47
|
-
|
|
48
|
-
let currentCacheDataObj = JSON.parse(currentCacheData || "{}");
|
|
49
|
-
if (!currentCacheData || !currentCacheDataObj[cacheId]) {
|
|
50
|
-
currentCacheDataObj = {
|
|
51
|
-
[cacheId]: {
|
|
52
|
-
[this.name]: {}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (!currentCacheDataObj[cacheId][this.name]) {
|
|
57
|
-
currentCacheDataObj[cacheId][this.name] = {};
|
|
58
|
-
}
|
|
59
|
-
cacheKey.forEach((key) => {
|
|
60
|
-
currentCacheDataObj[cacheId][this.name][key] = store == null ? void 0 : store[key];
|
|
61
|
-
});
|
|
62
|
-
window.sessionStorage.setItem(
|
|
63
|
-
fatherModule,
|
|
64
|
-
JSON.stringify(currentCacheDataObj)
|
|
65
|
-
);
|
|
66
|
-
} else {
|
|
67
|
-
let currentCacheData = window.sessionStorage.getItem(cacheId);
|
|
68
|
-
let currentCacheDataObj = JSON.parse(currentCacheData || "{}");
|
|
69
|
-
if (!currentCacheDataObj) {
|
|
70
|
-
currentCacheDataObj = {};
|
|
71
|
-
}
|
|
72
|
-
if (!currentCacheDataObj[this.name]) {
|
|
73
|
-
currentCacheDataObj[this.name] = {};
|
|
74
|
-
}
|
|
75
|
-
cacheKey.forEach((key) => {
|
|
76
|
-
currentCacheDataObj[this.name][key] = store[key];
|
|
77
|
-
});
|
|
78
|
-
window.sessionStorage.setItem(
|
|
79
|
-
cacheId,
|
|
80
|
-
JSON.stringify(currentCacheDataObj)
|
|
81
|
-
);
|
|
66
|
+
parsedCacheData[cacheId] = cacheBucket;
|
|
82
67
|
}
|
|
68
|
+
sessionStorage.setItem(storageKey, JSON.stringify(parsedCacheData));
|
|
69
|
+
} catch {
|
|
83
70
|
}
|
|
84
71
|
}
|
|
85
72
|
effectsOn(eventType, callback) {
|
|
@@ -202,6 +202,8 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
202
202
|
const productTitle = resolveProductTitle(product, booking, sourceProduct);
|
|
203
203
|
const productCover = resolveProductCover(product, booking, sourceProduct);
|
|
204
204
|
const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
|
|
205
|
+
const hasBundle = Array.isArray(product.product_bundle) && product.product_bundle.length > 0;
|
|
206
|
+
const bundleEdit = product.bundle_edit ?? (hasBundle ? 0 : void 0);
|
|
205
207
|
const other = {
|
|
206
208
|
product_variant_id: product.product_variant_id ?? 0,
|
|
207
209
|
option: (0, import_utils.getProductSkuOptions)(product),
|
|
@@ -234,6 +236,7 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
234
236
|
product.discount_list,
|
|
235
237
|
(_c = product.metadata) == null ? void 0 : _c.product_discount_reason
|
|
236
238
|
) || void 0,
|
|
239
|
+
...bundleEdit !== void 0 ? { bundle_edit: bundleEdit } : {},
|
|
237
240
|
...productOptionString ? { product_option_string: productOptionString } : {}
|
|
238
241
|
};
|
|
239
242
|
const manualDiscount = (product.discount_list || []).find((d) => (d == null ? void 0 : d.type) === "product");
|
|
@@ -83,12 +83,13 @@ function getTimeObj(params) {
|
|
|
83
83
|
const { cacheItem, useStartTime, useDuration, ctx } = params;
|
|
84
84
|
const isMultiDay = (0, import_serviceTimes.isMultiDayProduct)(cacheItem);
|
|
85
85
|
const flexibleOption = getFlexibleOption({ cacheItem, useStartTime, ctx });
|
|
86
|
-
const
|
|
86
|
+
const {
|
|
87
|
+
timeSlices,
|
|
88
|
+
durationSlicesBasedOnTime
|
|
89
|
+
} = (0, import_timeSlices.sliceDayIntoFiveMinutes)(
|
|
87
90
|
(_c = (_b = (_a = ctx == null ? void 0 : ctx.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.service_time,
|
|
88
91
|
isMultiDay
|
|
89
92
|
);
|
|
90
|
-
const timeSlices = [...baseSlices.timeSlices];
|
|
91
|
-
const durationSlicesBasedOnTime = [...baseSlices.durationSlicesBasedOnTime];
|
|
92
93
|
if (flexibleOption) {
|
|
93
94
|
durationSlicesBasedOnTime.unshift(flexibleOption);
|
|
94
95
|
}
|
|
@@ -38,10 +38,21 @@ __export(timeSlices_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(timeSlices_exports);
|
|
39
39
|
var import_dayjs = __toESM(require("dayjs"));
|
|
40
40
|
var import_flexible = require("./flexible");
|
|
41
|
+
var timeSlicesCache = /* @__PURE__ */ new Map();
|
|
42
|
+
function copyTimeSlices(result) {
|
|
43
|
+
return {
|
|
44
|
+
timeSlices: [...result.timeSlices],
|
|
45
|
+
durationSlicesBasedOnTime: [...result.durationSlicesBasedOnTime]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
41
48
|
function sliceDayIntoFiveMinutes(config, isDay) {
|
|
49
|
+
const timeSlice = config && config.value || 5;
|
|
50
|
+
const cacheKey = isDay ? "days" : `minutes:${timeSlice}`;
|
|
51
|
+
const cached = timeSlicesCache.get(cacheKey);
|
|
52
|
+
if (cached)
|
|
53
|
+
return copyTimeSlices(cached);
|
|
42
54
|
const startTime = (0, import_dayjs.default)().startOf("day");
|
|
43
55
|
const endTime = (0, import_dayjs.default)().endOf("day");
|
|
44
|
-
const timeSlice = config && config.value || 5;
|
|
45
56
|
const timeSlices = [];
|
|
46
57
|
const durationSlicesBasedOnTime = [];
|
|
47
58
|
let currentTime = startTime;
|
|
@@ -58,7 +69,9 @@ function sliceDayIntoFiveMinutes(config, isDay) {
|
|
|
58
69
|
});
|
|
59
70
|
currentDay += 1;
|
|
60
71
|
}
|
|
61
|
-
|
|
72
|
+
const result2 = { timeSlices, durationSlicesBasedOnTime };
|
|
73
|
+
timeSlicesCache.set(cacheKey, result2);
|
|
74
|
+
return copyTimeSlices(result2);
|
|
62
75
|
}
|
|
63
76
|
while (currentTime.isBefore(endTime)) {
|
|
64
77
|
timeSlices.push({
|
|
@@ -73,7 +86,9 @@ function sliceDayIntoFiveMinutes(config, isDay) {
|
|
|
73
86
|
});
|
|
74
87
|
currentTime = nextTime;
|
|
75
88
|
}
|
|
76
|
-
|
|
89
|
+
const result = { timeSlices, durationSlicesBasedOnTime };
|
|
90
|
+
timeSlicesCache.set(cacheKey, result);
|
|
91
|
+
return copyTimeSlices(result);
|
|
77
92
|
}
|
|
78
93
|
function findNextDuration(current, array, defaultValue) {
|
|
79
94
|
if (defaultValue !== void 0 && defaultValue !== null)
|
|
@@ -44,6 +44,10 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
44
44
|
* 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
|
|
45
45
|
*/
|
|
46
46
|
queryCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* 查询单个客户详情,不写入 customerList / pagination 状态。
|
|
49
|
+
*/
|
|
50
|
+
queryCustomerDetail(id: string | number): Promise<ShopCustomer | null>;
|
|
47
51
|
/**
|
|
48
52
|
* 获取客户列表
|
|
49
53
|
* @param params 查询参数
|
|
@@ -201,6 +201,17 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
201
201
|
pageSize
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* 查询单个客户详情,不写入 customerList / pagination 状态。
|
|
206
|
+
*/
|
|
207
|
+
async queryCustomerDetail(id) {
|
|
208
|
+
var _a;
|
|
209
|
+
const result = await this.request.get(`/customer/info/${id}`, {
|
|
210
|
+
with_trashed: 1
|
|
211
|
+
});
|
|
212
|
+
const customer = ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.customer) || (result == null ? void 0 : result.data) || (result == null ? void 0 : result.customer) || null;
|
|
213
|
+
return customer && typeof customer === "object" ? customer : null;
|
|
214
|
+
}
|
|
204
215
|
/**
|
|
205
216
|
* 获取客户列表
|
|
206
217
|
* @param params 查询参数
|
|
@@ -112,6 +112,8 @@ export interface CustomerModuleAPI {
|
|
|
112
112
|
getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
113
|
/** 查询客户列表但不更新列表分页状态 */
|
|
114
114
|
queryCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
115
|
+
/** 查询单个客户详情但不修改客户列表状态 */
|
|
116
|
+
queryCustomerDetail: (id: string | number) => Promise<ShopCustomer | null>;
|
|
115
117
|
/** 设置客户列表 */
|
|
116
118
|
setCustomerList: (customers: ShopCustomer[], total?: number) => void;
|
|
117
119
|
/** 设置当前选择的客户 */
|
|
@@ -32,6 +32,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
32
32
|
customerId?: number;
|
|
33
33
|
orderId?: number;
|
|
34
34
|
}): Promise<DiscountWithReason>;
|
|
35
|
+
batchSearchByProductIds(productIds: number[]): Promise<any>;
|
|
35
36
|
filterEnabledDiscountList(discountList: Discount[]): Discount[];
|
|
36
37
|
private checkUsageCreditsLimit;
|
|
37
38
|
filterEnabledDiscountListWithReason(discountList: Discount[]): DiscountWithReason;
|
|
@@ -147,6 +147,15 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
147
147
|
const resultDiscountWithReason = this.filterEnabledDiscountListWithReason((result == null ? void 0 : result.data) || []) || [];
|
|
148
148
|
return resultDiscountWithReason;
|
|
149
149
|
}
|
|
150
|
+
async batchSearchByProductIds(productIds) {
|
|
151
|
+
const result = await this.request.get(`/machinecode/batch-search`, {
|
|
152
|
+
ids: productIds,
|
|
153
|
+
translate_flag: 1,
|
|
154
|
+
tags: ["good_pass", "product_discount_card"],
|
|
155
|
+
relation_product: 1
|
|
156
|
+
});
|
|
157
|
+
return (result == null ? void 0 : result.data) || [];
|
|
158
|
+
}
|
|
150
159
|
filterEnabledDiscountList(discountList) {
|
|
151
160
|
return discountList.filter(
|
|
152
161
|
(discount) => discount.limit_status === "enable" && new import_decimal.default((discount == null ? void 0 : discount.par_value) || 0).minus(new import_decimal.default((discount == null ? void 0 : discount.used_par_value) || 0)).greaterThan(0) && this.checkUsageCreditsLimit(discount)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
+
import { BaseModule } from '../BaseModule';
|
|
3
|
+
import { IFormInfo, IFormRecord, IFormItemData, IFetchFormInfoParams, IFetchFormRecordsParams, IAddFormRecordParams, IAppendFormRecordParams, IEnsureFormDataParams, IEnsureFormByProductParams, IRefreshAllFormRecordsParams, HolderModuleAPI, HolderFormMap } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './utils';
|
|
6
|
+
export declare class HolderModule extends BaseModule implements Module, HolderModuleAPI {
|
|
7
|
+
protected defaultName: string;
|
|
8
|
+
protected defaultVersion: string;
|
|
9
|
+
private store;
|
|
10
|
+
private request;
|
|
11
|
+
private cacheId;
|
|
12
|
+
private openCache;
|
|
13
|
+
private fatherModule;
|
|
14
|
+
private isLoading;
|
|
15
|
+
private error;
|
|
16
|
+
/** 已加载过表单数据的 form_id 缓存标记 */
|
|
17
|
+
private loadedFormIds;
|
|
18
|
+
private window;
|
|
19
|
+
constructor(name?: string, version?: string);
|
|
20
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
21
|
+
/** 统一提交 formMap,仅此处触发 store changed */
|
|
22
|
+
private commitFormMap;
|
|
23
|
+
/** 通知 UI 刷新(数据未变但需要 re-read 的场景) */
|
|
24
|
+
private notifyFormMapChanged;
|
|
25
|
+
getHolderFormMap(): HolderFormMap;
|
|
26
|
+
getHolderFormData(formId: number | string): IFormItemData | undefined;
|
|
27
|
+
setFormData(formId: number | string, data: Partial<IFormItemData>): void;
|
|
28
|
+
private ensureFormItem;
|
|
29
|
+
private hasFormData;
|
|
30
|
+
private patchFormMap;
|
|
31
|
+
fetchFormInfo(params: IFetchFormInfoParams): Promise<IFormInfo | IFormInfo[]>;
|
|
32
|
+
fetchRecords(params: IFetchFormRecordsParams): Promise<any>;
|
|
33
|
+
ensureFormData(params: IEnsureFormDataParams): Promise<IFormItemData>;
|
|
34
|
+
ensureFormByProduct(params: IEnsureFormByProductParams): Promise<IFormItemData | null>;
|
|
35
|
+
addFormRecord(params: IAddFormRecordParams): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* UI 层自行请求添加接口后,将返回记录合并到 holderMap 对应 form_id 的 records 中
|
|
38
|
+
*/
|
|
39
|
+
appendFormRecord(params: IAppendFormRecordParams): IFormRecord;
|
|
40
|
+
removeFormRecord(formId: number | string, formRecordId: number): void;
|
|
41
|
+
clearFormData(formId?: number | string): void;
|
|
42
|
+
/**
|
|
43
|
+
* 登录后按当前 holderMap 批量刷新所有表单的 records。
|
|
44
|
+
* 遍历 holderMap,从 form.form 中读取 form_id、shop_id,结合 customer_id 重新拉取记录。
|
|
45
|
+
*/
|
|
46
|
+
refreshAllFormRecords(params?: IRefreshAllFormRecordsParams): Promise<HolderFormMap>;
|
|
47
|
+
storeChange(path?: string): void;
|
|
48
|
+
}
|