@pisell/pisellos 2.3.1 → 2.3.2

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.
Files changed (49) hide show
  1. package/dist/modules/Order/index.d.ts +9 -0
  2. package/dist/modules/Order/index.js +448 -369
  3. package/dist/modules/Order/types.d.ts +2 -0
  4. package/dist/modules/Quotation/index.d.ts +16 -2
  5. package/dist/modules/Quotation/index.js +71 -38
  6. package/dist/modules/Quotation/types.d.ts +14 -0
  7. package/dist/modules/SalesSummary/index.d.ts +1 -0
  8. package/dist/modules/SalesSummary/index.js +7 -4
  9. package/dist/modules/Schedule/index.d.ts +4 -0
  10. package/dist/modules/Schedule/index.js +31 -1
  11. package/dist/modules/Schedule/types.d.ts +2 -0
  12. package/dist/server/index.js +13 -12
  13. package/dist/server/modules/products/index.d.ts +4 -0
  14. package/dist/server/modules/products/index.js +76 -45
  15. package/dist/server/modules/quotation/index.d.ts +39 -0
  16. package/dist/server/modules/quotation/index.js +278 -66
  17. package/dist/server/modules/schedule/index.d.ts +2 -0
  18. package/dist/server/modules/schedule/index.js +10 -2
  19. package/dist/solution/BaseSales/index.d.ts +10 -1
  20. package/dist/solution/BaseSales/index.js +825 -528
  21. package/dist/solution/BaseSales/types.d.ts +7 -0
  22. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +12 -1
  23. package/dist/solution/BaseSales/utils/quotationPrice.js +16 -3
  24. package/dist/solution/BookingByStep/index.d.ts +1 -1
  25. package/lib/modules/Order/index.d.ts +9 -0
  26. package/lib/modules/Order/index.js +48 -7
  27. package/lib/modules/Order/types.d.ts +2 -0
  28. package/lib/modules/Quotation/index.d.ts +16 -2
  29. package/lib/modules/Quotation/index.js +49 -13
  30. package/lib/modules/Quotation/types.d.ts +14 -0
  31. package/lib/modules/SalesSummary/index.d.ts +1 -0
  32. package/lib/modules/SalesSummary/index.js +4 -3
  33. package/lib/modules/Schedule/index.d.ts +4 -0
  34. package/lib/modules/Schedule/index.js +21 -0
  35. package/lib/modules/Schedule/types.d.ts +2 -0
  36. package/lib/server/index.js +1 -1
  37. package/lib/server/modules/products/index.d.ts +4 -0
  38. package/lib/server/modules/products/index.js +43 -19
  39. package/lib/server/modules/quotation/index.d.ts +39 -0
  40. package/lib/server/modules/quotation/index.js +179 -1
  41. package/lib/server/modules/schedule/index.d.ts +2 -0
  42. package/lib/server/modules/schedule/index.js +8 -1
  43. package/lib/solution/BaseSales/index.d.ts +10 -1
  44. package/lib/solution/BaseSales/index.js +218 -19
  45. package/lib/solution/BaseSales/types.d.ts +7 -0
  46. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +12 -1
  47. package/lib/solution/BaseSales/utils/quotationPrice.js +15 -3
  48. package/lib/solution/BookingByStep/index.d.ts +1 -1
  49. package/package.json +1 -1
@@ -46,6 +46,9 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
46
46
  // 是否已注册内置价格格式化器
47
47
  this.isPriceFormatterRegistered = false;
48
48
  this.quotationBridgeLoadedKey = "";
49
+ this.quotationScheduleCache = /* @__PURE__ */ new Map();
50
+ this.quotationScheduleCacheSource = null;
51
+ this.quotationScheduleCacheLoaded = false;
49
52
  this.pendingSyncMessages = [];
50
53
  /** 最近一次 SSE 全量拉取完成时间 */
51
54
  this.lastServerFullFetchAtMs = 0;
@@ -198,25 +201,30 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
198
201
  this.quotationPriceBridge = quotation;
199
202
  }
