@pisell/pisellos 2.3.69 → 2.3.71

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 (44) hide show
  1. package/dist/core/index.d.ts +0 -7
  2. package/dist/core/index.js +65 -109
  3. package/dist/modules/Order/index.d.ts +1 -1
  4. package/dist/modules/Order/types.d.ts +2 -0
  5. package/dist/modules/Order/types.js +1 -0
  6. package/dist/modules/Quotation/index.d.ts +0 -6
  7. package/dist/modules/Quotation/index.js +19 -75
  8. package/dist/plugins/request.d.ts +0 -1
  9. package/dist/server/index.d.ts +2 -8
  10. package/dist/server/index.js +140 -206
  11. package/dist/server/modules/floor-plan/index.d.ts +0 -4
  12. package/dist/server/modules/floor-plan/index.js +98 -240
  13. package/dist/server/modules/menu/index.js +23 -48
  14. package/dist/server/modules/order/index.d.ts +7 -17
  15. package/dist/server/modules/order/index.js +207 -419
  16. package/dist/server/modules/products/index.d.ts +2 -8
  17. package/dist/server/modules/products/index.js +75 -167
  18. package/dist/server/modules/resource/index.js +13 -21
  19. package/dist/solution/BaseSales/index.js +15 -4
  20. package/dist/solution/BookingByStep/index.d.ts +1 -1
  21. package/dist/solution/BookingTicket/index.d.ts +5 -15
  22. package/dist/solution/BookingTicket/index.js +21 -6
  23. package/lib/core/index.d.ts +0 -7
  24. package/lib/core/index.js +2 -20
  25. package/lib/modules/Order/index.d.ts +1 -1
  26. package/lib/modules/Order/types.d.ts +2 -0
  27. package/lib/modules/Quotation/index.d.ts +0 -6
  28. package/lib/modules/Quotation/index.js +5 -49
  29. package/lib/plugins/request.d.ts +0 -1
  30. package/lib/server/index.d.ts +2 -8
  31. package/lib/server/index.js +17 -52
  32. package/lib/server/modules/floor-plan/index.d.ts +0 -4
  33. package/lib/server/modules/floor-plan/index.js +6 -54
  34. package/lib/server/modules/menu/index.js +5 -31
  35. package/lib/server/modules/order/index.d.ts +7 -17
  36. package/lib/server/modules/order/index.js +40 -197
  37. package/lib/server/modules/products/index.d.ts +2 -8
  38. package/lib/server/modules/products/index.js +24 -97
  39. package/lib/server/modules/resource/index.js +2 -7
  40. package/lib/solution/BaseSales/index.js +4 -4
  41. package/lib/solution/BookingByStep/index.d.ts +1 -1
  42. package/lib/solution/BookingTicket/index.d.ts +5 -15
  43. package/lib/solution/BookingTicket/index.js +15 -5
  44. 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, _b, _c;
195
+ var _a;
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, _b2, _c2, _d, _e, _f;
214
+ var _a2, _b, _c, _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 = ((_b2 = (_a2 = params.scheduleModule).getScheduleList) == null ? void 0 : _b2.call(_a2)) || [];
220
+ const scheduleList = ((_b = (_a2 = params.scheduleModule).getScheduleList) == null ? void 0 : _b.call(_a2)) || [];
221
221
  for (const schedule of scheduleList) {
222
222
  this.quotationScheduleCache.set(String(schedule.id), schedule);
223
223
  }
@@ -226,21 +226,12 @@ 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 = (_c2 = params.scheduleModule).getScheduleListByIds) == null ? void 0 : _d.call(_c2, [id])) || ((_f = (_e = params.scheduleModule).getScheduleByIds) == null ? void 0 : _f.call(_e, [id])) || [];
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])) || [];
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
- });
244
235
  await this.refreshQuotationPriceBridge({ customer_id: params.customer_id });
245
236
  }
246
237
  /**
@@ -807,20 +798,17 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
807
798
  */
