@pisell/pisellos 2.2.163 → 2.2.165
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/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 +157 -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 +65 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +191 -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.js +23 -22
- package/dist/modules/Discount/index.js +4 -3
- package/dist/modules/Order/index.d.ts +25 -7
- package/dist/modules/Order/index.js +608 -291
- package/dist/modules/Order/types.d.ts +46 -14
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +76 -23
- package/dist/modules/SalesSummary/index.js +4 -2
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +46 -7
- package/dist/solution/BaseSales/index.js +928 -312
- package/dist/solution/BaseSales/types.d.ts +51 -1
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +159 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +33 -14
- package/dist/solution/BaseSales/utils.js +36 -7
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +124 -1
- package/dist/solution/BookingTicket/index.js +488 -90
- 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 +111 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +334 -0
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +231 -128
- package/dist/solution/ScanOrder/utils.js +36 -7
- package/dist/solution/VenueBooking/index.d.ts +4 -2
- 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/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 +174 -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 +65 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +177 -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.js +8 -8
- package/lib/modules/Discount/index.js +5 -1
- package/lib/modules/Order/index.d.ts +25 -7
- package/lib/modules/Order/index.js +268 -72
- package/lib/modules/Order/types.d.ts +46 -14
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +66 -15
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/solution/BaseSales/index.d.ts +46 -7
- package/lib/solution/BaseSales/index.js +369 -17
- package/lib/solution/BaseSales/types.d.ts +51 -1
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +201 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +31 -10
- package/lib/solution/BaseSales/utils.js +37 -5
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +124 -1
- package/lib/solution/BookingTicket/index.js +255 -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 +111 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +308 -0
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +147 -66
- package/lib/solution/ScanOrder/utils.js +37 -5
- package/lib/solution/VenueBooking/index.d.ts +4 -2
- 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 +1 -1
|
@@ -47,6 +47,8 @@ __export(utils_exports, {
|
|
|
47
47
|
normalizeBookingSubType: () => normalizeBookingSubType,
|
|
48
48
|
normalizeSubmitBooking: () => normalizeSubmitBooking,
|
|
49
49
|
normalizeSubmitCollectPaxValue: () => normalizeSubmitCollectPaxValue,
|
|
50
|
+
resolveManualOverrideLineOriginalPrice: () => resolveManualOverrideLineOriginalPrice,
|
|
51
|
+
resolveRulesManualDiscountFlag: () => resolveRulesManualDiscountFlag,
|
|
50
52
|
resolveSubmitCollectPax: () => resolveSubmitCollectPax,
|
|
51
53
|
sumOptionUnitPrice: () => sumOptionUnitPrice
|
|
52
54
|
});
|
|
@@ -80,6 +82,36 @@ function sumOptionUnitPrice(options) {
|
|
|
80
82
|
}
|
|
81
83
|
return total;
|
|
82
84
|
}
|
|
85
|
+
function resolveRulesManualDiscountFlag(metadata) {
|
|
86
|
+
if (!metadata)
|
|
87
|
+
return void 0;
|
|
88
|
+
if (metadata.is_manual_discount === true || metadata.is_manual_discount === 1) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
const priceOverride = metadata.price_override;
|
|
92
|
+
if (priceOverride !== void 0 && priceOverride !== null && priceOverride !== "") {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return void 0;
|
|
96
|
+
}
|
|
97
|
+
function resolveManualOverrideLineOriginalPrice(params, fallbackCompositeOriginal) {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
const metadata = params.metadata || {};
|
|
100
|
+
const priceOverride = metadata.price_override;
|
|
101
|
+
if (priceOverride === void 0 || priceOverride === null || priceOverride === "") {
|
|
102
|
+
return fallbackCompositeOriginal;
|
|
103
|
+
}
|
|
104
|
+
const refTotal = (_b = (_a = metadata.origin) == null ? void 0 : _a._extend) == null ? void 0 : _b.origin_total;
|
|
105
|
+
if (refTotal === void 0 || refTotal === null || refTotal === "") {
|
|
106
|
+
return fallbackCompositeOriginal;
|
|
107
|
+
}
|
|
108
|
+
const parsed = Number(refTotal);
|
|
109
|
+
if (!Number.isFinite(parsed)) {
|
|
110
|
+
return fallbackCompositeOriginal;
|
|
111
|
+
}
|
|
112
|
+
const num = Number(params.num) > 0 ? Number(params.num) : 1;
|
|
113
|
+
return new import_decimal.default(parsed).dividedBy(num).toDecimalPlaces(2).toFixed(2);
|
|
114
|
+
}
|
|
83
115
|
function createDefaultOrderRulesHooks() {
|
|
84
116
|
const toUnitPriceString = (totalLike, num) => {
|
|
85
117
|
const effectiveNum = Number(num) > 0 ? Number(num) : 1;
|
|
@@ -87,7 +119,7 @@ function createDefaultOrderRulesHooks() {
|
|
|
87
119
|
};
|
|
88
120
|
return {
|
|
89
121
|
getProduct: (product) => {
|
|
90
|
-
var _a, _b, _c, _d, _e
|
|
122
|
+
var _a, _b, _c, _d, _e;
|
|
91
123
|
const metadataAny = product.metadata || {};
|
|
92
124
|
const optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
93
125
|
let sourcePrice;
|
|
@@ -135,9 +167,11 @@ function createDefaultOrderRulesHooks() {
|
|
|
135
167
|
bundle: product.product_bundle || [],
|
|
136
168
|
booking_id: ((_b = product.metadata) == null ? void 0 : _b.booking_id) || null,
|
|
137
169
|
isClient: false,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
170
|
+
// 勿写死 false:否则 Rules 不会走 total≠origin_total 的手动价推断,
|
|
171
|
+
// 无券时会把 bundle 价还原成 original_price(手动改价套餐会从 20 回到 30)。
|
|
172
|
+
isManualDiscount: resolveRulesManualDiscountFlag(metadataAny),
|
|
173
|
+
holder_id: (_c = product.metadata) == null ? void 0 : _c.holder_id,
|
|
174
|
+
startDate: ((_d = product.metadata) == null ? void 0 : _d.start_date) || ((_e = product.metadata) == null ? void 0 : _e.startDate)
|
|
141
175
|
};
|
|
142
176
|
},
|
|
143
177
|
setProduct: (product, values) => {
|
|
@@ -160,10 +194,14 @@ function createDefaultOrderRulesHooks() {
|
|
|
160
194
|
bundle: nextBundle,
|
|
161
195
|
useOriginalBundle: true
|
|
162
196
|
});
|
|
197
|
+
const finalOriginalPrice = resolveManualOverrideLineOriginalPrice(
|
|
198
|
+
{ num: nextNum, metadata: metadataAny },
|
|
199
|
+
composedOriginalPrice
|
|
200
|
+
);
|
|
163
201
|
return {
|
|
164
202
|
...product,
|
|
165
203
|
selling_price: composedSellingPrice,
|
|
166
|
-
original_price:
|
|
204
|
+
original_price: finalOriginalPrice,
|
|
167
205
|
discount_list: values.discount_list ?? product.discount_list,
|
|
168
206
|
num: values.quantity ?? product.num,
|
|
169
207
|
product_bundle: nextBundle,
|
|
@@ -425,18 +463,18 @@ function createDefaultTempOrder(params) {
|
|
|
425
463
|
return {
|
|
426
464
|
order_id: null,
|
|
427
465
|
external_sale_number: "",
|
|
428
|
-
order_number:
|
|
429
|
-
shop_order_number:
|
|
430
|
-
shop_full_order_number:
|
|
431
|
-
type: "
|
|
432
|
-
business_code:
|
|
466
|
+
order_number: null,
|
|
467
|
+
shop_order_number: null,
|
|
468
|
+
shop_full_order_number: null,
|
|
469
|
+
type: "",
|
|
470
|
+
business_code: void 0,
|
|
433
471
|
platform: "h5",
|
|
434
472
|
sales_channel: "my_pisel",
|
|
435
473
|
order_sales_channel: "online_store",
|
|
436
474
|
status: "normal",
|
|
437
475
|
payment_status: "payment_processing",
|
|
438
476
|
shipping_status: "unfulfilled",
|
|
439
|
-
customer_id:
|
|
477
|
+
customer_id: 0,
|
|
440
478
|
customer_name: "",
|
|
441
479
|
country_calling_code: "",
|
|
442
480
|
phone: "",
|
|
@@ -471,6 +509,7 @@ function createDefaultTempOrder(params) {
|
|
|
471
509
|
};
|
|
472
510
|
}
|
|
473
511
|
function buildSubmitPayload(params) {
|
|
512
|
+
var _a;
|
|
474
513
|
const {
|
|
475
514
|
tempOrder,
|
|
476
515
|
cacheId,
|
|
@@ -496,7 +535,6 @@ function buildSubmitPayload(params) {
|
|
|
496
535
|
shop_service_type: _shopServiceType,
|
|
497
536
|
start_time: _startTime,
|
|
498
537
|
customer: _customer,
|
|
499
|
-
shop_full_order_number: _shopFullOrderNumber,
|
|
500
538
|
tax_fee: _rootTaxFee,
|
|
501
539
|
total_amount: _totalAmount,
|
|
502
540
|
total_refund_amount: _totalRefundAmount,
|
|
@@ -504,12 +542,23 @@ function buildSubmitPayload(params) {
|
|
|
504
542
|
holder_id: _holderId,
|
|
505
543
|
...tempOrderRest
|
|
506
544
|
} = tempOrder;
|
|
545
|
+
let submitType = type ?? tempOrder.type;
|
|
546
|
+
if (!submitType) {
|
|
547
|
+
if ((_a = tempOrder == null ? void 0 : tempOrder.bookings) == null ? void 0 : _a.length) {
|
|
548
|
+
submitType = "appointment_booking";
|
|
549
|
+
} else {
|
|
550
|
+
submitType = "virtual";
|
|
551
|
+
}
|
|
552
|
+
}
|
|
507
553
|
const payload = {
|
|
508
554
|
...tempOrderRest,
|
|
555
|
+
order_number: null,
|
|
556
|
+
shop_order_number: null,
|
|
557
|
+
shop_full_order_number: null,
|
|
509
558
|
platform: normalizeSubmitPlatform(platform),
|
|
510
559
|
request_unique_idempotency_token: tempOrder.request_unique_idempotency_token || `${tempOrder.external_sale_number}_${now.getTime()}`,
|
|
511
|
-
type:
|
|
512
|
-
business_code: businessCode ?? tempOrder.business_code
|
|
560
|
+
type: submitType,
|
|
561
|
+
business_code: businessCode ?? tempOrder.business_code,
|
|
513
562
|
sales_channel: tempOrder.sales_channel || "my_pisel",
|
|
514
563
|
order_sales_channel: channel ?? tempOrder.order_sales_channel ?? "online_store",
|
|
515
564
|
status: tempOrder.status || "normal",
|
|
@@ -526,7 +575,7 @@ function buildSubmitPayload(params) {
|
|
|
526
575
|
schedule_date: scheduleDate,
|
|
527
576
|
created_at: tempOrder.created_at || formatDateTime(now),
|
|
528
577
|
bookings: (tempOrder.bookings || []).filter(
|
|
529
|
-
(booking) => Number(booking.parent_id
|
|
578
|
+
(booking) => Number(booking.parent_id) !== 0
|
|
530
579
|
).map((booking) => normalizeSubmitBooking(booking)),
|
|
531
580
|
payments: tempOrder.payments || [],
|
|
532
581
|
// discount_list: tempOrder.discount_list || [],
|
|
@@ -630,6 +679,8 @@ function formatV1Product(products) {
|
|
|
630
679
|
normalizeBookingSubType,
|
|
631
680
|
normalizeSubmitBooking,
|
|
632
681
|
normalizeSubmitCollectPaxValue,
|
|
682
|
+
resolveManualOverrideLineOriginalPrice,
|
|
683
|
+
resolveRulesManualDiscountFlag,
|
|
633
684
|
resolveSubmitCollectPax,
|
|
634
685
|
sumOptionUnitPrice
|
|
635
686
|
});
|
|
@@ -30,7 +30,8 @@ __reExport(SalesSummary_exports, require("./types"), module.exports);
|
|
|
30
30
|
var salesSummaryDataKeys = {
|
|
31
31
|
isPriceIncludeTax: "is_price_include_tax",
|
|
32
32
|
taxRate: "tax_rate",
|
|
33
|
-
taxTitle: "tax_title"
|
|
33
|
+
taxTitle: "tax_title",
|
|
34
|
+
taxCountryCode: "tax_country_code"
|
|
34
35
|
};
|
|
35
36
|
var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
36
37
|
constructor(name, version) {
|
|
@@ -84,7 +85,8 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
84
85
|
return {
|
|
85
86
|
isPriceIncludeTax: this.getAppData(salesSummaryDataKeys.isPriceIncludeTax),
|
|
86
87
|
taxRate: this.getAppData(salesSummaryDataKeys.taxRate),
|
|
87
|
-
taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle)
|
|
88
|
+
taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle),
|
|
89
|
+
taxCountryCode: this.getAppData(salesSummaryDataKeys.taxCountryCode)
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
92
|
async getSummary(params) {
|
package/lib/modules/index.d.ts
CHANGED
package/lib/modules/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
|
|
|
34
34
|
__reExport(modules_exports, require("./Quotation"), module.exports);
|
|
35
35
|
__reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
|
|
36
36
|
__reExport(modules_exports, require("./OpenData"), module.exports);
|
|
37
|
+
__reExport(modules_exports, require("./BookingContext"), module.exports);
|
|
37
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
39
|
0 && (module.exports = {
|
|
39
40
|
...require("./Product"),
|
|
@@ -53,5 +54,6 @@ __reExport(modules_exports, require("./OpenData"), module.exports);
|
|
|
53
54
|
...require("./Schedule"),
|
|
54
55
|
...require("./Quotation"),
|
|
55
56
|
...require("./ScanOrderLogger"),
|
|
56
|
-
...require("./OpenData")
|
|
57
|
+
...require("./OpenData"),
|
|
58
|
+
...require("./BookingContext")
|
|
57
59
|
});
|
|
@@ -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;
|
|
@@ -39,7 +42,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
39
42
|
constructor(name?: string, version?: string);
|
|
40
43
|
/**
|
|
41
44
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
42
|
-
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
|
|
45
|
+
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment / quotation。
|
|
43
46
|
*/
|
|
44
47
|
protected getRegisteredModuleNames(): readonly string[];
|
|
45
48
|
/**
|
|
@@ -55,6 +58,10 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
55
58
|
*/
|
|
56
59
|
private logError;
|
|
57
60
|
get payment(): PaymentModule | undefined;
|
|
61
|
+
private getCurrentOrderCustomerId;
|
|
62
|
+
private applyQuotationScheduleResolver;
|
|
63
|
+
private loadQuotationForPriceQuery;
|
|
64
|
+
protected getSubmitOrderSalesChannel(): string | undefined;
|
|
58
65
|
/**
|
|
59
66
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
60
67
|
* 默认使用 BookingByStep 公共 `createModule`。子类若需引入额外类型(如 customer),
|
|
@@ -67,6 +74,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
67
74
|
* sessionStorage 损坏时静默忽略,按空状态注册。
|
|
68
75
|
*/
|
|
69
76
|
protected readSessionCacheData(): Record<string, any>;
|
|
77
|
+
private getAppData;
|
|
78
|
+
private syncAppDataToTempOrder;
|
|
70
79
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
71
80
|
destroy(): Promise<void>;
|
|
72
81
|
/**
|
|
@@ -91,27 +100,54 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
91
100
|
getPayments(): ISalesPayment[];
|
|
92
101
|
/** 获取附加费用(运费/服务费/税费等)。 */
|
|
93
102
|
getSurcharges(): ISalesSurcharge[];
|
|
94
|
-
getTempOrder():
|
|
103
|
+
getTempOrder(): OrderTempOrder | null;
|
|
104
|
+
replaceTempOrder(tempOrder: OrderTempOrder): Promise<OrderTempOrder>;
|
|
95
105
|
getOrderIdentity(): import("../../modules/Order/types").OrderIdentitySnapshot | null;
|
|
96
106
|
getOrderSnapshot(): import("../../modules/Order/types").OrderSnapshot | null;
|
|
97
107
|
getOrderSyncState(): import("../../modules/Order/types").OrderSyncState;
|
|
98
108
|
getOrderAmountSnapshot(): import("../../modules/Order/types").OrderAmountSnapshot | null;
|
|
99
109
|
getTempOrderNote(): string;
|
|
100
110
|
updateTempOrderNote(note: string): string;
|
|
111
|
+
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
112
|
+
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
113
|
+
updateRemoteOrderNote(orderId: number | string, note: string): void;
|
|
101
114
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
102
115
|
updateTempOrderContactsInfo(contactsInfo: Record<string, any> | null): Record<string, any> | null;
|
|
103
116
|
private ensureTempOrder;
|
|
104
|
-
addNewOrder(): Promise<
|
|
117
|
+
addNewOrder(): Promise<OrderTempOrder>;
|
|
105
118
|
saveDraft(): Promise<void>;
|
|
106
|
-
restoreOrder(): Promise<
|
|
119
|
+
restoreOrder(): Promise<OrderTempOrder>;
|
|
120
|
+
/**
|
|
121
|
+
* 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
|
|
122
|
+
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
123
|
+
*/
|
|
124
|
+
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
107
125
|
getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
|
|
108
126
|
getSummary(): Promise<import("../../modules/Order/types").OrderSummary>;
|
|
127
|
+
private getHistoricalProductDiscountList;
|
|
128
|
+
private isPersistedOrderProduct;
|
|
129
|
+
private mergeHistoricalDiscountList;
|
|
130
|
+
loadDiscountConfig(params?: {
|
|
131
|
+
customerId?: number;
|
|
132
|
+
action?: 'create' | 'edit';
|
|
133
|
+
}): Promise<{
|
|
134
|
+
productList: Record<string, any>[];
|
|
135
|
+
discountList: Discount[];
|
|
136
|
+
}>;
|
|
137
|
+
bestDiscount(cb?: (result: any) => void): Promise<{
|
|
138
|
+
productList: Record<string, any>[];
|
|
139
|
+
discountList: Discount[];
|
|
140
|
+
}>;
|
|
109
141
|
getDiscountList(): Discount[];
|
|
110
142
|
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
111
143
|
setDiscountSelected(params: {
|
|
112
144
|
discountId: number;
|
|
113
145
|
isSelected: boolean;
|
|
114
146
|
}): Promise<void>;
|
|
147
|
+
applyDiscountCalculationResult(result?: {
|
|
148
|
+
productList?: Record<string, any>[];
|
|
149
|
+
discountList?: Discount[];
|
|
150
|
+
}): Promise<void>;
|
|
115
151
|
submitScanOrder<T = any>(params?: {
|
|
116
152
|
payments?: OrderPaymentSource[];
|
|
117
153
|
paymentStatus?: BaseSalesPaymentStatus;
|
|
@@ -183,8 +219,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
183
219
|
submitBeforeSend?: boolean;
|
|
184
220
|
}): Promise<T>;
|
|
185
221
|
transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
|
|
222
|
+
calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
|
|
186
223
|
addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
187
|
-
|
|
224
|
+
updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
225
|
+
updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
226
|
+
updateOrderBooking(params: UpdateOrderBookingParams): any[];
|
|
188
227
|
/**
|
|
189
228
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
190
229
|
* 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
|