@pisell/pisellos 2.3.68 → 2.3.69

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 (39) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +109 -65
  3. package/dist/modules/Quotation/index.d.ts +6 -0
  4. package/dist/modules/Quotation/index.js +75 -19
  5. package/dist/plugins/request.d.ts +1 -0
  6. package/dist/server/index.d.ts +8 -2
  7. package/dist/server/index.js +206 -140
  8. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  9. package/dist/server/modules/floor-plan/index.js +240 -98
  10. package/dist/server/modules/menu/index.js +48 -23
  11. package/dist/server/modules/order/index.d.ts +17 -7
  12. package/dist/server/modules/order/index.js +419 -207
  13. package/dist/server/modules/products/index.d.ts +8 -2
  14. package/dist/server/modules/products/index.js +167 -75
  15. package/dist/server/modules/resource/index.js +21 -13
  16. package/dist/solution/BaseSales/index.d.ts +10 -0
  17. package/dist/solution/BaseSales/index.js +861 -806
  18. package/dist/solution/BookingTicket/index.d.ts +3 -1
  19. package/dist/solution/BookingTicket/index.js +187 -149
  20. package/lib/core/index.d.ts +7 -0
  21. package/lib/core/index.js +20 -2
  22. package/lib/modules/Quotation/index.d.ts +6 -0
  23. package/lib/modules/Quotation/index.js +49 -5
  24. package/lib/plugins/request.d.ts +1 -0
  25. package/lib/server/index.d.ts +8 -2
  26. package/lib/server/index.js +52 -17
  27. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  28. package/lib/server/modules/floor-plan/index.js +54 -6
  29. package/lib/server/modules/menu/index.js +31 -5
  30. package/lib/server/modules/order/index.d.ts +17 -7
  31. package/lib/server/modules/order/index.js +197 -40
  32. package/lib/server/modules/products/index.d.ts +8 -2
  33. package/lib/server/modules/products/index.js +97 -24
  34. package/lib/server/modules/resource/index.js +7 -2
  35. package/lib/solution/BaseSales/index.d.ts +10 -0
  36. package/lib/solution/BaseSales/index.js +32 -2
  37. package/lib/solution/BookingTicket/index.d.ts +3 -1
  38. package/lib/solution/BookingTicket/index.js +12 -0
  39. package/package.json +1 -1
@@ -192,7 +192,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
192
192
  * Server 层负责传入完整 schedule 模块,Products 只负责把报价单计算结果转成价格响应形状。
193
193
  */
194
194
  async setupQuotationPriceBridge(params) {
195
- var _a;
195
+ var _a, _b, _c;
196
196
  if (!this.core) {
197
197
  this.logWarning("setupQuotationPriceBridge: core 尚未初始化");
198
198
  return;
@@ -211,13 +211,13 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
211
211
  this.quotationScheduleCacheSource = params.scheduleModule;
212
212
  }
213
213
  this.quotationPriceBridge.setScheduleResolver((id) => {
214
- var _a2, _b, _c, _d, _e, _f;
214
+ var _a2, _b2, _c2, _d, _e, _f;
215
215
  const scheduleId = String(id);
216
216
  if (this.quotationScheduleCache.has(scheduleId)) {
217
217
  return this.quotationScheduleCache.get(scheduleId);
218
218
  }
219
219
  if (!this.quotationScheduleCacheLoaded) {
220
- const scheduleList = ((_b = (_a2 = params.scheduleModule).getScheduleList) == null ? void 0 : _b.call(_a2)) || [];
220
+ const scheduleList = ((_b2 = (_a2 = params.scheduleModule).getScheduleList) == null ? void 0 : _b2.call(_a2)) || [];
221
221
  for (const schedule of scheduleList) {
222
222
  this.quotationScheduleCache.set(String(schedule.id), schedule);
223
223
  }
@@ -226,12 +226,21 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
226
226
  if (this.quotationScheduleCache.has(scheduleId)) {
227
227
  return this.quotationScheduleCache.get(scheduleId);
228
228
  }
229
- 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])) || [];
229
+ const schedules = ((_d = (_c2 = params.scheduleModule).getScheduleListByIds) == null ? void 0 : _d.call(_c2, [id])) || ((_f = (_e = params.scheduleModule).getScheduleByIds) == null ? void 0 : _f.call(_e, [id])) || [];
230
230
  if (schedules[0])
231
231
  this.quotationScheduleCache.set(scheduleId, schedules[0]);
232
232
  return schedules[0];
233
233
  });
