@pisell/pisellos 2.3.53 → 2.3.55
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 +9 -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 +4 -2
- package/dist/modules/Order/index.js +66 -34
- 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 +34 -15
- 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 +907 -793
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +64 -42
- package/dist/solution/BaseSales/utils/cartPromotion.js +4 -1
- 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 +14 -2
- 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 +179 -0
- package/dist/solution/UnifiedBookingSales/index.js +1892 -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 +51 -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 +4 -2
- package/lib/modules/Order/index.js +30 -13
- 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 +48 -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 +72 -15
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +24 -8
- package/lib/solution/BaseSales/utils/cartPromotion.js +3 -0
- 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 +14 -2
- 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 +179 -0
- package/lib/solution/UnifiedBookingSales/index.js +1085 -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 {};
|
|
@@ -438,7 +438,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
438
438
|
_id: product._id,
|
|
439
439
|
parentId: product._id,
|
|
440
440
|
quantity: product.quantity,
|
|
441
|
-
num: product.num
|
|
441
|
+
num: product.num,
|
|
442
|
+
booking_id: product.booking_id
|
|
442
443
|
});
|
|
443
444
|
|
|
444
445
|
// 2. 展开 bundle 子商品
|
|
@@ -465,7 +466,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
465
466
|
origin_total: new Decimal(bundleItem.price || 0).mul(bundleItem.num || 1).toNumber(),
|
|
466
467
|
original_price: bundleItem.original_price,
|
|
467
468
|
// 继承主商品属性
|
|
468
|
-
booking_id:
|
|
469
|
+
booking_id: bundleItem.booking_id,
|
|
469
470
|
discount_list: bundleItem.discount_list || []
|
|
470
471
|
});
|
|
471
472
|
});
|
|
@@ -990,7 +991,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
990
991
|
discount_product_id: discount.product_id
|
|
991
992
|
},
|
|
992
993
|
metadata: {
|
|
993
|
-
num: num
|
|
994
|
+
num: num,
|
|
995
|
+
discount_rule_uncheck_flag: discount === null || discount === void 0 ? void 0 : discount.discount_rule_uncheck_flag
|
|
994
996
|
}
|
|
995
997
|
};
|
|
996
998
|
applicableProducts.push(productData);
|
|
@@ -1485,7 +1487,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1485
1487
|
_num: isGoodPass ? 1 : product.num,
|
|
1486
1488
|
config: _selectedDiscount === null || _selectedDiscount === void 0 ? void 0 : _selectedDiscount.config,
|
|
1487
1489
|
metadata: _objectSpread(_objectSpread({
|
|
1488
|
-
num: 1
|
|
1490
|
+
num: 1,
|
|
1491
|
+
discount_rule_uncheck_flag: _selectedDiscount === null || _selectedDiscount === void 0 ? void 0 : _selectedDiscount.discount_rule_uncheck_flag
|
|
1489
1492
|
}, productDiscountDifference !== undefined && {
|
|
1490
1493
|
product_discount_difference: productDiscountDifference
|
|
1491
1494
|
}), {}, {
|
|
@@ -1572,6 +1575,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1572
1575
|
metadata: {
|
|
1573
1576
|
// 🔥 使用拆分后的唯一 _id
|
|
1574
1577
|
custom_product_bundle_map_id: uniqueId,
|
|
1578
|
+
discount_rule_uncheck_flag: _selectedDiscount2 === null || _selectedDiscount2 === void 0 ? void 0 : _selectedDiscount2.discount_rule_uncheck_flag,
|
|
1575
1579
|
num: 1
|
|
1576
1580
|
},
|
|
1577
1581
|
_num: 1,
|
|
@@ -1603,7 +1607,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1603
1607
|
_id: "".concat(flatItem._id, "_split_rest"),
|
|
1604
1608
|
num: normalNum,
|
|
1605
1609
|
quantity: normalNum,
|
|
1606
|
-
discount_list:
|
|
1610
|
+
discount_list: _this4.filterDiscountListByType(flatItem.discount_list, 'promotion'),
|
|
1607
1611
|
processed: true
|
|
1608
1612
|
}));
|
|
1609
1613
|
}
|
|
@@ -1665,6 +1669,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1665
1669
|
metadata: _objectSpread({
|
|
1666
1670
|
// 🔥 使用唯一的 _id
|
|
1667
1671
|
custom_product_bundle_map_id: _uniqueId,
|
|
1672
|
+
discount_rule_uncheck_flag: _selectedDiscount3 === null || _selectedDiscount3 === void 0 ? void 0 : _selectedDiscount3.discount_rule_uncheck_flag,
|
|
1668
1673
|
num: product.num || 1
|
|
1669
1674
|
}, _productDiscountDifference !== undefined && {
|
|
1670
1675
|
product_discount_difference: _productDiscountDifference
|
|
@@ -1680,7 +1685,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1680
1685
|
processedItems.push(_objectSpread(_objectSpread({}, flatItem), {}, {
|
|
1681
1686
|
total: targetProductTotal,
|
|
1682
1687
|
price: new Decimal(_productOriginTotal || 0).minus(fixedAmountPerItem).toNumber(),
|
|
1683
|
-
discount_list: [_discountDetail2],
|
|
1688
|
+
discount_list: _this4.filterDiscountListByType(flatItem.discount_list, 'promotion').concat([_discountDetail2]),
|
|
1684
1689
|
processed: true
|
|
1685
1690
|
}));
|
|
1686
1691
|
}
|
|
@@ -2155,6 +2160,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2155
2160
|
}, {
|
|
2156
2161
|
key: "checkPackageSubItemUsageRules",
|
|
2157
2162
|
value: function checkPackageSubItemUsageRules(discount, flatItem) {
|
|
2163
|
+
var _flatItem$product;
|
|
2158
2164
|
var limitedData = discount.limited_relation_product_data;
|
|
2159
2165
|
var usageRules = limitedData === null || limitedData === void 0 ? void 0 : limitedData.package_sub_item_usage_rules;
|
|
2160
2166
|
var rules = ['original_price'].concat(_toConsumableArray((usageRules === null || usageRules === void 0 ? void 0 : usageRules.rules) || []));
|
|
@@ -2176,6 +2182,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2176
2182
|
filter = _ref17$filter === void 0 ? 0 : _ref17$filter;
|
|
2177
2183
|
var isMainProduct = flatItem.type === 'main'; // 单独购买
|
|
2178
2184
|
var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
|
|
2185
|
+
var bundleMainProductId = (_flatItem$product = flatItem.product) === null || _flatItem$product === void 0 ? void 0 : _flatItem$product.product_id;
|
|
2179
2186
|
|
|
2180
2187
|
// 主商品直接可用
|
|
2181
2188
|
if (isMainProduct) {
|
|
@@ -2218,13 +2225,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2218
2225
|
if (!filter) {
|
|
2219
2226
|
isScopeValid = true;
|
|
2220
2227
|
} else {
|
|
2221
|
-
isScopeValid = !exclude_bundle_product_ids.includes(Number(
|
|
2228
|
+
isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2222
2229
|
}
|
|
2223
2230
|
}
|
|
2224
2231
|
|
|
2225
2232
|
// 包含套餐判断, products值兼容旧数据
|
|
2226
2233
|
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2227
|
-
isScopeValid = include_bundle_product_ids.includes(Number(
|
|
2234
|
+
isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2228
2235
|
}
|
|
2229
2236
|
|
|
2230
2237
|
// 价格和套餐适用范围都符合,则可用
|
|
@@ -2274,16 +2281,43 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2274
2281
|
|
|
2275
2282
|
// 检查 rules
|
|
2276
2283
|
if (rules.length > 0) {
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2284
|
+
var _isOriginalPrice3 = _isOriginalPrice2 && rules.includes('original_price');
|
|
2285
|
+
var _isMarkupPrice3 = _isMarkupPrice2 && rules.includes('markup_price');
|
|
2286
|
+
// 价格是否符合规则:原价或加价
|
|
2287
|
+
var _isPriceValid = _isOriginalPrice3 || _isMarkupPrice3;
|
|
2288
|
+
// 套餐适用范围校验
|
|
2289
|
+
var _isScopeValid = false;
|
|
2290
|
+
|
|
2291
|
+
// 排除套餐判断, product_all值兼容旧数据
|
|
2292
|
+
if (scopeType === 'all_packages' || scopeType === 'product_all') {
|
|
2293
|
+
// 所有套餐可用
|
|
2294
|
+
if (!filter) {
|
|
2295
|
+
_isScopeValid = true;
|
|
2296
|
+
} else {
|
|
2297
|
+
_isScopeValid = !exclude_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2298
|
+
}
|
|
2280
2299
|
}
|
|
2281
2300
|
|
|
2282
|
-
//
|
|
2283
|
-
if (
|
|
2301
|
+
// 包含套餐判断, products值兼容旧数据
|
|
2302
|
+
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2303
|
+
_isScopeValid = include_bundle_product_ids.includes(Number(bundleMainProductId));
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
// 价格和套餐适用范围都符合,则可用
|
|
2307
|
+
if (_isPriceValid && _isScopeValid) {
|
|
2284
2308
|
return true;
|
|
2285
2309
|
}
|
|
2286
2310
|
|
|
2311
|
+
// 检查原价
|
|
2312
|
+
// if (isOriginalPrice && rules.includes('original_price')) {
|
|
2313
|
+
// return true;
|
|
2314
|
+
// }
|
|
2315
|
+
|
|
2316
|
+
// 检查加价
|
|
2317
|
+
// if (isMarkupPrice && rules.includes('markup_price')) {
|
|
2318
|
+
// return true;
|
|
2319
|
+
// }
|
|
2320
|
+
|
|
2287
2321
|
// 如果都不匹配,则不可用
|
|
2288
2322
|
return false;
|
|
2289
2323
|
}
|
|
@@ -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[];
|