@pisell/pisellos 2.3.193 → 2.3.195
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/OpenData/types.d.ts +3 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +76 -61
- package/dist/solution/BaseSales/index.d.ts +3 -0
- package/dist/solution/BaseSales/index.js +45 -36
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/index.js +35 -25
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/modules/OpenData/types.d.ts +3 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/server/index.d.ts +2 -0
- package/lib/server/index.js +17 -6
- package/lib/solution/BaseSales/index.d.ts +3 -0
- package/lib/solution/BaseSales/index.js +11 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/index.js +7 -0
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ScheduleItem } from '../Schedule/types';
|
|
2
|
+
import type { PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
|
|
3
|
+
export type { PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
|
|
2
4
|
export interface MultiLangObject {
|
|
3
5
|
en?: string;
|
|
4
6
|
ja?: string;
|
|
@@ -126,6 +128,7 @@ export interface OpenDataConfig {
|
|
|
126
128
|
}>;
|
|
127
129
|
'documents.invoice_template'?: string | number;
|
|
128
130
|
'documents.invoice_edit'?: RawInvoiceEditConfig;
|
|
131
|
+
'documents.pos_receipt_auto_print_payment_statuses'?: PosReceiptAutoPrintPaymentStatus[];
|
|
129
132
|
/** @deprecated 仅保留旧调用方的类型兼容,Invoice 读取逻辑不再消费该字段。 */
|
|
130
133
|
'documents.invoice'?: RawInvoiceLayoutConfig;
|
|
131
134
|
/** @deprecated Invoice 读取逻辑只消费扁平的 documents.invoice_* 字段。 */
|
|
@@ -637,7 +637,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
637
637
|
generateIdempotencyToken(): string;
|
|
638
638
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
639
639
|
createOrder(params: CommitOrderParams['query']): {
|
|
640
|
-
type: "
|
|
640
|
+
type: "appointment_booking" | "virtual";
|
|
641
641
|
platform: string;
|
|
642
642
|
sales_channel: string;
|
|
643
643
|
order_sales_channel: string;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -563,6 +563,8 @@ declare class Server {
|
|
|
563
563
|
* Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
|
|
564
564
|
*/
|
|
565
565
|
private shouldAutoPrintCheckoutReceipt;
|
|
566
|
+
/** Only receipt auto-printing uses this policy; vouchers retain their paid-order gate. */
|
|
567
|
+
private shouldAutoPrintReceiptForPaymentStatus;
|
|
566
568
|
private shouldBuildSmallTicketData;
|
|
567
569
|
private shouldPrintSyncedOrder;
|
|
568
570
|
private hasPaymentStatus;
|
package/dist/server/index.js
CHANGED
|
@@ -49,6 +49,7 @@ import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPending
|
|
|
49
49
|
import { finalizeSalesNotesForCheckout } from "../modules/Order/salesNotes";
|
|
50
50
|
import { normalizeOrderCollections } from "../modules/Order/utils/orderCollectionIdentity";
|
|
51
51
|
import { stripOsPrivatePayloadFields } from "../utils/os-private-payload";
|
|
52
|
+
import { normalizePosReceiptAutoPrintPaymentStatuses, OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD } from "../utils/pos-receipt-auto-print";
|
|
52
53
|
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings, normalizeRawInvoiceTemplateSettings, resolveInvoiceReceiptLocales } from "../modules/OpenData";
|
|
53
54
|
var OS_FULFILLMENT_REF_MODE_FIELD = '_os_fulfillment_ref_mode';
|
|
54
55
|
var OS_INVOICE_LAYOUT_CONFIG_FIELD = '_os_invoice_layout_config';
|
|
@@ -6592,7 +6593,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6592
6593
|
value: function () {
|
|
6593
6594
|
var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(params) {
|
|
6594
6595
|
var _params$data5, _params$data6, _this$order6, _this$order6$getLocal;
|
|
6595
|
-
var backendPath, title, lookup, localOrder, extractedInvoice, extractedTemplateSettings, data, invoiceLayoutConfig, invoiceTemplateSettings, normalizedData, numberedData, checkoutData, pendingResult, pendingOrder;
|
|
6596
|
+
var backendPath, title, lookup, localOrder, extractedInvoice, extractedTemplateSettings, data, invoiceLayoutConfig, invoiceTemplateSettings, receiptAutoPrintPaymentStatuses, normalizedData, numberedData, checkoutData, pendingResult, pendingOrder;
|
|
6596
6597
|
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
6597
6598
|
while (1) switch (_context66.prev = _context66.next) {
|
|
6598
6599
|
case 0:
|
|
@@ -6629,6 +6630,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6629
6630
|
data = extractedTemplateSettings.data;
|
|
6630
6631
|
invoiceLayoutConfig = extractedInvoice.invoiceLayoutConfig;
|
|
6631
6632
|
invoiceTemplateSettings = this.normalizePrintInvoiceTemplateSettings(extractedTemplateSettings.invoiceTemplateSettings);
|
|
6633
|
+
receiptAutoPrintPaymentStatuses = normalizePosReceiptAutoPrintPaymentStatuses(data === null || data === void 0 ? void 0 : data[OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD]);
|
|
6632
6634
|
this.logInfo("".concat(title, ": \u5F00\u59CB\u5904\u7406"), {
|
|
6633
6635
|
backendPath: backendPath,
|
|
6634
6636
|
order_id: data === null || data === void 0 ? void 0 : data.order_id,
|
|
@@ -6636,7 +6638,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6636
6638
|
order_number: data === null || data === void 0 ? void 0 : data.order_number
|
|
6637
6639
|
});
|
|
6638
6640
|
if (!(data !== null && data !== void 0 && data.sync_mode || data !== null && data !== void 0 && data.syncMode)) {
|
|
6639
|
-
_context66.next =
|
|
6641
|
+
_context66.next = 19;
|
|
6640
6642
|
break;
|
|
6641
6643
|
}
|
|
6642
6644
|
return _context66.abrupt("return", this.handleSyncCheckoutSubmit({
|
|
@@ -6644,19 +6646,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
6644
6646
|
data: data,
|
|
6645
6647
|
title: title,
|
|
6646
6648
|
invoiceLayoutConfig: invoiceLayoutConfig,
|
|
6647
|
-
invoiceTemplateSettings: invoiceTemplateSettings
|
|
6649
|
+
invoiceTemplateSettings: invoiceTemplateSettings,
|
|
6650
|
+
receiptAutoPrintPaymentStatuses: receiptAutoPrintPaymentStatuses
|
|
6648
6651
|
}));
|
|
6649
|
-
case
|
|
6650
|
-
_context66.next =
|
|
6652
|
+
case 19:
|
|
6653
|
+
_context66.next = 21;
|
|
6651
6654
|
return this.normalizeCheckoutSubmitData(data, title);
|
|
6652
|
-
case
|
|
6655
|
+
case 21:
|
|
6653
6656
|
normalizedData = _context66.sent;
|
|
6654
|
-
_context66.next =
|
|
6657
|
+
_context66.next = 24;
|
|
6655
6658
|
return this.ensureCheckoutOrderNumbers(normalizedData, title);
|
|
6656
|
-
case
|
|
6659
|
+
case 24:
|
|
6657
6660
|
numberedData = _context66.sent;
|
|
6658
6661
|
checkoutData = this.normalizeCheckoutCollections(stripOsPrivatePayloadFields(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
|
|
6659
|
-
_context66.next =
|
|
6662
|
+
_context66.next = 28;
|
|
6660
6663
|
return this.handlePendingSyncCheckoutOrder({
|
|
6661
6664
|
backendPath: backendPath,
|
|
6662
6665
|
data: checkoutData,
|
|
@@ -6664,41 +6667,41 @@ var Server = /*#__PURE__*/function () {
|
|
|
6664
6667
|
reason: 'checkout 已转入设备任务同步',
|
|
6665
6668
|
invoiceTemplateSettings: invoiceTemplateSettings
|
|
6666
6669
|
});
|
|
6667
|
-
case
|
|
6670
|
+
case 28:
|
|
6668
6671
|
pendingResult = _context66.sent;
|
|
6669
6672
|
if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
|
|
6670
|
-
_context66.next =
|
|
6673
|
+
_context66.next = 43;
|
|
6671
6674
|
break;
|
|
6672
6675
|
}
|
|
6673
6676
|
pendingOrder = pendingResult.data;
|
|
6674
|
-
if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData, invoiceTemplateSettings) && this.
|
|
6675
|
-
_context66.next =
|
|
6677
|
+
if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(pendingOrder, receiptAutoPrintPaymentStatuses) && this.shouldAutoPrintCheckoutReceipt())) {
|
|
6678
|
+
_context66.next = 41;
|
|
6676
6679
|
break;
|
|
6677
6680
|
}
|
|
6678
|
-
_context66.prev =
|
|
6679
|
-
_context66.next =
|
|
6681
|
+
_context66.prev = 32;
|
|
6682
|
+
_context66.next = 35;
|
|
6680
6683
|
return this.dispatchLocalReceiptPrint({
|
|
6681
6684
|
checkoutData: checkoutData,
|
|
6682
6685
|
order: pendingOrder,
|
|
6683
6686
|
response: pendingResult,
|
|
6684
|
-
requireFullyPaid:
|
|
6687
|
+
requireFullyPaid: receiptAutoPrintPaymentStatuses === undefined,
|
|
6685
6688
|
invoiceLayoutConfig: invoiceLayoutConfig,
|
|
6686
6689
|
invoiceTemplateSettings: invoiceTemplateSettings
|
|
6687
6690
|
});
|
|
6688
|
-
case
|
|
6689
|
-
_context66.next =
|
|
6691
|
+
case 35:
|
|
6692
|
+
_context66.next = 41;
|
|
6690
6693
|
break;
|
|
6691
|
-
case
|
|
6692
|
-
_context66.prev =
|
|
6693
|
-
_context66.t1 = _context66["catch"](
|
|
6694
|
+
case 37:
|
|
6695
|
+
_context66.prev = 37;
|
|
6696
|
+
_context66.t1 = _context66["catch"](32);
|
|
6694
6697
|
// The sale is already persisted. A failed receipt must not cancel its
|
|
6695
6698
|
// sync task or send an unfiltered fallback to the printer.
|
|
6696
6699
|
pendingResult.receipt_print_error = this.getUnknownErrorMessage(_context66.t1);
|
|
6697
6700
|
this.logError("".concat(title, ": \u5C0F\u7968\u751F\u6210\u5931\u8D25\uFF0C\u8BA2\u5355\u4ECD\u7EE7\u7EED\u540C\u6B65"), {
|
|
6698
6701
|
error: pendingResult.receipt_print_error
|
|
6699
6702
|
});
|
|
6700
|
-
case
|
|
6701
|
-
_context66.next =
|
|
6703
|
+
case 41:
|
|
6704
|
+
_context66.next = 43;
|
|
6702
6705
|
return this.dispatchCheckoutSyncTask({
|
|
6703
6706
|
backendPath: backendPath,
|
|
6704
6707
|
data: checkoutData,
|
|
@@ -6706,9 +6709,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
6706
6709
|
invoiceLayoutConfig: invoiceLayoutConfig,
|
|
6707
6710
|
invoiceTemplateSettings: invoiceTemplateSettings
|
|
6708
6711
|
});
|
|
6709
|
-
case
|
|
6712
|
+
case 43:
|
|
6710
6713
|
if (pendingResult.data.order_id) {
|
|
6711
|
-
_context66.next =
|
|
6714
|
+
_context66.next = 45;
|
|
6712
6715
|
break;
|
|
6713
6716
|
}
|
|
6714
6717
|
return _context66.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
|
|
@@ -6716,13 +6719,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
6716
6719
|
order_id: pendingResult.data.external_sale_number
|
|
6717
6720
|
})
|
|
6718
6721
|
}));
|
|
6719
|
-
case 44:
|
|
6720
|
-
return _context66.abrupt("return", pendingResult);
|
|
6721
6722
|
case 45:
|
|
6723
|
+
return _context66.abrupt("return", pendingResult);
|
|
6724
|
+
case 46:
|
|
6722
6725
|
case "end":
|
|
6723
6726
|
return _context66.stop();
|
|
6724
6727
|
}
|
|
6725
|
-
}, _callee66, this, [[
|
|
6728
|
+
}, _callee66, this, [[32, 37]]);
|
|
6726
6729
|
}));
|
|
6727
6730
|
function handleOrderCheckoutSubmit(_x73) {
|
|
6728
6731
|
return _handleOrderCheckoutSubmit.apply(this, arguments);
|
|
@@ -6734,11 +6737,11 @@ var Server = /*#__PURE__*/function () {
|
|
|
6734
6737
|
value: function () {
|
|
6735
6738
|
var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
|
|
6736
6739
|
var _this$app15;
|
|
6737
|
-
var backendPath, data, title, invoiceLayoutConfig, invoiceTemplateSettings, syncResult, _normalized$data, normalized, response, syncedOrder, backendError, _normalized$data2, _normalized, message;
|
|
6740
|
+
var backendPath, data, title, invoiceLayoutConfig, invoiceTemplateSettings, receiptAutoPrintPaymentStatuses, syncResult, _normalized$data, normalized, response, syncedOrder, backendError, _normalized$data2, _normalized, message;
|
|
6738
6741
|
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
|
6739
6742
|
while (1) switch (_context67.prev = _context67.next) {
|
|
6740
6743
|
case 0:
|
|
6741
|
-
backendPath = params.backendPath, data = params.data, title = params.title, invoiceLayoutConfig = params.invoiceLayoutConfig, invoiceTemplateSettings = params.invoiceTemplateSettings;
|
|
6744
|
+
backendPath = params.backendPath, data = params.data, title = params.title, invoiceLayoutConfig = params.invoiceLayoutConfig, invoiceTemplateSettings = params.invoiceTemplateSettings, receiptAutoPrintPaymentStatuses = params.receiptAutoPrintPaymentStatuses;
|
|
6742
6745
|
if ((_this$app15 = this.app) !== null && _this$app15 !== void 0 && (_this$app15 = _this$app15.request) !== null && _this$app15 !== void 0 && _this$app15.post) {
|
|
6743
6746
|
_context67.next = 4;
|
|
6744
6747
|
break;
|
|
@@ -6776,7 +6779,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6776
6779
|
case 11:
|
|
6777
6780
|
response = this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder);
|
|
6778
6781
|
syncedOrder = syncResult.syncedOrder;
|
|
6779
|
-
if (!(syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData, invoiceTemplateSettings) && this.
|
|
6782
|
+
if (!(syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(syncedOrder, receiptAutoPrintPaymentStatuses) && (receiptAutoPrintPaymentStatuses === undefined || this.shouldAutoPrintCheckoutReceipt()))) {
|
|
6780
6783
|
_context67.next = 23;
|
|
6781
6784
|
break;
|
|
6782
6785
|
}
|
|
@@ -6786,7 +6789,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
6786
6789
|
checkoutData: syncResult.checkoutData,
|
|
6787
6790
|
order: syncedOrder,
|
|
6788
6791
|
response: syncResult.normalizedResponse,
|
|
6789
|
-
requireFullyPaid:
|
|
6792
|
+
requireFullyPaid: receiptAutoPrintPaymentStatuses === undefined,
|
|
6790
6793
|
invoiceLayoutConfig: invoiceLayoutConfig,
|
|
6791
6794
|
invoiceTemplateSettings: invoiceTemplateSettings
|
|
6792
6795
|
});
|
|
@@ -7101,6 +7104,18 @@ var Server = /*#__PURE__*/function () {
|
|
|
7101
7104
|
if (((_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 || (_this$core$context2$g = _this$core$context2.getPlatform) === null || _this$core$context2$g === void 0 ? void 0 : _this$core$context2$g.call(_this$core$context2)) !== 'android') return true;
|
|
7102
7105
|
return ((_this$app16 = this.app) === null || _this$app16 === void 0 || (_this$app16 = _this$app16.storage) === null || _this$app16 === void 0 || (_this$app16$getStorag = _this$app16.getStorage) === null || _this$app16$getStorag === void 0 ? void 0 : _this$app16$getStorag.call(_this$app16, AUTO_PRINT_STORAGE_KEY)) !== 'false';
|
|
7103
7106
|
}
|
|
7107
|
+
|
|
7108
|
+
/** Only receipt auto-printing uses this policy; vouchers retain their paid-order gate. */
|
|
7109
|
+
}, {
|
|
7110
|
+
key: "shouldAutoPrintReceiptForPaymentStatus",
|
|
7111
|
+
value: function shouldAutoPrintReceiptForPaymentStatus(order, statuses) {
|
|
7112
|
+
var _this19 = this;
|
|
7113
|
+
if (statuses === undefined) return this.isSalesOrderFullyPaid(order);
|
|
7114
|
+
var paymentStatus = String((order === null || order === void 0 ? void 0 : order.payment_status) || '').toLowerCase();
|
|
7115
|
+
return statuses.some(function (status) {
|
|
7116
|
+
return status === 'paid' ? _this19.isSalesOrderFullyPaid(order) : paymentStatus === status;
|
|
7117
|
+
});
|
|
7118
|
+
}
|
|
7104
7119
|
}, {
|
|
7105
7120
|
key: "shouldBuildSmallTicketData",
|
|
7106
7121
|
value: function shouldBuildSmallTicketData(order, invoiceTemplateSettings) {
|
|
@@ -7146,13 +7161,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
7146
7161
|
}, {
|
|
7147
7162
|
key: "sumPaidOrderPayments",
|
|
7148
7163
|
value: function sumPaidOrderPayments(payments) {
|
|
7149
|
-
var
|
|
7164
|
+
var _this20 = this;
|
|
7150
7165
|
if (!Array.isArray(payments)) return 0;
|
|
7151
7166
|
return payments.reduce(function (sum, payment) {
|
|
7152
7167
|
var _payment$amount;
|
|
7153
7168
|
var status = String((payment === null || payment === void 0 ? void 0 : payment.status) || '').toLowerCase();
|
|
7154
7169
|
if (status !== 'paid') return sum;
|
|
7155
|
-
return sum +
|
|
7170
|
+
return sum + _this20.toAmountNumber((_payment$amount = payment === null || payment === void 0 ? void 0 : payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment === null || payment === void 0 ? void 0 : payment.origin_amount);
|
|
7156
7171
|
}, 0);
|
|
7157
7172
|
}
|
|
7158
7173
|
}, {
|
|
@@ -7168,7 +7183,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7168
7183
|
value: function () {
|
|
7169
7184
|
var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(order) {
|
|
7170
7185
|
var _this$products3,
|
|
7171
|
-
|
|
7186
|
+
_this21 = this;
|
|
7172
7187
|
var products, productIdSet, productIds, entries;
|
|
7173
7188
|
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
|
7174
7189
|
while (1) switch (_context72.prev = _context72.next) {
|
|
@@ -7201,20 +7216,20 @@ var Server = /*#__PURE__*/function () {
|
|
|
7201
7216
|
_context72.next = 8;
|
|
7202
7217
|
return Promise.all(productIds.map( /*#__PURE__*/function () {
|
|
7203
7218
|
var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(id) {
|
|
7204
|
-
var
|
|
7219
|
+
var _this21$products, _this21$products$getP, product;
|
|
7205
7220
|
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
|
7206
7221
|
while (1) switch (_context71.prev = _context71.next) {
|
|
7207
7222
|
case 0:
|
|
7208
7223
|
_context71.prev = 0;
|
|
7209
7224
|
_context71.next = 3;
|
|
7210
|
-
return (
|
|
7225
|
+
return (_this21$products = _this21.products) === null || _this21$products === void 0 || (_this21$products$getP = _this21$products.getProductById) === null || _this21$products$getP === void 0 ? void 0 : _this21$products$getP.call(_this21$products, Number(id));
|
|
7211
7226
|
case 3:
|
|
7212
7227
|
product = _context71.sent;
|
|
7213
7228
|
return _context71.abrupt("return", product ? [String(id), product] : null);
|
|
7214
7229
|
case 7:
|
|
7215
7230
|
_context71.prev = 7;
|
|
7216
7231
|
_context71.t0 = _context71["catch"](0);
|
|
7217
|
-
|
|
7232
|
+
_this21.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
|
|
7218
7233
|
product_id: id,
|
|
7219
7234
|
error: _context71.t0 instanceof Error ? _context71.t0.message : String(_context71.t0)
|
|
7220
7235
|
});
|
|
@@ -7365,7 +7380,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7365
7380
|
key: "withSalesDetailProductSnapshots",
|
|
7366
7381
|
value: function () {
|
|
7367
7382
|
var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(order) {
|
|
7368
|
-
var
|
|
7383
|
+
var _this22 = this;
|
|
7369
7384
|
var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
|
|
7370
7385
|
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
|
7371
7386
|
while (1) switch (_context74.prev = _context74.next) {
|
|
@@ -7389,8 +7404,8 @@ var Server = /*#__PURE__*/function () {
|
|
|
7389
7404
|
case 8:
|
|
7390
7405
|
hasChanged = false;
|
|
7391
7406
|
enrichedProducts = products.map(function (product) {
|
|
7392
|
-
var productWithBundleSnapshots =
|
|
7393
|
-
var nextProduct =
|
|
7407
|
+
var productWithBundleSnapshots = _this22.withBundleCatalogSnapshots(product, snapshotMap);
|
|
7408
|
+
var nextProduct = _this22.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
|
|
7394
7409
|
if (nextProduct !== product) hasChanged = true;
|
|
7395
7410
|
return nextProduct;
|
|
7396
7411
|
});
|
|
@@ -7418,13 +7433,13 @@ var Server = /*#__PURE__*/function () {
|
|
|
7418
7433
|
}, {
|
|
7419
7434
|
key: "withPendingSyncProductTitles",
|
|
7420
7435
|
value: function withPendingSyncProductTitles(order, productMap) {
|
|
7421
|
-
var
|
|
7436
|
+
var _this23 = this;
|
|
7422
7437
|
var products = Array.isArray(order.products) ? order.products : null;
|
|
7423
7438
|
if (!(products !== null && products !== void 0 && products.length)) return order;
|
|
7424
7439
|
return _objectSpread(_objectSpread({}, order), {}, {
|
|
7425
7440
|
products: products.map(function (product) {
|
|
7426
7441
|
return _objectSpread(_objectSpread({}, product), {}, {
|
|
7427
|
-
product_title:
|
|
7442
|
+
product_title: _this23.buildProductTitleSnapshot(product, productMap)
|
|
7428
7443
|
});
|
|
7429
7444
|
})
|
|
7430
7445
|
});
|
|
@@ -7435,7 +7450,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7435
7450
|
var _product$product_id4,
|
|
7436
7451
|
_product$product,
|
|
7437
7452
|
_fallbackProduct$prod,
|
|
7438
|
-
|
|
7453
|
+
_this24 = this;
|
|
7439
7454
|
var productId = (_product$product_id4 = product.product_id) !== null && _product$product_id4 !== void 0 ? _product$product_id4 : product.id;
|
|
7440
7455
|
var fallbackProduct = productId !== undefined && productId !== null ? productMap[productId] || productMap[String(productId)] : null;
|
|
7441
7456
|
var ownTitle = product.product_title || product.title || product.name || ((_product$product = product.product) === null || _product$product === void 0 ? void 0 : _product$product.title);
|
|
@@ -7443,7 +7458,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
7443
7458
|
var currentLocale = this.getProductTitleSnapshotCurrentLocale();
|
|
7444
7459
|
var autoTitle = this.resolveFirstProductTitleValue(ownTitle) || this.resolveFirstProductTitleValue(fallbackTitle);
|
|
7445
7460
|
return PRODUCT_TITLE_SNAPSHOT_KEYS.reduce(function (snapshot, key) {
|
|
7446
|
-
snapshot[key] =
|
|
7461
|
+
snapshot[key] = _this24.resolveProductTitleValue(ownTitle, key, currentLocale) || _this24.resolveProductTitleValue(fallbackTitle, key, currentLocale) || (key === 'auto' || key === 'original' ? autoTitle : null);
|
|
7447
7462
|
return snapshot;
|
|
7448
7463
|
}, {});
|
|
7449
7464
|
}
|
|
@@ -7542,14 +7557,14 @@ var Server = /*#__PURE__*/function () {
|
|
|
7542
7557
|
key: "enrichPaymentNamesByCode",
|
|
7543
7558
|
value: function () {
|
|
7544
7559
|
var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(order) {
|
|
7545
|
-
var
|
|
7560
|
+
var _this25 = this;
|
|
7546
7561
|
var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
|
|
7547
7562
|
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
7548
7563
|
while (1) switch (_context75.prev = _context75.next) {
|
|
7549
7564
|
case 0:
|
|
7550
7565
|
payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
|
|
7551
7566
|
hasMissingName = payments.some(function (payment) {
|
|
7552
|
-
return
|
|
7567
|
+
return _this25.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this25.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
|
|
7553
7568
|
});
|
|
7554
7569
|
if (hasMissingName) {
|
|
7555
7570
|
_context75.next = 4;
|
|
@@ -7582,9 +7597,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
7582
7597
|
}
|
|
7583
7598
|
hasResolvedName = false;
|
|
7584
7599
|
enrichedPayments = payments.map(function (payment) {
|
|
7585
|
-
if (!
|
|
7586
|
-
if (!
|
|
7587
|
-
var name = nameByCode.get(
|
|
7600
|
+
if (!_this25.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name)) return payment;
|
|
7601
|
+
if (!_this25.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code)) return payment;
|
|
7602
|
+
var name = nameByCode.get(_this25.getPaymentCodeKey(payment === null || payment === void 0 ? void 0 : payment.code));
|
|
7588
7603
|
if (!name) return payment;
|
|
7589
7604
|
hasResolvedName = true;
|
|
7590
7605
|
return _objectSpread(_objectSpread({}, payment), {}, {
|
|
@@ -8450,10 +8465,10 @@ var Server = /*#__PURE__*/function () {
|
|
|
8450
8465
|
value: function extractBackendErrorResponse(error) {
|
|
8451
8466
|
var _error$response3,
|
|
8452
8467
|
_error$response4,
|
|
8453
|
-
|
|
8468
|
+
_this26 = this;
|
|
8454
8469
|
var candidates = [error === null || error === void 0 || (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.body, error === null || error === void 0 ? void 0 : error.body];
|
|
8455
8470
|
return candidates.find(function (candidate) {
|
|
8456
|
-
return
|
|
8471
|
+
return _this26.isExplicitBackendErrorResponse(candidate);
|
|
8457
8472
|
}) || null;
|
|
8458
8473
|
}
|
|
8459
8474
|
}, {
|
|
@@ -8815,7 +8830,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
8815
8830
|
value: (function () {
|
|
8816
8831
|
var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(context, options) {
|
|
8817
8832
|
var _menu_list_ids$length3,
|
|
8818
|
-
|
|
8833
|
+
_this27 = this;
|
|
8819
8834
|
var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, queryIds, startupPreloadTask, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
|
|
8820
8835
|
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
|
8821
8836
|
while (1) switch (_context82.prev = _context82.next) {
|
|
@@ -9028,9 +9043,9 @@ var Server = /*#__PURE__*/function () {
|
|
|
9028
9043
|
}
|
|
9029
9044
|
tMenu = performance.now();
|
|
9030
9045
|
getActiveMenus = function getActiveMenus() {
|
|
9031
|
-
return
|
|
9032
|
-
var
|
|
9033
|
-
return ((
|
|
9046
|
+
return _this27.menu.getMenuByIds(menu_list_ids).filter(function (menu) {
|
|
9047
|
+
var _this27$schedule;
|
|
9048
|
+
return ((_this27$schedule = _this27.schedule) === null || _this27$schedule === void 0 ? void 0 : _this27$schedule.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
9034
9049
|
});
|
|
9035
9050
|
};
|
|
9036
9051
|
activeMenuList = getActiveMenus();
|
|
@@ -9343,7 +9358,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
9343
9358
|
}, {
|
|
9344
9359
|
key: "notifySalesSearchSubscribers",
|
|
9345
9360
|
value: function notifySalesSearchSubscribers(payload) {
|
|
9346
|
-
var
|
|
9361
|
+
var _this28 = this;
|
|
9347
9362
|
if (this.salesSearchSubscribers.size === 0) return;
|
|
9348
9363
|
var changedOrders = this.extractChangedOrdersFromPayload(payload);
|
|
9349
9364
|
if (changedOrders.length === 0) {
|
|
@@ -9361,21 +9376,21 @@ var Server = /*#__PURE__*/function () {
|
|
|
9361
9376
|
subscriber = _step20$value[1];
|
|
9362
9377
|
try {
|
|
9363
9378
|
var changedVisibleOrders = changedOrders.filter(function (order) {
|
|
9364
|
-
var orderId =
|
|
9379
|
+
var orderId = _this28.getSalesSearchOrderId(order);
|
|
9365
9380
|
return !!orderId && subscriber.visibleOrderIds.has(orderId);
|
|
9366
9381
|
});
|
|
9367
9382
|
if (changedVisibleOrders.length === 0) {
|
|
9368
9383
|
return 1; // continue
|
|
9369
9384
|
}
|
|
9370
|
-
subscriber.callback(
|
|
9371
|
-
|
|
9385
|
+
subscriber.callback(_this28.buildSalesSearchDeltaResponse(subscriber, changedVisibleOrders));
|
|
9386
|
+
_this28.logInfo('notifySalesSearchSubscribers: 已推送 delta', {
|
|
9372
9387
|
subscriberId: subscriberId,
|
|
9373
9388
|
kind: subscriber.kind,
|
|
9374
9389
|
count: changedVisibleOrders.length
|
|
9375
9390
|
});
|
|
9376
9391
|
} catch (error) {
|
|
9377
9392
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
9378
|
-
|
|
9393
|
+
_this28.logError('notifySalesSearchSubscribers: 推送失败', {
|
|
9379
9394
|
subscriberId: subscriberId,
|
|
9380
9395
|
error: errorMessage
|
|
9381
9396
|
});
|
|
@@ -13,6 +13,7 @@ import type { Discount, VirtualCurrencyAsset } from '../../modules/Discount/type
|
|
|
13
13
|
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
14
14
|
export * from './types';
|
|
15
15
|
import { ProductList } from '../../modules/ProductList';
|
|
16
|
+
import { type PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
|
|
16
17
|
import { PaymentModule } from '../../modules/Payment';
|
|
17
18
|
import type { PaymentMethod, RoundingResult, WalletAssetId, WalletAssetsBehaviorOptions, WalletAssetsSnapshot, WalletAssetsState, WalletAssetSelectionSource, ScanWalletAssetResult } from '../../modules/Payment/types';
|
|
18
19
|
import type { SalesSummaryModule } from '../../modules/SalesSummary';
|
|
@@ -199,6 +200,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
199
200
|
private getFulfillmentRefMode;
|
|
200
201
|
private getCachedInvoiceLayoutConfig;
|
|
201
202
|
private getCachedInvoiceTemplateSettings;
|
|
203
|
+
/** Only solutions with a current POS business configuration opt into this receipt policy. */
|
|
204
|
+
protected getPosReceiptAutoPrintPaymentStatuses(): PosReceiptAutoPrintPaymentStatus[] | undefined;
|
|
202
205
|
private buildSubmitPayloadEnhancerWithOpenDataConfig;
|
|
203
206
|
/**
|
|
204
207
|
* 工厂入口:根据子模块名实例化对应模块。
|