@pisell/pisellos 2.3.44 → 2.3.45
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/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +2 -4
- package/dist/modules/Order/index.js +25 -54
- package/dist/modules/Order/types.d.ts +0 -9
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.js +13 -47
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +0 -14
- package/dist/server/index.js +657 -772
- package/dist/solution/BaseSales/index.d.ts +0 -7
- package/dist/solution/BaseSales/index.js +42 -64
- package/dist/solution/BookingByStep/index.d.ts +1 -16
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +2 -14
- package/dist/solution/BookingTicket/index.js +2 -2
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +739 -1142
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +841 -1167
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +2 -4
- package/lib/modules/Order/index.js +10 -26
- package/lib/modules/Order/types.d.ts +0 -9
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.js +16 -33
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +0 -14
- package/lib/server/index.js +5 -65
- package/lib/solution/BaseSales/index.d.ts +0 -7
- package/lib/solution/BaseSales/index.js +8 -24
- package/lib/solution/BookingByStep/index.d.ts +1 -16
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +2 -14
- package/lib/solution/BookingTicket/index.js +2 -10
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +182 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +110 -322
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1891
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1084
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OrderModule, ProductList, SalesSummaryModule, ScanOrderLogInput, ScanOrderLoggerModule, ScanOrderLoggerProviderConfig, ScanOrderLoggerProviderType, DateModule, ScheduleModule, QuotationModule, OpenDataModule } from '../../modules';
|
|
2
2
|
import type { QuantityCheckResult, QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
3
|
-
import { HolderModule } from '../../modules/Holder';
|
|
4
3
|
export type { ScanOrderOrderProductIdentity, ScanOrderOrderProduct, ScanOrderSubmitProduct, ScanOrderSummary, ScanOrderTempOrder, ScanOrderSubmitPayload, } from '../ScanOrder/types';
|
|
5
4
|
export declare enum VenueBookingHooks {
|
|
6
5
|
onInited = "venueBooking:onInited",
|
|
@@ -97,7 +96,6 @@ export interface VenueResourceRawData {
|
|
|
97
96
|
export interface ResourceProductMapping {
|
|
98
97
|
productId: number;
|
|
99
98
|
productTitle: string;
|
|
100
|
-
formName?: string;
|
|
101
99
|
resourceName: string;
|
|
102
100
|
formId: number | string;
|
|
103
101
|
price: string;
|
|
@@ -146,7 +144,6 @@ export interface VenueBookingState {
|
|
|
146
144
|
passed: boolean | null;
|
|
147
145
|
failures: QuantityCheckResult[];
|
|
148
146
|
};
|
|
149
|
-
holder?: HolderModule;
|
|
150
147
|
}
|
|
151
148
|
export interface VenueBookingLoggerRuntimeConfig {
|
|
152
149
|
provider?: ScanOrderLoggerProviderType;
|
|
@@ -12,6 +12,10 @@ export declare function buildPriceBreakdown(params: {
|
|
|
12
12
|
}) => number;
|
|
13
13
|
};
|
|
14
14
|
}): PriceBreakdownEntry[];
|
|
15
|
+
export declare function buildVenueResourceMetadata(params: {
|
|
16
|
+
mapping: ResourceProductMapping;
|
|
17
|
+
rawResource: VenueResourceRawData | undefined;
|
|
18
|
+
}): Record<string, any>;
|
|
15
19
|
export interface BuildVenueBookingParams {
|
|
16
20
|
group: MergedSlotGroup;
|
|
17
21
|
resourceId: number | string;
|
|
@@ -25,10 +29,6 @@ export interface BuildVenueBookingParams {
|
|
|
25
29
|
*/
|
|
26
30
|
childResources?: VenueResourceRawData[];
|
|
27
31
|
}
|
|
28
|
-
export declare function buildVenueResourceMetadata(params: {
|
|
29
|
-
mapping: ResourceProductMapping;
|
|
30
|
-
rawResource: VenueResourceRawData | undefined;
|
|
31
|
-
}): Record<string, any>;
|
|
32
32
|
export declare function buildVenueBookingEntry(params: BuildVenueBookingParams): Record<string, any>;
|
|
33
33
|
/**
|
|
34
34
|
* 从一条已合并的订单商品还原出独立的时段列表。
|
|
@@ -90,15 +90,13 @@ export function buildPriceBreakdown(params) {
|
|
|
90
90
|
return entries;
|
|
91
91
|
}
|
|
92
92
|
export function buildVenueResourceMetadata(params) {
|
|
93
|
-
var
|
|
93
|
+
var _rawResource$form_nam, _ref, _rawResource$main_fie, _rawResource$combined;
|
|
94
94
|
var mapping = params.mapping,
|
|
95
95
|
rawResource = params.rawResource;
|
|
96
|
-
var combined = rawResource === null || rawResource === void 0 ? void 0 : rawResource.combined_resource;
|
|
97
|
-
var isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
|
|
98
96
|
return {
|
|
99
|
-
form_name: (
|
|
100
|
-
resource_name: (_rawResource$main_fie = rawResource === null || rawResource === void 0 ? void 0 : rawResource.main_field) !== null && _rawResource$main_fie !== void 0 ? _rawResource$main_fie : mapping.resourceName,
|
|
101
|
-
combined_resource:
|
|
97
|
+
form_name: (_rawResource$form_nam = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_name) !== null && _rawResource$form_nam !== void 0 ? _rawResource$form_nam : '',
|
|
98
|
+
resource_name: (_ref = (_rawResource$main_fie = rawResource === null || rawResource === void 0 ? void 0 : rawResource.main_field) !== null && _rawResource$main_fie !== void 0 ? _rawResource$main_fie : mapping.resourceName) !== null && _ref !== void 0 ? _ref : '',
|
|
99
|
+
combined_resource: (_rawResource$combined = rawResource === null || rawResource === void 0 ? void 0 : rawResource.combined_resource) !== null && _rawResource$combined !== void 0 ? _rawResource$combined : null
|
|
102
100
|
};
|
|
103
101
|
}
|
|
104
102
|
export function buildVenueBookingEntry(params) {
|
|
@@ -121,10 +119,7 @@ export function buildVenueBookingEntry(params) {
|
|
|
121
119
|
form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
|
|
122
120
|
relation_id: resourceId,
|
|
123
121
|
capacity: 1,
|
|
124
|
-
metadata:
|
|
125
|
-
mapping: mapping,
|
|
126
|
-
rawResource: rawResource
|
|
127
|
-
})
|
|
122
|
+
metadata: {}
|
|
128
123
|
};
|
|
129
124
|
if (childResources && childResources.length) {
|
|
130
125
|
resourceEntry.children = childResources.map(function (child) {
|
package/dist/solution/index.d.ts
CHANGED
package/dist/solution/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -32,7 +32,6 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
32
32
|
customerId?: number;
|
|
33
33
|
orderId?: number;
|
|
34
34
|
}): Promise<DiscountWithReason>;
|
|
35
|
-
batchSearchByProductIds(productIds: number[]): Promise<any>;
|
|
36
35
|
filterEnabledDiscountList(discountList: Discount[]): Discount[];
|
|
37
36
|
private checkUsageCreditsLimit;
|
|
38
37
|
filterEnabledDiscountListWithReason(discountList: Discount[]): DiscountWithReason;
|
|
@@ -147,15 +147,6 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
147
147
|
const resultDiscountWithReason = this.filterEnabledDiscountListWithReason((result == null ? void 0 : result.data) || []) || [];
|
|
148
148
|
return resultDiscountWithReason;
|
|
149
149
|
}
|
|
150
|
-
async batchSearchByProductIds(productIds) {
|
|
151
|
-
const result = await this.request.get(`/machinecode/batch-search`, {
|
|
152
|
-
ids: productIds,
|
|
153
|
-
translate_flag: 1,
|
|
154
|
-
tags: ["good_pass", "product_discount_card"],
|
|
155
|
-
relation_product: 1
|
|
156
|
-
});
|
|
157
|
-
return (result == null ? void 0 : result.data) || [];
|
|
158
|
-
}
|
|
159
150
|
filterEnabledDiscountList(discountList) {
|
|
160
151
|
return discountList.filter(
|
|
161
152
|
(discount) => discount.limit_status === "enable" && new import_decimal.default((discount == null ? void 0 : discount.par_value) || 0).minus(new import_decimal.default((discount == null ? void 0 : discount.used_par_value) || 0)).greaterThan(0) && this.checkUsageCreditsLimit(discount)
|
|
@@ -73,7 +73,7 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
|
|
|
73
73
|
}
|
|
74
74
|
async fetchOpenData(params) {
|
|
75
75
|
var _a, _b;
|
|
76
|
-
const getData = (_b = (_a = this.appPlugin)
|
|
76
|
+
const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
|
|
77
77
|
const shopId = getData == null ? void 0 : getData("shop_id");
|
|
78
78
|
if (!shopId)
|
|
79
79
|
throw new Error("[OpenDataModule] 无法获取 shop_id");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams
|
|
3
|
+
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
6
|
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
|
|
@@ -147,7 +147,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
147
147
|
isTempOrderPersistEnabled(): boolean;
|
|
148
148
|
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化;草稿保存请使用 IndexedDB saveDraft。 */
|
|
149
149
|
persistTempOrder(): void;
|
|
150
|
-
notifyTempOrderChanged(): void;
|
|
151
150
|
private createDefaultTempOrderInstance;
|
|
152
151
|
private createExternalSaleNumber;
|
|
153
152
|
private ensureExternalSaleNumber;
|
|
@@ -487,7 +486,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
487
486
|
generateIdempotencyToken(): string;
|
|
488
487
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
489
488
|
createOrder(params: CommitOrderParams['query']): {
|
|
490
|
-
type: "
|
|
489
|
+
type: "appointment_booking" | "virtual";
|
|
491
490
|
platform: string;
|
|
492
491
|
sales_channel: string;
|
|
493
492
|
order_sales_channel: string;
|
|
@@ -497,7 +496,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
497
496
|
is_deposit: number;
|
|
498
497
|
relation_products: any[];
|
|
499
498
|
relation_forms: any[];
|
|
500
|
-
business_code: string | undefined;
|
|
501
499
|
};
|
|
502
500
|
checkBeforeSubmitOrder(params: {
|
|
503
501
|
cartItems: CartItem[];
|
|
@@ -328,7 +328,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
async initialize(core, options) {
|
|
331
|
-
var _a, _b, _c
|
|
331
|
+
var _a, _b, _c;
|
|
332
332
|
this.core = core;
|
|
333
333
|
this.store = options.store;
|
|
334
334
|
if (!this.store.tempOrder) {
|
|
@@ -341,19 +341,19 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
341
341
|
this.store.availableWalletIds = [];
|
|
342
342
|
}
|
|
343
343
|
this.request = this.core.getPlugin("request");
|
|
344
|
-
|
|
345
|
-
if (!appPlugin) {
|
|
346
|
-
|
|
344
|
+
this.appPlugin = this.core.getPlugin("app");
|
|
345
|
+
if (!this.appPlugin) {
|
|
346
|
+
throw new Error("Order 模块需要 app 插件支持");
|
|
347
347
|
}
|
|
348
|
-
const app =
|
|
349
|
-
this.logger = app
|
|
348
|
+
const app = this.appPlugin.getApp();
|
|
349
|
+
this.logger = app.logger;
|
|
350
350
|
this.window = this.core.getPlugin("window");
|
|
351
351
|
const otherParams = options.otherParams || {};
|
|
352
352
|
this.cacheId = otherParams.cacheId;
|
|
353
353
|
this.salesSummaryModuleName = otherParams.salesSummaryModuleName;
|
|
354
|
-
this.rulesHooksOverride = (
|
|
354
|
+
this.rulesHooksOverride = (_a = otherParams.rules) == null ? void 0 : _a.hooks;
|
|
355
355
|
this.moduleHooksOverride = options.hooks;
|
|
356
|
-
this.orderHooks = this.moduleHooksOverride || ((
|
|
356
|
+
this.orderHooks = this.moduleHooksOverride || ((_b = otherParams.order) == null ? void 0 : _b.hooks) || ((_c = otherParams.hooks) == null ? void 0 : _c.order);
|
|
357
357
|
this.otherParams = otherParams;
|
|
358
358
|
this.registerDiscountModules(options);
|
|
359
359
|
this.logInfo("OrderModule initialized successfully");
|
|
@@ -880,16 +880,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
880
880
|
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化;草稿保存请使用 IndexedDB saveDraft。 */
|
|
881
881
|
persistTempOrder() {
|
|
882
882
|
}
|
|
883
|
-
notifyTempOrderChanged() {
|
|
884
|
-
if (!this.store.tempOrder)
|
|
885
|
-
return;
|
|
886
|
-
this.store.tempOrder = {
|
|
887
|
-
...this.store.tempOrder,
|
|
888
|
-
products: [...this.store.tempOrder.products],
|
|
889
|
-
bookings: this.store.tempOrder.bookings ? [...this.store.tempOrder.bookings] : []
|
|
890
|
-
};
|
|
891
|
-
this.persistTempOrder();
|
|
892
|
-
}
|
|
893
883
|
// ─── TempOrder: 创建 & 获取 ───
|
|
894
884
|
createDefaultTempOrderInstance() {
|
|
895
885
|
return (0, import_utils.createDefaultTempOrder)({
|
|
@@ -3928,7 +3918,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3928
3918
|
tempOrder,
|
|
3929
3919
|
effectivePayments
|
|
3930
3920
|
);
|
|
3931
|
-
const
|
|
3921
|
+
const submitResult = await this.submitTempOrder({
|
|
3932
3922
|
payments: effectivePayments,
|
|
3933
3923
|
paymentStatus,
|
|
3934
3924
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
@@ -3942,8 +3932,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3942
3932
|
};
|
|
3943
3933
|
return nextPayload;
|
|
3944
3934
|
}
|
|
3945
|
-
};
|
|
3946
|
-
const submitResult = params.checkoutSyncTaskEnabled === false ? await this.submitTempOrderAsync(submitParams) : await this.submitTempOrder(submitParams);
|
|
3935
|
+
});
|
|
3947
3936
|
return { ...completion, submitResult };
|
|
3948
3937
|
}
|
|
3949
3938
|
createOrder(params) {
|
|
@@ -3960,13 +3949,11 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3960
3949
|
is_deposit: 0,
|
|
3961
3950
|
relation_products: [],
|
|
3962
3951
|
relation_forms: [],
|
|
3963
|
-
business_code: params == null ? void 0 : params.business_code,
|
|
3964
3952
|
...(params == null ? void 0 : params.extraData) || {}
|
|
3965
3953
|
};
|
|
3966
3954
|
let is_deposit = 0;
|
|
3967
3955
|
if (params.cartItems.length > 0) {
|
|
3968
3956
|
params.cartItems.forEach((item) => {
|
|
3969
|
-
var _a2;
|
|
3970
3957
|
if (!item._origin.duration) {
|
|
3971
3958
|
const { duration, durationType } = (0, import_utils.generateDuration)(item);
|
|
3972
3959
|
item._origin.duration = duration;
|
|
@@ -3975,9 +3962,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3975
3962
|
item._origin.sub_type = (0, import_utils.normalizeBookingSubType)(item._origin);
|
|
3976
3963
|
const discountList = (0, import_utils.getAllDiscountList)(item);
|
|
3977
3964
|
item._origin.product.discount_list = discountList;
|
|
3978
|
-
if ((_a2 = params == null ? void 0 : params.extraData) == null ? void 0 : _a2.is_add_holder_info) {
|
|
3979
|
-
(0, import_utils.ensureCartItemOriginHolder)(item, this.window);
|
|
3980
|
-
}
|
|
3981
3965
|
if ((0, import_utils2.isNormalProduct)(item._origin)) {
|
|
3982
3966
|
order.relation_products.push(item._origin.product);
|
|
3983
3967
|
const relationForms = item._origin.relation_forms || [];
|
|
@@ -396,7 +396,6 @@ export interface CommitOrderParams {
|
|
|
396
396
|
type: 'virtual' | 'appointment_booking';
|
|
397
397
|
platform?: string;
|
|
398
398
|
extraData?: Record<string, any>;
|
|
399
|
-
business_code?: string;
|
|
400
399
|
};
|
|
401
400
|
}
|
|
402
401
|
export interface OrderSubmitBooking {
|
|
@@ -572,12 +571,6 @@ export interface SyncPaymentsToOrderParams {
|
|
|
572
571
|
payments: OrderPaymentSource[];
|
|
573
572
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
574
573
|
submitWhenPaid?: boolean;
|
|
575
|
-
/**
|
|
576
|
-
* Whether the checkout should be queued as the local `sync_sales` task.
|
|
577
|
-
* Defaults to true to preserve the WebPOS retry path. Set to false when
|
|
578
|
-
* the caller must wait for the cloud checkout response before proceeding.
|
|
579
|
-
*/
|
|
580
|
-
checkoutSyncTaskEnabled?: boolean;
|
|
581
574
|
smallTicketDataFlag?: number;
|
|
582
575
|
businessCode?: string;
|
|
583
576
|
channel?: string;
|
|
@@ -740,8 +733,6 @@ export interface OrderModuleAPI {
|
|
|
740
733
|
setEnableTempOrderPersist: (enabled: boolean) => void;
|
|
741
734
|
/** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
|
|
742
735
|
isTempOrderPersistEnabled: () => boolean;
|
|
743
|
-
/** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
|
|
744
|
-
notifyTempOrderChanged: () => void;
|
|
745
736
|
submitTempOrder: <T = any>(params?: {
|
|
746
737
|
cacheId?: string;
|
|
747
738
|
platform?: string;
|
|
@@ -15,7 +15,6 @@ export interface OrderProductsDepositSummary {
|
|
|
15
15
|
deposit_policy_ids: number[];
|
|
16
16
|
hasDeposit: boolean;
|
|
17
17
|
}
|
|
18
|
-
import type { WindowPlugin } from '../../plugins';
|
|
19
18
|
/**
|
|
20
19
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
21
20
|
*
|
|
@@ -178,15 +177,6 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
178
177
|
form_id: number;
|
|
179
178
|
form_record_ids: number[];
|
|
180
179
|
}[];
|
|
181
|
-
export interface CartOrderHolder {
|
|
182
|
-
customer_id?: number;
|
|
183
|
-
form_id: number | string;
|
|
184
|
-
form_record: (number | string)[] | null;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
188
|
-
*/
|
|
189
|
-
export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
|
|
190
180
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
191
181
|
export { createUuidV4 };
|
|
192
182
|
export declare function isTempOrder(data: any): data is OrderTempOrder;
|
|
@@ -36,9 +36,8 @@ __export(utils_exports, {
|
|
|
36
36
|
composeLinePrice: () => composeLinePrice,
|
|
37
37
|
createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
|
|
38
38
|
createDefaultTempOrder: () => createDefaultTempOrder,
|
|
39
|
-
createEmptySummary: () =>
|
|
39
|
+
createEmptySummary: () => import_utils2.createEmptySummary,
|
|
40
40
|
createUuidV4: () => import_orderCollectionIdentity.createUuidV4,
|
|
41
|
-
ensureCartItemOriginHolder: () => ensureCartItemOriginHolder,
|
|
42
41
|
ensureManualProductDiscountList: () => import_manualProductDiscount.ensureManualProductDiscountList,
|
|
43
42
|
ensureProductSku: () => ensureProductSku,
|
|
44
43
|
findManualProductDiscountItem: () => import_manualProductDiscount.findManualProductDiscountItem,
|
|
@@ -86,10 +85,9 @@ __export(utils_exports, {
|
|
|
86
85
|
module.exports = __toCommonJS(utils_exports);
|
|
87
86
|
var import_dayjs = __toESM(require("dayjs"));
|
|
88
87
|
var import_decimal = __toESM(require("decimal.js"));
|
|
89
|
-
var import_utils = require("
|
|
90
|
-
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
88
|
+
var import_utils = require("../../solution/ScanOrder/utils");
|
|
91
89
|
var import_orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
92
|
-
var
|
|
90
|
+
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
93
91
|
var import_manualProductDiscount = require("./utils/manualProductDiscount");
|
|
94
92
|
function composeLinePrice(params) {
|
|
95
93
|
const { mainPrice, bundle, useOriginalBundle } = params;
|
|
@@ -548,7 +546,7 @@ function createDefaultOrderRulesHooks() {
|
|
|
548
546
|
// 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
|
|
549
547
|
// 不透明 identity 契约下,normalizeOrderProduct / hydrate 已保证唯一值存在;
|
|
550
548
|
// 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
|
|
551
|
-
_id: ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? `${product.product_id}_${product.product_variant_id}_${product.metadata.unique_identification_number}` : `${product.product_id}_${product.product_variant_id}_${(0,
|
|
549
|
+
_id: ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? `${product.product_id}_${product.product_variant_id}_${product.metadata.unique_identification_number}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils.buildProductLineFingerprint)(
|
|
552
550
|
getProductSkuOptions(product),
|
|
553
551
|
product.product_bundle
|
|
554
552
|
)}`,
|
|
@@ -640,34 +638,6 @@ var mergeRelationForms = (relationForms) => {
|
|
|
640
638
|
}, {})
|
|
641
639
|
).filter((item) => item.form_record_ids.length > 0);
|
|
642
640
|
};
|
|
643
|
-
function getCustomerIdFromStorage(window) {
|
|
644
|
-
var _a;
|
|
645
|
-
try {
|
|
646
|
-
const customer = JSON.parse(((_a = window == null ? void 0 : window.getLocalStorage) == null ? void 0 : _a.call(window, "customer")) || "{}");
|
|
647
|
-
const customerId = Number(customer == null ? void 0 : customer.id);
|
|
648
|
-
return Number.isFinite(customerId) && customerId > 0 ? customerId : void 0;
|
|
649
|
-
} catch {
|
|
650
|
-
return void 0;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
function ensureCartItemOriginHolder(cartItem, window) {
|
|
654
|
-
var _a;
|
|
655
|
-
if ((_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.holder) {
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
const holderConfig = (0, import_utils.getProductHolderConfig)(
|
|
659
|
-
(cartItem == null ? void 0 : cartItem._productInit) ?? (cartItem == null ? void 0 : cartItem._productOrigin)
|
|
660
|
-
);
|
|
661
|
-
const formRecordId = cartItem == null ? void 0 : cartItem.holder_id;
|
|
662
|
-
if (!(holderConfig == null ? void 0 : holderConfig.resource_id) || formRecordId == null) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
cartItem._origin.holder = {
|
|
666
|
-
customer_id: getCustomerIdFromStorage(window),
|
|
667
|
-
form_id: holderConfig.resource_id,
|
|
668
|
-
form_record: [formRecordId]
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
641
|
var getAllDiscountList = (cartItem) => {
|
|
672
642
|
var _a, _b, _c, _d;
|
|
673
643
|
let discountList = ((_b = (_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.product) == null ? void 0 : _b.discount_list) || [];
|
|
@@ -1033,7 +1003,7 @@ function buildSubmitPayload(params) {
|
|
|
1033
1003
|
// contacts: tempOrder.contacts || [],
|
|
1034
1004
|
contacts_info: tempOrder.contacts_info && !Array.isArray(tempOrder.contacts_info) ? tempOrder.contacts_info : null,
|
|
1035
1005
|
// holder: tempOrder.holder || null,
|
|
1036
|
-
summary: summary || tempOrder.summary || (0,
|
|
1006
|
+
summary: summary || tempOrder.summary || (0, import_utils.createEmptySummary)(),
|
|
1037
1007
|
metadata: (() => {
|
|
1038
1008
|
const {
|
|
1039
1009
|
collect_pax: _collectPax,
|
|
@@ -1282,7 +1252,6 @@ function indexOrderProductsByUid(products) {
|
|
|
1282
1252
|
createDefaultTempOrder,
|
|
1283
1253
|
createEmptySummary,
|
|
1284
1254
|
createUuidV4,
|
|
1285
|
-
ensureCartItemOriginHolder,
|
|
1286
1255
|
ensureManualProductDiscountList,
|
|
1287
1256
|
ensureProductSku,
|
|
1288
1257
|
findManualProductDiscountItem,
|
|
@@ -106,48 +106,39 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
106
106
|
} catch (error) {
|
|
107
107
|
console.error(error);
|
|
108
108
|
}
|
|
109
|
-
const channelMap = {
|
|
110
|
-
online_store: "online-store",
|
|
111
|
-
scan_to_order: "online-store",
|
|
112
|
-
"scan-to-order": "online-store",
|
|
113
|
-
scan_to_order_2: "mobile_order",
|
|
114
|
-
scan_to_order_3: "scantoorder3"
|
|
115
|
-
};
|
|
116
|
-
const rawApplicationCode = (_b = this.otherParams) == null ? void 0 : _b.channel;
|
|
117
|
-
const mappedApplicationCode = typeof rawApplicationCode === "string" ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
|
|
118
|
-
const queryPayload = {
|
|
119
|
-
open_quotation: 1,
|
|
120
|
-
open_bundle: 0,
|
|
121
|
-
exclude_extension_type: [
|
|
122
|
-
"product_party",
|
|
123
|
-
"product_event",
|
|
124
|
-
"product_series_event",
|
|
125
|
-
"product_package_ticket",
|
|
126
|
-
"ticket",
|
|
127
|
-
"event_item"
|
|
128
|
-
],
|
|
129
|
-
with: ["category", "collection", "resourceRelation"],
|
|
130
|
-
status,
|
|
131
|
-
num: 500,
|
|
132
|
-
skip: 1,
|
|
133
|
-
customer_id,
|
|
134
|
-
...Array.isArray(category_ids) && category_ids.length ? { category_ids } : {},
|
|
135
|
-
...Array.isArray(product_ids) && product_ids.length ? { ids: product_ids } : {},
|
|
136
|
-
...Array.isArray(collection) && collection.length ? { collection } : {},
|
|
137
|
-
front_end_cache_id: cacheId,
|
|
138
|
-
...Array.isArray(menu_list_ids) && menu_list_ids.length ? { menu_list_ids } : {},
|
|
139
|
-
with_count,
|
|
140
|
-
// client_schedule_ids: schedule_ids,
|
|
141
|
-
schedule_date,
|
|
142
|
-
application_code: mappedApplicationCode,
|
|
143
|
-
is_eject: 1,
|
|
144
|
-
with_schedule,
|
|
145
|
-
schedule_datetime,
|
|
146
|
-
extension_type
|
|
147
|
-
};
|
|
148
109
|
const productsData = await this.request.post(
|
|
149
110
|
`/product/query`,
|
|
150
|
-
|
|
111
|
+
{
|
|
112
|
+
open_quotation: 1,
|
|
113
|
+
open_bundle: 0,
|
|
114
|
+
exclude_extension_type: [
|
|
115
|
+
"product_party",
|
|
116
|
+
"product_event",
|
|
117
|
+
"product_series_event",
|
|
118
|
+
"product_package_ticket",
|
|
119
|
+
"ticket",
|
|
120
|
+
"event_item"
|
|
121
|
+
],
|
|
122
|
+
with: ["category", "collection", "resourceRelation"],
|
|
123
|
+
status,
|
|
124
|
+
num: 500,
|
|
125
|
+
skip: 1,
|
|
126
|
+
customer_id,
|
|
127
|
+
category_ids,
|
|
128
|
+
ids: product_ids,
|
|
129
|
+
collection,
|
|
130
|
+
front_end_cache_id: cacheId,
|
|
131
|
+
menu_list_ids,
|
|
132
|
+
with_count,
|
|
133
|
+
// client_schedule_ids: schedule_ids,
|
|
134
|
+
schedule_date,
|
|
135
|
+
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel,
|
|
136
|
+
is_eject: 1,
|
|
137
|
+
with_schedule,
|
|
138
|
+
schedule_datetime,
|
|
139
|
+
extension_type,
|
|
140
|
+
strategy_context
|
|
141
|
+
},
|
|
151
142
|
{ osServer: true, callback: options == null ? void 0 : options.callback, subscriberId: options == null ? void 0 : options.subscriberId, customToast: () => {
|
|
152
143
|
} }
|
|
153
144
|
);
|
|
@@ -21,7 +21,7 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
21
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
22
22
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
23
23
|
*
|
|
24
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
24
|
+
* Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
|
|
25
25
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
26
26
|
* the requested productId wins.
|
|
27
27
|
*/
|
|
@@ -52,7 +52,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
52
52
|
{ useCache: false, osServer: true }
|
|
53
53
|
);
|
|
54
54
|
const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
|
|
55
|
-
list.sort((a, b) =>
|
|
55
|
+
list.sort((a, b) => a.sort - b.sort);
|
|
56
56
|
this.store.list = list;
|
|
57
57
|
}
|
|
58
58
|
getQuotationList() {
|
|
@@ -96,7 +96,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
|
96
96
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
97
97
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
98
98
|
*
|
|
99
|
-
* Priority: iterates quotations already sorted by `sort`
|
|
99
|
+
* Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
|
|
100
100
|
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
101
101
|
* the requested productId wins.
|
|
102
102
|
*/
|