@pisell/pisellos 2.2.171 → 2.2.173
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 +9 -0
- package/dist/modules/BookingContext/index.d.ts +37 -0
- package/dist/modules/BookingContext/index.js +436 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +193 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +215 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Customer/index.d.ts +6 -0
- package/dist/modules/Customer/index.js +129 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -4
- package/dist/modules/Discount/index.js +8 -93
- package/dist/modules/Discount/types.d.ts +1 -7
- package/dist/modules/Order/index.d.ts +33 -17
- package/dist/modules/Order/index.js +757 -395
- package/dist/modules/Order/types.d.ts +58 -17
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +212 -0
- package/dist/modules/Order/utils.d.ts +39 -1
- package/dist/modules/Order/utils.js +219 -31
- package/dist/modules/Quotation/index.js +16 -5
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +26 -10
- package/dist/modules/SalesSummary/index.js +4 -2
- package/dist/modules/Schedule/index.js +6 -2
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/server/index.js +10 -6
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/server/modules/products/index.js +113 -94
- package/dist/server/modules/schedule/index.js +13 -6
- package/dist/solution/BaseSales/index.d.ts +53 -7
- package/dist/solution/BaseSales/index.js +1160 -339
- package/dist/solution/BaseSales/types.d.ts +67 -1
- package/dist/solution/BaseSales/types.js +3 -1
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +65 -15
- package/dist/solution/BaseSales/utils.js +46 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +134 -2
- package/dist/solution/BookingTicket/index.js +776 -175
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/BookingTicket/types.js +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +231 -128
- package/dist/solution/ScanOrder/utils.js +46 -8
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +18 -23
- package/dist/solution/VenueBooking/index.d.ts +5 -9
- package/dist/solution/VenueBooking/index.js +103 -55
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/BookingContext/index.d.ts +37 -0
- package/lib/modules/BookingContext/index.js +297 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +207 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +198 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Customer/index.d.ts +6 -0
- package/lib/modules/Customer/index.js +26 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -4
- package/lib/modules/Discount/index.js +8 -63
- package/lib/modules/Discount/types.d.ts +1 -7
- package/lib/modules/Order/index.d.ts +33 -17
- package/lib/modules/Order/index.js +402 -148
- package/lib/modules/Order/types.d.ts +58 -17
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils.d.ts +39 -1
- package/lib/modules/Order/utils.js +197 -22
- package/lib/modules/Quotation/index.js +17 -6
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +22 -14
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/Schedule/index.js +3 -1
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/server/index.js +2 -0
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/server/modules/products/index.js +23 -12
- package/lib/server/modules/schedule/index.js +2 -1
- package/lib/solution/BaseSales/index.d.ts +53 -7
- package/lib/solution/BaseSales/index.js +527 -20
- package/lib/solution/BaseSales/types.d.ts +67 -1
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +70 -11
- package/lib/solution/BaseSales/utils.js +46 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +134 -2
- package/lib/solution/BookingTicket/index.js +349 -8
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/BookingTicket/types.js +6 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +147 -66
- package/lib/solution/ScanOrder/utils.js +46 -6
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +2 -4
- package/lib/solution/VenueBooking/index.d.ts +5 -9
- package/lib/solution/VenueBooking/index.js +50 -14
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/package.json +2 -2
|
@@ -33,6 +33,13 @@ __export(filterOrders_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(filterOrders_exports);
|
|
35
35
|
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
function getOrderPaymentCodes(order) {
|
|
37
|
+
const payments = order.payments;
|
|
38
|
+
if (!Array.isArray(payments) || payments.length === 0) {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
return payments.map((item) => item == null ? void 0 : item.code).filter((code) => typeof code === "string" && code.length > 0);
|
|
42
|
+
}
|
|
36
43
|
function filterOrders(orders, filters) {
|
|
37
44
|
const safeFilters = filters || {};
|
|
38
45
|
if (!orders || !Array.isArray(orders)) {
|
|
@@ -133,26 +140,27 @@ function filterOrders(orders, filters) {
|
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
if (safeFilters.payment_methods && safeFilters.payment_methods.length > 0) {
|
|
136
|
-
|
|
143
|
+
const orderPaymentCodes = getOrderPaymentCodes(order);
|
|
144
|
+
if (orderPaymentCodes.length === 0) {
|
|
137
145
|
rejected.push({
|
|
138
146
|
order_id: order.order_id,
|
|
139
147
|
order_number: order.order_number,
|
|
140
148
|
reason: {
|
|
141
149
|
field: "payment_methods",
|
|
142
|
-
actual: order.
|
|
150
|
+
actual: order.payments,
|
|
143
151
|
expected: safeFilters.payment_methods
|
|
144
152
|
}
|
|
145
153
|
});
|
|
146
154
|
return false;
|
|
147
155
|
}
|
|
148
|
-
const hasMatch =
|
|
156
|
+
const hasMatch = orderPaymentCodes.some((code) => safeFilters.payment_methods.includes(code));
|
|
149
157
|
if (!hasMatch) {
|
|
150
158
|
rejected.push({
|
|
151
159
|
order_id: order.order_id,
|
|
152
160
|
order_number: order.order_number,
|
|
153
161
|
reason: {
|
|
154
162
|
field: "payment_methods",
|
|
155
|
-
actual:
|
|
163
|
+
actual: orderPaymentCodes,
|
|
156
164
|
expected: safeFilters.payment_methods
|
|
157
165
|
}
|
|
158
166
|
});
|
|
@@ -177,7 +177,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
177
177
|
* Server 层负责传入完整 schedule 模块,Products 只负责把报价单计算结果转成价格响应形状。
|
|
178
178
|
*/
|
|
179
179
|
async setupQuotationPriceBridge(params) {
|
|
180
|
-
var _a
|
|
180
|
+
var _a;
|
|
181
181
|
if (!this.core) {
|
|
182
182
|
this.logWarning("setupQuotationPriceBridge: core 尚未初始化");
|
|
183
183
|
return;
|
|
@@ -190,15 +190,25 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
190
190
|
this.quotationPriceBridge = quotation;
|
|
191
191
|
}
|
|
192
192
|
if (params.scheduleModule) {
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
scheduleList.map((schedule) => [schedule.id, schedule])
|
|
196
|
-
);
|
|
193
|
+
const scheduleCache = /* @__PURE__ */ new Map();
|
|
194
|
+
let hasLoadedScheduleList = false;
|
|
197
195
|
this.quotationPriceBridge.setScheduleResolver((id) => {
|
|
198
|
-
var _a2,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
197
|
+
const scheduleId = String(id);
|
|
198
|
+
if (scheduleCache.has(scheduleId))
|
|
199
|
+
return scheduleCache.get(scheduleId);
|
|
200
|
+
if (!hasLoadedScheduleList) {
|
|
201
|
+
const scheduleList = ((_b = (_a2 = params.scheduleModule).getScheduleList) == null ? void 0 : _b.call(_a2)) || [];
|
|
202
|
+
for (const schedule of scheduleList) {
|
|
203
|
+
scheduleCache.set(String(schedule.id), schedule);
|
|
204
|
+
}
|
|
205
|
+
hasLoadedScheduleList = true;
|
|
206
|
+
}
|
|
207
|
+
if (scheduleCache.has(scheduleId))
|
|
208
|
+
return scheduleCache.get(scheduleId);
|
|
209
|
+
const schedules = ((_d = (_c = params.scheduleModule).getScheduleListByIds) == null ? void 0 : _d.call(_c, [id])) || ((_f = (_e = params.scheduleModule).getScheduleByIds) == null ? void 0 : _f.call(_e, [id])) || [];
|
|
210
|
+
if (schedules[0])
|
|
211
|
+
scheduleCache.set(scheduleId, schedules[0]);
|
|
202
212
|
return schedules[0];
|
|
203
213
|
});
|
|
204
214
|
}
|
|
@@ -258,10 +268,11 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
258
268
|
customer_id: customerId
|
|
259
269
|
});
|
|
260
270
|
const productPrice = quotedPrice ?? product.price;
|
|
271
|
+
const productBasePrice = quotedPrice ?? product.base_price ?? product.price ?? 0;
|
|
261
272
|
return {
|
|
262
273
|
id: product.id,
|
|
263
274
|
price: String(productPrice ?? 0),
|
|
264
|
-
base_price: String(
|
|
275
|
+
base_price: String(productBasePrice),
|
|
265
276
|
variant: this.buildVariantPriceData(product, datetime, customerId),
|
|
266
277
|
bundle_group: this.buildBundleGroupPriceData(product, datetime, customerId)
|
|
267
278
|
};
|
|
@@ -278,7 +289,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
278
289
|
customer_id: customerId
|
|
279
290
|
});
|
|
280
291
|
const price = quotedPrice ?? variant.price ?? product.price ?? 0;
|
|
281
|
-
const basePrice = variant.base_price ?? variant.price ?? product.base_price ?? product.price ?? 0;
|
|
292
|
+
const basePrice = quotedPrice ?? variant.base_price ?? variant.price ?? product.base_price ?? product.price ?? 0;
|
|
282
293
|
return {
|
|
283
294
|
id: Number(variant.id),
|
|
284
295
|
product_id: Number(variant.product_id ?? product.id),
|
|
@@ -303,7 +314,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
303
314
|
customer_id: customerId
|
|
304
315
|
});
|
|
305
316
|
const price = quotedPrice ?? item.price ?? 0;
|
|
306
|
-
const basePrice = item.base_price ?? item.price ?? 0;
|
|
317
|
+
const basePrice = quotedPrice ?? item.base_price ?? item.price ?? 0;
|
|
307
318
|
return {
|
|
308
319
|
id: Number(item.id),
|
|
309
320
|
product_id: Number(item.product_id ?? product.id),
|
|
@@ -183,8 +183,9 @@ var ScheduleModuleEx = class extends import_BaseModule.BaseModule {
|
|
|
183
183
|
return [];
|
|
184
184
|
}
|
|
185
185
|
const result = [];
|
|
186
|
+
const scheduleList = this.store.scheduleList || [];
|
|
186
187
|
for (const id of ids) {
|
|
187
|
-
const schedule = this.store.map.get(id);
|
|
188
|
+
const schedule = this.store.map.get(id) || scheduleList.find((item) => String(item.id) === String(id));
|
|
188
189
|
if (schedule) {
|
|
189
190
|
result.push(schedule);
|
|
190
191
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
-
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesScanCodeResult } from './types';
|
|
3
|
+
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesProductBookingPriceResult, BaseSalesScanCodeResult } from './types';
|
|
4
4
|
import { OrderModule } from '../../modules/Order';
|
|
5
|
-
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput,
|
|
5
|
+
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder } 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';
|
|
@@ -11,6 +11,7 @@ import { ProductList } from '../../modules/ProductList';
|
|
|
11
11
|
import { PaymentModule } from '../../modules/Payment';
|
|
12
12
|
import type { SalesSummaryModule } from '../../modules/SalesSummary';
|
|
13
13
|
import type { ScheduleModule } from '../../modules/Schedule';
|
|
14
|
+
import { QuotationModule } from '../../modules/Quotation';
|
|
14
15
|
import type { ISalesDetail, ISalesDetailHeader, ISalesBooking, ISalesPayment, ISalesSurcharge } from './utils/parseSalesResponse';
|
|
15
16
|
import { type TransformBaseProductToOrderProductParams } from './utils/transformBaseProductToOrderProduct';
|
|
16
17
|
export interface BaseSalesState {
|
|
@@ -19,6 +20,7 @@ export interface BaseSalesState {
|
|
|
19
20
|
payment?: PaymentModule;
|
|
20
21
|
salesSummary?: SalesSummaryModule;
|
|
21
22
|
schedule?: ScheduleModule;
|
|
23
|
+
quotation?: QuotationModule;
|
|
22
24
|
}
|
|
23
25
|
export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
24
26
|
protected defaultName: string;
|
|
@@ -26,6 +28,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
26
28
|
isSolution: boolean;
|
|
27
29
|
protected initializeOptions: ModuleOptions;
|
|
28
30
|
private logger;
|
|
31
|
+
private appPlugin;
|
|
29
32
|
protected store: BaseSalesState;
|
|
30
33
|
protected otherParams: Record<string, any>;
|
|
31
34
|
protected cacheId: string | undefined;
|
|
@@ -36,10 +39,12 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
36
39
|
window: WindowPlugin;
|
|
37
40
|
request: RequestPlugin;
|
|
38
41
|
protected currentSalesDetail: ISalesDetail | null;
|
|
42
|
+
protected discountConfigCacheKey: string | null;
|
|
43
|
+
protected hasManualDiscountSelection: boolean;
|
|
39
44
|
constructor(name?: string, version?: string);
|
|
40
45
|
/**
|
|
41
46
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
42
|
-
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
|
|
47
|
+
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment / quotation。
|
|
43
48
|
*/
|
|
44
49
|
protected getRegisteredModuleNames(): readonly string[];
|
|
45
50
|
/**
|
|
@@ -55,6 +60,10 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
55
60
|
*/
|
|
56
61
|
private logError;
|
|
57
62
|
get payment(): PaymentModule | undefined;
|
|
63
|
+
private getCurrentOrderCustomerId;
|
|
64
|
+
private applyQuotationScheduleResolver;
|
|
65
|
+
private loadQuotationForPriceQuery;
|
|
66
|
+
protected getSubmitOrderSalesChannel(): string | undefined;
|
|
58
67
|
/**
|
|
59
68
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
60
69
|
* 默认使用 BookingByStep 公共 `createModule`。子类若需引入额外类型(如 customer),
|
|
@@ -67,6 +76,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
67
76
|
* sessionStorage 损坏时静默忽略,按空状态注册。
|
|
68
77
|
*/
|
|
69
78
|
protected readSessionCacheData(): Record<string, any>;
|
|
79
|
+
private getAppData;
|
|
80
|
+
private syncAppDataToTempOrder;
|
|
70
81
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
71
82
|
destroy(): Promise<void>;
|
|
72
83
|
/**
|
|
@@ -91,27 +102,59 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
91
102
|
getPayments(): ISalesPayment[];
|
|
92
103
|
/** 获取附加费用(运费/服务费/税费等)。 */
|
|
93
104
|
getSurcharges(): ISalesSurcharge[];
|
|
94
|
-
getTempOrder():
|
|
105
|
+
getTempOrder(): OrderTempOrder | null;
|
|
106
|
+
replaceTempOrder(tempOrder: OrderTempOrder): Promise<OrderTempOrder>;
|
|
95
107
|
getOrderIdentity(): import("../../modules/Order/types").OrderIdentitySnapshot | null;
|
|
96
108
|
getOrderSnapshot(): import("../../modules/Order/types").OrderSnapshot | null;
|
|
97
109
|
getOrderSyncState(): import("../../modules/Order/types").OrderSyncState;
|
|
98
110
|
getOrderAmountSnapshot(): import("../../modules/Order/types").OrderAmountSnapshot | null;
|
|
99
111
|
getTempOrderNote(): string;
|
|
100
112
|
updateTempOrderNote(note: string): string;
|
|
113
|
+
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
114
|
+
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
115
|
+
updateRemoteOrderNote(orderId: number | string, note: string): void;
|
|
101
116
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
102
117
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
118
|
+
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
119
|
+
setEnableTempOrderPersist(enabled: boolean): void;
|
|
120
|
+
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
121
|
+
isTempOrderPersistEnabled(): boolean;
|
|
103
122
|
private ensureTempOrder;
|
|
104
|
-
addNewOrder(): Promise<
|
|
123
|
+
addNewOrder(): Promise<OrderTempOrder>;
|
|
105
124
|
saveDraft(): Promise<void>;
|
|
106
|
-
restoreOrder(): Promise<
|
|
125
|
+
restoreOrder(): Promise<OrderTempOrder>;
|
|
126
|
+
/**
|
|
127
|
+
* 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
|
|
128
|
+
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
129
|
+
*/
|
|
130
|
+
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
107
131
|
getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
|
|
108
132
|
getSummary(): Promise<import("../../modules/Order/types").OrderSummary>;
|
|
133
|
+
private getHistoricalProductDiscountList;
|
|
134
|
+
private isPersistedOrderProduct;
|
|
135
|
+
private mergeHistoricalDiscountList;
|
|
136
|
+
private mergeCurrentDiscountSelectionState;
|
|
137
|
+
loadDiscountConfig(params?: {
|
|
138
|
+
customerId?: number;
|
|
139
|
+
action?: 'create' | 'edit';
|
|
140
|
+
}): Promise<{
|
|
141
|
+
productList: Record<string, any>[];
|
|
142
|
+
discountList: Discount[];
|
|
143
|
+
}>;
|
|
144
|
+
bestDiscount(cb?: (result: any) => void): Promise<{
|
|
145
|
+
productList: Record<string, any>[];
|
|
146
|
+
discountList: Discount[];
|
|
147
|
+
}>;
|
|
109
148
|
getDiscountList(): Discount[];
|
|
110
149
|
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
111
150
|
setDiscountSelected(params: {
|
|
112
151
|
discountId: number;
|
|
113
152
|
isSelected: boolean;
|
|
114
153
|
}): Promise<void>;
|
|
154
|
+
applyDiscountCalculationResult(result?: {
|
|
155
|
+
productList?: Record<string, any>[];
|
|
156
|
+
discountList?: Discount[];
|
|
157
|
+
}): Promise<void>;
|
|
115
158
|
submitScanOrder<T = any>(params?: {
|
|
116
159
|
payments?: OrderPaymentSource[];
|
|
117
160
|
paymentStatus?: BaseSalesPaymentStatus;
|
|
@@ -183,8 +226,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
183
226
|
submitBeforeSend?: boolean;
|
|
184
227
|
}): Promise<T>;
|
|
185
228
|
transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
|
|
229
|
+
calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
|
|
186
230
|
addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
187
|
-
|
|
231
|
+
updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
232
|
+
updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
233
|
+
updateOrderBooking(params: UpdateOrderBookingParams): any[];
|
|
188
234
|
/**
|
|
189
235
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
190
236
|
* 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
|