808
799
  clearPriceCache() {
809
800
  this.productsPriceCache.clear();
810
- this.quotationScheduleCache.clear();
811
- this.quotationScheduleCacheLoaded = false;
812
801
  console.log("[ProductsModule] 🗑️ 商品价格缓存已清空");
813
802
  }
814
803
  /**
815
804
  * 通过 ProductDataSource SSE 加载完整商品列表
816
805
  */
817
- async loadProductsByServer(options = {}) {
806
+ async loadProductsByServer() {
818
807
  if (!this.productDataSource) {
819
808
  this.logWarning("loadProductsByServer: ProductDataSource 不可用");
820
809
  return [];
821
810
  }
822
- const trigger = options.trigger || "unknown";
823
- this.logInfo("开始通过 DataSource SSE 加载商品列表", { trigger });
811
+ this.logInfo("开始通过 DataSource SSE 加载商品列表");
824
812
  const t0 = performance.now();
825
813
  try {
826
814
  const tSSE = performance.now();
@@ -828,7 +816,6 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
828
816
  const list = productList || [];
829
817
  (0, import_product.perfMark)("loadProductsByServer.SSE", performance.now() - tSSE, { count: list.length });
830
818
  this.logInfo("通过 DataSource SSE 加载商品列表成功", {
831
- trigger,
832
819
  productCount: list.length,
833
820
  duration: `${Math.round(performance.now() - t0)}ms`
834
821
  });
@@ -842,7 +829,6 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
842
829
  const errorMessage = error instanceof Error ? error.message : String(error);
843
830
  console.error("[Products] 加载商品数据失败:", error);
844
831
  this.logError("通过 DataSource SSE 加载商品列表失败", {
845
- trigger,
846
832
  duration: `${duration}ms`,
847
833
  error: errorMessage
848
834
  });
@@ -1033,9 +1019,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1033
1019
  async refreshProducts() {
1034
1020
  const tTotal = performance.now();
1035
1021
  this.logInfo("refreshProducts 开始");
1036
- const products = await this.loadProductsByServer({
1037
- trigger: "product_sync"
1038
- });
1022
+ const products = await this.loadProductsByServer();
1039
1023
  if (products && products.length > 0) {
1040
1024
  this.store.list = products;
1041
1025
  this.syncProductsMap();
@@ -1080,23 +1064,18 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1080
1064
  this.logWarning("loadProductsFromIndexDB: dbManager 不可用");
1081
1065
  return [];
1082
1066
  }
1083
- const startedAt = performance.now();
1084
1067
  try {
1068
+ const t0 = performance.now();
1085
1069
  const products = await this.dbManager.getAll(INDEXDB_STORE_NAME);
1086
- const durationMs = +(performance.now() - startedAt).toFixed(2);
1087
- (0, import_product.perfMark)("loadProductsFromIndexDB", durationMs, { count: (products == null ? void 0 : products.length) ?? 0 });
1070
+ (0, import_product.perfMark)("loadProductsFromIndexDB", performance.now() - t0, { count: (products == null ? void 0 : products.length) ?? 0 });
1088
1071
  this.logInfo("从 IndexDB 加载商品数据", {
1089
- productCount: (products == null ? void 0 : products.length) ?? 0,
1090
- durationMs
1072
+ productCount: (products == null ? void 0 : products.length) ?? 0
1091
1073
  });
1092
1074
  return products || [];
1093
1075
  } catch (error) {
1094
1076
  const errorMessage = error instanceof Error ? error.message : String(error);
1095
1077
  console.error("[Products] 从 IndexDB 读取数据失败:", error);
1096
- this.logError("从 IndexDB 读取数据失败", {
1097
- durationMs: +(performance.now() - startedAt).toFixed(2),
1098
- error: errorMessage
1099
- });
1078
+ this.logError("从 IndexDB 读取数据失败", { error: errorMessage });
1100
1079
  return [];
1101
1080
  }
1102
1081
  }
@@ -1124,54 +1103,22 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1124
1103
  this.logWarning("replaceProductsSnapshotInIndexDB: dbManager 不可用");
1125
1104
  return;
1126
1105
  }
1127
- const enqueuedAt = performance.now();
1128
- let queueWaitMs = 0;
1129
- let clearDurationMs = 0;
1130
- let writeDurationMs = 0;
1131
1106
  try {
1132
1107
  await this.runInProductIndexDBSaveQueue(async () => {
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
- }
1108
+ this.logInfo("replaceProductsSnapshotInIndexDB 开始", { source, productCount: products.length });
1109
+ const t0 = performance.now();
1110
+ await this.dbManager.clear(INDEXDB_STORE_NAME);
1146
1111
  if (products.length > 0) {
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
- }
1112
+ await this.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
1153
1113
  }
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
- });
1114
+ (0, import_product.perfMark)("replaceProductsSnapshotInIndexDB", performance.now() - t0, { count: products.length });
1115
+ this.logInfo("replaceProductsSnapshotInIndexDB 完成", { source, productCount: products.length });
1165
1116
  });
