@pisell/pisellos 2.3.1 → 2.3.3
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/Order/index.d.ts +9 -0
- package/dist/modules/Order/index.js +448 -371
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/Quotation/index.d.ts +16 -2
- package/dist/modules/Quotation/index.js +71 -38
- package/dist/modules/Quotation/types.d.ts +14 -0
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +7 -4
- package/dist/modules/Schedule/index.d.ts +4 -0
- package/dist/modules/Schedule/index.js +31 -1
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/server/index.js +13 -13
- package/dist/server/modules/order/index.d.ts +25 -7
- package/dist/server/modules/order/index.js +370 -309
- package/dist/server/modules/products/index.d.ts +4 -0
- package/dist/server/modules/products/index.js +76 -45
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +278 -66
- package/dist/server/modules/schedule/index.d.ts +2 -0
- package/dist/server/modules/schedule/index.js +10 -2
- package/dist/solution/BaseSales/index.d.ts +10 -1
- package/dist/solution/BaseSales/index.js +825 -528
- package/dist/solution/BaseSales/types.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +12 -1
- package/dist/solution/BaseSales/utils/quotationPrice.js +16 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/modules/Order/index.d.ts +9 -0
- package/lib/modules/Order/index.js +48 -9
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/Quotation/index.d.ts +16 -2
- package/lib/modules/Quotation/index.js +49 -13
- package/lib/modules/Quotation/types.d.ts +14 -0
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +4 -3
- package/lib/modules/Schedule/index.d.ts +4 -0
- package/lib/modules/Schedule/index.js +21 -0
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/server/index.js +1 -1
- package/lib/server/modules/order/index.d.ts +25 -7
- package/lib/server/modules/order/index.js +88 -54
- package/lib/server/modules/products/index.d.ts +4 -0
- package/lib/server/modules/products/index.js +43 -19
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +179 -1
- package/lib/server/modules/schedule/index.d.ts +2 -0
- package/lib/server/modules/schedule/index.js +8 -1
- package/lib/solution/BaseSales/index.d.ts +10 -1
- package/lib/solution/BaseSales/index.js +218 -19
- package/lib/solution/BaseSales/types.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +12 -1
- package/lib/solution/BaseSales/utils/quotationPrice.js +15 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,9 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
24
24
|
private quotationBridgeLoadedKey?;
|
|
25
25
|
private quotationBridgeRefreshPromise?;
|
|
26
26
|
private quotationBridgeRefreshKey?;
|
|
27
|
+
private quotationScheduleCache;
|
|
28
|
+
private quotationScheduleCacheSource;
|
|
29
|
+
private quotationScheduleCacheLoaded;
|
|
27
30
|
private productDataSource;
|
|
28
31
|
private pendingSyncMessages;
|
|
29
32
|
private syncTimer?;
|
|
@@ -75,6 +78,7 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
75
78
|
}): Promise<void>;
|
|
76
79
|
private ensureQuotationBridgeReady;
|
|
77
80
|
private getQuotationBridgeScopeKey;
|
|
81
|
+
private getQuotedPrice;
|
|
78
82
|
private buildPriceDataFromQuotation;
|
|
79
83
|
private buildVariantPriceData;
|
|
80
84
|
private buildBundleGroupPriceData;
|
|
@@ -77,6 +77,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
77
77
|
_defineProperty(_assertThisInitialized(_this), "quotationBridgeLoadedKey", '');
|
|
78
78
|
_defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshPromise", void 0);
|
|
79
79
|
_defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshKey", void 0);
|
|
80
|
+
_defineProperty(_assertThisInitialized(_this), "quotationScheduleCache", new Map());
|
|
81
|
+
_defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheSource", null);
|
|
82
|
+
_defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheLoaded", false);
|
|
80
83
|
// ---- 商品数据同步相关 ----
|
|
81
84
|
_defineProperty(_assertThisInitialized(_this), "productDataSource", void 0);
|
|
82
85
|
_defineProperty(_assertThisInitialized(_this), "pendingSyncMessages", []);
|
|
@@ -283,8 +286,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
283
286
|
key: "setupQuotationPriceBridge",
|
|
284
287
|
value: (function () {
|
|
285
288
|
var _setupQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
286
|
-
var _this$otherParams
|
|
287
|
-
|
|
289
|
+
var _this$otherParams,
|
|
290
|
+
_this3 = this;
|
|
291
|
+
var channel, quotation;
|
|
288
292
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
289
293
|
while (1) switch (_context3.prev = _context3.next) {
|
|
290
294
|
case 0:
|
|
@@ -308,13 +312,18 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
308
312
|
this.quotationPriceBridge = quotation;
|
|
309
313
|
case 10:
|
|
310
314
|
if (params.scheduleModule) {
|
|
311
|
-
|
|
312
|
-
|
|
315
|
+
if (this.quotationScheduleCacheSource !== params.scheduleModule) {
|
|
316
|
+
this.quotationScheduleCache.clear();
|
|
317
|
+
this.quotationScheduleCacheLoaded = false;
|
|
318
|
+
this.quotationScheduleCacheSource = params.scheduleModule;
|
|
319
|
+
}
|
|
313
320
|
this.quotationPriceBridge.setScheduleResolver(function (id) {
|
|
314
321
|
var _params$scheduleModul3, _params$scheduleModul4, _params$scheduleModul5, _params$scheduleModul6;
|
|
315
322
|
var scheduleId = String(id);
|
|
316
|
-
if (
|
|
317
|
-
|
|
323
|
+
if (_this3.quotationScheduleCache.has(scheduleId)) {
|
|
324
|
+
return _this3.quotationScheduleCache.get(scheduleId);
|
|
325
|
+
}
|
|
326
|
+
if (!_this3.quotationScheduleCacheLoaded) {
|
|
318
327
|
var _params$scheduleModul, _params$scheduleModul2;
|
|
319
328
|
var scheduleList = ((_params$scheduleModul = (_params$scheduleModul2 = params.scheduleModule).getScheduleList) === null || _params$scheduleModul === void 0 ? void 0 : _params$scheduleModul.call(_params$scheduleModul2)) || [];
|
|
320
329
|
var _iterator = _createForOfIteratorHelper(scheduleList),
|
|
@@ -322,18 +331,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
322
331
|
try {
|
|
323
332
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
324
333
|
var schedule = _step.value;
|
|
325
|
-
|
|
334
|
+
_this3.quotationScheduleCache.set(String(schedule.id), schedule);
|
|
326
335
|
}
|
|
327
336
|
} catch (err) {
|
|
328
337
|
_iterator.e(err);
|
|
329
338
|
} finally {
|
|
330
339
|
_iterator.f();
|
|
331
340
|
}
|
|
332
|
-
|
|
341
|
+
_this3.quotationScheduleCacheLoaded = true;
|
|
342
|
+
}
|
|
343
|
+
if (_this3.quotationScheduleCache.has(scheduleId)) {
|
|
344
|
+
return _this3.quotationScheduleCache.get(scheduleId);
|
|
333
345
|
}
|
|
334
|
-
if (scheduleCache.has(scheduleId)) return scheduleCache.get(scheduleId);
|
|
335
346
|
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])) || [];
|
|
336
|
-
if (schedules[0])
|
|
347
|
+
if (schedules[0]) _this3.quotationScheduleCache.set(scheduleId, schedules[0]);
|
|
337
348
|
return schedules[0];
|
|
338
349
|
});
|
|
339
350
|
}
|
|
@@ -360,7 +371,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
360
371
|
key: "refreshQuotationPriceBridge",
|
|
361
372
|
value: (function () {
|
|
362
373
|
var _refreshQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
363
|
-
var
|
|
374
|
+
var _this4 = this;
|
|
364
375
|
var refreshKey;
|
|
365
376
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
366
377
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -392,10 +403,10 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
392
403
|
this.quotationBridgeRefreshPromise = this.quotationPriceBridge.loadQuotations({
|
|
393
404
|
channel: this.quotationBridgeChannel
|
|
394
405
|
}).then(function () {
|
|
395
|
-
|
|
406
|
+
_this4.quotationBridgeLoadedKey = refreshKey;
|
|
396
407
|
}).finally(function () {
|
|
397
|
-
|
|
398
|
-
|
|
408
|
+
_this4.quotationBridgeRefreshPromise = undefined;
|
|
409
|
+
_this4.quotationBridgeRefreshKey = undefined;
|
|
399
410
|
});
|
|
400
411
|
_context4.next = 14;
|
|
401
412
|
return this.quotationBridgeRefreshPromise;
|
|
@@ -461,14 +472,34 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
461
472
|
value: function getQuotationBridgeScopeKey() {
|
|
462
473
|
return this.quotationBridgeChannel || '';
|
|
463
474
|
}
|
|
475
|
+
}, {
|
|
476
|
+
key: "getQuotedPrice",
|
|
477
|
+
value: function getQuotedPrice(params) {
|
|
478
|
+
var quotation = this.quotationPriceBridge;
|
|
479
|
+
if (!quotation) return null;
|
|
480
|
+
var query = {
|
|
481
|
+
productId: params.productId,
|
|
482
|
+
variantId: params.variantId,
|
|
483
|
+
datetime: params.datetime,
|
|
484
|
+
customer_id: params.customerId
|
|
485
|
+
};
|
|
486
|
+
if (typeof quotation.getQuotationMatchForProduct === 'function') {
|
|
487
|
+
var _quotation$getQuotati, _quotation$getQuotati2;
|
|
488
|
+
return (_quotation$getQuotati = (_quotation$getQuotati2 = quotation.getQuotationMatchForProduct(query)) === null || _quotation$getQuotati2 === void 0 ? void 0 : _quotation$getQuotati2.price) !== null && _quotation$getQuotati !== void 0 ? _quotation$getQuotati : null;
|
|
489
|
+
}
|
|
490
|
+
if (typeof quotation.getPriceForProduct === 'function') {
|
|
491
|
+
return quotation.getPriceForProduct(query);
|
|
492
|
+
}
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
464
495
|
}, {
|
|
465
496
|
key: "buildPriceDataFromQuotation",
|
|
466
497
|
value: function buildPriceDataFromQuotation(product, datetime, customerId) {
|
|
467
|
-
var
|
|
468
|
-
var quotedPrice =
|
|
498
|
+
var _ref2, _ref3;
|
|
499
|
+
var quotedPrice = this.getQuotedPrice({
|
|
469
500
|
productId: product.id,
|
|
470
501
|
datetime: datetime,
|
|
471
|
-
|
|
502
|
+
customerId: customerId
|
|
472
503
|
});
|
|
473
504
|
var productPrice = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : product.price;
|
|
474
505
|
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;
|
|
@@ -483,15 +514,15 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
483
514
|
}, {
|
|
484
515
|
key: "buildVariantPriceData",
|
|
485
516
|
value: function buildVariantPriceData(product, datetime, customerId) {
|
|
486
|
-
var
|
|
517
|
+
var _this5 = this;
|
|
487
518
|
if (!Array.isArray(product.variant)) return [];
|
|
488
519
|
return product.variant.map(function (variant) {
|
|
489
|
-
var
|
|
490
|
-
var quotedPrice =
|
|
520
|
+
var _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _variant$product_id;
|
|
521
|
+
var quotedPrice = _this5.getQuotedPrice({
|
|
491
522
|
productId: product.id,
|
|
492
523
|
variantId: Number(variant.id),
|
|
493
524
|
datetime: datetime,
|
|
494
|
-
|
|
525
|
+
customerId: customerId
|
|
495
526
|
});
|
|
496
527
|
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;
|
|
497
528
|
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;
|
|
@@ -506,20 +537,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
506
537
|
}, {
|
|
507
538
|
key: "buildBundleGroupPriceData",
|
|
508
539
|
value: function buildBundleGroupPriceData(product, datetime, customerId) {
|
|
509
|
-
var
|
|
540
|
+
var _this6 = this;
|
|
510
541
|
if (!Array.isArray(product.bundle_group)) return [];
|
|
511
542
|
return product.bundle_group.map(function (group) {
|
|
512
543
|
return {
|
|
513
544
|
id: Number(group.id),
|
|
514
545
|
bundle_item: (group.bundle_item || []).map(function (item) {
|
|
515
|
-
var
|
|
546
|
+
var _ref10, _ref11, _ref12, _item$product_id, _item$group_id;
|
|
516
547
|
var bundleProductId = Number(item.bundle_product_id);
|
|
517
548
|
var bundleVariantId = Number(item.bundle_variant_id || 0);
|
|
518
|
-
var quotedPrice =
|
|
549
|
+
var quotedPrice = _this6.getQuotedPrice({
|
|
519
550
|
productId: bundleProductId,
|
|
520
551
|
variantId: bundleVariantId,
|
|
521
552
|
datetime: datetime,
|
|
522
|
-
|
|
553
|
+
customerId: customerId
|
|
523
554
|
});
|
|
524
555
|
var price = (_ref10 = quotedPrice !== null && quotedPrice !== void 0 ? quotedPrice : item.price) !== null && _ref10 !== void 0 ? _ref10 : 0;
|
|
525
556
|
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;
|
|
@@ -1660,7 +1691,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1660
1691
|
key: "replaceProductsSnapshotInIndexDB",
|
|
1661
1692
|
value: (function () {
|
|
1662
1693
|
var _replaceProductsSnapshotInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(products, source) {
|
|
1663
|
-
var
|
|
1694
|
+
var _this7 = this;
|
|
1664
1695
|
var errorMessage;
|
|
1665
1696
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1666
1697
|
while (1) switch (_context20.prev = _context20.next) {
|
|
@@ -1679,25 +1710,25 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1679
1710
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1680
1711
|
while (1) switch (_context19.prev = _context19.next) {
|
|
1681
1712
|
case 0:
|
|
1682
|
-
|
|
1713
|
+
_this7.logInfo('replaceProductsSnapshotInIndexDB 开始', {
|
|
1683
1714
|
source: source,
|
|
1684
1715
|
productCount: products.length
|
|
1685
1716
|
});
|
|
1686
1717
|
t0 = performance.now();
|
|
1687
1718
|
_context19.next = 4;
|
|
1688
|
-
return
|
|
1719
|
+
return _this7.dbManager.clear(INDEXDB_STORE_NAME);
|
|
1689
1720
|
case 4:
|
|
1690
1721
|
if (!(products.length > 0)) {
|
|
1691
1722
|
_context19.next = 7;
|
|
1692
1723
|
break;
|
|
1693
1724
|
}
|
|
1694
1725
|
_context19.next = 7;
|
|
1695
|
-
return
|
|
1726
|
+
return _this7.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
|
|
1696
1727
|
case 7:
|
|
1697
1728
|
perfMark('replaceProductsSnapshotInIndexDB', performance.now() - t0, {
|
|
1698
1729
|
count: products.length
|
|
1699
1730
|
});
|
|
1700
|
-
|
|
1731
|
+
_this7.logInfo('replaceProductsSnapshotInIndexDB 完成', {
|
|
1701
1732
|
source: source,
|
|
1702
1733
|
productCount: products.length
|
|
1703
1734
|
});
|
|
@@ -1741,7 +1772,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1741
1772
|
key: "patchProductsInIndexDB",
|
|
1742
1773
|
value: (function () {
|
|
1743
1774
|
var _patchProductsInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(products, source) {
|
|
1744
|
-
var
|
|
1775
|
+
var _this8 = this;
|
|
1745
1776
|
var mergeActions,
|
|
1746
1777
|
validProducts,
|
|
1747
1778
|
errorMessage,
|
|
@@ -1772,22 +1803,22 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1772
1803
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1773
1804
|
while (1) switch (_context21.prev = _context21.next) {
|
|
1774
1805
|
case 0:
|
|
1775
|
-
|
|
1806
|
+
_this8.logInfo('patchProductsInIndexDB 开始', {
|
|
1776
1807
|
source: source,
|
|
1777
1808
|
count: validProducts.length
|
|
1778
1809
|
});
|
|
1779
1810
|
t0 = performance.now();
|
|
1780
|
-
if (!(typeof
|
|
1811
|
+
if (!(typeof _this8.dbManager.bulkUpdate === 'function')) {
|
|
1781
1812
|
_context21.next = 7;
|
|
1782
1813
|
break;
|
|
1783
1814
|
}
|
|
1784
1815
|
_context21.next = 5;
|
|
1785
|
-
return
|
|
1816
|
+
return _this8.dbManager.bulkUpdate(INDEXDB_STORE_NAME, validProducts);
|
|
1786
1817
|
case 5:
|
|
1787
1818
|
_context21.next = 25;
|
|
1788
1819
|
break;
|
|
1789
1820
|
case 7:
|
|
1790
|
-
if (!(typeof
|
|
1821
|
+
if (!(typeof _this8.dbManager.update === 'function')) {
|
|
1791
1822
|
_context21.next = 25;
|
|
1792
1823
|
break;
|
|
1793
1824
|
}
|
|
@@ -1801,7 +1832,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1801
1832
|
}
|
|
1802
1833
|
product = _step10.value;
|
|
1803
1834
|
_context21.next = 15;
|
|
1804
|
-
return
|
|
1835
|
+
return _this8.dbManager.update(INDEXDB_STORE_NAME, product);
|
|
1805
1836
|
case 15:
|
|
1806
1837
|
_context21.next = 11;
|
|
1807
1838
|
break;
|
|
@@ -1820,7 +1851,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1820
1851
|
perfMark('patchProductsInIndexDB', performance.now() - t0, {
|
|
1821
1852
|
count: validProducts.length
|
|
1822
1853
|
});
|
|
1823
|
-
|
|
1854
|
+
_this8.logInfo('patchProductsInIndexDB 完成', {
|
|
1824
1855
|
source: source,
|
|
1825
1856
|
count: validProducts.length
|
|
1826
1857
|
});
|
|
@@ -2018,7 +2049,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2018
2049
|
}, {
|
|
2019
2050
|
key: "setupProductSync",
|
|
2020
2051
|
value: function setupProductSync() {
|
|
2021
|
-
var
|
|
2052
|
+
var _this9 = this;
|
|
2022
2053
|
if (!this.productDataSource) {
|
|
2023
2054
|
this.logWarning('setupProductSync: ProductDataSource 不可用,跳过同步初始化');
|
|
2024
2055
|
return;
|
|
@@ -2028,20 +2059,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2028
2059
|
var data = (message === null || message === void 0 ? void 0 : message.data) || message;
|
|
2029
2060
|
if (!data) return;
|
|
2030
2061
|
console.log("[ProductsModule] \u6536\u5230\u540C\u6B65\u6D88\u606F [".concat(channelKey, "]:"), data);
|
|
2031
|
-
|
|
2062
|
+
_this9.logInfo('收到同步消息', {
|
|
2032
2063
|
channelKey: channelKey,
|
|
2033
2064
|
action: data.action,
|
|
2034
2065
|
id: data.id,
|
|
2035
2066
|
action_filed: data.action_filed
|
|
2036
2067
|
});
|
|
2037
|
-
|
|
2068
|
+
_this9.pendingSyncMessages.push(_objectSpread(_objectSpread({}, data), {}, {
|
|
2038
2069
|
_channelKey: channelKey
|
|
2039
2070
|
}));
|
|
2040
|
-
if (
|
|
2041
|
-
clearTimeout(
|
|
2071
|
+
if (_this9.syncTimer) {
|
|
2072
|
+
clearTimeout(_this9.syncTimer);
|
|
2042
2073
|
}
|
|
2043
|
-
|
|
2044
|
-
|
|
2074
|
+
_this9.syncTimer = setTimeout(function () {
|
|
2075
|
+
_this9.processProductSyncMessages();
|
|
2045
2076
|
}, PRODUCT_SYNC_DEBOUNCE_MS);
|
|
2046
2077
|
};
|
|
2047
2078
|
};
|
|
@@ -2059,7 +2090,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2059
2090
|
}
|
|
2060
2091
|
}
|
|
2061
2092
|
}).catch(function (err) {
|
|
2062
|
-
|
|
2093
|
+
_this9.logError('setupProductSync: DataSource run 出错', {
|
|
2063
2094
|
error: err instanceof Error ? err.message : String(err)
|
|
2064
2095
|
});
|
|
2065
2096
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../../types';
|
|
2
2
|
import { BaseModule } from '../../../modules/BaseModule';
|
|
3
3
|
import { QuotationData } from './types';
|
|
4
|
+
import type { ScheduleItem } from '../../../modules/Schedule/types';
|
|
5
|
+
import type { QuotationCustomerScopeInfo } from '../../../modules/Quotation/types';
|
|
4
6
|
/**
|
|
5
7
|
* 报价单模块 - 用于管理报价单数据和计算商品价格
|
|
6
8
|
*/
|
|
@@ -10,6 +12,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
10
12
|
private request;
|
|
11
13
|
private store;
|
|
12
14
|
private dbManager;
|
|
15
|
+
private scheduleResolver?;
|
|
13
16
|
constructor(name?: string, version?: string);
|
|
14
17
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
15
18
|
/**
|
|
@@ -25,10 +28,46 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
25
28
|
* 获取报价单列表
|
|
26
29
|
*/
|
|
27
30
|
getQuotationList(): QuotationData[];
|
|
31
|
+
loadQuotations(params?: {
|
|
32
|
+
channel?: string;
|
|
33
|
+
customer_id?: number | string;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
|
|
36
|
+
getPriceForProduct(params: {
|
|
37
|
+
productId: number;
|
|
38
|
+
variantId?: number;
|
|
39
|
+
datetime: string;
|
|
40
|
+
channel?: string;
|
|
41
|
+
customer_id?: number | string;
|
|
42
|
+
}): string | null;
|
|
43
|
+
getQuotationMatchForProduct(params: {
|
|
44
|
+
productId: number;
|
|
45
|
+
variantId?: number;
|
|
46
|
+
datetime: string;
|
|
47
|
+
channel?: string;
|
|
48
|
+
customer_id?: number | string;
|
|
49
|
+
}): {
|
|
50
|
+
price: string | null;
|
|
51
|
+
quotationShelfId: number;
|
|
52
|
+
} | null;
|
|
53
|
+
getQuotationShelfId(params: {
|
|
54
|
+
productId: number;
|
|
55
|
+
variantId?: number;
|
|
56
|
+
datetime: string;
|
|
57
|
+
channel?: string;
|
|
58
|
+
customer_id?: number | string;
|
|
59
|
+
}): number;
|
|
60
|
+
getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
|
|
28
61
|
/**
|
|
29
62
|
* 清空缓存
|
|
30
63
|
*/
|
|
31
64
|
clear(): Promise<void>;
|
|
65
|
+
private normalizeCustomerId;
|
|
66
|
+
private hasValidCustomerId;
|
|
67
|
+
private isQuotationVisibleForCustomer;
|
|
68
|
+
private isQuotationVisibleForChannel;
|
|
69
|
+
private isQuotationActiveAt;
|
|
70
|
+
private findProductData;
|
|
32
71
|
/**
|
|
33
72
|
* 从 IndexDB 加载报价单数据
|
|
34
73
|
* @private
|