@pisell/pisellos 2.2.171 → 2.2.173
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/BookingContext/index.d.ts +37 -0
- package/dist/modules/BookingContext/index.js +436 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +193 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +215 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Customer/index.d.ts +6 -0
- package/dist/modules/Customer/index.js +129 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -4
- package/dist/modules/Discount/index.js +8 -93
- package/dist/modules/Discount/types.d.ts +1 -7
- package/dist/modules/Order/index.d.ts +33 -17
- package/dist/modules/Order/index.js +757 -395
- package/dist/modules/Order/types.d.ts +58 -17
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +212 -0
- package/dist/modules/Order/utils.d.ts +39 -1
- package/dist/modules/Order/utils.js +219 -31
- package/dist/modules/Quotation/index.js +16 -5
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +26 -10
- package/dist/modules/SalesSummary/index.js +4 -2
- package/dist/modules/Schedule/index.js +6 -2
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/server/index.js +10 -6
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/server/modules/products/index.js +113 -94
- package/dist/server/modules/schedule/index.js +13 -6
- package/dist/solution/BaseSales/index.d.ts +53 -7
- package/dist/solution/BaseSales/index.js +1160 -339
- package/dist/solution/BaseSales/types.d.ts +67 -1
- package/dist/solution/BaseSales/types.js +3 -1
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +65 -15
- package/dist/solution/BaseSales/utils.js +46 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +134 -2
- package/dist/solution/BookingTicket/index.js +776 -175
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/BookingTicket/types.js +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +231 -128
- package/dist/solution/ScanOrder/utils.js +46 -8
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +18 -23
- package/dist/solution/VenueBooking/index.d.ts +5 -9
- package/dist/solution/VenueBooking/index.js +103 -55
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/BookingContext/index.d.ts +37 -0
- package/lib/modules/BookingContext/index.js +297 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +207 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +198 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Customer/index.d.ts +6 -0
- package/lib/modules/Customer/index.js +26 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -4
- package/lib/modules/Discount/index.js +8 -63
- package/lib/modules/Discount/types.d.ts +1 -7
- package/lib/modules/Order/index.d.ts +33 -17
- package/lib/modules/Order/index.js +402 -148
- package/lib/modules/Order/types.d.ts +58 -17
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils.d.ts +39 -1
- package/lib/modules/Order/utils.js +197 -22
- package/lib/modules/Quotation/index.js +17 -6
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +22 -14
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/Schedule/index.js +3 -1
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/server/index.js +2 -0
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/server/modules/products/index.js +23 -12
- package/lib/server/modules/schedule/index.js +2 -1
- package/lib/solution/BaseSales/index.d.ts +53 -7
- package/lib/solution/BaseSales/index.js +527 -20
- package/lib/solution/BaseSales/types.d.ts +67 -1
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +70 -11
- package/lib/solution/BaseSales/utils.js +46 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +134 -2
- package/lib/solution/BookingTicket/index.js +349 -8
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/BookingTicket/types.js +6 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +147 -66
- package/lib/solution/ScanOrder/utils.js +46 -6
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +2 -4
- package/lib/solution/VenueBooking/index.d.ts +5 -9
- package/lib/solution/VenueBooking/index.js +50 -14
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/package.json +2 -2
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
+
/** 从订单 payments 提取支付方式 code,与 UI 筛选选项及 filterBookings 一致 */
|
|
3
|
+
function getOrderPaymentCodes(order) {
|
|
4
|
+
var payments = order.payments;
|
|
5
|
+
if (!Array.isArray(payments) || payments.length === 0) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
return payments.map(function (item) {
|
|
9
|
+
return item === null || item === void 0 ? void 0 : item.code;
|
|
10
|
+
}).filter(function (code) {
|
|
11
|
+
return typeof code === 'string' && code.length > 0;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
2
15
|
/**
|
|
3
16
|
* 订单过滤函数
|
|
4
17
|
* @param orders 原始订单列表
|
|
@@ -126,22 +139,23 @@ export function filterOrders(orders, filters) {
|
|
|
126
139
|
}
|
|
127
140
|
}
|
|
128
141
|
|
|
129
|
-
// payment_methods -
|
|
142
|
+
// payment_methods - 支付方式(按 payments[].code 匹配,不再使用 order.payment_methods)
|
|
130
143
|
if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
|
|
131
|
-
|
|
144
|
+
var orderPaymentCodes = getOrderPaymentCodes(order);
|
|
145
|
+
if (orderPaymentCodes.length === 0) {
|
|
132
146
|
rejected.push({
|
|
133
147
|
order_id: order.order_id,
|
|
134
148
|
order_number: order.order_number,
|
|
135
149
|
reason: {
|
|
136
150
|
field: 'payment_methods',
|
|
137
|
-
actual: order.
|
|
151
|
+
actual: order.payments,
|
|
138
152
|
expected: safeFilters.payment_methods
|
|
139
153
|
}
|
|
140
154
|
});
|
|
141
155
|
return false;
|
|
142
156
|
}
|
|
143
|
-
var hasMatch =
|
|
144
|
-
return safeFilters.payment_methods.includes(
|
|
157
|
+
var hasMatch = orderPaymentCodes.some(function (code) {
|
|
158
|
+
return safeFilters.payment_methods.includes(code);
|
|
145
159
|
});
|
|
146
160
|
if (!hasMatch) {
|
|
147
161
|
rejected.push({
|
|
@@ -149,7 +163,7 @@ export function filterOrders(orders, filters) {
|
|
|
149
163
|
order_number: order.order_number,
|
|
150
164
|
reason: {
|
|
151
165
|
field: 'payment_methods',
|
|
152
|
-
actual:
|
|
166
|
+
actual: orderPaymentCodes,
|
|
153
167
|
expected: safeFilters.payment_methods
|
|
154
168
|
}
|
|
155
169
|
});
|
|
@@ -277,7 +277,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
277
277
|
value: (function () {
|
|
278
278
|
var _setupQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
279
279
|
var _this$otherParams;
|
|
280
|
-
var channel, quotation,
|
|
280
|
+
var channel, quotation, scheduleCache, hasLoadedScheduleList;
|
|
281
281
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
282
282
|
while (1) switch (_context3.prev = _context3.next) {
|
|
283
283
|
case 0:
|
|
@@ -301,14 +301,32 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
301
301
|
this.quotationPriceBridge = quotation;
|
|
302
302
|
case 10:
|
|
303
303
|
if (params.scheduleModule) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
return [schedule.id, schedule];
|
|
307
|
-
}));
|
|
304
|
+
scheduleCache = new Map();
|
|
305
|
+
hasLoadedScheduleList = false;
|
|
308
306
|
this.quotationPriceBridge.setScheduleResolver(function (id) {
|
|
309
|
-
var _params$scheduleModul3, _params$scheduleModul4;
|
|
310
|
-
|
|
311
|
-
|
|
307
|
+
var _params$scheduleModul3, _params$scheduleModul4, _params$scheduleModul5, _params$scheduleModul6;
|
|
308
|
+
var scheduleId = String(id);
|
|
309
|
+
if (scheduleCache.has(scheduleId)) return scheduleCache.get(scheduleId);
|
|
310
|
+
if (!hasLoadedScheduleList) {
|
|
311
|
+
var _params$scheduleModul, _params$scheduleModul2;
|
|
312
|
+
var scheduleList = ((_params$scheduleModul = (_params$scheduleModul2 = params.scheduleModule).getScheduleList) === null || _params$scheduleModul === void 0 ? void 0 : _params$scheduleModul.call(_params$scheduleModul2)) || [];
|
|
313
|
+
var _iterator = _createForOfIteratorHelper(scheduleList),
|
|
314
|
+
_step;
|
|
315
|
+
try {
|
|
316
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
317
|
+
var schedule = _step.value;
|
|
318
|
+
scheduleCache.set(String(schedule.id), schedule);
|
|
319
|
+
}
|
|
320
|
+
} catch (err) {
|
|
321
|
+
_iterator.e(err);
|
|
322
|
+
} finally {
|
|
323
|
+
_iterator.f();
|
|
324
|
+
}
|
|
325
|
+
hasLoadedScheduleList = true;
|
|
326
|
+
}
|
|
327
|
+
if (scheduleCache.has(scheduleId)) return scheduleCache.get(scheduleId);
|
|
328
|
+
var schedules = ((_params$scheduleModul3 = (_params$scheduleModul4 = params.scheduleModule).getScheduleListByIds) === null || _params$scheduleModul3 === void 0 ? void 0 : _params$scheduleModul3.call(_params$scheduleModul4, [id])) || ((_params$scheduleModul5 = (_params$scheduleModul6 = params.scheduleModule).getScheduleByIds) === null || _params$scheduleModul5 === void 0 ? void 0 : _params$scheduleModul5.call(_params$scheduleModul6, [id])) || [];
|
|
329
|
+
if (schedules[0]) scheduleCache.set(scheduleId, schedules[0]);
|
|
312
330
|
return schedules[0];
|
|
313
331
|
});
|
|
314
332
|
}
|
|
@@ -441,17 +459,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
441
459
|
}, {
|
|
442
460
|
key: "buildPriceDataFromQuotation",
|
|
443
461
|
value: function buildPriceDataFromQuotation(product, datetime, customerId) {
|
|
444
|
-
var _this$quotationPriceB, _ref2,
|
|
462
|
+
var _this$quotationPriceB, _ref2, _ref3;
|
|
445
463
|
var quotedPrice = (_this$quotationPriceB = this.quotationPriceBridge) === null || _this$quotationPriceB === void 0 ? void 0 : _this$quotationPriceB.getPriceForProduct({
|
|
446
464
|
productId: product.id,
|
|
447
465
|
datetime: datetime,
|
|
448
466
|
customer_id: customerId
|
|
449
467
|
});
|
|
450
468
|
var productPrice = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.price;
|
|
469
|
+
var productBasePrice = (_ref2 = (_ref3 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.base_price) !== null && _ref3 !== void 0 ? _ref3 : product.price) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
451
470
|
return {
|
|
452
471
|
id: product.id,
|
|
453
472
|
price: String(productPrice !== null && productPrice !== void 0 ? productPrice : 0),
|
|
454
|
-
base_price: String(
|
|
473
|
+
base_price: String(productBasePrice),
|
|
455
474
|
variant: this.buildVariantPriceData(product, datetime, customerId),
|
|
456
475
|
bundle_group: this.buildBundleGroupPriceData(product, datetime, customerId)
|
|
457
476
|
};
|
|
@@ -462,15 +481,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
462
481
|
var _this4 = this;
|
|
463
482
|
if (!Array.isArray(product.variant)) return [];
|
|
464
483
|
return product.variant.map(function (variant) {
|
|
465
|
-
var _this4$quotationPrice,
|
|
484
|
+
var _this4$quotationPrice, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _variant$product_id;
|
|
466
485
|
var quotedPrice = (_this4$quotationPrice = _this4.quotationPriceBridge) === null || _this4$quotationPrice === void 0 ? void 0 : _this4$quotationPrice.getPriceForProduct({
|
|
467
486
|
productId: product.id,
|
|
468
487
|
variantId: Number(variant.id),
|
|
469
488
|
datetime: datetime,
|
|
470
489
|
customer_id: customerId
|
|
471
490
|
});
|
|
472
|
-
var price = (
|
|
473
|
-
var basePrice = (
|
|
491
|
+
var price = (_ref4 = (_ref5 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.price) !== null && _ref5 !== void 0 ? _ref5 : product.price) !== null && _ref4 !== void 0 ? _ref4 : 0;
|
|
492
|
+
var basePrice = (_ref6 = (_ref7 = (_ref8 = (_ref9 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : variant.base_price) !== null && _ref9 !== void 0 ? _ref9 : variant.price) !== null && _ref8 !== void 0 ? _ref8 : product.base_price) !== null && _ref7 !== void 0 ? _ref7 : product.price) !== null && _ref6 !== void 0 ? _ref6 : 0;
|
|
474
493
|
return {
|
|
475
494
|
id: Number(variant.id),
|
|
476
495
|
product_id: Number((_variant$product_id = variant.product_id) !== null && _variant$product_id !== void 0 ? _variant$product_id : product.id),
|
|
@@ -488,7 +507,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
488
507
|
return {
|
|
489
508
|
id: Number(group.id),
|
|
490
509
|
bundle_item: (group.bundle_item || []).map(function (item) {
|
|
491
|
-
var _this5$quotationPrice,
|
|
510
|
+
var _this5$quotationPrice, _ref10, _ref11, _ref12, _item$product_id, _item$group_id;
|
|
492
511
|
var bundleProductId = Number(item.bundle_product_id);
|
|
493
512
|
var bundleVariantId = Number(item.bundle_variant_id || 0);
|
|
494
513
|
var quotedPrice = (_this5$quotationPrice = _this5.quotationPriceBridge) === null || _this5$quotationPrice === void 0 ? void 0 : _this5$quotationPrice.getPriceForProduct({
|
|
@@ -497,8 +516,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
497
516
|
datetime: datetime,
|
|
498
517
|
customer_id: customerId
|
|
499
518
|
});
|
|
500
|
-
var price = (
|
|
501
|
-
var basePrice = (
|
|
519
|
+
var price = (_ref10 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0;
|
|
520
|
+
var basePrice = (_ref11 = (_ref12 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.base_price) !== null && _ref12 !== void 0 ? _ref12 : item.price) !== null && _ref11 !== void 0 ? _ref11 : 0;
|
|
502
521
|
return {
|
|
503
522
|
id: Number(item.id),
|
|
504
523
|
product_id: Number((_item$product_id = item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : product.id),
|
|
@@ -531,7 +550,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
531
550
|
value: (function () {
|
|
532
551
|
var _getProductsWithPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(schedule_date, extraContext, options) {
|
|
533
552
|
var _options$changedIds;
|
|
534
|
-
var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache,
|
|
553
|
+
var t0, scopedProductIds, cacheKey, scopedProductIdSet, changedIds, cachedProducts, updatedProducts, updatedMap, mergedCache, _iterator2, _step2, p, _iterator3, _step3, _p, errorMessage, result;
|
|
535
554
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
536
555
|
while (1) switch (_context6.prev = _context6.next) {
|
|
537
556
|
case 0:
|
|
@@ -572,10 +591,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
572
591
|
return [p.id, p];
|
|
573
592
|
}));
|
|
574
593
|
mergedCache = [];
|
|
575
|
-
|
|
594
|
+
_iterator2 = _createForOfIteratorHelper(cachedProducts);
|
|
576
595
|
try {
|
|
577
|
-
for (
|
|
578
|
-
p =
|
|
596
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
597
|
+
p = _step2.value;
|
|
579
598
|
if (updatedMap.has(p.id)) {
|
|
580
599
|
mergedCache.push(updatedMap.get(p.id));
|
|
581
600
|
updatedMap.delete(p.id);
|
|
@@ -585,20 +604,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
585
604
|
}
|
|
586
605
|
// 剩余的是新增商品(create 场景)
|
|
587
606
|
} catch (err) {
|
|
588
|
-
|
|
607
|
+
_iterator2.e(err);
|
|
589
608
|
} finally {
|
|
590
|
-
|
|
609
|
+
_iterator2.f();
|
|
591
610
|
}
|
|
592
|
-
|
|
611
|
+
_iterator3 = _createForOfIteratorHelper(updatedMap.values());
|
|
593
612
|
try {
|
|
594
|
-
for (
|
|
595
|
-
_p =
|
|
613
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
614
|
+
_p = _step3.value;
|
|
596
615
|
mergedCache.push(_p);
|
|
597
616
|
}
|
|
598
617
|
} catch (err) {
|
|
599
|
-
|
|
618
|
+
_iterator3.e(err);
|
|
600
619
|
} finally {
|
|
601
|
-
|
|
620
|
+
_iterator3.f();
|
|
602
621
|
}
|
|
603
622
|
this.productsPriceCache.set(cacheKey, mergedCache);
|
|
604
623
|
this.logInfo('增量更新完成', {
|
|
@@ -833,25 +852,25 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
833
852
|
}
|
|
834
853
|
if (productIds.length === 0 && collectionIds.length === 0) return [];
|
|
835
854
|
var result = new Set();
|
|
836
|
-
var
|
|
837
|
-
|
|
855
|
+
var _iterator4 = _createForOfIteratorHelper(productIds),
|
|
856
|
+
_step4;
|
|
838
857
|
try {
|
|
839
|
-
for (
|
|
840
|
-
var id =
|
|
858
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
859
|
+
var id = _step4.value;
|
|
841
860
|
if (this.store.map.has(id)) result.add(id);
|
|
842
861
|
}
|
|
843
862
|
} catch (err) {
|
|
844
|
-
|
|
863
|
+
_iterator4.e(err);
|
|
845
864
|
} finally {
|
|
846
|
-
|
|
865
|
+
_iterator4.f();
|
|
847
866
|
}
|
|
848
867
|
if (collectionIds.length === 0) return Array.from(result);
|
|
849
868
|
var collectionIdSet = new Set(collectionIds);
|
|
850
|
-
var
|
|
851
|
-
|
|
869
|
+
var _iterator5 = _createForOfIteratorHelper(this.getProductsRef()),
|
|
870
|
+
_step5;
|
|
852
871
|
try {
|
|
853
|
-
for (
|
|
854
|
-
var product =
|
|
872
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
873
|
+
var product = _step5.value;
|
|
855
874
|
if (result.has(product.id)) continue;
|
|
856
875
|
if (!Array.isArray(product.collection)) continue;
|
|
857
876
|
var isInCollection = product.collection.some(function (collection) {
|
|
@@ -860,9 +879,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
860
879
|
if (isInCollection) result.add(product.id);
|
|
861
880
|
}
|
|
862
881
|
} catch (err) {
|
|
863
|
-
|
|
882
|
+
_iterator5.e(err);
|
|
864
883
|
} finally {
|
|
865
|
-
|
|
884
|
+
_iterator5.f();
|
|
866
885
|
}
|
|
867
886
|
return Array.from(result);
|
|
868
887
|
}
|
|
@@ -1141,11 +1160,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1141
1160
|
key: "fetchProductsByHttp",
|
|
1142
1161
|
value: (function () {
|
|
1143
1162
|
var _fetchProductsByHttp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
1144
|
-
var
|
|
1163
|
+
var _ref13, _ref13$category_ids, category_ids, _ref13$product_ids, product_ids, _ref13$collection, collection, customer_id, cacheId, startTime, _this$otherParams3, _productsData$data, productsData, productList, duration, _duration2, errorMessage;
|
|
1145
1164
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1146
1165
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1147
1166
|
case 0:
|
|
1148
|
-
|
|
1167
|
+
_ref13 = params || {}, _ref13$category_ids = _ref13.category_ids, category_ids = _ref13$category_ids === void 0 ? [] : _ref13$category_ids, _ref13$product_ids = _ref13.product_ids, product_ids = _ref13$product_ids === void 0 ? [] : _ref13$product_ids, _ref13$collection = _ref13.collection, collection = _ref13$collection === void 0 ? [] : _ref13$collection, customer_id = _ref13.customer_id, cacheId = _ref13.cacheId;
|
|
1149
1168
|
this.logInfo('fetchProductsByHttp: 开始请求', {
|
|
1150
1169
|
categoryIdsCount: category_ids.length,
|
|
1151
1170
|
productIdsCount: product_ids.length,
|
|
@@ -1293,18 +1312,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1293
1312
|
key: "getProductsRefByIds",
|
|
1294
1313
|
value: function getProductsRefByIds(ids) {
|
|
1295
1314
|
var products = [];
|
|
1296
|
-
var
|
|
1297
|
-
|
|
1315
|
+
var _iterator6 = _createForOfIteratorHelper(ids),
|
|
1316
|
+
_step6;
|
|
1298
1317
|
try {
|
|
1299
|
-
for (
|
|
1300
|
-
var id =
|
|
1318
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
1319
|
+
var id = _step6.value;
|
|
1301
1320
|
var product = this.store.map.get(id);
|
|
1302
1321
|
if (product) products.push(product);
|
|
1303
1322
|
}
|
|
1304
1323
|
} catch (err) {
|
|
1305
|
-
|
|
1324
|
+
_iterator6.e(err);
|
|
1306
1325
|
} finally {
|
|
1307
|
-
|
|
1326
|
+
_iterator6.f();
|
|
1308
1327
|
}
|
|
1309
1328
|
return products;
|
|
1310
1329
|
}
|
|
@@ -1343,7 +1362,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1343
1362
|
key: "removeProductsByIds",
|
|
1344
1363
|
value: (function () {
|
|
1345
1364
|
var _removeProductsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(ids) {
|
|
1346
|
-
var idSet,
|
|
1365
|
+
var idSet, _iterator7, _step7, _id, _iterator8, _step8, id, errorMessage, _iterator9, _step9, _step9$value, dateKey, cachedProducts;
|
|
1347
1366
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1348
1367
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1349
1368
|
case 0:
|
|
@@ -1355,31 +1374,31 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1355
1374
|
this.store.list = this.store.list.filter(function (p) {
|
|
1356
1375
|
return !idSet.has(p.id);
|
|
1357
1376
|
});
|
|
1358
|
-
|
|
1377
|
+
_iterator7 = _createForOfIteratorHelper(ids);
|
|
1359
1378
|
try {
|
|
1360
|
-
for (
|
|
1361
|
-
_id =
|
|
1379
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
1380
|
+
_id = _step7.value;
|
|
1362
1381
|
this.store.map.delete(_id);
|
|
1363
1382
|
}
|
|
1364
1383
|
} catch (err) {
|
|
1365
|
-
|
|
1384
|
+
_iterator7.e(err);
|
|
1366
1385
|
} finally {
|
|
1367
|
-
|
|
1386
|
+
_iterator7.f();
|
|
1368
1387
|
}
|
|
1369
1388
|
if (!this.dbManager) {
|
|
1370
1389
|
_context14.next = 30;
|
|
1371
1390
|
break;
|
|
1372
1391
|
}
|
|
1373
1392
|
_context14.prev = 6;
|
|
1374
|
-
|
|
1393
|
+
_iterator8 = _createForOfIteratorHelper(ids);
|
|
1375
1394
|
_context14.prev = 8;
|
|
1376
|
-
|
|
1395
|
+
_iterator8.s();
|
|
1377
1396
|
case 10:
|
|
1378
|
-
if ((
|
|
1397
|
+
if ((_step8 = _iterator8.n()).done) {
|
|
1379
1398
|
_context14.next = 16;
|
|
1380
1399
|
break;
|
|
1381
1400
|
}
|
|
1382
|
-
id =
|
|
1401
|
+
id = _step8.value;
|
|
1383
1402
|
_context14.next = 14;
|
|
1384
1403
|
return this.dbManager.delete(INDEXDB_STORE_NAME, id);
|
|
1385
1404
|
case 14:
|
|
@@ -1391,10 +1410,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1391
1410
|
case 18:
|
|
1392
1411
|
_context14.prev = 18;
|
|
1393
1412
|
_context14.t0 = _context14["catch"](8);
|
|
1394
|
-
|
|
1413
|
+
_iterator8.e(_context14.t0);
|
|
1395
1414
|
case 21:
|
|
1396
1415
|
_context14.prev = 21;
|
|
1397
|
-
|
|
1416
|
+
_iterator8.f();
|
|
1398
1417
|
return _context14.finish(21);
|
|
1399
1418
|
case 24:
|
|
1400
1419
|
_context14.next = 30;
|
|
@@ -1408,18 +1427,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1408
1427
|
error: errorMessage
|
|
1409
1428
|
});
|
|
1410
1429
|
case 30:
|
|
1411
|
-
|
|
1430
|
+
_iterator9 = _createForOfIteratorHelper(this.productsPriceCache.entries());
|
|
1412
1431
|
try {
|
|
1413
|
-
for (
|
|
1414
|
-
|
|
1432
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
1433
|
+
_step9$value = _slicedToArray(_step9.value, 2), dateKey = _step9$value[0], cachedProducts = _step9$value[1];
|
|
1415
1434
|
this.productsPriceCache.set(dateKey, cachedProducts.filter(function (p) {
|
|
1416
1435
|
return !idSet.has(p.id);
|
|
1417
1436
|
}));
|
|
1418
1437
|
}
|
|
1419
1438
|
} catch (err) {
|
|
1420
|
-
|
|
1439
|
+
_iterator9.e(err);
|
|
1421
1440
|
} finally {
|
|
1422
|
-
|
|
1441
|
+
_iterator9.f();
|
|
1423
1442
|
}
|
|
1424
1443
|
this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
|
|
1425
1444
|
this.logInfo('removeProductsByIds 完成', {
|
|
@@ -1659,17 +1678,17 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1659
1678
|
value: function syncProductsMap() {
|
|
1660
1679
|
var t0 = performance.now();
|
|
1661
1680
|
this.store.map.clear();
|
|
1662
|
-
var
|
|
1663
|
-
|
|
1681
|
+
var _iterator10 = _createForOfIteratorHelper(this.store.list),
|
|
1682
|
+
_step10;
|
|
1664
1683
|
try {
|
|
1665
|
-
for (
|
|
1666
|
-
var product =
|
|
1684
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
1685
|
+
var product = _step10.value;
|
|
1667
1686
|
this.store.map.set(product.id, product);
|
|
1668
1687
|
}
|
|
1669
1688
|
} catch (err) {
|
|
1670
|
-
|
|
1689
|
+
_iterator10.e(err);
|
|
1671
1690
|
} finally {
|
|
1672
|
-
|
|
1691
|
+
_iterator10.f();
|
|
1673
1692
|
}
|
|
1674
1693
|
perfMark('syncProductsMap', performance.now() - t0, {
|
|
1675
1694
|
count: this.store.map.size
|
|
@@ -1881,7 +1900,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1881
1900
|
key: "processProductSyncMessages",
|
|
1882
1901
|
value: (function () {
|
|
1883
1902
|
var _processProductSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1884
|
-
var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache,
|
|
1903
|
+
var messages, deleteIds, bodyUpdates, sseRefreshIds, priceRefreshIds, shouldClearPriceCache, _iterator11, _step11, msg, channelKey, _msg$relation_product, _msg$change_types, _msg$ids2, _msg$ids, ids, bodyId, _bodyId, _msg$relation_product2, _msg$relation_product3, uniqueDeleteIds, uniqueSSEIds, uniquePriceIds, freshProducts, allChangedIds, hasChanges, errorMessage;
|
|
1885
1904
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1886
1905
|
while (1) switch (_context20.prev = _context20.next) {
|
|
1887
1906
|
case 0:
|
|
@@ -1901,15 +1920,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1901
1920
|
sseRefreshIds = [];
|
|
1902
1921
|
priceRefreshIds = [];
|
|
1903
1922
|
shouldClearPriceCache = false;
|
|
1904
|
-
|
|
1923
|
+
_iterator11 = _createForOfIteratorHelper(messages);
|
|
1905
1924
|
_context20.prev = 11;
|
|
1906
|
-
|
|
1925
|
+
_iterator11.s();
|
|
1907
1926
|
case 13:
|
|
1908
|
-
if ((
|
|
1927
|
+
if ((_step11 = _iterator11.n()).done) {
|
|
1909
1928
|
_context20.next = 36;
|
|
1910
1929
|
break;
|
|
1911
1930
|
}
|
|
1912
|
-
msg =
|
|
1931
|
+
msg = _step11.value;
|
|
1913
1932
|
channelKey = msg._channelKey || msg.module || 'product';
|
|
1914
1933
|
if (!(channelKey === 'product')) {
|
|
1915
1934
|
_context20.next = 33;
|
|
@@ -1975,10 +1994,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1975
1994
|
case 38:
|
|
1976
1995
|
_context20.prev = 38;
|
|
1977
1996
|
_context20.t0 = _context20["catch"](11);
|
|
1978
|
-
|
|
1997
|
+
_iterator11.e(_context20.t0);
|
|
1979
1998
|
case 41:
|
|
1980
1999
|
_context20.prev = 41;
|
|
1981
|
-
|
|
2000
|
+
_iterator11.f();
|
|
1982
2001
|
return _context20.finish(41);
|
|
1983
2002
|
case 44:
|
|
1984
2003
|
uniqueDeleteIds = _toConsumableArray(new Set(deleteIds));
|
|
@@ -2149,7 +2168,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2149
2168
|
key: "applyBodyUpdatesToStore",
|
|
2150
2169
|
value: (function () {
|
|
2151
2170
|
var _applyBodyUpdatesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(bodyUpdates) {
|
|
2152
|
-
var updatedCount, newCount, appliedIds,
|
|
2171
|
+
var updatedCount, newCount, appliedIds, _iterator12, _step12, _step12$value, id, body;
|
|
2153
2172
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2154
2173
|
while (1) switch (_context22.prev = _context22.next) {
|
|
2155
2174
|
case 0:
|
|
@@ -2167,19 +2186,19 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2167
2186
|
}
|
|
2168
2187
|
return p;
|
|
2169
2188
|
});
|
|
2170
|
-
|
|
2189
|
+
_iterator12 = _createForOfIteratorHelper(bodyUpdates);
|
|
2171
2190
|
try {
|
|
2172
|
-
for (
|
|
2173
|
-
|
|
2191
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
2192
|
+
_step12$value = _slicedToArray(_step12.value, 2), id = _step12$value[0], body = _step12$value[1];
|
|
2174
2193
|
if (!appliedIds.has(id)) {
|
|
2175
2194
|
this.store.list.push(body);
|
|
2176
2195
|
newCount++;
|
|
2177
2196
|
}
|
|
2178
2197
|
}
|
|
2179
2198
|
} catch (err) {
|
|
2180
|
-
|
|
2199
|
+
_iterator12.e(err);
|
|
2181
2200
|
} finally {
|
|
2182
|
-
|
|
2201
|
+
_iterator12.f();
|
|
2183
2202
|
}
|
|
2184
2203
|
this.syncProductsMap();
|
|
2185
2204
|
_context22.next = 10;
|
|
@@ -2212,21 +2231,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2212
2231
|
key: "mergeProductsToStore",
|
|
2213
2232
|
value: (function () {
|
|
2214
2233
|
var _mergeProductsToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(freshProducts) {
|
|
2215
|
-
var freshMap,
|
|
2234
|
+
var freshMap, _iterator13, _step13, p, updatedList, newCount, _iterator14, _step14, _p2, updatedCount;
|
|
2216
2235
|
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2217
2236
|
while (1) switch (_context23.prev = _context23.next) {
|
|
2218
2237
|
case 0:
|
|
2219
2238
|
freshMap = new Map();
|
|
2220
|
-
|
|
2239
|
+
_iterator13 = _createForOfIteratorHelper(freshProducts);
|
|
2221
2240
|
try {
|
|
2222
|
-
for (
|
|
2223
|
-
p =
|
|
2241
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
2242
|
+
p = _step13.value;
|
|
2224
2243
|
freshMap.set(p.id, p);
|
|
2225
2244
|
}
|
|
2226
2245
|
} catch (err) {
|
|
2227
|
-
|
|
2246
|
+
_iterator13.e(err);
|
|
2228
2247
|
} finally {
|
|
2229
|
-
|
|
2248
|
+
_iterator13.f();
|
|
2230
2249
|
}
|
|
2231
2250
|
updatedList = this.store.list.map(function (p) {
|
|
2232
2251
|
if (freshMap.has(p.id)) {
|
|
@@ -2237,16 +2256,16 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2237
2256
|
return p;
|
|
2238
2257
|
}); // freshMap 中剩余的是新商品(create 场景)
|
|
2239
2258
|
newCount = freshMap.size;
|
|
2240
|
-
|
|
2259
|
+
_iterator14 = _createForOfIteratorHelper(freshMap.values());
|
|
2241
2260
|
try {
|
|
2242
|
-
for (
|
|
2243
|
-
_p2 =
|
|
2261
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
2262
|
+
_p2 = _step14.value;
|
|
2244
2263
|
updatedList.push(_p2);
|
|
2245
2264
|
}
|
|
2246
2265
|
} catch (err) {
|
|
2247
|
-
|
|
2266
|
+
_iterator14.e(err);
|
|
2248
2267
|
} finally {
|
|
2249
|
-
|
|
2268
|
+
_iterator14.f();
|
|
2250
2269
|
}
|
|
2251
2270
|
updatedCount = freshProducts.length - newCount;
|
|
2252
2271
|
this.store.list = updatedList;
|
|
@@ -257,6 +257,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
257
257
|
}, {
|
|
258
258
|
key: "getScheduleByIds",
|
|
259
259
|
value: function getScheduleByIds(ids) {
|
|
260
|
+
var _this2 = this;
|
|
260
261
|
if (!ids || ids.length === 0) {
|
|
261
262
|
this.logInfo('getScheduleByIds: 未提供有效的 ids', {
|
|
262
263
|
idsCount: 0
|
|
@@ -264,15 +265,21 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
264
265
|
return [];
|
|
265
266
|
}
|
|
266
267
|
var result = [];
|
|
268
|
+
var scheduleList = this.store.scheduleList || [];
|
|
267
269
|
var _iterator = _createForOfIteratorHelper(ids),
|
|
268
270
|
_step;
|
|
269
271
|
try {
|
|
270
|
-
|
|
272
|
+
var _loop = function _loop() {
|
|
271
273
|
var id = _step.value;
|
|
272
|
-
var schedule =
|
|
274
|
+
var schedule = _this2.store.map.get(id) || scheduleList.find(function (item) {
|
|
275
|
+
return String(item.id) === String(id);
|
|
276
|
+
});
|
|
273
277
|
if (schedule) {
|
|
274
278
|
result.push(schedule);
|
|
275
279
|
}
|
|
280
|
+
};
|
|
281
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
282
|
+
_loop();
|
|
276
283
|
}
|
|
277
284
|
} catch (err) {
|
|
278
285
|
_iterator.e(err);
|
|
@@ -371,11 +378,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
371
378
|
}, {
|
|
372
379
|
key: "getDateIsInSchedule",
|
|
373
380
|
value: function getDateIsInSchedule(date, scheduleList) {
|
|
374
|
-
var
|
|
381
|
+
var _this3 = this;
|
|
375
382
|
var scheduleListData = [];
|
|
376
383
|
scheduleList.forEach(function (item) {
|
|
377
384
|
if (typeof item === 'number') {
|
|
378
|
-
scheduleListData.push.apply(scheduleListData, _toConsumableArray(
|
|
385
|
+
scheduleListData.push.apply(scheduleListData, _toConsumableArray(_this3.getScheduleByIds([item])));
|
|
379
386
|
} else {
|
|
380
387
|
scheduleListData.push(item);
|
|
381
388
|
}
|
|
@@ -446,7 +453,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
446
453
|
key: "saveScheduleToIndexDB",
|
|
447
454
|
value: (function () {
|
|
448
455
|
var _saveScheduleToIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(scheduleList) {
|
|
449
|
-
var
|
|
456
|
+
var _this4 = this;
|
|
450
457
|
var savePromises, errorMessage;
|
|
451
458
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
452
459
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -467,7 +474,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
|
|
|
467
474
|
case 7:
|
|
468
475
|
// 逐个保存日程(每个日程是独立的记录)
|
|
469
476
|
savePromises = scheduleList.map(function (schedule) {
|
|
470
|
-
return
|
|
477
|
+
return _this4.dbManager.add(INDEXDB_STORE_NAME, schedule);
|
|
471
478
|
});
|
|
472
479
|
_context5.next = 10;
|
|
473
480
|
return Promise.all(savePromises);
|