200
203
  if (params.scheduleModule) {
201
- const scheduleCache = /* @__PURE__ */ new Map();
202
- let hasLoadedScheduleList = false;
204
+ if (this.quotationScheduleCacheSource !== params.scheduleModule) {
205
+ this.quotationScheduleCache.clear();
206
+ this.quotationScheduleCacheLoaded = false;
207
+ this.quotationScheduleCacheSource = params.scheduleModule;
208
+ }
203
209
  this.quotationPriceBridge.setScheduleResolver((id) => {
204
210
  var _a2, _b, _c, _d, _e, _f;
205
211
  const scheduleId = String(id);
206
- if (scheduleCache.has(scheduleId))
207
- return scheduleCache.get(scheduleId);
208
- if (!hasLoadedScheduleList) {
212
+ if (this.quotationScheduleCache.has(scheduleId)) {
213
+ return this.quotationScheduleCache.get(scheduleId);
214
+ }
215
+ if (!this.quotationScheduleCacheLoaded) {
209
216
  const scheduleList = ((_b = (_a2 = params.scheduleModule).getScheduleList) == null ? void 0 : _b.call(_a2)) || [];
210
217
  for (const schedule of scheduleList) {
211
- scheduleCache.set(String(schedule.id), schedule);
218
+ this.quotationScheduleCache.set(String(schedule.id), schedule);
212
219
  }
213
- hasLoadedScheduleList = true;
220
+ this.quotationScheduleCacheLoaded = true;
221
+ }
222
+ if (this.quotationScheduleCache.has(scheduleId)) {
223
+ return this.quotationScheduleCache.get(scheduleId);
214
224
  }
215
- if (scheduleCache.has(scheduleId))
216
- return scheduleCache.get(scheduleId);
217
225
  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])) || [];
218
226
  if (schedules[0])
219
- scheduleCache.set(scheduleId, schedules[0]);
227
+ this.quotationScheduleCache.set(scheduleId, schedules[0]);
220
228
  return schedules[0];
221
229
  });
222
230
  }
@@ -266,12 +274,30 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
266
274
  getQuotationBridgeScopeKey() {
267
275
  return this.quotationBridgeChannel || "";
268
276
  }
