@pisell/pisellos 2.3.67 → 2.3.69
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/walletPass/evaluator.js +0 -1
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
- package/dist/modules/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Order/index.d.ts +22 -2
- package/dist/modules/Order/index.js +313 -142
- package/dist/modules/Order/types.d.ts +13 -1
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Order/utils.js +0 -1
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +52 -18
- package/dist/modules/Rules/index.js +46 -31
- package/dist/server/index.js +3 -6
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +252 -93
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +13 -1
- package/dist/solution/BaseSales/index.js +903 -831
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingTicket/index.d.ts +7 -1
- package/dist/solution/BookingTicket/index.js +310 -224
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/dist/solution/UnifiedBookingSales/index.js +640 -321
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
- package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Order/index.d.ts +22 -2
- package/lib/modules/Order/index.js +212 -54
- package/lib/modules/Order/types.d.ts +13 -1
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Order/utils.js +0 -1
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +27 -2
- package/lib/modules/Rules/index.js +17 -1
- package/lib/server/index.js +3 -6
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +66 -2
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +13 -1
- package/lib/solution/BaseSales/index.js +61 -18
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingTicket/index.d.ts +7 -1
- package/lib/solution/BookingTicket/index.js +65 -14
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/lib/solution/UnifiedBookingSales/index.js +188 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -39,9 +39,9 @@ import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentI
|
|
|
39
39
|
import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
|
|
40
40
|
import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid } from "../../solution/BaseSales/utils/cartPromotion";
|
|
41
41
|
import { buildProductLineFingerprint, getProductIdentityIndex, getSafeProductNum, isIdentityMatch, normalizeOrderProduct } from "../../solution/ScanOrder/utils";
|
|
42
|
-
import { syncManualProductDiscountProductNum } from "./utils/manualProductDiscount";
|
|
42
|
+
import { hasManualProductDiscountFlag, syncManualProductDiscountProductNum } from "./utils/manualProductDiscount";
|
|
43
43
|
import { expandHydratedProductsForDiscountCollection, restoreHydratedBundleDiscounts } from "./utils/bundleDiscountHydration";
|
|
44
|
-
import { getOrderCollectionPersistentId, getOrderCollectionUid, normalizeOrderCollections, setOrderCollectionUid } from "./utils/orderCollectionIdentity";
|
|
44
|
+
import { getOrderCollectionPersistentId, getOrderCollectionUid, normalizeOrderCollections, repairDuplicateProductLineIdentities as repairDuplicateOrderProductLineIdentities, setOrderCollectionUid } from "./utils/orderCollectionIdentity";
|
|
45
45
|
import { consolidateDiscountFreeProductLines, ensureUniqueProductLineUids } from "./utils/discountProductLineIdentity";
|
|
46
46
|
import { DiscountModule } from "../Discount";
|
|
47
47
|
import { RulesModule } from "../Rules";
|
|
@@ -64,8 +64,7 @@ function isSameDiscountList(left, right) {
|
|
|
64
64
|
return JSON.stringify(normalizeDiscountListSignature(left)) === JSON.stringify(normalizeDiscountListSignature(right));
|
|
65
65
|
}
|
|
66
66
|
function isManualProductDiscountProduct(product) {
|
|
67
|
-
|
|
68
|
-
return (product === null || product === void 0 || (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.is_manual_discount) === true || (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.is_manual_discount) === 1 || ((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (item) {
|
|
67
|
+
return hasManualProductDiscountFlag(product === null || product === void 0 ? void 0 : product.metadata) || ((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (item) {
|
|
69
68
|
return (item === null || item === void 0 ? void 0 : item.type) === 'product';
|
|
70
69
|
});
|
|
71
70
|
}
|
|
@@ -122,6 +121,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
122
121
|
_defineProperty(_assertThisInitialized(_this), "window", void 0);
|
|
123
122
|
_defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
|
|
124
123
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
124
|
+
_defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
|
|
125
|
+
_defineProperty(_assertThisInitialized(_this), "openCache", false);
|
|
126
|
+
_defineProperty(_assertThisInitialized(_this), "sessionStoragePersistEnabled", false);
|
|
127
|
+
_defineProperty(_assertThisInitialized(_this), "sessionStorageRestoreRecord", null);
|
|
125
128
|
_defineProperty(_assertThisInitialized(_this), "salesSummaryModuleName", void 0);
|
|
126
129
|
_defineProperty(_assertThisInitialized(_this), "rulesHooksOverride", void 0);
|
|
127
130
|
_defineProperty(_assertThisInitialized(_this), "moduleHooksOverride", void 0);
|
|
@@ -270,7 +273,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
270
273
|
key: "applyProductDiscountPrices",
|
|
271
274
|
value: function applyProductDiscountPrices(products) {
|
|
272
275
|
return (products || []).map(function (product) {
|
|
273
|
-
var _product$metadata$sou, _product$
|
|
276
|
+
var _product$metadata$sou, _product$metadata, _product$metadata2, _product$original_pri2;
|
|
274
277
|
if (isManualProductDiscountProduct(product)) return product;
|
|
275
278
|
var discountItems = Array.isArray(product.discount_list) ? product.discount_list : [];
|
|
276
279
|
var hasOnlyPersistedDiscountSnapshots = product.order_detail_id !== undefined && product.order_detail_id !== null && discountItems.length > 0 && discountItems.every(function (discount) {
|
|
@@ -281,7 +284,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
281
284
|
}
|
|
282
285
|
var totalPerUnitDiscount = resolveEffectivePerUnitDiscount(product);
|
|
283
286
|
var optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
|
|
284
|
-
var sourcePrice = (_product$metadata$sou = (_product$
|
|
287
|
+
var sourcePrice = (_product$metadata$sou = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri2 = product.original_price) !== null && _product$original_pri2 !== void 0 ? _product$original_pri2 : '0';
|
|
285
288
|
var newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
286
289
|
var newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
287
290
|
if (product.metadata) {
|
|
@@ -308,18 +311,38 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
308
311
|
return product;
|
|
309
312
|
});
|
|
310
313
|
}
|
|
314
|
+
}, {
|
|
315
|
+
key: "syncSessionStorageOptions",
|
|
316
|
+
value: function syncSessionStorageOptions(otherParams) {
|
|
317
|
+
this.cacheId = otherParams.cacheId;
|
|
318
|
+
this.fatherModule = otherParams.fatherModule;
|
|
319
|
+
this.openCache = Boolean(this.cacheId && otherParams.openCache !== false);
|
|
320
|
+
this.sessionStoragePersistEnabled = Boolean(this.openCache && otherParams.enableSessionStoragePersist === true);
|
|
321
|
+
}
|
|
311
322
|
}, {
|
|
312
323
|
key: "initialize",
|
|
313
324
|
value: function () {
|
|
314
325
|
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
315
326
|
var _appPlugin$getApp, _otherParams$rules, _otherParams$order, _otherParams$hooks;
|
|
316
|
-
var appPlugin, app
|
|
327
|
+
var otherParams, cachedTempOrder, appPlugin, app;
|
|
317
328
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
318
329
|
while (1) switch (_context.prev = _context.next) {
|
|
319
330
|
case 0:
|
|
320
331
|
this.core = core;
|
|
321
332
|
this.store = options.store;
|
|
322
|
-
|
|
333
|
+
otherParams = options.otherParams || {};
|
|
334
|
+
this.syncSessionStorageOptions(otherParams);
|
|
335
|
+
if (this.sessionStoragePersistEnabled) {
|
|
336
|
+
cachedTempOrder = this.store.tempOrder;
|
|
337
|
+
this.sessionStorageRestoreRecord = isTempOrder(cachedTempOrder) ? cloneDeep(cachedTempOrder) : null;
|
|
338
|
+
// 统一由 loadSalesDetail hydrate,初始化阶段不直接把缓存态暴露给业务。
|
|
339
|
+
this.store.tempOrder = null;
|
|
340
|
+
this.store.summary = createEmptySummary();
|
|
341
|
+
this.store.availableWalletIds = [];
|
|
342
|
+
this.store.lastOrderInfo = undefined;
|
|
343
|
+
this.store.syncState = undefined;
|
|
344
|
+
this.store.discountList = [];
|
|
345
|
+
} else if (!this.store.tempOrder) {
|
|
323
346
|
this.store.tempOrder = null;
|
|
324
347
|
}
|
|
325
348
|
if (!this.store.summary) {
|
|
@@ -336,8 +359,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
336
359
|
app = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
|
|
337
360
|
this.logger = app === null || app === void 0 ? void 0 : app.logger;
|
|
338
361
|
this.window = this.core.getPlugin('window');
|
|
339
|
-
otherParams = options.otherParams || {};
|
|
340
|
-
this.cacheId = otherParams.cacheId;
|
|
341
362
|
this.salesSummaryModuleName = otherParams.salesSummaryModuleName;
|
|
342
363
|
this.rulesHooksOverride = (_otherParams$rules = otherParams.rules) === null || _otherParams$rules === void 0 ? void 0 : _otherParams$rules.hooks;
|
|
343
364
|
this.moduleHooksOverride = options.hooks;
|
|
@@ -365,49 +386,50 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
365
386
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
366
387
|
while (1) switch (_context2.prev = _context2.next) {
|
|
367
388
|
case 0:
|
|
389
|
+
this.sessionStorageRestoreRecord = null;
|
|
368
390
|
childModules = [(_this$store = this.store) === null || _this$store === void 0 ? void 0 : _this$store.discount, (_this$store2 = this.store) === null || _this$store2 === void 0 ? void 0 : _this$store2.rules];
|
|
369
391
|
_i = 0, _childModules = childModules;
|
|
370
|
-
case
|
|
392
|
+
case 3:
|
|
371
393
|
if (!(_i < _childModules.length)) {
|
|
372
|
-
_context2.next =
|
|
394
|
+
_context2.next = 19;
|
|
373
395
|
break;
|
|
374
396
|
}
|
|
375
397
|
childModule = _childModules[_i];
|
|
376
398
|
if (!(!childModule || typeof childModule.destroy !== 'function')) {
|
|
377
|
-
_context2.next =
|
|
399
|
+
_context2.next = 7;
|
|
378
400
|
break;
|
|
379
401
|
}
|
|
380
|
-
return _context2.abrupt("continue",
|
|
381
|
-
case
|
|
382
|
-
_context2.prev =
|
|
383
|
-
_context2.next =
|
|
402
|
+
return _context2.abrupt("continue", 16);
|
|
403
|
+
case 7:
|
|
404
|
+
_context2.prev = 7;
|
|
405
|
+
_context2.next = 10;
|
|
384
406
|
return childModule.destroy();
|
|
385
|
-
case
|
|
386
|
-
_context2.next =
|
|
407
|
+
case 10:
|
|
408
|
+
_context2.next = 16;
|
|
387
409
|
break;
|
|
388
|
-
case
|
|
389
|
-
_context2.prev =
|
|
390
|
-
_context2.t0 = _context2["catch"](
|
|
410
|
+
case 12:
|
|
411
|
+
_context2.prev = 12;
|
|
412
|
+
_context2.t0 = _context2["catch"](7);
|
|
391
413
|
errorMessage = _context2.t0 instanceof Error ? _context2.t0.message : String(_context2.t0);
|
|
392
414
|
this.logWarning('Destroy child module failed', {
|
|
393
415
|
module: childModule.name,
|
|
394
416
|
error: errorMessage
|
|
395
417
|
});
|
|
396
|
-
case
|
|
418
|
+
case 16:
|
|
397
419
|
_i++;
|
|
398
|
-
_context2.next =
|
|
420
|
+
_context2.next = 3;
|
|
399
421
|
break;
|
|
400
|
-
case
|
|
422
|
+
case 19:
|
|
401
423
|
if (this.store) {
|
|
402
424
|
this.store.discount = null;
|
|
403
425
|
this.store.rules = null;
|
|
404
426
|
}
|
|
405
427
|
_get(_getPrototypeOf(OrderModule.prototype), "destroy", this).call(this);
|
|
406
|
-
case
|
|
428
|
+
case 21:
|
|
407
429
|
case "end":
|
|
408
430
|
return _context2.stop();
|
|
409
431
|
}
|
|
410
|
-
}, _callee2, this, [[
|
|
432
|
+
}, _callee2, this, [[7, 12]]);
|
|
411
433
|
}));
|
|
412
434
|
function destroy() {
|
|
413
435
|
return _destroy.apply(this, arguments);
|
|
@@ -425,7 +447,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
425
447
|
value: function updateOtherParams(params) {
|
|
426
448
|
var _otherParams$rules2, _otherParams$order2, _otherParams$hooks2;
|
|
427
449
|
var otherParams = params || {};
|
|
428
|
-
this.
|
|
450
|
+
this.syncSessionStorageOptions(otherParams);
|
|
429
451
|
this.salesSummaryModuleName = otherParams.salesSummaryModuleName;
|
|
430
452
|
this.rulesHooksOverride = (_otherParams$rules2 = otherParams.rules) === null || _otherParams$rules2 === void 0 ? void 0 : _otherParams$rules2.hooks;
|
|
431
453
|
this.orderHooks = this.moduleHooksOverride || ((_otherParams$order2 = otherParams.order) === null || _otherParams$order2 === void 0 ? void 0 : _otherParams$order2.hooks) || ((_otherParams$hooks2 = otherParams.hooks) === null || _otherParams$hooks2 === void 0 ? void 0 : _otherParams$hooks2.order);
|
|
@@ -483,15 +505,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
483
505
|
value: function registerDiscountModules(options) {
|
|
484
506
|
var _targetCacheData;
|
|
485
507
|
var targetCacheData = {};
|
|
486
|
-
if (this.cacheId && this.window) {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
508
|
+
if (!this.sessionStoragePersistEnabled && this.openCache && this.cacheId && this.window) {
|
|
509
|
+
try {
|
|
510
|
+
var sessionData = this.window.sessionStorage.getItem(this.name);
|
|
511
|
+
if (sessionData) {
|
|
490
512
|
var data = JSON.parse(sessionData);
|
|
491
513
|
targetCacheData = (data === null || data === void 0 ? void 0 : data[this.cacheId]) || {};
|
|
492
|
-
} catch (_unused) {
|
|
493
|
-
// sessionStorage 损坏则忽略,按空 initialState 走
|
|
494
514
|
}
|
|
515
|
+
} catch (_unused) {
|
|
516
|
+
// sessionStorage 损坏或不可用时忽略,按空 initialState 走
|
|
495
517
|
}
|
|
496
518
|
}
|
|
497
519
|
var discount = new DiscountModule("".concat(this.name, "_discount"));
|
|
@@ -499,7 +521,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
499
521
|
initialState: (_targetCacheData = targetCacheData) === null || _targetCacheData === void 0 ? void 0 : _targetCacheData[discount.name],
|
|
500
522
|
otherParams: {
|
|
501
523
|
fatherModule: this.name,
|
|
502
|
-
|
|
524
|
+
// Unified 的单快照由 Order 管理;其他 Solution 保持原有 Discount 缓存语义。
|
|
525
|
+
openCache: this.openCache && !this.sessionStoragePersistEnabled,
|
|
503
526
|
cacheId: this.cacheId
|
|
504
527
|
}
|
|
505
528
|
});
|
|
@@ -1254,7 +1277,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1254
1277
|
|
|
1255
1278
|
/**
|
|
1256
1279
|
* 控制 IndexedDB 草稿(saveDraft)是否写入。
|
|
1257
|
-
*
|
|
1280
|
+
* 此开关仅影响 saveDraft;可选 sessionStorage 会话恢复由
|
|
1281
|
+
* enableSessionStoragePersist 独立控制。
|
|
1258
1282
|
*
|
|
1259
1283
|
* @example
|
|
1260
1284
|
* order.setEnableTempOrderPersist(false); // BigSale 弹窗:跳过 ~1s 的 dbUpdate
|
|
@@ -1272,11 +1296,76 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1272
1296
|
return this.draftPersistEnabled;
|
|
1273
1297
|
}
|
|
1274
1298
|
|
|
1275
|
-
/**
|
|
1299
|
+
/**
|
|
1300
|
+
* 在 UnifiedBookingSales 显式开启会话恢复时,将完整 tempOrder 写入
|
|
1301
|
+
* sessionStorage 的 cacheId 分桶。写入失败由 BaseModule 静默降级。
|
|
1302
|
+
*/
|
|
1276
1303
|
}, {
|
|
1277
1304
|
key: "persistTempOrder",
|
|
1278
1305
|
value: function persistTempOrder() {
|
|
1279
|
-
|
|
1306
|
+
if (!this.sessionStoragePersistEnabled || !this.store.tempOrder) return;
|
|
1307
|
+
this.checkSaveCache({
|
|
1308
|
+
cacheId: this.cacheId,
|
|
1309
|
+
fatherModule: this.fatherModule,
|
|
1310
|
+
store: {
|
|
1311
|
+
tempOrder: this.store.tempOrder
|
|
1312
|
+
},
|
|
1313
|
+
cacheKey: ['tempOrder']
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
* 终止当前模块实例的 sessionStorage 订单恢复会话。
|
|
1319
|
+
*
|
|
1320
|
+
* 支付跳转等终态场景需要同时删除当前 cacheId 的 tempOrder 快照,并关闭
|
|
1321
|
+
* 本实例后续异步任务的再次写入;新模块实例初始化时会按 otherParams 重新启用。
|
|
1322
|
+
*/
|
|
1323
|
+
}, {
|
|
1324
|
+
key: "clearSessionStoragePersistedTempOrder",
|
|
1325
|
+
value: function clearSessionStoragePersistedTempOrder() {
|
|
1326
|
+
var _this$window;
|
|
1327
|
+
this.sessionStorageRestoreRecord = null;
|
|
1328
|
+
if (!this.sessionStoragePersistEnabled) return;
|
|
1329
|
+
this.sessionStoragePersistEnabled = false;
|
|
1330
|
+
if (!this.cacheId || !this.fatherModule || !((_this$window = this.window) !== null && _this$window !== void 0 && _this$window.sessionStorage)) {
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
var sessionStorage = this.window.sessionStorage;
|
|
1334
|
+
var rawCacheData = sessionStorage.getItem(this.fatherModule);
|
|
1335
|
+
if (!rawCacheData) return;
|
|
1336
|
+
var parsedCacheData;
|
|
1337
|
+
try {
|
|
1338
|
+
parsedCacheData = JSON.parse(rawCacheData);
|
|
1339
|
+
} catch (_unused2) {
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1342
|
+
if (!parsedCacheData || _typeof(parsedCacheData) !== 'object' || Array.isArray(parsedCacheData)) {
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
var cacheRoot = parsedCacheData;
|
|
1346
|
+
var cacheBucket = cacheRoot[this.cacheId];
|
|
1347
|
+
if (!cacheBucket || _typeof(cacheBucket) !== 'object' || Array.isArray(cacheBucket)) {
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1350
|
+
var moduleBucket = cacheBucket[this.name];
|
|
1351
|
+
if (!moduleBucket || _typeof(moduleBucket) !== 'object' || Array.isArray(moduleBucket)) {
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
delete moduleBucket.tempOrder;
|
|
1355
|
+
if (Object.keys(moduleBucket).length === 0) {
|
|
1356
|
+
delete cacheBucket[this.name];
|
|
1357
|
+
}
|
|
1358
|
+
if (Object.keys(cacheBucket).length === 0) {
|
|
1359
|
+
delete cacheRoot[this.cacheId];
|
|
1360
|
+
}
|
|
1361
|
+
sessionStorage.setItem(this.fatherModule, JSON.stringify(cacheRoot));
|
|
1362
|
+
}
|
|
1363
|
+
}, {
|
|
1364
|
+
key: "consumeSessionStorageRestore",
|
|
1365
|
+
value: function consumeSessionStorageRestore() {
|
|
1366
|
+
var record = this.sessionStorageRestoreRecord;
|
|
1367
|
+
this.sessionStorageRestoreRecord = null;
|
|
1368
|
+
return record ? cloneDeep(record) : null;
|
|
1280
1369
|
}
|
|
1281
1370
|
}, {
|
|
1282
1371
|
key: "notifyTempOrderChanged",
|
|
@@ -1543,7 +1632,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1543
1632
|
paidAmount: netPaidAmount
|
|
1544
1633
|
});
|
|
1545
1634
|
var isOrderFullyPaid = orderExpectedAmount.lte(0) ? true : netPaidAmount.gte(orderExpectedAmount);
|
|
1546
|
-
var paymentStage = this.isDepositOrder(tempOrder, depositAmount) && !isDepositFullyPaid ? 'deposit' : 'normal';
|
|
1635
|
+
var paymentStage = this.isDepositOrder(tempOrder, depositAmount) && !isDepositFullyPaid && !this.hasPaidNormalPayment(paymentList) ? 'deposit' : 'normal';
|
|
1547
1636
|
return {
|
|
1548
1637
|
isFullyPaid: isOrderFullyPaid,
|
|
1549
1638
|
isOrderFullyPaid: isOrderFullyPaid,
|
|
@@ -1565,12 +1654,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1565
1654
|
return sum.plus(_this6.calculatePaymentGapAmount(paymentRecord));
|
|
1566
1655
|
}, new Decimal(0));
|
|
1567
1656
|
}
|
|
1657
|
+
}, {
|
|
1658
|
+
key: "hasPaidNormalPayment",
|
|
1659
|
+
value: function hasPaidNormalPayment(payments) {
|
|
1660
|
+
return (payments || []).some(function (payment) {
|
|
1661
|
+
var paymentRecord = payment;
|
|
1662
|
+
if (!isPaidPaymentRecord(paymentRecord)) return false;
|
|
1663
|
+
return paymentRecord.order_payment_type !== 'deposit' && paymentRecord.type !== 'deposit';
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1568
1666
|
}, {
|
|
1569
1667
|
key: "resolveNextOrderPaymentType",
|
|
1570
1668
|
value: function resolveNextOrderPaymentType(tempOrder) {
|
|
1571
1669
|
var depositAmount = new Decimal(tempOrder.deposit_amount || '0.00');
|
|
1572
1670
|
if (!this.isDepositOrder(tempOrder, depositAmount)) return 'normal';
|
|
1573
1671
|
if (depositAmount.lte(0)) return 'normal';
|
|
1672
|
+
if (this.hasPaidNormalPayment(tempOrder.payments || [])) return 'normal';
|
|
1574
1673
|
var depositPaidAmount = this.calculateDepositPaidAmount(tempOrder.payments || []);
|
|
1575
1674
|
return depositPaidAmount.lt(depositAmount) ? 'deposit' : 'normal';
|
|
1576
1675
|
}
|
|
@@ -1898,10 +1997,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1898
1997
|
value: function calculateSummaryAmountGap(params) {
|
|
1899
1998
|
var tempOrder = params.tempOrder,
|
|
1900
1999
|
summary = params.summary,
|
|
1901
|
-
orderPaidAmount = params.orderPaidAmount
|
|
2000
|
+
orderPaidAmount = params.orderPaidAmount,
|
|
2001
|
+
payments = params.payments;
|
|
1902
2002
|
var refundAmount = this.getSummaryRefundAmount(summary);
|
|
1903
2003
|
var netOrderPaidAmount = Decimal.max(orderPaidAmount.minus(refundAmount), 0);
|
|
1904
|
-
var targetAmount = this.calculatePaymentTargetAmount(tempOrder, summary, netOrderPaidAmount);
|
|
2004
|
+
var targetAmount = this.calculatePaymentTargetAmount(tempOrder, summary, netOrderPaidAmount, payments);
|
|
1905
2005
|
return targetAmount.minus(netOrderPaidAmount).toFixed(2);
|
|
1906
2006
|
}
|
|
1907
2007
|
}, {
|
|
@@ -1913,10 +2013,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1913
2013
|
key: "calculatePaymentTargetAmount",
|
|
1914
2014
|
value: function calculatePaymentTargetAmount(tempOrder, summary) {
|
|
1915
2015
|
var paidAmount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Decimal(0);
|
|
2016
|
+
var payments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : tempOrder.payments || [];
|
|
1916
2017
|
var depositAmount = this.getDepositAmount(tempOrder, summary);
|
|
1917
2018
|
if (!this.isDepositOrder(tempOrder, depositAmount)) {
|
|
1918
2019
|
return this.getOrderExpectedAmount(summary);
|
|
1919
2020
|
}
|
|
2021
|
+
if (this.hasPaidNormalPayment(payments)) {
|
|
2022
|
+
return this.getOrderExpectedAmount(summary);
|
|
2023
|
+
}
|
|
1920
2024
|
if (this.isDepositCovered({
|
|
1921
2025
|
tempOrder: tempOrder,
|
|
1922
2026
|
summary: summary,
|
|
@@ -1933,7 +2037,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1933
2037
|
try {
|
|
1934
2038
|
var parsed = new Decimal(String(value || 0));
|
|
1935
2039
|
return parsed.toFixed(4);
|
|
1936
|
-
} catch (
|
|
2040
|
+
} catch (_unused3) {
|
|
1937
2041
|
return String(value);
|
|
1938
2042
|
}
|
|
1939
2043
|
}
|
|
@@ -2169,17 +2273,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2169
2273
|
}, {
|
|
2170
2274
|
key: "isSnapshotPayableAmountUnchanged",
|
|
2171
2275
|
value: function isSnapshotPayableAmountUnchanged(tempOrder, snapshot, snapshotSummary) {
|
|
2172
|
-
var
|
|
2276
|
+
var currentPayments = tempOrder.payments || [];
|
|
2277
|
+
var currentPaidPaymentSummary = this.calculatePaidPaymentSummary(currentPayments);
|
|
2173
2278
|
var currentAmountGap = this.calculateSummaryAmountGap({
|
|
2174
2279
|
tempOrder: tempOrder,
|
|
2175
2280
|
summary: snapshotSummary,
|
|
2176
|
-
orderPaidAmount: currentPaidPaymentSummary.gapPaidAmount
|
|
2281
|
+
orderPaidAmount: currentPaidPaymentSummary.gapPaidAmount,
|
|
2282
|
+
payments: currentPayments
|
|
2177
2283
|
});
|
|
2178
|
-
var
|
|
2284
|
+
var snapshotPayments = Array.isArray(snapshot.payments) ? snapshot.payments : [];
|
|
2285
|
+
var snapshotPaidPaymentSummary = this.calculatePaidPaymentSummary(snapshotPayments);
|
|
2179
2286
|
var snapshotAmountGap = this.calculateSummaryAmountGap({
|
|
2180
2287
|
tempOrder: tempOrder,
|
|
2181
2288
|
summary: snapshotSummary,
|
|
2182
|
-
orderPaidAmount: snapshotPaidPaymentSummary.gapPaidAmount
|
|
2289
|
+
orderPaidAmount: snapshotPaidPaymentSummary.gapPaidAmount,
|
|
2290
|
+
payments: snapshotPayments
|
|
2183
2291
|
});
|
|
2184
2292
|
return currentAmountGap === snapshotAmountGap;
|
|
2185
2293
|
}
|
|
@@ -2213,6 +2321,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2213
2321
|
}
|
|
2214
2322
|
var isPayableAmountUnchanged = this.isSnapshotPayableAmountUnchanged(tempOrder, snapshot, summary);
|
|
2215
2323
|
if (!isPayableAmountUnchanged) return null;
|
|
2324
|
+
var currentPaidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
|
|
2325
|
+
summary.amount_gap = this.calculateSummaryAmountGap({
|
|
2326
|
+
tempOrder: tempOrder,
|
|
2327
|
+
summary: summary,
|
|
2328
|
+
orderPaidAmount: currentPaidPaymentSummary.gapPaidAmount
|
|
2329
|
+
});
|
|
2216
2330
|
if (Array.isArray(snapshot.products)) {
|
|
2217
2331
|
tempOrder.products = cloneDeep(snapshot.products);
|
|
2218
2332
|
}
|
|
@@ -2341,6 +2455,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2341
2455
|
value: function restoreOrder() {
|
|
2342
2456
|
var _this$store$discount16, _this$store$discount17;
|
|
2343
2457
|
this.logInfo('restoreOrder start', {});
|
|
2458
|
+
this.sessionStorageRestoreRecord = null;
|
|
2344
2459
|
var freshTempOrder = this.createDefaultTempOrderInstance();
|
|
2345
2460
|
this.ensureExternalSaleNumber(freshTempOrder);
|
|
2346
2461
|
this.store.tempOrder = freshTempOrder;
|
|
@@ -2371,36 +2486,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2371
2486
|
}
|
|
2372
2487
|
throw new Error('无效的 tempOrder 数据');
|
|
2373
2488
|
case 2:
|
|
2489
|
+
this.sessionStorageRestoreRecord = null;
|
|
2374
2490
|
nextTempOrder = this.normalizeTempOrderForRuntime(cloneDeep(tempOrder), {
|
|
2375
2491
|
ensureIdentity: false
|
|
2376
2492
|
});
|
|
2377
2493
|
this.store.tempOrder = nextTempOrder;
|
|
2378
2494
|
if (!((options === null || options === void 0 ? void 0 : options.recalculateSummary) !== false)) {
|
|
2379
|
-
_context12.next =
|
|
2495
|
+
_context12.next = 10;
|
|
2380
2496
|
break;
|
|
2381
2497
|
}
|
|
2382
|
-
_context12.next =
|
|
2498
|
+
_context12.next = 8;
|
|
2383
2499
|
return this.recalculateSummary({
|
|
2384
2500
|
createIfMissing: false
|
|
2385
2501
|
});
|
|
2386
|
-
case
|
|
2387
|
-
_context12.next =
|
|
2502
|
+
case 8:
|
|
2503
|
+
_context12.next = 11;
|
|
2388
2504
|
break;
|
|
2389
|
-
case 9:
|
|
2390
|
-
this.store.summary = createEmptySummary();
|
|
2391
2505
|
case 10:
|
|
2506
|
+
this.store.summary = createEmptySummary();
|
|
2507
|
+
case 11:
|
|
2392
2508
|
if ((options === null || options === void 0 ? void 0 : options.persist) !== false) {
|
|
2393
2509
|
this.persistTempOrder();
|
|
2394
2510
|
}
|
|
2395
2511
|
if (!(options !== null && options !== void 0 && options.saveDraft)) {
|
|
2396
|
-
_context12.next =
|
|
2512
|
+
_context12.next = 15;
|
|
2397
2513
|
break;
|
|
2398
2514
|
}
|
|
2399
|
-
_context12.next =
|
|
2515
|
+
_context12.next = 15;
|
|
2400
2516
|
return this.saveDraft();
|
|
2401
|
-
case 14:
|
|
2402
|
-
return _context12.abrupt("return", nextTempOrder);
|
|
2403
2517
|
case 15:
|
|
2518
|
+
return _context12.abrupt("return", nextTempOrder);
|
|
2519
|
+
case 16:
|
|
2404
2520
|
case "end":
|
|
2405
2521
|
return _context12.stop();
|
|
2406
2522
|
}
|
|
@@ -2569,6 +2685,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2569
2685
|
}
|
|
2570
2686
|
return tempOrder._extend;
|
|
2571
2687
|
}
|
|
2688
|
+
}, {
|
|
2689
|
+
key: "repairDuplicateProductLineIdentities",
|
|
2690
|
+
value: function repairDuplicateProductLineIdentities(tempOrder) {
|
|
2691
|
+
var _tempOrder$_extend7;
|
|
2692
|
+
var result = repairDuplicateOrderProductLineIdentities(tempOrder.products, (_tempOrder$_extend7 = tempOrder._extend) === null || _tempOrder$_extend7 === void 0 ? void 0 : _tempOrder$_extend7.productsByUid);
|
|
2693
|
+
if (!result.repairs.length) return;
|
|
2694
|
+
tempOrder.products = result.products;
|
|
2695
|
+
if (result.productsByUid) {
|
|
2696
|
+
this.ensureExtend(tempOrder).productsByUid = result.productsByUid;
|
|
2697
|
+
}
|
|
2698
|
+
this.logWarning('Repaired duplicate product line identities', {
|
|
2699
|
+
repairCount: result.repairs.length,
|
|
2700
|
+
repairs: result.repairs
|
|
2701
|
+
});
|
|
2702
|
+
}
|
|
2572
2703
|
}, {
|
|
2573
2704
|
key: "captureProductRuntime",
|
|
2574
2705
|
value: function captureProductRuntime(tempOrder, rawProduct, normalizedProduct, existedUid) {
|
|
@@ -2675,10 +2806,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2675
2806
|
}
|
|
2676
2807
|
});
|
|
2677
2808
|
products.forEach(function (product) {
|
|
2678
|
-
var _product$
|
|
2809
|
+
var _product$metadata3, _product$metadata4;
|
|
2679
2810
|
if (!product || _typeof(product) !== 'object') return;
|
|
2680
|
-
var productUid = ((_product$
|
|
2681
|
-
var bookingUid = product.booking_uid || ((_product$
|
|
2811
|
+
var productUid = ((_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.unique_identification_number) || product.unique_identification_number;
|
|
2812
|
+
var bookingUid = product.booking_uid || ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.booking_uid);
|
|
2682
2813
|
var linkedBooking = (productUid !== undefined && productUid !== null && String(productUid) !== '' ? bookingByProductUid.get(String(productUid)) : undefined) || (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '' ? bookingByBookingUid.get(String(bookingUid)) : undefined);
|
|
2683
2814
|
if (linkedBooking) {
|
|
2684
2815
|
_this16.setProductHolderFromBooking(product, linkedBooking);
|
|
@@ -2817,11 +2948,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2817
2948
|
}, {
|
|
2818
2949
|
key: "removeLinkedBookingsForProduct",
|
|
2819
2950
|
value: function removeLinkedBookingsForProduct(tempOrder, product) {
|
|
2820
|
-
var _product$
|
|
2821
|
-
_product$
|
|
2951
|
+
var _product$metadata5,
|
|
2952
|
+
_product$metadata6,
|
|
2822
2953
|
_this18 = this;
|
|
2823
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
2824
|
-
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$
|
|
2954
|
+
var productUid = (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
2955
|
+
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid);
|
|
2825
2956
|
if (!productUid && !bookingUid) return;
|
|
2826
2957
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
2827
2958
|
var currentBookingUid = _this18.getBookingUniqueIdentificationNumber(booking);
|
|
@@ -2841,9 +2972,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2841
2972
|
}, {
|
|
2842
2973
|
key: "applyOrderProductsDepositSummary",
|
|
2843
2974
|
value: function applyOrderProductsDepositSummary(tempOrder, summary) {
|
|
2844
|
-
var _tempOrder$
|
|
2975
|
+
var _tempOrder$_extend8;
|
|
2845
2976
|
var depositSummary = calculateOrderProductsDeposit(tempOrder.products || [], {
|
|
2846
|
-
productsByUid: (_tempOrder$
|
|
2977
|
+
productsByUid: (_tempOrder$_extend8 = tempOrder._extend) === null || _tempOrder$_extend8 === void 0 ? void 0 : _tempOrder$_extend8.productsByUid
|
|
2847
2978
|
});
|
|
2848
2979
|
var manualDepositOverride = this.getManualDepositOverride(tempOrder);
|
|
2849
2980
|
var currentStructuralFingerprint = manualDepositOverride ? this.buildOrderProductsStructuralFingerprint(tempOrder.products) : '';
|
|
@@ -3804,8 +3935,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3804
3935
|
}, {
|
|
3805
3936
|
key: "hasLinkedBookingUid",
|
|
3806
3937
|
value: function hasLinkedBookingUid(product) {
|
|
3807
|
-
var _product$booking_uid, _product$
|
|
3808
|
-
var bookingUid = (_product$booking_uid = product === null || product === void 0 ? void 0 : product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : product === null || product === void 0 || (_product$
|
|
3938
|
+
var _product$booking_uid, _product$metadata7;
|
|
3939
|
+
var bookingUid = (_product$booking_uid = product === null || product === void 0 ? void 0 : product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : product === null || product === void 0 || (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid;
|
|
3809
3940
|
return bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '';
|
|
3810
3941
|
}
|
|
3811
3942
|
|
|
@@ -3904,13 +4035,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3904
4035
|
normalizedIncoming.discount_list = normalizeOrderProductDiscountList(normalizedIncoming.discount_list);
|
|
3905
4036
|
var hasIncomingGoodPass = this.hasGoodPassDiscount(normalizedIncoming);
|
|
3906
4037
|
var hasIncomingProductNote = this.hasOrderProductLineNote(normalizedIncoming);
|
|
4038
|
+
var hasIncomingManualProductDiscount = isManualProductDiscountProduct(normalizedIncoming);
|
|
3907
4039
|
var hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
|
|
3908
4040
|
var isIncomingCustomItem = ((_productToAdd$metadat = productToAdd.metadata) === null || _productToAdd$metadat === void 0 || (_productToAdd$metadat = _productToAdd$metadat.origin) === null || _productToAdd$metadat === void 0 ? void 0 : _productToAdd$metadat.isCustomItem) === true || ((_origin = productToAdd._origin) === null || _origin === void 0 ? void 0 : _origin.isCustomItem) === true;
|
|
3909
|
-
var shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
|
|
4041
|
+
var shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
|
|
3910
4042
|
var matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
|
|
3911
4043
|
var _item$metadata3;
|
|
3912
4044
|
if (_this27.hasGoodPassDiscount(item)) return false;
|
|
3913
4045
|
if (_this27.hasOrderProductLineNote(item)) return false;
|
|
4046
|
+
if (isManualProductDiscountProduct(item)) return false;
|
|
3914
4047
|
if (item.order_detail_id !== undefined && item.order_detail_id !== null) return false;
|
|
3915
4048
|
if ((_item$metadata3 = item.metadata) !== null && _item$metadata3 !== void 0 && _item$metadata3.is_edit_for_runtime) return false;
|
|
3916
4049
|
if (item.product_id !== productToAdd.product_id) return false;
|
|
@@ -3946,10 +4079,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3946
4079
|
})));
|
|
3947
4080
|
normalizedProduct.discount_list = normalizeOrderProductDiscountList(normalizedProduct.discount_list);
|
|
3948
4081
|
var nextNum = getSafeProductNum(targetProduct.num + normalizedProduct.num);
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
tempOrder.products[matchedIndex] = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, targetProduct), normalizedProduct), {}, {
|
|
3952
|
-
discount_list: nextDiscountList,
|
|
4082
|
+
tempOrder.products[matchedIndex] = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), normalizedProduct), {}, {
|
|
4083
|
+
discount_list: normalizedProduct.discount_list,
|
|
3953
4084
|
metadata: _objectSpread(_objectSpread(_objectSpread({}, targetProduct.metadata || {}), normalizedProduct.metadata || {}), {}, {
|
|
3954
4085
|
unique_identification_number: targetUid
|
|
3955
4086
|
}),
|
|
@@ -3959,15 +4090,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
3959
4090
|
option: []
|
|
3960
4091
|
}), {}, {
|
|
3961
4092
|
option: getProductSkuOptions(normalizedProduct)
|
|
3962
|
-
})
|
|
3963
|
-
}, targetIsManualProductDiscount ? {
|
|
3964
|
-
selling_price: targetProduct.selling_price,
|
|
3965
|
-
original_price: targetProduct.original_price,
|
|
3966
|
-
payment_price: targetProduct.payment_price,
|
|
3967
|
-
metadata: _objectSpread(_objectSpread(_objectSpread({}, normalizedProduct.metadata || {}), targetProduct.metadata || {}), {}, {
|
|
3968
|
-
unique_identification_number: targetUid
|
|
3969
|
-
})
|
|
3970
|
-
} : {}), {}, {
|
|
4093
|
+
}),
|
|
3971
4094
|
note: targetProduct.note,
|
|
3972
4095
|
order_detail_id: targetProduct.order_detail_id,
|
|
3973
4096
|
num: nextNum
|
|
@@ -4538,6 +4661,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4538
4661
|
case 0:
|
|
4539
4662
|
product_id = params.product_id, product_variant_id = params.product_variant_id, num = params.num, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key, product_sku = params.product_sku, product_bundle = params.product_bundle;
|
|
4540
4663
|
tempOrder = this.ensureTempOrder();
|
|
4664
|
+
this.repairDuplicateProductLineIdentities(tempOrder);
|
|
4541
4665
|
identityLookup = {
|
|
4542
4666
|
product_id: product_id,
|
|
4543
4667
|
product_variant_id: product_variant_id
|
|
@@ -4563,11 +4687,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4563
4687
|
productIndex = getProductIdentityIndex(tempOrder.products, identityLookup);
|
|
4564
4688
|
}
|
|
4565
4689
|
if (!(productIndex === -1)) {
|
|
4566
|
-
_context25.next =
|
|
4690
|
+
_context25.next = 13;
|
|
4567
4691
|
break;
|
|
4568
4692
|
}
|
|
4569
4693
|
throw new Error('[Order] 目标商品不存在,无法更新数量');
|
|
4570
|
-
case
|
|
4694
|
+
case 13:
|
|
4571
4695
|
targetProduct = tempOrder.products[productIndex];
|
|
4572
4696
|
normalizedProduct = normalizeOrderProduct(_objectSpread(_objectSpread({}, targetProduct), {}, {
|
|
4573
4697
|
num: getSafeProductNum(num),
|
|
@@ -4577,22 +4701,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4577
4701
|
}));
|
|
4578
4702
|
normalizedProduct.discount_list = normalizeOrderProductDiscountList(normalizedProduct.discount_list);
|
|
4579
4703
|
tempOrder.products[productIndex] = normalizedProduct;
|
|
4580
|
-
_context25.next =
|
|
4704
|
+
_context25.next = 19;
|
|
4581
4705
|
return this.applyPromotion();
|
|
4582
|
-
case
|
|
4706
|
+
case 19:
|
|
4583
4707
|
this.applyDiscount();
|
|
4584
4708
|
this.sanitizeTempOrderProducts(tempOrder);
|
|
4585
|
-
_context25.next =
|
|
4709
|
+
_context25.next = 23;
|
|
4586
4710
|
return this.recalculateSummary({
|
|
4587
4711
|
createIfMissing: true
|
|
4588
4712
|
});
|
|
4589
|
-
case
|
|
4713
|
+
case 23:
|
|
4590
4714
|
this.persistTempOrder();
|
|
4591
4715
|
this.logInfo('updateOrderProductQuantity success', {
|
|
4592
4716
|
params: params
|
|
4593
4717
|
});
|
|
4594
4718
|
return _context25.abrupt("return", tempOrder.products);
|
|
4595
|
-
case
|
|
4719
|
+
case 26:
|
|
4596
4720
|
case "end":
|
|
4597
4721
|
return _context25.stop();
|
|
4598
4722
|
}
|
|
@@ -4685,12 +4809,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4685
4809
|
while (1) switch (_context28.prev = _context28.next) {
|
|
4686
4810
|
case 0:
|
|
4687
4811
|
tempOrder = this.ensureTempOrder();
|
|
4812
|
+
this.repairDuplicateProductLineIdentities(tempOrder);
|
|
4688
4813
|
if (identities.length) {
|
|
4689
|
-
_context28.next =
|
|
4814
|
+
_context28.next = 4;
|
|
4690
4815
|
break;
|
|
4691
4816
|
}
|
|
4692
4817
|
return _context28.abrupt("return", tempOrder.products);
|
|
4693
|
-
case
|
|
4818
|
+
case 4:
|
|
4694
4819
|
productsBeforeRemove = tempOrder.products || [];
|
|
4695
4820
|
bookingsBeforeRemove = tempOrder.bookings || [];
|
|
4696
4821
|
preserveDisplayPosition = options === null || options === void 0 ? void 0 : options.preserveDisplayPosition;
|
|
@@ -4719,7 +4844,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4719
4844
|
}
|
|
4720
4845
|
linkedBookingUidsToRemove = new Set();
|
|
4721
4846
|
_iterator21 = _createForOfIteratorHelper(matchedProducts);
|
|
4722
|
-
_context28.prev =
|
|
4847
|
+
_context28.prev = 15;
|
|
4723
4848
|
_loop3 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop3() {
|
|
4724
4849
|
var _metadata11, _metadata12, _metadata13, _metadata14;
|
|
4725
4850
|
var product, productUid, productBookingUid, isAddTimeProduct;
|
|
@@ -4754,33 +4879,33 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4754
4879
|
}, _loop3);
|
|
4755
4880
|
});
|
|
4756
4881
|
_iterator21.s();
|
|
4757
|
-
case
|
|
4882
|
+
case 18:
|
|
4758
4883
|
if ((_step21 = _iterator21.n()).done) {
|
|
4759
|
-
_context28.next =
|
|
4884
|
+
_context28.next = 24;
|
|
4760
4885
|
break;
|
|
4761
4886
|
}
|
|
4762
|
-
return _context28.delegateYield(_loop3(), "t0",
|
|
4763
|
-
case
|
|
4887
|
+
return _context28.delegateYield(_loop3(), "t0", 20);
|
|
4888
|
+
case 20:
|
|
4764
4889
|
if (!_context28.t0) {
|
|
4765
|
-
_context28.next =
|
|
4890
|
+
_context28.next = 22;
|
|
4766
4891
|
break;
|
|
4767
4892
|
}
|
|
4768
|
-
return _context28.abrupt("continue",
|
|
4769
|
-
case
|
|
4770
|
-
_context28.next =
|
|
4893
|
+
return _context28.abrupt("continue", 22);
|
|
4894
|
+
case 22:
|
|
4895
|
+
_context28.next = 18;
|
|
4771
4896
|
break;
|
|
4772
|
-
case
|
|
4773
|
-
_context28.next =
|
|
4897
|
+
case 24:
|
|
4898
|
+
_context28.next = 29;
|
|
4774
4899
|
break;
|
|
4775
|
-
case
|
|
4776
|
-
_context28.prev =
|
|
4777
|
-
_context28.t1 = _context28["catch"](
|
|
4900
|
+
case 26:
|
|
4901
|
+
_context28.prev = 26;
|
|
4902
|
+
_context28.t1 = _context28["catch"](15);
|
|
4778
4903
|
_iterator21.e(_context28.t1);
|
|
4779
|
-
case
|
|
4780
|
-
_context28.prev =
|
|
4904
|
+
case 29:
|
|
4905
|
+
_context28.prev = 29;
|
|
4781
4906
|
_iterator21.f();
|
|
4782
|
-
return _context28.finish(
|
|
4783
|
-
case
|
|
4907
|
+
return _context28.finish(29);
|
|
4908
|
+
case 32:
|
|
4784
4909
|
if (linkedBookingUidsToRemove.size > 0) {
|
|
4785
4910
|
// 删除主预约商品时,同步移除挂在同一 booking_uid 下的加时商品,避免残留孤儿行。
|
|
4786
4911
|
tempOrder.products = (tempOrder.products || []).filter(function (line) {
|
|
@@ -4806,18 +4931,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4806
4931
|
tempOrder.products = nextProductIndex >= 0 ? [].concat(_toConsumableArray(productsWithoutRemaining.slice(0, nextProductIndex)), [remainingProduct], _toConsumableArray(productsWithoutRemaining.slice(nextProductIndex))) : [].concat(_toConsumableArray(productsWithoutRemaining), [remainingProduct]);
|
|
4807
4932
|
}
|
|
4808
4933
|
}
|
|
4809
|
-
_context28.next =
|
|
4934
|
+
_context28.next = 36;
|
|
4810
4935
|
return this.finalizeAfterProductsMutation(tempOrder);
|
|
4811
|
-
case
|
|
4936
|
+
case 36:
|
|
4812
4937
|
this.logInfo('removeProductsFromOrder success', {
|
|
4813
4938
|
identities: identities
|
|
4814
4939
|
});
|
|
4815
4940
|
return _context28.abrupt("return", tempOrder.products);
|
|
4816
|
-
case
|
|
4941
|
+
case 38:
|
|
4817
4942
|
case "end":
|
|
4818
4943
|
return _context28.stop();
|
|
4819
4944
|
}
|
|
4820
|
-
}, _callee25, this, [[
|
|
4945
|
+
}, _callee25, this, [[15, 26, 29, 32]]);
|
|
4821
4946
|
}));
|
|
4822
4947
|
function removeProductsFromOrder(_x31, _x32) {
|
|
4823
4948
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
@@ -5915,36 +6040,83 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5915
6040
|
key: "hydrateTempOrderFromRecord",
|
|
5916
6041
|
value: (function () {
|
|
5917
6042
|
var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(record, options) {
|
|
5918
|
-
var _this$store$
|
|
5919
|
-
var sourceRaw, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, nextTempOrder, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$
|
|
6043
|
+
var _sourceRaw$_extend, _this$store$discount22;
|
|
6044
|
+
var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, nextTempOrder, _this$store$discount20, _this$store$discount21, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount23, _this$store$discount24;
|
|
5920
6045
|
return _regeneratorRuntime().wrap(function _callee42$(_context45) {
|
|
5921
6046
|
while (1) switch (_context45.prev = _context45.next) {
|
|
5922
6047
|
case 0:
|
|
5923
6048
|
sourceRaw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
|
|
5924
|
-
|
|
6049
|
+
duplicateProductIdentityRepair = repairDuplicateOrderProductLineIdentities(Array.isArray(sourceRaw.products) ? sourceRaw.products : [], (_sourceRaw$_extend = sourceRaw._extend) === null || _sourceRaw$_extend === void 0 ? void 0 : _sourceRaw$_extend.productsByUid);
|
|
6050
|
+
duplicateIdentityReadySource = duplicateProductIdentityRepair.repairs.length ? _objectSpread(_objectSpread({}, sourceRaw), {}, {
|
|
6051
|
+
products: duplicateProductIdentityRepair.products
|
|
6052
|
+
}, duplicateProductIdentityRepair.productsByUid ? {
|
|
6053
|
+
_extend: _objectSpread(_objectSpread({}, sourceRaw._extend || {}), {}, {
|
|
6054
|
+
productsByUid: duplicateProductIdentityRepair.productsByUid
|
|
6055
|
+
})
|
|
6056
|
+
} : {}) : sourceRaw;
|
|
6057
|
+
identityReadySource = this.seedAnonymousBookingUidsFromProducts(duplicateIdentityReadySource);
|
|
5925
6058
|
normalizedCollections = normalizeOrderCollections(identityReadySource);
|
|
5926
6059
|
raw = normalizedCollections.order;
|
|
5927
|
-
hasIdentityChanges = Object.values(normalizedCollections.stats).some(function (stats) {
|
|
6060
|
+
hasIdentityChanges = duplicateProductIdentityRepair.repairs.length > 0 || Object.values(normalizedCollections.stats).some(function (stats) {
|
|
5928
6061
|
return stats.backfilledUidCount > 0 || stats.collapsedDuplicateCount > 0 || stats.uidConflictCount > 0 || stats.anonymousRowCount > 0;
|
|
5929
6062
|
});
|
|
5930
6063
|
if (hasIdentityChanges) {
|
|
5931
6064
|
identityLogMetadata = {
|
|
5932
6065
|
collections: normalizedCollections.stats,
|
|
5933
|
-
uidRemapCount: normalizedCollections.uidRemaps.length
|
|
6066
|
+
uidRemapCount: normalizedCollections.uidRemaps.length,
|
|
6067
|
+
duplicateProductUidRepairCount: duplicateProductIdentityRepair.repairs.length
|
|
5934
6068
|
};
|
|
5935
6069
|
hasIdentityWarnings = Object.values(normalizedCollections.stats).some(function (stats) {
|
|
5936
6070
|
return stats.uidConflictCount > 0 || stats.anonymousRowCount > 0;
|
|
5937
|
-
});
|
|
6071
|
+
}) || duplicateProductIdentityRepair.repairs.length > 0;
|
|
5938
6072
|
if (hasIdentityWarnings) {
|
|
5939
6073
|
this.logWarning('Normalized hydrated order collection identities', identityLogMetadata);
|
|
5940
6074
|
} else {
|
|
5941
6075
|
this.logInfo('Normalized hydrated order collection identities', identityLogMetadata);
|
|
5942
6076
|
}
|
|
5943
6077
|
}
|
|
6078
|
+
isSessionStorageHydrate = (options === null || options === void 0 ? void 0 : options.source) === 'sessionStorage';
|
|
5944
6079
|
nextTempOrder = this.normalizeTempOrderForRuntime(raw, {
|
|
5945
|
-
makeEditMark:
|
|
5946
|
-
});
|
|
5947
|
-
|
|
6080
|
+
makeEditMark: !isSessionStorageHydrate
|
|
6081
|
+
});
|
|
6082
|
+
this.store.tempOrder = nextTempOrder;
|
|
6083
|
+
if (!isSessionStorageHydrate) {
|
|
6084
|
+
_context45.next = 29;
|
|
6085
|
+
break;
|
|
6086
|
+
}
|
|
6087
|
+
// 会话快照是未提交购物车,不应获得编辑订单的 saved/edit 标记与服务端基线。
|
|
6088
|
+
restoredSessionDiscounts = Array.isArray(raw.discount_list) ? cloneDeep(raw.discount_list) : [];
|
|
6089
|
+
nextExtend = _objectSpread({}, nextTempOrder._extend || {});
|
|
6090
|
+
delete nextExtend.originalSalesSnapshot;
|
|
6091
|
+
nextTempOrder._extend = nextExtend;
|
|
6092
|
+
nextTempOrder.products.forEach(function (product) {
|
|
6093
|
+
if (product.metadata) {
|
|
6094
|
+
delete product.metadata.is_edit_for_runtime;
|
|
6095
|
+
}
|
|
6096
|
+
});
|
|
6097
|
+
nextTempOrder.discount_list = restoredSessionDiscounts;
|
|
6098
|
+
this.store.summary = createEmptySummary();
|
|
6099
|
+
this.store.lastOrderInfo = undefined;
|
|
6100
|
+
_context45.next = 22;
|
|
6101
|
+
return (_this$store$discount20 = this.store.discount) === null || _this$store$discount20 === void 0 ? void 0 : _this$store$discount20.setOriginalDiscountList(cloneDeep(restoredSessionDiscounts));
|
|
6102
|
+
case 22:
|
|
6103
|
+
_context45.next = 24;
|
|
6104
|
+
return (_this$store$discount21 = this.store.discount) === null || _this$store$discount21 === void 0 ? void 0 : _this$store$discount21.setDiscountList(cloneDeep(restoredSessionDiscounts));
|
|
6105
|
+
case 24:
|
|
6106
|
+
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
6107
|
+
_context45.next = 27;
|
|
6108
|
+
break;
|
|
6109
|
+
}
|
|
6110
|
+
_context45.next = 27;
|
|
6111
|
+
return this.recalculateSummary({
|
|
6112
|
+
createIfMissing: false
|
|
6113
|
+
});
|
|
6114
|
+
case 27:
|
|
6115
|
+
this.persistTempOrder();
|
|
6116
|
+
return _context45.abrupt("return", nextTempOrder);
|
|
6117
|
+
case 29:
|
|
6118
|
+
// Server list compatibility may synthesize order_id from external_sale_number; tempOrder must not.
|
|
6119
|
+
sourceLastOrderInfo = sourceRaw.lastOrderInfo || sourceRaw;
|
|
5948
6120
|
isDraftOrder = Number(nextTempOrder.is_draft_order || 0) === 1;
|
|
5949
6121
|
syntheticIdentityOptions = {
|
|
5950
6122
|
isDraftOrder: isDraftOrder,
|
|
@@ -5954,7 +6126,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5954
6126
|
summarySurcharges = Array.isArray(rawSummary.surcharges) ? rawSummary.surcharges.map(function (s) {
|
|
5955
6127
|
return _objectSpread({}, s || {});
|
|
5956
6128
|
}) : cloneDeep(nextTempOrder.surcharges || []);
|
|
5957
|
-
this.store.tempOrder = nextTempOrder;
|
|
5958
6129
|
this.store.summary = _objectSpread(_objectSpread(_objectSpread({}, createEmptySummary()), rawSummary), {}, {
|
|
5959
6130
|
surcharges: summarySurcharges
|
|
5960
6131
|
});
|
|
@@ -5975,7 +6146,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5975
6146
|
this.store.syncState = 'local';
|
|
5976
6147
|
}
|
|
5977
6148
|
hydratedEditDiscounts = this.collectHydratedEditDiscounts(nextTempOrder.products);
|
|
5978
|
-
currentDiscounts = typeof ((_this$store$
|
|
6149
|
+
currentDiscounts = typeof ((_this$store$discount22 = this.store.discount) === null || _this$store$discount22 === void 0 ? void 0 : _this$store$discount22.getDiscountList) === 'function' ? this.store.discount.getDiscountList() || [] : [];
|
|
5979
6150
|
currentScanDiscounts = currentDiscounts.filter(function (discount) {
|
|
5980
6151
|
return discount === null || discount === void 0 ? void 0 : discount.isScan;
|
|
5981
6152
|
});
|
|
@@ -5988,28 +6159,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5988
6159
|
nextDiscounts = [].concat(_toConsumableArray(hydratedEditDiscounts), _toConsumableArray(retainedScanDiscounts));
|
|
5989
6160
|
shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
|
|
5990
6161
|
if (shouldSkipEmptyDiscountSync) {
|
|
5991
|
-
_context45.next =
|
|
6162
|
+
_context45.next = 52;
|
|
5992
6163
|
break;
|
|
5993
6164
|
}
|
|
5994
6165
|
OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
|
|
5995
|
-
_context45.next =
|
|
5996
|
-
return (_this$store$
|
|
5997
|
-
case
|
|
5998
|
-
_context45.next =
|
|
5999
|
-
return (_this$store$
|
|
6000
|
-
case
|
|
6166
|
+
_context45.next = 50;
|
|
6167
|
+
return (_this$store$discount23 = this.store.discount) === null || _this$store$discount23 === void 0 ? void 0 : _this$store$discount23.setOriginalDiscountList(nextDiscounts);
|
|
6168
|
+
case 50:
|
|
6169
|
+
_context45.next = 52;
|
|
6170
|
+
return (_this$store$discount24 = this.store.discount) === null || _this$store$discount24 === void 0 ? void 0 : _this$store$discount24.setDiscountList(nextDiscounts);
|
|
6171
|
+
case 52:
|
|
6001
6172
|
if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
|
|
6002
|
-
_context45.next =
|
|
6173
|
+
_context45.next = 55;
|
|
6003
6174
|
break;
|
|
6004
6175
|
}
|
|
6005
|
-
_context45.next =
|
|
6176
|
+
_context45.next = 55;
|
|
6006
6177
|
return this.recalculateSummary({
|
|
6007
6178
|
createIfMissing: false
|
|
6008
6179
|
});
|
|
6009
|
-
case
|
|
6180
|
+
case 55:
|
|
6010
6181
|
this.persistTempOrder();
|
|
6011
6182
|
return _context45.abrupt("return", nextTempOrder);
|
|
6012
|
-
case
|
|
6183
|
+
case 57:
|
|
6013
6184
|
case "end":
|
|
6014
6185
|
return _context45.stop();
|
|
6015
6186
|
}
|
|
@@ -6068,10 +6239,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6068
6239
|
_step22;
|
|
6069
6240
|
try {
|
|
6070
6241
|
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
|
|
6071
|
-
var _product$
|
|
6242
|
+
var _product$metadata8;
|
|
6072
6243
|
var product = _step22.value;
|
|
6073
6244
|
var productUid = getOrderCollectionUid('product', product);
|
|
6074
|
-
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$
|
|
6245
|
+
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.booking_uid);
|
|
6075
6246
|
if (!productUid || bookingUid === undefined || bookingUid === null || bookingUid === '') {
|
|
6076
6247
|
continue;
|
|
6077
6248
|
}
|
|
@@ -6188,11 +6359,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6188
6359
|
_step24;
|
|
6189
6360
|
try {
|
|
6190
6361
|
for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {
|
|
6191
|
-
var _product$
|
|
6362
|
+
var _product$metadata9, _ref75, _ref76, _existed$origin, _rawProduct$metadata;
|
|
6192
6363
|
var _step24$value = _slicedToArray(_step24.value, 2),
|
|
6193
6364
|
index = _step24$value[0],
|
|
6194
6365
|
product = _step24$value[1];
|
|
6195
|
-
var uid = (_product$
|
|
6366
|
+
var uid = (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.unique_identification_number;
|
|
6196
6367
|
if (!uid) continue;
|
|
6197
6368
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
6198
6369
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
@@ -6247,8 +6418,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6247
6418
|
var bookingUidByProductUid = new Map();
|
|
6248
6419
|
var productByUid = new Map();
|
|
6249
6420
|
(tempOrder.products || []).forEach(function (product) {
|
|
6250
|
-
var _product$
|
|
6251
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
6421
|
+
var _product$metadata10;
|
|
6422
|
+
var productUid = (product === null || product === void 0 || (_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
6252
6423
|
if (productUid !== undefined && productUid !== null && String(productUid) !== '') {
|
|
6253
6424
|
productByUid.set(String(productUid), product);
|
|
6254
6425
|
}
|
|
@@ -6269,8 +6440,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6269
6440
|
bookingUidByProductUid.set(String(productUid), bookingUid);
|
|
6270
6441
|
});
|
|
6271
6442
|
(tempOrder.products || []).forEach(function (product) {
|
|
6272
|
-
var _product$
|
|
6273
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
6443
|
+
var _product$metadata11;
|
|
6444
|
+
var productUid = (product === null || product === void 0 || (_product$metadata11 = product.metadata) === null || _product$metadata11 === void 0 ? void 0 : _product$metadata11.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
6274
6445
|
if (productUid === undefined || productUid === null || String(productUid) === '') return;
|
|
6275
6446
|
var bookingUid = bookingUidByProductUid.get(String(productUid));
|
|
6276
6447
|
if (!bookingUid) return;
|