@pisell/pisellos 2.2.175 → 2.2.177
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/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 +86 -17
- package/dist/modules/Order/index.js +1303 -497
- package/dist/modules/Order/types.d.ts +198 -18
- package/dist/modules/Order/types.js +31 -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 +50 -1
- package/dist/modules/Order/utils.js +261 -31
- package/dist/modules/Quotation/index.d.ts +0 -1
- package/dist/modules/Quotation/index.js +23 -21
- 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/SalesSummary/utils.js +18 -5
- 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 +87 -29
- package/dist/server/modules/order/index.d.ts +23 -0
- package/dist/server/modules/order/index.js +123 -46
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/server/modules/products/index.d.ts +1 -1
- package/dist/server/modules/products/index.js +130 -113
- package/dist/server/modules/schedule/index.js +13 -6
- package/dist/solution/BaseSales/index.d.ts +89 -7
- package/dist/solution/BaseSales/index.js +1484 -365
- package/dist/solution/BaseSales/types.d.ts +67 -1
- package/dist/solution/BaseSales/types.js +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1258 -0
- 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 +68 -16
- package/dist/solution/BaseSales/utils.js +46 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +133 -1
- package/dist/solution/BookingTicket/index.js +780 -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/BookingTicket/utils/cartView.js +4 -2
- 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 +0 -49
- 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 +86 -17
- package/lib/modules/Order/index.js +633 -146
- package/lib/modules/Order/types.d.ts +198 -18
- package/lib/modules/Order/types.js +1 -0
- 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 +50 -1
- package/lib/modules/Order/utils.js +229 -21
- package/lib/modules/Quotation/index.d.ts +0 -1
- package/lib/modules/Quotation/index.js +18 -15
- 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/SalesSummary/utils.js +18 -5
- 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 +41 -4
- package/lib/server/modules/order/index.d.ts +23 -0
- package/lib/server/modules/order/index.js +46 -14
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/server/modules/products/index.d.ts +1 -1
- package/lib/server/modules/products/index.js +30 -20
- package/lib/server/modules/schedule/index.js +2 -1
- package/lib/solution/BaseSales/index.d.ts +89 -7
- package/lib/solution/BaseSales/index.js +736 -22
- package/lib/solution/BaseSales/types.d.ts +67 -1
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +836 -0
- 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 +71 -12
- package/lib/solution/BaseSales/utils.js +46 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +133 -1
- package/lib/solution/BookingTicket/index.js +352 -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/BookingTicket/utils/cartView.js +4 -2
- 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
|
@@ -280,6 +280,7 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
|
|
|
280
280
|
isChargeTax: (_product$is_charge_ta2 = product.is_charge_tax) !== null && _product$is_charge_ta2 !== void 0 ? _product$is_charge_ta2 : 0
|
|
281
281
|
});
|
|
282
282
|
var mainTaxRounded = mainTaxPrecise.toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
|
|
283
|
+
product.main_product_attached_bundle_tax_fee = mainTaxRounded.toFixed(2);
|
|
283
284
|
if (mainTaxPrecise.gt(0)) {
|
|
284
285
|
lastTaxableItem = {
|
|
285
286
|
type: 'main',
|
|
@@ -444,8 +445,20 @@ export function calculateSalesSummary(params) {
|
|
|
444
445
|
isEdit: false
|
|
445
446
|
}) || 0);
|
|
446
447
|
for (var i = 0; i < products.length; i++) {
|
|
447
|
-
var
|
|
448
|
-
|
|
448
|
+
var sourceItem = surchargeServiceItems[i] || {};
|
|
449
|
+
var product = products[i];
|
|
450
|
+
product.surcharge_fee = sourceItem.surcharge_fee || 0;
|
|
451
|
+
var relationSurchargeIds = Array.isArray(sourceItem.relation_surcharge_ids) ? sourceItem.relation_surcharge_ids : [];
|
|
452
|
+
var hasSurcharge = new Decimal(product.surcharge_fee || 0).gt(0) || relationSurchargeIds.length > 0;
|
|
453
|
+
if (hasSurcharge) {
|
|
454
|
+
product.main_product_attached_bundle_surcharge_fee = toFixed2(product.surcharge_fee);
|
|
455
|
+
}
|
|
456
|
+
if (relationSurchargeIds.length > 0) {
|
|
457
|
+
product.relation_surcharge_ids = sourceItem.relation_surcharge_ids;
|
|
458
|
+
}
|
|
459
|
+
if (hasSurcharge && sourceItem.surcharge_rounding_remainder !== undefined) {
|
|
460
|
+
product.surcharge_rounding_remainder = sourceItem.surcharge_rounding_remainder;
|
|
461
|
+
}
|
|
449
462
|
}
|
|
450
463
|
var hasTaxRate = taxRate !== undefined && taxRate !== null && taxRate > 0;
|
|
451
464
|
var productTaxFee;
|
|
@@ -458,8 +471,8 @@ export function calculateSalesSummary(params) {
|
|
|
458
471
|
}, new Decimal(0));
|
|
459
472
|
}
|
|
460
473
|
var shopDiscountAmount = Decimal.max(new Decimal(Number(shopDiscount) || 0), 0);
|
|
461
|
-
var
|
|
462
|
-
var totalAmount = isPriceIncludeTax === 1 ?
|
|
474
|
+
var preTaxExpectAmount = Decimal.max(0, productAmount.plus(surchargeAmount).minus(shopDiscountAmount));
|
|
475
|
+
var totalAmount = isPriceIncludeTax === 1 ? preTaxExpectAmount : preTaxExpectAmount.plus(productTaxFee);
|
|
463
476
|
var deposit = calculateProductsDeposit(products);
|
|
464
477
|
return {
|
|
465
478
|
product_quantity: productQuantity,
|
|
@@ -475,7 +488,7 @@ export function calculateSalesSummary(params) {
|
|
|
475
488
|
discount_amount: toFixed2(Decimal.max(productOriginalAmount.minus(productAmount), 0).plus(shopDiscountAmount)),
|
|
476
489
|
deposit_amount: deposit ? deposit.total : '0.00',
|
|
477
490
|
deposit: deposit,
|
|
478
|
-
expect_amount: toFixed2(
|
|
491
|
+
expect_amount: toFixed2(totalAmount),
|
|
479
492
|
total_amount: toFixed2(totalAmount),
|
|
480
493
|
total_refund_amount: '0.00',
|
|
481
494
|
customer_paid_amount: '0.00',
|
|
@@ -205,9 +205,13 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
205
205
|
}, {
|
|
206
206
|
key: "getScheduleListByIds",
|
|
207
207
|
value: function getScheduleListByIds(ids) {
|
|
208
|
-
|
|
209
|
-
return
|
|
208
|
+
var idSet = new Set(ids.map(function (id) {
|
|
209
|
+
return String(id);
|
|
210
|
+
}));
|
|
211
|
+
var list = this.store.scheduleList.filter(function (n) {
|
|
212
|
+
return idSet.has(String(n.id));
|
|
210
213
|
});
|
|
214
|
+
return list;
|
|
211
215
|
}
|
|
212
216
|
}, {
|
|
213
217
|
key: "setAvailabilityScheduleDateList",
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -168,16 +168,17 @@ var Server = /*#__PURE__*/function () {
|
|
|
168
168
|
*/
|
|
169
169
|
_defineProperty(this, "handleProductQuery", /*#__PURE__*/function () {
|
|
170
170
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
171
|
-
var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, _ref3, callback, subscriberId;
|
|
171
|
+
var url, method, data, config, menu_list_ids, schedule_datetime, schedule_date, customer_id, ids, _ref3, callback, subscriberId;
|
|
172
172
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
173
173
|
while (1) switch (_context.prev = _context.next) {
|
|
174
174
|
case 0:
|
|
175
175
|
url = _ref.url, method = _ref.method, data = _ref.data, config = _ref.config;
|
|
176
176
|
console.log('[Server] handleProductQuery:', url, method, data, config);
|
|
177
|
-
menu_list_ids = data.menu_list_ids, schedule_datetime = data.schedule_datetime, schedule_date = data.schedule_date, customer_id = data.customer_id;
|
|
177
|
+
menu_list_ids = data.menu_list_ids, schedule_datetime = data.schedule_datetime, schedule_date = data.schedule_date, customer_id = data.customer_id, ids = data.ids;
|
|
178
178
|
_ref3 = config || {}, callback = _ref3.callback, subscriberId = _ref3.subscriberId;
|
|
179
179
|
_this.logInfo('handleProductQuery: 开始处理商品查询请求', {
|
|
180
180
|
menu_list_ids: menu_list_ids,
|
|
181
|
+
ids: ids,
|
|
181
182
|
schedule_datetime: schedule_datetime,
|
|
182
183
|
schedule_date: schedule_date,
|
|
183
184
|
customer_id: customer_id
|
|
@@ -189,6 +190,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
189
190
|
callback: callback,
|
|
190
191
|
context: {
|
|
191
192
|
menu_list_ids: menu_list_ids,
|
|
193
|
+
ids: ids,
|
|
192
194
|
schedule_date: schedule_date,
|
|
193
195
|
schedule_datetime: schedule_datetime,
|
|
194
196
|
customer_id: customer_id
|
|
@@ -201,6 +203,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
201
203
|
}
|
|
202
204
|
return _context.abrupt("return", _this.computeProductQueryResult({
|
|
203
205
|
menu_list_ids: menu_list_ids,
|
|
206
|
+
ids: ids,
|
|
204
207
|
schedule_date: schedule_date,
|
|
205
208
|
schedule_datetime: schedule_datetime,
|
|
206
209
|
customer_id: customer_id
|
|
@@ -1608,26 +1611,30 @@ var Server = /*#__PURE__*/function () {
|
|
|
1608
1611
|
case 6:
|
|
1609
1612
|
_context18.prev = 6;
|
|
1610
1613
|
_context18.next = 9;
|
|
1614
|
+
return this.schedule.loadAllSchedule();
|
|
1615
|
+
case 9:
|
|
1616
|
+
this.products.clearPriceCache();
|
|
1617
|
+
_context18.next = 12;
|
|
1611
1618
|
return this.products.setupQuotationPriceBridge({
|
|
1612
1619
|
scheduleModule: this.schedule,
|
|
1613
1620
|
channel: (_this$core$context = this.core.context) === null || _this$core$context === void 0 ? void 0 : _this$core$context.channel
|
|
1614
1621
|
});
|
|
1615
|
-
case
|
|
1622
|
+
case 12:
|
|
1616
1623
|
this.logInfo('Products 报价单价格桥接初始化完成');
|
|
1617
|
-
_context18.next =
|
|
1624
|
+
_context18.next = 19;
|
|
1618
1625
|
break;
|
|
1619
|
-
case
|
|
1620
|
-
_context18.prev =
|
|
1626
|
+
case 15:
|
|
1627
|
+
_context18.prev = 15;
|
|
1621
1628
|
_context18.t0 = _context18["catch"](6);
|
|
1622
1629
|
errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
|
|
1623
1630
|
this.logError('Products 报价单价格桥接初始化失败', {
|
|
1624
1631
|
error: errorMessage
|
|
1625
1632
|
});
|
|
1626
|
-
case
|
|
1633
|
+
case 19:
|
|
1627
1634
|
case "end":
|
|
1628
1635
|
return _context18.stop();
|
|
1629
1636
|
}
|
|
1630
|
-
}, _callee18, this, [[6,
|
|
1637
|
+
}, _callee18, this, [[6, 15]]);
|
|
1631
1638
|
}));
|
|
1632
1639
|
function setupProductsQuotationPriceBridge() {
|
|
1633
1640
|
return _setupProductsQuotationPriceBridge.apply(this, arguments);
|
|
@@ -3303,14 +3310,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
3303
3310
|
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(context, options) {
|
|
3304
3311
|
var _menu_list_ids$length3,
|
|
3305
3312
|
_this6 = this;
|
|
3306
|
-
var tTotal, menu_list_ids, schedule_date, schedule_datetime, customer_id, product_id, _published$find, pid,
|
|
3313
|
+
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, product_id, queryIds, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, activeMenuList, tMenu, menuList, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tSort;
|
|
3307
3314
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3308
3315
|
while (1) switch (_context29.prev = _context29.next) {
|
|
3309
3316
|
case 0:
|
|
3310
3317
|
tTotal = performance.now();
|
|
3311
|
-
menu_list_ids = context.menu_list_ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, product_id = context.product_id;
|
|
3318
|
+
menu_list_ids = context.menu_list_ids, ids = context.ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, product_id = context.product_id;
|
|
3319
|
+
queryIds = Array.isArray(ids) ? ids.map(function (id) {
|
|
3320
|
+
return Number(id);
|
|
3321
|
+
}).filter(function (id) {
|
|
3322
|
+
return Number.isFinite(id);
|
|
3323
|
+
}) : [];
|
|
3312
3324
|
this.logInfo('computeProductQueryResult 开始', {
|
|
3313
3325
|
menuListIdsCount: (_menu_list_ids$length3 = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length3 !== void 0 ? _menu_list_ids$length3 : 0,
|
|
3326
|
+
ids: queryIds,
|
|
3314
3327
|
schedule_datetime: schedule_datetime,
|
|
3315
3328
|
schedule_date: schedule_date,
|
|
3316
3329
|
customer_id: customer_id,
|
|
@@ -3318,7 +3331,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3318
3331
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3319
3332
|
});
|
|
3320
3333
|
if (this.products) {
|
|
3321
|
-
_context29.next =
|
|
3334
|
+
_context29.next = 7;
|
|
3322
3335
|
break;
|
|
3323
3336
|
}
|
|
3324
3337
|
this.logError('computeProductQueryResult: Products 模块未注册');
|
|
@@ -3329,22 +3342,67 @@ var Server = /*#__PURE__*/function () {
|
|
|
3329
3342
|
count: 0
|
|
3330
3343
|
}
|
|
3331
3344
|
});
|
|
3332
|
-
case
|
|
3333
|
-
if (!(
|
|
3345
|
+
case 7:
|
|
3346
|
+
if (!(queryIds.length > 0)) {
|
|
3334
3347
|
_context29.next = 18;
|
|
3335
3348
|
break;
|
|
3336
3349
|
}
|
|
3337
|
-
|
|
3350
|
+
uniqueIds = Array.from(new Set(queryIds));
|
|
3338
3351
|
_tPrice = performance.now();
|
|
3339
|
-
_context29.next =
|
|
3352
|
+
_context29.next = 12;
|
|
3353
|
+
return this.products.getProductsWithPrice(schedule_date, {
|
|
3354
|
+
scheduleModule: this.getSchedule(),
|
|
3355
|
+
schedule_datetime: schedule_datetime,
|
|
3356
|
+
customer_id: customer_id
|
|
3357
|
+
}, {
|
|
3358
|
+
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
3359
|
+
productIds: uniqueIds
|
|
3360
|
+
});
|
|
3361
|
+
case 12:
|
|
3362
|
+
productsWithPrice = _context29.sent;
|
|
3363
|
+
perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
|
|
3364
|
+
count: productsWithPrice.length,
|
|
3365
|
+
ids: uniqueIds
|
|
3366
|
+
});
|
|
3367
|
+
_filteredProducts = productsWithPrice.filter(function (p) {
|
|
3368
|
+
return uniqueIds.includes(Number(p === null || p === void 0 ? void 0 : p.id));
|
|
3369
|
+
}).filter(function (p) {
|
|
3370
|
+
return ((p === null || p === void 0 ? void 0 : p.status) || 'published') === 'published';
|
|
3371
|
+
});
|
|
3372
|
+
perfMark('computeProductQueryResult', performance.now() - tTotal, {
|
|
3373
|
+
mode: 'ids',
|
|
3374
|
+
ids: uniqueIds,
|
|
3375
|
+
count: _filteredProducts.length
|
|
3376
|
+
});
|
|
3377
|
+
this.logInfo('computeProductQueryResult 完成(ids)', {
|
|
3378
|
+
ids: uniqueIds,
|
|
3379
|
+
count: _filteredProducts.length
|
|
3380
|
+
});
|
|
3381
|
+
return _context29.abrupt("return", {
|
|
3382
|
+
code: 200,
|
|
3383
|
+
data: {
|
|
3384
|
+
list: _filteredProducts,
|
|
3385
|
+
count: _filteredProducts.length
|
|
3386
|
+
},
|
|
3387
|
+
message: '',
|
|
3388
|
+
status: true
|
|
3389
|
+
});
|
|
3390
|
+
case 18:
|
|
3391
|
+
if (!(product_id != null && Number.isFinite(Number(product_id)))) {
|
|
3392
|
+
_context29.next = 30;
|
|
3393
|
+
break;
|
|
3394
|
+
}
|
|
3395
|
+
pid = Number(product_id);
|
|
3396
|
+
_tPrice2 = performance.now();
|
|
3397
|
+
_context29.next = 23;
|
|
3340
3398
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3341
3399
|
scheduleModule: this.getSchedule()
|
|
3342
3400
|
}, {
|
|
3343
3401
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds
|
|
3344
3402
|
});
|
|
3345
|
-
case
|
|
3403
|
+
case 23:
|
|
3346
3404
|
allProductsWithPrice = _context29.sent;
|
|
3347
|
-
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() -
|
|
3405
|
+
perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
|
|
3348
3406
|
count: allProductsWithPrice.length,
|
|
3349
3407
|
productId: pid
|
|
3350
3408
|
});
|
|
@@ -3369,9 +3427,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3369
3427
|
message: item ? '' : '商品不存在或未发布',
|
|
3370
3428
|
status: true
|
|
3371
3429
|
});
|
|
3372
|
-
case
|
|
3430
|
+
case 30:
|
|
3373
3431
|
if (this.menu) {
|
|
3374
|
-
_context29.next =
|
|
3432
|
+
_context29.next = 33;
|
|
3375
3433
|
break;
|
|
3376
3434
|
}
|
|
3377
3435
|
this.logError('computeProductQueryResult: Menu 模块未注册');
|
|
@@ -3382,9 +3440,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
3382
3440
|
count: 0
|
|
3383
3441
|
}
|
|
3384
3442
|
});
|
|
3385
|
-
case
|
|
3443
|
+
case 33:
|
|
3386
3444
|
if (this.schedule) {
|
|
3387
|
-
_context29.next =
|
|
3445
|
+
_context29.next = 36;
|
|
3388
3446
|
break;
|
|
3389
3447
|
}
|
|
3390
3448
|
this.logError('computeProductQueryResult: Schedule 模块未注册');
|
|
@@ -3395,7 +3453,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3395
3453
|
count: 0
|
|
3396
3454
|
}
|
|
3397
3455
|
});
|
|
3398
|
-
case
|
|
3456
|
+
case 36:
|
|
3399
3457
|
activeMenuList = [];
|
|
3400
3458
|
if (menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0) {
|
|
3401
3459
|
tMenu = performance.now();
|
|
@@ -3419,10 +3477,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
3419
3477
|
});
|
|
3420
3478
|
tPrice = performance.now();
|
|
3421
3479
|
if (!(scopedProductIds.length > 0)) {
|
|
3422
|
-
_context29.next =
|
|
3480
|
+
_context29.next = 49;
|
|
3423
3481
|
break;
|
|
3424
3482
|
}
|
|
3425
|
-
_context29.next =
|
|
3483
|
+
_context29.next = 46;
|
|
3426
3484
|
return this.products.getProductsWithPrice(schedule_date, {
|
|
3427
3485
|
scheduleModule: this.getSchedule(),
|
|
3428
3486
|
schedule_datetime: schedule_datetime,
|
|
@@ -3431,13 +3489,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
3431
3489
|
changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
|
|
3432
3490
|
productIds: productScope.isAllProducts ? undefined : scopedProductIds
|
|
3433
3491
|
});
|
|
3434
|
-
case
|
|
3492
|
+
case 46:
|
|
3435
3493
|
_context29.t0 = _context29.sent;
|
|
3436
|
-
_context29.next =
|
|
3494
|
+
_context29.next = 50;
|
|
3437
3495
|
break;
|
|
3438
|
-
case
|
|
3496
|
+
case 49:
|
|
3439
3497
|
_context29.t0 = [];
|
|
3440
|
-
case
|
|
3498
|
+
case 50:
|
|
3441
3499
|
filteredProducts = _context29.t0;
|
|
3442
3500
|
perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
|
|
3443
3501
|
count: filteredProducts.length,
|
|
@@ -3480,7 +3538,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
3480
3538
|
message: '',
|
|
3481
3539
|
status: true
|
|
3482
3540
|
});
|
|
3483
|
-
case
|
|
3541
|
+
case 62:
|
|
3484
3542
|
case "end":
|
|
3485
3543
|
return _context29.stop();
|
|
3486
3544
|
}
|
|
@@ -18,6 +18,7 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
18
18
|
private resourceIdIndex;
|
|
19
19
|
private logger;
|
|
20
20
|
private storage;
|
|
21
|
+
private orderSQLiteSaveQueue;
|
|
21
22
|
constructor(name?: string, version?: string);
|
|
22
23
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
23
24
|
/**
|
|
@@ -130,6 +131,28 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
130
131
|
private getStorageItem;
|
|
131
132
|
private setStorageItem;
|
|
132
133
|
private loadOrdersFromSQLite;
|
|
134
|
+
/**
|
|
135
|
+
* 串行执行订单 SQLite 保存任务,保证 clear + bulkAdd 组合不会被其它订单保存插入。
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* await this.runInOrderSQLiteSaveQueue(async () => {
|
|
139
|
+
* await this.dbManager.clear(INDEXDB_STORE_NAME)
|
|
140
|
+
* await this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orders)
|
|
141
|
+
* })
|
|
142
|
+
*/
|
|
143
|
+
private runInOrderSQLiteSaveQueue;
|
|
144
|
+
/**
|
|
145
|
+
* 保存订单列表到 SQLite,内部会先清空 orders 表再批量写入当前快照。
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* await this.saveOrdersToSQLite(this.store.list)
|
|
149
|
+
*/
|
|
133
150
|
private saveOrdersToSQLite;
|
|
151
|
+
/**
|
|
152
|
+
* 清空订单模块的内存数据和本地 SQLite 订单表。
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* await orderModule.clear()
|
|
156
|
+
*/
|
|
134
157
|
clear(): Promise<void>;
|
|
135
158
|
}
|
|
@@ -63,6 +63,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
63
63
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
64
64
|
// LoggerManager 实例
|
|
65
65
|
_defineProperty(_assertThisInitialized(_this), "storage", void 0);
|
|
66
|
+
_defineProperty(_assertThisInitialized(_this), "orderSQLiteSaveQueue", Promise.resolve());
|
|
66
67
|
return _this;
|
|
67
68
|
}
|
|
68
69
|
_createClass(OrderModule, [{
|
|
@@ -1276,92 +1277,168 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1276
1277
|
}
|
|
1277
1278
|
return loadOrdersFromSQLite;
|
|
1278
1279
|
}()
|
|
1280
|
+
/**
|
|
1281
|
+
* 串行执行订单 SQLite 保存任务,保证 clear + bulkAdd 组合不会被其它订单保存插入。
|
|
1282
|
+
*
|
|
1283
|
+
* @example
|
|
1284
|
+
* await this.runInOrderSQLiteSaveQueue(async () => {
|
|
1285
|
+
* await this.dbManager.clear(INDEXDB_STORE_NAME)
|
|
1286
|
+
* await this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orders)
|
|
1287
|
+
* })
|
|
1288
|
+
*/
|
|
1279
1289
|
}, {
|
|
1280
|
-
key: "
|
|
1281
|
-
value: function () {
|
|
1282
|
-
var
|
|
1290
|
+
key: "runInOrderSQLiteSaveQueue",
|
|
1291
|
+
value: (function () {
|
|
1292
|
+
var _runInOrderSQLiteSaveQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(task) {
|
|
1293
|
+
var queuedTask;
|
|
1283
1294
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1284
1295
|
while (1) switch (_context15.prev = _context15.next) {
|
|
1296
|
+
case 0:
|
|
1297
|
+
queuedTask = this.orderSQLiteSaveQueue.then(task, task);
|
|
1298
|
+
this.orderSQLiteSaveQueue = queuedTask.then(function () {
|
|
1299
|
+
return undefined;
|
|
1300
|
+
}, function () {
|
|
1301
|
+
return undefined;
|
|
1302
|
+
});
|
|
1303
|
+
return _context15.abrupt("return", queuedTask);
|
|
1304
|
+
case 3:
|
|
1305
|
+
case "end":
|
|
1306
|
+
return _context15.stop();
|
|
1307
|
+
}
|
|
1308
|
+
}, _callee15, this);
|
|
1309
|
+
}));
|
|
1310
|
+
function runInOrderSQLiteSaveQueue(_x8) {
|
|
1311
|
+
return _runInOrderSQLiteSaveQueue.apply(this, arguments);
|
|
1312
|
+
}
|
|
1313
|
+
return runInOrderSQLiteSaveQueue;
|
|
1314
|
+
}()
|
|
1315
|
+
/**
|
|
1316
|
+
* 保存订单列表到 SQLite,内部会先清空 orders 表再批量写入当前快照。
|
|
1317
|
+
*
|
|
1318
|
+
* @example
|
|
1319
|
+
* await this.saveOrdersToSQLite(this.store.list)
|
|
1320
|
+
*/
|
|
1321
|
+
)
|
|
1322
|
+
}, {
|
|
1323
|
+
key: "saveOrdersToSQLite",
|
|
1324
|
+
value: (function () {
|
|
1325
|
+
var _saveOrdersToSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(orderList) {
|
|
1326
|
+
var _this10 = this;
|
|
1327
|
+
var orderListSnapshot;
|
|
1328
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1329
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1285
1330
|
case 0:
|
|
1286
1331
|
if (this.dbManager) {
|
|
1287
|
-
|
|
1332
|
+
_context17.next = 2;
|
|
1288
1333
|
break;
|
|
1289
1334
|
}
|
|
1290
|
-
return
|
|
1335
|
+
return _context17.abrupt("return");
|
|
1291
1336
|
case 2:
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1337
|
+
orderListSnapshot = cloneDeep(orderList);
|
|
1338
|
+
_context17.prev = 3;
|
|
1339
|
+
_context17.next = 6;
|
|
1340
|
+
return this.runInOrderSQLiteSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1341
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1342
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1343
|
+
case 0:
|
|
1344
|
+
_this10.logInfo('saveOrdersToSQLite-开始', {
|
|
1345
|
+
count: orderListSnapshot.length
|
|
1346
|
+
});
|
|
1347
|
+
_context16.next = 3;
|
|
1348
|
+
return _this10.dbManager.clear(INDEXDB_STORE_NAME);
|
|
1349
|
+
case 3:
|
|
1350
|
+
_this10.logInfo('saveOrdersToSQLite-clear完成', {
|
|
1351
|
+
count: orderListSnapshot.length
|
|
1352
|
+
});
|
|
1353
|
+
if (!(orderListSnapshot.length === 0)) {
|
|
1354
|
+
_context16.next = 6;
|
|
1355
|
+
break;
|
|
1356
|
+
}
|
|
1357
|
+
return _context16.abrupt("return");
|
|
1358
|
+
case 6:
|
|
1359
|
+
_context16.next = 8;
|
|
1360
|
+
return _this10.dbManager.bulkAdd(INDEXDB_STORE_NAME, orderListSnapshot);
|
|
1361
|
+
case 8:
|
|
1362
|
+
_this10.logInfo('saveOrdersToSQLite-bulkAdd完成', {
|
|
1363
|
+
count: orderListSnapshot.length
|
|
1364
|
+
});
|
|
1365
|
+
case 9:
|
|
1366
|
+
case "end":
|
|
1367
|
+
return _context16.stop();
|
|
1368
|
+
}
|
|
1369
|
+
}, _callee16);
|
|
1370
|
+
})));
|
|
1298
1371
|
case 6:
|
|
1299
|
-
|
|
1300
|
-
count: orderList.length
|
|
1301
|
-
});
|
|
1302
|
-
if (!(orderList.length === 0)) {
|
|
1303
|
-
_context15.next = 9;
|
|
1304
|
-
break;
|
|
1305
|
-
}
|
|
1306
|
-
return _context15.abrupt("return");
|
|
1307
|
-
case 9:
|
|
1308
|
-
_context15.next = 11;
|
|
1309
|
-
return this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orderList);
|
|
1310
|
-
case 11:
|
|
1311
|
-
this.logInfo('saveOrdersToSQLite-bulkAdd完成', {
|
|
1312
|
-
count: orderList.length
|
|
1313
|
-
});
|
|
1314
|
-
_context15.next = 17;
|
|
1372
|
+
_context17.next = 11;
|
|
1315
1373
|
break;
|
|
1316
|
-
case
|
|
1317
|
-
|
|
1318
|
-
|
|
1374
|
+
case 8:
|
|
1375
|
+
_context17.prev = 8;
|
|
1376
|
+
_context17.t0 = _context17["catch"](3);
|
|
1319
1377
|
// SQLite 异常,避免影响主流程
|
|
1320
1378
|
this.logError('保存订单到 SQLite 失败', {
|
|
1321
|
-
error:
|
|
1322
|
-
orderList:
|
|
1379
|
+
error: _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0),
|
|
1380
|
+
orderList: orderListSnapshot.length
|
|
1323
1381
|
});
|
|
1324
|
-
case
|
|
1382
|
+
case 11:
|
|
1325
1383
|
case "end":
|
|
1326
|
-
return
|
|
1384
|
+
return _context17.stop();
|
|
1327
1385
|
}
|
|
1328
|
-
},
|
|
1386
|
+
}, _callee17, this, [[3, 8]]);
|
|
1329
1387
|
}));
|
|
1330
|
-
function saveOrdersToSQLite(
|
|
1388
|
+
function saveOrdersToSQLite(_x9) {
|
|
1331
1389
|
return _saveOrdersToSQLite.apply(this, arguments);
|
|
1332
1390
|
}
|
|
1333
1391
|
return saveOrdersToSQLite;
|
|
1334
1392
|
}()
|
|
1393
|
+
/**
|
|
1394
|
+
* 清空订单模块的内存数据和本地 SQLite 订单表。
|
|
1395
|
+
*
|
|
1396
|
+
* @example
|
|
1397
|
+
* await orderModule.clear()
|
|
1398
|
+
*/
|
|
1399
|
+
)
|
|
1335
1400
|
}, {
|
|
1336
1401
|
key: "clear",
|
|
1337
|
-
value: function () {
|
|
1338
|
-
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1339
|
-
|
|
1340
|
-
|
|
1402
|
+
value: (function () {
|
|
1403
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1404
|
+
var _this11 = this;
|
|
1405
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1406
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1341
1407
|
case 0:
|
|
1342
1408
|
this.store.list = [];
|
|
1343
1409
|
this.store.map = new Map();
|
|
1344
1410
|
this.resourceIdIndex.clear();
|
|
1345
1411
|
if (!this.dbManager) {
|
|
1346
|
-
|
|
1412
|
+
_context19.next = 6;
|
|
1347
1413
|
break;
|
|
1348
1414
|
}
|
|
1349
|
-
|
|
1350
|
-
return this.
|
|
1415
|
+
_context19.next = 6;
|
|
1416
|
+
return this.runInOrderSQLiteSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1417
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1418
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1419
|
+
case 0:
|
|
1420
|
+
_context18.next = 2;
|
|
1421
|
+
return _this11.dbManager.clear(INDEXDB_STORE_NAME);
|
|
1422
|
+
case 2:
|
|
1423
|
+
case "end":
|
|
1424
|
+
return _context18.stop();
|
|
1425
|
+
}
|
|
1426
|
+
}, _callee18);
|
|
1427
|
+
})));
|
|
1351
1428
|
case 6:
|
|
1352
1429
|
this.setStorageItem(ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY, '');
|
|
1353
1430
|
this.core.effects.emit(OrderHooks.onOrdersChanged, this.store.list);
|
|
1354
1431
|
case 8:
|
|
1355
1432
|
case "end":
|
|
1356
|
-
return
|
|
1433
|
+
return _context19.stop();
|
|
1357
1434
|
}
|
|
1358
|
-
},
|
|
1435
|
+
}, _callee19, this);
|
|
1359
1436
|
}));
|
|
1360
1437
|
function clear() {
|
|
1361
1438
|
return _clear.apply(this, arguments);
|
|
1362
1439
|
}
|
|
1363
1440
|
return clear;
|
|
1364
|
-
}()
|
|
1441
|
+
}())
|
|
1365
1442
|
}]);
|
|
1366
1443
|
return OrderModule;
|
|
1367
1444
|
}(BaseModule);
|
|
@@ -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
|
});
|
|
@@ -21,7 +21,7 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
21
21
|
private isPriceFormatterRegistered;
|
|
22
22
|
private quotationPriceBridge?;
|
|
23
23
|
private quotationBridgeChannel?;
|
|
24
|
-
private
|
|
24
|
+
private quotationBridgeLoadedKey?;
|
|
25
25
|
private quotationBridgeRefreshPromise?;
|
|
26
26
|
private quotationBridgeRefreshKey?;
|
|
27
27
|
private productDataSource;
|