@pisell/pisellos 2.1.171 → 2.1.173
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/index.d.ts +0 -4
- package/dist/model/strategy/adapter/index.js +1 -5
- package/dist/modules/Discount/index.d.ts +2 -5
- package/dist/modules/Discount/index.js +1 -21
- package/dist/modules/Discount/types.d.ts +0 -4
- package/dist/modules/Order/index.d.ts +0 -1
- package/dist/modules/Order/index.js +6 -18
- package/dist/modules/Order/types.d.ts +0 -2
- package/dist/modules/ProductList/index.d.ts +1 -3
- package/dist/modules/ProductList/index.js +11 -22
- package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/ScanOrder/index.js +1 -1
- package/dist/solution/ShopDiscount/index.js +15 -16
- package/dist/solution/VenueBooking/index.d.ts +3 -59
- package/dist/solution/VenueBooking/index.js +299 -771
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -3
- package/lib/model/strategy/adapter/index.d.ts +0 -4
- package/lib/model/strategy/adapter/index.js +2 -13
- package/lib/modules/Discount/index.d.ts +2 -5
- package/lib/modules/Discount/index.js +1 -11
- package/lib/modules/Discount/types.d.ts +0 -4
- package/lib/modules/Order/index.d.ts +0 -1
- package/lib/modules/Order/index.js +1 -11
- package/lib/modules/Order/types.d.ts +0 -2
- package/lib/modules/ProductList/index.d.ts +1 -3
- package/lib/modules/ProductList/index.js +40 -46
- package/lib/modules/Schedule/getDateIsInSchedule.js +0 -4
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/ScanOrder/index.js +1 -1
- package/lib/solution/ShopDiscount/index.js +2 -3
- package/lib/solution/VenueBooking/index.d.ts +3 -59
- package/lib/solution/VenueBooking/index.js +111 -550
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +0 -1
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +10 -5
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -3
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +3 -7
- package/package.json +2 -2
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -180
|
@@ -45,7 +45,6 @@ import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
|
|
|
45
45
|
import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
|
|
46
46
|
import { buildDateRangeSummary } from "./utils/dateSummary";
|
|
47
47
|
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
|
|
48
|
-
import { buildSlotPriceMapByScheduleSegments, formatProductsWithDataVariant, getPriceForProductAtDatetime, getSlotPriceFromMap } from "./utils/smartPricing";
|
|
49
48
|
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
50
49
|
import { OrderModule } from "../../modules/Order";
|
|
51
50
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
@@ -99,15 +98,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
99
98
|
_defineProperty(_assertThisInitialized(_this), "loginEffectDisposers", []);
|
|
100
99
|
_defineProperty(_assertThisInitialized(_this), "customerLoginRefreshInFlight", null);
|
|
101
100
|
_defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
|
|
102
|
-
/** 最近一次确认登录的客户;登录事件与 user 插件更新之间可能存在时序差。 */
|
|
103
|
-
_defineProperty(_assertThisInitialized(_this), "smartPricingCustomerId", void 0);
|
|
104
101
|
_defineProperty(_assertThisInitialized(_this), "loadAllProductsInFlight", null);
|
|
105
102
|
_defineProperty(_assertThisInitialized(_this), "productsLoaded", false);
|
|
106
103
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
|
|
107
|
-
/** 按日期缓存 slot 智能定价 Map,避免同周重复 resolveProducts */
|
|
108
|
-
_defineProperty(_assertThisInitialized(_this), "slotPriceMapCache", new Map());
|
|
109
|
-
/** loadProducts 后缓存的全量商品(venue + addon),供分段算价复用 */
|
|
110
|
-
_defineProperty(_assertThisInitialized(_this), "smartPricingProductCatalog", []);
|
|
111
104
|
return _this;
|
|
112
105
|
}
|
|
113
106
|
_createClass(VenueBookingImpl, [{
|
|
@@ -214,95 +207,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
214
207
|
}
|
|
215
208
|
return addVenueBookingLog;
|
|
216
209
|
}()
|
|
217
|
-
/**
|
|
218
|
-
* 临时线上排查日志:
|
|
219
|
-
* - 仅对指定页面 cacheId 开启,避免影响其他页面
|
|
220
|
-
* - 不 await,且吞掉日志上报异常,保证日志系统不会阻断登录/商品加载主流程
|
|
221
|
-
*/
|
|
222
|
-
}, {
|
|
223
|
-
key: "logPricingDiagnostics",
|
|
224
|
-
value: function logPricingDiagnostics(title) {
|
|
225
|
-
var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
226
|
-
if (!this.isPricingDiagnosticsEnabled()) return;
|
|
227
|
-
void this.addVenueBookingLog({
|
|
228
|
-
level: 'info',
|
|
229
|
-
title: title,
|
|
230
|
-
payload: payload
|
|
231
|
-
}).catch(function (error) {
|
|
232
|
-
console.warn('[VenueBooking] pricing diagnostic log failed', error);
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
}, {
|
|
236
|
-
key: "isPricingDiagnosticsEnabled",
|
|
237
|
-
value: function isPricingDiagnosticsEnabled() {
|
|
238
|
-
return String(this.cacheId || '') === VenueBookingImpl.PRICING_DEBUG_CACHE_ID;
|
|
239
|
-
}
|
|
240
|
-
}, {
|
|
241
|
-
key: "getAvailableWalletIdsForDiagnostics",
|
|
242
|
-
value: function getAvailableWalletIdsForDiagnostics() {
|
|
243
|
-
try {
|
|
244
|
-
var _this$store$order, _this$store$order$get;
|
|
245
|
-
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getAvailableWalletIds) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
|
|
246
|
-
} catch (error) {
|
|
247
|
-
return {
|
|
248
|
-
readFailed: true,
|
|
249
|
-
error: this.serializeError(error)
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}, {
|
|
254
|
-
key: "getOrderPricingSnapshotForDiagnostics",
|
|
255
|
-
value: function getOrderPricingSnapshotForDiagnostics() {
|
|
256
|
-
try {
|
|
257
|
-
var _this$store$order2;
|
|
258
|
-
var products = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2 = _this$store$order2.getTempOrder()) === null || _this$store$order2 === void 0 ? void 0 : _this$store$order2.products;
|
|
259
|
-
if (!Array.isArray(products)) return [];
|
|
260
|
-
return products.map(function (product) {
|
|
261
|
-
var _product$metadata, _product$metadata2, _product$metadata3, _product$metadata4, _product$metadata5, _product$metadata6;
|
|
262
|
-
return {
|
|
263
|
-
productId: product === null || product === void 0 ? void 0 : product.product_id,
|
|
264
|
-
resourceId: product === null || product === void 0 || (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id,
|
|
265
|
-
isVenueBooking: !!(product !== null && product !== void 0 && (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking),
|
|
266
|
-
sellingPrice: product === null || product === void 0 ? void 0 : product.selling_price,
|
|
267
|
-
originalPrice: product === null || product === void 0 ? void 0 : product.original_price,
|
|
268
|
-
sourceProductPrice: product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price,
|
|
269
|
-
mainProductOriginalPrice: product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_original_price,
|
|
270
|
-
mainProductSellingPrice: product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.main_product_selling_price,
|
|
271
|
-
priceBreakdown: product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.price_breakdown,
|
|
272
|
-
discountList: product === null || product === void 0 ? void 0 : product.discount_list
|
|
273
|
-
};
|
|
274
|
-
});
|
|
275
|
-
} catch (error) {
|
|
276
|
-
return [{
|
|
277
|
-
readFailed: true,
|
|
278
|
-
error: this.serializeError(error)
|
|
279
|
-
}];
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}, {
|
|
283
|
-
key: "getCatalogPricingSnapshotForDiagnostics",
|
|
284
|
-
value: function getCatalogPricingSnapshotForDiagnostics() {
|
|
285
|
-
var orderProductIds = new Set(this.getOrderPricingSnapshotForDiagnostics().map(function (product) {
|
|
286
|
-
return Number(product.productId);
|
|
287
|
-
}).filter(function (productId) {
|
|
288
|
-
return Number.isFinite(productId);
|
|
289
|
-
}));
|
|
290
|
-
return this.getAllProductsForSmartPricing().filter(function (product) {
|
|
291
|
-
return orderProductIds.has(Number(product === null || product === void 0 ? void 0 : product.id));
|
|
292
|
-
}).map(function (product) {
|
|
293
|
-
return {
|
|
294
|
-
productId: product === null || product === void 0 ? void 0 : product.id,
|
|
295
|
-
price: product === null || product === void 0 ? void 0 : product.price,
|
|
296
|
-
sellingPrice: product === null || product === void 0 ? void 0 : product.selling_price,
|
|
297
|
-
dataVariants: Array.isArray(product === null || product === void 0 ? void 0 : product.data_variants) ? product.data_variants.map(function (variant) {
|
|
298
|
-
return {
|
|
299
|
-
ruleId: variant === null || variant === void 0 ? void 0 : variant.data_variant_rule_id,
|
|
300
|
-
data: variant === null || variant === void 0 ? void 0 : variant.data
|
|
301
|
-
};
|
|
302
|
-
}) : []
|
|
303
|
-
};
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
210
|
}, {
|
|
307
211
|
key: "logMethodStart",
|
|
308
212
|
value: function logMethodStart(method) {
|
|
@@ -417,9 +321,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
417
321
|
}, {
|
|
418
322
|
key: "registerCustomerLoginListeners",
|
|
419
323
|
value: function registerCustomerLoginListeners() {
|
|
420
|
-
var
|
|
324
|
+
var _this$core2,
|
|
325
|
+
_this$core3,
|
|
326
|
+
_accountModule$getCur,
|
|
327
|
+
_accountModule$getAcc,
|
|
328
|
+
_this2 = this;
|
|
421
329
|
this.clearLoginEffectListeners();
|
|
422
|
-
var
|
|
330
|
+
var accountModule = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.getModule('account');
|
|
331
|
+
var registerAndLoginModule = (_this$core3 = this.core) === null || _this$core3 === void 0 ? void 0 : _this$core3.getModule('registerAndLogin');
|
|
332
|
+
var currentAccount = (accountModule === null || accountModule === void 0 || (_accountModule$getCur = accountModule.getCurrentAccount) === null || _accountModule$getCur === void 0 ? void 0 : _accountModule$getCur.call(accountModule)) || (accountModule === null || accountModule === void 0 || (_accountModule$getAcc = accountModule.getAccount) === null || _accountModule$getAcc === void 0 ? void 0 : _accountModule$getAcc.call(accountModule)) || null;
|
|
333
|
+
var createHandleLogin = function createHandleLogin(eventName) {
|
|
423
334
|
return /*#__PURE__*/function () {
|
|
424
335
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(payload) {
|
|
425
336
|
var customerId;
|
|
@@ -448,16 +359,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
448
359
|
};
|
|
449
360
|
}();
|
|
450
361
|
};
|
|
451
|
-
this.registerLoginEffect(
|
|
452
|
-
this.registerLoginEffect(
|
|
453
|
-
this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, createHandleLogin());
|
|
362
|
+
this.registerLoginEffect(AccountHooks.OnLogin, createHandleLogin(AccountHooks.OnLogin));
|
|
363
|
+
this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, createHandleLogin(RegisterAndLoginHooks.onLoginSuccess));
|
|
454
364
|
}
|
|
455
365
|
}, {
|
|
456
366
|
key: "refreshOrderMarketingAfterLogin",
|
|
457
367
|
value: function () {
|
|
458
368
|
var _refreshOrderMarketingAfterLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
459
369
|
var _this3 = this;
|
|
460
|
-
var
|
|
370
|
+
var refreshTask;
|
|
461
371
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
462
372
|
while (1) switch (_context5.prev = _context5.next) {
|
|
463
373
|
case 0:
|
|
@@ -467,226 +377,83 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
467
377
|
}
|
|
468
378
|
throw new Error('order 模块未初始化');
|
|
469
379
|
case 2:
|
|
470
|
-
pricingDiagnosticsEnabled = this.isPricingDiagnosticsEnabled();
|
|
471
|
-
if (pricingDiagnosticsEnabled) {
|
|
472
|
-
this.logPricingDiagnostics('[VenueBooking] refreshOrderMarketingAfterLogin entered', {
|
|
473
|
-
customerId: params.customerId,
|
|
474
|
-
hasCustomerLoginRefreshInFlight: !!this.customerLoginRefreshInFlight,
|
|
475
|
-
customerLoginRefreshIdInFlight: this.customerLoginRefreshIdInFlight,
|
|
476
|
-
hasLoadAllProductsInFlight: !!this.loadAllProductsInFlight,
|
|
477
|
-
productsLoaded: this.productsLoaded,
|
|
478
|
-
smartPricingProductCatalogCount: this.smartPricingProductCatalog.length,
|
|
479
|
-
note: 'This login refresh reloads products with the confirmed customer context before recalculation'
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
380
|
if (!this.customerLoginRefreshInFlight) {
|
|
483
|
-
_context5.next =
|
|
381
|
+
_context5.next = 9;
|
|
484
382
|
break;
|
|
485
383
|
}
|
|
486
384
|
if (!(this.customerLoginRefreshIdInFlight === params.customerId)) {
|
|
487
|
-
_context5.next =
|
|
385
|
+
_context5.next = 7;
|
|
488
386
|
break;
|
|
489
387
|
}
|
|
490
|
-
_context5.next =
|
|
388
|
+
_context5.next = 6;
|
|
491
389
|
return this.customerLoginRefreshInFlight;
|
|
492
|
-
case
|
|
390
|
+
case 6:
|
|
493
391
|
return _context5.abrupt("return");
|
|
494
|
-
case
|
|
495
|
-
_context5.next =
|
|
392
|
+
case 7:
|
|
393
|
+
_context5.next = 9;
|
|
496
394
|
return this.customerLoginRefreshInFlight;
|
|
497
|
-
case
|
|
395
|
+
case 9:
|
|
498
396
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
499
397
|
refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
500
|
-
var _this3$
|
|
501
|
-
var productsLoadBeforeLogin, loginProducts, _smartPricingContext$, _smartPricingContext$2, _smartPricingContext$3, _smartPricingContext$4, _this3$smartPricingPr, smartPricingContext, strategyConfigs, _getTempOrder;
|
|
398
|
+
var _this3$otherParams;
|
|
502
399
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
503
400
|
while (1) switch (_context4.prev = _context4.next) {
|
|
504
401
|
case 0:
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
if (pricingDiagnosticsEnabled) {
|
|
508
|
-
_this3.logPricingDiagnostics('[VenueBooking] login pricing customer context set', {
|
|
509
|
-
customerId: params.customerId,
|
|
510
|
-
userPluginCustomerId: _this3.resolveCustomerIdForSmartPricing(),
|
|
511
|
-
availableWalletIdsBeforeDiscountConfig: _this3.getAvailableWalletIdsForDiagnostics(),
|
|
512
|
-
orderProductsBeforeDiscountConfig: _this3.getOrderPricingSnapshotForDiagnostics()
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
_context4.next = 4;
|
|
516
|
-
return _this3.store.order.loadDiscountConfig({
|
|
517
|
-
customerId: params.customerId
|
|
518
|
-
});
|
|
519
|
-
case 4:
|
|
520
|
-
if (!pricingDiagnosticsEnabled) {
|
|
521
|
-
_context4.next = 21;
|
|
402
|
+
if (!_this3.store.quotation) {
|
|
403
|
+
_context4.next = 3;
|
|
522
404
|
break;
|
|
523
405
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
_context4.next = 16;
|
|
528
|
-
break;
|
|
529
|
-
}
|
|
530
|
-
_this3.logPricingDiagnostics('[VenueBooking] login waiting for previous product load', {
|
|
531
|
-
customerId: params.customerId
|
|
406
|
+
_context4.next = 3;
|
|
407
|
+
return _this3.store.quotation.loadQuotations({
|
|
408
|
+
channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
|
|
532
409
|
});
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
break;
|
|
539
|
-
case 13:
|
|
540
|
-
_context4.prev = 13;
|
|
541
|
-
_context4.t0 = _context4["catch"](8);
|
|
542
|
-
_this3.logPricingDiagnostics('[VenueBooking] previous product load failed before login reload', {
|
|
543
|
-
customerId: params.customerId,
|
|
544
|
-
error: _this3.serializeError(_context4.t0)
|
|
545
|
-
});
|
|
546
|
-
case 16:
|
|
547
|
-
_this3.logPricingDiagnostics('[VenueBooking] login product reload starting', {
|
|
548
|
-
customerId: params.customerId,
|
|
549
|
-
productsLoadedBeforeReload: _this3.productsLoaded,
|
|
550
|
-
catalogCountBeforeReload: _this3.smartPricingProductCatalog.length,
|
|
551
|
-
availableWalletIds: _this3.getAvailableWalletIdsForDiagnostics()
|
|
552
|
-
});
|
|
553
|
-
_context4.next = 19;
|
|
554
|
-
return _this3.loadAllProducts();
|
|
555
|
-
case 19:
|
|
556
|
-
loginProducts = _context4.sent;
|
|
557
|
-
_this3.logPricingDiagnostics('[VenueBooking] login product reload completed', {
|
|
558
|
-
customerId: params.customerId,
|
|
559
|
-
venueProductCount: loginProducts.venueProducts.length,
|
|
560
|
-
addonProductCount: loginProducts.addonProducts.length,
|
|
561
|
-
catalogCountAfterReload: _this3.smartPricingProductCatalog.length,
|
|
562
|
-
resourceProductMapSize: _this3.resourceProductMap.size
|
|
410
|
+
case 3:
|
|
411
|
+
_this3.recalculateOrderPricesFromQuotation();
|
|
412
|
+
_context4.next = 6;
|
|
413
|
+
return _this3.store.order.loadDiscountConfig({
|
|
414
|
+
customerId: params.customerId
|
|
563
415
|
});
|
|
564
|
-
case
|
|
565
|
-
|
|
566
|
-
smartPricingContext = _this3.buildSmartPricingContext();
|
|
567
|
-
strategyConfigs = ((_smartPricingContext$ = smartPricingContext.evaluator) === null || _smartPricingContext$ === void 0 || (_smartPricingContext$2 = _smartPricingContext$.getStrategyConfigs) === null || _smartPricingContext$2 === void 0 ? void 0 : _smartPricingContext$2.call(_smartPricingContext$)) || [];
|
|
568
|
-
_this3.logPricingDiagnostics('[VenueBooking] login discount config loaded', {
|
|
569
|
-
customerId: params.customerId,
|
|
570
|
-
availableWalletIdsAfterDiscountConfig: _this3.getAvailableWalletIdsForDiagnostics(),
|
|
571
|
-
discountList: _this3.store.order.getDiscountList(),
|
|
572
|
-
smartPricingContext: {
|
|
573
|
-
customerId: smartPricingContext.customerId,
|
|
574
|
-
availableWalletIds: smartPricingContext.availableWalletIds,
|
|
575
|
-
channel: smartPricingContext.channel,
|
|
576
|
-
businessCode: smartPricingContext.businessCode,
|
|
577
|
-
orderType: smartPricingContext.orderType,
|
|
578
|
-
scheduleCount: ((_smartPricingContext$3 = smartPricingContext.scheduleList) === null || _smartPricingContext$3 === void 0 ? void 0 : _smartPricingContext$3.length) || 0,
|
|
579
|
-
menuCount: ((_smartPricingContext$4 = smartPricingContext.menuList) === null || _smartPricingContext$4 === void 0 ? void 0 : _smartPricingContext$4.length) || 0,
|
|
580
|
-
hasEvaluator: !!smartPricingContext.evaluator
|
|
581
|
-
},
|
|
582
|
-
strategyConfigs: strategyConfigs.map(function (config) {
|
|
583
|
-
var _config$metadata, _config$metadata2, _config$metadata3, _config$metadata4;
|
|
584
|
-
return {
|
|
585
|
-
ruleId: config === null || config === void 0 || (_config$metadata = config.metadata) === null || _config$metadata === void 0 ? void 0 : _config$metadata.id,
|
|
586
|
-
name: config === null || config === void 0 || (_config$metadata2 = config.metadata) === null || _config$metadata2 === void 0 ? void 0 : _config$metadata2.name,
|
|
587
|
-
status: config === null || config === void 0 || (_config$metadata3 = config.metadata) === null || _config$metadata3 === void 0 || (_config$metadata3 = _config$metadata3.custom) === null || _config$metadata3 === void 0 ? void 0 : _config$metadata3.status,
|
|
588
|
-
priority: config === null || config === void 0 || (_config$metadata4 = config.metadata) === null || _config$metadata4 === void 0 || (_config$metadata4 = _config$metadata4.custom) === null || _config$metadata4 === void 0 ? void 0 : _config$metadata4.priority,
|
|
589
|
-
conditions: config === null || config === void 0 ? void 0 : config.conditions
|
|
590
|
-
};
|
|
591
|
-
}),
|
|
592
|
-
productsLoaded: _this3.productsLoaded,
|
|
593
|
-
smartPricingProductCatalogCount: (_this3$smartPricingPr = _this3.smartPricingProductCatalog) === null || _this3$smartPricingPr === void 0 ? void 0 : _this3$smartPricingPr.length,
|
|
594
|
-
resourceProductMapSize: _this3.resourceProductMap.size,
|
|
595
|
-
matchingCatalogProducts: _this3.getCatalogPricingSnapshotForDiagnostics()
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
_this3.clearSlotPriceMapCache();
|
|
599
|
-
if (pricingDiagnosticsEnabled) {
|
|
600
|
-
_this3.logPricingDiagnostics('[VenueBooking] login smart pricing recalculation starting', {
|
|
601
|
-
slotPriceMapCacheSizeAfterClear: _this3.slotPriceMapCache.size,
|
|
602
|
-
orderProductsBeforeRecalculation: _this3.getOrderPricingSnapshotForDiagnostics()
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
_this3.recalculateOrderPricesFromSmartPricing();
|
|
606
|
-
if (pricingDiagnosticsEnabled) {
|
|
607
|
-
_this3.logPricingDiagnostics('[VenueBooking] login smart pricing recalculation completed', {
|
|
608
|
-
orderProductsAfterRecalculation: _this3.getOrderPricingSnapshotForDiagnostics()
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
// loadDiscountConfig 会按登录前的订单价格预计算一次券;智能价更新后必须用新的
|
|
613
|
-
// source/main 价格字段重新套券,否则购物车行价与 Summary 会使用两套基数。
|
|
614
|
-
_this3.store.order.applyDiscount();
|
|
615
|
-
_this3.normalizeDiscountedOrderPrices(_this3.store.order.getDiscountList());
|
|
616
|
-
if (pricingDiagnosticsEnabled) {
|
|
617
|
-
_this3.logPricingDiagnostics('[VenueBooking] login discounts reapplied', {
|
|
618
|
-
discountList: _this3.store.order.getDiscountList(),
|
|
619
|
-
orderProductsAfterDiscount: _this3.getOrderPricingSnapshotForDiagnostics()
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
_context4.next = 31;
|
|
416
|
+
case 6:
|
|
417
|
+
_context4.next = 8;
|
|
623
418
|
return _this3.store.order.recalculateSummary({
|
|
624
419
|
createIfMissing: true
|
|
625
420
|
});
|
|
626
|
-
case
|
|
421
|
+
case 8:
|
|
627
422
|
_this3.store.order.persistTempOrder();
|
|
628
|
-
|
|
629
|
-
_this3.logPricingDiagnostics('[VenueBooking] login pricing summary persisted', {
|
|
630
|
-
summary: (_getTempOrder = _this3.store.order.getTempOrder()) === null || _getTempOrder === void 0 ? void 0 : _getTempOrder.summary,
|
|
631
|
-
orderProducts: _this3.getOrderPricingSnapshotForDiagnostics()
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
_context4.next = 35;
|
|
423
|
+
_context4.next = 11;
|
|
635
424
|
return _this3.refreshItemRuleQuantityLimits();
|
|
636
|
-
case
|
|
637
|
-
_context4.next =
|
|
425
|
+
case 11:
|
|
426
|
+
_context4.next = 13;
|
|
638
427
|
return _this3.refreshCartValidationPassed();
|
|
639
|
-
case
|
|
640
|
-
_context4.next = 39;
|
|
641
|
-
return (_this3$core = _this3.core) === null || _this3$core === void 0 || (_this3$core = _this3$core.effects) === null || _this3$core === void 0 || (_this3$core$emit = _this3$core.emit) === null || _this3$core$emit === void 0 ? void 0 : _this3$core$emit.call(_this3$core, VenueBookingHooks.onSmartPricingUpdated, {
|
|
642
|
-
customerId: params.customerId
|
|
643
|
-
});
|
|
644
|
-
case 39:
|
|
645
|
-
if (pricingDiagnosticsEnabled) {
|
|
646
|
-
_this3.logPricingDiagnostics('[VenueBooking] login smart pricing update emitted', {
|
|
647
|
-
customerId: params.customerId,
|
|
648
|
-
cartValidation: _this3.store.cartValidation
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
case 40:
|
|
428
|
+
case 13:
|
|
652
429
|
case "end":
|
|
653
430
|
return _context4.stop();
|
|
654
431
|
}
|
|
655
|
-
}, _callee4
|
|
432
|
+
}, _callee4);
|
|
656
433
|
}))();
|
|
657
434
|
this.customerLoginRefreshInFlight = refreshTask;
|
|
658
|
-
_context5.prev =
|
|
659
|
-
_context5.next =
|
|
435
|
+
_context5.prev = 12;
|
|
436
|
+
_context5.next = 15;
|
|
660
437
|
return refreshTask;
|
|
661
|
-
case
|
|
662
|
-
_context5.next =
|
|
438
|
+
case 15:
|
|
439
|
+
_context5.next = 20;
|
|
663
440
|
break;
|
|
664
|
-
case
|
|
665
|
-
_context5.prev =
|
|
666
|
-
_context5.t0 = _context5["catch"](
|
|
667
|
-
if (pricingDiagnosticsEnabled) {
|
|
668
|
-
this.logPricingDiagnostics('[VenueBooking] login smart pricing refresh failed', {
|
|
669
|
-
customerId: params.customerId,
|
|
670
|
-
error: this.serializeError(_context5.t0),
|
|
671
|
-
productsLoaded: this.productsLoaded,
|
|
672
|
-
smartPricingProductCatalogCount: this.smartPricingProductCatalog.length,
|
|
673
|
-
resourceProductMapSize: this.resourceProductMap.size,
|
|
674
|
-
orderProducts: this.getOrderPricingSnapshotForDiagnostics()
|
|
675
|
-
});
|
|
676
|
-
}
|
|
441
|
+
case 17:
|
|
442
|
+
_context5.prev = 17;
|
|
443
|
+
_context5.t0 = _context5["catch"](12);
|
|
677
444
|
throw _context5.t0;
|
|
678
|
-
case
|
|
679
|
-
_context5.prev =
|
|
445
|
+
case 20:
|
|
446
|
+
_context5.prev = 20;
|
|
680
447
|
if (this.customerLoginRefreshInFlight === refreshTask) {
|
|
681
448
|
this.customerLoginRefreshInFlight = null;
|
|
682
449
|
this.customerLoginRefreshIdInFlight = null;
|
|
683
450
|
}
|
|
684
|
-
return _context5.finish(
|
|
685
|
-
case
|
|
451
|
+
return _context5.finish(20);
|
|
452
|
+
case 23:
|
|
686
453
|
case "end":
|
|
687
454
|
return _context5.stop();
|
|
688
455
|
}
|
|
689
|
-
}, _callee5, this, [[
|
|
456
|
+
}, _callee5, this, [[12, 17, 20, 23]]);
|
|
690
457
|
}));
|
|
691
458
|
function refreshOrderMarketingAfterLogin(_x4) {
|
|
692
459
|
return _refreshOrderMarketingAfterLogin.apply(this, arguments);
|
|
@@ -713,8 +480,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
713
480
|
scheduleModule,
|
|
714
481
|
quotationModule,
|
|
715
482
|
openDataModule,
|
|
716
|
-
_this$store$
|
|
717
|
-
_this$store$
|
|
483
|
+
_this$store$order,
|
|
484
|
+
_this$store$order2,
|
|
485
|
+
_this$store$quotation,
|
|
486
|
+
_this$otherParams6,
|
|
718
487
|
_args6 = arguments;
|
|
719
488
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
720
489
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -724,7 +493,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
724
493
|
this.core = core;
|
|
725
494
|
this.initializeOptions = options || {};
|
|
726
495
|
this.store = _objectSpread(_objectSpread({}, this.store), options.store);
|
|
727
|
-
this.smartPricingCustomerId = undefined;
|
|
728
496
|
this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
|
|
729
497
|
this.store.status = 'initializing';
|
|
730
498
|
this.store.error = null;
|
|
@@ -745,19 +513,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
745
513
|
this.window = core.getPlugin('window');
|
|
746
514
|
this.request = core.getPlugin('request');
|
|
747
515
|
if (this.window) {
|
|
748
|
-
_context6.next =
|
|
516
|
+
_context6.next = 24;
|
|
749
517
|
break;
|
|
750
518
|
}
|
|
751
519
|
this.logMethodError('initialize', 'window plugin missing');
|
|
752
520
|
throw new Error('venueBooking解决方案需要 window 插件支持');
|
|
753
|
-
case
|
|
521
|
+
case 24:
|
|
754
522
|
if (this.request) {
|
|
755
|
-
_context6.next =
|
|
523
|
+
_context6.next = 27;
|
|
756
524
|
break;
|
|
757
525
|
}
|
|
758
526
|
this.logMethodError('initialize', 'request plugin missing');
|
|
759
527
|
throw new Error('venueBooking解决方案需要 request 插件支持');
|
|
760
|
-
case
|
|
528
|
+
case 27:
|
|
761
529
|
// 注册基础模块(order, salesSummary, products, logger)
|
|
762
530
|
baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
|
|
763
531
|
baseModules.forEach(function (step) {
|
|
@@ -854,41 +622,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
854
622
|
}
|
|
855
623
|
this.registerCustomerLoginListeners();
|
|
856
624
|
console.log('[VenueBooking] 初始化开始');
|
|
857
|
-
_context6.prev =
|
|
858
|
-
_context6.next =
|
|
859
|
-
return (_this$store$
|
|
625
|
+
_context6.prev = 50;
|
|
626
|
+
_context6.next = 53;
|
|
627
|
+
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
860
628
|
createIfMissing: false
|
|
861
629
|
});
|
|
862
|
-
case
|
|
863
|
-
(_this$store$
|
|
864
|
-
_context6.next =
|
|
630
|
+
case 53:
|
|
631
|
+
(_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
|
|
632
|
+
_context6.next = 56;
|
|
865
633
|
return this.loadRuntimeConfigs();
|
|
866
|
-
case
|
|
634
|
+
case 56:
|
|
867
635
|
if (!this.store.schedule) {
|
|
868
|
-
_context6.next =
|
|
636
|
+
_context6.next = 61;
|
|
869
637
|
break;
|
|
870
638
|
}
|
|
871
|
-
_context6.next =
|
|
639
|
+
_context6.next = 59;
|
|
872
640
|
return this.store.schedule.loadAllSchedule();
|
|
873
|
-
case
|
|
874
|
-
|
|
641
|
+
case 59:
|
|
642
|
+
this.injectScheduleResolverToQuotation();
|
|
643
|
+
(_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
|
|
644
|
+
channel: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel
|
|
645
|
+
});
|
|
646
|
+
case 61:
|
|
647
|
+
_context6.next = 63;
|
|
875
648
|
return this.refreshItemRuleQuantityLimits();
|
|
876
|
-
case
|
|
649
|
+
case 63:
|
|
877
650
|
this.store.status = 'ready';
|
|
878
651
|
console.log('[VenueBooking] 初始化完成');
|
|
879
|
-
_context6.next =
|
|
652
|
+
_context6.next = 67;
|
|
880
653
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
881
654
|
status: this.store.status
|
|
882
655
|
});
|
|
883
|
-
case
|
|
656
|
+
case 67:
|
|
884
657
|
this.logMethodSuccess('initialize', {
|
|
885
658
|
status: this.store.status
|
|
886
659
|
});
|
|
887
|
-
_context6.next =
|
|
660
|
+
_context6.next = 77;
|
|
888
661
|
break;
|
|
889
|
-
case
|
|
890
|
-
_context6.prev =
|
|
891
|
-
_context6.t0 = _context6["catch"](
|
|
662
|
+
case 70:
|
|
663
|
+
_context6.prev = 70;
|
|
664
|
+
_context6.t0 = _context6["catch"](50);
|
|
892
665
|
this.store.status = 'error';
|
|
893
666
|
this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : '初始化失败';
|
|
894
667
|
console.error('[VenueBooking] 初始化失败', _context6.t0);
|
|
@@ -896,11 +669,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
896
669
|
status: this.store.status
|
|
897
670
|
});
|
|
898
671
|
throw _context6.t0;
|
|
899
|
-
case
|
|
672
|
+
case 77:
|
|
900
673
|
case "end":
|
|
901
674
|
return _context6.stop();
|
|
902
675
|
}
|
|
903
|
-
}, _callee6, this, [[
|
|
676
|
+
}, _callee6, this, [[50, 70]]);
|
|
904
677
|
}));
|
|
905
678
|
function initialize(_x5) {
|
|
906
679
|
return _initialize.apply(this, arguments);
|
|
@@ -1041,113 +814,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1041
814
|
};
|
|
1042
815
|
}
|
|
1043
816
|
|
|
1044
|
-
/** 清除 slot 价格分段缓存(商品重载 / 登录后 customerId 变化时调用) */
|
|
1045
|
-
}, {
|
|
1046
|
-
key: "clearSlotPriceMapCache",
|
|
1047
|
-
value: function clearSlotPriceMapCache() {
|
|
1048
|
-
this.slotPriceMapCache.clear();
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
/** 读取当前登录 customerId */
|
|
1052
|
-
}, {
|
|
1053
|
-
key: "resolveCustomerIdForSmartPricing",
|
|
1054
|
-
value: function resolveCustomerIdForSmartPricing() {
|
|
1055
|
-
if (this.smartPricingCustomerId) return this.smartPricingCustomerId;
|
|
1056
|
-
try {
|
|
1057
|
-
var _this$core2, _userPlugin$get;
|
|
1058
|
-
var userPlugin = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.getPlugin('user');
|
|
1059
|
-
var customerId = Number(userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get) === null || _userPlugin$get === void 0 || (_userPlugin$get = _userPlugin$get.call(userPlugin)) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id);
|
|
1060
|
-
return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
|
|
1061
|
-
} catch (_unused2) {
|
|
1062
|
-
return undefined;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
}, {
|
|
1066
|
-
key: "resolveAvailableWalletIdsForSmartPricing",
|
|
1067
|
-
value: function resolveAvailableWalletIdsForSmartPricing() {
|
|
1068
|
-
var _this$store$order5, _this$store$order5$ge, _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
|
|
1069
|
-
var orderWalletIds = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || (_this$store$order5$ge = _this$store$order5.getAvailableWalletIds) === null || _this$store$order5$ge === void 0 ? void 0 : _this$store$order5$ge.call(_this$store$order5);
|
|
1070
|
-
var fallbackWalletIds = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.available_wallet_ids) || ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.availableWalletIds) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 || (_this$otherParams8 = _this$otherParams8.strategy_context) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.available_wallet_ids) || ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 || (_this$otherParams9 = _this$otherParams9.strategy_context) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.availableWalletIds);
|
|
1071
|
-
var source = Array.isArray(orderWalletIds) && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
|
|
1072
|
-
if (!Array.isArray(source)) return [];
|
|
1073
|
-
var ids = source.map(function (item) {
|
|
1074
|
-
return Number(item);
|
|
1075
|
-
}).filter(function (item) {
|
|
1076
|
-
return Number.isFinite(item) && item > 0;
|
|
1077
|
-
});
|
|
1078
|
-
return Array.from(new Set(ids));
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
/** 读取 schedule 全量列表,供智能定价 schedule_match 使用 */
|
|
1082
|
-
}, {
|
|
1083
|
-
key: "getScheduleListForSmartPricing",
|
|
1084
|
-
value: function getScheduleListForSmartPricing() {
|
|
1085
|
-
var _store;
|
|
1086
|
-
var scheduleModule = this.store.schedule;
|
|
1087
|
-
var list = scheduleModule === null || scheduleModule === void 0 || (_store = scheduleModule.store) === null || _store === void 0 ? void 0 : _store.scheduleList;
|
|
1088
|
-
return Array.isArray(list) ? list : [];
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
/** 构建智能定价上下文,对齐 OS Server buildProductFormatterContext */
|
|
1092
|
-
}, {
|
|
1093
|
-
key: "buildSmartPricingContext",
|
|
1094
|
-
value: function buildSmartPricingContext(customerId) {
|
|
1095
|
-
var _this$core3, _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16;
|
|
1096
|
-
var evaluator = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.dataVariantEvaluator;
|
|
1097
|
-
return {
|
|
1098
|
-
evaluator: evaluator,
|
|
1099
|
-
scheduleList: this.getScheduleListForSmartPricing(),
|
|
1100
|
-
menuList: ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.menuList) || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 || (_this$otherParams11 = _this$otherParams11.openData) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.menuList) || [],
|
|
1101
|
-
customerId: customerId !== null && customerId !== void 0 ? customerId : this.resolveCustomerIdForSmartPricing(),
|
|
1102
|
-
availableWalletIds: this.resolveAvailableWalletIdsForSmartPricing(),
|
|
1103
|
-
channel: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.channel,
|
|
1104
|
-
businessCode: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.businessCode,
|
|
1105
|
-
orderType: ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.orderType) || ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.type),
|
|
1106
|
-
strategy_context: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.strategy_context
|
|
1107
|
-
};
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
/** venue + addon 全量商品,供智能定价评估 */
|
|
1111
|
-
}, {
|
|
1112
|
-
key: "getAllProductsForSmartPricing",
|
|
1113
|
-
value: function getAllProductsForSmartPricing() {
|
|
1114
|
-
if (this.smartPricingProductCatalog.length) {
|
|
1115
|
-
return this.smartPricingProductCatalog;
|
|
1116
|
-
}
|
|
1117
|
-
var venueList = this.getVenueProducts();
|
|
1118
|
-
var addonList = this.getAddonProductsList();
|
|
1119
|
-
return [].concat(_toConsumableArray(venueList), _toConsumableArray(addonList));
|
|
1120
|
-
}
|
|
1121
|
-
}, {
|
|
1122
|
-
key: "getSlotPriceMapCacheKey",
|
|
1123
|
-
value: function getSlotPriceMapCacheKey(date, context) {
|
|
1124
|
-
var _context$customerId, _context$channel, _context$businessCode;
|
|
1125
|
-
return [date, (_context$customerId = context.customerId) !== null && _context$customerId !== void 0 ? _context$customerId : '', (context.availableWalletIds || []).join(','), (_context$channel = context.channel) !== null && _context$channel !== void 0 ? _context$channel : '', (_context$businessCode = context.businessCode) !== null && _context$businessCode !== void 0 ? _context$businessCode : ''].join('|');
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
/**
|
|
1129
|
-
* 按 schedule 分段构建 slot 价格 Map,带实例级缓存。
|
|
1130
|
-
*/
|
|
1131
|
-
}, {
|
|
1132
|
-
key: "buildSlotPriceMapForDate",
|
|
1133
|
-
value: function buildSlotPriceMapForDate(date, config, productIds) {
|
|
1134
|
-
var context = this.buildSmartPricingContext();
|
|
1135
|
-
var cacheKey = this.getSlotPriceMapCacheKey(date, context);
|
|
1136
|
-
var cached = this.slotPriceMapCache.get(cacheKey);
|
|
1137
|
-
if (cached) return cached;
|
|
1138
|
-
var timeLabels = generateTimeLabels(config);
|
|
1139
|
-
var slotPriceMap = buildSlotPriceMapByScheduleSegments({
|
|
1140
|
-
products: this.getAllProductsForSmartPricing(),
|
|
1141
|
-
productIds: productIds,
|
|
1142
|
-
date: date,
|
|
1143
|
-
timeLabels: timeLabels,
|
|
1144
|
-
config: config,
|
|
1145
|
-
context: context
|
|
1146
|
-
});
|
|
1147
|
-
this.slotPriceMapCache.set(cacheKey, slotPriceMap);
|
|
1148
|
-
return slotPriceMap;
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
817
|
// ─── 场地商品 & 附加商品 ───
|
|
1152
818
|
}, {
|
|
1153
819
|
key: "loadAllProducts",
|
|
@@ -1182,7 +848,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1182
848
|
key: "_doLoadAllProducts",
|
|
1183
849
|
value: function () {
|
|
1184
850
|
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
1185
|
-
var _this$
|
|
851
|
+
var _this$otherParams7, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
|
|
1186
852
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1187
853
|
while (1) switch (_context11.prev = _context11.next) {
|
|
1188
854
|
case 0:
|
|
@@ -1203,7 +869,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1203
869
|
_context11.next = 8;
|
|
1204
870
|
return this.loadOpenDataConfig();
|
|
1205
871
|
case 8:
|
|
1206
|
-
associatedMenus = ((_this$
|
|
872
|
+
associatedMenus = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.openData) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus']) || [];
|
|
1207
873
|
if (associatedMenus.length) {
|
|
1208
874
|
_context11.next = 12;
|
|
1209
875
|
break;
|
|
@@ -1219,16 +885,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1219
885
|
menu_list_ids: menuListIds,
|
|
1220
886
|
cacheId: this.cacheId,
|
|
1221
887
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
1222
|
-
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
1223
|
-
with_extra: ['dataVariants']
|
|
888
|
+
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
1224
889
|
});
|
|
1225
890
|
case 15:
|
|
1226
891
|
allProducts = _context11.sent;
|
|
1227
|
-
|
|
1228
|
-
list = rawList;
|
|
1229
|
-
this.smartPricingProductCatalog = rawList.slice();
|
|
1230
|
-
list = formatProductsWithDataVariant(list, this.buildSmartPricingContext(), dayjs().format('YYYY-MM-DD HH:mm:ss'));
|
|
1231
|
-
this.clearSlotPriceMapCache();
|
|
892
|
+
list = Array.isArray(allProducts) ? allProducts : [];
|
|
1232
893
|
venueList = list.filter(function (p) {
|
|
1233
894
|
return p.duration != null;
|
|
1234
895
|
});
|
|
@@ -1254,16 +915,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1254
915
|
venueProducts: venueList,
|
|
1255
916
|
addonProducts: addonList
|
|
1256
917
|
});
|
|
1257
|
-
case
|
|
1258
|
-
_context11.prev =
|
|
918
|
+
case 28:
|
|
919
|
+
_context11.prev = 28;
|
|
1259
920
|
_context11.t0 = _context11["catch"](1);
|
|
1260
921
|
this.logMethodError('loadAllProducts', _context11.t0);
|
|
1261
922
|
throw _context11.t0;
|
|
1262
|
-
case
|
|
923
|
+
case 32:
|
|
1263
924
|
case "end":
|
|
1264
925
|
return _context11.stop();
|
|
1265
926
|
}
|
|
1266
|
-
}, _callee11, this, [[1,
|
|
927
|
+
}, _callee11, this, [[1, 28]]);
|
|
1267
928
|
}));
|
|
1268
929
|
function _doLoadAllProducts() {
|
|
1269
930
|
return _doLoadAllProducts2.apply(this, arguments);
|
|
@@ -1582,11 +1243,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1582
1243
|
config: this.baseSlotConfig,
|
|
1583
1244
|
rawResources: this.store.rawResourceData,
|
|
1584
1245
|
resourceProductMap: this.resourceProductMap,
|
|
1246
|
+
quotationModule: this.store.quotation,
|
|
1585
1247
|
resolveConfig: function resolveConfig(date) {
|
|
1586
1248
|
return _this6.resolveSlotConfigForDate(date);
|
|
1587
|
-
},
|
|
1588
|
-
buildSlotPriceMap: function buildSlotPriceMap(date, config, productIds) {
|
|
1589
|
-
return _this6.buildSlotPriceMapForDate(date, config, productIds);
|
|
1590
1249
|
}
|
|
1591
1250
|
});
|
|
1592
1251
|
}
|
|
@@ -1594,16 +1253,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1594
1253
|
key: "getTimeSlotGrid",
|
|
1595
1254
|
value: function getTimeSlotGrid(date) {
|
|
1596
1255
|
var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
|
|
1597
|
-
var
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1256
|
+
var quotationPriceMap;
|
|
1257
|
+
if (this.store.quotation) {
|
|
1258
|
+
var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
|
|
1259
|
+
return m.productId;
|
|
1260
|
+
})));
|
|
1261
|
+
var timeLabels = generateTimeLabels(resolvedSlotConfig);
|
|
1262
|
+
var timePoints = timeLabels.map(function (label) {
|
|
1263
|
+
return "".concat(date, " ").concat(label);
|
|
1264
|
+
});
|
|
1265
|
+
quotationPriceMap = this.store.quotation.buildProductPriceMap({
|
|
1266
|
+
productIds: productIds,
|
|
1267
|
+
timePoints: timePoints
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1601
1270
|
return buildTimeSlotGrid({
|
|
1602
1271
|
date: date,
|
|
1603
1272
|
config: resolvedSlotConfig,
|
|
1604
1273
|
rawResources: this.store.rawResourceData,
|
|
1605
1274
|
resourceProductMap: this.resourceProductMap,
|
|
1606
|
-
|
|
1275
|
+
quotationPriceMap: quotationPriceMap
|
|
1607
1276
|
});
|
|
1608
1277
|
}
|
|
1609
1278
|
|
|
@@ -1703,8 +1372,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1703
1372
|
}, {
|
|
1704
1373
|
key: "getSelectedSlotsForResource",
|
|
1705
1374
|
value: function getSelectedSlotsForResource(resourceId, productId) {
|
|
1706
|
-
var _this$store$
|
|
1707
|
-
var tempOrder = (_this$store$
|
|
1375
|
+
var _this$store$order3;
|
|
1376
|
+
var tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder();
|
|
1708
1377
|
if (!tempOrder) return [];
|
|
1709
1378
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1710
1379
|
var _p$metadata, _p$metadata2;
|
|
@@ -1865,9 +1534,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1865
1534
|
}, {
|
|
1866
1535
|
key: "getAllSelectedSlots",
|
|
1867
1536
|
value: function getAllSelectedSlots() {
|
|
1868
|
-
var _this$store$
|
|
1537
|
+
var _this$store$order4;
|
|
1869
1538
|
var result = new Map();
|
|
1870
|
-
var tempOrder = (_this$store$
|
|
1539
|
+
var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
|
|
1871
1540
|
if (!tempOrder) return result;
|
|
1872
1541
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1873
1542
|
var _p$metadata3;
|
|
@@ -1878,9 +1547,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1878
1547
|
_step9;
|
|
1879
1548
|
try {
|
|
1880
1549
|
var _loop2 = function _loop2() {
|
|
1881
|
-
var _product$
|
|
1550
|
+
var _product$metadata;
|
|
1882
1551
|
var product = _step9.value;
|
|
1883
|
-
var resourceId = (_product$
|
|
1552
|
+
var resourceId = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id;
|
|
1884
1553
|
if (resourceId == null) return 1; // continue
|
|
1885
1554
|
var productId = Number(product.product_id);
|
|
1886
1555
|
var existing = result.get(resourceId) || [];
|
|
@@ -2039,7 +1708,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2039
1708
|
booking_uid: bookingUuid,
|
|
2040
1709
|
price_breakdown: buildPriceBreakdown({
|
|
2041
1710
|
group: group,
|
|
2042
|
-
productId: mapping.productId
|
|
1711
|
+
productId: mapping.productId,
|
|
1712
|
+
quotation: this.store.quotation
|
|
2043
1713
|
})
|
|
2044
1714
|
},
|
|
2045
1715
|
_origin: {
|
|
@@ -2170,25 +1840,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2170
1840
|
_context18.next = 6;
|
|
2171
1841
|
return this.store.schedule.loadAllSchedule();
|
|
2172
1842
|
case 6:
|
|
1843
|
+
this.injectScheduleResolverToQuotation();
|
|
2173
1844
|
this.logMethodSuccess('loadSchedules');
|
|
2174
|
-
_context18.next =
|
|
1845
|
+
_context18.next = 14;
|
|
2175
1846
|
break;
|
|
2176
|
-
case
|
|
2177
|
-
_context18.prev =
|
|
1847
|
+
case 10:
|
|
1848
|
+
_context18.prev = 10;
|
|
2178
1849
|
_context18.t0 = _context18["catch"](1);
|
|
2179
1850
|
this.logMethodError('loadSchedules', _context18.t0);
|
|
2180
1851
|
throw _context18.t0;
|
|
2181
|
-
case
|
|
1852
|
+
case 14:
|
|
2182
1853
|
case "end":
|
|
2183
1854
|
return _context18.stop();
|
|
2184
1855
|
}
|
|
2185
|
-
}, _callee18, this, [[1,
|
|
1856
|
+
}, _callee18, this, [[1, 10]]);
|
|
2186
1857
|
}));
|
|
2187
1858
|
function loadSchedules() {
|
|
2188
1859
|
return _loadSchedules.apply(this, arguments);
|
|
2189
1860
|
}
|
|
2190
1861
|
return loadSchedules;
|
|
2191
1862
|
}()
|
|
1863
|
+
}, {
|
|
1864
|
+
key: "injectScheduleResolverToQuotation",
|
|
1865
|
+
value: function injectScheduleResolverToQuotation() {
|
|
1866
|
+
var _this9 = this;
|
|
1867
|
+
if (this.store.quotation && this.store.schedule) {
|
|
1868
|
+
this.store.quotation.setScheduleResolver(function (id) {
|
|
1869
|
+
return _this9.store.schedule.getScheduleListByIds([id])[0];
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
2192
1873
|
}, {
|
|
2193
1874
|
key: "getScheduleListByIds",
|
|
2194
1875
|
value: function getScheduleListByIds(ids) {
|
|
@@ -2200,8 +1881,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2200
1881
|
}, {
|
|
2201
1882
|
key: "getTempOrder",
|
|
2202
1883
|
value: function getTempOrder() {
|
|
2203
|
-
var _this$store$
|
|
2204
|
-
var result = ((_this$store$
|
|
1884
|
+
var _this$store$order5;
|
|
1885
|
+
var result = ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder()) || null;
|
|
2205
1886
|
return result;
|
|
2206
1887
|
}
|
|
2207
1888
|
}, {
|
|
@@ -2259,176 +1940,60 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2259
1940
|
}
|
|
2260
1941
|
return onCustomerLogin;
|
|
2261
1942
|
}()
|
|
2262
|
-
/**
|
|
2263
|
-
* 接收 pisell2 VenueBooking 登录链路诊断日志。
|
|
2264
|
-
* 实际是否上报仍由 OS 内部 cacheId 白名单统一控制。
|
|
2265
|
-
*/
|
|
2266
1943
|
}, {
|
|
2267
|
-
key: "
|
|
2268
|
-
value: function
|
|
2269
|
-
this.logPricingDiagnostics("[VenueBooking][pisell2] ".concat(String((params === null || params === void 0 ? void 0 : params.title) || 'diagnostic')), (params === null || params === void 0 ? void 0 : params.payload) || {});
|
|
2270
|
-
}
|
|
2271
|
-
}, {
|
|
2272
|
-
key: "recalculateOrderPricesFromSmartPricing",
|
|
2273
|
-
value: function recalculateOrderPricesFromSmartPricing() {
|
|
1944
|
+
key: "recalculateOrderPricesFromQuotation",
|
|
1945
|
+
value: function recalculateOrderPricesFromQuotation() {
|
|
2274
1946
|
var _tempOrder$products,
|
|
2275
|
-
|
|
2276
|
-
if (!this.store.order)
|
|
2277
|
-
this.logPricingDiagnostics('[VenueBooking] order smart pricing recalculation skipped', {
|
|
2278
|
-
reason: 'order module is missing'
|
|
2279
|
-
});
|
|
2280
|
-
return;
|
|
2281
|
-
}
|
|
1947
|
+
_this10 = this;
|
|
1948
|
+
if (!this.store.order || !this.store.quotation) return;
|
|
2282
1949
|
var tempOrder = this.store.order.getTempOrder();
|
|
2283
|
-
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length))
|
|
2284
|
-
this.logPricingDiagnostics('[VenueBooking] order smart pricing recalculation skipped', {
|
|
2285
|
-
reason: 'temp order has no products'
|
|
2286
|
-
});
|
|
2287
|
-
return;
|
|
2288
|
-
}
|
|
1950
|
+
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
2289
1951
|
var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
2290
|
-
var catalog = this.getAllProductsForSmartPricing();
|
|
2291
|
-
var context = this.buildSmartPricingContext();
|
|
2292
|
-
var productDiagnostics = this.isPricingDiagnosticsEnabled() ? [] : null;
|
|
2293
1952
|
var _iterator12 = _createForOfIteratorHelper(tempOrder.products),
|
|
2294
1953
|
_step12;
|
|
2295
1954
|
try {
|
|
2296
1955
|
var _loop4 = function _loop4() {
|
|
2297
|
-
var _product$
|
|
1956
|
+
var _product$metadata2;
|
|
2298
1957
|
var product = _step12.value;
|
|
2299
|
-
if ((_product$
|
|
2300
|
-
var mappings =
|
|
2301
|
-
if (!mappings || !mappings.length)
|
|
2302
|
-
productDiagnostics === null || productDiagnostics === void 0 || productDiagnostics.push({
|
|
2303
|
-
productId: product.product_id,
|
|
2304
|
-
resourceId: product.metadata.resource_id,
|
|
2305
|
-
originalSellingPrice: product.selling_price,
|
|
2306
|
-
result: 'skipped',
|
|
2307
|
-
reason: 'resourceProductMap has no mapping for resource'
|
|
2308
|
-
});
|
|
2309
|
-
return 0; // continue
|
|
2310
|
-
}
|
|
1958
|
+
if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
|
|
1959
|
+
var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
|
|
1960
|
+
if (!mappings || !mappings.length) return 0; // continue
|
|
2311
1961
|
var mapping = mappings.find(function (m) {
|
|
2312
1962
|
return Number(m.productId) === Number(product.product_id);
|
|
2313
1963
|
}) || mappings[0];
|
|
2314
|
-
if (!mapping)
|
|
2315
|
-
|
|
2316
|
-
productId: product.product_id,
|
|
2317
|
-
resourceId: product.metadata.resource_id,
|
|
2318
|
-
originalSellingPrice: product.selling_price,
|
|
2319
|
-
result: 'skipped',
|
|
2320
|
-
reason: 'no product mapping selected',
|
|
2321
|
-
mappings: mappings
|
|
2322
|
-
});
|
|
2323
|
-
return 0; // continue
|
|
2324
|
-
}
|
|
2325
|
-
var slots = expandMergedSlotToIndividual(product, _this9.store.slotConfig.slotDurationMinutes);
|
|
2326
|
-
var uniqueDates = _toConsumableArray(new Set(slots.map(function (slot) {
|
|
2327
|
-
return dayjs(slot.startTime).format('YYYY-MM-DD');
|
|
2328
|
-
})));
|
|
2329
|
-
var slotPriceMaps = new Map();
|
|
2330
|
-
var _iterator13 = _createForOfIteratorHelper(uniqueDates),
|
|
2331
|
-
_step13;
|
|
2332
|
-
try {
|
|
2333
|
-
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
2334
|
-
var slotDate = _step13.value;
|
|
2335
|
-
slotPriceMaps.set(slotDate, _this9.buildSlotPriceMapForDate(slotDate, _this9.store.slotConfig, [mapping.productId]));
|
|
2336
|
-
}
|
|
2337
|
-
} catch (err) {
|
|
2338
|
-
_iterator13.e(err);
|
|
2339
|
-
} finally {
|
|
2340
|
-
_iterator13.f();
|
|
2341
|
-
}
|
|
1964
|
+
if (!mapping) return 0; // continue
|
|
1965
|
+
var slots = expandMergedSlotToIndividual(product, _this10.store.slotConfig.slotDurationMinutes);
|
|
2342
1966
|
var updatedSlots = slots.map(function (slot) {
|
|
2343
|
-
var
|
|
2344
|
-
var slotPriceMap = slotPriceMaps.get(slotDate);
|
|
1967
|
+
var _getPriceForProduct;
|
|
2345
1968
|
return _objectSpread(_objectSpread({}, slot), {}, {
|
|
2346
1969
|
productId: mapping.productId,
|
|
2347
|
-
price:
|
|
2348
|
-
slotPriceMap: slotPriceMap,
|
|
1970
|
+
price: (_getPriceForProduct = _this10.store.quotation.getPriceForProduct({
|
|
2349
1971
|
productId: mapping.productId,
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
}) : mapping.price
|
|
1972
|
+
datetime: slot.startTime
|
|
1973
|
+
})) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
|
|
2353
1974
|
});
|
|
2354
1975
|
});
|
|
2355
1976
|
var merged = mergeConsecutiveSlots(updatedSlots);
|
|
2356
1977
|
if (merged.length === 1) {
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
productId: mapping.productId
|
|
2364
|
-
})
|
|
2365
|
-
});
|
|
2366
|
-
productDiagnostics === null || productDiagnostics === void 0 || productDiagnostics.push({
|
|
2367
|
-
productId: product.product_id,
|
|
2368
|
-
resourceId: product.metadata.resource_id,
|
|
2369
|
-
result: 'price reset',
|
|
2370
|
-
previousSellingPrice: previousSellingPrice,
|
|
2371
|
-
finalSellingPrice: product.selling_price,
|
|
2372
|
-
mapping: mapping,
|
|
2373
|
-
slots: updatedSlots,
|
|
2374
|
-
merged: merged,
|
|
2375
|
-
slotPriceMaps: Array.from(slotPriceMaps.entries()).map(function (_ref3) {
|
|
2376
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
2377
|
-
date = _ref4[0],
|
|
2378
|
-
priceMap = _ref4[1];
|
|
2379
|
-
return {
|
|
2380
|
-
date: date,
|
|
2381
|
-
entries: Array.from(priceMap.entries())
|
|
2382
|
-
};
|
|
2383
|
-
})
|
|
2384
|
-
});
|
|
2385
|
-
} else {
|
|
2386
|
-
productDiagnostics === null || productDiagnostics === void 0 || productDiagnostics.push({
|
|
2387
|
-
productId: product.product_id,
|
|
2388
|
-
resourceId: product.metadata.resource_id,
|
|
2389
|
-
originalSellingPrice: product.selling_price,
|
|
2390
|
-
result: 'skipped',
|
|
2391
|
-
reason: 'expanded slots did not merge into exactly one group',
|
|
2392
|
-
mapping: mapping,
|
|
2393
|
-
slots: updatedSlots,
|
|
2394
|
-
merged: merged
|
|
1978
|
+
product.selling_price = merged[0].totalPrice;
|
|
1979
|
+
product.original_price = merged[0].totalPrice;
|
|
1980
|
+
product.metadata.price_breakdown = buildPriceBreakdown({
|
|
1981
|
+
group: merged[0],
|
|
1982
|
+
productId: mapping.productId,
|
|
1983
|
+
quotation: _this10.store.quotation
|
|
2395
1984
|
});
|
|
2396
1985
|
}
|
|
2397
1986
|
} else if (product.product_id != null) {
|
|
2398
|
-
var
|
|
2399
|
-
|
|
2400
|
-
}) : undefined;
|
|
2401
|
-
var _previousSellingPrice = product === null || product === void 0 ? void 0 : product.selling_price;
|
|
2402
|
-
var smartPrice = getPriceForProductAtDatetime({
|
|
2403
|
-
products: catalog,
|
|
2404
|
-
context: context,
|
|
2405
|
-
productId: Number(product.product_id),
|
|
2406
|
-
datetime: now,
|
|
2407
|
-
fallbackPrice: product.selling_price
|
|
2408
|
-
});
|
|
2409
|
-
_this9.resetProductPriceForSmartPricing({
|
|
2410
|
-
product: product,
|
|
2411
|
-
price: smartPrice
|
|
2412
|
-
});
|
|
2413
|
-
productDiagnostics === null || productDiagnostics === void 0 || productDiagnostics.push({
|
|
2414
|
-
productId: product.product_id,
|
|
2415
|
-
result: 'price reset',
|
|
2416
|
-
previousSellingPrice: _previousSellingPrice,
|
|
2417
|
-
resolvedSmartPrice: smartPrice,
|
|
2418
|
-
finalSellingPrice: product.selling_price,
|
|
2419
|
-
catalogProduct: catalogProduct ? {
|
|
2420
|
-
price: catalogProduct.price,
|
|
2421
|
-
sellingPrice: catalogProduct.selling_price,
|
|
2422
|
-
dataVariants: catalogProduct.data_variants
|
|
2423
|
-
} : null
|
|
2424
|
-
});
|
|
2425
|
-
} else {
|
|
2426
|
-
productDiagnostics === null || productDiagnostics === void 0 || productDiagnostics.push({
|
|
1987
|
+
var _product$product_vari;
|
|
1988
|
+
var quotationPrice = _this10.store.quotation.getPriceForProduct({
|
|
2427
1989
|
productId: product.product_id,
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
reason: 'product_id is missing'
|
|
1990
|
+
variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
|
|
1991
|
+
datetime: now
|
|
2431
1992
|
});
|
|
1993
|
+
if (quotationPrice !== null) {
|
|
1994
|
+
product.selling_price = quotationPrice;
|
|
1995
|
+
product.original_price = quotationPrice;
|
|
1996
|
+
}
|
|
2432
1997
|
}
|
|
2433
1998
|
},
|
|
2434
1999
|
_ret;
|
|
@@ -2441,46 +2006,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2441
2006
|
} finally {
|
|
2442
2007
|
_iterator12.f();
|
|
2443
2008
|
}
|
|
2444
|
-
if (productDiagnostics) {
|
|
2445
|
-
this.logPricingDiagnostics('[VenueBooking] order smart pricing recalculation detail', {
|
|
2446
|
-
now: now,
|
|
2447
|
-
context: {
|
|
2448
|
-
customerId: context.customerId,
|
|
2449
|
-
availableWalletIds: context.availableWalletIds,
|
|
2450
|
-
channel: context.channel,
|
|
2451
|
-
businessCode: context.businessCode,
|
|
2452
|
-
orderType: context.orderType,
|
|
2453
|
-
hasEvaluator: !!context.evaluator
|
|
2454
|
-
},
|
|
2455
|
-
catalogCount: catalog.length,
|
|
2456
|
-
resourceProductMapSize: this.resourceProductMap.size,
|
|
2457
|
-
productDiagnostics: productDiagnostics
|
|
2458
|
-
});
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
/**
|
|
2463
|
-
* DataVariant 重算价格后,同步刷新订单展示、Rules 与 Summary 共用的价格口径。
|
|
2464
|
-
* Rules 会在本轮结束后根据当前客户的 discountList 重新写入实际折扣。
|
|
2465
|
-
*/
|
|
2466
|
-
}, {
|
|
2467
|
-
key: "resetProductPriceForSmartPricing",
|
|
2468
|
-
value: function resetProductPriceForSmartPricing(params) {
|
|
2469
|
-
var product = params.product,
|
|
2470
|
-
price = params.price,
|
|
2471
|
-
priceBreakdown = params.priceBreakdown;
|
|
2472
|
-
var metadata = product.metadata || {};
|
|
2473
|
-
product.selling_price = price;
|
|
2474
|
-
product.original_price = price;
|
|
2475
|
-
product.discount_list = [];
|
|
2476
|
-
product.metadata = _objectSpread(_objectSpread(_objectSpread({}, metadata), priceBreakdown ? {
|
|
2477
|
-
price_breakdown: priceBreakdown
|
|
2478
|
-
} : {}), {}, {
|
|
2479
|
-
source_product_price: price,
|
|
2480
|
-
main_product_original_price: price,
|
|
2481
|
-
main_product_selling_price: price,
|
|
2482
|
-
price_schema_version: 2
|
|
2483
|
-
});
|
|
2484
2009
|
}
|
|
2485
2010
|
}, {
|
|
2486
2011
|
key: "scanCode",
|
|
@@ -2547,7 +2072,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2547
2072
|
key: "setDiscountSelected",
|
|
2548
2073
|
value: (function () {
|
|
2549
2074
|
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2550
|
-
var _tempOrder$holder, _this$store$order$
|
|
2075
|
+
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator13, _step13, d, selectedResourceIds, _iterator14, _step14, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
2551
2076
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2552
2077
|
while (1) switch (_context21.prev = _context21.next) {
|
|
2553
2078
|
case 0:
|
|
@@ -2607,118 +2132,123 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2607
2132
|
}).map(function (d) {
|
|
2608
2133
|
return d.id;
|
|
2609
2134
|
}));
|
|
2610
|
-
|
|
2135
|
+
_iterator13 = _createForOfIteratorHelper(nextDiscountList);
|
|
2611
2136
|
try {
|
|
2612
|
-
for (
|
|
2613
|
-
d =
|
|
2137
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
2138
|
+
d = _step13.value;
|
|
2614
2139
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
2615
2140
|
d.isSelected = false;
|
|
2616
2141
|
}
|
|
2617
2142
|
}
|
|
2618
2143
|
} catch (err) {
|
|
2619
|
-
|
|
2144
|
+
_iterator13.e(err);
|
|
2620
2145
|
} finally {
|
|
2621
|
-
|
|
2146
|
+
_iterator13.f();
|
|
2622
2147
|
}
|
|
2623
2148
|
}
|
|
2624
2149
|
}
|
|
2625
2150
|
}
|
|
2626
|
-
|
|
2627
|
-
|
|
2151
|
+
selectedResourceIds = new Set(nextDiscountList.filter(function (d) {
|
|
2152
|
+
return d.isSelected;
|
|
2153
|
+
}).map(function (d) {
|
|
2154
|
+
return d.id;
|
|
2155
|
+
})); // 无条件归一化:不论 Rules 是否清空 discount_list、长度是否变化,
|
|
2156
|
+
// 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
|
|
2157
|
+
// 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
|
|
2158
|
+
// 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
|
|
2159
|
+
_iterator14 = _createForOfIteratorHelper(tempOrder.products);
|
|
2160
|
+
_context21.prev = 19;
|
|
2161
|
+
_iterator14.s();
|
|
2162
|
+
case 21:
|
|
2163
|
+
if ((_step14 = _iterator14.n()).done) {
|
|
2164
|
+
_context21.next = 35;
|
|
2165
|
+
break;
|
|
2166
|
+
}
|
|
2167
|
+
product = _step14.value;
|
|
2168
|
+
if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
|
|
2169
|
+
_context21.next = 25;
|
|
2170
|
+
break;
|
|
2171
|
+
}
|
|
2172
|
+
return _context21.abrupt("continue", 33);
|
|
2173
|
+
case 25:
|
|
2174
|
+
// 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
|
|
2175
|
+
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
2176
|
+
var _pd$discount$resource, _pd$discount;
|
|
2177
|
+
var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
|
|
2178
|
+
return rid != null && selectedResourceIds.has(rid);
|
|
2179
|
+
});
|
|
2180
|
+
|
|
2181
|
+
// 2. 以 source_product_price 为券作用基准:券作用于 source(不含 option),
|
|
2182
|
+
// 再把 option 加回得到含 option 的 main_product_selling_price,最后合成 composite。
|
|
2183
|
+
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
2184
|
+
return sum + (pd.amount || 0);
|
|
2185
|
+
}, 0);
|
|
2186
|
+
optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
2187
|
+
sourcePrice = (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
2188
|
+
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
2189
|
+
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
2190
|
+
if (product.metadata) {
|
|
2191
|
+
product.metadata.main_product_selling_price = newMainSellingPrice;
|
|
2192
|
+
product.metadata.price_schema_version = 2;
|
|
2193
|
+
}
|
|
2194
|
+
product.selling_price = composeLinePrice({
|
|
2195
|
+
mainPrice: newMainSellingPrice,
|
|
2196
|
+
bundle: product.product_bundle
|
|
2197
|
+
});
|
|
2198
|
+
case 33:
|
|
2628
2199
|
_context21.next = 21;
|
|
2200
|
+
break;
|
|
2201
|
+
case 35:
|
|
2202
|
+
_context21.next = 40;
|
|
2203
|
+
break;
|
|
2204
|
+
case 37:
|
|
2205
|
+
_context21.prev = 37;
|
|
2206
|
+
_context21.t0 = _context21["catch"](19);
|
|
2207
|
+
_iterator14.e(_context21.t0);
|
|
2208
|
+
case 40:
|
|
2209
|
+
_context21.prev = 40;
|
|
2210
|
+
_iterator14.f();
|
|
2211
|
+
return _context21.finish(40);
|
|
2212
|
+
case 43:
|
|
2213
|
+
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2214
|
+
_context21.next = 46;
|
|
2629
2215
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2630
|
-
case
|
|
2216
|
+
case 46:
|
|
2631
2217
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
2632
2218
|
return d.isSelected;
|
|
2633
2219
|
});
|
|
2634
2220
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2635
2221
|
return d.id === params.discountId;
|
|
2636
2222
|
}) || null;
|
|
2637
|
-
_context21.next =
|
|
2223
|
+
_context21.next = 50;
|
|
2638
2224
|
return this.store.order.recalculateSummary({
|
|
2639
2225
|
createIfMissing: true
|
|
2640
2226
|
});
|
|
2641
|
-
case
|
|
2227
|
+
case 50:
|
|
2642
2228
|
this.store.order.persistTempOrder();
|
|
2643
|
-
finalSummary = ((_this$store$order$
|
|
2644
|
-
finalProduct = ((_this$store$order$
|
|
2229
|
+
finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
|
|
2230
|
+
finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
|
|
2645
2231
|
this.logMethodSuccess('setDiscountSelected', params);
|
|
2646
2232
|
finalTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2647
2233
|
return d.id === params.discountId;
|
|
2648
2234
|
}) || null;
|
|
2649
2235
|
return _context21.abrupt("return", this.store.order.getDiscountList());
|
|
2650
|
-
case
|
|
2651
|
-
_context21.prev =
|
|
2652
|
-
_context21.
|
|
2653
|
-
this.logMethodError('setDiscountSelected', _context21.
|
|
2654
|
-
throw _context21.
|
|
2655
|
-
case
|
|
2236
|
+
case 58:
|
|
2237
|
+
_context21.prev = 58;
|
|
2238
|
+
_context21.t1 = _context21["catch"](1);
|
|
2239
|
+
this.logMethodError('setDiscountSelected', _context21.t1);
|
|
2240
|
+
throw _context21.t1;
|
|
2241
|
+
case 62:
|
|
2656
2242
|
case "end":
|
|
2657
2243
|
return _context21.stop();
|
|
2658
2244
|
}
|
|
2659
|
-
}, _callee21, this, [[1,
|
|
2245
|
+
}, _callee21, this, [[1, 58], [19, 37, 40, 43]]);
|
|
2660
2246
|
}));
|
|
2661
2247
|
function setDiscountSelected(_x15) {
|
|
2662
2248
|
return _setDiscountSelected.apply(this, arguments);
|
|
2663
2249
|
}
|
|
2664
2250
|
return setDiscountSelected;
|
|
2665
|
-
}()
|
|
2666
|
-
/**
|
|
2667
|
-
* 统一 VenueBooking 折扣后的订单行价。
|
|
2668
|
-
*
|
|
2669
|
-
* Rules 的 `discount_list.amount` 是已经按适用规则计算出的每件优惠额;它是这里唯一
|
|
2670
|
-
* 的折扣金额来源。使用智能定价写入的 source_product_price 减去该金额,再同步
|
|
2671
|
-
* selling_price 与 Summary 使用的 main_product_selling_price,避免 UI 的购物车行价、
|
|
2672
|
-
* 小计和提交订单各自读取到不同的价格字段。
|
|
2673
|
-
*/
|
|
2674
|
-
)
|
|
2675
|
-
}, {
|
|
2676
|
-
key: "normalizeDiscountedOrderPrices",
|
|
2677
|
-
value: function normalizeDiscountedOrderPrices(discountList) {
|
|
2678
|
-
var order = this.store.order;
|
|
2679
|
-
if (!order) return;
|
|
2680
|
-
var tempOrder = order.ensureTempOrder();
|
|
2681
|
-
var selectedResourceIds = new Set((discountList || []).filter(function (discount) {
|
|
2682
|
-
return discount.isSelected;
|
|
2683
|
-
}).map(function (discount) {
|
|
2684
|
-
return discount.id;
|
|
2685
|
-
}));
|
|
2686
|
-
var _iterator15 = _createForOfIteratorHelper(tempOrder.products),
|
|
2687
|
-
_step15;
|
|
2688
|
-
try {
|
|
2689
|
-
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
2690
|
-
var _product$_origin, _metadata$source_prod, _product$original_pri;
|
|
2691
|
-
var product = _step15.value;
|
|
2692
|
-
// 手动改价商品不参与券流程归一化,保留手工价格。
|
|
2693
|
-
if ((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount) continue;
|
|
2694
|
-
|
|
2695
|
-
// Rules 可能保留已取消折扣的明细;先使行级明细和当前选择状态一致。
|
|
2696
|
-
product.discount_list = (product.discount_list || []).filter(function (detail) {
|
|
2697
|
-
var _detail$discount$reso, _detail$discount;
|
|
2698
|
-
var resourceId = (_detail$discount$reso = (_detail$discount = detail.discount) === null || _detail$discount === void 0 ? void 0 : _detail$discount.resource_id) !== null && _detail$discount$reso !== void 0 ? _detail$discount$reso : detail.id;
|
|
2699
|
-
return resourceId != null && selectedResourceIds.has(resourceId);
|
|
2700
|
-
});
|
|
2701
|
-
var totalPerUnitDiscount = (product.discount_list || []).reduce(function (total, detail) {
|
|
2702
|
-
return total.plus(detail.amount || 0);
|
|
2703
|
-
}, new Decimal(0));
|
|
2704
|
-
var metadata = product.metadata || (product.metadata = {});
|
|
2705
|
-
var optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
2706
|
-
var sourcePrice = (_metadata$source_prod = metadata.source_product_price) !== null && _metadata$source_prod !== void 0 ? _metadata$source_prod : metadata.main_product_original_price != null ? new Decimal(Number(metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
2707
|
-
var nextSourceSellingPrice = Decimal.max(0, new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount)).toDecimalPlaces(2).toString();
|
|
2708
|
-
var nextMainSellingPrice = new Decimal(Number(nextSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
2709
|
-
metadata.main_product_selling_price = nextMainSellingPrice;
|
|
2710
|
-
metadata.price_schema_version = 2;
|
|
2711
|
-
product.selling_price = composeLinePrice({
|
|
2712
|
-
mainPrice: nextMainSellingPrice,
|
|
2713
|
-
bundle: product.product_bundle
|
|
2714
|
-
});
|
|
2715
|
-
}
|
|
2716
|
-
} catch (err) {
|
|
2717
|
-
_iterator15.e(err);
|
|
2718
|
-
} finally {
|
|
2719
|
-
_iterator15.f();
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2251
|
+
}())
|
|
2722
2252
|
}, {
|
|
2723
2253
|
key: "addNewOrder",
|
|
2724
2254
|
value: function () {
|
|
@@ -2809,7 +2339,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2809
2339
|
key: "submitOrder",
|
|
2810
2340
|
value: function () {
|
|
2811
2341
|
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2812
|
-
var _this$
|
|
2342
|
+
var _this$otherParams8, _this$otherParams9, _this$otherParams10, _this$otherParams11, _tempOrder$products2, result, tempOrder;
|
|
2813
2343
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2814
2344
|
while (1) switch (_context24.prev = _context24.next) {
|
|
2815
2345
|
case 0:
|
|
@@ -2827,10 +2357,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2827
2357
|
_context24.next = 8;
|
|
2828
2358
|
return this.store.order.submitTempOrder({
|
|
2829
2359
|
cacheId: this.cacheId,
|
|
2830
|
-
platform: (_this$
|
|
2831
|
-
businessCode: (_this$
|
|
2832
|
-
channel: (_this$
|
|
2833
|
-
type: (_this$
|
|
2360
|
+
platform: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform,
|
|
2361
|
+
businessCode: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode,
|
|
2362
|
+
channel: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.channel,
|
|
2363
|
+
type: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.type
|
|
2834
2364
|
});
|
|
2835
2365
|
case 8:
|
|
2836
2366
|
result = _context24.sent;
|
|
@@ -2906,7 +2436,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2906
2436
|
key: "addProductToOrder",
|
|
2907
2437
|
value: function () {
|
|
2908
2438
|
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
|
|
2909
|
-
var _product$
|
|
2439
|
+
var _product$metadata5, _product$product_vari2, quotationPrice, products;
|
|
2910
2440
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2911
2441
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2912
2442
|
case 0:
|
|
@@ -2921,18 +2451,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2921
2451
|
}
|
|
2922
2452
|
throw new Error('order 模块未初始化');
|
|
2923
2453
|
case 4:
|
|
2924
|
-
if (!((_product$
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
2930
|
-
fallbackPrice: product.selling_price
|
|
2454
|
+
if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && this.store.quotation && product.product_id != null) {
|
|
2455
|
+
quotationPrice = this.store.quotation.getPriceForProduct({
|
|
2456
|
+
productId: product.product_id,
|
|
2457
|
+
variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
|
|
2458
|
+
datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2931
2459
|
});
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2460
|
+
if (quotationPrice !== null) {
|
|
2461
|
+
product.selling_price = quotationPrice;
|
|
2462
|
+
product.original_price = quotationPrice;
|
|
2463
|
+
} else if (product.selling_price != null) {
|
|
2464
|
+
product.original_price = product.selling_price;
|
|
2465
|
+
}
|
|
2936
2466
|
}
|
|
2937
2467
|
_context26.next = 7;
|
|
2938
2468
|
return this.store.order.addProductToOrder(product);
|
|
@@ -3017,7 +2547,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3017
2547
|
key: "removeProductFromOrder",
|
|
3018
2548
|
value: function () {
|
|
3019
2549
|
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
|
|
3020
|
-
var _this$store$order$
|
|
2550
|
+
var _this$store$order$get3, _this$store$order6, _this$store$order$ens, _this$store$order7, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator15, _step15, _product$metadata6, _product$metadata7, product, beforeBookingCount, _this$store$order$per, _this$store$order8;
|
|
3021
2551
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3022
2552
|
while (1) switch (_context28.prev = _context28.next) {
|
|
3023
2553
|
case 0:
|
|
@@ -3032,7 +2562,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3032
2562
|
}
|
|
3033
2563
|
throw new Error('order 模块未初始化');
|
|
3034
2564
|
case 4:
|
|
3035
|
-
tempOrder = ((_this$store$order$
|
|
2565
|
+
tempOrder = ((_this$store$order$get3 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order6)) || ((_this$store$order$ens = (_this$store$order7 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order7));
|
|
3036
2566
|
_context28.next = 7;
|
|
3037
2567
|
return this.store.order.removeProductFromOrder(identity);
|
|
3038
2568
|
case 7:
|
|
@@ -3043,23 +2573,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3043
2573
|
}
|
|
3044
2574
|
venueProductUids = new Set();
|
|
3045
2575
|
venueBookingUids = new Set();
|
|
3046
|
-
|
|
2576
|
+
_iterator15 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
3047
2577
|
_context28.prev = 12;
|
|
3048
|
-
|
|
2578
|
+
_iterator15.s();
|
|
3049
2579
|
case 14:
|
|
3050
|
-
if ((
|
|
2580
|
+
if ((_step15 = _iterator15.n()).done) {
|
|
3051
2581
|
_context28.next = 22;
|
|
3052
2582
|
break;
|
|
3053
2583
|
}
|
|
3054
|
-
product =
|
|
3055
|
-
if (product !== null && product !== void 0 && (_product$
|
|
2584
|
+
product = _step15.value;
|
|
2585
|
+
if (product !== null && product !== void 0 && (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) {
|
|
3056
2586
|
_context28.next = 18;
|
|
3057
2587
|
break;
|
|
3058
2588
|
}
|
|
3059
2589
|
return _context28.abrupt("continue", 20);
|
|
3060
2590
|
case 18:
|
|
3061
2591
|
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
3062
|
-
if ((_product$
|
|
2592
|
+
if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
|
|
3063
2593
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
3064
2594
|
}
|
|
3065
2595
|
case 20:
|
|
@@ -3071,10 +2601,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3071
2601
|
case 24:
|
|
3072
2602
|
_context28.prev = 24;
|
|
3073
2603
|
_context28.t0 = _context28["catch"](12);
|
|
3074
|
-
|
|
2604
|
+
_iterator15.e(_context28.t0);
|
|
3075
2605
|
case 27:
|
|
3076
2606
|
_context28.prev = 27;
|
|
3077
|
-
|
|
2607
|
+
_iterator15.f();
|
|
3078
2608
|
return _context28.finish(27);
|
|
3079
2609
|
case 30:
|
|
3080
2610
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
@@ -3089,7 +2619,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3089
2619
|
return true;
|
|
3090
2620
|
});
|
|
3091
2621
|
if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
|
|
3092
|
-
(_this$store$order$per = (_this$store$
|
|
2622
|
+
(_this$store$order$per = (_this$store$order8 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order8);
|
|
3093
2623
|
}
|
|
3094
2624
|
case 33:
|
|
3095
2625
|
_context28.next = 35;
|
|
@@ -3322,17 +2852,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3322
2852
|
if (visited.has(value)) return;
|
|
3323
2853
|
visited.add(value);
|
|
3324
2854
|
if (Array.isArray(value)) {
|
|
3325
|
-
var
|
|
3326
|
-
|
|
2855
|
+
var _iterator16 = _createForOfIteratorHelper(value),
|
|
2856
|
+
_step16;
|
|
3327
2857
|
try {
|
|
3328
|
-
for (
|
|
3329
|
-
var item =
|
|
2858
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
2859
|
+
var item = _step16.value;
|
|
3330
2860
|
collectFromValue(item);
|
|
3331
2861
|
}
|
|
3332
2862
|
} catch (err) {
|
|
3333
|
-
|
|
2863
|
+
_iterator16.e(err);
|
|
3334
2864
|
} finally {
|
|
3335
|
-
|
|
2865
|
+
_iterator16.f();
|
|
3336
2866
|
}
|
|
3337
2867
|
return;
|
|
3338
2868
|
}
|
|
@@ -3340,8 +2870,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3340
2870
|
var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
|
|
3341
2871
|
var productId = Number(rawProductId);
|
|
3342
2872
|
if (Number.isFinite(productId) && productId > 0) {
|
|
3343
|
-
var
|
|
3344
|
-
var productVariantId = Number((
|
|
2873
|
+
var _ref3, _node$product_variant;
|
|
2874
|
+
var productVariantId = Number((_ref3 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref3 !== void 0 ? _ref3 : 0);
|
|
3345
2875
|
var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
|
|
3346
2876
|
var key = buildProductKey(productId, normalizedVariantId);
|
|
3347
2877
|
if (!sourceMap.has(key)) sourceMap.set(key, node);
|
|
@@ -3380,7 +2910,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3380
2910
|
key: "ensureItemRuleConfigsLoaded",
|
|
3381
2911
|
value: function () {
|
|
3382
2912
|
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
3383
|
-
var
|
|
2913
|
+
var _this11 = this;
|
|
3384
2914
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3385
2915
|
while (1) switch (_context35.prev = _context35.next) {
|
|
3386
2916
|
case 0:
|
|
@@ -3401,19 +2931,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3401
2931
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3402
2932
|
while (1) switch (_context34.prev = _context34.next) {
|
|
3403
2933
|
case 0:
|
|
3404
|
-
runtimeConfig =
|
|
2934
|
+
runtimeConfig = _this11.getItemRuleRuntimeConfig();
|
|
3405
2935
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
3406
2936
|
if (!(staticConfigs.length > 0)) {
|
|
3407
2937
|
_context34.next = 6;
|
|
3408
2938
|
break;
|
|
3409
2939
|
}
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
return _context34.abrupt("return",
|
|
2940
|
+
_this11.itemRuleConfigs = staticConfigs;
|
|
2941
|
+
_this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2942
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
3413
2943
|
case 6:
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
return _context34.abrupt("return",
|
|
2944
|
+
_this11.itemRuleConfigs = [];
|
|
2945
|
+
_this11.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2946
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
3417
2947
|
case 9:
|
|
3418
2948
|
case "end":
|
|
3419
2949
|
return _context34.stop();
|
|
@@ -3487,7 +3017,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3487
3017
|
key: "applyPrefillByItemRule",
|
|
3488
3018
|
value: function () {
|
|
3489
3019
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
3490
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
3020
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator17, _step17, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
|
|
3491
3021
|
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3492
3022
|
while (1) switch (_context37.prev = _context37.next) {
|
|
3493
3023
|
case 0:
|
|
@@ -3532,15 +3062,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3532
3062
|
productSourceMap = _context37.sent;
|
|
3533
3063
|
tempOrder = this.ensureTempOrder();
|
|
3534
3064
|
hasChanges = false;
|
|
3535
|
-
|
|
3065
|
+
_iterator17 = _createForOfIteratorHelper(prefillItems);
|
|
3536
3066
|
_context37.prev = 20;
|
|
3537
|
-
|
|
3067
|
+
_iterator17.s();
|
|
3538
3068
|
case 22:
|
|
3539
|
-
if ((
|
|
3069
|
+
if ((_step17 = _iterator17.n()).done) {
|
|
3540
3070
|
_context37.next = 45;
|
|
3541
3071
|
break;
|
|
3542
3072
|
}
|
|
3543
|
-
prefillItem =
|
|
3073
|
+
prefillItem = _step17.value;
|
|
3544
3074
|
productId = Number(prefillItem.product_id);
|
|
3545
3075
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3546
3076
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
@@ -3609,10 +3139,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3609
3139
|
case 47:
|
|
3610
3140
|
_context37.prev = 47;
|
|
3611
3141
|
_context37.t0 = _context37["catch"](20);
|
|
3612
|
-
|
|
3142
|
+
_iterator17.e(_context37.t0);
|
|
3613
3143
|
case 50:
|
|
3614
3144
|
_context37.prev = 50;
|
|
3615
|
-
|
|
3145
|
+
_iterator17.f();
|
|
3616
3146
|
return _context37.finish(50);
|
|
3617
3147
|
case 53:
|
|
3618
3148
|
if (!hasChanges) {
|
|
@@ -3874,7 +3404,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3874
3404
|
var raw = this.window.sessionStorage.getItem(key) || '{}';
|
|
3875
3405
|
var parsed = JSON.parse(raw);
|
|
3876
3406
|
return parsed && _typeof(parsed) === 'object' ? parsed : {};
|
|
3877
|
-
} catch (
|
|
3407
|
+
} catch (_unused3) {
|
|
3878
3408
|
return {};
|
|
3879
3409
|
}
|
|
3880
3410
|
}
|
|
@@ -3958,14 +3488,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3958
3488
|
key: "setOtherParams",
|
|
3959
3489
|
value: function () {
|
|
3960
3490
|
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3961
|
-
var
|
|
3962
|
-
|
|
3491
|
+
var _ref5,
|
|
3492
|
+
_ref5$cover,
|
|
3963
3493
|
cover,
|
|
3964
3494
|
_args44 = arguments;
|
|
3965
3495
|
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3966
3496
|
while (1) switch (_context44.prev = _context44.next) {
|
|
3967
3497
|
case 0:
|
|
3968
|
-
|
|
3498
|
+
_ref5 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
|
|
3969
3499
|
if (cover) {
|
|
3970
3500
|
this.otherParams = params;
|
|
3971
3501
|
} else {
|
|
@@ -3985,7 +3515,5 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3985
3515
|
}]);
|
|
3986
3516
|
return VenueBookingImpl;
|
|
3987
3517
|
}(BaseModule);
|
|
3988
|
-
_defineProperty(VenueBookingImpl, "PRICING_DEBUG_CACHE_ID", '031596279011848516');
|
|
3989
3518
|
_defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
|
|
3990
|
-
_defineProperty(VenueBookingImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
|
|
3991
3519
|
_defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');
|