@pisell/pisellos 2.2.223 → 2.2.225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
- package/dist/modules/Customer/index.d.ts +7 -0
- package/dist/modules/Customer/index.js +16 -0
- package/dist/modules/OpenData/index.d.ts +7 -0
- package/dist/modules/OpenData/index.js +15 -0
- package/dist/modules/Order/index.d.ts +44 -0
- package/dist/modules/Order/index.js +306 -113
- package/dist/modules/Order/types.d.ts +16 -0
- package/dist/modules/Order/utils.js +7 -4
- package/dist/modules/Payment/index.d.ts +7 -0
- package/dist/modules/Payment/index.js +12 -0
- package/dist/modules/ProductList/index.d.ts +7 -0
- package/dist/modules/ProductList/index.js +11 -0
- package/dist/modules/SalesSummary/index.d.ts +7 -0
- package/dist/modules/SalesSummary/index.js +58 -23
- package/dist/modules/Schedule/index.d.ts +7 -0
- package/dist/modules/Schedule/index.js +16 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +519 -355
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/server/modules/order/utils/filterBookings.js +25 -2
- package/dist/server/utils/small-ticket.js +160 -30
- package/dist/solution/BaseSales/index.d.ts +17 -0
- package/dist/solution/BaseSales/index.js +524 -439
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -7
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -9
- package/dist/solution/BookingTicket/index.js +42 -76
- package/dist/types/index.d.ts +10 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +3 -0
- package/lib/modules/Customer/index.d.ts +7 -0
- package/lib/modules/Customer/index.js +12 -0
- package/lib/modules/OpenData/index.d.ts +7 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/Order/index.d.ts +44 -0
- package/lib/modules/Order/index.js +150 -3
- package/lib/modules/Order/types.d.ts +16 -0
- package/lib/modules/Order/utils.js +6 -2
- package/lib/modules/Payment/index.d.ts +7 -0
- package/lib/modules/Payment/index.js +9 -0
- package/lib/modules/ProductList/index.d.ts +7 -0
- package/lib/modules/ProductList/index.js +9 -0
- package/lib/modules/SalesSummary/index.d.ts +7 -0
- package/lib/modules/SalesSummary/index.js +13 -0
- package/lib/modules/Schedule/index.d.ts +7 -0
- package/lib/modules/Schedule/index.js +12 -0
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +136 -3
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/server/modules/order/utils/filterBookings.js +17 -2
- package/lib/server/utils/small-ticket.js +141 -32
- package/lib/solution/BaseSales/index.d.ts +17 -0
- package/lib/solution/BaseSales/index.js +48 -10
- package/lib/solution/BaseSales/utils/cartPromotion.js +31 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -9
- package/lib/solution/BookingTicket/index.js +1 -13
- package/lib/types/index.d.ts +10 -0
- package/package.json +1 -1
|
@@ -244,9 +244,10 @@ export function mergeIdenticalPromotionCartLines(products) {
|
|
|
244
244
|
var fingerprint = buildProductLineFingerprint(getProductSkuOptions(line), line.product_bundle);
|
|
245
245
|
var unitPrice = String((_ref2 = (_line$metadata$source = (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.source_product_price) !== null && _line$metadata$source !== void 0 ? _line$metadata$source : line.selling_price) !== null && _ref2 !== void 0 ? _ref2 : '');
|
|
246
246
|
var promoUnitPrice = String((_ref3 = (_promotion$finalPrice = promotion.finalPrice) !== null && _promotion$finalPrice !== void 0 ? _promotion$finalPrice : (_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.main_product_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '');
|
|
247
|
+
var noteSignature = getProductLineNoteSignature(line);
|
|
247
248
|
var bookingUid = (_line$booking_uid = line === null || line === void 0 ? void 0 : line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : line === null || line === void 0 || (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid;
|
|
248
249
|
var orderDetailId = (_line$order_detail_id = line === null || line === void 0 ? void 0 : line.order_detail_id) !== null && _line$order_detail_id !== void 0 ? _line$order_detail_id : line === null || line === void 0 ? void 0 : line.orderDetailId;
|
|
249
|
-
var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
|
|
250
|
+
var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, noteSignature, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
|
|
250
251
|
var hitIndex = indexByKey.get(mergeKey);
|
|
251
252
|
if (hitIndex === undefined) {
|
|
252
253
|
indexByKey.set(mergeKey, merged.length);
|
|
@@ -414,6 +415,14 @@ function getGiftInfo(product) {
|
|
|
414
415
|
var _product$metadata2;
|
|
415
416
|
return (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2._giftInfo) || (product === null || product === void 0 ? void 0 : product._giftInfo) || null;
|
|
416
417
|
}
|
|
418
|
+
function getProductLineNoteSignature(product) {
|
|
419
|
+
var note = product === null || product === void 0 ? void 0 : product.note;
|
|
420
|
+
if (typeof note !== 'string') return '';
|
|
421
|
+
var normalizedNote = note.trim();
|
|
422
|
+
if (!normalizedNote) return '';
|
|
423
|
+
var uid = getOrderProductUid(product);
|
|
424
|
+
return uid ? "note:".concat(uid) : "note:".concat(normalizedNote);
|
|
425
|
+
}
|
|
417
426
|
function isPersistedGeneratedVoucher(product) {
|
|
418
427
|
var _product$order_detail;
|
|
419
428
|
var orderDetailId = (_product$order_detail = product === null || product === void 0 ? void 0 : product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product === null || product === void 0 ? void 0 : product.orderDetailId;
|
|
@@ -453,17 +462,18 @@ function getProductBundleForEvaluator(product) {
|
|
|
453
462
|
export function buildConsolidateKeyForPromotion(item) {
|
|
454
463
|
var _item$booking_uid, _item$metadata, _item$order_detail_id, _item$product_variant3;
|
|
455
464
|
var fingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
|
|
465
|
+
var noteSignature = getProductLineNoteSignature(item);
|
|
456
466
|
var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.booking_uid;
|
|
457
467
|
var orderDetailId = (_item$order_detail_id = item === null || item === void 0 ? void 0 : item.order_detail_id) !== null && _item$order_detail_id !== void 0 ? _item$order_detail_id : item === null || item === void 0 ? void 0 : item.orderDetailId;
|
|
458
468
|
if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
|
|
459
469
|
var _item$product_variant;
|
|
460
|
-
return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, String(orderDetailId)].join('#');
|
|
470
|
+
return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, noteSignature, String(orderDetailId)].join('#');
|
|
461
471
|
}
|
|
462
472
|
if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
|
|
463
473
|
var _item$product_variant2;
|
|
464
|
-
return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, String(bookingUid)].join('#');
|
|
474
|
+
return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, noteSignature, String(bookingUid)].join('#');
|
|
465
475
|
}
|
|
466
|
-
return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint].join('#');
|
|
476
|
+
return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint, noteSignature].join('#');
|
|
467
477
|
}
|
|
468
478
|
function consolidateMainProductsForPromotion(entries) {
|
|
469
479
|
if (!Array.isArray(entries) || entries.length <= 1) {
|
|
@@ -474,10 +484,12 @@ function consolidateMainProductsForPromotion(entries) {
|
|
|
474
484
|
_step5;
|
|
475
485
|
try {
|
|
476
486
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
487
|
+
var _item$metadata2;
|
|
477
488
|
var _step5$value = _step5.value,
|
|
478
489
|
item = _step5$value.item,
|
|
479
490
|
originalListIndex = _step5$value.originalListIndex;
|
|
480
491
|
var key = buildConsolidateKeyForPromotion(item);
|
|
492
|
+
var wasInPromotion = (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 || (_item$metadata2 = _item$metadata2._promotion) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.inPromotion) === true;
|
|
481
493
|
var existing = groups.get(key);
|
|
482
494
|
if (!existing) {
|
|
483
495
|
var mergedItem = cloneDeep(item);
|
|
@@ -498,6 +510,9 @@ function consolidateMainProductsForPromotion(entries) {
|
|
|
498
510
|
_iterator6.f();
|
|
499
511
|
}
|
|
500
512
|
}
|
|
513
|
+
if (wasInPromotion) {
|
|
514
|
+
mergedItem._wasInPromotionBeforeConsolidate = true;
|
|
515
|
+
}
|
|
501
516
|
groups.set(key, {
|
|
502
517
|
item: mergedItem,
|
|
503
518
|
originalListIndex: originalListIndex
|
|
@@ -505,6 +520,9 @@ function consolidateMainProductsForPromotion(entries) {
|
|
|
505
520
|
continue;
|
|
506
521
|
}
|
|
507
522
|
existing.item.num = getSafeProductNum(Number(existing.item.num || 0) + Number(item.num || 0));
|
|
523
|
+
if (wasInPromotion) {
|
|
524
|
+
existing.item._wasInPromotionBeforeConsolidate = true;
|
|
525
|
+
}
|
|
508
526
|
}
|
|
509
527
|
} catch (err) {
|
|
510
528
|
_iterator5.e(err);
|
|
@@ -1059,13 +1077,13 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1059
1077
|
var promotionProducts = [];
|
|
1060
1078
|
var originalItemMap = new Map();
|
|
1061
1079
|
var productsForStrategies = consolidatedMainProductsWithIndex.map(function (_ref16, i) {
|
|
1062
|
-
var _item$product_id, _item$product_variant5, _item$
|
|
1080
|
+
var _item$product_id, _item$product_variant5, _item$metadata3, _item$num;
|
|
1063
1081
|
var item = _ref16.item;
|
|
1064
1082
|
return {
|
|
1065
1083
|
id: i,
|
|
1066
1084
|
product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : 0) || 0,
|
|
1067
1085
|
product_variant_id: Number((_item$product_variant5 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant5 !== void 0 ? _item$product_variant5 : 0) || 0,
|
|
1068
|
-
name: (item === null || item === void 0 || (_item$
|
|
1086
|
+
name: (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
|
|
1069
1087
|
price: getOrderProductBasePrice(item),
|
|
1070
1088
|
quantity: Number((_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : 1) || 1,
|
|
1071
1089
|
bundle: getProductBundleForEvaluator(item)
|
|
@@ -1195,7 +1213,7 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1195
1213
|
newItem._sourceCartNum = sourceCartNum;
|
|
1196
1214
|
|
|
1197
1215
|
// 清掉历史促销字段
|
|
1198
|
-
var wasInPromotion = ((_metadata$_promotion2 = metadata._promotion) === null || _metadata$_promotion2 === void 0 ? void 0 : _metadata$_promotion2.inPromotion) === true;
|
|
1216
|
+
var wasInPromotion = ((_metadata$_promotion2 = metadata._promotion) === null || _metadata$_promotion2 === void 0 ? void 0 : _metadata$_promotion2.inPromotion) === true || originalItem._wasInPromotionBeforeConsolidate === true;
|
|
1199
1217
|
delete metadata._promotion;
|
|
1200
1218
|
if (Array.isArray(newItem.product_bundle)) {
|
|
1201
1219
|
var _iterator23 = _createForOfIteratorHelper(newItem.product_bundle),
|
|
@@ -1408,6 +1426,7 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1408
1426
|
delete product._sortSubIndex;
|
|
1409
1427
|
delete product._originalProductUid;
|
|
1410
1428
|
delete product._sourceCartNum;
|
|
1429
|
+
delete product._wasInPromotionBeforeConsolidate;
|
|
1411
1430
|
}
|
|
1412
1431
|
return {
|
|
1413
1432
|
products: processedProducts,
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 3 | 6 | 4 | 5;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -312,7 +312,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
312
312
|
* 获取当前的客户搜索条件
|
|
313
313
|
* @returns 当前搜索条件
|
|
314
314
|
*/
|
|
315
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
315
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
316
316
|
/**
|
|
317
317
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
318
318
|
* @returns 客户状态
|
|
@@ -359,14 +359,6 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
359
359
|
* 清空所有扫描监听对应的任务执行队列
|
|
360
360
|
*/
|
|
361
361
|
clearAllScanListenersTaskQueue(): void;
|
|
362
|
-
/**
|
|
363
|
-
* 设置其他参数
|
|
364
|
-
* @param params 参数
|
|
365
|
-
* @param options 选项
|
|
366
|
-
*/
|
|
367
|
-
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
368
|
-
cover?: boolean;
|
|
369
|
-
}): Promise<void>;
|
|
370
362
|
/**
|
|
371
363
|
* 获取其他参数
|
|
372
364
|
* @returns 其他参数
|
|
@@ -300,7 +300,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
300
300
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
301
301
|
return _context4.abrupt("return");
|
|
302
302
|
case 15:
|
|
303
|
-
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'],
|
|
303
|
+
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
304
304
|
receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
|
|
305
305
|
prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
|
|
306
306
|
shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
|
|
@@ -1717,57 +1717,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1717
1717
|
this.scan.clearTaskQueue();
|
|
1718
1718
|
}
|
|
1719
1719
|
|
|
1720
|
-
/**
|
|
1721
|
-
* 设置其他参数
|
|
1722
|
-
* @param params 参数
|
|
1723
|
-
* @param options 选项
|
|
1724
|
-
*/
|
|
1725
|
-
}, {
|
|
1726
|
-
key: "setOtherParams",
|
|
1727
|
-
value: (function () {
|
|
1728
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
1729
|
-
var _ref10,
|
|
1730
|
-
_ref10$cover,
|
|
1731
|
-
cover,
|
|
1732
|
-
_args24 = arguments;
|
|
1733
|
-
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1734
|
-
while (1) switch (_context24.prev = _context24.next) {
|
|
1735
|
-
case 0:
|
|
1736
|
-
_ref10 = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {}, _ref10$cover = _ref10.cover, cover = _ref10$cover === void 0 ? false : _ref10$cover;
|
|
1737
|
-
if (cover) {
|
|
1738
|
-
this.otherParams = params;
|
|
1739
|
-
} else {
|
|
1740
|
-
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
1741
|
-
}
|
|
1742
|
-
case 2:
|
|
1743
|
-
case "end":
|
|
1744
|
-
return _context24.stop();
|
|
1745
|
-
}
|
|
1746
|
-
}, _callee24, this);
|
|
1747
|
-
}));
|
|
1748
|
-
function setOtherParams(_x17) {
|
|
1749
|
-
return _setOtherParams.apply(this, arguments);
|
|
1750
|
-
}
|
|
1751
|
-
return setOtherParams;
|
|
1752
|
-
}()
|
|
1753
1720
|
/**
|
|
1754
1721
|
* 获取其他参数
|
|
1755
1722
|
* @returns 其他参数
|
|
1756
1723
|
*/
|
|
1757
|
-
)
|
|
1758
1724
|
}, {
|
|
1759
1725
|
key: "getOtherParams",
|
|
1760
1726
|
value: (function () {
|
|
1761
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1762
|
-
return _regeneratorRuntime().wrap(function
|
|
1763
|
-
while (1) switch (
|
|
1727
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1728
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1729
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1764
1730
|
case 0:
|
|
1765
|
-
return
|
|
1731
|
+
return _context24.abrupt("return", this.otherParams);
|
|
1766
1732
|
case 1:
|
|
1767
1733
|
case "end":
|
|
1768
|
-
return
|
|
1734
|
+
return _context24.stop();
|
|
1769
1735
|
}
|
|
1770
|
-
},
|
|
1736
|
+
}, _callee24, this);
|
|
1771
1737
|
}));
|
|
1772
1738
|
function getOtherParams() {
|
|
1773
1739
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -1976,10 +1942,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1976
1942
|
}, {
|
|
1977
1943
|
key: "buildAddProductCtx",
|
|
1978
1944
|
value: function buildAddProductCtx(extra) {
|
|
1979
|
-
var _extra$date2,
|
|
1945
|
+
var _extra$date2, _ref10, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get4, _extra$presetStartTim2;
|
|
1980
1946
|
var bookingContextState = this.store.bookingContext.getState();
|
|
1981
1947
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
1982
|
-
var orderCustomerId = (
|
|
1948
|
+
var orderCustomerId = (_ref10 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref10 !== void 0 ? _ref10 : undefined;
|
|
1983
1949
|
return _objectSpread({
|
|
1984
1950
|
bookingConfig: bookingContextState.bookingConfig,
|
|
1985
1951
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2085,18 +2051,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2085
2051
|
}, {
|
|
2086
2052
|
key: "updateProductInOrder",
|
|
2087
2053
|
value: (function () {
|
|
2088
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2089
|
-
return _regeneratorRuntime().wrap(function
|
|
2090
|
-
while (1) switch (
|
|
2054
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2055
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2056
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2091
2057
|
case 0:
|
|
2092
|
-
return
|
|
2058
|
+
return _context25.abrupt("return", this.updateOrderProduct(params));
|
|
2093
2059
|
case 1:
|
|
2094
2060
|
case "end":
|
|
2095
|
-
return
|
|
2061
|
+
return _context25.stop();
|
|
2096
2062
|
}
|
|
2097
|
-
},
|
|
2063
|
+
}, _callee25, this);
|
|
2098
2064
|
}));
|
|
2099
|
-
function updateProductInOrder(
|
|
2065
|
+
function updateProductInOrder(_x17) {
|
|
2100
2066
|
return _updateProductInOrder.apply(this, arguments);
|
|
2101
2067
|
}
|
|
2102
2068
|
return updateProductInOrder;
|
|
@@ -2118,47 +2084,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2118
2084
|
}, {
|
|
2119
2085
|
key: "handleGlobalScanCode",
|
|
2120
2086
|
value: (function () {
|
|
2121
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2087
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(code, bridge) {
|
|
2122
2088
|
var _this6 = this;
|
|
2123
2089
|
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2124
|
-
return _regeneratorRuntime().wrap(function
|
|
2125
|
-
while (1) switch (
|
|
2090
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2091
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2126
2092
|
case 0:
|
|
2127
2093
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2128
2094
|
if (trimmed) {
|
|
2129
|
-
|
|
2095
|
+
_context26.next = 4;
|
|
2130
2096
|
break;
|
|
2131
2097
|
}
|
|
2132
2098
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2133
|
-
return
|
|
2099
|
+
return _context26.abrupt("return", {
|
|
2134
2100
|
status: 'failed',
|
|
2135
2101
|
reason: 'empty_code'
|
|
2136
2102
|
});
|
|
2137
2103
|
case 4:
|
|
2138
|
-
|
|
2104
|
+
_context26.prev = 4;
|
|
2139
2105
|
localSearch = function localSearch(v) {
|
|
2140
2106
|
return _this6.store.products.findProductsByCodeOrBarcode(v);
|
|
2141
2107
|
};
|
|
2142
2108
|
scanCallback = handleGlobalScan(this.request, localSearch);
|
|
2143
|
-
|
|
2109
|
+
_context26.next = 9;
|
|
2144
2110
|
return scanCallback({
|
|
2145
2111
|
type: 'nativeScanner',
|
|
2146
2112
|
value: trimmed
|
|
2147
2113
|
});
|
|
2148
2114
|
case 9:
|
|
2149
|
-
raw =
|
|
2115
|
+
raw = _context26.sent;
|
|
2150
2116
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
2151
2117
|
if (formatted) {
|
|
2152
|
-
|
|
2118
|
+
_context26.next = 14;
|
|
2153
2119
|
break;
|
|
2154
2120
|
}
|
|
2155
2121
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2156
|
-
return
|
|
2122
|
+
return _context26.abrupt("return", {
|
|
2157
2123
|
status: 'failed',
|
|
2158
2124
|
reason: 'not_found'
|
|
2159
2125
|
});
|
|
2160
2126
|
case 14:
|
|
2161
|
-
|
|
2127
|
+
_context26.next = 16;
|
|
2162
2128
|
return applyGlobalScan({
|
|
2163
2129
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2164
2130
|
return _this6.setOrderCustomer(customer);
|
|
@@ -2187,25 +2153,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2187
2153
|
}
|
|
2188
2154
|
}, formatted, bridge);
|
|
2189
2155
|
case 16:
|
|
2190
|
-
_result7 =
|
|
2156
|
+
_result7 = _context26.sent;
|
|
2191
2157
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
2192
|
-
return
|
|
2158
|
+
return _context26.abrupt("return", _result7);
|
|
2193
2159
|
case 21:
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
2160
|
+
_context26.prev = 21;
|
|
2161
|
+
_context26.t0 = _context26["catch"](4);
|
|
2162
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context26.t0);
|
|
2197
2163
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2198
|
-
return
|
|
2164
|
+
return _context26.abrupt("return", {
|
|
2199
2165
|
status: 'failed',
|
|
2200
2166
|
reason: 'not_found'
|
|
2201
2167
|
});
|
|
2202
2168
|
case 26:
|
|
2203
2169
|
case "end":
|
|
2204
|
-
return
|
|
2170
|
+
return _context26.stop();
|
|
2205
2171
|
}
|
|
2206
|
-
},
|
|
2172
|
+
}, _callee26, this, [[4, 21]]);
|
|
2207
2173
|
}));
|
|
2208
|
-
function handleGlobalScanCode(
|
|
2174
|
+
function handleGlobalScanCode(_x18, _x19) {
|
|
2209
2175
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
2210
2176
|
}
|
|
2211
2177
|
return handleGlobalScanCode;
|
|
@@ -2218,12 +2184,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2218
2184
|
}, {
|
|
2219
2185
|
key: "destroy",
|
|
2220
2186
|
value: (function () {
|
|
2221
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2187
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2222
2188
|
var _this$scan;
|
|
2223
|
-
return _regeneratorRuntime().wrap(function
|
|
2224
|
-
while (1) switch (
|
|
2189
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2190
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2225
2191
|
case 0:
|
|
2226
|
-
|
|
2192
|
+
_context27.next = 2;
|
|
2227
2193
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
2228
2194
|
case 2:
|
|
2229
2195
|
try {
|
|
@@ -2234,9 +2200,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2234
2200
|
scanCache.clear();
|
|
2235
2201
|
case 4:
|
|
2236
2202
|
case "end":
|
|
2237
|
-
return
|
|
2203
|
+
return _context27.stop();
|
|
2238
2204
|
}
|
|
2239
|
-
},
|
|
2205
|
+
}, _callee27, this);
|
|
2240
2206
|
}));
|
|
2241
2207
|
function destroy() {
|
|
2242
2208
|
return _destroy.apply(this, arguments);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,6 +14,16 @@ export interface Module {
|
|
|
14
14
|
name: string;
|
|
15
15
|
version: string;
|
|
16
16
|
initialize: (core: PisellCore, options: ModuleOptions) => Promise<void> | void;
|
|
17
|
+
/**
|
|
18
|
+
* 父级解决方案运行时更新 otherParams 后,显式通知子模块刷新自己的运行态参数。
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* await module.updateOtherParams?.({ channel: 'pos' }, { changedParams: { channel: 'pos' } });
|
|
22
|
+
*/
|
|
23
|
+
updateOtherParams?: (params: Record<string, any>, meta?: {
|
|
24
|
+
changedParams?: Record<string, any>;
|
|
25
|
+
cover?: boolean;
|
|
26
|
+
}) => Promise<void> | void;
|
|
17
27
|
destroy?: () => Promise<void> | void;
|
|
18
28
|
exports?: Record<string, any>;
|
|
19
29
|
isSolution?: boolean;
|
|
@@ -174,6 +174,9 @@ function cacheItemToBookingInput(cacheItem, options) {
|
|
|
174
174
|
if (ext.holder_id !== void 0 && ext.holder_id !== null) {
|
|
175
175
|
metadata.holder_id = ext.holder_id;
|
|
176
176
|
}
|
|
177
|
+
if (ext.holder !== void 0) {
|
|
178
|
+
metadata.holder = ext.holder;
|
|
179
|
+
}
|
|
177
180
|
if (ext.collect_pax !== void 0)
|
|
178
181
|
metadata.collect_pax = ext.collect_pax;
|
|
179
182
|
const extendCapacity = normalizeExtendCapacityForMetadata(ext.capacity);
|
|
@@ -19,6 +19,13 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
|
|
|
19
19
|
private otherParams;
|
|
20
20
|
constructor(name?: string, version?: string);
|
|
21
21
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* 更新父级解决方案透传的运行态参数,并刷新客户模块缓存配置。
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* customerModule.updateOtherParams({ isFranchisee: true, cacheId: 'cache-2' });
|
|
27
|
+
*/
|
|
28
|
+
updateOtherParams(params: Record<string, any>): void;
|
|
22
29
|
/**
|
|
23
30
|
* 获取客户列表数据(内部方法)
|
|
24
31
|
* @param params 查询参数
|
|
@@ -114,6 +114,18 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
114
114
|
this.fatherModule = options.otherParams.fatherModule;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* 更新父级解决方案透传的运行态参数,并刷新客户模块缓存配置。
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* customerModule.updateOtherParams({ isFranchisee: true, cacheId: 'cache-2' });
|
|
122
|
+
*/
|
|
123
|
+
updateOtherParams(params) {
|
|
124
|
+
this.otherParams = params || {};
|
|
125
|
+
this.openCache = this.otherParams.openCache ?? false;
|
|
126
|
+
this.cacheId = this.otherParams.cacheId;
|
|
127
|
+
this.fatherModule = this.otherParams.fatherModule;
|
|
128
|
+
}
|
|
117
129
|
/**
|
|
118
130
|
* 获取客户列表数据(内部方法)
|
|
119
131
|
* @param params 查询参数
|
|
@@ -17,6 +17,13 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
17
17
|
private otherParams;
|
|
18
18
|
constructor(name?: string, version?: string);
|
|
19
19
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
|
|
25
|
+
*/
|
|
26
|
+
updateOtherParams(params: Record<string, any>): void;
|
|
20
27
|
fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
|
|
21
28
|
getOpenData(): OpenDataConfig | null;
|
|
22
29
|
getLastFetchedAt(): number | null;
|
|
@@ -59,6 +59,18 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
|
|
|
59
59
|
throw new Error("OpenDataModule 需要 window 插件支持");
|
|
60
60
|
console.log("[OpenDataModule] 初始化完成");
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
|
|
67
|
+
*/
|
|
68
|
+
updateOtherParams(params) {
|
|
69
|
+
this.otherParams = params || {};
|
|
70
|
+
this.openCache = this.otherParams.openCache ?? false;
|
|
71
|
+
this.cacheId = this.otherParams.cacheId;
|
|
72
|
+
this.fatherModule = this.otherParams.fatherModule;
|
|
73
|
+
}
|
|
62
74
|
async fetchOpenData(params) {
|
|
63
75
|
var _a, _b;
|
|
64
76
|
const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
|
|
@@ -17,6 +17,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
17
17
|
private cacheId;
|
|
18
18
|
private salesSummaryModuleName;
|
|
19
19
|
private rulesHooksOverride?;
|
|
20
|
+
private moduleHooksOverride?;
|
|
20
21
|
private orderHooks?;
|
|
21
22
|
private otherParams?;
|
|
22
23
|
/** 评估器引用;由 SalesSdkProvider 注入,未注入时 applyPromotion 静默跳过 */
|
|
@@ -43,6 +44,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
43
44
|
private applyProductDiscountPrices;
|
|
44
45
|
constructor(name?: string, version?: string);
|
|
45
46
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* 更新父级解决方案透传的运行态参数,并同步 Order 内部依赖的派生字段。
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* orderModule.updateOtherParams({ cacheId: 'cache-2', channel: 'pos' });
|
|
52
|
+
*/
|
|
53
|
+
updateOtherParams(params: Record<string, any>): void;
|
|
46
54
|
/**
|
|
47
55
|
* 记录信息日志
|
|
48
56
|
*/
|
|
@@ -186,6 +194,41 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
186
194
|
private ensureExtend;
|
|
187
195
|
private captureProductRuntime;
|
|
188
196
|
private createLinkedProductAndBooking;
|
|
197
|
+
/**
|
|
198
|
+
* booking.holder 是提交真源;metadata.holder 作为详情/回显冗余字段同步保存。
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* this.syncBookingMetadataHolder(booking, metadata);
|
|
202
|
+
*/
|
|
203
|
+
private syncBookingMetadataHolder;
|
|
204
|
+
/**
|
|
205
|
+
* 从单条 booking 的 holder / metadata 中收集 holder form_record。
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* const ids = this.collectBookingHolderRecords(booking);
|
|
209
|
+
*/
|
|
210
|
+
private collectBookingHolderRecords;
|
|
211
|
+
/**
|
|
212
|
+
* 按 form_record 顺序读取 booking holder 的主字段名称。
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* const names = this.collectBookingHolderNames(booking);
|
|
216
|
+
*/
|
|
217
|
+
private collectBookingHolderNames;
|
|
218
|
+
/**
|
|
219
|
+
* 按老 ticketBooking `formatHolder` 语义汇总订单顶层 holder。
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* const holder = this.buildTempOrderHolderFromBookings(tempOrder);
|
|
223
|
+
*/
|
|
224
|
+
private buildTempOrderHolderFromBookings;
|
|
225
|
+
/**
|
|
226
|
+
* 将 booking 级 holder 汇总到 tempOrder 顶层 holder。
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* this.syncTempOrderHolderFromBookings(tempOrder);
|
|
230
|
+
*/
|
|
231
|
+
private syncTempOrderHolderFromBookings;
|
|
189
232
|
private getBookingUniqueIdentificationNumber;
|
|
190
233
|
private findBookingIndexByUniqueIdentificationNumber;
|
|
191
234
|
private removeLinkedBookingsForProduct;
|
|
@@ -251,6 +294,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
251
294
|
*/
|
|
252
295
|
updateVoucherOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
|
|
253
296
|
private shouldMergeProductToOrder;
|
|
297
|
+
private hasOrderProductLineNote;
|
|
254
298
|
/**
|
|
255
299
|
* 预约商品加车后的统一收尾:促销、折扣、summary 重算与持久化(批量拆行时只调用一次)。
|
|
256
300
|
*
|