234
234
  }
235
+ if (params.onQuotationUpdated) {
236
+ this.quotationBridgeUpdatedCallback = params.onQuotationUpdated;
237
+ }
238
+ (_c = (_b = this.quotationPriceBridge).setQuotationListUpdatedListener) == null ? void 0 : _c.call(_b, () => {
239
+ var _a2;
240
+ this.quotationBridgeLoadedKey = this.getQuotationBridgeScopeKey();
241
+ this.clearPriceCache();
242
+ (_a2 = this.quotationBridgeUpdatedCallback) == null ? void 0 : _a2.call(this);
243
+ });
235
244
  await this.refreshQuotationPriceBridge({ customer_id: params.customer_id });
236
245
  }
237
246
  /**
@@ -798,17 +807,20 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
798
807
  */
799
808
  clearPriceCache() {
800
809
  this.productsPriceCache.clear();
810
+ this.quotationScheduleCache.clear();
811
+ this.quotationScheduleCacheLoaded = false;
801
812
  console.log("[ProductsModule] 🗑️ 商品价格缓存已清空");
802
813
  }
803
814
  /**
804
815
  * 通过 ProductDataSource SSE 加载完整商品列表
805
816
  */
806
- async loadProductsByServer() {
817
+ async loadProductsByServer(options = {}) {
807
818
  if (!this.productDataSource) {
808
819
  this.logWarning("loadProductsByServer: ProductDataSource 不可用");
809
820
  return [];
810
821
  }
811
- this.logInfo("开始通过 DataSource SSE 加载商品列表");
822
+ const trigger = options.trigger || "unknown";
823
+ this.logInfo("开始通过 DataSource SSE 加载商品列表", { trigger });
812
824
  const t0 = performance.now();
813
825
  try {
814
826
  const tSSE = performance.now();
@@ -816,6 +828,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
816
828
  const list = productList || [];
817
829
  (0, import_product.perfMark)("loadProductsByServer.SSE", performance.now() - tSSE, { count: list.length });
818
830
  this.logInfo("通过 DataSource SSE 加载商品列表成功", {
831
+ trigger,
819
832
  productCount: list.length,
820
833
  duration: `${Math.round(performance.now() - t0)}ms`
821
834
  });
@@ -829,6 +842,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
829
842
  const errorMessage = error instanceof Error ? error.message : String(error);
830
843
  console.error("[Products] 加载商品数据失败:", error);
831
844
  this.logError("通过 DataSource SSE 加载商品列表失败", {
845
+ trigger,
832
846
  duration: `${duration}ms`,
833
847
  error: errorMessage
834
848
  });
@@ -1019,7 +1033,9 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1019
1033
  async refreshProducts() {
1020
1034
  const tTotal = performance.now();
1021
1035
  this.logInfo("refreshProducts 开始");
1022
- const products = await this.loadProductsByServer();
1036
+ const products = await this.loadProductsByServer({
1037
+ trigger: "product_sync"
1038
+ });
1023
1039
  if (products && products.length > 0) {
1024
1040
  this.store.list = products;
1025
1041
  this.syncProductsMap();
@@ -1064,18 +1080,23 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1064
1080
  this.logWarning("loadProductsFromIndexDB: dbManager 不可用");
1065
1081
  return [];
1066
1082
  }
1083
+ const startedAt = performance.now();
1067
1084
  try {
1068
- const t0 = performance.now();
1069
1085
  const products = await this.dbManager.getAll(INDEXDB_STORE_NAME);
1070
- (0, import_product.perfMark)("loadProductsFromIndexDB", performance.now() - t0, { count: (products == null ? void 0 : products.length) ?? 0 });
1086
+ const durationMs = +(performance.now() - startedAt).toFixed(2);
1087
+ (0, import_product.perfMark)("loadProductsFromIndexDB", durationMs, { count: (products == null ? void 0 : products.length) ?? 0 });
1071
1088
  this.logInfo("从 IndexDB 加载商品数据", {
1072
- productCount: (products == null ? void 0 : products.length) ?? 0
1089
+ productCount: (products == null ? void 0 : products.length) ?? 0,
1090
+ durationMs
1073
1091
  });
1074
1092
  return products || [];
1075
1093
  } catch (error) {
1076
1094
  const errorMessage = error instanceof Error ? error.message : String(error);
1077
1095
  console.error("[Products] 从 IndexDB 读取数据失败:", error);
1078
- this.logError("从 IndexDB 读取数据失败", { error: errorMessage });
1096
+ this.logError("从 IndexDB 读取数据失败", {
1097
+ durationMs: +(performance.now() - startedAt).toFixed(2),
1098
+ error: errorMessage
1099
+ });
1079
1100
  return [];
1080
1101
  }
1081
1102
  }
@@ -1103,22 +1124,54 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1103
1124
  this.logWarning("replaceProductsSnapshotInIndexDB: dbManager 不可用");
1104
1125
  return;
1105
1126
  }
1127
+ const enqueuedAt = performance.now();
1128
+ let queueWaitMs = 0;
1129
+ let clearDurationMs = 0;
1130
+ let writeDurationMs = 0;
1106
1131
  try {
1107
1132
  await this.runInProductIndexDBSaveQueue(async () => {
1108
- this.logInfo("replaceProductsSnapshotInIndexDB 开始", { source, productCount: products.length });
1109
- const t0 = performance.now();
1110
- await this.dbManager.clear(INDEXDB_STORE_NAME);
1133
+ const operationStartedAt = performance.now();
1134
+ queueWaitMs = +(operationStartedAt - enqueuedAt).toFixed(2);
1135
+ this.logInfo("replaceProductsSnapshotInIndexDB 开始", {
1136
+ source,
1137
+ productCount: products.length,
1138
+ queueWaitMs
1139
+ });
1140
+ const clearStartedAt = performance.now();
1141
+ try {
1142
+ await this.dbManager.clear(INDEXDB_STORE_NAME);
1143
+ } finally {
1144
+ clearDurationMs = +(performance.now() - clearStartedAt).toFixed(2);
1145
+ }
1111
1146
  if (products.length > 0) {
1112
- await this.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
1147
+ const writeStartedAt = performance.now();
1148
+ try {
1149
+ await this.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
1150
+ } finally {
1151
+ writeDurationMs = +(performance.now() - writeStartedAt).toFixed(2);
1152
+ }
1113
1153
  }
1114
- (0, import_product.perfMark)("replaceProductsSnapshotInIndexDB", performance.now() - t0, { count: products.length });
1115
- this.logInfo("replaceProductsSnapshotInIndexDB 完成", { source, productCount: products.length });
1154
+ const executeDurationMs = +(performance.now() - operationStartedAt).toFixed(2);
1155
+ (0, import_product.perfMark)("replaceProductsSnapshotInIndexDB", executeDurationMs, { count: products.length });
1156
+ this.logInfo("replaceProductsSnapshotInIndexDB 完成", {
1157
+ source,
1158
+ productCount: products.length,
1159
+ queueWaitMs,
1160
+ clearDurationMs,
1161
+ writeDurationMs,
1162
+ executeDurationMs,
1163
+ totalDurationMs: +(performance.now() - enqueuedAt).toFixed(2)
1164
+ });
1116
1165
  });
1117
1166
  } catch (error) {
1118
1167
  const errorMessage = error instanceof Error ? error.message : String(error);
1119
1168
  this.logError("全量保存商品到 IndexDB 失败", {
1120
1169
  source,
1121
1170
  productCount: products.length,
1171
+ queueWaitMs,
1172
+ clearDurationMs,
1173
+ writeDurationMs,
1174
+ totalDurationMs: +(performance.now() - enqueuedAt).toFixed(2),
1122
1175
  error: errorMessage
1123
1176
  });
1124
1177
  }
@@ -1200,6 +1253,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1200
1253
  source: "IndexDB"
1201
1254
  });
