@pisell/pisellos 2.3.41 → 2.3.43
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/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 +3 -1
- package/dist/modules/Order/index.js +55 -26
- package/dist/modules/Order/types.d.ts +9 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +35 -3
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- 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 +47 -13
- 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 +14 -0
- package/dist/server/index.js +772 -657
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +64 -42
- 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 +1 -1
- package/dist/solution/BookingTicket/index.js +2 -2
- 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 +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1891 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -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/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 +3 -1
- package/lib/modules/Order/index.js +27 -11
- package/lib/modules/Order/types.d.ts +9 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +36 -5
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -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 +33 -16
- 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 +14 -0
- package/lib/server/index.js +65 -5
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +24 -8
- 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 +1 -1
- package/lib/solution/BookingTicket/index.js +10 -2
- 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 +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1084 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -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
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
export type ResourcePlannerMode = 'appointment' | 'scan_order' | 'venue_grid';
|
|
2
|
+
export type ResourcePlannerProductKind = 'normal' | 'duration' | 'session' | 'venue_slot';
|
|
3
|
+
export type ResourcePlannerResourceType = 'single' | 'multiple' | 'capacity';
|
|
4
|
+
export type ResourcePlannerStatus = 'available' | 'limited' | 'full' | 'conflict' | 'unavailable' | 'past';
|
|
5
|
+
export interface ResourcePlannerTimeRange {
|
|
6
|
+
start_at: string;
|
|
7
|
+
end_at: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ResourcePlannerEvent extends ResourcePlannerTimeRange {
|
|
10
|
+
resourceId?: number | string;
|
|
11
|
+
resource_id?: number | string;
|
|
12
|
+
pax?: number;
|
|
13
|
+
product_uid?: string;
|
|
14
|
+
source?: 'remote' | 'cart' | 'selection';
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export interface ResourcePlannerResourceRequirement {
|
|
18
|
+
formId?: number | string;
|
|
19
|
+
resourceIds?: Array<number | string>;
|
|
20
|
+
resourceType?: ResourcePlannerResourceType;
|
|
21
|
+
capacityRequired?: number;
|
|
22
|
+
required?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ResourcePlannerProduct {
|
|
25
|
+
id: number | string;
|
|
26
|
+
title?: string;
|
|
27
|
+
kind: ResourcePlannerProductKind;
|
|
28
|
+
durationMinutes?: number;
|
|
29
|
+
schedule?: ResourcePlannerTimeRange[];
|
|
30
|
+
resourceRequirements?: ResourcePlannerResourceRequirement[];
|
|
31
|
+
capacityRequired?: number;
|
|
32
|
+
quantity?: number;
|
|
33
|
+
price?: string | number | null;
|
|
34
|
+
raw?: Record<string, any>;
|
|
35
|
+
}
|
|
36
|
+
export interface ResourcePlannerResource {
|
|
37
|
+
id: number | string;
|
|
38
|
+
formId?: number | string;
|
|
39
|
+
name?: string;
|
|
40
|
+
resourceType: ResourcePlannerResourceType;
|
|
41
|
+
capacity: number;
|
|
42
|
+
times: Array<ResourcePlannerTimeRange & {
|
|
43
|
+
event_list?: ResourcePlannerEvent[];
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}>;
|
|
46
|
+
childResourceIds?: Array<number | string>;
|
|
47
|
+
raw?: Record<string, any>;
|
|
48
|
+
}
|
|
49
|
+
export interface ResourcePlannerContextInput {
|
|
50
|
+
products?: ResourcePlannerProduct[];
|
|
51
|
+
resources?: ResourcePlannerResource[];
|
|
52
|
+
externalEvents?: ResourcePlannerEvent[];
|
|
53
|
+
slotDurationMinutes?: number;
|
|
54
|
+
businessStartTime?: string;
|
|
55
|
+
businessEndTime?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface ResourcePlannerQuery {
|
|
58
|
+
mode?: ResourcePlannerMode;
|
|
59
|
+
productIds?: Array<number | string>;
|
|
60
|
+
date?: string;
|
|
61
|
+
dateRange?: {
|
|
62
|
+
start: string;
|
|
63
|
+
end: string;
|
|
64
|
+
};
|
|
65
|
+
startTime?: string;
|
|
66
|
+
endTime?: string;
|
|
67
|
+
resourceIds?: Array<number | string>;
|
|
68
|
+
serviceObjectIds?: Array<number | string>;
|
|
69
|
+
holderIds?: Array<number | string>;
|
|
70
|
+
pax?: number;
|
|
71
|
+
slotDurationMinutes?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface ResourcePlannerSelection {
|
|
74
|
+
productIds: Array<number | string>;
|
|
75
|
+
date?: string;
|
|
76
|
+
startTime?: string;
|
|
77
|
+
endTime?: string;
|
|
78
|
+
resourceIds: Array<number | string>;
|
|
79
|
+
assignments: ResourcePlannerAssignment[];
|
|
80
|
+
mode?: ResourcePlannerMode;
|
|
81
|
+
}
|
|
82
|
+
export interface ResourcePlannerSelectionPatch extends Partial<ResourcePlannerSelection> {
|
|
83
|
+
replaceAssignments?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface ResourcePlannerDemandInterval {
|
|
86
|
+
id: string;
|
|
87
|
+
productId: number | string;
|
|
88
|
+
source: Extract<ResourcePlannerProductKind, 'duration' | 'session' | 'venue_slot'>;
|
|
89
|
+
date: string;
|
|
90
|
+
start_at: string;
|
|
91
|
+
end_at: string;
|
|
92
|
+
durationMinutes: number;
|
|
93
|
+
quantity: number;
|
|
94
|
+
capacityRequired: number;
|
|
95
|
+
resourceRequirements: ResourcePlannerResourceRequirement[];
|
|
96
|
+
}
|
|
97
|
+
export interface ResourcePlannerConflict {
|
|
98
|
+
type: 'outside_resource_time' | 'remote_event_overlap' | 'cart_overlap' | 'capacity_full' | 'missing_time' | 'missing_resource' | 'missing_assignment' | 'past';
|
|
99
|
+
message: string;
|
|
100
|
+
event?: ResourcePlannerEvent;
|
|
101
|
+
resourceId?: number | string;
|
|
102
|
+
productId?: number | string;
|
|
103
|
+
}
|
|
104
|
+
export interface ResourcePlannerAvailabilityCell {
|
|
105
|
+
key: string;
|
|
106
|
+
productId: number | string;
|
|
107
|
+
resourceId?: number | string;
|
|
108
|
+
date?: string;
|
|
109
|
+
start_at: string;
|
|
110
|
+
end_at: string;
|
|
111
|
+
startTime?: string;
|
|
112
|
+
endTime?: string;
|
|
113
|
+
durationMinutes?: number;
|
|
114
|
+
cellType: 'availability_range' | 'fixed_interval' | 'unavailable';
|
|
115
|
+
status: ResourcePlannerStatus;
|
|
116
|
+
remainingCapacity?: number;
|
|
117
|
+
maxCapacity?: number;
|
|
118
|
+
reasonCodes: string[];
|
|
119
|
+
conflicts: ResourcePlannerConflict[];
|
|
120
|
+
}
|
|
121
|
+
export interface ResourcePlannerProductOption {
|
|
122
|
+
productId: number | string;
|
|
123
|
+
title?: string;
|
|
124
|
+
status: ResourcePlannerStatus;
|
|
125
|
+
reasonCodes: string[];
|
|
126
|
+
}
|
|
127
|
+
export interface ResourcePlannerResourceOption {
|
|
128
|
+
resourceId: number | string;
|
|
129
|
+
resourceName?: string;
|
|
130
|
+
resourceFormId?: number | string;
|
|
131
|
+
resourceType: ResourcePlannerResourceType;
|
|
132
|
+
status: ResourcePlannerStatus;
|
|
133
|
+
remainingCapacity?: number;
|
|
134
|
+
maxCapacity?: number;
|
|
135
|
+
reasonCodes: string[];
|
|
136
|
+
}
|
|
137
|
+
export interface ResourcePlannerDateSummary {
|
|
138
|
+
date: string;
|
|
139
|
+
status: ResourcePlannerStatus;
|
|
140
|
+
availableCount: number;
|
|
141
|
+
totalCount: number;
|
|
142
|
+
}
|
|
143
|
+
export interface ResourcePlannerTimeSlot {
|
|
144
|
+
startTime: string;
|
|
145
|
+
endTime: string;
|
|
146
|
+
status: ResourcePlannerStatus;
|
|
147
|
+
resourceId: number | string;
|
|
148
|
+
productId?: number | string;
|
|
149
|
+
remainingCapacity?: number;
|
|
150
|
+
maxCapacity?: number;
|
|
151
|
+
reasonCodes: string[];
|
|
152
|
+
}
|
|
153
|
+
export interface ResourcePlannerTimeGridRow {
|
|
154
|
+
resourceId: number | string;
|
|
155
|
+
resourceName?: string;
|
|
156
|
+
resourceFormId?: number | string;
|
|
157
|
+
slots: ResourcePlannerTimeSlot[];
|
|
158
|
+
}
|
|
159
|
+
export interface ResourcePlannerTimeGrid {
|
|
160
|
+
date?: string;
|
|
161
|
+
timeLabels: string[];
|
|
162
|
+
resources: ResourcePlannerTimeGridRow[];
|
|
163
|
+
}
|
|
164
|
+
export interface ResourcePlannerProjection {
|
|
165
|
+
query: ResourcePlannerQuery;
|
|
166
|
+
demandIntervals: ResourcePlannerDemandInterval[];
|
|
167
|
+
productOptions: ResourcePlannerProductOption[];
|
|
168
|
+
resourceOptions: ResourcePlannerResourceOption[];
|
|
169
|
+
dateSummary: ResourcePlannerDateSummary[];
|
|
170
|
+
timeGrid: ResourcePlannerTimeGrid;
|
|
171
|
+
cells: ResourcePlannerAvailabilityCell[];
|
|
172
|
+
}
|
|
173
|
+
export interface ResourcePlannerAssignment {
|
|
174
|
+
productId: number | string;
|
|
175
|
+
resourceId: number | string;
|
|
176
|
+
start_at: string;
|
|
177
|
+
end_at: string;
|
|
178
|
+
capacityRequired?: number;
|
|
179
|
+
}
|
|
180
|
+
export interface ResourcePlannerAssignableSlotResource {
|
|
181
|
+
resourceId: number | string;
|
|
182
|
+
resourceName?: string;
|
|
183
|
+
resourceFormId?: number | string;
|
|
184
|
+
resourceType?: ResourcePlannerResourceType;
|
|
185
|
+
capacityRequired?: number;
|
|
186
|
+
remainingCapacity?: number;
|
|
187
|
+
maxCapacity?: number;
|
|
188
|
+
}
|
|
189
|
+
export interface ResourcePlannerAssignableSlot {
|
|
190
|
+
key: string;
|
|
191
|
+
productId: number | string;
|
|
192
|
+
date: string;
|
|
193
|
+
start_at: string;
|
|
194
|
+
end_at: string;
|
|
195
|
+
startTime: string;
|
|
196
|
+
endTime: string;
|
|
197
|
+
durationMinutes: number;
|
|
198
|
+
status: ResourcePlannerStatus;
|
|
199
|
+
resources: ResourcePlannerAssignableSlotResource[];
|
|
200
|
+
assignments: ResourcePlannerAssignment[];
|
|
201
|
+
conflicts: ResourcePlannerConflict[];
|
|
202
|
+
}
|
|
203
|
+
export interface ResourcePlannerAssignableSlotResult {
|
|
204
|
+
projection: ResourcePlannerProjection;
|
|
205
|
+
slots: ResourcePlannerAssignableSlot[];
|
|
206
|
+
conflicts: ResourcePlannerConflict[];
|
|
207
|
+
}
|
|
208
|
+
export interface ResourcePlannerAssignmentResult {
|
|
209
|
+
assignments: ResourcePlannerAssignment[];
|
|
210
|
+
conflicts: ResourcePlannerConflict[];
|
|
211
|
+
}
|
|
212
|
+
export interface ResourcePlannerValidationResult {
|
|
213
|
+
ok: boolean;
|
|
214
|
+
conflicts: ResourcePlannerConflict[];
|
|
215
|
+
}
|
|
216
|
+
export interface ResourcePlannerSnapshot {
|
|
217
|
+
context: Required<ResourcePlannerContextInput>;
|
|
218
|
+
selection: ResourcePlannerSelection;
|
|
219
|
+
projection: ResourcePlannerProjection | null;
|
|
220
|
+
version: number;
|
|
221
|
+
}
|
|
222
|
+
export interface ResourcePlannerState {
|
|
223
|
+
context: Required<ResourcePlannerContextInput>;
|
|
224
|
+
selection: ResourcePlannerSelection;
|
|
225
|
+
projection: ResourcePlannerProjection | null;
|
|
226
|
+
version: number;
|
|
227
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -434,7 +434,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
434
434
|
_id: product._id,
|
|
435
435
|
parentId: product._id,
|
|
436
436
|
quantity: product.quantity,
|
|
437
|
-
num: product.num
|
|
437
|
+
num: product.num,
|
|
438
|
+
booking_id: product.booking_id
|
|
438
439
|
});
|
|
439
440
|
|
|
440
441
|
// 2. 展开 bundle 子商品
|
|
@@ -458,7 +459,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
458
459
|
origin_total: new Decimal(bundleItem.price || 0).mul(bundleItem.num || 1).toNumber(),
|
|
459
460
|
original_price: bundleItem.original_price,
|
|
460
461
|
// 继承主商品属性
|
|
461
|
-
booking_id:
|
|
462
|
+
booking_id: bundleItem.booking_id,
|
|
462
463
|
discount_list: bundleItem.discount_list || []
|
|
463
464
|
});
|
|
464
465
|
});
|
|
@@ -983,7 +984,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
983
984
|
discount_product_id: discount.product_id
|
|
984
985
|
},
|
|
985
986
|
metadata: {
|
|
986
|
-
num: num
|
|
987
|
+
num: num,
|
|
988
|
+
discount_rule_uncheck_flag: discount === null || discount === void 0 ? void 0 : discount.discount_rule_uncheck_flag
|
|
987
989
|
}
|
|
988
990
|
};
|
|
989
991
|
applicableProducts.push(productData);
|
|
@@ -1479,7 +1481,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1479
1481
|
_num: isGoodPass ? 1 : product.num,
|
|
1480
1482
|
config: _selectedDiscount === null || _selectedDiscount === void 0 ? void 0 : _selectedDiscount.config,
|
|
1481
1483
|
metadata: _objectSpread(_objectSpread({
|
|
1482
|
-
num: 1
|
|
1484
|
+
num: 1,
|
|
1485
|
+
discount_rule_uncheck_flag: _selectedDiscount === null || _selectedDiscount === void 0 ? void 0 : _selectedDiscount.discount_rule_uncheck_flag
|
|
1483
1486
|
}, productDiscountDifference !== undefined && {
|
|
1484
1487
|
product_discount_difference: productDiscountDifference
|
|
1485
1488
|
}), {}, {
|
|
@@ -1566,6 +1569,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1566
1569
|
metadata: {
|
|
1567
1570
|
// 🔥 使用拆分后的唯一 _id
|
|
1568
1571
|
custom_product_bundle_map_id: uniqueId,
|
|
1572
|
+
discount_rule_uncheck_flag: _selectedDiscount2 === null || _selectedDiscount2 === void 0 ? void 0 : _selectedDiscount2.discount_rule_uncheck_flag,
|
|
1569
1573
|
num: 1
|
|
1570
1574
|
},
|
|
1571
1575
|
_num: 1,
|
|
@@ -1597,7 +1601,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1597
1601
|
_id: "".concat(flatItem._id, "_split_rest"),
|
|
1598
1602
|
num: normalNum,
|
|
1599
1603
|
quantity: normalNum,
|
|
1600
|
-
discount_list:
|
|
1604
|
+
discount_list: _this3.filterDiscountListByType(flatItem.discount_list, 'promotion'),
|
|
1601
1605
|
processed: true
|
|
1602
1606
|
}));
|
|
1603
1607
|
}
|
|
@@ -1651,6 +1655,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1651
1655
|
metadata: _objectSpread({
|
|
1652
1656
|
// 🔥 使用唯一的 _id
|
|
1653
1657
|
custom_product_bundle_map_id: _uniqueId,
|
|
1658
|
+
discount_rule_uncheck_flag: _selectedDiscount3 === null || _selectedDiscount3 === void 0 ? void 0 : _selectedDiscount3.discount_rule_uncheck_flag,
|
|
1654
1659
|
num: product.num || 1
|
|
1655
1660
|
}, _productDiscountDifference !== undefined && {
|
|
1656
1661
|
product_discount_difference: _productDiscountDifference
|
|
@@ -1666,7 +1671,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1666
1671
|
processedItems.push(_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1667
1672
|
total: targetProductTotal,
|
|
1668
1673
|
price: new Decimal(_productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
|
|
1669
|
-
discount_list: [_discountDetail2],
|
|
1674
|
+
discount_list: _this3.filterDiscountListByType(flatItem.discount_list, 'promotion').concat([_discountDetail2]),
|
|
1670
1675
|
processed: true
|
|
1671
1676
|
}));
|
|
1672
1677
|
}
|
|
@@ -2141,6 +2146,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2141
2146
|
}, {
|
|
2142
2147
|
key: "checkPackageSubItemUsageRules",
|
|
2143
2148
|
value: function checkPackageSubItemUsageRules(discount, flatItem) {
|
|
2149
|
+
var _flatItem$product;
|
|
2144
2150
|
var limitedData = discount.limited_relation_product_data;
|
|
2145
2151
|
var usageRules = limitedData === null || limitedData === void 0 ? void 0 : limitedData.package_sub_item_usage_rules;
|
|
2146
2152
|
var rules = ['original_price'].concat(_toConsumableArray((usageRules === null || usageRules === void 0 ? void 0 : usageRules.rules) || []));
|
|
@@ -2162,6 +2168,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2162
2168
|
filter = _ref17$filter === void 0 ? 0 : _ref17$filter;
|
|
2163
2169
|
var isMainProduct = flatItem.type === 'main'; // 单独购买
|
|
2164
2170
|
var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
|
|
2171
|
+
var bundleMainProductId = (_flatItem$product = flatItem.product) === null || _flatItem$product === void 0 ? void 0 : _flatItem$product.product_id;
|
|
2165
2172
|
|
|
2166
2173
|
// 主商品直接可用
|
|
2167
2174
|
if (isMainProduct) {
|
|
@@ -2204,13 +2211,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2204
2211
|
if (!filter) {
|
|
2205
2212
|
isScopeValid = true;
|
|
2206
2213
|
} else {
|
|
2207
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(
|
|
2214
|
+
isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2208
2215
|
}
|
|
2209
2216
|
}
|
|
2210
2217
|
|
|
2211
2218
|
// 包含套餐判断, products值兼容旧数据
|
|
2212
2219
|
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2213
|
-
isScopeValid = include_bundle_product_ids.includes(Number(
|
|
2220
|
+
isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2214
2221
|
}
|
|
2215
2222
|
|
|
2216
2223
|
// 价格和套餐适用范围都符合,则可用
|
|
@@ -2260,16 +2267,43 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2260
2267
|
|
|
2261
2268
|
// 检查 rules
|
|
2262
2269
|
if (rules.length > 0) {
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2270
|
+
var _isOriginalPrice3 = _isOriginalPrice2 && rules.includes('original_price');
|
|
2271
|
+
var _isMarkupPrice3 = _isMarkupPrice2 && rules.includes('markup_price');
|
|
2272
|
+
// 价格是否符合规则:原价或加价
|
|
2273
|
+
var _isPriceValid = _isOriginalPrice3 || _isMarkupPrice3;
|
|
2274
|
+
// 套餐适用范围校验
|
|
2275
|
+
var _isScopeValid = false;
|
|
2276
|
+
|
|
2277
|
+
// 排除套餐判断, product_all值兼容旧数据
|
|
2278
|
+
if (scopeType === 'all_packages' || scopeType === 'product_all') {
|
|
2279
|
+
// 所有套餐可用
|
|
2280
|
+
if (!filter) {
|
|
2281
|
+
_isScopeValid = true;
|
|
2282
|
+
} else {
|
|
2283
|
+
_isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2284
|
+
}
|
|
2266
2285
|
}
|
|
2267
2286
|
|
|
2268
|
-
//
|
|
2269
|
-
if (
|
|
2287
|
+
// 包含套餐判断, products值兼容旧数据
|
|
2288
|
+
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2289
|
+
_isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
// 价格和套餐适用范围都符合,则可用
|
|
2293
|
+
if (_isPriceValid && _isScopeValid) {
|
|
2270
2294
|
return true;
|
|
2271
2295
|
}
|
|
2272
2296
|
|
|
2297
|
+
// 检查原价
|
|
2298
|
+
// if (isOriginalPrice && rules.includes('original_price')) {
|
|
2299
|
+
// return true;
|
|
2300
|
+
// }
|
|
2301
|
+
|
|
2302
|
+
// 检查加价
|
|
2303
|
+
// if (isMarkupPrice && rules.includes('markup_price')) {
|
|
2304
|
+
// return true;
|
|
2305
|
+
// }
|
|
2306
|
+
|
|
2273
2307
|
// 如果都不匹配,则不可用
|
|
2274
2308
|
return false;
|
|
2275
2309
|
}
|
|
@@ -64,21 +64,19 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
64
64
|
this.store.surchargeList = ((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList) || [];
|
|
65
65
|
this.store.summary = ((_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.summary) || createEmptySalesSummary();
|
|
66
66
|
this.surchargeListModuleName = ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.surchargeListModuleName) || 'surchargeList';
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
throw new Error('SalesSummaryModule 需要 app 插件支持');
|
|
72
|
-
case 10:
|
|
67
|
+
|
|
68
|
+
// if (!this.appPlugin) {
|
|
69
|
+
// throw new Error('SalesSummaryModule 需要 app 插件支持');
|
|
70
|
+
// }
|
|
73
71
|
if (this.request) {
|
|
74
|
-
_context.next =
|
|
72
|
+
_context.next = 10;
|
|
75
73
|
break;
|
|
76
74
|
}
|
|
77
75
|
throw new Error('SalesSummaryModule 需要 request 插件支持');
|
|
78
|
-
case
|
|
79
|
-
_context.next =
|
|
76
|
+
case 10:
|
|
77
|
+
_context.next = 12;
|
|
80
78
|
return this.getSurchargeList();
|
|
81
|
-
case
|
|
79
|
+
case 12:
|
|
82
80
|
case "end":
|
|
83
81
|
return _context.stop();
|
|
84
82
|
}
|
|
@@ -192,10 +190,11 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
192
190
|
}, {
|
|
193
191
|
key: "getAppData",
|
|
194
192
|
value: function getAppData(key) {
|
|
195
|
-
var _this$appPlugin$getDa, _this$
|
|
196
|
-
var getData = (_this$appPlugin
|
|
193
|
+
var _this$appPlugin, _this$appPlugin$getDa, _this$appPlugin2, _this$appPlugin2$getA, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
|
|
194
|
+
var getData = (_this$appPlugin = this.appPlugin) === null || _this$appPlugin === void 0 || (_this$appPlugin$getDa = _this$appPlugin.getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
197
195
|
if (typeof getData === 'function') return getData(key);
|
|
198
|
-
var app = this.appPlugin.getApp();
|
|
196
|
+
var app = (_this$appPlugin2 = this.appPlugin) === null || _this$appPlugin2 === void 0 || (_this$appPlugin2$getA = _this$appPlugin2.getApp) === null || _this$appPlugin2$getA === void 0 ? void 0 : _this$appPlugin2$getA.call(_this$appPlugin2);
|
|
197
|
+
if (!app) return undefined;
|
|
199
198
|
var coreData = app === null || app === void 0 || (_app$models = app.models) === null || _app$models === void 0 || (_app$models$getStore = _app$models.getStore) === null || _app$models$getStore === void 0 || (_app$models$getStore$ = (_app$models$getStore$2 = _app$models$getStore.call(_app$models)).getDataByModel) === null || _app$models$getStore$ === void 0 ? void 0 : _app$models$getStore$.call(_app$models$getStore$2, 'core', 'core');
|
|
200
199
|
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
201
200
|
}
|
|
@@ -11,10 +11,12 @@ export declare class ScanOrderLoggerModule extends BaseModule implements Module,
|
|
|
11
11
|
protected defaultName: string;
|
|
12
12
|
protected defaultVersion: string;
|
|
13
13
|
private store;
|
|
14
|
+
private window?;
|
|
14
15
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
15
16
|
setContext(context: ScanOrderLoggerContext): void;
|
|
16
17
|
setProvider(provider: ScanOrderLoggerProviderType): void;
|
|
17
18
|
setProviderConfig(providerConfig: ScanOrderLoggerProviderConfig): void;
|
|
19
|
+
private getCurrentHost;
|
|
18
20
|
private buildRecord;
|
|
19
21
|
addLog(params: ScanOrderLogInput): Promise<void>;
|
|
20
22
|
}
|
|
@@ -46,6 +46,7 @@ export var ScanOrderLoggerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
46
46
|
_defineProperty(_assertThisInitialized(_this), "defaultName", 'scanOrderLogger');
|
|
47
47
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
48
48
|
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
49
50
|
return _this;
|
|
50
51
|
}
|
|
51
52
|
_createClass(ScanOrderLoggerModule, [{
|
|
@@ -64,6 +65,7 @@ export var ScanOrderLoggerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
64
65
|
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
65
66
|
this.core = core;
|
|
66
67
|
this.store = options.store;
|
|
68
|
+
this.window = core.getPlugin('window') || undefined;
|
|
67
69
|
provider = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.provider) || 'feishu';
|
|
68
70
|
providerConfig = ((_options$otherParams2 = options.otherParams) === null || _options$otherParams2 === void 0 ? void 0 : _options$otherParams2.providerConfig) || {};
|
|
69
71
|
context = ((_options$otherParams3 = options.otherParams) === null || _options$otherParams3 === void 0 ? void 0 : _options$otherParams3.context) || {};
|
|
@@ -73,7 +75,7 @@ export var ScanOrderLoggerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
73
75
|
grafana: _objectSpread(_objectSpread({}, defaultProviderConfig.grafana), providerConfig.grafana || {})
|
|
74
76
|
});
|
|
75
77
|
this.store.context = context;
|
|
76
|
-
case
|
|
78
|
+
case 10:
|
|
77
79
|
case "end":
|
|
78
80
|
return _context.stop();
|
|
79
81
|
}
|
|
@@ -102,16 +104,27 @@ export var ScanOrderLoggerModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
102
104
|
grafana: _objectSpread(_objectSpread({}, this.store.providerConfig.grafana || {}), providerConfig.grafana || {})
|
|
103
105
|
});
|
|
104
106
|
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "getCurrentHost",
|
|
109
|
+
value: function getCurrentHost() {
|
|
110
|
+
var _this$window;
|
|
111
|
+
var host = (_this$window = this.window) === null || _this$window === void 0 || (_this$window = _this$window.location) === null || _this$window === void 0 ? void 0 : _this$window.host;
|
|
112
|
+
if (typeof host === 'string' && host.length > 0) return host;
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
105
115
|
}, {
|
|
106
116
|
key: "buildRecord",
|
|
107
117
|
value: function buildRecord(params) {
|
|
118
|
+
var host = this.getCurrentHost();
|
|
108
119
|
return {
|
|
109
120
|
level: params.level || 'info',
|
|
110
121
|
title: params.title,
|
|
111
122
|
timestamp: params.timestamp || dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
112
123
|
payload: params.payload || {},
|
|
113
124
|
extra: params.extra || {},
|
|
114
|
-
context: this.store.context || {}
|
|
125
|
+
context: _objectSpread(_objectSpread({}, this.store.context || {}), host ? {
|
|
126
|
+
host: host
|
|
127
|
+
} : {})
|
|
115
128
|
};
|
|
116
129
|
}
|
|
117
130
|
}, {
|
|
@@ -142,62 +142,80 @@ function _flushQueue() {
|
|
|
142
142
|
export var feishuLoggerProvider = {
|
|
143
143
|
send: function send(payload) {
|
|
144
144
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
145
|
-
var _payload$providerConf, _payload$providerConf2, _payload$providerConf3;
|
|
146
|
-
var webhook, throttleMs;
|
|
145
|
+
var _payload$providerConf, _payload$providerConf2, _payload$providerConf3, _payload$providerConf4;
|
|
146
|
+
var webhook, errorHook, throttleMs;
|
|
147
147
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
148
148
|
while (1) switch (_context.prev = _context.next) {
|
|
149
149
|
case 0:
|
|
150
150
|
cachedProviderConfig = payload.providerConfig;
|
|
151
151
|
webhook = (_payload$providerConf = payload.providerConfig) === null || _payload$providerConf === void 0 || (_payload$providerConf = _payload$providerConf.feishu) === null || _payload$providerConf === void 0 ? void 0 : _payload$providerConf.webhook;
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
errorHook = (_payload$providerConf2 = payload.providerConfig) === null || _payload$providerConf2 === void 0 || (_payload$providerConf2 = _payload$providerConf2.feishu) === null || _payload$providerConf2 === void 0 ? void 0 : _payload$providerConf2.errorHook;
|
|
153
|
+
if (!(typeof fetch !== 'function')) {
|
|
154
|
+
_context.next = 6;
|
|
154
155
|
break;
|
|
155
156
|
}
|
|
156
|
-
console.warn('[ScanOrderLogger] Feishu
|
|
157
|
+
console.warn('[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报');
|
|
157
158
|
return _context.abrupt("return");
|
|
158
|
-
case
|
|
159
|
-
if (isWebhookUsable(
|
|
160
|
-
_context.next =
|
|
159
|
+
case 6:
|
|
160
|
+
if (!(payload.record.level === 'error' && isWebhookUsable(errorHook))) {
|
|
161
|
+
_context.next = 16;
|
|
161
162
|
break;
|
|
162
163
|
}
|
|
164
|
+
_context.prev = 7;
|
|
165
|
+
_context.next = 10;
|
|
166
|
+
return postToFeishu(errorHook, buildFeishuBody([payload.record]));
|
|
167
|
+
case 10:
|
|
168
|
+
_context.next = 15;
|
|
169
|
+
break;
|
|
170
|
+
case 12:
|
|
171
|
+
_context.prev = 12;
|
|
172
|
+
_context.t0 = _context["catch"](7);
|
|
173
|
+
console.warn('[ScanOrderLogger] Feishu errorHook 上报失败', _context.t0);
|
|
174
|
+
case 15:
|
|
163
175
|
return _context.abrupt("return");
|
|
164
|
-
case
|
|
165
|
-
if (
|
|
166
|
-
_context.next =
|
|
176
|
+
case 16:
|
|
177
|
+
if (webhook) {
|
|
178
|
+
_context.next = 19;
|
|
167
179
|
break;
|
|
168
180
|
}
|
|
169
|
-
console.warn('[ScanOrderLogger]
|
|
181
|
+
console.warn('[ScanOrderLogger] Feishu webhook 未配置,跳过日志上报');
|
|
170
182
|
return _context.abrupt("return");
|
|
171
|
-
case
|
|
172
|
-
|
|
173
|
-
if (!(throttleMs <= 0)) {
|
|
183
|
+
case 19:
|
|
184
|
+
if (isWebhookUsable(webhook)) {
|
|
174
185
|
_context.next = 21;
|
|
175
186
|
break;
|
|
176
187
|
}
|
|
177
|
-
_context.
|
|
178
|
-
|
|
188
|
+
return _context.abrupt("return");
|
|
189
|
+
case 21:
|
|
190
|
+
throttleMs = (_payload$providerConf3 = (_payload$providerConf4 = payload.providerConfig) === null || _payload$providerConf4 === void 0 || (_payload$providerConf4 = _payload$providerConf4.feishu) === null || _payload$providerConf4 === void 0 ? void 0 : _payload$providerConf4.throttleMs) !== null && _payload$providerConf3 !== void 0 ? _payload$providerConf3 : DEFAULT_THROTTLE_MS;
|
|
191
|
+
if (!(throttleMs <= 0)) {
|
|
192
|
+
_context.next = 32;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
_context.prev = 23;
|
|
196
|
+
_context.next = 26;
|
|
179
197
|
return postToFeishu(webhook, buildFeishuBody([payload.record]));
|
|
180
|
-
case
|
|
181
|
-
_context.next =
|
|
198
|
+
case 26:
|
|
199
|
+
_context.next = 31;
|
|
182
200
|
break;
|
|
183
|
-
case
|
|
184
|
-
_context.prev =
|
|
185
|
-
_context.
|
|
186
|
-
console.warn('[ScanOrderLogger] Feishu 日志上报失败', _context.
|
|
187
|
-
case
|
|
201
|
+
case 28:
|
|
202
|
+
_context.prev = 28;
|
|
203
|
+
_context.t1 = _context["catch"](23);
|
|
204
|
+
console.warn('[ScanOrderLogger] Feishu 日志上报失败', _context.t1);
|
|
205
|
+
case 31:
|
|
188
206
|
return _context.abrupt("return");
|
|
189
|
-
case
|
|
207
|
+
case 32:
|
|
190
208
|
pendingQueue.push(payload.record);
|
|
191
209
|
if (!flushTimer) {
|
|
192
210
|
flushTimer = setTimeout(function () {
|
|
193
211
|
void flushQueue();
|
|
194
212
|
}, throttleMs);
|
|
195
213
|
}
|
|
196
|
-
case
|
|
214
|
+
case 34:
|
|
197
215
|
case "end":
|
|
198
216
|
return _context.stop();
|
|
199
217
|
}
|
|
200
|
-
}, _callee, null, [[12,
|
|
218
|
+
}, _callee, null, [[7, 12], [23, 28]]);
|
|
201
219
|
}))();
|
|
202
220
|
}
|
|
203
221
|
};
|
|
@@ -2,6 +2,7 @@ export type ScanOrderLogLevel = 'info' | 'warning' | 'error' | 'debug';
|
|
|
2
2
|
export type ScanOrderLoggerProviderType = 'feishu' | 'grafana';
|
|
3
3
|
export interface ScanOrderLoggerProviderFeishuConfig {
|
|
4
4
|
webhook?: string;
|
|
5
|
+
errorHook?: string;
|
|
5
6
|
/**
|
|
6
7
|
* 节流窗口毫秒数,默认 3000ms
|
|
7
8
|
* - >0:首条日志进入队列并启动定时器,窗口结束后合并成一条 Feishu post 统一发送
|
|
@@ -24,7 +24,9 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
24
24
|
*
|
|
25
25
|
* @memberof ScheduleModule
|
|
26
26
|
*/
|
|
27
|
-
loadAllSchedule(
|
|
27
|
+
loadAllSchedule(options?: {
|
|
28
|
+
useCache?: boolean;
|
|
29
|
+
}): Promise<void>;
|
|
28
30
|
setScheduleList(list: ScheduleItem[]): void;
|
|
29
31
|
private syncScheduleMap;
|
|
30
32
|
getScheduleList(): ScheduleItem[];
|