@pisell/pisellos 2.3.38 → 2.3.40
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/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- 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.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- 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.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- 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 -16
- package/dist/server/index.js +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- 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 +4 -8
- package/dist/solution/BookingTicket/index.js +51 -134
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1148 -756
- 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 +1871 -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 +1176 -860
- 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 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- 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.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- 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.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- 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 -16
- package/lib/server/index.js +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- 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 +4 -8
- package/lib/solution/BookingTicket/index.js +19 -64
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -190
- 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 +1076 -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 +328 -123
- 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 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -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[];
|
|
@@ -123,21 +123,24 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
123
123
|
key: "loadAllSchedule",
|
|
124
124
|
value: (function () {
|
|
125
125
|
var _loadAllSchedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
126
|
-
var _scheduleList$data;
|
|
127
|
-
var
|
|
126
|
+
var _options$useCache, _scheduleList$data;
|
|
127
|
+
var options,
|
|
128
|
+
scheduleList,
|
|
129
|
+
_args2 = arguments;
|
|
128
130
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
129
131
|
while (1) switch (_context2.prev = _context2.next) {
|
|
130
132
|
case 0:
|
|
131
|
-
|
|
133
|
+
options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
134
|
+
_context2.next = 3;
|
|
132
135
|
return this.request.get("/schedule", {
|
|
133
136
|
num: 999
|
|
134
137
|
}, {
|
|
135
|
-
useCache: true
|
|
138
|
+
useCache: (_options$useCache = options.useCache) !== null && _options$useCache !== void 0 ? _options$useCache : true
|
|
136
139
|
});
|
|
137
|
-
case
|
|
140
|
+
case 3:
|
|
138
141
|
scheduleList = _context2.sent;
|
|
139
142
|
this.setScheduleList(((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || []);
|
|
140
|
-
case
|
|
143
|
+
case 5:
|
|
141
144
|
case "end":
|
|
142
145
|
return _context2.stop();
|
|
143
146
|
}
|
|
@@ -176,8 +179,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
176
179
|
key: "loadScheduleAvailableDate",
|
|
177
180
|
value: function () {
|
|
178
181
|
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
179
|
-
var
|
|
180
|
-
var startDate, endDate, custom_page_id, channel, dates, res;
|
|
182
|
+
var startDate, endDate, custom_page_id, channel, dates, res, responseData, dateList, otherProductIds;
|
|
181
183
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
182
184
|
while (1) switch (_context3.prev = _context3.next) {
|
|
183
185
|
case 0:
|
|
@@ -205,22 +207,25 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
205
207
|
});
|
|
206
208
|
case 8:
|
|
207
209
|
res = _context3.sent;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
+
responseData = res.data || {};
|
|
211
|
+
dateList = Array.isArray(responseData.date_list) ? responseData.date_list : [];
|
|
212
|
+
otherProductIds = Array.isArray(responseData.other_product_ids) ? responseData.other_product_ids : [];
|
|
213
|
+
this.setAvailabilityScheduleDateList(dateList);
|
|
214
|
+
this.setOtherProductsIds(otherProductIds);
|
|
210
215
|
// 如果没有schedule或者结束日期在今天之前,则所有日期均不可用
|
|
211
|
-
if (!(!
|
|
212
|
-
_context3.next =
|
|
216
|
+
if (!(!dateList.length && !otherProductIds.length || dayjs(endDate).isBefore(dayjs(), 'day'))) {
|
|
217
|
+
_context3.next = 16;
|
|
213
218
|
break;
|
|
214
219
|
}
|
|
215
220
|
return _context3.abrupt("return", dates);
|
|
216
|
-
case
|
|
217
|
-
if (
|
|
221
|
+
case 16:
|
|
222
|
+
if (otherProductIds.length) {
|
|
218
223
|
// 如果后端有返回 other_product_ids ,意味着有 duration 商品,则今天以及今天以后的日期均可用
|
|
219
224
|
dates.forEach(function (n) {
|
|
220
225
|
n.status = 'available';
|
|
221
226
|
});
|
|
222
227
|
} else {
|
|
223
|
-
|
|
228
|
+
dateList.forEach(function (n) {
|
|
224
229
|
var index = dates.findIndex(function (m) {
|
|
225
230
|
return m.date === n.date;
|
|
226
231
|
});
|
|
@@ -231,7 +236,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
231
236
|
}
|
|
232
237
|
dates = disableDatesBeforeOneDay(dates);
|
|
233
238
|
return _context3.abrupt("return", dates);
|
|
234
|
-
case
|
|
239
|
+
case 19:
|
|
235
240
|
case "end":
|
|
236
241
|
return _context3.stop();
|
|
237
242
|
}
|
|
@@ -706,25 +706,50 @@ var getBundleItemIsDiscountPrice = function getBundleItemIsDiscountPrice(item) {
|
|
|
706
706
|
var getBundleItemIsMarkupOrDiscountPrice = function getBundleItemIsMarkupOrDiscountPrice(item) {
|
|
707
707
|
return getBundleItemIsMarkupPrice(item) || getBundleItemIsDiscountPrice(item);
|
|
708
708
|
};
|
|
709
|
+
var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
710
|
+
return (discounts || []).reduce(function (total, discount) {
|
|
711
|
+
return total.add(new Decimal(discount.amount || 0));
|
|
712
|
+
}, new Decimal(0)).toNumber();
|
|
713
|
+
};
|
|
709
714
|
|
|
710
715
|
/**
|
|
711
716
|
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
712
717
|
*/
|
|
713
718
|
var getMainProductTotal = function getMainProductTotal(item) {
|
|
714
|
-
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$metadata2;
|
|
719
|
+
var _ref8, _ref9, _item$main_product_se, _item$metadata, _item$metadata2, _item$metadata3, _item$metadata4;
|
|
715
720
|
// 新语义 v2 下 `main_product_selling_price` / `metadata.main_product_selling_price`
|
|
716
721
|
// 已经是"含 option、含主商品折扣"的主价,直接作为主商品基准,无需再减折扣或加 option。
|
|
717
722
|
// 仅需叠加 markup / markdown 类 bundle(原价 bundle 的税费单独处理)。
|
|
718
723
|
var total = new Decimal((_ref8 = (_ref9 = (_item$main_product_se = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se !== void 0 ? _item$main_product_se : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.main_product_selling_price) !== null && _ref9 !== void 0 ? _ref9 : item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.main_product_original_price) !== null && _ref8 !== void 0 ? _ref8 : 0);
|
|
724
|
+
|
|
725
|
+
// 做个兜底 如果新语义价格字段都没有,则切换回老逻辑
|
|
726
|
+
var hasMainProductPrice = (item === null || item === void 0 ? void 0 : item.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.main_product_selling_price) != null || (item === null || item === void 0 || (_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.main_product_original_price) != null;
|
|
727
|
+
if (!hasMainProductPrice) {
|
|
728
|
+
var _ref10, _ref11, _item$main_product_se2, _item$metadata5, _item$_origin3, _item$_originData;
|
|
729
|
+
total = new Decimal((_ref10 = (_ref11 = (_item$main_product_se2 = item === null || item === void 0 ? void 0 : item.main_product_selling_price) !== null && _item$main_product_se2 !== void 0 ? _item$main_product_se2 : item === null || item === void 0 || (_item$metadata5 = item.metadata) === null || _item$metadata5 === void 0 ? void 0 : _item$metadata5.main_product_selling_price) !== null && _ref11 !== void 0 ? _ref11 : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
730
|
+
var discount = (item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.discount_list) || (item === null || item === void 0 || (_item$_originData = item._originData) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.product) === null || _item$_originData === void 0 || (_item$_originData = _item$_originData.discount_list) === null || _item$_originData === void 0 ? void 0 : _item$_originData.filter(function (item) {
|
|
731
|
+
var _item$metadata6;
|
|
732
|
+
return !(item !== null && item !== void 0 && (_item$metadata6 = item.metadata) !== null && _item$metadata6 !== void 0 && _item$metadata6.custom_product_bundle_map_id);
|
|
733
|
+
})) || [];
|
|
734
|
+
var mainProductDiscountAmount = getDiscountAmount(discount);
|
|
735
|
+
total = total.minus(mainProductDiscountAmount);
|
|
736
|
+
|
|
737
|
+
// 单规格
|
|
738
|
+
if (item !== null && item !== void 0 && item.option && Array.isArray(item === null || item === void 0 ? void 0 : item.option)) {
|
|
739
|
+
total = total.add(item === null || item === void 0 ? void 0 : item.option.reduce(function (t, option) {
|
|
740
|
+
return t.add(new Decimal(option.price || 0).mul(option.num || 1));
|
|
741
|
+
}, new Decimal(0)));
|
|
742
|
+
}
|
|
743
|
+
}
|
|
719
744
|
var _iterator4 = _createForOfIteratorHelper((item === null || item === void 0 ? void 0 : item.bundle) || []),
|
|
720
745
|
_step4;
|
|
721
746
|
try {
|
|
722
747
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
723
748
|
var bundleItem = _step4.value;
|
|
724
749
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
725
|
-
var
|
|
750
|
+
var _ref12, _bundleItem$bundle_se2;
|
|
726
751
|
// IMPORTANT: 套餐子商品如果应用了 discount,bundle_selling_price 和 price 其实都已经是折后价格了,不需要单独再减一次
|
|
727
|
-
var bundleItemTotal = new Decimal((
|
|
752
|
+
var bundleItemTotal = new Decimal((_ref12 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref12 !== void 0 ? _ref12 : 0);
|
|
728
753
|
total = total.add(bundleItemTotal);
|
|
729
754
|
}
|
|
730
755
|
}
|
|
@@ -844,12 +869,12 @@ var isProductMatchSurchargeCondition = function isProductMatchSurchargeCondition
|
|
|
844
869
|
* @param options.scheduleById schedule 映射表:`{ [scheduleId]: schedule }`(用于根据配置的 `available_schedule_ids` 做日程匹配)
|
|
845
870
|
* @returns 附加费列表(仅返回金额 > 0 的项)
|
|
846
871
|
*/
|
|
847
|
-
export var getSurcharge = function getSurcharge(
|
|
872
|
+
export var getSurcharge = function getSurcharge(_ref13, options) {
|
|
848
873
|
var _service$filter;
|
|
849
|
-
var service =
|
|
850
|
-
addons =
|
|
851
|
-
bookingDetail =
|
|
852
|
-
bookingId =
|
|
874
|
+
var service = _ref13.service,
|
|
875
|
+
addons = _ref13.addons,
|
|
876
|
+
bookingDetail = _ref13.bookingDetail,
|
|
877
|
+
bookingId = _ref13.bookingId;
|
|
853
878
|
var isEdit = options.isEdit,
|
|
854
879
|
isInScheduleByDate = options.isInScheduleByDate,
|
|
855
880
|
surcharge_list = options.surcharge_list,
|
|
@@ -971,11 +996,11 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
971
996
|
scheduleById: scheduleById || {},
|
|
972
997
|
isInScheduleByDate: isInScheduleByDate
|
|
973
998
|
})) {
|
|
974
|
-
var
|
|
999
|
+
var _ref14, _bundleItem$bundle_se3;
|
|
975
1000
|
var _mainQuantity = item.num || 1;
|
|
976
1001
|
matchedItems.push({
|
|
977
1002
|
isMain: false,
|
|
978
|
-
total: Number((
|
|
1003
|
+
total: Number((_ref14 = (_bundleItem$bundle_se3 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se3 !== void 0 ? _bundleItem$bundle_se3 : bundleItem.price) !== null && _ref14 !== void 0 ? _ref14 : 0),
|
|
979
1004
|
quantity: bundleItem.num || bundleItem.quantity || 1,
|
|
980
1005
|
item: bundleItem,
|
|
981
1006
|
mainQuantity: _mainQuantity // 子商品的mainQuantity是所属主商品的quantity
|
|
@@ -1191,9 +1216,9 @@ export var getSurcharge = function getSurcharge(_ref11, options) {
|
|
|
1191
1216
|
}
|
|
1192
1217
|
return surchargeWithAmount;
|
|
1193
1218
|
};
|
|
1194
|
-
function resetItemsSurchargeSideEffects(
|
|
1195
|
-
var service =
|
|
1196
|
-
addons =
|
|
1219
|
+
function resetItemsSurchargeSideEffects(_ref15) {
|
|
1220
|
+
var service = _ref15.service,
|
|
1221
|
+
addons = _ref15.addons;
|
|
1197
1222
|
var resetItem = function resetItem(item) {
|
|
1198
1223
|
if (!item) return;
|
|
1199
1224
|
item.surcharge_fee = 0;
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
|
@@ -17,4 +17,6 @@ export * from "./Schedule";
|
|
|
17
17
|
export * from "./Quotation";
|
|
18
18
|
export * from "./ScanOrderLogger";
|
|
19
19
|
export * from "./OpenData";
|
|
20
|
-
export * from "./BookingContext";
|
|
20
|
+
export * from "./BookingContext";
|
|
21
|
+
export * from "./Holder";
|
|
22
|
+
export * from "./ResourcePlanner";
|
package/dist/plugins/window.d.ts
CHANGED
package/dist/server/index.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ declare class Server {
|
|
|
49
49
|
private productQuerySubscribers;
|
|
50
50
|
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
51
|
private productQueryScheduleTimers;
|
|
52
|
+
/** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
|
|
53
|
+
private menuScheduleRefreshInFlight;
|
|
54
|
+
private lastMenuScheduleRefreshAt;
|
|
55
|
+
private readonly MENU_SCHEDULE_REFRESH_COOLDOWN_MS;
|
|
52
56
|
private orderQuerySubscribers;
|
|
53
57
|
private bookingQuerySubscribers;
|
|
54
58
|
private bookingRemoteQuerySubscribers;
|
|
@@ -57,7 +61,6 @@ declare class Server {
|
|
|
57
61
|
private readonly BOOKING_REMOTE_CACHE_MAX_ENTRIES;
|
|
58
62
|
private salesSearchSubscribers;
|
|
59
63
|
private deviceTaskActionsRegistered;
|
|
60
|
-
private localPaymentUpdateQueues;
|
|
61
64
|
private floorPlanQuerySubscribers;
|
|
62
65
|
private moduleRegistry;
|
|
63
66
|
constructor(core: PisellCore);
|
|
@@ -121,8 +124,6 @@ declare class Server {
|
|
|
121
124
|
private handleSyncSalesTask;
|
|
122
125
|
private runCheckoutSync;
|
|
123
126
|
private omitCheckoutSyncMode;
|
|
124
|
-
private buildRemoteCheckoutData;
|
|
125
|
-
private mergeCheckoutSyncPayments;
|
|
126
127
|
private persistSyncedCheckoutOrder;
|
|
127
128
|
/**
|
|
128
129
|
* 将普通层 QuotationModule 的报价单计算能力桥接到 Server Products 模块。
|
|
@@ -262,6 +263,16 @@ declare class Server {
|
|
|
262
263
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
263
264
|
*/
|
|
264
265
|
private handleProductQuery;
|
|
266
|
+
/**
|
|
267
|
+
* ProductList callers such as standalone retail pages do not always have a selected schedule.
|
|
268
|
+
* In that case query against the current local time so menu availability can still be evaluated.
|
|
269
|
+
*/
|
|
270
|
+
private resolveProductQueryScheduleContext;
|
|
271
|
+
/**
|
|
272
|
+
* OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
|
|
273
|
+
* 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
|
|
274
|
+
*/
|
|
275
|
+
private refreshMenuScheduleCacheAfterEmptyResult;
|
|
265
276
|
/**
|
|
266
277
|
* 按商品 id 查询单条(GET /shop/product/query/:productId)
|
|
267
278
|
* schedule_date 必填:query 或 data;schedule_datetime 可选。不走订阅。
|
|
@@ -456,18 +467,6 @@ declare class Server {
|
|
|
456
467
|
*/
|
|
457
468
|
private handleUpdateLocalOrder;
|
|
458
469
|
private handleOrderSalesCheckout;
|
|
459
|
-
private handleOrderSalesDraft;
|
|
460
|
-
private createLocalPaymentOperationId;
|
|
461
|
-
private buildLocalPaymentOrderLogContext;
|
|
462
|
-
private isValidLocalPaymentDecimal;
|
|
463
|
-
private getInvalidLocalPaymentSurchargeFields;
|
|
464
|
-
private buildLocalPaymentSurchargeUpdate;
|
|
465
|
-
private handleGetLocalPayment;
|
|
466
|
-
private handleUpdateLocalPayment;
|
|
467
|
-
private runLocalPaymentUpdateInQueue;
|
|
468
|
-
private processLocalPaymentUpdate;
|
|
469
|
-
private processSuccessfulLocalPayment;
|
|
470
|
-
private sanitizeLocalRecoveryOrder;
|
|
471
470
|
private handleOrderCheckout;
|
|
472
471
|
private getDeviceTaskPlugin;
|
|
473
472
|
private getIdGeneratorPlugin;
|
|
@@ -495,7 +494,6 @@ declare class Server {
|
|
|
495
494
|
private syncMachinecodeRedeemStatusToLocalOrder;
|
|
496
495
|
private handleOrderCheckoutSubmit;
|
|
497
496
|
private handleSyncCheckoutSubmit;
|
|
498
|
-
private handleOrderDraftSubmit;
|
|
499
497
|
private handlePendingSyncCheckoutOrder;
|
|
500
498
|
private buildPendingSyncCheckoutOrder;
|
|
501
499
|
private shouldBuildSmallTicketData;
|