@pisell/pisellos 2.3.50 → 2.3.53
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/utils/buildCacheItemFromOrderLine.js +12 -10
- 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 +6 -8
- package/dist/modules/Order/index.js +165 -140
- package/dist/modules/Order/types.d.ts +21 -12
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Payment/types.d.ts +8 -0
- package/dist/modules/Payment/walletpass.d.ts +7 -1
- package/dist/modules/Payment/walletpass.js +155 -45
- 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 +32 -56
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/SalesSummary/utils.js +7 -1
- 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 +793 -907
- package/dist/server/modules/index.d.ts +1 -1
- package/dist/server/modules/order/index.d.ts +16 -0
- package/dist/server/modules/order/index.js +964 -776
- package/dist/server/modules/order/types.d.ts +14 -0
- package/dist/server/modules/order/types.js +6 -0
- package/dist/solution/BaseSales/index.d.ts +18 -13
- package/dist/solution/BaseSales/index.js +202 -178
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- 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 +1 -13
- package/dist/solution/BookingTicket/index.js +2 -2
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- 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/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -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 +6 -8
- package/lib/modules/Order/index.js +89 -38
- package/lib/modules/Order/types.d.ts +21 -12
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Payment/types.d.ts +8 -0
- package/lib/modules/Payment/walletpass.d.ts +7 -1
- package/lib/modules/Payment/walletpass.js +107 -9
- 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 +32 -44
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/SalesSummary/utils.js +5 -1
- 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 +15 -72
- package/lib/server/modules/index.d.ts +1 -1
- package/lib/server/modules/order/index.d.ts +16 -0
- package/lib/server/modules/order/index.js +140 -4
- package/lib/server/modules/order/types.d.ts +14 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/solution/BaseSales/index.d.ts +18 -13
- package/lib/solution/BaseSales/index.js +58 -35
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- 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 +1 -13
- package/lib/solution/BookingTicket/index.js +2 -10
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- 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
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
|
|
34
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
35
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
36
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
37
|
-
default: () => import_adapter2.default
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
40
|
-
var import_evaluator = require("./evaluator");
|
|
41
|
-
var import_adapter = require("./adapter");
|
|
42
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
43
|
-
var import_examples = require("./examples");
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
47
|
-
ITEM_REWARD_STRATEGY,
|
|
48
|
-
PromotionAdapter,
|
|
49
|
-
PromotionEvaluator,
|
|
50
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
51
|
-
});
|
|
@@ -149,7 +149,9 @@ function mapOrderBundleToOtherBundle(bundle) {
|
|
|
149
149
|
return bundle.map((item) => {
|
|
150
150
|
return {
|
|
151
151
|
...item,
|
|
152
|
-
|
|
152
|
+
// 后端历史订单可能没有 original_price;此时 price 是折前毛价,
|
|
153
|
+
// bundle_selling_price 已包含折扣,不能把它当成编辑时的新原价。
|
|
154
|
+
original_price: item.original_price ?? item.product_price ?? item.price ?? item.bundle_selling_price
|
|
153
155
|
};
|
|
154
156
|
});
|
|
155
157
|
}
|
|
@@ -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,9 +1,9 @@
|
|
|
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
|
-
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';
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
9
|
import { UnavailableReason } from '../Rules/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;
|
|
@@ -385,7 +384,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
385
384
|
* await order.addProductToOrder({ product_id: 1, num: 3 }, { start_time: '10:00' });
|
|
386
385
|
* // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
|
|
387
386
|
*/
|
|
388
|
-
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
|
|
387
|
+
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<OrderProduct[]>;
|
|
389
388
|
/**
|
|
390
389
|
* 批量添加商品行,所有行追加完成后只触发一次促销、折扣、summary 重算与持久化。
|
|
391
390
|
*
|
|
@@ -423,8 +422,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
423
422
|
* @example
|
|
424
423
|
* await order.removeProductsFromOrder([identityA, identityB]);
|
|
425
424
|
*/
|
|
426
|
-
removeProductsFromOrder(identities: OrderProductIdentity[]): Promise<OrderProduct[]>;
|
|
427
|
-
removeProductFromOrder(identity: OrderProductIdentity): Promise<OrderProduct[]>;
|
|
425
|
+
removeProductsFromOrder(identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
426
|
+
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
428
427
|
/**
|
|
429
428
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
430
429
|
* 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
|
|
@@ -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[];
|
|
@@ -563,4 +561,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
563
561
|
getOrderInfo(order_id: number): Promise<any>;
|
|
564
562
|
getVouchers(): any[];
|
|
565
563
|
}
|
|
566
|
-
export type { UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
564
|
+
export type { AddProductToOrderOptions, RemoveProductsFromOrderOptions, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
@@ -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)({
|
|
@@ -2897,8 +2887,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2897
2887
|
* @example
|
|
2898
2888
|
* await this.appendProductLineToTempOrder(tempOrder, { product_id: 1, num: 1 }, booking);
|
|
2899
2889
|
*/
|
|
2900
|
-
async appendProductLineToTempOrder(tempOrder, product, booking) {
|
|
2901
|
-
var _a, _b;
|
|
2890
|
+
async appendProductLineToTempOrder(tempOrder, product, booking, options) {
|
|
2891
|
+
var _a, _b, _c, _d;
|
|
2902
2892
|
const linked = booking ? this.createLinkedProductAndBooking({ product, booking }) : null;
|
|
2903
2893
|
const productToAdd = (linked == null ? void 0 : linked.product) || product;
|
|
2904
2894
|
const incomingFingerprint = (0, import_utils3.buildProductLineFingerprint)(
|
|
@@ -2909,7 +2899,12 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2909
2899
|
productToAdd,
|
|
2910
2900
|
(0, import_utils3.normalizeOrderProduct)(productToAdd)
|
|
2911
2901
|
);
|
|
2912
|
-
const
|
|
2902
|
+
const isWeighingProduct = Number(((_a = normalizedIncoming.product_sku) == null ? void 0 : _a.open_sold_weight) || 0) === 1;
|
|
2903
|
+
const netWeight = Number((_b = normalizedIncoming.product_sku) == null ? void 0 : _b.net_weight);
|
|
2904
|
+
if (isWeighingProduct && (!Number.isFinite(netWeight) || netWeight <= 0)) {
|
|
2905
|
+
throw new Error("[Order] 称重商品净重必须大于 0");
|
|
2906
|
+
}
|
|
2907
|
+
const incomingBookingUid = productToAdd.booking_uid ?? ((_c = productToAdd.metadata) == null ? void 0 : _c.booking_uid);
|
|
2913
2908
|
if (incomingBookingUid !== void 0 && incomingBookingUid !== null && String(incomingBookingUid) !== "") {
|
|
2914
2909
|
normalizedIncoming.booking_uid = String(incomingBookingUid);
|
|
2915
2910
|
normalizedIncoming.metadata = {
|
|
@@ -2925,7 +2920,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2925
2920
|
);
|
|
2926
2921
|
const hasIncomingProductNote = this.hasOrderProductLineNote(normalizedIncoming);
|
|
2927
2922
|
const hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
|
|
2928
|
-
const shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingBookingUid;
|
|
2923
|
+
const shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingBookingUid || isWeighingProduct;
|
|
2929
2924
|
const matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex((item) => {
|
|
2930
2925
|
var _a2;
|
|
2931
2926
|
if (this.hasGoodPassDiscount(item))
|
|
@@ -2974,10 +2969,19 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
2974
2969
|
booking_uid: linked.bookingUid
|
|
2975
2970
|
};
|
|
2976
2971
|
}
|
|
2977
|
-
|
|
2972
|
+
const insertAtIndex = options == null ? void 0 : options.insertAtIndex;
|
|
2973
|
+
if (Number.isInteger(insertAtIndex) && Number(insertAtIndex) >= 0 && Number(insertAtIndex) < tempOrder.products.length) {
|
|
2974
|
+
tempOrder.products = [
|
|
2975
|
+
...tempOrder.products.slice(0, insertAtIndex),
|
|
2976
|
+
normalizedIncoming,
|
|
2977
|
+
...tempOrder.products.slice(insertAtIndex)
|
|
2978
|
+
];
|
|
2979
|
+
} else {
|
|
2980
|
+
tempOrder.products = [...tempOrder.products, normalizedIncoming];
|
|
2981
|
+
}
|
|
2978
2982
|
} else {
|
|
2979
2983
|
const targetProduct = matchedProduct;
|
|
2980
|
-
const targetUid = (
|
|
2984
|
+
const targetUid = (_d = targetProduct.metadata) == null ? void 0 : _d.unique_identification_number;
|
|
2981
2985
|
const normalizedProduct = (0, import_utils.mergeOrderProductDisplayFields)(
|
|
2982
2986
|
targetProduct,
|
|
2983
2987
|
(0, import_utils3.normalizeOrderProduct)({
|
|
@@ -3033,6 +3037,14 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3033
3037
|
tempOrder.products[matchedIndex],
|
|
3034
3038
|
targetUid
|
|
3035
3039
|
);
|
|
3040
|
+
if (matchedIndex !== tempOrder.products.length - 1) {
|
|
3041
|
+
const mergedProduct = tempOrder.products[matchedIndex];
|
|
3042
|
+
tempOrder.products = [
|
|
3043
|
+
...tempOrder.products.slice(0, matchedIndex),
|
|
3044
|
+
...tempOrder.products.slice(matchedIndex + 1),
|
|
3045
|
+
mergedProduct
|
|
3046
|
+
];
|
|
3047
|
+
}
|
|
3036
3048
|
}
|
|
3037
3049
|
if (linked) {
|
|
3038
3050
|
tempOrder.bookings = [...tempOrder.bookings || [], linked.booking];
|
|
@@ -3045,8 +3057,15 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3045
3057
|
* await order.addProductToOrder({ product_id: 1, num: 3 }, { start_time: '10:00' });
|
|
3046
3058
|
* // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
|
|
3047
3059
|
*/
|
|
3048
|
-
async addProductToOrder(product, booking) {
|
|
3060
|
+
async addProductToOrder(product, booking, options) {
|
|
3049
3061
|
const tempOrder = this.ensureTempOrder();
|
|
3062
|
+
const insertAfterProductUid = options == null ? void 0 : options.insertAfterProductUid;
|
|
3063
|
+
const anchorIndex = booking && insertAfterProductUid ? tempOrder.products.findIndex((line) => {
|
|
3064
|
+
var _a;
|
|
3065
|
+
const uid = ((_a = line.metadata) == null ? void 0 : _a.unique_identification_number) || line.unique_identification_number;
|
|
3066
|
+
return uid !== void 0 && uid !== null && String(uid) === String(insertAfterProductUid);
|
|
3067
|
+
}) : -1;
|
|
3068
|
+
let insertAtIndex = anchorIndex >= 0 ? anchorIndex + 1 : void 0;
|
|
3050
3069
|
if (booking) {
|
|
3051
3070
|
const productRecord = product;
|
|
3052
3071
|
const splitCount = (0, import_utils3.getSafeProductNum)(
|
|
@@ -3060,14 +3079,22 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3060
3079
|
await this.appendProductLineToTempOrder(
|
|
3061
3080
|
tempOrder,
|
|
3062
3081
|
singleLine,
|
|
3063
|
-
(0, import_lodash_es.cloneDeep)(booking)
|
|
3082
|
+
(0, import_lodash_es.cloneDeep)(booking),
|
|
3083
|
+
{ insertAtIndex }
|
|
3064
3084
|
);
|
|
3085
|
+
if (insertAtIndex !== void 0)
|
|
3086
|
+
insertAtIndex += 1;
|
|
3065
3087
|
}
|
|
3066
3088
|
await this.finalizeProductOrderMutation(tempOrder);
|
|
3067
3089
|
return tempOrder.products;
|
|
3068
3090
|
}
|
|
3069
3091
|
}
|
|
3070
|
-
await this.appendProductLineToTempOrder(
|
|
3092
|
+
await this.appendProductLineToTempOrder(
|
|
3093
|
+
tempOrder,
|
|
3094
|
+
product,
|
|
3095
|
+
booking,
|
|
3096
|
+
{ insertAtIndex }
|
|
3097
|
+
);
|
|
3071
3098
|
await this.finalizeProductOrderMutation(tempOrder);
|
|
3072
3099
|
this.logInfo("addProductToOrder success", {
|
|
3073
3100
|
product_id: product.product_id,
|
|
@@ -3548,7 +3575,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3548
3575
|
* @example
|
|
3549
3576
|
* await order.removeProductsFromOrder([identityA, identityB]);
|
|
3550
3577
|
*/
|
|
3551
|
-
async removeProductsFromOrder(identities) {
|
|
3578
|
+
async removeProductsFromOrder(identities, options) {
|
|
3552
3579
|
var _a, _b, _c, _d;
|
|
3553
3580
|
const tempOrder = this.ensureTempOrder();
|
|
3554
3581
|
if (!identities.length) {
|
|
@@ -3556,6 +3583,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3556
3583
|
}
|
|
3557
3584
|
const productsBeforeRemove = tempOrder.products || [];
|
|
3558
3585
|
const bookingsBeforeRemove = tempOrder.bookings || [];
|
|
3586
|
+
const preserveDisplayPosition = options == null ? void 0 : options.preserveDisplayPosition;
|
|
3587
|
+
const anchorIndex = preserveDisplayPosition ? productsBeforeRemove.findIndex((item) => {
|
|
3588
|
+
var _a2;
|
|
3589
|
+
const uid = ((_a2 = item.metadata) == null ? void 0 : _a2.unique_identification_number) || item.unique_identification_number;
|
|
3590
|
+
return uid !== void 0 && uid !== null && String(uid) === String(preserveDisplayPosition.anchorProductUid);
|
|
3591
|
+
}) : -1;
|
|
3592
|
+
const productsAfterAnchor = anchorIndex >= 0 ? productsBeforeRemove.slice(anchorIndex + 1) : [];
|
|
3559
3593
|
const matchedProducts = productsBeforeRemove.filter((item) => {
|
|
3560
3594
|
return identities.some((identity) => (0, import_utils3.isIdentityMatch)(item, identity));
|
|
3561
3595
|
});
|
|
@@ -3596,14 +3630,37 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3596
3630
|
return !(isAddTimeProduct && lineBookingUid !== void 0 && lineBookingUid !== null && linkedBookingUidsToRemove.has(String(lineBookingUid)));
|
|
3597
3631
|
});
|
|
3598
3632
|
}
|
|
3633
|
+
if (preserveDisplayPosition && anchorIndex >= 0) {
|
|
3634
|
+
const remainingProductIndex = tempOrder.products.findIndex((item) => {
|
|
3635
|
+
var _a2;
|
|
3636
|
+
const uid = ((_a2 = item.metadata) == null ? void 0 : _a2.unique_identification_number) || item.unique_identification_number;
|
|
3637
|
+
return uid !== void 0 && uid !== null && String(uid) === String(preserveDisplayPosition.remainingProductUid);
|
|
3638
|
+
});
|
|
3639
|
+
if (remainingProductIndex >= 0) {
|
|
3640
|
+
const remainingProduct = tempOrder.products[remainingProductIndex];
|
|
3641
|
+
const nextProduct = productsAfterAnchor.find(
|
|
3642
|
+
(item) => tempOrder.products.includes(item)
|
|
3643
|
+
);
|
|
3644
|
+
const productsWithoutRemaining = [
|
|
3645
|
+
...tempOrder.products.slice(0, remainingProductIndex),
|
|
3646
|
+
...tempOrder.products.slice(remainingProductIndex + 1)
|
|
3647
|
+
];
|
|
3648
|
+
const nextProductIndex = nextProduct ? productsWithoutRemaining.indexOf(nextProduct) : -1;
|
|
3649
|
+
tempOrder.products = nextProductIndex >= 0 ? [
|
|
3650
|
+
...productsWithoutRemaining.slice(0, nextProductIndex),
|
|
3651
|
+
remainingProduct,
|
|
3652
|
+
...productsWithoutRemaining.slice(nextProductIndex)
|
|
3653
|
+
] : [...productsWithoutRemaining, remainingProduct];
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3599
3656
|
await this.finalizeAfterProductsMutation(tempOrder);
|
|
3600
3657
|
this.logInfo("removeProductsFromOrder success", {
|
|
3601
3658
|
identities
|
|
3602
3659
|
});
|
|
3603
3660
|
return tempOrder.products;
|
|
3604
3661
|
}
|
|
3605
|
-
async removeProductFromOrder(identity) {
|
|
3606
|
-
return this.removeProductsFromOrder([identity]);
|
|
3662
|
+
async removeProductFromOrder(identity, options) {
|
|
3663
|
+
return this.removeProductsFromOrder([identity], options);
|
|
3607
3664
|
}
|
|
3608
3665
|
/**
|
|
3609
3666
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
@@ -3928,7 +3985,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3928
3985
|
tempOrder,
|
|
3929
3986
|
effectivePayments
|
|
3930
3987
|
);
|
|
3931
|
-
const
|
|
3988
|
+
const submitResult = await this.submitTempOrder({
|
|
3932
3989
|
payments: effectivePayments,
|
|
3933
3990
|
paymentStatus,
|
|
3934
3991
|
smallTicketDataFlag: params.smallTicketDataFlag,
|
|
@@ -3942,8 +3999,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3942
3999
|
};
|
|
3943
4000
|
return nextPayload;
|
|
3944
4001
|
}
|
|
3945
|
-
};
|
|
3946
|
-
const submitResult = params.checkoutSyncTaskEnabled === false ? await this.submitTempOrderAsync(submitParams) : await this.submitTempOrder(submitParams);
|
|
4002
|
+
});
|
|
3947
4003
|
return { ...completion, submitResult };
|
|
3948
4004
|
}
|
|
3949
4005
|
createOrder(params) {
|
|
@@ -3960,13 +4016,11 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3960
4016
|
is_deposit: 0,
|
|
3961
4017
|
relation_products: [],
|
|
3962
4018
|
relation_forms: [],
|
|
3963
|
-
business_code: params == null ? void 0 : params.business_code,
|
|
3964
4019
|
...(params == null ? void 0 : params.extraData) || {}
|
|
3965
4020
|
};
|
|
3966
4021
|
let is_deposit = 0;
|
|
3967
4022
|
if (params.cartItems.length > 0) {
|
|
3968
4023
|
params.cartItems.forEach((item) => {
|
|
3969
|
-
var _a2;
|
|
3970
4024
|
if (!item._origin.duration) {
|
|
3971
4025
|
const { duration, durationType } = (0, import_utils.generateDuration)(item);
|
|
3972
4026
|
item._origin.duration = duration;
|
|
@@ -3975,9 +4029,6 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
3975
4029
|
item._origin.sub_type = (0, import_utils.normalizeBookingSubType)(item._origin);
|
|
3976
4030
|
const discountList = (0, import_utils.getAllDiscountList)(item);
|
|
3977
4031
|
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
4032
|
if ((0, import_utils2.isNormalProduct)(item._origin)) {
|
|
3982
4033
|
order.relation_products.push(item._origin.product);
|
|
3983
4034
|
const relationForms = item._origin.relation_forms || [];
|
|
@@ -321,6 +321,24 @@ export interface ReplaceTempOrderOptions {
|
|
|
321
321
|
saveDraft?: boolean;
|
|
322
322
|
}
|
|
323
323
|
export type AddProductBookingInput = Record<string, any>;
|
|
324
|
+
/**
|
|
325
|
+
* 添加商品行时的顺序控制。
|
|
326
|
+
* 默认追加到 products 尾部;预约数量同步可插入到既有预约组的最新行之后,
|
|
327
|
+
* 避免步进器修改数量改变该组展示位置。
|
|
328
|
+
*/
|
|
329
|
+
export interface AddProductToOrderOptions {
|
|
330
|
+
insertAfterProductUid?: string;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* 删除商品后的可选位置保持策略。
|
|
334
|
+
* 预约合并行减量时仍删除最新真实行,再把剩余代表行移动到被删除代表行原位置。
|
|
335
|
+
*/
|
|
336
|
+
export interface RemoveProductsFromOrderOptions {
|
|
337
|
+
preserveDisplayPosition?: {
|
|
338
|
+
remainingProductUid: string;
|
|
339
|
+
anchorProductUid: string;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
324
342
|
/** 更新购物车行:仅传 SKU 时命中同 SKU 第一行;多行同 SKU 须传 unique_identification_number / 选项指纹等 */
|
|
325
343
|
export interface UpdateOrderProductParams {
|
|
326
344
|
product_id: number | null;
|
|
@@ -396,7 +414,6 @@ export interface CommitOrderParams {
|
|
|
396
414
|
type: 'virtual' | 'appointment_booking';
|
|
397
415
|
platform?: string;
|
|
398
416
|
extraData?: Record<string, any>;
|
|
399
|
-
business_code?: string;
|
|
400
417
|
};
|
|
401
418
|
}
|
|
402
419
|
export interface OrderSubmitBooking {
|
|
@@ -572,12 +589,6 @@ export interface SyncPaymentsToOrderParams {
|
|
|
572
589
|
payments: OrderPaymentSource[];
|
|
573
590
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
574
591
|
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
592
|
smallTicketDataFlag?: number;
|
|
582
593
|
businessCode?: string;
|
|
583
594
|
channel?: string;
|
|
@@ -722,15 +733,15 @@ export interface OrderModuleAPI {
|
|
|
722
733
|
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
723
734
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
724
735
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
725
|
-
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput) => Promise<OrderProduct[]>;
|
|
736
|
+
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
|
|
726
737
|
updateOrderProduct: (params: UpdateOrderProductParams) => Promise<OrderProduct[]>;
|
|
727
738
|
/** 批量更新购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
728
739
|
updateOrderProducts: (paramsList: UpdateOrderProductParams[]) => Promise<OrderProduct[]>;
|
|
729
740
|
updateOrderProductQuantity: (params: UpdateOrderProductQuantityParams) => Promise<OrderProduct[]>;
|
|
730
741
|
updateOrderBooking: (params: UpdateOrderBookingParams) => any[];
|
|
731
|
-
removeProductFromOrder: (identity: OrderProductIdentity) => Promise<OrderProduct[]>;
|
|
742
|
+
removeProductFromOrder: (identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
|
|
732
743
|
/** 批量删除购物车行,末尾仅触发一次促销重算与 summary 刷新 */
|
|
733
|
-
removeProductsFromOrder: (identities: OrderProductIdentity[]) => Promise<OrderProduct[]>;
|
|
744
|
+
removeProductsFromOrder: (identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions) => Promise<OrderProduct[]>;
|
|
734
745
|
/** @deprecated no-op;OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
735
746
|
persistTempOrder: () => void;
|
|
736
747
|
/**
|
|
@@ -740,8 +751,6 @@ export interface OrderModuleAPI {
|
|
|
740
751
|
setEnableTempOrderPersist: (enabled: boolean) => void;
|
|
741
752
|
/** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
|
|
742
753
|
isTempOrderPersistEnabled: () => boolean;
|
|
743
|
-
/** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
|
|
744
|
-
notifyTempOrderChanged: () => void;
|
|
745
754
|
submitTempOrder: <T = any>(params?: {
|
|
746
755
|
cacheId?: string;
|
|
747
756
|
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;
|