1166
1117
  } catch (error) {
1167
1118
  const errorMessage = error instanceof Error ? error.message : String(error);
1168
1119
  this.logError("全量保存商品到 IndexDB 失败", {
1169
1120
  source,
1170
1121
  productCount: products.length,
1171
- queueWaitMs,
1172
- clearDurationMs,
1173
- writeDurationMs,
1174
- totalDurationMs: +(performance.now() - enqueuedAt).toFixed(2),
1175
1122
  error: errorMessage
1176
1123
  });
1177
1124
  }
@@ -1253,7 +1200,6 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1253
1200
  source: "IndexDB"
1254
1201
  });
1255
1202
  this.logInfo("预加载完成(从 IndexDB)", {
1256
- trigger: "preload",
1257
1203
  productCount: cachedData.length,
1258
1204
  duration: `${Math.round(performance.now() - tTotal)}ms`,
1259
1205
  source: "IndexDB"
@@ -1269,9 +1215,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1269
1215
  this.logWarning("从 IndexDB 加载数据失败,准备从服务器加载", { error: errorMessage });
1270
1216
  }
1271
1217
  const tServer = performance.now();
1272
- const products = await this.loadProductsByServer({
1273
- trigger: "preload"
1274
- });
1218
+ const products = await this.loadProductsByServer();
1275
1219
  (0, import_product.perfMark)("preload.loadFromServer", performance.now() - tServer, { count: (products == null ? void 0 : products.length) ?? 0 });
1276
1220
  if (products && products.length > 0) {
1277
1221
  this.store.list = products;
@@ -1284,7 +1228,6 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1284
1228
  source: "Server"
1285
1229
  });
