@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
package/lib/server/index.js
CHANGED
|
@@ -33,6 +33,7 @@ var _paymentUtils = require("../modules/Order/payment-utils");
|
|
|
33
33
|
var _salesNotes = require("../modules/Order/salesNotes");
|
|
34
34
|
var _orderCollectionIdentity = require("../modules/Order/utils/orderCollectionIdentity");
|
|
35
35
|
var _osPrivatePayload = require("../utils/os-private-payload");
|
|
36
|
+
var _posReceiptAutoPrint = require("../utils/pos-receipt-auto-print");
|
|
36
37
|
var _OpenData = require("../modules/OpenData");
|
|
37
38
|
var _modules = require("./modules");
|
|
38
39
|
Object.keys(_modules).forEach(function (key) {
|
|
@@ -4459,6 +4460,7 @@ class Server {
|
|
|
4459
4460
|
const data = extractedTemplateSettings.data;
|
|
4460
4461
|
const invoiceLayoutConfig = extractedInvoice.invoiceLayoutConfig;
|
|
4461
4462
|
const invoiceTemplateSettings = this.normalizePrintInvoiceTemplateSettings(extractedTemplateSettings.invoiceTemplateSettings);
|
|
4463
|
+
const receiptAutoPrintPaymentStatuses = (0, _posReceiptAutoPrint.normalizePosReceiptAutoPrintPaymentStatuses)(data?.[_posReceiptAutoPrint.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD]);
|
|
4462
4464
|
this.logInfo(`${title}: 开始处理`, {
|
|
4463
4465
|
backendPath,
|
|
4464
4466
|
order_id: data?.order_id,
|
|
@@ -4471,7 +4473,8 @@ class Server {
|
|
|
4471
4473
|
data,
|
|
4472
4474
|
title,
|
|
4473
4475
|
invoiceLayoutConfig,
|
|
4474
|
-
invoiceTemplateSettings
|
|
4476
|
+
invoiceTemplateSettings,
|
|
4477
|
+
receiptAutoPrintPaymentStatuses
|
|
4475
4478
|
});
|
|
4476
4479
|
}
|
|
4477
4480
|
const normalizedData = await this.normalizeCheckoutSubmitData(data, title);
|
|
@@ -4486,13 +4489,13 @@ class Server {
|
|
|
4486
4489
|
});
|
|
4487
4490
|
if (pendingResult?.status === true) {
|
|
4488
4491
|
const pendingOrder = pendingResult.data;
|
|
4489
|
-
if (pendingOrder && this.shouldBuildSmallTicketData(checkoutData, invoiceTemplateSettings) && this.
|
|
4492
|
+
if (pendingOrder && this.shouldBuildSmallTicketData(checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(pendingOrder, receiptAutoPrintPaymentStatuses) && this.shouldAutoPrintCheckoutReceipt()) {
|
|
4490
4493
|
try {
|
|
4491
4494
|
await this.dispatchLocalReceiptPrint({
|
|
4492
4495
|
checkoutData,
|
|
4493
4496
|
order: pendingOrder,
|
|
4494
4497
|
response: pendingResult,
|
|
4495
|
-
requireFullyPaid:
|
|
4498
|
+
requireFullyPaid: receiptAutoPrintPaymentStatuses === undefined,
|
|
4496
4499
|
invoiceLayoutConfig,
|
|
4497
4500
|
invoiceTemplateSettings
|
|
4498
4501
|
});
|
|
@@ -4530,7 +4533,8 @@ class Server {
|
|
|
4530
4533
|
data,
|
|
4531
4534
|
title,
|
|
4532
4535
|
invoiceLayoutConfig,
|
|
4533
|
-
invoiceTemplateSettings
|
|
4536
|
+
invoiceTemplateSettings,
|
|
4537
|
+
receiptAutoPrintPaymentStatuses
|
|
4534
4538
|
} = params;
|
|
4535
4539
|
if (!this.app?.request?.post) {
|
|
4536
4540
|
this.logError(`${title}: sync checkout app.request 不可用`);
|
|
@@ -4561,13 +4565,13 @@ class Server {
|
|
|
4561
4565
|
}
|
|
4562
4566
|
const response = this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder);
|
|
4563
4567
|
const syncedOrder = syncResult.syncedOrder;
|
|
4564
|
-
if (syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData, invoiceTemplateSettings) && this.
|
|
4568
|
+
if (syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(syncedOrder, receiptAutoPrintPaymentStatuses) && (receiptAutoPrintPaymentStatuses === undefined || this.shouldAutoPrintCheckoutReceipt())) {
|
|
4565
4569
|
try {
|
|
4566
4570
|
await this.dispatchLocalReceiptPrint({
|
|
4567
4571
|
checkoutData: syncResult.checkoutData,
|
|
4568
4572
|
order: syncedOrder,
|
|
4569
4573
|
response: syncResult.normalizedResponse,
|
|
4570
|
-
requireFullyPaid:
|
|
4574
|
+
requireFullyPaid: receiptAutoPrintPaymentStatuses === undefined,
|
|
4571
4575
|
invoiceLayoutConfig,
|
|
4572
4576
|
invoiceTemplateSettings
|
|
4573
4577
|
});
|
|
@@ -4787,6 +4791,13 @@ class Server {
|
|
|
4787
4791
|
if (this.core.context?.getPlatform?.() !== 'android') return true;
|
|
4788
4792
|
return this.app?.storage?.getStorage?.(AUTO_PRINT_STORAGE_KEY) !== 'false';
|
|
4789
4793
|
}
|
|
4794
|
+
|
|
4795
|
+
/** Only receipt auto-printing uses this policy; vouchers retain their paid-order gate. */
|
|
4796
|
+
shouldAutoPrintReceiptForPaymentStatus(order, statuses) {
|
|
4797
|
+
if (statuses === undefined) return this.isSalesOrderFullyPaid(order);
|
|
4798
|
+
const paymentStatus = String(order?.payment_status || '').toLowerCase();
|
|
4799
|
+
return statuses.some(status => status === 'paid' ? this.isSalesOrderFullyPaid(order) : paymentStatus === status);
|
|
4800
|
+
}
|
|
4790
4801
|
shouldBuildSmallTicketData(order, invoiceTemplateSettings) {
|
|
4791
4802
|
if (!order || typeof order !== 'object') return false;
|
|
4792
4803
|
const flag = order.small_ticket_data_flag ?? order.smallTicketDataFlag;
|
|
@@ -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
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
@@ -40,6 +40,7 @@ var _orderCollectionIdentity = require("../../modules/Order/utils/orderCollectio
|
|
|
40
40
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
41
41
|
var _clientDataVariants = require("../../modules/ProductList/clientDataVariants");
|
|
42
42
|
var _platform = require("../../utils/platform");
|
|
43
|
+
var _posReceiptAutoPrint = require("../../utils/pos-receipt-auto-print");
|
|
43
44
|
var _Quotation = require("../../modules/Quotation");
|
|
44
45
|
var _transformBaseProductToOrderProduct = require("./utils/transformBaseProductToOrderProduct");
|
|
45
46
|
var _quotationPrice = require("./utils/quotationPrice");
|
|
@@ -1448,11 +1449,17 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1448
1449
|
return undefined;
|
|
1449
1450
|
}
|
|
1450
1451
|
}
|
|
1452
|
+
|
|
1453
|
+
/** Only solutions with a current POS business configuration opt into this receipt policy. */
|
|
1454
|
+
getPosReceiptAutoPrintPaymentStatuses() {
|
|
1455
|
+
return undefined;
|
|
1456
|
+
}
|
|
1451
1457
|
buildSubmitPayloadEnhancerWithOpenDataConfig(enhancePayload) {
|
|
1452
1458
|
const fulfillmentRefMode = this.getFulfillmentRefMode();
|
|
1453
1459
|
const invoiceLayoutConfig = this.getCachedInvoiceLayoutConfig();
|
|
1454
1460
|
const invoiceTemplateSettings = this.getCachedInvoiceTemplateSettings();
|
|
1455
|
-
|
|
1461
|
+
const receiptPaymentStatuses = this.getPosReceiptAutoPrintPaymentStatuses();
|
|
1462
|
+
if (!fulfillmentRefMode && !invoiceLayoutConfig && !invoiceTemplateSettings && receiptPaymentStatuses === undefined) {
|
|
1456
1463
|
return enhancePayload;
|
|
1457
1464
|
}
|
|
1458
1465
|
return (payload, ctx) => {
|
|
@@ -1467,6 +1474,9 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1467
1474
|
} : {}),
|
|
1468
1475
|
...(invoiceTemplateSettings ? {
|
|
1469
1476
|
[OS_INVOICE_TEMPLATE_SETTINGS_FIELD]: (0, _lodashEs.cloneDeep)(invoiceTemplateSettings)
|
|
1477
|
+
} : {}),
|
|
1478
|
+
...(receiptPaymentStatuses !== undefined ? {
|
|
1479
|
+
[_posReceiptAutoPrint.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD]: [...receiptPaymentStatuses]
|
|
1470
1480
|
} : {})
|
|
1471
1481
|
};
|
|
1472
1482
|
};
|
|
@@ -328,7 +328,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
328
328
|
date: string;
|
|
329
329
|
status: string;
|
|
330
330
|
week: string;
|
|
331
|
-
weekNum: 0 | 1 | 2 |
|
|
331
|
+
weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
|
|
332
332
|
}[]>;
|
|
333
333
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
334
334
|
private getScheduleDataByIds;
|
|
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
366
366
|
* 获取当前的客户搜索条件
|
|
367
367
|
* @returns 当前搜索条件
|
|
368
368
|
*/
|
|
369
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
369
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
370
370
|
/**
|
|
371
371
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
372
372
|
* @returns 客户状态
|
|
@@ -10,6 +10,7 @@ import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAva
|
|
|
10
10
|
import type { BusinessAvailability } from '../../modules/BusinessAvailability';
|
|
11
11
|
import { BookingTicket } from '../BookingTicket';
|
|
12
12
|
import type { BaseSalesSubmitSalesOrderParams } from '../BaseSales/types';
|
|
13
|
+
import { type PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
|
|
13
14
|
import type { AllergyRequirement } from '../../model/strategy/adapter/itemRule';
|
|
14
15
|
export * from './types';
|
|
15
16
|
export * from './salesSettings';
|
|
@@ -224,6 +225,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
224
225
|
clearOpenDataCache(): void;
|
|
225
226
|
getInvoiceLayoutConfig(): Promise<InvoiceLayoutConfig>;
|
|
226
227
|
getInvoiceTemplateSettings(): Promise<InvoiceTemplateSettings>;
|
|
228
|
+
protected getPosReceiptAutoPrintPaymentStatuses(): PosReceiptAutoPrintPaymentStatus[] | undefined;
|
|
227
229
|
protected isInvoiceOpenDataCacheCurrent(): boolean;
|
|
228
230
|
/**
|
|
229
231
|
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
@@ -71,6 +71,7 @@ var _venueCatalogSession = require("./venueCatalogSession");
|
|
|
71
71
|
var _BookingTicket = require("../BookingTicket");
|
|
72
72
|
var _localClock = require("../../modules/ResourcePlanner/localClock");
|
|
73
73
|
var _platform = require("../../utils/platform");
|
|
74
|
+
var _posReceiptAutoPrint = require("../../utils/pos-receipt-auto-print");
|
|
74
75
|
var _itemRule = require("../../model/strategy/adapter/itemRule");
|
|
75
76
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
76
77
|
const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability', 'interface'];
|
|
@@ -2431,6 +2432,12 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2431
2432
|
}
|
|
2432
2433
|
return this.store.openData.getInvoiceTemplateSettings();
|
|
2433
2434
|
}
|
|
2435
|
+
getPosReceiptAutoPrintPaymentStatuses() {
|
|
2436
|
+
const platform = (0, _platform.normalizeRuntimePlatform)(this.otherParams?.platform);
|
|
2437
|
+
if (platform !== 'pos' && platform !== 'webpos') return undefined;
|
|
2438
|
+
if (!this.isInvoiceOpenDataCacheCurrent() || this.runtimeOpenDataModule !== this.store.openData || this.runtimeOpenDataCore !== this.core) return undefined;
|
|
2439
|
+
return (0, _posReceiptAutoPrint.normalizePosReceiptAutoPrintPaymentStatuses)(this.runtimeOpenDataSnapshot?.['documents.pos_receipt_auto_print_payment_statuses']);
|
|
2440
|
+
}
|
|
2434
2441
|
isInvoiceOpenDataCacheCurrent() {
|
|
2435
2442
|
const businessCode = String(this.otherParams?.businessCode || '').trim();
|
|
2436
2443
|
const channel = String(this.otherParams?.channel || '').trim();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = "_os_pos_receipt_auto_print_payment_statuses";
|
|
2
|
+
export type PosReceiptAutoPrintPaymentStatus = 'paid' | 'partially_paid' | 'payment_processing';
|
|
3
|
+
/** Missing/invalid configuration preserves legacy behavior; an empty array disables auto receipts. */
|
|
4
|
+
export declare function normalizePosReceiptAutoPrintPaymentStatuses(value: unknown): PosReceiptAutoPrintPaymentStatus[] | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = void 0;
|
|
7
|
+
exports.normalizePosReceiptAutoPrintPaymentStatuses = normalizePosReceiptAutoPrintPaymentStatuses;
|
|
8
|
+
const OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = exports.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = '_os_pos_receipt_auto_print_payment_statuses';
|
|
9
|
+
/** Missing/invalid configuration preserves legacy behavior; an empty array disables auto receipts. */
|
|
10
|
+
function normalizePosReceiptAutoPrintPaymentStatuses(value) {
|
|
11
|
+
if (!Array.isArray(value)) return undefined;
|
|
12
|
+
return [...new Set(value.filter(status => status === 'paid' || status === 'partially_paid' || status === 'payment_processing'))];
|
|
13
|
+
}
|