1202
1255
  this.logInfo("预加载完成(从 IndexDB)", {
1256
+ trigger: "preload",
1203
1257
  productCount: cachedData.length,
1204
1258
  duration: `${Math.round(performance.now() - tTotal)}ms`,
1205
1259
  source: "IndexDB"
@@ -1215,7 +1269,9 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1215
1269
  this.logWarning("从 IndexDB 加载数据失败,准备从服务器加载", { error: errorMessage });
1216
1270
  }
1217
1271
  const tServer = performance.now();
1218
- const products = await this.loadProductsByServer();
1272
+ const products = await this.loadProductsByServer({
1273
+ trigger: "preload"
1274
+ });
1219
1275
  (0, import_product.perfMark)("preload.loadFromServer", performance.now() - tServer, { count: (products == null ? void 0 : products.length) ?? 0 });
1220
1276
  if (products && products.length > 0) {
1221
1277
  this.store.list = products;
@@ -1228,6 +1284,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1228
1284
  source: "Server"
1229
1285
  });
1230
1286
  this.logInfo("预加载完成(从服务器)", {
1287
+ trigger: "preload",
1231
1288
  productCount: products.length,
1232
1289
  duration: `${Math.round(performance.now() - tTotal)}ms`,
1233
1290
  source: "Server"
@@ -1592,17 +1649,31 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1592
1649
  * 拿到完整数据后一次性替换 store,清除价格缓存,触发 onProductsSyncCompleted
1593
1650
  * @returns 刷新后的商品列表
1594
1651
  */
1595
- async silentRefresh() {
1652
+ async silentRefresh(options = {}) {
1596
1653
  const t0 = performance.now();
1597
1654
  const now = Date.now();
1598
- const elapsedSincePreload = now - this.lastPreloadCompletedAtMs;
1599
- const elapsedSinceFullFetch = now - this.lastServerFullFetchAtMs;
1600
- if (this.lastPreloadCompletedAtMs > 0 && elapsedSincePreload < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS || this.lastServerFullFetchAtMs > 0 && elapsedSinceFullFetch < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS) {
1655
+ const trigger = options.trigger || "background";
1656
+ const elapsedSincePreloadMs = now - this.lastPreloadCompletedAtMs;
1657
+ const elapsedSinceFullFetchMs = now - this.lastServerFullFetchAtMs;
1658
+ if (this.lastPreloadCompletedAtMs > 0 && elapsedSincePreloadMs < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS || this.lastServerFullFetchAtMs > 0 && elapsedSinceFullFetchMs < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS) {
1659
+ this.logInfo("silentRefresh 跳过全量 SSE", {
1660
+ trigger,
1661
+ reason: "within_min_interval",
1662
+ minIntervalMs: PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS,
1663
+ elapsedSincePreloadMs,
1664
+ elapsedSinceFullFetchMs,
1665
+ productCount: this.store.list.length
1666
+ });
1601
1667
  return this.store.list;
1602
1668
  }
1603
- this.logInfo("silentRefresh 开始");
1669
+ this.logInfo("silentRefresh 开始", {
1670
+ trigger,
1671
+ elapsedSincePreloadMs,
1672
+ elapsedSinceFullFetchMs,
1673
+ productCount: this.store.list.length
1674
+ });
1604
1675
  try {
1605
- const products = await this.loadProductsByServer();
1676
+ const products = await this.loadProductsByServer({ trigger });
1606
1677
  if (products && products.length > 0) {
1607
1678
  this.store.list = products;
1608
1679
  this.syncProductsMap();
@@ -1610,6 +1681,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1610
1681
  this.core.effects.emit(import_types.ProductsHooks.onProductsChanged, this.store.list);
1611
1682
  await this.core.effects.emit(import_types.ProductsHooks.onProductsSyncCompleted, null);
1612
1683
  this.logInfo("silentRefresh 完成", {
1684
+ trigger,
1613
1685
  productCount: products.length,
1614
1686
  duration: `${Math.round(performance.now() - t0)}ms`
1615
1687
  });
@@ -1621,6 +1693,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1621
1693
  } catch (error) {
1622
1694
  const errorMessage = error instanceof Error ? error.message : String(error);
1623
1695
  this.logError("silentRefresh 失败", {
1696
+ trigger,
1624
1697
  duration: `${Math.round(performance.now() - t0)}ms`,
1625
1698
  error: errorMessage
1626
1699
  });
@@ -88,13 +88,18 @@ var ResourceModule = class extends import_BaseModule.BaseModule {
88
88
  }
89
89
  }
90
90
  async preload() {
91
- await this.setupResourceSync();
92
91
  const cachedResources = await this.loadResourcesFromSQLite();
93
92
  if (cachedResources.length > 0) {
94
93
  this.store.list = (0, import_lodash_es.cloneDeep)(cachedResources).map((item) => this.normalizeResource(item));
95
94
  this.syncResourcesMap();
96
95
  await this.safeEmit(import_types.ResourceHooks.onResourcesChanged, this.store.list);
97
- } else {
96
+ void this.setupResourceSync().catch((error) => {
97
+ this.logError("后台初始化资源同步失败", error);
98
+ });
99
+ return;
100
+ }
101
+ await this.setupResourceSync();
102
+ if (this.store.list.length === 0) {
98
103
  const resources = await this.loadResourcesByServer();
99
104
  if (resources.length > 0) {
100
105
  this.store.list = (0, import_lodash_es.cloneDeep)(resources).map((item) => this.normalizeResource(item));
@@ -119,6 +119,15 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
119
119
  * application_code 仅作为接口兼容字段,不能替代 channel / business_code。
120
120
  */
121
121
  private getPriceQueryStrategyContext;
122
+ /**
123
+ * 子类可在商品重报价前准备客户维度的策略上下文,例如等待 Wallet/优惠资产加载。
124
+ */
125
+ protected prepareProductPriceQueryContext(_customerId?: number | string): Promise<void>;
126
+ /**
127
+ * 默认保留 BaseSales 的 legacy quotation 行为;已由 /product/query 统一完成
128
+ * 智能定价与报价合并的业务可在子类中覆盖,避免二次覆盖权威价格。
129
+ */
130
+ protected preferAuthoritativeProductQueryPrice(): boolean;
122
131
  private getPriceQuerySchedule;
123
132
  private loadProductsForPriceQuery;
124
133
  private loadProductForPriceQuery;
@@ -436,6 +445,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
436
445
  transformBaseProductToOrderProduct(params: TransformBaseProductToOrderProductParams): import("./utils/transformBaseProductToOrderProduct").BaseProductOrderProductInput | null;
437
446
  calculateProductBookingPrice(params: BaseSalesCalculateProductBookingPriceParams): Promise<BaseSalesProductBookingPriceResult>;
438
447
  getQuotationCustomerScopeInfo(): BaseSalesQuotationCustomerScopeInfo;
448
+ private hasSmartPricingStrategies;
439
449
  shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
440
450
  calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
441
451
  addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
@@ -734,8 +734,24 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
734
734
  if (businessCode !== void 0 && businessCode !== null && String(businessCode).trim() !== "") {
735
735
  strategyContext.business_code = String(businessCode).trim();
736
736
  }
737
+ const availableWalletIds = this.getAvailableWalletIds();
738
+ if (availableWalletIds.length > 0 && !Array.isArray(strategyContext.available_wallet_ids)) {
739
+ strategyContext.available_wallet_ids = availableWalletIds;
740
+ }
737
741
  return strategyContext;
738
742
  }
743
+ /**
744
+ * 子类可在商品重报价前准备客户维度的策略上下文,例如等待 Wallet/优惠资产加载。
745
+ */
746
+ async prepareProductPriceQueryContext(_customerId) {
747
+ }
748
+ /**
749
+ * 默认保留 BaseSales 的 legacy quotation 行为;已由 /product/query 统一完成
750
+ * 智能定价与报价合并的业务可在子类中覆盖,避免二次覆盖权威价格。
751
+ */
752
+ preferAuthoritativeProductQueryPrice() {
753
+ return false;
754
+ }
739
755
  getPriceQuerySchedule(params) {
740
756
  const booking = params.booking || {};
741
757
  if (typeof booking.start_date === "string" && booking.start_date.trim()) {
@@ -3129,6 +3145,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3129
3145
  async calculateProductBookingPrice(params) {
3130
3146
  const quotation = this.store.quotation;
3131
3147
  const customerId = params.customer_id ?? this.getCurrentOrderCustomerId();
3148
+ await this.prepareProductPriceQueryContext(customerId);
3132
3149
  const authoritativeProduct = await this.loadProductForPriceQuery(params, customerId);
3133
3150
  const product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
3134
3151
  await this.loadQuotationForPriceQuery({
@@ -3141,7 +3158,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3141
3158
  product,
3142
3159
  fallback_price: authoritativeProduct ? void 0 : params.fallback_price,
3143
3160
  customer_id: customerId,
3144
- quotation
3161
+ quotation: authoritativeProduct && this.preferAuthoritativeProductQueryPrice() ? void 0 : quotation
3145
3162
  });
3146
3163
  }
3147
3164
  getQuotationCustomerScopeInfo() {
@@ -3178,11 +3195,23 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3178
3195
  quotationScopes
3179
3196
  };
3180
3197
  }
3198
+ hasSmartPricingStrategies() {
3199
+ var _a, _b;
3200
+ const evaluator = (_b = (_a = this.core) == null ? void 0 : _a.context) == null ? void 0 : _b.dataVariantEvaluator;
3201
+ if (!evaluator || typeof evaluator.getStrategyConfigs !== "function") {
3202
+ return false;
3203
+ }
3204
+ const configs = evaluator.getStrategyConfigs();
3205
+ return Array.isArray(configs) && configs.length > 0;
3206
+ }
3181
3207
  shouldRecalculateProductBookingPricesForContextChange(params) {
3182
3208
  const scopeInfo = this.getQuotationCustomerScopeInfo();
3183
3209
  const scopedCustomerIds = new Set(scopeInfo.customerIds.map((id) => String(id)));
3184
3210
  const previousCustomerId = this.normalizePriceContextCustomerId(params.previousCustomerId);
3185
3211
  const nextCustomerId = this.normalizePriceContextCustomerId(params.nextCustomerId);
3212
+ if (this.hasSmartPricingStrategies()) {
3213
+ return previousCustomerId !== nextCustomerId;
3214
+ }
3186
3215
  const previousInScope = previousCustomerId ? scopedCustomerIds.has(previousCustomerId) : false;
3187
3216
  const nextInScope = nextCustomerId ? scopedCustomerIds.has(nextCustomerId) : false;
3188
3217
  let shouldRecalculate = false;
@@ -3203,6 +3232,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3203
3232
  return [];
3204
3233
  const quotation = this.store.quotation;
3205
3234
  const customerId = ((_a = paramsList[0]) == null ? void 0 : _a.customer_id) ?? this.getCurrentOrderCustomerId();
3235
+ await this.prepareProductPriceQueryContext(customerId);
3206
3236
  const productMapsByGroup = /* @__PURE__ */ new Map();
3207
3237
  const groups = /* @__PURE__ */ new Map();
3208
3238
  paramsList.forEach((params) => {
@@ -3260,7 +3290,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3260
3290
  product,
3261
3291
  fallback_price: authoritativeProduct ? void 0 : params.fallback_price,
3262
3292
  customer_id: customerId,
3263
- quotation
3293
+ quotation: authoritativeProduct && this.preferAuthoritativeProductQueryPrice() ? void 0 : quotation
3264
3294
  });
3265
3295
  });
3266
3296
  }
@@ -287,6 +287,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
287
287
  private buildOrderCustomerPayload;
288
288
  protected refreshDiscountConfigAfterOrderCustomerChange(customerId: number | null): Promise<void>;
289
289
  protected waitForOrderCustomerPromotionRefresh(): Promise<void>;
290
+ protected prepareProductPriceQueryContext(customerId?: number | string): Promise<void>;
291
+ protected preferAuthoritativeProductQueryPrice(): boolean;
290
292
  /**
291
293
  * 获取客户分页信息
292
294
  * @returns 分页信息
@@ -330,7 +332,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
330
332
  * 获取当前的客户搜索条件
331
333
  * @returns 当前搜索条件
332
334
  */
333
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
335
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
334
336
  /**
335
337
  * 获取客户列表状态(包含滚动加载相关状态)
336
338
  * @returns 客户状态
@@ -1036,6 +1036,18 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1036
1036
  waitForOrderCustomerPromotionRefresh() {
1037
1037
  return this.orderCustomerPromotionRefreshInFlight || Promise.resolve();
1038
1038
  }
1039
+ async prepareProductPriceQueryContext(customerId) {
1040
+ await Promise.resolve();
1041
+ const normalizedCustomerId = Number(customerId || 0);
1042
+ const refreshTask = this.orderCustomerDiscountRefreshInFlight;
1043
+ const shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
1044
+ if (shouldWait && refreshTask) {
1045
+ await refreshTask;
1046
+ }
1047
+ }
1048
+ preferAuthoritativeProductQueryPrice() {
1049
+ return true;
1050
+ }
1039
1051
  /**
1040
1052
  * 获取客户分页信息
1041
1053
  * @returns 分页信息
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.68",
4
+ "version": "2.3.69",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",