@pisell/pisellos 0.10.21 → 0.10.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/BookingContext/index.d.ts +3 -0
- package/dist/modules/BookingContext/index.js +42 -13
- package/dist/modules/BookingContext/types.d.ts +4 -4
- package/dist/modules/BookingContext/types.js +3 -3
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -7
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +28 -9
- package/dist/modules/Order/index.d.ts +5 -0
- package/dist/modules/Order/index.js +148 -84
- package/dist/modules/ProductList/clientDataVariants.d.ts +50 -0
- package/dist/modules/ProductList/clientDataVariants.js +216 -0
- package/dist/modules/ProductList/index.d.ts +14 -13
- package/dist/modules/ProductList/index.js +105 -77
- package/dist/modules/Quotation/index.d.ts +16 -0
- package/dist/modules/Quotation/index.js +240 -27
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -2
- package/dist/modules/ResourcePlanner/planner.js +88 -21
- package/dist/modules/ResourcePlanner/types.d.ts +12 -0
- package/dist/modules/Rules/index.d.ts +5 -0
- package/dist/modules/Rules/index.js +27 -12
- package/dist/solution/BaseSales/index.d.ts +16 -1
- package/dist/solution/BaseSales/index.js +667 -349
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Sales/index.js +5 -3
- package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +290 -81
- package/dist/solution/UnifiedBookingSales/types.d.ts +4 -0
- package/dist/solution/VenueBooking/index.d.ts +2 -0
- package/dist/solution/VenueBooking/index.js +542 -494
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +3 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +3 -1
- package/dist/utils/platform.d.ts +8 -0
- package/dist/utils/platform.js +15 -0
- package/lib/modules/BookingContext/index.d.ts +3 -0
- package/lib/modules/BookingContext/index.js +35 -8
- package/lib/modules/BookingContext/types.d.ts +4 -4
- package/lib/modules/BookingContext/types.js +3 -3
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +4 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +13 -0
- package/lib/modules/Order/index.d.ts +5 -0
- package/lib/modules/Order/index.js +65 -8
- package/lib/modules/ProductList/clientDataVariants.d.ts +50 -0
- package/lib/modules/ProductList/clientDataVariants.js +204 -0
- package/lib/modules/ProductList/index.d.ts +14 -13
- package/lib/modules/ProductList/index.js +77 -58
- package/lib/modules/Quotation/index.d.ts +16 -0
- package/lib/modules/Quotation/index.js +112 -9
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -2
- package/lib/modules/ResourcePlanner/planner.js +80 -20
- package/lib/modules/ResourcePlanner/types.d.ts +12 -0
- package/lib/modules/Rules/index.d.ts +5 -0
- package/lib/modules/Rules/index.js +20 -11
- package/lib/solution/BaseSales/index.d.ts +16 -1
- package/lib/solution/BaseSales/index.js +293 -66
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Sales/index.js +2 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +225 -20
- package/lib/solution/UnifiedBookingSales/types.d.ts +4 -0
- package/lib/solution/VenueBooking/index.d.ts +2 -0
- package/lib/solution/VenueBooking/index.js +28 -8
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +3 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +3 -1
- package/lib/utils/platform.d.ts +8 -0
- package/lib/utils/platform.js +22 -0
- package/package.json +1 -1
|
@@ -4301,6 +4301,74 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4301
4301
|
commitProductLine(shouldMerge);
|
|
4302
4302
|
}
|
|
4303
4303
|
|
|
4304
|
+
/**
|
|
4305
|
+
* booking 数量拆行时,若 Holder 数量与拆行数严格一致,则按下标分配。
|
|
4306
|
+
* 数量不一致时保持旧数据,避免猜测 Holder 与商品份数的对应关系。
|
|
4307
|
+
*/
|
|
4308
|
+
}, {
|
|
4309
|
+
key: "createSplitBookingLine",
|
|
4310
|
+
value: function createSplitBookingLine(product, booking, index, splitCount) {
|
|
4311
|
+
var _booking$metadata6, _ref62, _ref63, _bookingHolder$form_r, _booking$metadata7, _product$metadata8, _bookingHolder$name, _singleBooking$metada;
|
|
4312
|
+
var singleLine = cloneDeep(product);
|
|
4313
|
+
singleLine.num = 1;
|
|
4314
|
+
delete singleLine.product_quantity;
|
|
4315
|
+
var singleBooking = cloneDeep(booking);
|
|
4316
|
+
var bookingHolder = booking !== null && booking !== void 0 && booking.holder && _typeof(booking.holder) === 'object' ? booking.holder : null;
|
|
4317
|
+
var metadataHolder = booking !== null && booking !== void 0 && (_booking$metadata6 = booking.metadata) !== null && _booking$metadata6 !== void 0 && _booking$metadata6.holder && _typeof(booking.metadata.holder) === 'object' ? booking.metadata.holder : null;
|
|
4318
|
+
var rawHolderIds = (_ref62 = (_ref63 = (_bookingHolder$form_r = bookingHolder === null || bookingHolder === void 0 ? void 0 : bookingHolder.form_record) !== null && _bookingHolder$form_r !== void 0 ? _bookingHolder$form_r : booking === null || booking === void 0 || (_booking$metadata7 = booking.metadata) === null || _booking$metadata7 === void 0 ? void 0 : _booking$metadata7.holder_id) !== null && _ref63 !== void 0 ? _ref63 : metadataHolder === null || metadataHolder === void 0 ? void 0 : metadataHolder.form_record) !== null && _ref62 !== void 0 ? _ref62 : product === null || product === void 0 || (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.holder_id;
|
|
4319
|
+
var holderIds = (Array.isArray(rawHolderIds) ? rawHolderIds : [rawHolderIds]).map(function (holderId) {
|
|
4320
|
+
return holderId && _typeof(holderId) === 'object' ? holderId.form_record_id : holderId;
|
|
4321
|
+
}).filter(function (holderId) {
|
|
4322
|
+
return holderId !== undefined && holderId !== null && holderId !== '';
|
|
4323
|
+
});
|
|
4324
|
+
if (holderIds.length !== splitCount) {
|
|
4325
|
+
return {
|
|
4326
|
+
product: singleLine,
|
|
4327
|
+
booking: singleBooking
|
|
4328
|
+
};
|
|
4329
|
+
}
|
|
4330
|
+
var holderId = holderIds[index];
|
|
4331
|
+
var rawHolderName = (_bookingHolder$name = bookingHolder === null || bookingHolder === void 0 ? void 0 : bookingHolder.name) !== null && _bookingHolder$name !== void 0 ? _bookingHolder$name : metadataHolder === null || metadataHolder === void 0 ? void 0 : metadataHolder.name;
|
|
4332
|
+
var holderNames = Array.isArray(rawHolderName) ? rawHolderName.map(function (name) {
|
|
4333
|
+
return String(name || '').trim();
|
|
4334
|
+
}) : typeof rawHolderName === 'string' ? rawHolderName.split(',').map(function (name) {
|
|
4335
|
+
return name.trim();
|
|
4336
|
+
}) : [];
|
|
4337
|
+
var holderName = holderNames.length === splitCount ? holderNames[index] : undefined;
|
|
4338
|
+
var splitHolder = function splitHolder(holder) {
|
|
4339
|
+
return _objectSpread(_objectSpread({}, holder), {}, {
|
|
4340
|
+
form_record: [holderId]
|
|
4341
|
+
}, holderName ? {
|
|
4342
|
+
name: holderName
|
|
4343
|
+
} : Object.prototype.hasOwnProperty.call(holder, 'name') ? {
|
|
4344
|
+
name: undefined
|
|
4345
|
+
} : {});
|
|
4346
|
+
};
|
|
4347
|
+
singleLine.metadata = _objectSpread(_objectSpread({}, singleLine.metadata || {}), {}, {
|
|
4348
|
+
holder_id: [holderId]
|
|
4349
|
+
});
|
|
4350
|
+
if (singleLine._extend && _typeof(singleLine._extend) === 'object') {
|
|
4351
|
+
singleLine._extend = _objectSpread(_objectSpread({}, singleLine._extend), {}, {
|
|
4352
|
+
holder_id: [holderId]
|
|
4353
|
+
});
|
|
4354
|
+
}
|
|
4355
|
+
if (singleBooking.holder && _typeof(singleBooking.holder) === 'object') {
|
|
4356
|
+
singleBooking.holder = splitHolder(singleBooking.holder);
|
|
4357
|
+
}
|
|
4358
|
+
singleBooking.metadata = _objectSpread(_objectSpread({}, singleBooking.metadata || {}), {}, {
|
|
4359
|
+
holder_id: [holderId]
|
|
4360
|
+
}, (_singleBooking$metada = singleBooking.metadata) !== null && _singleBooking$metada !== void 0 && _singleBooking$metada.holder && _typeof(singleBooking.metadata.holder) === 'object' ? {
|
|
4361
|
+
holder: splitHolder(singleBooking.metadata.holder)
|
|
4362
|
+
} : {});
|
|
4363
|
+
if (Object.prototype.hasOwnProperty.call(singleBooking, 'holder_id')) {
|
|
4364
|
+
singleBooking.holder_id = [holderId];
|
|
4365
|
+
}
|
|
4366
|
+
return {
|
|
4367
|
+
product: singleLine,
|
|
4368
|
+
booking: singleBooking
|
|
4369
|
+
};
|
|
4370
|
+
}
|
|
4371
|
+
|
|
4304
4372
|
/**
|
|
4305
4373
|
* 添加商品行。带 booking 时强制独立行;num>1 时拆成多条 num=1 的 product+booking(对齐 BookingByStep / ticketBooking addService)。
|
|
4306
4374
|
*
|
|
@@ -4312,7 +4380,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4312
4380
|
key: "addProductToOrder",
|
|
4313
4381
|
value: (function () {
|
|
4314
4382
|
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(product, booking, options) {
|
|
4315
|
-
var tempOrder, insertAfterProductUid, anchorIndex, insertAtIndex,
|
|
4383
|
+
var tempOrder, insertAfterProductUid, anchorIndex, insertAtIndex, _ref64, _productRecord$num, productRecord, splitCount, i, splitLine, _appendResult, appendResult;
|
|
4316
4384
|
return _regeneratorRuntime().wrap(function _callee19$(_context21) {
|
|
4317
4385
|
while (1) switch (_context21.prev = _context21.next) {
|
|
4318
4386
|
case 0:
|
|
@@ -4325,66 +4393,64 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4325
4393
|
}) : -1;
|
|
4326
4394
|
insertAtIndex = anchorIndex >= 0 ? anchorIndex + 1 : undefined;
|
|
4327
4395
|
if (!booking) {
|
|
4328
|
-
_context21.next =
|
|
4396
|
+
_context21.next = 22;
|
|
4329
4397
|
break;
|
|
4330
4398
|
}
|
|
4331
4399
|
productRecord = product;
|
|
4332
|
-
splitCount = getSafeProductNum((
|
|
4400
|
+
splitCount = getSafeProductNum((_ref64 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref64 !== void 0 ? _ref64 : 1);
|
|
4333
4401
|
if (!(splitCount > 1)) {
|
|
4334
|
-
_context21.next =
|
|
4402
|
+
_context21.next = 22;
|
|
4335
4403
|
break;
|
|
4336
4404
|
}
|
|
4337
4405
|
i = 0;
|
|
4338
4406
|
case 9:
|
|
4339
4407
|
if (!(i < splitCount)) {
|
|
4340
|
-
_context21.next =
|
|
4408
|
+
_context21.next = 19;
|
|
4341
4409
|
break;
|
|
4342
4410
|
}
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
delete singleLine.product_quantity;
|
|
4346
|
-
_appendResult = this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking), {
|
|
4411
|
+
splitLine = this.createSplitBookingLine(productRecord, booking, i, splitCount);
|
|
4412
|
+
_appendResult = this.appendProductLineToTempOrder(tempOrder, splitLine.product, splitLine.booking, {
|
|
4347
4413
|
insertAtIndex: insertAtIndex,
|
|
4348
4414
|
disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
|
|
4349
4415
|
});
|
|
4350
4416
|
if (!_appendResult) {
|
|
4351
|
-
_context21.next =
|
|
4417
|
+
_context21.next = 15;
|
|
4352
4418
|
break;
|
|
4353
4419
|
}
|
|
4354
|
-
_context21.next =
|
|
4420
|
+
_context21.next = 15;
|
|
4355
4421
|
return _appendResult;
|
|
4356
|
-
case
|
|
4422
|
+
case 15:
|
|
4357
4423
|
if (insertAtIndex !== undefined) insertAtIndex += 1;
|
|
4358
|
-
case
|
|
4424
|
+
case 16:
|
|
4359
4425
|
i += 1;
|
|
4360
4426
|
_context21.next = 9;
|
|
4361
4427
|
break;
|
|
4362
|
-
case
|
|
4363
|
-
_context21.next =
|
|
4428
|
+
case 19:
|
|
4429
|
+
_context21.next = 21;
|
|
4364
4430
|
return this.finalizeProductOrderMutation(tempOrder);
|
|
4365
|
-
case
|
|
4431
|
+
case 21:
|
|
4366
4432
|
return _context21.abrupt("return", tempOrder.products);
|
|
4367
|
-
case
|
|
4433
|
+
case 22:
|
|
4368
4434
|
appendResult = this.appendProductLineToTempOrder(tempOrder, product, booking, {
|
|
4369
4435
|
insertAtIndex: insertAtIndex,
|
|
4370
4436
|
disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
|
|
4371
4437
|
});
|
|
4372
4438
|
if (!appendResult) {
|
|
4373
|
-
_context21.next =
|
|
4439
|
+
_context21.next = 26;
|
|
4374
4440
|
break;
|
|
4375
4441
|
}
|
|
4376
|
-
_context21.next =
|
|
4442
|
+
_context21.next = 26;
|
|
4377
4443
|
return appendResult;
|
|
4378
|
-
case
|
|
4379
|
-
_context21.next =
|
|
4444
|
+
case 26:
|
|
4445
|
+
_context21.next = 28;
|
|
4380
4446
|
return this.finalizeProductOrderMutation(tempOrder);
|
|
4381
|
-
case
|
|
4447
|
+
case 28:
|
|
4382
4448
|
this.logInfo('addProductToOrder success', {
|
|
4383
4449
|
product_id: product.product_id,
|
|
4384
4450
|
with_booking: !!booking
|
|
4385
4451
|
});
|
|
4386
4452
|
return _context21.abrupt("return", tempOrder.products);
|
|
4387
|
-
case
|
|
4453
|
+
case 30:
|
|
4388
4454
|
case "end":
|
|
4389
4455
|
return _context21.stop();
|
|
4390
4456
|
}
|
|
@@ -4409,7 +4475,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4409
4475
|
key: "addProductsToOrder",
|
|
4410
4476
|
value: (function () {
|
|
4411
4477
|
var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(items, options) {
|
|
4412
|
-
var tempOrder, _iterator20, _step20, item, product, booking,
|
|
4478
|
+
var tempOrder, _iterator20, _step20, item, product, booking, _ref65, _productRecord$num2, productRecord, splitCount, i, splitLine, _appendResult2, appendResult;
|
|
4413
4479
|
return _regeneratorRuntime().wrap(function _callee20$(_context22) {
|
|
4414
4480
|
while (1) switch (_context22.prev = _context22.next) {
|
|
4415
4481
|
case 0:
|
|
@@ -4425,7 +4491,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4425
4491
|
_iterator20.s();
|
|
4426
4492
|
case 6:
|
|
4427
4493
|
if ((_step20 = _iterator20.n()).done) {
|
|
4428
|
-
_context22.next =
|
|
4494
|
+
_context22.next = 32;
|
|
4429
4495
|
break;
|
|
4430
4496
|
}
|
|
4431
4497
|
item = _step20.value;
|
|
@@ -4434,75 +4500,73 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4434
4500
|
_context22.next = 11;
|
|
4435
4501
|
break;
|
|
4436
4502
|
}
|
|
4437
|
-
return _context22.abrupt("continue",
|
|
4503
|
+
return _context22.abrupt("continue", 30);
|
|
4438
4504
|
case 11:
|
|
4439
4505
|
if (!booking) {
|
|
4440
|
-
_context22.next =
|
|
4506
|
+
_context22.next = 26;
|
|
4441
4507
|
break;
|
|
4442
4508
|
}
|
|
4443
4509
|
productRecord = product;
|
|
4444
|
-
splitCount = getSafeProductNum((
|
|
4510
|
+
splitCount = getSafeProductNum((_ref65 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref65 !== void 0 ? _ref65 : 1);
|
|
4445
4511
|
if (!(splitCount > 1)) {
|
|
4446
|
-
_context22.next =
|
|
4512
|
+
_context22.next = 26;
|
|
4447
4513
|
break;
|
|
4448
4514
|
}
|
|
4449
4515
|
i = 0;
|
|
4450
4516
|
case 16:
|
|
4451
4517
|
if (!(i < splitCount)) {
|
|
4452
|
-
_context22.next =
|
|
4518
|
+
_context22.next = 25;
|
|
4453
4519
|
break;
|
|
4454
4520
|
}
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
delete singleLine.product_quantity;
|
|
4458
|
-
_appendResult2 = this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking));
|
|
4521
|
+
splitLine = this.createSplitBookingLine(productRecord, booking, i, splitCount);
|
|
4522
|
+
_appendResult2 = this.appendProductLineToTempOrder(tempOrder, splitLine.product, splitLine.booking);
|
|
4459
4523
|
if (!_appendResult2) {
|
|
4460
|
-
_context22.next =
|
|
4524
|
+
_context22.next = 22;
|
|
4461
4525
|
break;
|
|
4462
4526
|
}
|
|
4463
|
-
_context22.next =
|
|
4527
|
+
_context22.next = 22;
|
|
4464
4528
|
return _appendResult2;
|
|
4465
|
-
case
|
|
4529
|
+
case 22:
|
|
4466
4530
|
i += 1;
|
|
4467
4531
|
_context22.next = 16;
|
|
4468
4532
|
break;
|
|
4469
|
-
case
|
|
4470
|
-
return _context22.abrupt("continue",
|
|
4471
|
-
case
|
|
4533
|
+
case 25:
|
|
4534
|
+
return _context22.abrupt("continue", 30);
|
|
4535
|
+
case 26:
|
|
4472
4536
|
appendResult = this.appendProductLineToTempOrder(tempOrder, product, booking);
|
|
4473
4537
|
if (!appendResult) {
|
|
4474
|
-
_context22.next =
|
|
4538
|
+
_context22.next = 30;
|
|
4475
4539
|
break;
|
|
4476
4540
|
}
|
|
4477
|
-
_context22.next =
|
|
4541
|
+
_context22.next = 30;
|
|
4478
4542
|
return appendResult;
|
|
4479
|
-
case
|
|
4543
|
+
case 30:
|
|
4480
4544
|
_context22.next = 6;
|
|
4481
4545
|
break;
|
|
4482
|
-
case
|
|
4483
|
-
_context22.next =
|
|
4546
|
+
case 32:
|
|
4547
|
+
_context22.next = 37;
|
|
4484
4548
|
break;
|
|
4485
|
-
case
|
|
4486
|
-
_context22.prev =
|
|
4549
|
+
case 34:
|
|
4550
|
+
_context22.prev = 34;
|
|
4487
4551
|
_context22.t0 = _context22["catch"](4);
|
|
4488
4552
|
_iterator20.e(_context22.t0);
|
|
4489
|
-
case
|
|
4490
|
-
_context22.prev =
|
|
4553
|
+
case 37:
|
|
4554
|
+
_context22.prev = 37;
|
|
4491
4555
|
_iterator20.f();
|
|
4492
|
-
return _context22.finish(
|
|
4493
|
-
case
|
|
4494
|
-
_context22.next =
|
|
4556
|
+
return _context22.finish(37);
|
|
4557
|
+
case 40:
|
|
4558
|
+
_context22.next = 42;
|
|
4495
4559
|
return this.finalizeProductOrderMutation(tempOrder, options);
|
|
4496
|
-
case
|
|
4560
|
+
case 42:
|
|
4497
4561
|
this.logInfo('addProductsToOrder success', {
|
|
4498
4562
|
itemsCount: items.length
|
|
4499
4563
|
});
|
|
4500
4564
|
return _context22.abrupt("return", tempOrder.products);
|
|
4501
|
-
case
|
|
4565
|
+
case 44:
|
|
4502
4566
|
case "end":
|
|
4503
4567
|
return _context22.stop();
|
|
4504
4568
|
}
|
|
4505
|
-
}, _callee20, this, [[4,
|
|
4569
|
+
}, _callee20, this, [[4, 34, 37, 40]]);
|
|
4506
4570
|
}));
|
|
4507
4571
|
function addProductsToOrder(_x24, _x25) {
|
|
4508
4572
|
return _addProductsToOrder.apply(this, arguments);
|
|
@@ -4531,9 +4595,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4531
4595
|
}, {
|
|
4532
4596
|
key: "getBundleRuntimeIdentity",
|
|
4533
4597
|
value: function getBundleRuntimeIdentity(bundle) {
|
|
4534
|
-
var
|
|
4598
|
+
var _ref66, _bundle$bundle_id2, _ref67, _bundle$bundle_group_2, _ref68, _ref69, _bundle$bundle_produc3, _ref70, _bundle$bundle_varian3;
|
|
4535
4599
|
if (!bundle || _typeof(bundle) !== 'object') return '';
|
|
4536
|
-
return [(
|
|
4600
|
+
return [(_ref66 = (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id) !== null && _ref66 !== void 0 ? _ref66 : '', (_ref67 = (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id) !== null && _ref67 !== void 0 ? _ref67 : '', (_ref68 = (_ref69 = (_bundle$bundle_produc3 = bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle._bundle_product_id) !== null && _ref69 !== void 0 ? _ref69 : bundle.product_id) !== null && _ref68 !== void 0 ? _ref68 : '', (_ref70 = (_bundle$bundle_varian3 = bundle.bundle_variant_id) !== null && _bundle$bundle_varian3 !== void 0 ? _bundle$bundle_varian3 : bundle.product_variant_id) !== null && _ref70 !== void 0 ? _ref70 : 0].join('|');
|
|
4537
4601
|
}
|
|
4538
4602
|
}, {
|
|
4539
4603
|
key: "preservePersistedBundlePriceFields",
|
|
@@ -4684,13 +4748,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4684
4748
|
delete nextProduct.metadata.main_product_original_price;
|
|
4685
4749
|
delete nextProduct.metadata.price_schema_version;
|
|
4686
4750
|
} else if (callerChangesLineConfiguration && !callerUpdatesTopPrice && !callerUpdatesMainMeta) {
|
|
4687
|
-
var
|
|
4751
|
+
var _ref71, _targetProduct$metada10, _targetProduct$metada11, _ref72, _targetProduct$metada12, _targetProduct$metada13, _targetProduct$metada14;
|
|
4688
4752
|
// 仅 option / bundle 变化时,保留历史 source 和主商品折扣金额,
|
|
4689
4753
|
// 但必须让 original 与 selling 一起随新的 option 金额移动。
|
|
4690
4754
|
var previousOptionSum = sumOptionUnitPrice(getProductSkuOptions(targetProduct));
|
|
4691
4755
|
var nextOptionSum = sumOptionUnitPrice(getProductSkuOptions(nextProduct));
|
|
4692
|
-
var _previousMainOriginal = new Decimal(Number((
|
|
4693
|
-
var _previousMainSelling = new Decimal(Number((
|
|
4756
|
+
var _previousMainOriginal = new Decimal(Number((_ref71 = (_targetProduct$metada10 = (_targetProduct$metada11 = targetProduct.metadata) === null || _targetProduct$metada11 === void 0 ? void 0 : _targetProduct$metada11.main_product_original_price) !== null && _targetProduct$metada10 !== void 0 ? _targetProduct$metada10 : targetProduct.original_price) !== null && _ref71 !== void 0 ? _ref71 : 0) || 0);
|
|
4757
|
+
var _previousMainSelling = new Decimal(Number((_ref72 = (_targetProduct$metada12 = (_targetProduct$metada13 = targetProduct.metadata) === null || _targetProduct$metada13 === void 0 ? void 0 : _targetProduct$metada13.main_product_selling_price) !== null && _targetProduct$metada12 !== void 0 ? _targetProduct$metada12 : targetProduct.selling_price) !== null && _ref72 !== void 0 ? _ref72 : _previousMainOriginal.toNumber()) || 0);
|
|
4694
4758
|
var _preservedDiscount = _previousMainOriginal.minus(_previousMainSelling);
|
|
4695
4759
|
var previousSource = ((_targetProduct$metada14 = targetProduct.metadata) === null || _targetProduct$metada14 === void 0 ? void 0 : _targetProduct$metada14.source_product_price) != null ? new Decimal(Number(targetProduct.metadata.source_product_price) || 0) : _previousMainOriginal.minus(previousOptionSum);
|
|
4696
4760
|
var _nextMainOriginal = previousSource.plus(nextOptionSum);
|
|
@@ -5285,23 +5349,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5285
5349
|
}, {
|
|
5286
5350
|
key: "buildCurrentSubmitPayloadForLocalPrint",
|
|
5287
5351
|
value: function buildCurrentSubmitPayloadForLocalPrint(params) {
|
|
5288
|
-
var _params$cacheId, _this$otherParams5,
|
|
5352
|
+
var _params$cacheId, _this$otherParams5, _ref73, _params$businessCode, _this$otherParams6, _this$otherParams7;
|
|
5289
5353
|
var tempOrder = this.ensureTempOrder();
|
|
5290
5354
|
this.persistTempOrder();
|
|
5291
5355
|
var payload = buildSubmitPayload({
|
|
5292
5356
|
tempOrder: tempOrder,
|
|
5293
5357
|
cacheId: (_params$cacheId = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId !== void 0 ? _params$cacheId : this.cacheId,
|
|
5294
5358
|
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform),
|
|
5295
|
-
businessCode: (
|
|
5359
|
+
businessCode: (_ref73 = (_params$businessCode = params === null || params === void 0 ? void 0 : params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _ref73 !== void 0 ? _ref73 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code,
|
|
5296
5360
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
5297
5361
|
type: params === null || params === void 0 ? void 0 : params.type,
|
|
5298
5362
|
summary: this.store.summary || createEmptySummary(),
|
|
5299
5363
|
enhance: function enhance(nextPayload) {
|
|
5300
|
-
var
|
|
5364
|
+
var _ref74, _tempOrder$order_numb, _ref75, _tempOrder$shop_order, _ref76, _tempOrder$shop_full_;
|
|
5301
5365
|
return _objectSpread(_objectSpread({}, nextPayload), {}, {
|
|
5302
|
-
order_number: (
|
|
5303
|
-
shop_order_number: (
|
|
5304
|
-
shop_full_order_number: (
|
|
5366
|
+
order_number: (_ref74 = (_tempOrder$order_numb = tempOrder.order_number) !== null && _tempOrder$order_numb !== void 0 ? _tempOrder$order_numb : nextPayload.order_number) !== null && _ref74 !== void 0 ? _ref74 : null,
|
|
5367
|
+
shop_order_number: (_ref75 = (_tempOrder$shop_order = tempOrder.shop_order_number) !== null && _tempOrder$shop_order !== void 0 ? _tempOrder$shop_order : nextPayload.shop_order_number) !== null && _ref75 !== void 0 ? _ref75 : null,
|
|
5368
|
+
shop_full_order_number: (_ref76 = (_tempOrder$shop_full_ = tempOrder.shop_full_order_number) !== null && _tempOrder$shop_full_ !== void 0 ? _tempOrder$shop_full_ : nextPayload.shop_full_order_number) !== null && _ref76 !== void 0 ? _ref76 : null,
|
|
5305
5369
|
small_ticket_data_flag: 1
|
|
5306
5370
|
});
|
|
5307
5371
|
}
|
|
@@ -5465,7 +5529,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5465
5529
|
key: "runSubmitTempOrder",
|
|
5466
5530
|
value: function () {
|
|
5467
5531
|
var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
5468
|
-
var _params$cacheId3, _this$otherParams12,
|
|
5532
|
+
var _params$cacheId3, _this$otherParams12, _ref77, _ref78, _submitSnapshot$busin, _this$otherParams13, _this$otherParams14, _submitSnapshot$type;
|
|
5469
5533
|
var tempOrder, isOnlineStorePlatform, shouldConfirmPendingVoucherPayments, hasPaymentOverride, preparedPaymentOverride, latestSummary, effectiveCacheId, hasPaymentStatusOverride, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, submittedOrderId, resultRecord;
|
|
5470
5534
|
return _regeneratorRuntime().wrap(function _callee33$(_context36) {
|
|
5471
5535
|
while (1) switch (_context36.prev = _context36.next) {
|
|
@@ -5531,7 +5595,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
5531
5595
|
tempOrder: tempOrder,
|
|
5532
5596
|
cacheId: effectiveCacheId,
|
|
5533
5597
|
platform: (params === null || params === void 0 ? void 0 : params.platform) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.platform),
|
|
5534
|
-
businessCode: (
|
|
5598
|
+
businessCode: (_ref77 = (_ref78 = (_submitSnapshot$busin = submitSnapshot.businessCode) !== null && _submitSnapshot$busin !== void 0 ? _submitSnapshot$busin : params === null || params === void 0 ? void 0 : params.businessCode) !== null && _ref78 !== void 0 ? _ref78 : (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.businessCode) !== null && _ref77 !== void 0 ? _ref77 : (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.business_code,
|
|
5535
5599
|
channel: params === null || params === void 0 ? void 0 : params.channel,
|
|
5536
5600
|
type: (_submitSnapshot$type = submitSnapshot.type) !== null && _submitSnapshot$type !== void 0 ? _submitSnapshot$type : params === null || params === void 0 ? void 0 : params.type,
|
|
5537
5601
|
summary: latestSummary,
|
|
@@ -6493,10 +6557,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6493
6557
|
_step22;
|
|
6494
6558
|
try {
|
|
6495
6559
|
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
|
|
6496
|
-
var _product$
|
|
6560
|
+
var _product$metadata9;
|
|
6497
6561
|
var product = _step22.value;
|
|
6498
6562
|
var productUid = getOrderCollectionUid('product', product);
|
|
6499
|
-
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$
|
|
6563
|
+
var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.booking_uid);
|
|
6500
6564
|
if (!productUid || bookingUid === undefined || bookingUid === null || bookingUid === '') {
|
|
6501
6565
|
continue;
|
|
6502
6566
|
}
|
|
@@ -6515,12 +6579,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6515
6579
|
_step23;
|
|
6516
6580
|
try {
|
|
6517
6581
|
for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
|
|
6518
|
-
var _booking$
|
|
6582
|
+
var _booking$metadata9;
|
|
6519
6583
|
var booking = _step23.value;
|
|
6520
6584
|
if (getOrderCollectionPersistentId('booking', booking) || getOrderCollectionUid('booking', booking)) {
|
|
6521
6585
|
continue;
|
|
6522
6586
|
}
|
|
6523
|
-
var _productUid = (booking === null || booking === void 0 ? void 0 : booking.product_uid) || (booking === null || booking === void 0 || (_booking$
|
|
6587
|
+
var _productUid = (booking === null || booking === void 0 ? void 0 : booking.product_uid) || (booking === null || booking === void 0 || (_booking$metadata9 = booking.metadata) === null || _booking$metadata9 === void 0 ? void 0 : _booking$metadata9.product_uid);
|
|
6524
6588
|
if (_productUid === undefined || _productUid === null || _productUid === '') continue;
|
|
6525
6589
|
var key = String(_productUid);
|
|
6526
6590
|
anonymousBookingCountByProductUid.set(key, (anonymousBookingCountByProductUid.get(key) || 0) + 1);
|
|
@@ -6532,11 +6596,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6532
6596
|
}
|
|
6533
6597
|
return _objectSpread(_objectSpread({}, raw), {}, {
|
|
6534
6598
|
bookings: raw.bookings.map(function (booking) {
|
|
6535
|
-
var _booking$
|
|
6599
|
+
var _booking$metadata8;
|
|
6536
6600
|
if (getOrderCollectionPersistentId('booking', booking) || getOrderCollectionUid('booking', booking)) {
|
|
6537
6601
|
return booking;
|
|
6538
6602
|
}
|
|
6539
|
-
var productUid = (booking === null || booking === void 0 ? void 0 : booking.product_uid) || (booking === null || booking === void 0 || (_booking$
|
|
6603
|
+
var productUid = (booking === null || booking === void 0 ? void 0 : booking.product_uid) || (booking === null || booking === void 0 || (_booking$metadata8 = booking.metadata) === null || _booking$metadata8 === void 0 ? void 0 : _booking$metadata8.product_uid);
|
|
6540
6604
|
if (productUid === undefined || productUid === null || productUid === '') {
|
|
6541
6605
|
return booking;
|
|
6542
6606
|
}
|
|
@@ -6613,15 +6677,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6613
6677
|
_step24;
|
|
6614
6678
|
try {
|
|
6615
6679
|
for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {
|
|
6616
|
-
var _product$
|
|
6680
|
+
var _product$metadata10, _ref79, _ref80, _existed$origin, _rawProduct$metadata;
|
|
6617
6681
|
var _step24$value = _slicedToArray(_step24.value, 2),
|
|
6618
6682
|
index = _step24$value[0],
|
|
6619
6683
|
product = _step24$value[1];
|
|
6620
|
-
var uid = (_product$
|
|
6684
|
+
var uid = (_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.unique_identification_number;
|
|
6621
6685
|
if (!uid) continue;
|
|
6622
6686
|
var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
|
|
6623
6687
|
var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
|
|
6624
|
-
var origin = (
|
|
6688
|
+
var origin = (_ref79 = (_ref80 = (_existed$origin = existed.origin) !== null && _existed$origin !== void 0 ? _existed$origin : rawProduct._origin) !== null && _ref80 !== void 0 ? _ref80 : (_rawProduct$metadata = rawProduct.metadata) === null || _rawProduct$metadata === void 0 ? void 0 : _rawProduct$metadata.origin) !== null && _ref79 !== void 0 ? _ref79 : rawProduct;
|
|
6625
6689
|
var originSnapshot = cloneDeep(origin);
|
|
6626
6690
|
var productOptionString = this.buildHydratedProductOptionString(rawProduct) || this.buildHydratedProductOptionString(product);
|
|
6627
6691
|
if (productOptionString && originSnapshot && _typeof(originSnapshot) === 'object') {
|
|
@@ -6672,8 +6736,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6672
6736
|
var bookingUidByProductUid = new Map();
|
|
6673
6737
|
var productByUid = new Map();
|
|
6674
6738
|
(tempOrder.products || []).forEach(function (product) {
|
|
6675
|
-
var _product$
|
|
6676
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
6739
|
+
var _product$metadata11;
|
|
6740
|
+
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);
|
|
6677
6741
|
if (productUid !== undefined && productUid !== null && String(productUid) !== '') {
|
|
6678
6742
|
productByUid.set(String(productUid), product);
|
|
6679
6743
|
}
|
|
@@ -6694,8 +6758,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6694
6758
|
bookingUidByProductUid.set(String(productUid), bookingUid);
|
|
6695
6759
|
});
|
|
6696
6760
|
(tempOrder.products || []).forEach(function (product) {
|
|
6697
|
-
var _product$
|
|
6698
|
-
var productUid = (product === null || product === void 0 || (_product$
|
|
6761
|
+
var _product$metadata12;
|
|
6762
|
+
var productUid = (product === null || product === void 0 || (_product$metadata12 = product.metadata) === null || _product$metadata12 === void 0 ? void 0 : _product$metadata12.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
|
|
6699
6763
|
if (productUid === undefined || productUid === null || String(productUid) === '') return;
|
|
6700
6764
|
var bookingUid = bookingUidByProductUid.get(String(productUid));
|
|
6701
6765
|
if (!bookingUid) return;
|
|
@@ -6750,10 +6814,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
6750
6814
|
}, {
|
|
6751
6815
|
key: "normalizeHydratedProductOptionItem",
|
|
6752
6816
|
value: function normalizeHydratedProductOptionItem(optionItem) {
|
|
6753
|
-
var
|
|
6754
|
-
var rawNum = (
|
|
6817
|
+
var _ref81, _optionItem$num, _ref82, _optionItem$add_price;
|
|
6818
|
+
var rawNum = (_ref81 = (_optionItem$num = optionItem === null || optionItem === void 0 ? void 0 : optionItem.num) !== null && _optionItem$num !== void 0 ? _optionItem$num : optionItem === null || optionItem === void 0 ? void 0 : optionItem.quantity) !== null && _ref81 !== void 0 ? _ref81 : 1;
|
|
6755
6819
|
var parsedNum = Number(rawNum);
|
|
6756
|
-
var rawPrice = (
|
|
6820
|
+
var rawPrice = (_ref82 = (_optionItem$add_price = optionItem === null || optionItem === void 0 ? void 0 : optionItem.add_price) !== null && _optionItem$add_price !== void 0 ? _optionItem$add_price : optionItem === null || optionItem === void 0 ? void 0 : optionItem.price) !== null && _ref82 !== void 0 ? _ref82 : 0;
|
|
6757
6821
|
var parsedPrice = Number(rawPrice);
|
|
6758
6822
|
var normalized = _objectSpread(_objectSpread({}, optionItem), {}, {
|
|
6759
6823
|
option_group_item_id: optionItem === null || optionItem === void 0 ? void 0 : optionItem.option_group_item_id,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PisellCore } from '../../types';
|
|
2
|
+
import type { RequestPlugin } from '../../plugins';
|
|
3
|
+
import type { ProductData } from '../Product/types';
|
|
4
|
+
export declare const PRODUCT_QUERY_DATA_VARIANT_RELATIONS: readonly ["category", "collection", "resourceRelation", "bundleGroup.bundleItem", "optionGroup.optionItem", "variantGroup.variantItem", "dataVariants"];
|
|
5
|
+
/**
|
|
6
|
+
* 判断当前商品查询是否会被本地 OS Server 接管。
|
|
7
|
+
*
|
|
8
|
+
* H5 RequestPlugin 即使收到 osServer=true 仍会直接请求远端接口,因此必须按
|
|
9
|
+
* RequestPlugin 实际 baseUrl 对应的已注册路由判断,不能只看请求选项。
|
|
10
|
+
*/
|
|
11
|
+
export declare function isProductQueryHandledByOsServer(core: PisellCore | undefined, request: RequestPlugin | undefined): boolean;
|
|
12
|
+
export interface ResolveClientDataVariantsParams {
|
|
13
|
+
core: PisellCore | undefined;
|
|
14
|
+
otherParams?: Record<string, any>;
|
|
15
|
+
products: ProductData[];
|
|
16
|
+
queryPayload: Record<string, any>;
|
|
17
|
+
handledByOsServer: boolean;
|
|
18
|
+
scheduleList?: unknown;
|
|
19
|
+
menuList?: unknown;
|
|
20
|
+
/** Quote fast paths require hydrated relations; legacy list resolution does not. */
|
|
21
|
+
requireCompleteDataVariantRelations?: boolean;
|
|
22
|
+
/** Quote fast paths require every referenced rule; legacy list resolution is best-effort. */
|
|
23
|
+
requireEvaluatorReady?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type ResolveClientDataVariantsResult = {
|
|
26
|
+
status: 'handled-by-os-server' | 'empty' | 'data-variants-unavailable' | 'evaluator-unavailable' | 'evaluator-not-ready';
|
|
27
|
+
products: ProductData[];
|
|
28
|
+
} | {
|
|
29
|
+
status: 'resolved';
|
|
30
|
+
products: ProductData[];
|
|
31
|
+
} | {
|
|
32
|
+
status: 'error';
|
|
33
|
+
products: ProductData[];
|
|
34
|
+
error: unknown;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Strict client-side Data Variant resolution for quote fast paths.
|
|
38
|
+
*
|
|
39
|
+
* Unlike resolveClientDataVariants, callers can distinguish a complete local
|
|
40
|
+
* result from a capability/readiness/error fallback and decide to query the
|
|
41
|
+
* remote product endpoint instead.
|
|
42
|
+
*/
|
|
43
|
+
export declare function tryResolveClientDataVariants({ core, otherParams, products, queryPayload, handledByOsServer, scheduleList: explicitScheduleList, menuList: explicitMenuList, requireCompleteDataVariantRelations, requireEvaluatorReady, }: ResolveClientDataVariantsParams): ResolveClientDataVariantsResult;
|
|
44
|
+
/**
|
|
45
|
+
* 未启用商品 OS 路由时,在客户端补做 Data Variant 解析。
|
|
46
|
+
*
|
|
47
|
+
* 商品列表和预约报价必须共用这个边界,避免 H5 的弹窗报价绕过客户端智能定价。
|
|
48
|
+
* OS Server 已接管时直接信任服务端结果,确保同一批商品只评估一次。
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveClientDataVariants({ core, otherParams, products, queryPayload, handledByOsServer, scheduleList: explicitScheduleList, menuList: explicitMenuList, }: ResolveClientDataVariantsParams): ProductData[];
|