@pisell/pisellos 2.3.9 → 2.3.11
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/Order/index.js +3 -1
- package/dist/server/index.js +5 -3
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +50 -28
- package/dist/solution/BaseSales/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +7 -0
- package/dist/solution/BookingTicket/index.js +86 -6
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Order/index.js +4 -1
- package/lib/server/index.js +5 -3
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +18 -1
- package/lib/solution/BaseSales/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +7 -0
- package/lib/solution/BookingTicket/index.js +40 -0
- package/package.json +1 -1
|
@@ -4640,7 +4640,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
4640
4640
|
this.logInfo('runSubmitTempOrder: 提交成功', {
|
|
4641
4641
|
submittedOrderId: submittedOrderId,
|
|
4642
4642
|
result: result,
|
|
4643
|
-
tempOrder: tempOrder
|
|
4643
|
+
tempOrder: _objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
4644
|
+
_extend: undefined
|
|
4645
|
+
})
|
|
4644
4646
|
});
|
|
4645
4647
|
if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
|
|
4646
4648
|
_context32.next = 56;
|
package/dist/server/index.js
CHANGED
|
@@ -4235,10 +4235,12 @@ var Server = /*#__PURE__*/function () {
|
|
|
4235
4235
|
action: 'print_all',
|
|
4236
4236
|
device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
|
|
4237
4237
|
payload: {
|
|
4238
|
-
type:
|
|
4238
|
+
type: '99',
|
|
4239
4239
|
data: params.receiptOnly ? {
|
|
4240
4240
|
order_id: printIdentity,
|
|
4241
|
-
small_ticket_data: (_params$syncedOrder = params.syncedOrder) === null || _params$syncedOrder === void 0 || (_params$syncedOrder = _params$syncedOrder.payment_info) === null || _params$syncedOrder === void 0 ? void 0 : _params$syncedOrder.small_ticket_data
|
|
4241
|
+
small_ticket_data: (_params$syncedOrder = params.syncedOrder) === null || _params$syncedOrder === void 0 || (_params$syncedOrder = _params$syncedOrder.payment_info) === null || _params$syncedOrder === void 0 ? void 0 : _params$syncedOrder.small_ticket_data,
|
|
4242
|
+
skip_wristband: true,
|
|
4243
|
+
skip_voucher: true
|
|
4242
4244
|
} : {
|
|
4243
4245
|
order_id: printIdentity,
|
|
4244
4246
|
machine_code_print_info: (_params$syncedOrder2 = params.syncedOrder) === null || _params$syncedOrder2 === void 0 || (_params$syncedOrder2 = _params$syncedOrder2.payment_info) === null || _params$syncedOrder2 === void 0 ? void 0 : _params$syncedOrder2.machine_code_print_info,
|
|
@@ -4249,7 +4251,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
4249
4251
|
idempotency_key: this.buildPrintOtherReceiptIdempotencyKey(params.syncedOrder, {
|
|
4250
4252
|
receiptOnly: params.receiptOnly
|
|
4251
4253
|
}),
|
|
4252
|
-
name: '
|
|
4254
|
+
name: 'PRINT_V1',
|
|
4253
4255
|
source: 'server',
|
|
4254
4256
|
source_type: 'order',
|
|
4255
4257
|
source_id: printIdentity
|
|
@@ -180,6 +180,7 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
180
180
|
* const idx = this.lookupOrderIndexByIdentityKeys(identityKeyToIndex, freshIdentityKeys)
|
|
181
181
|
*/
|
|
182
182
|
private lookupOrderIndexByIdentityKeys;
|
|
183
|
+
private isRemoteEchoMergeSource;
|
|
183
184
|
/**
|
|
184
185
|
* 将订单的全部身份键登记到索引并指向其在列表中的下标。
|
|
185
186
|
* 合并后订单新增的身份字段(如挂单同步后拿到 order_id)也会被登记。
|
|
@@ -1607,7 +1607,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1607
1607
|
key: "mergeOrdersToStore",
|
|
1608
1608
|
value: (function () {
|
|
1609
1609
|
var _mergeOrdersToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(freshOrders, source) {
|
|
1610
|
-
var storeOrderCountBefore, normalizedFreshOrders, _iterator9, _step9, order, id, uniqueFreshOrders, uniqueFreshCount, patchedOrders, mergeActions, updatedList, identityKeyToIndex, index, identityKeys, _iterator10, _step10, key, _iterator11, _step11, fresh, freshIdentityKeys, matchIndex, storageKey, mergeKey, mergedOrder, insertIndex, insertCount, updateCount;
|
|
1610
|
+
var storeOrderCountBefore, normalizedFreshOrders, _iterator9, _step9, order, id, uniqueFreshOrders, uniqueFreshCount, patchedOrders, mergeActions, updatedList, identityKeyToIndex, index, identityKeys, _iterator10, _step10, key, _iterator11, _step11, fresh, freshIdentityKeys, matchIndex, storageKey, mergeKey, existingOrder, _ref2, _existingOrder$order_, _ref3, _external_sale_number, _existingOrder$paymen, _fresh$payment_status, _existingOrder$need_s, _fresh$need_sync, mergedOrder, insertIndex, insertCount, updateCount;
|
|
1611
1611
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1612
1612
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1613
1613
|
case 0:
|
|
@@ -1680,7 +1680,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1680
1680
|
_iterator11.s();
|
|
1681
1681
|
case 33:
|
|
1682
1682
|
if ((_step11 = _iterator11.n()).done) {
|
|
1683
|
-
_context16.next =
|
|
1683
|
+
_context16.next = 57;
|
|
1684
1684
|
break;
|
|
1685
1685
|
}
|
|
1686
1686
|
fresh = _step11.value;
|
|
@@ -1689,38 +1689,55 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1689
1689
|
storageKey = this.getOrderStorageKey(fresh);
|
|
1690
1690
|
mergeKey = storageKey || (fresh.order_id !== undefined && fresh.order_id !== null ? this.getIdKey(fresh.order_id) : '');
|
|
1691
1691
|
if (!(matchIndex >= 0)) {
|
|
1692
|
-
_context16.next =
|
|
1692
|
+
_context16.next = 50;
|
|
1693
1693
|
break;
|
|
1694
1694
|
}
|
|
1695
|
-
|
|
1695
|
+
existingOrder = updatedList[matchIndex];
|
|
1696
|
+
if (!(this.isPendingSyncOrder(existingOrder) && this.isRemoteEchoMergeSource(source))) {
|
|
1697
|
+
_context16.next = 44;
|
|
1698
|
+
break;
|
|
1699
|
+
}
|
|
1700
|
+
this.logInfo('mergeOrdersToStore-跳过 pending 订单远端覆盖', {
|
|
1701
|
+
source: source,
|
|
1702
|
+
order_id: (_ref2 = (_existingOrder$order_ = existingOrder.order_id) !== null && _existingOrder$order_ !== void 0 ? _existingOrder$order_ : fresh.order_id) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
1703
|
+
external_sale_number: (_ref3 = (_external_sale_number = existingOrder.external_sale_number) !== null && _external_sale_number !== void 0 ? _external_sale_number : fresh.external_sale_number) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
1704
|
+
local_payment_status: (_existingOrder$paymen = existingOrder.payment_status) !== null && _existingOrder$paymen !== void 0 ? _existingOrder$paymen : null,
|
|
1705
|
+
remote_payment_status: (_fresh$payment_status = fresh.payment_status) !== null && _fresh$payment_status !== void 0 ? _fresh$payment_status : null,
|
|
1706
|
+
local_need_sync: (_existingOrder$need_s = existingOrder.need_sync) !== null && _existingOrder$need_s !== void 0 ? _existingOrder$need_s : null,
|
|
1707
|
+
remote_need_sync: (_fresh$need_sync = fresh.need_sync) !== null && _fresh$need_sync !== void 0 ? _fresh$need_sync : null,
|
|
1708
|
+
reason: 'protect_pending_sync_order_from_remote_echo'
|
|
1709
|
+
});
|
|
1710
|
+
return _context16.abrupt("continue", 55);
|
|
1711
|
+
case 44:
|
|
1712
|
+
mergedOrder = this.mergeOrderRecords(existingOrder, fresh);
|
|
1696
1713
|
updatedList[matchIndex] = mergedOrder;
|
|
1697
1714
|
// 合并后身份字段可能新增(如挂单拿到 order_id),同步登记到索引,
|
|
1698
1715
|
// 供同批后续 fresh 命中同一槽位,避免重复插入
|
|
1699
1716
|
this.registerOrderIdentityKeys(identityKeyToIndex, mergedOrder, matchIndex);
|
|
1700
1717
|
patchedOrders.push(mergedOrder);
|
|
1701
1718
|
if (mergeKey) mergeActions[mergeKey] = 'update';
|
|
1702
|
-
return _context16.abrupt("continue",
|
|
1703
|
-
case
|
|
1719
|
+
return _context16.abrupt("continue", 55);
|
|
1720
|
+
case 50:
|
|
1704
1721
|
insertIndex = updatedList.length;
|
|
1705
1722
|
updatedList.push(fresh);
|
|
1706
1723
|
this.registerOrderIdentityKeys(identityKeyToIndex, fresh, insertIndex);
|
|
1707
1724
|
patchedOrders.push(fresh);
|
|
1708
1725
|
if (mergeKey) mergeActions[mergeKey] = 'insert';
|
|
1709
|
-
case
|
|
1726
|
+
case 55:
|
|
1710
1727
|
_context16.next = 33;
|
|
1711
1728
|
break;
|
|
1712
|
-
case
|
|
1713
|
-
_context16.next =
|
|
1729
|
+
case 57:
|
|
1730
|
+
_context16.next = 62;
|
|
1714
1731
|
break;
|
|
1715
|
-
case
|
|
1716
|
-
_context16.prev =
|
|
1732
|
+
case 59:
|
|
1733
|
+
_context16.prev = 59;
|
|
1717
1734
|
_context16.t1 = _context16["catch"](31);
|
|
1718
1735
|
_iterator11.e(_context16.t1);
|
|
1719
|
-
case
|
|
1720
|
-
_context16.prev =
|
|
1736
|
+
case 62:
|
|
1737
|
+
_context16.prev = 62;
|
|
1721
1738
|
_iterator11.f();
|
|
1722
|
-
return _context16.finish(
|
|
1723
|
-
case
|
|
1739
|
+
return _context16.finish(62);
|
|
1740
|
+
case 65:
|
|
1724
1741
|
insertCount = Object.values(mergeActions).filter(function (v) {
|
|
1725
1742
|
return v === 'insert';
|
|
1726
1743
|
}).length;
|
|
@@ -1736,22 +1753,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1736
1753
|
// 仅在自检开关开启时做一次兜底校验。
|
|
1737
1754
|
this.store.list = this.runOrderStoreSelfCheck(updatedList, "".concat(source, ".store"));
|
|
1738
1755
|
this.syncOrdersMap();
|
|
1739
|
-
_context16.next =
|
|
1756
|
+
_context16.next = 72;
|
|
1740
1757
|
return this.patchOrdersInSQLite(patchedOrders, source, mergeActions);
|
|
1741
|
-
case
|
|
1758
|
+
case 72:
|
|
1742
1759
|
this.logInfo('mergeOrdersToStore-结束', {
|
|
1743
1760
|
uniqueFreshCount: uniqueFreshCount,
|
|
1744
1761
|
storeOrderCountAfter: this.store.list.length,
|
|
1745
1762
|
insertCount: insertCount,
|
|
1746
1763
|
updateCount: updateCount
|
|
1747
1764
|
});
|
|
1748
|
-
_context16.next =
|
|
1765
|
+
_context16.next = 75;
|
|
1749
1766
|
return this.emitOrdersChanged(patchedOrders, source);
|
|
1750
|
-
case
|
|
1767
|
+
case 75:
|
|
1751
1768
|
case "end":
|
|
1752
1769
|
return _context16.stop();
|
|
1753
1770
|
}
|
|
1754
|
-
}, _callee16, this, [[5, 17, 20, 23], [31,
|
|
1771
|
+
}, _callee16, this, [[5, 17, 20, 23], [31, 59, 62, 65]]);
|
|
1755
1772
|
}));
|
|
1756
1773
|
function mergeOrdersToStore(_x9, _x10) {
|
|
1757
1774
|
return _mergeOrdersToStore.apply(this, arguments);
|
|
@@ -1786,6 +1803,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1786
1803
|
}
|
|
1787
1804
|
return matchIndex;
|
|
1788
1805
|
}
|
|
1806
|
+
}, {
|
|
1807
|
+
key: "isRemoteEchoMergeSource",
|
|
1808
|
+
value: function isRemoteEchoMergeSource(source) {
|
|
1809
|
+
return source === 'pubsub.bodyUpsert' || source === 'pubsub.httpRefresh';
|
|
1810
|
+
}
|
|
1789
1811
|
|
|
1790
1812
|
/**
|
|
1791
1813
|
* 将订单的全部身份键登记到索引并指向其在列表中的下标。
|
|
@@ -2166,22 +2188,22 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2166
2188
|
} finally {
|
|
2167
2189
|
_iterator20.f();
|
|
2168
2190
|
}
|
|
2169
|
-
return _toConsumableArray(groups.entries()).filter(function (
|
|
2170
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
2171
|
-
group = _ref3[1];
|
|
2172
|
-
return group.length > 1;
|
|
2173
|
-
}).slice(0, 20).map(function (_ref4) {
|
|
2191
|
+
return _toConsumableArray(groups.entries()).filter(function (_ref4) {
|
|
2174
2192
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
2175
|
-
key = _ref5[0],
|
|
2176
2193
|
group = _ref5[1];
|
|
2194
|
+
return group.length > 1;
|
|
2195
|
+
}).slice(0, 20).map(function (_ref6) {
|
|
2196
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
2197
|
+
key = _ref7[0],
|
|
2198
|
+
group = _ref7[1];
|
|
2177
2199
|
return {
|
|
2178
2200
|
key: key,
|
|
2179
2201
|
count: group.length,
|
|
2180
2202
|
orders: group.map(function (order) {
|
|
2181
|
-
var _order$order_id2,
|
|
2203
|
+
var _order$order_id2, _external_sale_number2, _shop_order_number, _shop_full_order_numb, _order$need_sync;
|
|
2182
2204
|
return {
|
|
2183
2205
|
order_id: (_order$order_id2 = order.order_id) !== null && _order$order_id2 !== void 0 ? _order$order_id2 : null,
|
|
2184
|
-
external_sale_number: (
|
|
2206
|
+
external_sale_number: (_external_sale_number2 = order.external_sale_number) !== null && _external_sale_number2 !== void 0 ? _external_sale_number2 : null,
|
|
2185
2207
|
shop_order_number: (_shop_order_number = order.shop_order_number) !== null && _shop_order_number !== void 0 ? _shop_order_number : null,
|
|
2186
2208
|
shop_full_order_number: (_shop_full_order_numb = order.shop_full_order_number) !== null && _shop_full_order_numb !== void 0 ? _shop_full_order_numb : null,
|
|
2187
2209
|
need_sync: (_order$need_sync = order.need_sync) !== null && _order$need_sync !== void 0 ? _order$need_sync : null
|
|
@@ -30,7 +30,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
30
30
|
protected defaultVersion: string;
|
|
31
31
|
isSolution: boolean;
|
|
32
32
|
protected initializeOptions: ModuleOptions;
|
|
33
|
-
|
|
33
|
+
protected logger: any;
|
|
34
34
|
protected appPlugin: AppPlugin;
|
|
35
35
|
protected store: BaseSalesState;
|
|
36
36
|
protected otherParams: Record<string, any>;
|
|
@@ -551,6 +551,13 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
551
551
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
552
552
|
cover?: boolean;
|
|
553
553
|
}): Promise<void>;
|
|
554
|
+
private getDeviceTaskPlugin;
|
|
555
|
+
handlePrintWristband(params: {
|
|
556
|
+
voucher_ids: number[];
|
|
557
|
+
}): Promise<void>;
|
|
558
|
+
handleCheckIn(params: {
|
|
559
|
+
voucher_ids: number[];
|
|
560
|
+
}): Promise<void>;
|
|
554
561
|
/**
|
|
555
562
|
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
556
563
|
* 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
|
|
@@ -49,6 +49,7 @@ import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItem
|
|
|
49
49
|
import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
|
|
50
50
|
import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
|
|
51
51
|
import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
|
|
52
|
+
import { createUuidV4 } from "../../modules/Order/utils";
|
|
52
53
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
|
|
53
54
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
54
55
|
|
|
@@ -2586,6 +2587,85 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2586
2587
|
}
|
|
2587
2588
|
return setOtherParams;
|
|
2588
2589
|
}()
|
|
2590
|
+
}, {
|
|
2591
|
+
key: "getDeviceTaskPlugin",
|
|
2592
|
+
value: function getDeviceTaskPlugin() {
|
|
2593
|
+
var _app$getApp;
|
|
2594
|
+
var app = this.core.getPlugin('app');
|
|
2595
|
+
return (app === null || app === void 0 || (_app$getApp = app.getApp()) === null || _app$getApp === void 0 ? void 0 : _app$getApp.getPlugin('deviceTask')) || null;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
// 打印手环,单个或批量都可以
|
|
2599
|
+
}, {
|
|
2600
|
+
key: "handlePrintWristband",
|
|
2601
|
+
value: function () {
|
|
2602
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
|
|
2603
|
+
var deviceTask, deviceId;
|
|
2604
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2605
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2606
|
+
case 0:
|
|
2607
|
+
deviceTask = this.getDeviceTaskPlugin();
|
|
2608
|
+
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
2609
|
+
_context32.next = 4;
|
|
2610
|
+
break;
|
|
2611
|
+
}
|
|
2612
|
+
this.logger.addLog({
|
|
2613
|
+
type: 'info',
|
|
2614
|
+
title: '[BookingTicket] handlePrintWristband: deviceTask.dispatch 不可用',
|
|
2615
|
+
metadata: {
|
|
2616
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2617
|
+
}
|
|
2618
|
+
});
|
|
2619
|
+
return _context32.abrupt("return");
|
|
2620
|
+
case 4:
|
|
2621
|
+
_context32.next = 6;
|
|
2622
|
+
return this.getShortNumberOrDeviceId();
|
|
2623
|
+
case 6:
|
|
2624
|
+
deviceId = _context32.sent;
|
|
2625
|
+
deviceTask.dispatch({
|
|
2626
|
+
action: 'print_v1',
|
|
2627
|
+
device_id: deviceId,
|
|
2628
|
+
payload: {
|
|
2629
|
+
type: 'WRISTBAND',
|
|
2630
|
+
data: {
|
|
2631
|
+
order_id: this.getOrderIdentity(),
|
|
2632
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2633
|
+
}
|
|
2634
|
+
},
|
|
2635
|
+
idempotency_key: createUuidV4(),
|
|
2636
|
+
name: 'PRINT_V1',
|
|
2637
|
+
source: 'server',
|
|
2638
|
+
source_type: 'order',
|
|
2639
|
+
source_id: createUuidV4()
|
|
2640
|
+
});
|
|
2641
|
+
case 8:
|
|
2642
|
+
case "end":
|
|
2643
|
+
return _context32.stop();
|
|
2644
|
+
}
|
|
2645
|
+
}, _callee32, this);
|
|
2646
|
+
}));
|
|
2647
|
+
function handlePrintWristband(_x23) {
|
|
2648
|
+
return _handlePrintWristband.apply(this, arguments);
|
|
2649
|
+
}
|
|
2650
|
+
return handlePrintWristband;
|
|
2651
|
+
}() // 触发 checkIn
|
|
2652
|
+
}, {
|
|
2653
|
+
key: "handleCheckIn",
|
|
2654
|
+
value: function () {
|
|
2655
|
+
var _handleCheckIn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
2656
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2657
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2658
|
+
case 0:
|
|
2659
|
+
case "end":
|
|
2660
|
+
return _context33.stop();
|
|
2661
|
+
}
|
|
2662
|
+
}, _callee33);
|
|
2663
|
+
}));
|
|
2664
|
+
function handleCheckIn(_x24) {
|
|
2665
|
+
return _handleCheckIn.apply(this, arguments);
|
|
2666
|
+
}
|
|
2667
|
+
return handleCheckIn;
|
|
2668
|
+
}()
|
|
2589
2669
|
/**
|
|
2590
2670
|
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
2591
2671
|
* 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
|
|
@@ -2593,12 +2673,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2593
2673
|
}, {
|
|
2594
2674
|
key: "destroy",
|
|
2595
2675
|
value: (function () {
|
|
2596
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2676
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2597
2677
|
var _this$scan;
|
|
2598
|
-
return _regeneratorRuntime().wrap(function
|
|
2599
|
-
while (1) switch (
|
|
2678
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2679
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2600
2680
|
case 0:
|
|
2601
|
-
|
|
2681
|
+
_context34.next = 2;
|
|
2602
2682
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
2603
2683
|
case 2:
|
|
2604
2684
|
try {
|
|
@@ -2609,9 +2689,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2609
2689
|
scanCache.clear();
|
|
2610
2690
|
case 4:
|
|
2611
2691
|
case "end":
|
|
2612
|
-
return
|
|
2692
|
+
return _context34.stop();
|
|
2613
2693
|
}
|
|
2614
|
-
},
|
|
2694
|
+
}, _callee34, this);
|
|
2615
2695
|
}));
|
|
2616
2696
|
function destroy() {
|
|
2617
2697
|
return _destroy.apply(this, arguments);
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
|
@@ -3454,7 +3454,10 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3454
3454
|
this.logInfo("runSubmitTempOrder: 提交成功", {
|
|
3455
3455
|
submittedOrderId,
|
|
3456
3456
|
result,
|
|
3457
|
-
tempOrder
|
|
3457
|
+
tempOrder: {
|
|
3458
|
+
...tempOrder,
|
|
3459
|
+
_extend: void 0
|
|
3460
|
+
}
|
|
3458
3461
|
});
|
|
3459
3462
|
if (submittedOrderId !== null && submittedOrderId !== void 0) {
|
|
3460
3463
|
tempOrder.order_id = submittedOrderId;
|
package/lib/server/index.js
CHANGED
|
@@ -2656,10 +2656,12 @@ var Server = class {
|
|
|
2656
2656
|
action: "print_all",
|
|
2657
2657
|
device_id: params.deviceId ?? deviceId,
|
|
2658
2658
|
payload: {
|
|
2659
|
-
type:
|
|
2659
|
+
type: "99",
|
|
2660
2660
|
data: params.receiptOnly ? {
|
|
2661
2661
|
order_id: printIdentity,
|
|
2662
|
-
small_ticket_data: (_b = (_a = params.syncedOrder) == null ? void 0 : _a.payment_info) == null ? void 0 : _b.small_ticket_data
|
|
2662
|
+
small_ticket_data: (_b = (_a = params.syncedOrder) == null ? void 0 : _a.payment_info) == null ? void 0 : _b.small_ticket_data,
|
|
2663
|
+
skip_wristband: true,
|
|
2664
|
+
skip_voucher: true
|
|
2663
2665
|
} : {
|
|
2664
2666
|
order_id: printIdentity,
|
|
2665
2667
|
machine_code_print_info: (_d = (_c = params.syncedOrder) == null ? void 0 : _c.payment_info) == null ? void 0 : _d.machine_code_print_info,
|
|
@@ -2670,7 +2672,7 @@ var Server = class {
|
|
|
2670
2672
|
idempotency_key: this.buildPrintOtherReceiptIdempotencyKey(params.syncedOrder, {
|
|
2671
2673
|
receiptOnly: params.receiptOnly
|
|
2672
2674
|
}),
|
|
2673
|
-
name: "
|
|
2675
|
+
name: "PRINT_V1",
|
|
2674
2676
|
source: "server",
|
|
2675
2677
|
source_type: "order",
|
|
2676
2678
|
source_id: printIdentity
|
|
@@ -180,6 +180,7 @@ export declare class OrderModule extends BaseModule implements Module {
|
|
|
180
180
|
* const idx = this.lookupOrderIndexByIdentityKeys(identityKeyToIndex, freshIdentityKeys)
|
|
181
181
|
*/
|
|
182
182
|
private lookupOrderIndexByIdentityKeys;
|
|
183
|
+
private isRemoteEchoMergeSource;
|
|
183
184
|
/**
|
|
184
185
|
* 将订单的全部身份键登记到索引并指向其在列表中的下标。
|
|
185
186
|
* 合并后订单新增的身份字段(如挂单同步后拿到 order_id)也会被登记。
|
|
@@ -985,7 +985,21 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
985
985
|
const storageKey = this.getOrderStorageKey(fresh);
|
|
986
986
|
const mergeKey = storageKey || (fresh.order_id !== void 0 && fresh.order_id !== null ? this.getIdKey(fresh.order_id) : "");
|
|
987
987
|
if (matchIndex >= 0) {
|
|
988
|
-
const
|
|
988
|
+
const existingOrder = updatedList[matchIndex];
|
|
989
|
+
if (this.isPendingSyncOrder(existingOrder) && this.isRemoteEchoMergeSource(source)) {
|
|
990
|
+
this.logInfo("mergeOrdersToStore-跳过 pending 订单远端覆盖", {
|
|
991
|
+
source,
|
|
992
|
+
order_id: existingOrder.order_id ?? fresh.order_id ?? null,
|
|
993
|
+
external_sale_number: existingOrder.external_sale_number ?? fresh.external_sale_number ?? null,
|
|
994
|
+
local_payment_status: existingOrder.payment_status ?? null,
|
|
995
|
+
remote_payment_status: fresh.payment_status ?? null,
|
|
996
|
+
local_need_sync: existingOrder.need_sync ?? null,
|
|
997
|
+
remote_need_sync: fresh.need_sync ?? null,
|
|
998
|
+
reason: "protect_pending_sync_order_from_remote_echo"
|
|
999
|
+
});
|
|
1000
|
+
continue;
|
|
1001
|
+
}
|
|
1002
|
+
const mergedOrder = this.mergeOrderRecords(existingOrder, fresh);
|
|
989
1003
|
updatedList[matchIndex] = mergedOrder;
|
|
990
1004
|
this.registerOrderIdentityKeys(identityKeyToIndex, mergedOrder, matchIndex);
|
|
991
1005
|
patchedOrders.push(mergedOrder);
|
|
@@ -1036,6 +1050,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
1036
1050
|
}
|
|
1037
1051
|
return matchIndex;
|
|
1038
1052
|
}
|
|
1053
|
+
isRemoteEchoMergeSource(source) {
|
|
1054
|
+
return source === "pubsub.bodyUpsert" || source === "pubsub.httpRefresh";
|
|
1055
|
+
}
|
|
1039
1056
|
/**
|
|
1040
1057
|
* 将订单的全部身份键登记到索引并指向其在列表中的下标。
|
|
1041
1058
|
* 合并后订单新增的身份字段(如挂单同步后拿到 order_id)也会被登记。
|
|
@@ -30,7 +30,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
30
30
|
protected defaultVersion: string;
|
|
31
31
|
isSolution: boolean;
|
|
32
32
|
protected initializeOptions: ModuleOptions;
|
|
33
|
-
|
|
33
|
+
protected logger: any;
|
|
34
34
|
protected appPlugin: AppPlugin;
|
|
35
35
|
protected store: BaseSalesState;
|
|
36
36
|
protected otherParams: Record<string, any>;
|
|
@@ -551,6 +551,13 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
551
551
|
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
552
552
|
cover?: boolean;
|
|
553
553
|
}): Promise<void>;
|
|
554
|
+
private getDeviceTaskPlugin;
|
|
555
|
+
handlePrintWristband(params: {
|
|
556
|
+
voucher_ids: number[];
|
|
557
|
+
}): Promise<void>;
|
|
558
|
+
handleCheckIn(params: {
|
|
559
|
+
voucher_ids: number[];
|
|
560
|
+
}): Promise<void>;
|
|
554
561
|
/**
|
|
555
562
|
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
556
563
|
* 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
|
|
@@ -52,6 +52,7 @@ var import_buildNormalProductCacheItemFromOrderLine = require("../../modules/Boo
|
|
|
52
52
|
var import_orderLineDisplay = require("../../modules/BookingContext/utils/orderLineDisplay");
|
|
53
53
|
var import_bookingStatus = require("./utils/bookingStatus");
|
|
54
54
|
var import_resolveBestAddTimePlan = require("./utils/resolveBestAddTimePlan");
|
|
55
|
+
var import_utils = require("../../modules/Order/utils");
|
|
55
56
|
__reExport(BookingTicket_exports, require("./types"), module.exports);
|
|
56
57
|
var OPEN_DATA_SECTION_CODES = ["sale", "reservation", "fulfillment", "menu", "workflow"];
|
|
57
58
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1e3;
|
|
@@ -1505,6 +1506,45 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1505
1506
|
await this.configureIdGeneratorFromOpenData();
|
|
1506
1507
|
}
|
|
1507
1508
|
}
|
|
1509
|
+
getDeviceTaskPlugin() {
|
|
1510
|
+
var _a;
|
|
1511
|
+
const app = this.core.getPlugin("app");
|
|
1512
|
+
return ((_a = app == null ? void 0 : app.getApp()) == null ? void 0 : _a.getPlugin("deviceTask")) || null;
|
|
1513
|
+
}
|
|
1514
|
+
// 打印手环,单个或批量都可以
|
|
1515
|
+
async handlePrintWristband(params) {
|
|
1516
|
+
const deviceTask = this.getDeviceTaskPlugin();
|
|
1517
|
+
if (!(deviceTask == null ? void 0 : deviceTask.dispatch)) {
|
|
1518
|
+
this.logger.addLog({
|
|
1519
|
+
type: "info",
|
|
1520
|
+
title: "[BookingTicket] handlePrintWristband: deviceTask.dispatch 不可用",
|
|
1521
|
+
metadata: {
|
|
1522
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
1523
|
+
}
|
|
1524
|
+
});
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
const deviceId = await this.getShortNumberOrDeviceId();
|
|
1528
|
+
deviceTask.dispatch({
|
|
1529
|
+
action: "print_v1",
|
|
1530
|
+
device_id: deviceId,
|
|
1531
|
+
payload: {
|
|
1532
|
+
type: "WRISTBAND",
|
|
1533
|
+
data: {
|
|
1534
|
+
order_id: this.getOrderIdentity(),
|
|
1535
|
+
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
1536
|
+
}
|
|
1537
|
+
},
|
|
1538
|
+
idempotency_key: (0, import_utils.createUuidV4)(),
|
|
1539
|
+
name: "PRINT_V1",
|
|
1540
|
+
source: "server",
|
|
1541
|
+
source_type: "order",
|
|
1542
|
+
source_id: (0, import_utils.createUuidV4)()
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
// 触发 checkIn
|
|
1546
|
+
async handleCheckIn(params) {
|
|
1547
|
+
}
|
|
1508
1548
|
/**
|
|
1509
1549
|
* 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
|
|
1510
1550
|
* 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
|