@pisell/pisellos 2.3.37 → 2.3.39
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/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +513 -747
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +40 -11
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +49 -78
- package/dist/modules/Payment/types.d.ts +24 -26
- package/dist/modules/Payment/types.js +0 -2
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.js +48 -15
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1162 -1943
- package/dist/server/modules/order/index.d.ts +4 -49
- package/dist/server/modules/order/index.js +695 -1574
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +10 -33
- package/dist/solution/BaseSales/index.js +385 -676
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.js +1 -2
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1140 -737
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1177 -850
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +83 -187
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +39 -10
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +12 -33
- package/lib/modules/Payment/types.d.ts +24 -26
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.js +34 -18
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +88 -678
- package/lib/server/modules/order/index.d.ts +4 -49
- package/lib/server/modules/order/index.js +66 -657
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +10 -33
- package/lib/solution/BaseSales/index.js +33 -201
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.js +1 -2
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -182
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -115
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -213,12 +213,10 @@ export interface OrderBookingItem {
|
|
|
213
213
|
[key: string]: unknown;
|
|
214
214
|
}[];
|
|
215
215
|
}
|
|
216
|
-
/** 支付记录 metadata */
|
|
216
|
+
/** 支付记录 metadata,常含 unique_payment_number */
|
|
217
217
|
export interface OrderPaymentMetadata {
|
|
218
|
-
/**
|
|
218
|
+
/** 设备端本地支付唯一标识 */
|
|
219
219
|
unique_payment_number?: string;
|
|
220
|
-
/** 刷卡机设备快照;server 不解析内部字段,仅透传并持久化 */
|
|
221
|
-
card_reader_snapshot?: Record<string, unknown>;
|
|
222
220
|
[key: string]: unknown;
|
|
223
221
|
}
|
|
224
222
|
/**
|
|
@@ -227,8 +225,6 @@ export interface OrderPaymentMetadata {
|
|
|
227
225
|
export interface OrderPaymentItem {
|
|
228
226
|
/** 支付记录 ID;存量/更新时传。来源:OrderPayment.id */
|
|
229
227
|
order_payment_id?: number | null;
|
|
230
|
-
/** 支付项稳定唯一号;历史支付项允许缺失 */
|
|
231
|
-
payment_number?: string;
|
|
232
228
|
/** 支付方式 ID(设备端从本地支付方式配置取详情)。来源:OrderPayment.custom_payment_id */
|
|
233
229
|
custom_payment_id?: number;
|
|
234
230
|
/** 支付方式编码。来源:OrderPayment.payment_method */
|
|
@@ -253,13 +249,11 @@ export interface OrderPaymentItem {
|
|
|
253
249
|
created_at?: string | null;
|
|
254
250
|
/** 手续费配置。来源:OrderPayment.service_charge */
|
|
255
251
|
service_charge?: Record<string, unknown> | null;
|
|
256
|
-
/** 已计算的支付手续费。来源:OrderPayment.service_fee */
|
|
257
|
-
service_fee?: OrderMoneyString;
|
|
258
252
|
/** Wallet Pass 使用单位 */
|
|
259
253
|
wallet_pass_usage_unit?: unknown[] | null;
|
|
260
254
|
/** Wallet Pass 使用值 */
|
|
261
255
|
wallet_pass_use_value?: number | null;
|
|
262
|
-
/**
|
|
256
|
+
/** 元数据;含 unique_payment_number。来源:OrderPayment.metadata */
|
|
263
257
|
metadata?: OrderPaymentMetadata | null;
|
|
264
258
|
}
|
|
265
259
|
/**
|
|
@@ -419,8 +413,6 @@ export interface OrderData {
|
|
|
419
413
|
create_date?: string;
|
|
420
414
|
/** 本地待同步标记:1 表示需要后续同步到云端 */
|
|
421
415
|
need_sync?: 0 | 1 | number;
|
|
422
|
-
/** 本地草稿标记:1 表示仅为 POS 可恢复草稿,不代表已提交云端 */
|
|
423
|
-
is_draft_order?: 0 | 1 | number;
|
|
424
416
|
/** 兼容:部分场景仍使用顶层 total_amount */
|
|
425
417
|
total_amount?: OrderMoneyString | number;
|
|
426
418
|
/** 扩展字段(物流、标签等);使用 any 以便筛选与数据源扩展 */
|
|
@@ -2,7 +2,7 @@ import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult } from './types';
|
|
4
4
|
import { OrderModule } from '../../modules/Order';
|
|
5
|
-
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData,
|
|
5
|
+
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from '../../modules/Order/types';
|
|
6
6
|
import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
|
|
7
7
|
import type { Discount } from '../../modules/Discount/types';
|
|
8
8
|
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
@@ -24,19 +24,6 @@ export interface BaseSalesState {
|
|
|
24
24
|
schedule?: ScheduleModule;
|
|
25
25
|
quotation?: QuotationModule;
|
|
26
26
|
}
|
|
27
|
-
export interface BaseSalesUpdateOrderPaymentOptions extends OrderPaymentUpdateOptions {
|
|
28
|
-
persistDraft?: boolean;
|
|
29
|
-
submitWhenPaid?: boolean;
|
|
30
|
-
forceSubmitIfPaid?: boolean;
|
|
31
|
-
/** 草稿恢复时,允许将新回调字段合并进已 paid 的支付项。 */
|
|
32
|
-
applyUpdatesWhenPaid?: boolean;
|
|
33
|
-
smallTicketDataFlag?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface BaseSalesUpdateOrderPaymentResult extends OrderPaymentUpdateResult {
|
|
36
|
-
draftResult?: unknown;
|
|
37
|
-
draftError?: unknown;
|
|
38
|
-
syncResult?: SyncPaymentsToOrderResult<any>;
|
|
39
|
-
}
|
|
40
27
|
export type BaseSalesPrintLocalOrderReceiptParams = string | number;
|
|
41
28
|
export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
42
29
|
protected defaultName: string;
|
|
@@ -141,8 +128,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
141
128
|
*/
|
|
142
129
|
protected readSessionCacheData(): Record<string, any>;
|
|
143
130
|
protected getAppData<T>(key: string): T | undefined;
|
|
144
|
-
private getPaymentNumberDevicePrefixSync;
|
|
145
|
-
private getPaymentNumberDevicePrefixAsync;
|
|
146
131
|
private syncAppDataToTempOrder;
|
|
147
132
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
148
133
|
destroy(): Promise<void>;
|
|
@@ -255,13 +240,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
255
240
|
confirmPendingVoucherPayments?: boolean;
|
|
256
241
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
257
242
|
}): Promise<T>;
|
|
258
|
-
saveSalesOrderDraft<T = any>(params?: {
|
|
259
|
-
platform?: string;
|
|
260
|
-
businessCode?: string;
|
|
261
|
-
channel?: string;
|
|
262
|
-
type?: string;
|
|
263
|
-
enhancePayload?: SubmitPayloadEnhancer;
|
|
264
|
-
}): Promise<T>;
|
|
265
243
|
submitTempOrderAsync<T = any>(params?: {
|
|
266
244
|
payments?: OrderPaymentSource[];
|
|
267
245
|
paymentStatus?: BaseSalesPaymentStatus;
|
|
@@ -269,6 +247,13 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
269
247
|
confirmPendingVoucherPayments?: boolean;
|
|
270
248
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
271
249
|
}): Promise<T>;
|
|
250
|
+
/**
|
|
251
|
+
* 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
|
|
252
|
+
* otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
|
|
253
|
+
*/
|
|
254
|
+
protected shouldUseCheckoutSyncTask(): boolean;
|
|
255
|
+
/** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
|
|
256
|
+
protected getDefaultCheckoutSmallTicketDataFlag(): number | undefined;
|
|
272
257
|
printLocalOrderReceipt<T = any>(lookup?: BaseSalesPrintLocalOrderReceiptParams): Promise<T>;
|
|
273
258
|
private getSubmitPaymentStatus;
|
|
274
259
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
@@ -280,24 +265,16 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
280
265
|
private queueLatestAutoPaymentSync;
|
|
281
266
|
private scheduleQueuedAutoPaymentSyncFlush;
|
|
282
267
|
private flushQueuedAutoPaymentSync;
|
|
283
|
-
/**
|
|
284
|
-
* 同步兼容入口。无法等待 IoT 短号时,按调用当下的 device_id 或 LOCAL 生成。
|
|
285
|
-
*/
|
|
268
|
+
/** 追加单个支付项到当前订单。 */
|
|
286
269
|
addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
|
|
287
|
-
/** 创建新支付项时读取最新设备短号,不缓存运行时设备信息。 */
|
|
288
|
-
addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
|
|
289
|
-
private addOrderPaymentWithDevicePrefix;
|
|
290
270
|
/** 更新当前订单中的指定支付项。 */
|
|
291
|
-
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any
|
|
271
|
+
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>): OrderPaymentData[];
|
|
292
272
|
/** 删除当前订单中的指定支付项。 */
|
|
293
273
|
deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
|
|
294
274
|
/** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
|
|
295
275
|
updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
|
|
296
276
|
status?: 'paid' | 'payment_pending';
|
|
297
277
|
}): OrderPaymentData[];
|
|
298
|
-
updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
|
|
299
|
-
status?: 'paid' | 'payment_pending';
|
|
300
|
-
}): Promise<OrderPaymentData[]>;
|
|
301
278
|
confirmPendingVoucherPayments(): OrderPaymentData[];
|
|
302
279
|
discardPendingVoucherPayments(): OrderPaymentData[];
|
|
303
280
|
private getWalletProductList;
|
|
@@ -40,8 +40,6 @@ var import_decimal = __toESM(require("decimal.js"));
|
|
|
40
40
|
var import_lodash_es = require("lodash-es");
|
|
41
41
|
var import_types2 = require("../BookingByStep/types");
|
|
42
42
|
var import_utils = require("../../modules/Order/utils");
|
|
43
|
-
var import_payment_utils = require("../../modules/Order/payment-utils");
|
|
44
|
-
var import_payment_number = require("../../utils/payment-number");
|
|
45
43
|
var import_orderCollectionIdentity = require("../../modules/Order/utils/orderCollectionIdentity");
|
|
46
44
|
var import_dayjs = __toESM(require("dayjs"));
|
|
47
45
|
__reExport(BaseSales_exports, require("./types"), module.exports);
|
|
@@ -79,11 +77,6 @@ function isBaseSalesHistoricalDiscountEntry(discount) {
|
|
|
79
77
|
(discount == null ? void 0 : discount.isEditMode) || (discount == null ? void 0 : discount.isDisabled) || (discount == null ? void 0 : discount.order_discount_id) != null
|
|
80
78
|
);
|
|
81
79
|
}
|
|
82
|
-
function getBaseSalesUniqueArrayMetadataKey(key) {
|
|
83
|
-
if (key === "products" || key === "bookings")
|
|
84
|
-
return "unique_identification_number";
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
80
|
var BASE_SALES_PERSISTENT_ID_FIELD_BY_KIND = {
|
|
88
81
|
product: "order_detail_id",
|
|
89
82
|
booking: "schedule_event_id",
|
|
@@ -157,15 +150,6 @@ function mergeBaseSalesCollectionItem(kind, currentItem, incomingItem, uidRemaps
|
|
|
157
150
|
return kind === "product" ? mergeBaseSalesProductSnapshotFields(currentItem, mergedItem) : mergedItem;
|
|
158
151
|
}
|
|
159
152
|
function mergeBaseSalesOrderCollection(kind, currentValue, incomingValue, strategy, uidRemaps) {
|
|
160
|
-
if (kind === "payment") {
|
|
161
|
-
return (0, import_payment_utils.mergeOrderPaymentListsByIdentity)(
|
|
162
|
-
currentValue,
|
|
163
|
-
incomingValue,
|
|
164
|
-
strategy === "preserve-local" ? { preserveUnmatchedExisting: true } : {
|
|
165
|
-
preserveUnmatchedExistingWhen: (payment) => (0, import_payment_utils.isIdentifiedPendingOrderPayment)(payment) || !(0, import_orderCollectionIdentity.getOrderCollectionPersistentId)("payment", payment)
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
153
|
const currentItems = (0, import_orderCollectionIdentity.normalizeOrderCollection)(kind, currentValue, {
|
|
170
154
|
ensureUid: false
|
|
171
155
|
}).items;
|
|
@@ -225,35 +209,6 @@ function normalizeBaseSalesRecordCollections(sourceRecord, options) {
|
|
|
225
209
|
}
|
|
226
210
|
return normalizedRecord;
|
|
227
211
|
}
|
|
228
|
-
function getBaseSalesMetadataUid(item, metadataKey) {
|
|
229
|
-
var _a;
|
|
230
|
-
const uid = ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a[metadataKey]) ?? (item == null ? void 0 : item[metadataKey]);
|
|
231
|
-
if (uid === void 0 || uid === null || uid === "")
|
|
232
|
-
return null;
|
|
233
|
-
return String(uid);
|
|
234
|
-
}
|
|
235
|
-
function mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey) {
|
|
236
|
-
const result = [];
|
|
237
|
-
const indexByUid = /* @__PURE__ */ new Map();
|
|
238
|
-
const appendOrReplaceByUid = (item) => {
|
|
239
|
-
const clonedItem = (0, import_lodash_es.cloneDeep)(item);
|
|
240
|
-
const uid = getBaseSalesMetadataUid(clonedItem, metadataKey);
|
|
241
|
-
if (!uid) {
|
|
242
|
-
result.push(clonedItem);
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
const existingIndex = indexByUid.get(uid);
|
|
246
|
-
if (existingIndex !== void 0) {
|
|
247
|
-
result[existingIndex] = clonedItem;
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
indexByUid.set(uid, result.length);
|
|
251
|
-
result.push(clonedItem);
|
|
252
|
-
};
|
|
253
|
-
currentValue.forEach(appendOrReplaceByUid);
|
|
254
|
-
loadedValue.forEach(appendOrReplaceByUid);
|
|
255
|
-
return result;
|
|
256
|
-
}
|
|
257
212
|
function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, strategy) {
|
|
258
213
|
const normalizedLoadedRecord = normalizeBaseSalesRecordCollections(
|
|
259
214
|
loadedRecord || {},
|
|
@@ -282,15 +237,6 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
282
237
|
);
|
|
283
238
|
}
|
|
284
239
|
if (Array.isArray(currentValue) && Array.isArray(loadedValue)) {
|
|
285
|
-
if (key === "payments" || key === "payment") {
|
|
286
|
-
return (0, import_payment_utils.mergeOrderPaymentListsByIdentity)(currentValue, loadedValue, {
|
|
287
|
-
preserveUnmatchedExisting: true
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
const metadataKey = getBaseSalesUniqueArrayMetadataKey(key);
|
|
291
|
-
if (metadataKey) {
|
|
292
|
-
return mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey);
|
|
293
|
-
}
|
|
294
240
|
return [
|
|
295
241
|
...(0, import_lodash_es.cloneDeep)(currentValue),
|
|
296
242
|
...(0, import_lodash_es.cloneDeep)(loadedValue)
|
|
@@ -309,18 +255,6 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
309
255
|
(0, import_orderCollectionIdentity.applyOrderCollectionUidRemaps)(mergedRecord, uidRemaps)
|
|
310
256
|
);
|
|
311
257
|
}
|
|
312
|
-
function filterPendingPaymentsFromLoadedSalesDetail(sourceRecord) {
|
|
313
|
-
if (!sourceRecord || typeof sourceRecord !== "object")
|
|
314
|
-
return sourceRecord;
|
|
315
|
-
const record = { ...sourceRecord };
|
|
316
|
-
if (Array.isArray(sourceRecord.payments)) {
|
|
317
|
-
record.payments = sourceRecord.payments.filter((payment) => !(0, import_payment_utils.isPendingOrderPayment)(payment));
|
|
318
|
-
}
|
|
319
|
-
if (Array.isArray(sourceRecord.payment)) {
|
|
320
|
-
record.payment = sourceRecord.payment.filter((payment) => !(0, import_payment_utils.isPendingOrderPayment)(payment));
|
|
321
|
-
}
|
|
322
|
-
return record;
|
|
323
|
-
}
|
|
324
258
|
var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
325
259
|
constructor(name, version) {
|
|
326
260
|
super(name, version);
|
|
@@ -862,16 +796,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
862
796
|
const coreData = (_f = (_d = (_c = app == null ? void 0 : app.models) == null ? void 0 : _c.getStore) == null ? void 0 : (_e = _d.call(_c)).getDataByModel) == null ? void 0 : _f.call(_e, "core", "core");
|
|
863
797
|
return coreData == null ? void 0 : coreData[key];
|
|
864
798
|
}
|
|
865
|
-
getPaymentNumberDevicePrefixSync() {
|
|
866
|
-
if (!this.appPlugin)
|
|
867
|
-
return "LOCAL";
|
|
868
|
-
return (0, import_payment_number.resolvePaymentNumberDevicePrefixFromDeviceId)((key) => this.getAppData(key));
|
|
869
|
-
}
|
|
870
|
-
getPaymentNumberDevicePrefixAsync() {
|
|
871
|
-
if (!this.appPlugin)
|
|
872
|
-
return Promise.resolve("LOCAL");
|
|
873
|
-
return (0, import_payment_number.resolvePaymentNumberDevicePrefix)((key) => this.getAppData(key));
|
|
874
|
-
}
|
|
875
799
|
syncAppDataToTempOrder(tempOrder) {
|
|
876
800
|
const isPriceIncludeTax = this.getAppData("is_price_include_tax");
|
|
877
801
|
const taxCountryCode = this.getAppData("tax_country_code");
|
|
@@ -909,7 +833,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
909
833
|
return isChanged;
|
|
910
834
|
}
|
|
911
835
|
async initialize(core, options = {}) {
|
|
912
|
-
var _a, _b;
|
|
836
|
+
var _a, _b, _c, _d;
|
|
913
837
|
this.core = core;
|
|
914
838
|
this.initializeOptions = options || {};
|
|
915
839
|
this.otherParams = options.otherParams || {};
|
|
@@ -919,10 +843,9 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
919
843
|
this.request = core.getPlugin("request");
|
|
920
844
|
this.appPlugin = core.getPlugin("app");
|
|
921
845
|
if (!this.appPlugin) {
|
|
922
|
-
throw new Error("Checkout 解决方案需要 app 插件支持");
|
|
923
846
|
}
|
|
924
|
-
const app = this.appPlugin.getApp();
|
|
925
|
-
this.logger = app.logger;
|
|
847
|
+
const app = (_c = (_b = this.appPlugin) == null ? void 0 : _b.getApp) == null ? void 0 : _c.call(_b);
|
|
848
|
+
this.logger = app == null ? void 0 : app.logger;
|
|
926
849
|
const targetCacheData = this.readSessionCacheData();
|
|
927
850
|
const moduleNames = this.getRegisteredModuleNames();
|
|
928
851
|
moduleNames.forEach((step) => {
|
|
@@ -947,7 +870,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
947
870
|
if (this.store.schedule && !this.isScheduleListLoaded(this.store.schedule)) {
|
|
948
871
|
await this.store.schedule.loadAllSchedule();
|
|
949
872
|
}
|
|
950
|
-
if (this.store.order && typeof ((
|
|
873
|
+
if (this.store.order && typeof ((_d = this.otherParams) == null ? void 0 : _d.enableTempOrderPersist) === "boolean") {
|
|
951
874
|
this.store.order.setEnableTempOrderPersist(
|
|
952
875
|
this.otherParams.enableTempOrderPersist
|
|
953
876
|
);
|
|
@@ -1006,16 +929,13 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1006
929
|
const message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || `加载销售详情失败: ${lookup}`;
|
|
1007
930
|
throw new Error(message);
|
|
1008
931
|
}
|
|
1009
|
-
const remoteRecord =
|
|
1010
|
-
preloadedSalesDetail ?? loadedRecord.data
|
|
1011
|
-
);
|
|
932
|
+
const remoteRecord = preloadedSalesDetail ?? loadedRecord.data;
|
|
1012
933
|
const currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
1013
|
-
const
|
|
934
|
+
const record = params.merge ? mergeSalesDetailRecordWithTempOrder(
|
|
1014
935
|
currentTempOrder,
|
|
1015
936
|
remoteRecord,
|
|
1016
937
|
"preserve-local"
|
|
1017
938
|
) : remoteRecord;
|
|
1018
|
-
const record = filterPendingPaymentsFromLoadedSalesDetail(mergedRecord);
|
|
1019
939
|
return await this.hydrateLatestLoadedSalesDetail(record, loadSequence);
|
|
1020
940
|
} finally {
|
|
1021
941
|
this.salesDetailLoadInFlightCount = Math.max(
|
|
@@ -1791,6 +1711,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1791
1711
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1792
1712
|
}
|
|
1793
1713
|
const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
|
|
1714
|
+
const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
|
|
1794
1715
|
const submitParams = {
|
|
1795
1716
|
cacheId: this.cacheId,
|
|
1796
1717
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
@@ -1800,25 +1721,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1800
1721
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
|
|
1801
1722
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1802
1723
|
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1803
|
-
...
|
|
1724
|
+
...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
|
|
1804
1725
|
...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
|
|
1805
1726
|
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1806
1727
|
};
|
|
1807
|
-
return this.store.order.submitTempOrder(submitParams);
|
|
1808
|
-
}
|
|
1809
|
-
async saveSalesOrderDraft(params) {
|
|
1810
|
-
var _a, _b, _c, _d;
|
|
1811
|
-
if (!this.store.order) {
|
|
1812
|
-
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1813
|
-
}
|
|
1814
|
-
return this.store.order.saveTempOrderAsDraft({
|
|
1815
|
-
cacheId: this.cacheId,
|
|
1816
|
-
platform: (params == null ? void 0 : params.platform) ?? ((_a = this.otherParams) == null ? void 0 : _a.platform),
|
|
1817
|
-
businessCode: (params == null ? void 0 : params.businessCode) ?? ((_b = this.otherParams) == null ? void 0 : _b.businessCode) ?? ((_c = this.otherParams) == null ? void 0 : _c.business_code),
|
|
1818
|
-
channel: (params == null ? void 0 : params.channel) ?? this.getSubmitOrderSalesChannel(),
|
|
1819
|
-
type: (params == null ? void 0 : params.type) ?? ((_d = this.otherParams) == null ? void 0 : _d.type),
|
|
1820
|
-
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1821
|
-
});
|
|
1728
|
+
return this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams);
|
|
1822
1729
|
}
|
|
1823
1730
|
async submitTempOrderAsync(params) {
|
|
1824
1731
|
var _a, _b, _c, _d;
|
|
@@ -1826,20 +1733,35 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1826
1733
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1827
1734
|
}
|
|
1828
1735
|
const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
|
|
1736
|
+
const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
|
|
1829
1737
|
const submitParams = {
|
|
1830
1738
|
cacheId: this.cacheId,
|
|
1831
1739
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
1832
1740
|
businessCode: ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code),
|
|
1833
1741
|
channel: this.getSubmitOrderSalesChannel(),
|
|
1834
1742
|
type: (_d = this.otherParams) == null ? void 0 : _d.type,
|
|
1743
|
+
request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
|
|
1835
1744
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1836
1745
|
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1837
|
-
...
|
|
1746
|
+
...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
|
|
1838
1747
|
...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
|
|
1839
1748
|
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1840
1749
|
};
|
|
1841
1750
|
return this.store.order.submitTempOrderAsync(submitParams);
|
|
1842
1751
|
}
|
|
1752
|
+
/**
|
|
1753
|
+
* 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
|
|
1754
|
+
* otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
|
|
1755
|
+
*/
|
|
1756
|
+
shouldUseCheckoutSyncTask() {
|
|
1757
|
+
var _a;
|
|
1758
|
+
const configured = (_a = this.otherParams) == null ? void 0 : _a.checkoutSyncTaskEnabled;
|
|
1759
|
+
return typeof configured === "boolean" ? configured : true;
|
|
1760
|
+
}
|
|
1761
|
+
/** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
|
|
1762
|
+
getDefaultCheckoutSmallTicketDataFlag() {
|
|
1763
|
+
return void 0;
|
|
1764
|
+
}
|
|
1843
1765
|
async printLocalOrderReceipt(lookup) {
|
|
1844
1766
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1845
1767
|
if (!this.store.order) {
|
|
@@ -1899,6 +1821,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1899
1821
|
const channel = params.channel ?? this.getSubmitOrderSalesChannel();
|
|
1900
1822
|
const syncParams = {
|
|
1901
1823
|
...params,
|
|
1824
|
+
checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask(),
|
|
1902
1825
|
...businessCode !== void 0 ? { businessCode } : {},
|
|
1903
1826
|
...channel !== void 0 ? { channel } : {}
|
|
1904
1827
|
};
|
|
@@ -2020,26 +1943,8 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2020
1943
|
}
|
|
2021
1944
|
}
|
|
2022
1945
|
}
|
|
2023
|
-
/**
|
|
2024
|
-
* 同步兼容入口。无法等待 IoT 短号时,按调用当下的 device_id 或 LOCAL 生成。
|
|
2025
|
-
*/
|
|
1946
|
+
/** 追加单个支付项到当前订单。 */
|
|
2026
1947
|
addOrderPayment(payment) {
|
|
2027
|
-
const hasPaymentNumber = String(
|
|
2028
|
-
payment.payment_number || ""
|
|
2029
|
-
).trim() !== "";
|
|
2030
|
-
return this.addOrderPaymentWithDevicePrefix(
|
|
2031
|
-
payment,
|
|
2032
|
-
hasPaymentNumber ? "LOCAL" : this.getPaymentNumberDevicePrefixSync()
|
|
2033
|
-
);
|
|
2034
|
-
}
|
|
2035
|
-
/** 创建新支付项时读取最新设备短号,不缓存运行时设备信息。 */
|
|
2036
|
-
async addOrderPaymentAsync(payment) {
|
|
2037
|
-
const paymentRecord = payment;
|
|
2038
|
-
const hasPaymentNumber = String(paymentRecord.payment_number || "").trim() !== "";
|
|
2039
|
-
const devicePrefix = hasPaymentNumber ? "LOCAL" : await this.getPaymentNumberDevicePrefixAsync();
|
|
2040
|
-
return this.addOrderPaymentWithDevicePrefix(payment, devicePrefix);
|
|
2041
|
-
}
|
|
2042
|
-
addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
|
|
2043
1948
|
var _a;
|
|
2044
1949
|
if (!this.store.order)
|
|
2045
1950
|
throw new Error("order 模块未初始化");
|
|
@@ -2056,26 +1961,21 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2056
1961
|
if (shopWalletPassId !== void 0 && shopWalletPassId !== null) {
|
|
2057
1962
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
2058
1963
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
import_utils.createUuidV4
|
|
2063
|
-
);
|
|
1964
|
+
if (!metadata.unique_payment_number) {
|
|
1965
|
+
metadata.unique_payment_number = (0, import_utils.createUuidV4)();
|
|
1966
|
+
}
|
|
2064
1967
|
const paymentTimestamp = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
2065
1968
|
const paymentTime = paymentRecord.payment_time ?? paymentTimestamp;
|
|
2066
1969
|
const createdAt = paymentRecord.created_at ?? paymentTimestamp;
|
|
2067
1970
|
const serviceCharge = paymentRecord.service_charge && typeof paymentRecord.service_charge === "object" ? paymentRecord.service_charge : null;
|
|
2068
1971
|
const calculatedServiceFee = serviceCharge ? new import_decimal.default(paymentRecord.origin_amount ?? paymentRecord.amount ?? 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : void 0;
|
|
2069
1972
|
const payments = this.store.order.addOrderPayment({
|
|
2070
|
-
...
|
|
1973
|
+
...paymentRecord,
|
|
2071
1974
|
...calculatedServiceFee !== void 0 ? { service_fee: calculatedServiceFee } : {},
|
|
2072
1975
|
metadata,
|
|
2073
1976
|
payment_time: paymentTime,
|
|
2074
1977
|
created_at: createdAt
|
|
2075
1978
|
});
|
|
2076
|
-
if (paymentRecord.status === "payment_pending") {
|
|
2077
|
-
return payments;
|
|
2078
|
-
}
|
|
2079
1979
|
const amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2080
1980
|
const syncState = this.store.order.getOrderSyncState();
|
|
2081
1981
|
if (amountSnapshot) {
|
|
@@ -2097,73 +1997,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2097
1997
|
return payments;
|
|
2098
1998
|
}
|
|
2099
1999
|
/** 更新当前订单中的指定支付项。 */
|
|
2100
|
-
|
|
2101
|
-
var _a, _b, _c;
|
|
2000
|
+
updateOrderPayment(paymentIdentity, updates) {
|
|
2102
2001
|
if (!this.store.order)
|
|
2103
2002
|
throw new Error("order 模块未初始化");
|
|
2104
|
-
|
|
2105
|
-
const previousMatch = (0, import_payment_utils.resolveOrderPaymentIdentity)(
|
|
2106
|
-
this.store.order.getOrderPayments(),
|
|
2107
|
-
paymentIdentity,
|
|
2108
|
-
matchMode
|
|
2109
|
-
);
|
|
2110
|
-
const previousPayment = previousMatch == null ? void 0 : previousMatch.payment;
|
|
2111
|
-
if ((previousPayment == null ? void 0 : previousPayment.status) === "paid" && !options.applyUpdatesWhenPaid) {
|
|
2112
|
-
const currentPayments = this.store.order.getOrderPayments();
|
|
2113
|
-
let syncResult2;
|
|
2114
|
-
if (options.submitWhenPaid && options.forceSubmitIfPaid) {
|
|
2115
|
-
syncResult2 = await this.syncPaymentsToOrder({
|
|
2116
|
-
payments: currentPayments,
|
|
2117
|
-
paymentStatus: this.getPaymentStatusForSync(currentPayments),
|
|
2118
|
-
submitWhenPaid: true,
|
|
2119
|
-
smallTicketDataFlag: options.smallTicketDataFlag ?? 1
|
|
2120
|
-
});
|
|
2121
|
-
}
|
|
2122
|
-
return {
|
|
2123
|
-
updated: false,
|
|
2124
|
-
payment: previousPayment,
|
|
2125
|
-
payments: currentPayments,
|
|
2126
|
-
summary: ((_a = this.store.order.getOrderAmountSnapshot()) == null ? void 0 : _a.summary) || null,
|
|
2127
|
-
...syncResult2 !== void 0 ? { syncResult: syncResult2 } : {}
|
|
2128
|
-
};
|
|
2129
|
-
}
|
|
2130
|
-
const result = await this.store.order.updateOrderPayment(paymentIdentity, updates, {
|
|
2131
|
-
matchBy: matchMode
|
|
2132
|
-
});
|
|
2133
|
-
let draftResult;
|
|
2134
|
-
let draftError;
|
|
2135
|
-
if (options.persistDraft !== false) {
|
|
2136
|
-
try {
|
|
2137
|
-
draftResult = await this.saveSalesOrderDraft();
|
|
2138
|
-
} catch (error) {
|
|
2139
|
-
draftError = error;
|
|
2140
|
-
this.logError("updateOrderPayment: 保存支付草稿失败", {
|
|
2141
|
-
paymentIdentity,
|
|
2142
|
-
error: error instanceof Error ? error.message : String(error)
|
|
2143
|
-
});
|
|
2144
|
-
if (!options.submitWhenPaid)
|
|
2145
|
-
throw error;
|
|
2146
|
-
}
|
|
2147
|
-
}
|
|
2148
|
-
const becamePaid = (previousPayment == null ? void 0 : previousPayment.status) !== "paid" && ((_b = result.payment) == null ? void 0 : _b.status) === "paid";
|
|
2149
|
-
const shouldSubmit = Boolean(
|
|
2150
|
-
options.submitWhenPaid && ((_c = result.payment) == null ? void 0 : _c.status) === "paid" && (becamePaid || options.forceSubmitIfPaid)
|
|
2151
|
-
);
|
|
2152
|
-
let syncResult;
|
|
2153
|
-
if (shouldSubmit) {
|
|
2154
|
-
syncResult = await this.syncPaymentsToOrder({
|
|
2155
|
-
payments: result.payments,
|
|
2156
|
-
paymentStatus: this.getPaymentStatusForSync(result.payments),
|
|
2157
|
-
submitWhenPaid: true,
|
|
2158
|
-
smallTicketDataFlag: options.smallTicketDataFlag ?? 1
|
|
2159
|
-
});
|
|
2160
|
-
}
|
|
2161
|
-
return {
|
|
2162
|
-
...result,
|
|
2163
|
-
...draftResult !== void 0 ? { draftResult } : {},
|
|
2164
|
-
...draftError !== void 0 ? { draftError } : {},
|
|
2165
|
-
...syncResult !== void 0 ? { syncResult } : {}
|
|
2166
|
-
};
|
|
2003
|
+
return this.store.order.updateOrderPayment(paymentIdentity, updates);
|
|
2167
2004
|
}
|
|
2168
2005
|
/** 删除当前订单中的指定支付项。 */
|
|
2169
2006
|
deleteOrderPayment(paymentIdentity) {
|
|
@@ -2177,11 +2014,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2177
2014
|
throw new Error("order 模块未初始化");
|
|
2178
2015
|
return this.store.order.updateVoucherOrderPayments(payments, options);
|
|
2179
2016
|
}
|
|
2180
|
-
async updateVoucherOrderPaymentsAsync(payments, options) {
|
|
2181
|
-
if (!this.store.order)
|
|
2182
|
-
throw new Error("order 模块未初始化");
|
|
2183
|
-
return this.store.order.updateVoucherOrderPaymentsAsync(payments, options);
|
|
2184
|
-
}
|
|
2185
2017
|
confirmPendingVoucherPayments() {
|
|
2186
2018
|
if (!this.store.order)
|
|
2187
2019
|
throw new Error("order 模块未初始化");
|
|
@@ -82,13 +82,8 @@ export interface ISalesBooking {
|
|
|
82
82
|
metadata?: Record<string, any> | null;
|
|
83
83
|
[key: string]: any;
|
|
84
84
|
}
|
|
85
|
-
export interface ISalesPaymentMetadata extends Record<string, any> {
|
|
86
|
-
/** 刷卡机设备快照;OS 不解析内部字段 */
|
|
87
|
-
card_reader_snapshot?: Record<string, unknown>;
|
|
88
|
-
}
|
|
89
85
|
export interface ISalesPayment {
|
|
90
86
|
order_payment_id?: number | null;
|
|
91
|
-
payment_number?: string;
|
|
92
87
|
custom_payment_id?: number;
|
|
93
88
|
code?: string;
|
|
94
89
|
name?: string;
|
|
@@ -100,7 +95,7 @@ export interface ISalesPayment {
|
|
|
100
95
|
status?: string;
|
|
101
96
|
payment_time?: string | null;
|
|
102
97
|
service_charge?: Record<string, any> | null;
|
|
103
|
-
metadata?:
|
|
98
|
+
metadata?: Record<string, any> | null;
|
|
104
99
|
[key: string]: any;
|
|
105
100
|
}
|
|
106
101
|
export interface ISalesSurcharge {
|
|
@@ -10,6 +10,7 @@ import { ITime } from '../../modules/Date/types';
|
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
12
12
|
import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
|
|
13
|
+
import { IAppendFormRecordParams } from '../../modules/Holder/types';
|
|
13
14
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
14
15
|
protected defaultName: string;
|
|
15
16
|
protected defaultVersion: string;
|
|
@@ -126,6 +127,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
126
127
|
* @param params
|
|
127
128
|
*/
|
|
128
129
|
fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* 获取 holder 表单 map
|
|
132
|
+
*/
|
|
133
|
+
getHolderFormMap(): import("../../modules").HolderFormMap;
|
|
134
|
+
/**
|
|
135
|
+
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
136
|
+
*/
|
|
137
|
+
refreshAllHolderFormRecords(params?: {
|
|
138
|
+
customer_id?: number;
|
|
139
|
+
}): Promise<import("../../modules").HolderFormMap>;
|
|
140
|
+
/**
|
|
141
|
+
* 添加表单记录
|
|
142
|
+
*/
|
|
143
|
+
appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
|
|
129
144
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
130
145
|
clearDateRange(): void;
|
|
131
146
|
getDateRange(): Promise<ITime[]>;
|
|
@@ -302,7 +317,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
317
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
318
|
errorList: any[];
|
|
304
319
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
320
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
321
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
322
|
resources_code: string;
|
|
308
323
|
startDate: string;
|
|
@@ -311,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
326
|
date: string;
|
|
312
327
|
status: string;
|
|
313
328
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
329
|
+
weekNum: 0 | 1 | 5 | 2 | 4 | 3 | 6;
|
|
315
330
|
}[]>;
|
|
316
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
332
|
private getScheduleDataByIds;
|