@pisell/pisellos 2.2.204 → 2.2.206
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/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +21 -16
- package/dist/modules/Order/index.d.ts +9 -0
- package/dist/modules/Order/index.js +237 -146
- package/dist/modules/Order/types.d.ts +10 -0
- package/dist/modules/Order/utils.js +7 -5
- package/dist/modules/Payment/index.d.ts +0 -13
- package/dist/modules/Payment/index.js +449 -833
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +142 -0
- package/dist/server/index.js +2208 -824
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/order/index.d.ts +7 -0
- package/dist/server/modules/order/index.js +375 -337
- package/dist/server/modules/order/types.d.ts +15 -0
- package/dist/server/modules/order/types.js +8 -0
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/utils/small-ticket.d.ts +69 -0
- package/dist/server/utils/small-ticket.js +528 -0
- package/dist/solution/BaseSales/index.d.ts +10 -3
- package/dist/solution/BaseSales/index.js +307 -198
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -1
- package/dist/solution/BookingTicket/index.js +444 -264
- package/dist/solution/BookingTicket/types.d.ts +2 -1
- package/dist/solution/BookingTicket/types.js +3 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +51 -52
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +6 -4
- package/lib/modules/Order/index.d.ts +9 -0
- package/lib/modules/Order/index.js +64 -4
- package/lib/modules/Order/types.d.ts +10 -0
- package/lib/modules/Order/utils.js +4 -3
- package/lib/modules/Payment/index.d.ts +0 -13
- package/lib/modules/Payment/index.js +6 -149
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +142 -0
- package/lib/server/index.js +867 -49
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/order/index.d.ts +7 -0
- package/lib/server/modules/order/index.js +21 -7
- package/lib/server/modules/order/types.d.ts +15 -0
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/utils/small-ticket.d.ts +69 -0
- package/lib/server/utils/small-ticket.js +555 -0
- package/lib/solution/BaseSales/index.d.ts +10 -3
- package/lib/solution/BaseSales/index.js +98 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -1
- package/lib/solution/BookingTicket/index.js +109 -2
- package/lib/solution/BookingTicket/types.d.ts +2 -1
- package/lib/solution/BookingTicket/types.js +5 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/package.json +1 -1
|
@@ -456,6 +456,7 @@ export interface OrderPaymentData {
|
|
|
456
456
|
payment_time?: string;
|
|
457
457
|
wallet_pass_usage_unit?: unknown;
|
|
458
458
|
wallet_pass_use_value?: string | number | null;
|
|
459
|
+
fund_record?: Record<string, any>;
|
|
459
460
|
metadata: OrderPaymentMetadata;
|
|
460
461
|
rounding_amount?: string;
|
|
461
462
|
service_charge?: {
|
|
@@ -477,6 +478,7 @@ export interface LoadSalesDetailParams {
|
|
|
477
478
|
externalSaleNumber?: string;
|
|
478
479
|
external_sale_number?: string;
|
|
479
480
|
forceRemote?: boolean;
|
|
481
|
+
merge?: boolean;
|
|
480
482
|
}
|
|
481
483
|
export interface SalesOrderLookupParams {
|
|
482
484
|
lookup: number | string;
|
|
@@ -597,6 +599,14 @@ export interface OrderModuleAPI {
|
|
|
597
599
|
getOrderSnapshot: () => OrderSnapshot | null;
|
|
598
600
|
getOrderSyncState: () => OrderSyncState;
|
|
599
601
|
getOrderAmountSnapshot: () => OrderAmountSnapshot | null;
|
|
602
|
+
buildCurrentSubmitPayloadForLocalPrint: (params?: {
|
|
603
|
+
cacheId?: string;
|
|
604
|
+
platform?: string;
|
|
605
|
+
businessCode?: string;
|
|
606
|
+
channel?: string;
|
|
607
|
+
type?: string;
|
|
608
|
+
}) => OrderSubmitPayload;
|
|
609
|
+
applyLocalPrintOrderNumbers: (order?: Record<string, any> | null) => Promise<OrderTempOrder>;
|
|
600
610
|
getTempOrderNote: () => string;
|
|
601
611
|
updateTempOrderNote: {
|
|
602
612
|
(note: string): string;
|
|
@@ -748,9 +748,9 @@ function buildSubmitPayload(params) {
|
|
|
748
748
|
...tempOrderRest,
|
|
749
749
|
customer_id: tempOrder.customer_id ?? 1,
|
|
750
750
|
customer_name: tempOrder.customer_name || "Select a customer",
|
|
751
|
-
order_number: null,
|
|
752
|
-
shop_order_number: null,
|
|
753
|
-
shop_full_order_number: null,
|
|
751
|
+
order_number: tempOrder.order_number ?? null,
|
|
752
|
+
shop_order_number: tempOrder.shop_order_number ?? null,
|
|
753
|
+
shop_full_order_number: tempOrder.shop_full_order_number ?? null,
|
|
754
754
|
platform: normalizeSubmitPlatform(platform),
|
|
755
755
|
request_unique_idempotency_token: tempOrder.request_unique_idempotency_token || `${tempOrder.external_sale_number}_${now.getTime()}`,
|
|
756
756
|
type: submitType,
|
|
@@ -825,6 +825,7 @@ function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
825
825
|
...item.payment_time !== void 0 ? { payment_time: item.payment_time } : {},
|
|
826
826
|
...item.wallet_pass_usage_unit !== void 0 ? { wallet_pass_usage_unit: item.wallet_pass_usage_unit } : {},
|
|
827
827
|
...item.wallet_pass_use_value !== void 0 ? { wallet_pass_use_value: item.wallet_pass_use_value } : {},
|
|
828
|
+
...item.fund_record && typeof item.fund_record === "object" && !Array.isArray(item.fund_record) ? { fund_record: { ...item.fund_record } } : {},
|
|
828
829
|
metadata,
|
|
829
830
|
...item.rounding_amount !== void 0 ? { rounding_amount: String(item.rounding_amount) } : {},
|
|
830
831
|
...item.service_charge !== void 0 ? { service_charge: item.service_charge } : {},
|
|
@@ -25,9 +25,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
25
25
|
private dbManager;
|
|
26
26
|
private logger;
|
|
27
27
|
private voucherUpdateLockByOrderUuid;
|
|
28
|
-
private payMethodMemoryCache;
|
|
29
|
-
private payMethodListInFlight;
|
|
30
|
-
private isRefreshingPaymentMethods;
|
|
31
28
|
protected otherParams: any;
|
|
32
29
|
cash: CashPayment;
|
|
33
30
|
eftpos: EftposPayment;
|
|
@@ -57,20 +54,10 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
57
54
|
*
|
|
58
55
|
*/
|
|
59
56
|
private registerNetworkHandlers;
|
|
60
|
-
private filterPayMethods;
|
|
61
57
|
/**
|
|
62
58
|
* 获取支付方式列表
|
|
63
59
|
*/
|
|
64
60
|
getPayMethodListAsync(): Promise<PaymentMethod[]>;
|
|
65
|
-
private loadPayMethodListAsync;
|
|
66
|
-
/**
|
|
67
|
-
* 后台刷新支付方式列表
|
|
68
|
-
*/
|
|
69
|
-
private refreshPaymentMethodsInBackground;
|
|
70
|
-
/**
|
|
71
|
-
* 检查支付方式列表是否有变化
|
|
72
|
-
*/
|
|
73
|
-
private hasPaymentMethodsChanged;
|
|
74
61
|
/**
|
|
75
62
|
* 获取订单列表
|
|
76
63
|
*/
|
|
@@ -76,9 +76,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
76
76
|
this.defaultVersion = "1.0.0";
|
|
77
77
|
// LoggerManager 实例
|
|
78
78
|
this.voucherUpdateLockByOrderUuid = /* @__PURE__ */ new Map();
|
|
79
|
-
this.payMethodMemoryCache = null;
|
|
80
|
-
this.payMethodListInFlight = null;
|
|
81
|
-
this.isRefreshingPaymentMethods = false;
|
|
82
79
|
this.otherParams = {};
|
|
83
80
|
this.cash = new import_cash.CashPaymentImpl(this);
|
|
84
81
|
this.eftpos = new import_eftpos.EftposPaymentImpl(this);
|
|
@@ -213,66 +210,18 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
213
210
|
}
|
|
214
211
|
});
|
|
215
212
|
}
|
|
216
|
-
async filterPayMethods(payMethods) {
|
|
217
|
-
payMethods = payMethods.filter((method) => method.status === 1 && method.disable === 0);
|
|
218
|
-
const walletPassMethod = payMethods.find((method) => method.code === "WALLET_PASS");
|
|
219
|
-
if (walletPassMethod) {
|
|
220
|
-
payMethods.forEach((method) => {
|
|
221
|
-
if (method.code === "PRODUCTVOUCHER" || method.code === "GIFTCARD" || method.code === "POINTCARD") {
|
|
222
|
-
method.channel_application = walletPassMethod.channel_application;
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
} else {
|
|
226
|
-
payMethods = payMethods.filter((method) => method.code !== "PRODUCTVOUCHER" && method.code !== "GIFTCARD" && method.code !== "POINTCARD");
|
|
227
|
-
}
|
|
228
|
-
return payMethods;
|
|
229
|
-
}
|
|
230
213
|
/**
|
|
231
214
|
* 获取支付方式列表
|
|
232
215
|
*/
|
|
233
216
|
async getPayMethodListAsync() {
|
|
234
|
-
var _a;
|
|
235
217
|
this.logInfo("Starting getPayMethodListAsync");
|
|
236
|
-
if ((_a = this.payMethodMemoryCache) == null ? void 0 : _a.length) {
|
|
237
|
-
return this.payMethodMemoryCache;
|
|
238
|
-
}
|
|
239
|
-
if (this.payMethodListInFlight) {
|
|
240
|
-
return this.payMethodListInFlight;
|
|
241
|
-
}
|
|
242
|
-
this.payMethodListInFlight = this.loadPayMethodListAsync().finally(() => {
|
|
243
|
-
this.payMethodListInFlight = null;
|
|
244
|
-
});
|
|
245
|
-
return this.payMethodListInFlight;
|
|
246
|
-
}
|
|
247
|
-
async loadPayMethodListAsync() {
|
|
248
218
|
try {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const hasCache = cachedMethods.length > 0;
|
|
256
|
-
if (hasCache) {
|
|
257
|
-
this.payMethodMemoryCache = cachedMethods;
|
|
258
|
-
this.refreshPaymentMethodsInBackground(cachedMethods);
|
|
259
|
-
return cachedMethods;
|
|
260
|
-
}
|
|
261
|
-
const response = await this.request.get("/pay/custom-payment/all");
|
|
262
|
-
response.data = await this.filterPayMethods(response.data);
|
|
263
|
-
const payMethods = response.data || [];
|
|
264
|
-
this.payMethodMemoryCache = payMethods;
|
|
265
|
-
try {
|
|
266
|
-
for (const method of payMethods) {
|
|
267
|
-
await this.dbManager.update("pay_method", method);
|
|
268
|
-
}
|
|
269
|
-
} catch (dbError) {
|
|
270
|
-
console.warn("[PaymentModule] 无法缓存支付方式,pay_method 表不存在");
|
|
271
|
-
}
|
|
272
|
-
await this.core.effects.emit(
|
|
273
|
-
`${this.name}:onPaymentMethodsLoaded`,
|
|
274
|
-
payMethods
|
|
275
|
-
);
|
|
219
|
+
const response = await this.request.get("/pay/custom-payment/all", {
|
|
220
|
+
filterPaymentMethods: true
|
|
221
|
+
}, {
|
|
222
|
+
osServer: true
|
|
223
|
+
});
|
|
224
|
+
const payMethods = (response == null ? void 0 : response.data) || response || [];
|
|
276
225
|
this.logInfo("getPayMethodListAsync completed successfully", {
|
|
277
226
|
payMethods
|
|
278
227
|
});
|
|
@@ -283,98 +232,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
283
232
|
return [];
|
|
284
233
|
}
|
|
285
234
|
}
|
|
286
|
-
/**
|
|
287
|
-
* 后台刷新支付方式列表
|
|
288
|
-
*/
|
|
289
|
-
async refreshPaymentMethodsInBackground(cachedMethods) {
|
|
290
|
-
if (this.isRefreshingPaymentMethods)
|
|
291
|
-
return;
|
|
292
|
-
this.isRefreshingPaymentMethods = true;
|
|
293
|
-
this.logInfo("Starting refreshPaymentMethodsInBackground", {
|
|
294
|
-
cachedMethodsCount: cachedMethods.length
|
|
295
|
-
});
|
|
296
|
-
try {
|
|
297
|
-
console.log("[PaymentModule] 后台刷新支付方式列表...");
|
|
298
|
-
const response = await this.request.get("/pay/custom-payment/all");
|
|
299
|
-
response.data = await this.filterPayMethods(response.data);
|
|
300
|
-
const newPayMethods = response.data || [];
|
|
301
|
-
this.payMethodMemoryCache = newPayMethods;
|
|
302
|
-
const hasChanges = this.hasPaymentMethodsChanged(
|
|
303
|
-
cachedMethods,
|
|
304
|
-
newPayMethods
|
|
305
|
-
);
|
|
306
|
-
if (hasChanges) {
|
|
307
|
-
console.log("[PaymentModule] 支付方式列表已更新");
|
|
308
|
-
this.logInfo("Payment methods updated in background", {
|
|
309
|
-
oldCount: cachedMethods.length,
|
|
310
|
-
newCount: newPayMethods.length
|
|
311
|
-
});
|
|
312
|
-
try {
|
|
313
|
-
for (const method of cachedMethods) {
|
|
314
|
-
await this.dbManager.delete("pay_method", method.id);
|
|
315
|
-
}
|
|
316
|
-
for (const method of newPayMethods) {
|
|
317
|
-
await this.dbManager.update("pay_method", method);
|
|
318
|
-
}
|
|
319
|
-
} catch (dbError) {
|
|
320
|
-
console.warn("[PaymentModule] 无法更新支付方式缓存", dbError);
|
|
321
|
-
}
|
|
322
|
-
const eventData = {
|
|
323
|
-
oldMethods: cachedMethods,
|
|
324
|
-
newMethods: newPayMethods
|
|
325
|
-
};
|
|
326
|
-
await this.core.effects.emit(
|
|
327
|
-
`${this.name}:onPaymentMethodsChanged`,
|
|
328
|
-
eventData
|
|
329
|
-
);
|
|
330
|
-
} else {
|
|
331
|
-
console.log("[PaymentModule] 支付方式列表无变化");
|
|
332
|
-
}
|
|
333
|
-
} catch (error) {
|
|
334
|
-
console.error("[PaymentModule] 后台刷新支付方式失败", error);
|
|
335
|
-
} finally {
|
|
336
|
-
this.isRefreshingPaymentMethods = false;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* 检查支付方式列表是否有变化
|
|
341
|
-
*/
|
|
342
|
-
hasPaymentMethodsChanged(oldMethods, newMethods) {
|
|
343
|
-
if (oldMethods.length !== newMethods.length) {
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
const oldMethodsMap = new Map(
|
|
347
|
-
oldMethods.map((method) => [method.id, method])
|
|
348
|
-
);
|
|
349
|
-
for (const newMethod of newMethods) {
|
|
350
|
-
const oldMethod = oldMethodsMap.get(newMethod.id);
|
|
351
|
-
if (!oldMethod) {
|
|
352
|
-
return true;
|
|
353
|
-
}
|
|
354
|
-
if (oldMethod.code !== newMethod.code || oldMethod.name !== newMethod.name || oldMethod.type !== newMethod.type || oldMethod.description !== newMethod.description || oldMethod.status !== newMethod.status || oldMethod.disable !== newMethod.disable || oldMethod.is_surcharge !== newMethod.is_surcharge || oldMethod.fixed !== newMethod.fixed || oldMethod.percentage !== newMethod.percentage || oldMethod.enabled !== newMethod.enabled || JSON.stringify(oldMethod.channel_application || []) !== JSON.stringify(newMethod.channel_application || []) || JSON.stringify(oldMethod.companies || []) !== JSON.stringify(newMethod.companies || []) || JSON.stringify(oldMethod.metadata || {}) !== JSON.stringify(newMethod.metadata || {})) {
|
|
355
|
-
console.log(`[PaymentModule] 支付方式 ${newMethod.id} (${newMethod.code}) 发生变化:`, {
|
|
356
|
-
id: newMethod.id,
|
|
357
|
-
changes: {
|
|
358
|
-
code: oldMethod.code !== newMethod.code ? { old: oldMethod.code, new: newMethod.code } : void 0,
|
|
359
|
-
name: oldMethod.name !== newMethod.name ? { old: oldMethod.name, new: newMethod.name } : void 0,
|
|
360
|
-
type: oldMethod.type !== newMethod.type ? { old: oldMethod.type, new: newMethod.type } : void 0,
|
|
361
|
-
description: oldMethod.description !== newMethod.description ? { old: oldMethod.description, new: newMethod.description } : void 0,
|
|
362
|
-
status: oldMethod.status !== newMethod.status ? { old: oldMethod.status, new: newMethod.status } : void 0,
|
|
363
|
-
disable: oldMethod.disable !== newMethod.disable ? { old: oldMethod.disable, new: newMethod.disable } : void 0,
|
|
364
|
-
is_surcharge: oldMethod.is_surcharge !== newMethod.is_surcharge ? { old: oldMethod.is_surcharge, new: newMethod.is_surcharge } : void 0,
|
|
365
|
-
fixed: oldMethod.fixed !== newMethod.fixed ? { old: oldMethod.fixed, new: newMethod.fixed } : void 0,
|
|
366
|
-
percentage: oldMethod.percentage !== newMethod.percentage ? { old: oldMethod.percentage, new: newMethod.percentage } : void 0,
|
|
367
|
-
enabled: oldMethod.enabled !== newMethod.enabled ? { old: oldMethod.enabled, new: newMethod.enabled } : void 0,
|
|
368
|
-
channel_application: JSON.stringify(oldMethod.channel_application || []) !== JSON.stringify(newMethod.channel_application || []) ? { old: oldMethod.channel_application, new: newMethod.channel_application } : void 0,
|
|
369
|
-
companies: JSON.stringify(oldMethod.companies || []) !== JSON.stringify(newMethod.companies || []) ? { old: oldMethod.companies, new: newMethod.companies } : void 0,
|
|
370
|
-
metadata: JSON.stringify(oldMethod.metadata || {}) !== JSON.stringify(newMethod.metadata || {}) ? { old: oldMethod.metadata, new: newMethod.metadata } : void 0
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
return true;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
378
235
|
/**
|
|
379
236
|
* 获取订单列表
|
|
380
237
|
*/
|
package/lib/plugins/request.d.ts
CHANGED
package/lib/server/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { QuotationModule } from './modules/quotation';
|
|
|
4
4
|
import { ScheduleModuleEx } from './modules/schedule';
|
|
5
5
|
import { ResourceModule } from './modules/resource';
|
|
6
6
|
import { FloorPlanModule } from './modules/floor-plan';
|
|
7
|
+
import { PaymentServerModule } from './modules/payment';
|
|
7
8
|
import { PisellCore, ServerModuleConfig, InitializeServerOptions } from '../types';
|
|
8
9
|
import type { RouteHandler, HttpMethod, RouteDefinition, Router, ModuleRegistryConfig, RequestSetting } from './types';
|
|
9
10
|
import { OrderModule } from './modules/order';
|
|
@@ -23,6 +24,9 @@ declare class Server {
|
|
|
23
24
|
resource?: ResourceModule;
|
|
24
25
|
order?: OrderModule;
|
|
25
26
|
floor_plan?: FloorPlanModule;
|
|
27
|
+
payment?: PaymentServerModule;
|
|
28
|
+
private paymentRouteModule?;
|
|
29
|
+
private paymentRouteModuleInFlight?;
|
|
26
30
|
/** GET 前缀路由(最长前缀优先匹配) */
|
|
27
31
|
private prefixRouterGet;
|
|
28
32
|
router: Router;
|
|
@@ -33,6 +37,8 @@ declare class Server {
|
|
|
33
37
|
private bookingRemoteCache;
|
|
34
38
|
private readonly BOOKING_REMOTE_CACHE_TTL_MS;
|
|
35
39
|
private readonly BOOKING_REMOTE_CACHE_MAX_ENTRIES;
|
|
40
|
+
private salesSearchSubscribers;
|
|
41
|
+
private deviceTaskActionsRegistered;
|
|
36
42
|
private floorPlanQuerySubscribers;
|
|
37
43
|
private moduleRegistry;
|
|
38
44
|
constructor(core: PisellCore);
|
|
@@ -85,6 +91,8 @@ declare class Server {
|
|
|
85
91
|
config: ModuleRegistryConfig;
|
|
86
92
|
shouldPreload: boolean;
|
|
87
93
|
}[]>;
|
|
94
|
+
private registerDeviceTaskActions;
|
|
95
|
+
private handleSyncSalesTask;
|
|
88
96
|
/**
|
|
89
97
|
* 将普通层 QuotationModule 的报价单计算能力桥接到 Server Products 模块。
|
|
90
98
|
*/
|
|
@@ -167,6 +175,8 @@ declare class Server {
|
|
|
167
175
|
* @private
|
|
168
176
|
*/
|
|
169
177
|
private registerServerRoutes;
|
|
178
|
+
private getPaymentRouteModule;
|
|
179
|
+
private handlePaymentMethods;
|
|
170
180
|
/**
|
|
171
181
|
* 根据 subscriberId 移除商品查询订阅者
|
|
172
182
|
*/
|
|
@@ -194,6 +204,84 @@ declare class Server {
|
|
|
194
204
|
* 取消订单列表查询订阅(HTTP 路由入口)
|
|
195
205
|
*/
|
|
196
206
|
private handleUnsubscribeOrderQuery;
|
|
207
|
+
/**
|
|
208
|
+
* 处理 sales 单模块搜索:请求透传后端,仅在 OS 层维护已返回订单号集合。
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* await this.handleSalesSearchModule({ url: '/shop/es/search/sales', method: 'post', data: { keyword: 'A' } })
|
|
212
|
+
*/
|
|
213
|
+
private handleSalesSearchModule;
|
|
214
|
+
/**
|
|
215
|
+
* 处理 sales 聚合搜索:请求透传后端,仅订阅 sales 分组的已返回订单号。
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* await this.handleSalesSearchAggregate({ url: '/shop/es/search', method: 'post', data: { modules: [] } })
|
|
219
|
+
*/
|
|
220
|
+
private handleSalesSearchAggregate;
|
|
221
|
+
/**
|
|
222
|
+
* 取消 sales 搜索订阅。
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* await this.handleUnsubscribeSalesSearch({ data: { subscriberId: 'global-search-order' } } as any)
|
|
226
|
+
*/
|
|
227
|
+
private handleUnsubscribeSalesSearch;
|
|
228
|
+
/**
|
|
229
|
+
* 执行 sales 搜索并登记可见订单号。
|
|
230
|
+
* 搜索参数完全透传后端,OS 不做过滤、筛选、排序。
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* const result = await this.handleSalesSearchRequest('single', '/shop/es/search/sales', { keyword: '1001' }, {})
|
|
234
|
+
*/
|
|
235
|
+
private handleSalesSearchRequest;
|
|
236
|
+
/**
|
|
237
|
+
* 透传调用后端 sales 搜索接口。
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* const res = await this.fetchSalesSearchFromAPI('/shop/es/search/sales', { keyword: '1001' })
|
|
241
|
+
*/
|
|
242
|
+
private fetchSalesSearchFromAPI;
|
|
243
|
+
/**
|
|
244
|
+
* 构建搜索订阅签名;页码变化不重置,可继续累计 visibleOrderIds。
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* const signature = this.buildSalesSearchSignature('single', { keyword: 'A', page: 2 })
|
|
248
|
+
*/
|
|
249
|
+
private buildSalesSearchSignature;
|
|
250
|
+
/**
|
|
251
|
+
* 移除页码参数,保留 page size、keyword、filters、sort 等查询语义参数。
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* this.stripSalesSearchPageParams({ page: 2, per_page: 20, keyword: 'A' })
|
|
255
|
+
*/
|
|
256
|
+
private stripSalesSearchPageParams;
|
|
257
|
+
/**
|
|
258
|
+
* 提取响应 data,兼容 OS 包装结构与后端直接响应结构。
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* const data = this.extractSalesSearchResponseData(result)
|
|
262
|
+
*/
|
|
263
|
+
private extractSalesSearchResponseData;
|
|
264
|
+
/**
|
|
265
|
+
* 从搜索响应中提取 sales 命中的订单号。
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* const ids = this.extractSalesSearchOrderIds('single', result)
|
|
269
|
+
*/
|
|
270
|
+
private extractSalesSearchOrderIds;
|
|
271
|
+
/**
|
|
272
|
+
* 查找聚合搜索响应中的 sales 分组。
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* const group = this.findSalesSearchAggregateGroup({ results: [{ module: 'sales' }] })
|
|
276
|
+
*/
|
|
277
|
+
private findSalesSearchAggregateGroup;
|
|
278
|
+
/**
|
|
279
|
+
* 从订单或搜索命中项中取订单号。
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* const id = this.getSalesSearchOrderId({ order_id: 1001 })
|
|
283
|
+
*/
|
|
284
|
+
private getSalesSearchOrderId;
|
|
197
285
|
/**
|
|
198
286
|
* 从查询值中提取 YYYY-MM-DD 日期串。
|
|
199
287
|
*
|
|
@@ -286,9 +374,33 @@ declare class Server {
|
|
|
286
374
|
private handleUpdateLocalOrder;
|
|
287
375
|
private handleOrderSalesCheckout;
|
|
288
376
|
private handleOrderCheckout;
|
|
377
|
+
private getDeviceTaskPlugin;
|
|
378
|
+
private getIdGeneratorPlugin;
|
|
379
|
+
private getAppData;
|
|
380
|
+
private getSmallTicketShopInfo;
|
|
381
|
+
private taskOk;
|
|
382
|
+
private taskFail;
|
|
383
|
+
private taskTimeout;
|
|
384
|
+
private resolveCheckoutTaskDeviceId;
|
|
385
|
+
private buildCheckoutTaskIdempotencyKey;
|
|
386
|
+
private ensureCheckoutOrderNumbers;
|
|
387
|
+
private dispatchCheckoutSyncTask;
|
|
388
|
+
private dispatchPrintOtherReceiptTask;
|
|
389
|
+
private buildPrintOtherReceiptIdempotencyKey;
|
|
390
|
+
private getPrintOrderIdentity;
|
|
391
|
+
private dispatchLocalReceiptPrint;
|
|
392
|
+
private handleLocalPrintOrder;
|
|
289
393
|
private handleOrderCheckoutSubmit;
|
|
290
394
|
private handlePendingSyncCheckoutOrder;
|
|
291
395
|
private buildPendingSyncCheckoutOrder;
|
|
396
|
+
private shouldBuildSmallTicketData;
|
|
397
|
+
private shouldPrintSyncedOrder;
|
|
398
|
+
private hasPaymentStatus;
|
|
399
|
+
private isSalesOrderFullyPaid;
|
|
400
|
+
private sumPaidOrderPayments;
|
|
401
|
+
private toAmountNumber;
|
|
402
|
+
private buildSmallTicketProductMap;
|
|
403
|
+
private withLocalSmallTicketData;
|
|
292
404
|
private handleOrderSalesDetail;
|
|
293
405
|
/**
|
|
294
406
|
* 解析 order_ids 入参,兼容 url query / data 字段、字符串(csv) / 数组两种形态。
|
|
@@ -321,6 +433,7 @@ declare class Server {
|
|
|
321
433
|
private buildOrderSalesDetailBackendPath;
|
|
322
434
|
private extractOrderDataFromCheckoutResponse;
|
|
323
435
|
private normalizeCheckoutResponse;
|
|
436
|
+
private isCheckoutResponseRejected;
|
|
324
437
|
private extractBackendErrorResponse;
|
|
325
438
|
private isExplicitBackendErrorResponse;
|
|
326
439
|
/**
|
|
@@ -377,6 +490,35 @@ declare class Server {
|
|
|
377
490
|
* 订单数据变更后,遍历订阅者重新计算并通过 callback 推送
|
|
378
491
|
*/
|
|
379
492
|
private recomputeAndNotifyOrderQuery;
|
|
493
|
+
/**
|
|
494
|
+
* 订单变更后通知 sales 搜索订阅者。
|
|
495
|
+
* 仅回传当前查询已返回订单号集合中的变更订单。
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* this.notifySalesSearchSubscribers({ list: [], changedOrders: [order], source: 'pubsub.bodyUpsert' })
|
|
499
|
+
*/
|
|
500
|
+
private notifySalesSearchSubscribers;
|
|
501
|
+
/**
|
|
502
|
+
* 从订单变更事件中提取明确 delta。
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* const list = this.extractChangedOrdersFromPayload(payload)
|
|
506
|
+
*/
|
|
507
|
+
private extractChangedOrdersFromPayload;
|
|
508
|
+
/**
|
|
509
|
+
* 构建与当前搜索接口一致的 delta 响应。
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* const response = this.buildSalesSearchDeltaResponse(subscriber, [order])
|
|
513
|
+
*/
|
|
514
|
+
private buildSalesSearchDeltaResponse;
|
|
515
|
+
/**
|
|
516
|
+
* 构建聚合搜索接口的 sales 分组 delta 响应。
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* const response = this.buildAggregateSalesSearchDeltaResponse(subscriber, [order])
|
|
520
|
+
*/
|
|
521
|
+
private buildAggregateSalesSearchDeltaResponse;
|
|
380
522
|
/**
|
|
381
523
|
* 预约数据变更后,遍历订阅者重新计算并通过 callback 推送
|
|
382
524
|
*/
|