@pisell/pisellos 2.3.66 → 2.3.68
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/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/Order/index.d.ts +22 -2
- package/dist/modules/Order/index.js +313 -142
- package/dist/modules/Order/types.d.ts +13 -1
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Order/utils.js +0 -1
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +21 -7
- package/dist/modules/Rules/index.js +46 -31
- package/dist/solution/BaseSales/index.d.ts +3 -1
- package/dist/solution/BaseSales/index.js +99 -82
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +4 -2
- package/dist/solution/BookingTicket/index.js +89 -65
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/dist/solution/UnifiedBookingSales/index.js +640 -321
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/Order/index.d.ts +22 -2
- package/lib/modules/Order/index.js +212 -54
- package/lib/modules/Order/types.d.ts +13 -1
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Order/utils.js +0 -1
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +12 -0
- package/lib/modules/Rules/index.js +17 -1
- package/lib/solution/BaseSales/index.d.ts +3 -1
- package/lib/solution/BaseSales/index.js +29 -16
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +4 -2
- package/lib/solution/BookingTicket/index.js +35 -12
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +25 -0
- package/lib/solution/UnifiedBookingSales/index.js +188 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
29
29
|
private addTimeProductsCatalog;
|
|
30
30
|
private orderCustomerDiscountRefreshInFlight;
|
|
31
31
|
private orderCustomerDiscountRefreshCustomerId;
|
|
32
|
+
private orderCustomerPromotionRefreshInFlight;
|
|
32
33
|
private loadOpenDataConfigInFlight;
|
|
33
34
|
/**
|
|
34
35
|
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext。
|
|
@@ -284,7 +285,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
284
285
|
restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
285
286
|
/** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
|
|
286
287
|
private buildOrderCustomerPayload;
|
|
287
|
-
|
|
288
|
+
protected refreshDiscountConfigAfterOrderCustomerChange(customerId: number | null): Promise<void>;
|
|
289
|
+
protected waitForOrderCustomerPromotionRefresh(): Promise<void>;
|
|
288
290
|
/**
|
|
289
291
|
* 获取客户分页信息
|
|
290
292
|
* @returns 分页信息
|
|
@@ -328,7 +330,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
328
330
|
* 获取当前的客户搜索条件
|
|
329
331
|
* @returns 当前搜索条件
|
|
330
332
|
*/
|
|
331
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
333
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
332
334
|
/**
|
|
333
335
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
334
336
|
* @returns 客户状态
|
|
@@ -52,6 +52,7 @@ import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resol
|
|
|
52
52
|
import { createUuidV4 } from "../../modules/Order/utils";
|
|
53
53
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
|
|
54
54
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
55
|
+
var USER_PLATFORM = ['pc', 'h5'];
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* 读取已有 booking 的协议唯一值,用于加时商品行绑定原预约。
|
|
@@ -178,6 +179,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
178
179
|
_defineProperty(_assertThisInitialized(_this), "addTimeProductsCatalog", []);
|
|
179
180
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
|
|
180
181
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
182
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
181
183
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
|
|
182
184
|
return _this;
|
|
183
185
|
}
|
|
@@ -400,35 +402,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
400
402
|
value: function () {
|
|
401
403
|
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
402
404
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
403
|
-
var
|
|
405
|
+
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
|
|
404
406
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
405
407
|
while (1) switch (_context5.prev = _context5.next) {
|
|
406
408
|
case 0:
|
|
407
409
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
408
410
|
this.setPaymentNumberDevicePrefix(null);
|
|
409
|
-
openDataConfig = null;
|
|
410
|
-
_context5.prev = 2;
|
|
411
|
-
_context5.next = 5;
|
|
412
|
-
return this.loadOpenDataConfig();
|
|
413
|
-
case 5:
|
|
414
|
-
openDataConfig = _context5.sent;
|
|
415
|
-
_context5.next = 12;
|
|
416
|
-
break;
|
|
417
|
-
case 8:
|
|
418
|
-
_context5.prev = 8;
|
|
419
|
-
_context5.t0 = _context5["catch"](2);
|
|
420
|
-
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
|
|
421
|
-
return _context5.abrupt("return");
|
|
422
|
-
case 12:
|
|
423
|
-
// if (!openDataConfig) return;
|
|
424
411
|
idGenerator = this.getIdGeneratorPlugin();
|
|
425
412
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
426
|
-
_context5.next =
|
|
413
|
+
_context5.next = 5;
|
|
427
414
|
break;
|
|
428
415
|
}
|
|
429
416
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
430
417
|
return _context5.abrupt("return");
|
|
418
|
+
case 5:
|
|
419
|
+
openDataConfig = null;
|
|
420
|
+
_context5.prev = 6;
|
|
421
|
+
_context5.next = 9;
|
|
422
|
+
return this.loadOpenDataConfig();
|
|
423
|
+
case 9:
|
|
424
|
+
openDataConfig = _context5.sent;
|
|
425
|
+
_context5.next = 16;
|
|
426
|
+
break;
|
|
427
|
+
case 12:
|
|
428
|
+
_context5.prev = 12;
|
|
429
|
+
_context5.t0 = _context5["catch"](6);
|
|
430
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
|
|
431
|
+
return _context5.abrupt("return");
|
|
431
432
|
case 16:
|
|
433
|
+
// if (!openDataConfig) return;
|
|
432
434
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
433
435
|
receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
|
|
434
436
|
prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
|
|
@@ -475,7 +477,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
475
477
|
case "end":
|
|
476
478
|
return _context5.stop();
|
|
477
479
|
}
|
|
478
|
-
}, _callee5, this, [[
|
|
480
|
+
}, _callee5, this, [[6, 12], [30, 35]]);
|
|
479
481
|
}));
|
|
480
482
|
function configureIdGeneratorFromOpenData() {
|
|
481
483
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -559,7 +561,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
559
561
|
key: "scanPromotionCode",
|
|
560
562
|
value: function () {
|
|
561
563
|
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
|
|
562
|
-
var raw, scannedList, extractedCustomerId, hasOrderCustomer, tempOrder;
|
|
564
|
+
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
563
565
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
564
566
|
while (1) switch (_context7.prev = _context7.next) {
|
|
565
567
|
case 0:
|
|
@@ -575,33 +577,34 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
575
577
|
raw = _context7.sent;
|
|
576
578
|
scannedList = raw.scannedDiscountList || [];
|
|
577
579
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
578
|
-
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
579
|
-
|
|
580
|
-
|
|
580
|
+
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
581
|
+
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
582
|
+
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
583
|
+
_context7.next = 12;
|
|
581
584
|
break;
|
|
582
585
|
}
|
|
583
|
-
_context7.next =
|
|
586
|
+
_context7.next = 12;
|
|
584
587
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
585
|
-
case
|
|
588
|
+
case 12:
|
|
586
589
|
if (!raw.isAvailable) {
|
|
587
|
-
_context7.next =
|
|
590
|
+
_context7.next = 19;
|
|
588
591
|
break;
|
|
589
592
|
}
|
|
590
|
-
_context7.next =
|
|
593
|
+
_context7.next = 15;
|
|
591
594
|
return this.store.order.recalculateSummary({
|
|
592
595
|
createIfMissing: true
|
|
593
596
|
});
|
|
594
|
-
case
|
|
597
|
+
case 15:
|
|
595
598
|
this.store.order.persistTempOrder();
|
|
596
599
|
tempOrder = this.store.order.ensureTempOrder();
|
|
597
|
-
_context7.next =
|
|
600
|
+
_context7.next = 19;
|
|
598
601
|
return this.effectsEmit('onDiscountApplied', {
|
|
599
602
|
productList: tempOrder.products || [],
|
|
600
603
|
discountList: this.store.order.getDiscountList(),
|
|
601
604
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
602
605
|
tempOrder: tempOrder
|
|
603
606
|
});
|
|
604
|
-
case
|
|
607
|
+
case 19:
|
|
605
608
|
return _context7.abrupt("return", _objectSpread(_objectSpread({
|
|
606
609
|
isAvailable: raw.isAvailable
|
|
607
610
|
}, raw.isAccepted !== undefined ? {
|
|
@@ -611,7 +614,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
611
614
|
unavailableReason: raw.unavailableReason,
|
|
612
615
|
scannedDiscountList: raw.scannedDiscountList
|
|
613
616
|
}));
|
|
614
|
-
case
|
|
617
|
+
case 20:
|
|
615
618
|
case "end":
|
|
616
619
|
return _context7.stop();
|
|
617
620
|
}
|
|
@@ -1556,7 +1559,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1556
1559
|
}, {
|
|
1557
1560
|
key: "setOrderCustomer",
|
|
1558
1561
|
value: function setOrderCustomer(customer) {
|
|
1559
|
-
var _this$store$order$get3
|
|
1562
|
+
var _this$store$order$get3,
|
|
1563
|
+
_this3 = this;
|
|
1560
1564
|
if (!customer) {
|
|
1561
1565
|
this.clearOrderCustomer();
|
|
1562
1566
|
return;
|
|
@@ -1585,8 +1589,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1585
1589
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
|
|
1586
1590
|
this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
|
|
1587
1591
|
// 客户切换可能改变可用促销/赠品;触发一次重算(recursion-safe)。
|
|
1588
|
-
|
|
1592
|
+
var promotionRefreshTask = this.store.order.applyPromotion().then(function () {
|
|
1593
|
+
return undefined;
|
|
1594
|
+
});
|
|
1595
|
+
this.orderCustomerPromotionRefreshInFlight = promotionRefreshTask;
|
|
1596
|
+
void promotionRefreshTask.then(function () {
|
|
1597
|
+
if (_this3.orderCustomerPromotionRefreshInFlight !== promotionRefreshTask) return;
|
|
1598
|
+
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1599
|
+
}, function (error) {
|
|
1589
1600
|
console.error('[BookingTicket] applyPromotion after customer change failed', error);
|
|
1601
|
+
if (_this3.orderCustomerPromotionRefreshInFlight !== promotionRefreshTask) return;
|
|
1602
|
+
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1590
1603
|
});
|
|
1591
1604
|
}
|
|
1592
1605
|
|
|
@@ -1616,7 +1629,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1616
1629
|
value: function clearOrderCustomer() {
|
|
1617
1630
|
var _discountModule$setOr,
|
|
1618
1631
|
_discountModule$setDi,
|
|
1619
|
-
|
|
1632
|
+
_this4 = this;
|
|
1620
1633
|
this.store.order.clearOrderCustomer();
|
|
1621
1634
|
this.discountConfigCacheKey = null;
|
|
1622
1635
|
this.hasManualDiscountSelection = false;
|
|
@@ -1629,9 +1642,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1629
1642
|
createIfMissing: true
|
|
1630
1643
|
}).then(function () {
|
|
1631
1644
|
var _discountModule$getDi;
|
|
1632
|
-
var tempOrder =
|
|
1633
|
-
|
|
1634
|
-
return
|
|
1645
|
+
var tempOrder = _this4.store.order.ensureTempOrder();
|
|
1646
|
+
_this4.store.order.persistTempOrder();
|
|
1647
|
+
return _this4.effectsEmit('onDiscountApplied', {
|
|
1635
1648
|
productList: tempOrder.products || [],
|
|
1636
1649
|
discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
|
|
1637
1650
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
@@ -1692,14 +1705,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1692
1705
|
}, {
|
|
1693
1706
|
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
1694
1707
|
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
1695
|
-
var
|
|
1696
|
-
if (!customerId || customerId === 1) return;
|
|
1708
|
+
var _this5 = this;
|
|
1709
|
+
if (!customerId || customerId === 1) return Promise.resolve();
|
|
1697
1710
|
if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
|
|
1698
|
-
return;
|
|
1711
|
+
return this.orderCustomerDiscountRefreshInFlight;
|
|
1699
1712
|
}
|
|
1700
1713
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1701
1714
|
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1702
|
-
var
|
|
1715
|
+
var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
|
|
1716
|
+
var currentCustomer, tempOrder, orderId, action;
|
|
1703
1717
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1704
1718
|
while (1) switch (_context22.prev = _context22.next) {
|
|
1705
1719
|
case 0:
|
|
@@ -1712,18 +1726,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1712
1726
|
return undefined;
|
|
1713
1727
|
});
|
|
1714
1728
|
case 3:
|
|
1715
|
-
currentCustomer =
|
|
1729
|
+
currentCustomer = _this5.store.order.getOrderCustomer();
|
|
1716
1730
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1717
1731
|
_context22.next = 6;
|
|
1718
1732
|
break;
|
|
1719
1733
|
}
|
|
1720
1734
|
return _context22.abrupt("return");
|
|
1721
1735
|
case 6:
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1736
|
+
tempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
|
|
1737
|
+
orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 || (_this5$getOrderIdenti = _this5$getOrderIdenti.call(_this5)) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.orderId);
|
|
1738
|
+
action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1739
|
+
_context22.next = 11;
|
|
1740
|
+
return _this5.loadDiscountConfig({
|
|
1741
|
+
customerId: customerId,
|
|
1742
|
+
action: action
|
|
1725
1743
|
});
|
|
1726
|
-
case
|
|
1744
|
+
case 11:
|
|
1727
1745
|
case "end":
|
|
1728
1746
|
return _context22.stop();
|
|
1729
1747
|
}
|
|
@@ -1734,10 +1752,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1734
1752
|
refreshTask.catch(function (error) {
|
|
1735
1753
|
console.error('Failed to load discount config after customer change:', error);
|
|
1736
1754
|
}).finally(function () {
|
|
1737
|
-
if (
|
|
1738
|
-
|
|
1739
|
-
|
|
1755
|
+
if (_this5.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
1756
|
+
_this5.orderCustomerDiscountRefreshInFlight = null;
|
|
1757
|
+
_this5.orderCustomerDiscountRefreshCustomerId = null;
|
|
1740
1758
|
});
|
|
1759
|
+
return refreshTask;
|
|
1760
|
+
}
|
|
1761
|
+
}, {
|
|
1762
|
+
key: "waitForOrderCustomerPromotionRefresh",
|
|
1763
|
+
value: function waitForOrderCustomerPromotionRefresh() {
|
|
1764
|
+
return this.orderCustomerPromotionRefreshInFlight || Promise.resolve();
|
|
1741
1765
|
}
|
|
1742
1766
|
|
|
1743
1767
|
/**
|
|
@@ -1921,9 +1945,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1921
1945
|
}, {
|
|
1922
1946
|
key: "scanGlobalListener",
|
|
1923
1947
|
value: function scanGlobalListener(callback) {
|
|
1924
|
-
var
|
|
1948
|
+
var _this6 = this;
|
|
1925
1949
|
var localSearch = function localSearch(v) {
|
|
1926
|
-
return
|
|
1950
|
+
return _this6.store.products.findProductsByCodeOrBarcode(v);
|
|
1927
1951
|
};
|
|
1928
1952
|
var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
1929
1953
|
var safeCallback = function safeCallback(d) {
|
|
@@ -2399,7 +2423,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2399
2423
|
key: "handleGlobalScanCode",
|
|
2400
2424
|
value: (function () {
|
|
2401
2425
|
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(code, bridge) {
|
|
2402
|
-
var
|
|
2426
|
+
var _this7 = this;
|
|
2403
2427
|
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2404
2428
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2405
2429
|
while (1) switch (_context28.prev = _context28.next) {
|
|
@@ -2417,7 +2441,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2417
2441
|
case 4:
|
|
2418
2442
|
_context28.prev = 4;
|
|
2419
2443
|
localSearch = function localSearch(v) {
|
|
2420
|
-
return
|
|
2444
|
+
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2421
2445
|
};
|
|
2422
2446
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2423
2447
|
_context28.next = 9;
|
|
@@ -2441,35 +2465,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2441
2465
|
_context28.next = 16;
|
|
2442
2466
|
return applyGlobalScan({
|
|
2443
2467
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2444
|
-
return
|
|
2468
|
+
return _this7.setOrderCustomer(customer);
|
|
2445
2469
|
},
|
|
2446
2470
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2447
|
-
return
|
|
2471
|
+
return _this7.getOrderCustomerSnapshot();
|
|
2448
2472
|
},
|
|
2449
2473
|
getBusinessCode: function getBusinessCode() {
|
|
2450
|
-
var
|
|
2451
|
-
return (
|
|
2474
|
+
var _this7$otherParams;
|
|
2475
|
+
return (_this7$otherParams = _this7.otherParams) === null || _this7$otherParams === void 0 ? void 0 : _this7$otherParams.businessCode;
|
|
2452
2476
|
},
|
|
2453
2477
|
buildAddProductCtx: function buildAddProductCtx(extra) {
|
|
2454
|
-
return
|
|
2478
|
+
return _this7.buildAddProductCtx(extra);
|
|
2455
2479
|
},
|
|
2456
2480
|
decideAddProduct: function decideAddProduct(item, options) {
|
|
2457
|
-
return
|
|
2481
|
+
return _this7.decideAddProduct(item, options);
|
|
2458
2482
|
},
|
|
2459
2483
|
decideAfterDetail: function decideAfterDetail(cacheItem, options) {
|
|
2460
|
-
return
|
|
2484
|
+
return _this7.decideAfterDetail(cacheItem, options);
|
|
2461
2485
|
},
|
|
2462
2486
|
transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
|
|
2463
|
-
return
|
|
2487
|
+
return _this7.transformDetailToProductAndBooking(input);
|
|
2464
2488
|
},
|
|
2465
2489
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
2466
|
-
return
|
|
2490
|
+
return _this7.addProductToOrder(product, booking);
|
|
2467
2491
|
},
|
|
2468
2492
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
2469
|
-
return
|
|
2493
|
+
return _this7.refreshWalletAssets(params);
|
|
2470
2494
|
},
|
|
2471
2495
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
2472
|
-
return
|
|
2496
|
+
return _this7.scanWalletAsset(scanCode);
|
|
2473
2497
|
}
|
|
2474
2498
|
}, formatted, bridge);
|
|
2475
2499
|
case 16:
|
|
@@ -2608,7 +2632,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2608
2632
|
key: "addAddTimeProductsToBooking",
|
|
2609
2633
|
value: (function () {
|
|
2610
2634
|
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
|
|
2611
|
-
var
|
|
2635
|
+
var _this8 = this,
|
|
2612
2636
|
_input$bookingPatch;
|
|
2613
2637
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2614
2638
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
@@ -2623,7 +2647,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2623
2647
|
case 3:
|
|
2624
2648
|
orderLines = (input.products || []).map(function (line) {
|
|
2625
2649
|
return {
|
|
2626
|
-
product:
|
|
2650
|
+
product: _this8.buildAddTimeOrderLine(line, bookingUid)
|
|
2627
2651
|
};
|
|
2628
2652
|
});
|
|
2629
2653
|
if (this.store.order) {
|
|
@@ -388,35 +388,46 @@ export function attachItemRuleLimitsToTopLevelProducts(productList, limits) {
|
|
|
388
388
|
* 数组元素先按主键排序再序列化,避免顺序差异导致误判为不同行。
|
|
389
389
|
*/
|
|
390
390
|
export function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
391
|
-
var
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
391
|
+
var normalizeOptions = function normalizeOptions(options) {
|
|
392
|
+
var optionArr = Array.isArray(options) ? options : [];
|
|
393
|
+
return optionArr.map(function (item) {
|
|
394
|
+
var _ref, _item$add_price;
|
|
395
|
+
return {
|
|
396
|
+
option_group_item_id: Number(item === null || item === void 0 ? void 0 : item.option_group_item_id) || 0,
|
|
397
|
+
option_group_id: Number(item === null || item === void 0 ? void 0 : item.option_group_id) || 0,
|
|
398
|
+
num: typeof (item === null || item === void 0 ? void 0 : item.num) === 'number' && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
399
|
+
price: String((_ref = (_item$add_price = item === null || item === void 0 ? void 0 : item.add_price) !== null && _item$add_price !== void 0 ? _item$add_price : item === null || item === void 0 ? void 0 : item.price) !== null && _ref !== void 0 ? _ref : '')
|
|
400
|
+
};
|
|
401
|
+
}).sort(function (p, q) {
|
|
402
|
+
if (p.option_group_item_id !== q.option_group_item_id) {
|
|
403
|
+
return p.option_group_item_id - q.option_group_item_id;
|
|
404
|
+
}
|
|
405
|
+
if (p.option_group_id !== q.option_group_id) {
|
|
406
|
+
return p.option_group_id - q.option_group_id;
|
|
407
|
+
}
|
|
408
|
+
if (p.num !== q.num) return p.num - q.num;
|
|
409
|
+
return p.price.localeCompare(q.price);
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
var normalizedOpts = normalizeOptions(productOptionItem);
|
|
408
413
|
var bundleArr = Array.isArray(productBundle) ? productBundle : [];
|
|
409
414
|
var normalizedBundles = bundleArr.map(function (item) {
|
|
410
|
-
var _ref2, _item$bundle_id;
|
|
415
|
+
var _ref2, _item$bundle_id, _item$bundle_variant_;
|
|
411
416
|
return {
|
|
412
417
|
bundle_id: Number((_ref2 = (_item$bundle_id = item === null || item === void 0 ? void 0 : item.bundle_id) !== null && _item$bundle_id !== void 0 ? _item$bundle_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref2 !== void 0 ? _ref2 : 0) || 0,
|
|
413
418
|
product_id: Number(item === null || item === void 0 ? void 0 : item.product_id) || 0,
|
|
414
|
-
|
|
419
|
+
product_variant_id: Number((_item$bundle_variant_ = item === null || item === void 0 ? void 0 : item.bundle_variant_id) !== null && _item$bundle_variant_ !== void 0 ? _item$bundle_variant_ : item === null || item === void 0 ? void 0 : item.product_variant_id) || 0,
|
|
420
|
+
num: typeof (item === null || item === void 0 ? void 0 : item.num) === 'number' && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
421
|
+
option: normalizeOptions(item === null || item === void 0 ? void 0 : item.option)
|
|
415
422
|
};
|
|
416
423
|
}).sort(function (p, q) {
|
|
417
424
|
if (p.bundle_id !== q.bundle_id) return p.bundle_id - q.bundle_id;
|
|
418
425
|
if (p.product_id !== q.product_id) return p.product_id - q.product_id;
|
|
419
|
-
|
|
426
|
+
if (p.product_variant_id !== q.product_variant_id) {
|
|
427
|
+
return p.product_variant_id - q.product_variant_id;
|
|
428
|
+
}
|
|
429
|
+
if (p.num !== q.num) return p.num - q.num;
|
|
430
|
+
return JSON.stringify(p.option).localeCompare(JSON.stringify(q.option));
|
|
420
431
|
});
|
|
421
432
|
return JSON.stringify([normalizedOpts, normalizedBundles]);
|
|
422
433
|
}
|
|
@@ -63,6 +63,24 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
63
63
|
private openDataTarget;
|
|
64
64
|
private loadOpenDataInFlight;
|
|
65
65
|
private loadOpenDataInFlightTarget;
|
|
66
|
+
protected getSubmitOrderSalesChannel(): string;
|
|
67
|
+
protected isSessionStoragePersistEnabled(): boolean;
|
|
68
|
+
protected shouldUseSessionStorageForSubModule(moduleName?: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* 读取与当前 cacheId 同分桶的 Solution 会话状态。
|
|
71
|
+
* 该状态独立于 otherParams,适合页面皮肤保存短生命周期 UI 状态。
|
|
72
|
+
*/
|
|
73
|
+
getSessionStateValue<T = unknown>(key: string): T | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* 写入与当前 cacheId 同分桶的 Solution 会话状态。
|
|
76
|
+
* value 为 undefined 时删除该 key;存储失败不阻断业务流程。
|
|
77
|
+
*/
|
|
78
|
+
setSessionStateValue(key: string, value: unknown): void;
|
|
79
|
+
/**
|
|
80
|
+
* 清除当前 cacheId 的可恢复订单快照,同时保留 Solution UI sessionState。
|
|
81
|
+
* 用于支付跳转等终态场景,避免浏览器返回时恢复已提交订单。
|
|
82
|
+
*/
|
|
83
|
+
clearSessionStorageOrderSnapshot(): void;
|
|
66
84
|
/**
|
|
67
85
|
* Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
|
|
68
86
|
* 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
|
|
@@ -72,6 +90,13 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
72
90
|
protected getDefaultCheckoutSmallTicketDataFlag(): number;
|
|
73
91
|
protected getRegisteredModuleNames(): readonly string[];
|
|
74
92
|
protected createSubModule(moduleName: string): Module | null;
|
|
93
|
+
addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
94
|
+
syncAuthenticatedOrderCustomer(): Promise<boolean>;
|
|
95
|
+
private isAuthenticatedCustomerUserPlatform;
|
|
96
|
+
private resolveDiscountOrderIdentity;
|
|
97
|
+
private resolveDiscountAction;
|
|
98
|
+
private resetCachedCustomerDiscountState;
|
|
99
|
+
private refreshLegacySessionCustomerDiscounts;
|
|
75
100
|
/**
|
|
76
101
|
* Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
|
|
77
102
|
* business/channel target so a reused solution instance cannot leak another entry's menus.
|