1286
1230
  this.logInfo("预加载完成(从服务器)", {
1287
- trigger: "preload",
1288
1231
  productCount: products.length,
1289
1232
  duration: `${Math.round(performance.now() - tTotal)}ms`,
1290
1233
  source: "Server"
@@ -1649,31 +1592,17 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1649
1592
  * 拿到完整数据后一次性替换 store,清除价格缓存,触发 onProductsSyncCompleted
1650
1593
  * @returns 刷新后的商品列表
1651
1594
  */
1652
- async silentRefresh(options = {}) {
1595
+ async silentRefresh() {
1653
1596
  const t0 = performance.now();
1654
1597
  const now = Date.now();
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
- });
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) {
1667
1601
  return this.store.list;
1668
1602
  }
1669
- this.logInfo("silentRefresh 开始", {
1670
- trigger,
1671
- elapsedSincePreloadMs,
1672
- elapsedSinceFullFetchMs,
1673
- productCount: this.store.list.length
1674
- });
1603
+ this.logInfo("silentRefresh 开始");
1675
1604
  try {
1676
- const products = await this.loadProductsByServer({ trigger });
1605
+ const products = await this.loadProductsByServer();
1677
1606
  if (products && products.length > 0) {
1678
1607
  this.store.list = products;
1679
1608
  this.syncProductsMap();
@@ -1681,7 +1610,6 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1681
1610
  this.core.effects.emit(import_types.ProductsHooks.onProductsChanged, this.store.list);
1682
1611
  await this.core.effects.emit(import_types.ProductsHooks.onProductsSyncCompleted, null);
1683
1612
  this.logInfo("silentRefresh 完成", {
1684
- trigger,
1685
1613
  productCount: products.length,
1686
1614
  duration: `${Math.round(performance.now() - t0)}ms`
1687
1615
  });
@@ -1693,7 +1621,6 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
1693
1621
  } catch (error) {
1694
1622
  const errorMessage = error instanceof Error ? error.message : String(error);
1695
1623
  this.logError("silentRefresh 失败", {
1696
- trigger,
1697
1624
  duration: `${Math.round(performance.now() - t0)}ms`,
1698
1625
  error: errorMessage
1699
1626
  });
@@ -88,18 +88,13 @@ var ResourceModule = class extends import_BaseModule.BaseModule {
88
88
  }
89
89
  }
90
90
  async preload() {
91
+ await this.setupResourceSync();
91
92
  const cachedResources = await this.loadResourcesFromSQLite();
92
93
  if (cachedResources.length > 0) {
93
94
  this.store.list = (0, import_lodash_es.cloneDeep)(cachedResources).map((item) => this.normalizeResource(item));
94
95
  this.syncResourcesMap();
95
96
  await this.safeEmit(import_types.ResourceHooks.onResourcesChanged, this.store.list);
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) {
97
+ } else {
103
98
  const resources = await this.loadResourcesByServer();
104
99
  if (resources.length > 0) {
105
100
  this.store.list = (0, import_lodash_es.cloneDeep)(resources).map((item) => this.normalizeResource(item));
@@ -1494,13 +1494,13 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1494
1494
  const hasDraftProduct = params.products.some((product) => !this.isPersistedOrderProduct(product));
1495
1495
  if (hasDraftProduct)
1496
1496
  return false;
1497
- const hasSelectedDiscount = params.currentDiscountList.some(
1498
- (discount) => discount.isSelected || discount.isEditMode || discount.isManualSelect
1497
+ const hasRuntimeDiscountSelection = params.currentDiscountList.some(
1498
+ (discount) => !discount.isEditMode && (discount.isSelected || discount.isManualSelect)
1499
1499
  );
1500
- if (hasSelectedDiscount)
1500
+ if (hasRuntimeDiscountSelection)
1501
1501
  return false;
1502
1502
  return !params.nextDiscountList.some(
1503
- (discount) => discount.isSelected || discount.isEditMode || discount.isManualSelect
1503
+ (discount) => !discount.isEditMode && (discount.isSelected || discount.isManualSelect)
1504
1504
  );
1505
1505
  }
1506
1506
  mergeCurrentDiscountSelectionState(discountList, currentDiscountList) {
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 1 | 5 | 2 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -3,7 +3,7 @@ import { BookingTicketCartView, BookingTicketProductCatalogView, BookingTicketSt
3
3
  import type { ProductData } from '../../modules';
4
4
  import type { OpenDataConfig } from '../../modules/OpenData';
5
5
  import { type BookingContextConfig, type BookingContextDateInput, type BookingContextResource, type BookingContextResourceMap, type BookingContextState, type InitBookingContextParams, type LoadBookingConfigParams, type LoadBookingResourcesParams, type ResourceError, type BookingCalcContext } from '../../modules/BookingContext';
6
- import type { OrderCustomerView } from '../../modules/Order/types';
6
+ import type { OrderCustomerView, OrderCustomerChangePayload } from '../../modules/Order/types';
7
7
  import { BaseSalesImpl } from '../BaseSales';
8
8
  import type { BaseSalesScanCodeResult } from '../BaseSales/types';
9
9
  import type { ISalesDetail } from '../BaseSales/utils/parseSalesResponse';
@@ -260,7 +260,9 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
260
260
  * 同时透传 OrderModule 内部 emit 的 `order:onOrderCustomerChange` 之外,
261
261
  * 在 BookingTicket 命名空间也 emit 一次,方便上层统一从 Solution 订阅。
262
262
  */
263
- setOrderCustomer(customer: ICustomer | null): void;
263
+ setOrderCustomer(customer: ICustomer | null, options?: {
264
+ source?: OrderCustomerChangePayload['source'];
265
+ }): void;
264
266
  /**
265
267
  * 读取 tempOrder 上的下单客户协议字段;customer_id 缺失时返回 null。
266
268
  */
@@ -451,19 +453,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
451
453
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
452
454
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
453
455
  */
454
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
455
- action: "reloadCatalog";
456
- } | {
457
- action: "add";
458
- cacheItem: any;
459
- } | {
460
- action: "requiresDetail";
461
- payload: AddProductRequiresDetailPayload;
462
- } | {
463
- action: "requiresBookingEdit";
464
- cacheItem: any;
465
- payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
466
- };
456
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
467
457
  /** 规格弹窗 callback 后的第二段决策。 */
468
458
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
469
459
  /**
@@ -343,7 +343,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
343
343
  country_calling_code: selectedCustomer == null ? void 0 : selectedCustomer.country_calling_code
344
344
  };
345
345
  customerModule.setSelectedCustomer(customer);
346
- this.setOrderCustomer(customer);
346
+ this.setOrderCustomer(customer, { source: "detailHydrate" });
347
347
  }
348
348
  return sales;
349
349
  }
@@ -392,7 +392,11 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
392
392
  }
393
393
  getDiscountCustomerId(discounts) {
394
394
  for (const item of discounts) {
395
- const topLevelId = Number(item.customer_id);
395
+ const rawCustomerId = item.customer_id;
396
+ if (!rawCustomerId || (0, import_cartView.isWalkInCustomer)({ id: rawCustomerId })) {
397
+ continue;
398
+ }
399
+ const topLevelId = Number(rawCustomerId);
396
400
  if (Number.isFinite(topLevelId) && topLevelId > 0) {
397
401
  return topLevelId;
398
402
  }
@@ -891,7 +895,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
891
895
  * 同时透传 OrderModule 内部 emit 的 `order:onOrderCustomerChange` 之外,
892
896
  * 在 BookingTicket 命名空间也 emit 一次,方便上层统一从 Solution 订阅。
893
897
  */
894
- setOrderCustomer(customer) {
898
+ setOrderCustomer(customer, options) {
895
899
  var _a;
896
900
  if (!customer) {
897
901
  this.clearOrderCustomer();
@@ -911,12 +915,18 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
911
915
  const snapshotReplenished = !snapshotBeforeSet && Boolean(snapshotAfterOrderSet);
912
916
  if (snapshotReplenished) {
913
917
  const next2 = this.buildOrderCustomerPayload();
914
- this.core.effects.emit(`${this.name}:onOrderCustomerChange`, next2);
918
+ this.core.effects.emit(
919
+ `${this.name}:onOrderCustomerChange`,
920
+ next2 && (options == null ? void 0 : options.source) ? { ...next2, source: options.source } : next2
921
+ );
915
922
  }
916
923
  return;
917
924
  }
918
925
  const next = this.buildOrderCustomerPayload();
919
- this.core.effects.emit(`${this.name}:onOrderCustomerChange`, next);
926
+ this.core.effects.emit(
927
+ `${this.name}:onOrderCustomerChange`,
928
+ next && (options == null ? void 0 : options.source) ? { ...next, source: options.source } : next
929
+ );
920
930
  this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
921
931
  const promotionRefreshTask = this.store.order.applyPromotion().then(() => void 0);
922
932
  this.orderCustomerPromotionRefreshInFlight = promotionRefreshTask;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.69",
4
+ "version": "2.3.71",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",