269
- buildPriceDataFromQuotation(product, datetime, customerId) {
277
+ getQuotedPrice(params) {
270
278
  var _a;
271
- const quotedPrice = (_a = this.quotationPriceBridge) == null ? void 0 : _a.getPriceForProduct({
279
+ const quotation = this.quotationPriceBridge;
280
+ if (!quotation)
281
+ return null;
282
+ const query = {
283
+ productId: params.productId,
284
+ variantId: params.variantId,
285
+ datetime: params.datetime,
286
+ customer_id: params.customerId
287
+ };
288
+ if (typeof quotation.getQuotationMatchForProduct === "function") {
289
+ return ((_a = quotation.getQuotationMatchForProduct(query)) == null ? void 0 : _a.price) ?? null;
290
+ }
291
+ if (typeof quotation.getPriceForProduct === "function") {
292
+ return quotation.getPriceForProduct(query);
293
+ }
294
+ return null;
295
+ }
296
+ buildPriceDataFromQuotation(product, datetime, customerId) {
297
+ const quotedPrice = this.getQuotedPrice({
272
298
  productId: product.id,
273
299
  datetime,
274
- customer_id: customerId
300
+ customerId
275
301
  });
276
302
  const productPrice = quotedPrice ?? product.price;
277
303
  const productBasePrice = quotedPrice ?? product.base_price ?? product.price ?? 0;
@@ -287,12 +313,11 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
287
313
  if (!Array.isArray(product.variant))
288
314
  return [];
289
315
  return product.variant.map((variant) => {
290
- var _a;
291
- const quotedPrice = (_a = this.quotationPriceBridge) == null ? void 0 : _a.getPriceForProduct({
316
+ const quotedPrice = this.getQuotedPrice({
292
317
  productId: product.id,
293
318
  variantId: Number(variant.id),
294
319
  datetime,
295
- customer_id: customerId
320
+ customerId
296
321
  });
297
322
  const price = quotedPrice ?? variant.price ?? product.price ?? 0;
298
323
  const basePrice = quotedPrice ?? variant.base_price ?? variant.price ?? product.base_price ?? product.price ?? 0;
@@ -310,14 +335,13 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
310
335
  return product.bundle_group.map((group) => ({
311
336
  id: Number(group.id),
312
337
  bundle_item: (group.bundle_item || []).map((item) => {
313
- var _a;
314
338
  const bundleProductId = Number(item.bundle_product_id);
315
339
  const bundleVariantId = Number(item.bundle_variant_id || 0);
316
- const quotedPrice = (_a = this.quotationPriceBridge) == null ? void 0 : _a.getPriceForProduct({
340
+ const quotedPrice = this.getQuotedPrice({
317
341
  productId: bundleProductId,
318
342
  variantId: bundleVariantId,
319
343
  datetime,
320
- customer_id: customerId
344
+ customerId
321
345
  });
322
346
  const price = quotedPrice ?? item.price ?? 0;
323
347
  const basePrice = quotedPrice ?? item.base_price ?? item.price ?? 0;
@@ -1,6 +1,8 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../../types';
2
2
  import { BaseModule } from '../../../modules/BaseModule';
3
3
  import { QuotationData } from './types';
4
+ import type { ScheduleItem } from '../../../modules/Schedule/types';
5
+ import type { QuotationCustomerScopeInfo } from '../../../modules/Quotation/types';
4
6
  /**
5
7
  * 报价单模块 - 用于管理报价单数据和计算商品价格
6
8
  */
@@ -10,6 +12,7 @@ export declare class QuotationModule extends BaseModule implements Module {
10
12
  private request;
11
13
  private store;
12
14
  private dbManager;
15
+ private scheduleResolver?;
13
16
  constructor(name?: string, version?: string);
14
17
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
15
18
  /**
@@ -25,10 +28,46 @@ export declare class QuotationModule extends BaseModule implements Module {
25
28
  * 获取报价单列表
26
29
  */
27
30
  getQuotationList(): QuotationData[];
31
+ loadQuotations(params?: {
32
+ channel?: string;
33
+ customer_id?: number | string;
34
+ }): Promise<void>;
35
+ setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
36
+ getPriceForProduct(params: {
37
+ productId: number;
38
+ variantId?: number;
39
+ datetime: string;
40
+ channel?: string;
41
+ customer_id?: number | string;
42
+ }): string | null;
43
+ getQuotationMatchForProduct(params: {
44
+ productId: number;
45
+ variantId?: number;
46
+ datetime: string;
47
+ channel?: string;
48
+ customer_id?: number | string;
49
+ }): {
50
+ price: string | null;
51
+ quotationShelfId: number;
52
+ } | null;
53
+ getQuotationShelfId(params: {
54
+ productId: number;
55
+ variantId?: number;
56
+ datetime: string;
57
+ channel?: string;
58
+ customer_id?: number | string;
59
+ }): number;
60
+ getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
28
61
  /**
29
62
  * 清空缓存
30
63
  */
31
64
  clear(): Promise<void>;
65
+ private normalizeCustomerId;
66
+ private hasValidCustomerId;
67
+ private isQuotationVisibleForCustomer;
68
+ private isQuotationVisibleForChannel;
69
+ private isQuotationActiveAt;
70
+ private findProductData;
32
71
  /**
33
72
  * 从 IndexDB 加载报价单数据
34
73
  * @private
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
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
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/server/modules/quotation/index.ts
@@ -23,11 +33,16 @@ __export(quotation_exports, {
23
33
  });
24
34
  module.exports = __toCommonJS(quotation_exports);
25
35
  var import_lodash_es = require("lodash-es");
36
+ var import_dayjs = __toESM(require("dayjs"));
37
+ var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
38
+ var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter"));
26
39
  var import_BaseModule = require("../../../modules/BaseModule");
27
40
  var import_types = require("./types");
41
+ var import_getDateIsInSchedule = require("../../../modules/Schedule/getDateIsInSchedule");
42
+ import_dayjs.default.extend(import_isSameOrBefore.default);
43
+ import_dayjs.default.extend(import_isSameOrAfter.default);
28
44
  var INDEXDB_STORE_NAME = "quotation";
29
45
  var QuotationModule = class extends import_BaseModule.BaseModule {
30
- // IndexDBManager 实例
31
46
  constructor(name, version) {
32
47
  super(name, version);
33
48
  this.defaultName = "quotation";
@@ -95,6 +110,97 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
95
110
  getQuotationList() {
96
111
  return this.store.quotationList;
97
112
  }
113
+ async loadQuotations(params) {
114
+ var _a;
115
+ if (Array.isArray(this.store.quotationList) && this.store.quotationList.length > 0) {
116
+ this.store.quotationList.sort(
117
+ (a, b) => Number(a.sort ?? a.priority ?? 0) - Number(b.sort ?? b.priority ?? 0)
118
+ );
119
+ return;
120
+ }
121
+ const query = {};
122
+ if (params == null ? void 0 : params.channel)
123
+ query.channel = params.channel;
124
+ if ((params == null ? void 0 : params.channel) === "online_store")
125
+ query.channel = "online-store";
126
+ const res = await this.request.get(
127
+ "/quotation/available",
128
+ query,
129
+ { useCache: false, osServer: true }
130
+ );
131
+ const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
132
+ list.sort((a, b) => Number(a.sort ?? a.priority ?? 0) - Number(b.sort ?? b.priority ?? 0));
133
+ this.store.quotationList = list;
134
+ await this.core.effects.emit(import_types.QuotationHooks.onQuotationLoaded, this.store.quotationList);
135
+ }
136
+ setScheduleResolver(resolver) {
137
+ this.scheduleResolver = resolver;
138
+ }
139
+ getPriceForProduct(params) {
140
+ var _a;
141
+ return ((_a = this.getQuotationMatchForProduct(params)) == null ? void 0 : _a.price) ?? null;
142
+ }
143
+ getQuotationMatchForProduct(params) {
144
+ const { productId, variantId, datetime, channel, customer_id } = params;
145
+ for (const quotation of this.store.quotationList) {
146
+ if (!this.isQuotationVisibleForChannel(quotation, channel))
147
+ continue;
148
+ if (!this.isQuotationVisibleForCustomer(quotation, customer_id))
149
+ continue;
150
+ if (!this.isQuotationActiveAt(quotation, datetime))
151
+ continue;
152
+ const match = this.findProductData(quotation, productId, variantId);
153
+ if (!match)
154
+ continue;
155
+ const value = match.value ?? match.final_price ?? match.discount_value;
156
+ if (Number(value) === 0)
157
+ continue;
158
+ if (value === void 0 || value === null || value === "")
159
+ continue;
160
+ return {
161
+ price: String(value),
162
+ quotationShelfId: Number(quotation.id) || 0
163
+ };
164
+ }
165
+ return null;
166
+ }
167
+ getQuotationShelfId(params) {
168
+ var _a;
169
+ return ((_a = this.getQuotationMatchForProduct(params)) == null ? void 0 : _a.quotationShelfId) ?? 0;
170
+ }
171
+ getQuotationCustomerScopeInfo() {
172
+ const customerById = /* @__PURE__ */ new Map();
173
+ const quotationScopes = this.store.quotationList.filter((quotation) => Array.isArray(quotation == null ? void 0 : quotation.customer) && quotation.customer.length > 0).map((quotation) => {
174
+ const customerIds = [];
175
+ const customers = [];
176
+ const localSeen = /* @__PURE__ */ new Set();
177
+ (quotation.customer || []).forEach((customer) => {
178
+ const customerId = this.normalizeCustomerId(customer == null ? void 0 : customer.id);
179
+ if (!customerId || localSeen.has(customerId))
180
+ return;
181
+ localSeen.add(customerId);
182
+ customerIds.push(customerId);
183
+ customers.push(customer);
184
+ if (!customerById.has(customerId))
185
+ customerById.set(customerId, customer);
186
+ });
187
+ return {
188
+ quotationId: Number(quotation.id),
189
+ quotationName: String(quotation.name || ""),
190
+ customerIds,
191
+ customers
192
+ };
193
+ });
194
+ const result = {
195
+ quotationCount: this.store.quotationList.length,
196
+ hasCustomerScopedQuotations: quotationScopes.length > 0,
197
+ allQuotationsCustomerScoped: this.store.quotationList.length > 0 && quotationScopes.length === this.store.quotationList.length,
198
+ customerIds: Array.from(customerById.keys()),
199
+ customers: Array.from(customerById.values()),
200
+ quotationScopes
201
+ };
202
+ return result;
203
+ }
98
204
  /**
99
205
  * 清空缓存
100
206
  */
@@ -110,6 +216,78 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
110
216
  }
111
217
  console.log("[Quotation] 缓存已清空");
112
218
  }
219
+ normalizeCustomerId(customerId) {
220
+ if (customerId === void 0 || customerId === null || customerId === "")
221
+ return null;
222
+ return String(customerId);
223
+ }
224
+ hasValidCustomerId(customerId) {
225
+ if (customerId === void 0 || customerId === null || customerId === "")
226
+ return false;
227
+ return Number(customerId) > 0;
228
+ }
229
+ isQuotationVisibleForCustomer(quotation, customerId) {
230
+ const customers = quotation.customer || [];
231
+ if (!Array.isArray(customers) || customers.length === 0)
232
+ return true;
233
+ if (!this.hasValidCustomerId(customerId))
234
+ return false;
235
+ return customers.some((customer) => String(customer.id) === String(customerId));
236
+ }
237
+ isQuotationVisibleForChannel(quotation, channel) {
238
+ if (!channel)
239
+ return true;
240
+ const normalizedChannel = channel === "online_store" ? "online-store" : channel;
241
+ const channels = quotation.channel;
242
+ if (!Array.isArray(channels) || channels.length === 0)
243
+ return true;
244
+ return channels.some((item) => String(item) === normalizedChannel);
245
+ }
246
+ isQuotationActiveAt(quotation, datetime) {
247
+ const quotationSchedules = Array.isArray(quotation.schedule) ? quotation.schedule : [];
248
+ const scheduleIds = Array.isArray(quotation.schedule_ids) ? quotation.schedule_ids : [];
249
+ if (!quotationSchedules.length && !scheduleIds.length)
250
+ return false;
251
+ const scheduleItems = [];
252
+ quotationSchedules.forEach((schedule) => {
253
+ var _a;
254
+ const full = (_a = this.scheduleResolver) == null ? void 0 : _a.call(this, schedule.id);
255
+ if (full) {
256
+ scheduleItems.push(full);
257
+ return;
258
+ }
259
+ if (this.scheduleResolver)
260
+ return;
261
+ scheduleItems.push({
262
+ ...schedule,
263
+ repeat_type: schedule.repeat_type || "none",
264
+ repeat_rule: schedule.repeat_rule || null,
265
+ time_slot: schedule.time_slot || []
266
+ });
267
+ });
268
+ scheduleIds.forEach((id) => {
269
+ var _a;
270
+ const full = (_a = this.scheduleResolver) == null ? void 0 : _a.call(this, id);
271
+ if (full)
272
+ scheduleItems.push(full);
273
+ });
274
+ if (!scheduleItems.length)
275
+ return false;
276
+ return (0, import_getDateIsInSchedule.getDateIsInSchedule)(datetime, scheduleItems);
277
+ }
278
+ findProductData(quotation, productId, variantId) {
279
+ const productData = Array.isArray(quotation.product_data) ? quotation.product_data : Array.isArray(quotation.product_prices) ? quotation.product_prices : [];
280
+ if (variantId && variantId !== 0) {
281
+ const variantMatch = productData.find(
282
+ (item) => Number(item.product_id) === productId && Number(item.variant_id || 0) === variantId
283
+ );
284
+ if (variantMatch)
285
+ return variantMatch;
286
+ }
287
+ return productData.find(
288
+ (item) => Number(item.product_id) === productId && Number(item.variant_id || 0) === 0
289
+ );
290
+ }
113
291
  /**
114
292
  * 从 IndexDB 加载报价单数据
115
293
  * @private
@@ -12,6 +12,7 @@ export declare class ScheduleModuleEx extends BaseModule implements Module, Sche
12
12
  private store;
13
13
  private dbManager;
14
14
  private logger;
15
+ private hasLoadedScheduleList;
15
16
  constructor(name?: string, version?: string);
16
17
  /**
17
18
  * 记录信息日志
@@ -41,6 +42,7 @@ export declare class ScheduleModuleEx extends BaseModule implements Module, Sche
41
42
  * 获取所有日程列表
42
43
  */
43
44
  getScheduleList(): ScheduleItem[];
45
+ isScheduleListLoaded(): boolean;
44
46
  /**
45
47
  * 根据 schedule IDs 获取日程数据
46
48
  * 使用 Map 快速查询,时间复杂度 O(m),m 为 ids 数量
@@ -42,12 +42,13 @@ import_dayjs.default.extend(import_isSameOrBefore.default);
42
42
  import_dayjs.default.extend(import_isSameOrAfter.default);
43
43
  var SCHEDULE_STORE_NAME = "schedule";
44
44
  var ScheduleModuleEx = class extends import_BaseModule.BaseModule {
45
- // LoggerManager 实例
46
45
  constructor(name, version) {
47
46
  super(name, version);
48
47
  this.defaultName = "schedule";
49
48
  this.defaultVersion = "1.1.0";
50
49
  this.store = {};
50
+ // LoggerManager 实例
51
+ this.hasLoadedScheduleList = false;
51
52
  }
52
53
  /**
53
54
  * 记录信息日志
@@ -110,9 +111,11 @@ var ScheduleModuleEx = class extends import_BaseModule.BaseModule {
110
111
  if (options.initialState) {
111
112
  this.store.scheduleList = options.initialState.scheduleList;
112
113
  this.syncScheduleMap();
114
+ this.hasLoadedScheduleList = Array.isArray(options.initialState.scheduleList);
113
115
  } else {
114
116
  this.store.scheduleList = [];
115
117
  this.store.map = /* @__PURE__ */ new Map();
118
+ this.hasLoadedScheduleList = false;
116
119
  }
117
120
  const appPlugin = core.getPlugin("app");
118
121
  if (appPlugin) {
@@ -165,6 +168,7 @@ var ScheduleModuleEx = class extends import_BaseModule.BaseModule {
165
168
  }
166
169
  setScheduleList(list) {
167
170
  this.store.scheduleList = list;
171
+ this.hasLoadedScheduleList = true;
168
172
  this.syncScheduleMap();
169
173
  }
170
174
  /**
@@ -173,6 +177,9 @@ var ScheduleModuleEx = class extends import_BaseModule.BaseModule {
173
177
  getScheduleList() {
174
178
  return this.store.scheduleList;
175
179
  }
180
+ isScheduleListLoaded() {
181
+ return this.hasLoadedScheduleList;
182
+ }
176
183
  /**
177
184
  * 根据 schedule IDs 获取日程数据
178
185
  * 使用 Map 快速查询,时间复杂度 O(m),m 为 ids 数量
@@ -1,6 +1,6 @@
1
1
  import { Module, ModuleOptions, PisellCore } from '../../types';
2
2
  import { BaseModule } from '../../modules/BaseModule';
3
- import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesProductBookingPriceResult, BaseSalesScanCodeResult } from './types';
3
+ import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult } from './types';
4
4
  import { OrderModule } from '../../modules/Order';
5
5
  import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from '../../modules/Order/types';
6
6
  import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
@@ -44,6 +44,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
44
44
  protected currentSalesDetail: ISalesDetail | null;
45
45
  protected discountConfigCacheKey: string | null;
46
46
  protected hasManualDiscountSelection: boolean;
47
+ private readonly reusedSharedSubModuleNames;
47
48
  private paymentMethodsCache;
48
49
  constructor(name?: string, version?: string);
49
50
  /**
@@ -51,6 +52,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
51
52
  * 默认包含通用销售模块:products / order / salesSummary / schedule / payment / quotation。
52
53
  */
53
54
  protected getRegisteredModuleNames(): readonly string[];
55
+ private getReusableSharedSubModule;
56
+ private isScheduleListLoaded;
54
57
  /**
55
58
  * 记录信息日志
56
59
  */
@@ -66,10 +69,12 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
66
69
  private hydrateOrderPaymentNames;
67
70
  get payment(): PaymentModule | undefined;
68
71
  private getCurrentOrderCustomerId;
72
+ private normalizePriceContextCustomerId;
69
73
  private applyQuotationScheduleResolver;
70
74
  private loadQuotationForPriceQuery;
71
75
  private getPriceQueryProductId;
72
76
  private getPriceQuerySchedule;
77
+ private loadProductsForPriceQuery;
73
78
  private loadProductForPriceQuery;
74
79
  private getAuthoritativeBundleItems;
75
80
  private findAuthoritativeBundleItem;
@@ -268,8 +273,12 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
268
273
  }): Promise<T>;
269
274
  transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
270
275
  calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
276
+ getQuotationCustomerScopeInfo(): BaseSalesQuotationCustomerScopeInfo;
277
+ shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
278
+ calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
271
279
  addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput): Promise<import("../../modules/Order/types").OrderProduct[]>;
272
280
  updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
281
+ updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
273
282
  updateOrderProductQuantity(params: BaseSalesUpdateOrderProductQuantityParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
274
283
  updateOrderBooking(params: UpdateOrderBookingParams): any[];
275
284
  /**