@pisell/pisellos 2.3.63 → 2.3.64

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 (37) hide show
  1. package/dist/core/index.js +0 -1
  2. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
  4. package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
  5. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
  6. package/dist/modules/Customer/index.d.ts +4 -0
  7. package/dist/modules/Customer/index.js +91 -59
  8. package/dist/modules/Customer/types.d.ts +2 -0
  9. package/dist/modules/Order/index.js +4 -1
  10. package/dist/modules/Order/utils.js +36 -30
  11. package/dist/modules/Payment/walletpass.js +4 -5
  12. package/dist/server/index.js +1 -1
  13. package/dist/server/modules/order/index.d.ts +1 -0
  14. package/dist/server/modules/order/index.js +252 -94
  15. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  16. package/dist/solution/BookingByStep/index.d.ts +1 -1
  17. package/dist/solution/BookingTicket/index.d.ts +2 -0
  18. package/dist/solution/BookingTicket/index.js +34 -10
  19. package/lib/core/index.js +0 -1
  20. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  21. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
  22. package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
  23. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
  24. package/lib/modules/Customer/index.d.ts +4 -0
  25. package/lib/modules/Customer/index.js +11 -0
  26. package/lib/modules/Customer/types.d.ts +2 -0
  27. package/lib/modules/Order/index.js +3 -2
  28. package/lib/modules/Order/utils.js +3 -0
  29. package/lib/modules/Payment/walletpass.js +0 -1
  30. package/lib/server/index.js +1 -1
  31. package/lib/server/modules/order/index.d.ts +1 -0
  32. package/lib/server/modules/order/index.js +66 -2
  33. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
  34. package/lib/solution/BookingByStep/index.d.ts +1 -1
  35. package/lib/solution/BookingTicket/index.d.ts +2 -0
  36. package/lib/solution/BookingTicket/index.js +18 -2
  37. package/package.json +1 -1
@@ -63,6 +63,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
63
63
  scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
64
64
  private hydrateOrderCustomerFromScanDiscounts;
65
65
  private getDiscountCustomerId;
66
+ resolveCustomerById(customerId: string | number): Promise<ICustomer | null>;
67
+ /** 兼容既有优惠码扫码逻辑。 */
66
68
  private resolveCustomerByDiscountCustomerId;
67
69
  private findCustomerById;
68
70
  private normalizeCustomer;
@@ -688,11 +688,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
688
688
  return null;
689
689
  }
690
690
  }, {
691
- key: "resolveCustomerByDiscountCustomerId",
691
+ key: "resolveCustomerById",
692
692
  value: function () {
693
- var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
693
+ var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
694
694
  var _result$list;
695
- var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
695
+ var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer, detailCustomer;
696
696
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
697
697
  while (1) switch (_context9.prev = _context9.next) {
698
698
  case 0:
@@ -714,18 +714,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
714
714
  case 7:
715
715
  result = _context9.sent;
716
716
  remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
717
- return _context9.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
718
- case 10:
717
+ if (!remoteCustomer) {
718
+ _context9.next = 11;
719
+ break;
720
+ }
721
+ return _context9.abrupt("return", this.normalizeCustomer(remoteCustomer));
722
+ case 11:
723
+ _context9.prev = 11;
724
+ _context9.next = 14;
725
+ return this.store.customer.queryCustomerDetail(customerId);
726
+ case 14:
727
+ detailCustomer = _context9.sent;
728
+ return _context9.abrupt("return", detailCustomer ? this.normalizeCustomer(detailCustomer) : null);
729
+ case 18:
730
+ _context9.prev = 18;
731
+ _context9.t0 = _context9["catch"](11);
732
+ console.warn('[BookingTicket] resolveCustomerById detail request failed', {
733
+ customerId: customerId,
734
+ error: _context9.t0
735
+ });
736
+ return _context9.abrupt("return", null);
737
+ case 22:
719
738
  case "end":
720
739
  return _context9.stop();
721
740
  }
722
- }, _callee9, this);
741
+ }, _callee9, this, [[11, 18]]);
723
742
  }));
724
- function resolveCustomerByDiscountCustomerId(_x6) {
725
- return _resolveCustomerByDiscountCustomerId.apply(this, arguments);
743
+ function resolveCustomerById(_x6) {
744
+ return _resolveCustomerById.apply(this, arguments);
726
745
  }
727
- return resolveCustomerByDiscountCustomerId;
728
- }()
746
+ return resolveCustomerById;
747
+ }() /** 兼容既有优惠码扫码逻辑。 */
748
+ }, {
749
+ key: "resolveCustomerByDiscountCustomerId",
750
+ value: function resolveCustomerByDiscountCustomerId(customerId) {
751
+ return this.resolveCustomerById(customerId);
752
+ }
729
753
  }, {
730
754
  key: "findCustomerById",
731
755
  value: function findCustomerById() {
package/lib/core/index.js CHANGED
@@ -50,7 +50,6 @@ var PisellOSCore = class {
50
50
  this.serverOptions = options.server;
51
51
  }
52
52
  this.initialize(options);
53
- console.log("constructor1234");
54
53
  }
55
54
  initialize(options) {
56
55
  if (options == null ? void 0 : options.plugins) {
@@ -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
- });
@@ -415,7 +415,6 @@ var WalletPassEvaluator = class {
415
415
  * 计算适用商品的总金额和数量
416
416
  */
417
417
  calculateApplicableProducts(products, applicableProductIds, deductTaxAndFee) {
418
- console.log(products, "products1234");
419
418
  let total = 0;
420
419
  let count = 0;
421
420
  if (applicableProductIds !== null && applicableProductIds.length === 0) {
@@ -166,7 +166,6 @@ var getApplicableProducts = (voucher, productsData) => {
166
166
  return productsData.filter((p) => applicableProductIds.includes(p.product_id));
167
167
  };
168
168
  function processVouchers(applicableVouchers, orderTotalAmount, products) {
169
- console.log(products, "products123");
170
169
  const productsCopy = expandProductsWithBundleItems(products, true);
171
170
  let remainingOrderAmount = new import_decimal.default(orderTotalAmount);
172
171
  const getItemPassUsage = (usageMap, walletPassProductId, lineKey) => {
@@ -202,6 +202,8 @@ function buildCacheItemFromOrderLine(input) {
202
202
  const productTitle = resolveProductTitle(product, booking, sourceProduct);
203
203
  const productCover = resolveProductCover(product, booking, sourceProduct);
204
204
  const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
205
+ const hasBundle = Array.isArray(product.product_bundle) && product.product_bundle.length > 0;
206
+ const bundleEdit = product.bundle_edit ?? (hasBundle ? 0 : void 0);
205
207
  const other = {
206
208
  product_variant_id: product.product_variant_id ?? 0,
207
209
  option: (0, import_utils.getProductSkuOptions)(product),
@@ -234,6 +236,7 @@ function buildCacheItemFromOrderLine(input) {
234
236
  product.discount_list,
235
237
  (_c = product.metadata) == null ? void 0 : _c.product_discount_reason
236
238
  ) || void 0,
239
+ ...bundleEdit !== void 0 ? { bundle_edit: bundleEdit } : {},
237
240
  ...productOptionString ? { product_option_string: productOptionString } : {}
238
241
  };
239
242
  const manualDiscount = (product.discount_list || []).find((d) => (d == null ? void 0 : d.type) === "product");
@@ -44,6 +44,10 @@ export declare class CustomerModule extends BaseModule implements Module, Custom
44
44
  * 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
45
45
  */
46
46
  queryCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
47
+ /**
48
+ * 查询单个客户详情,不写入 customerList / pagination 状态。
49
+ */
50
+ queryCustomerDetail(id: string | number): Promise<ShopCustomer | null>;
47
51
  /**
48
52
  * 获取客户列表
49
53
  * @param params 查询参数
@@ -201,6 +201,17 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
201
201
  pageSize
202
202
  };
203
203
  }
204
+ /**
205
+ * 查询单个客户详情,不写入 customerList / pagination 状态。
206
+ */
207
+ async queryCustomerDetail(id) {
208
+ var _a;
209
+ const result = await this.request.get(`/customer/info/${id}`, {
210
+ with_trashed: 1
211
+ });
212
+ const customer = ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.customer) || (result == null ? void 0 : result.data) || (result == null ? void 0 : result.customer) || null;
213
+ return customer && typeof customer === "object" ? customer : null;
214
+ }
204
215
  /**
205
216
  * 获取客户列表
206
217
  * @param params 查询参数
@@ -112,6 +112,8 @@ export interface CustomerModuleAPI {
112
112
  getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
113
113
  /** 查询客户列表但不更新列表分页状态 */
114
114
  queryCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
115
+ /** 查询单个客户详情但不修改客户列表状态 */
116
+ queryCustomerDetail: (id: string | number) => Promise<ShopCustomer | null>;
115
117
  /** 设置客户列表 */
116
118
  setCustomerList: (customers: ShopCustomer[], total?: number) => void;
117
119
  /** 设置当前选择的客户 */
@@ -4746,8 +4746,9 @@ var OrderModule = class extends import_BaseModule.BaseModule {
4746
4746
  delete row[`product_${"option"}_item`];
4747
4747
  if (!Array.isArray(row.product_bundle))
4748
4748
  row.product_bundle = [];
4749
- if (!row.metadata || typeof row.metadata !== "object")
4750
- row.metadata = {};
4749
+ row.metadata = row.metadata && typeof row.metadata === "object" ? { ...row.metadata } : {};
4750
+ delete row.bundle_edit;
4751
+ delete row.metadata.bundle_edit;
4751
4752
  if (row.booking_uid && !row.metadata.booking_uid) {
4752
4753
  row.metadata.booking_uid = row.booking_uid;
4753
4754
  }
@@ -801,6 +801,8 @@ function normalizeSubmitProduct(product) {
801
801
  delete productRest[`product_${"option"}_item`];
802
802
  const rawMetadata = submitProduct.metadata || {};
803
803
  const bookingUid = rawMetadata.booking_uid;
804
+ const hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
805
+ const bundleEdit = submitProduct.bundle_edit ?? rawMetadata.bundle_edit ?? (hasProductBundle ? 0 : void 0);
804
806
  const cleanMetadata = {};
805
807
  if (rawMetadata.unique_identification_number) {
806
808
  cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
@@ -843,6 +845,7 @@ function normalizeSubmitProduct(product) {
843
845
  return {
844
846
  ...productRest,
845
847
  ...bookingUid ? { booking_uid: bookingUid } : {},
848
+ ...bundleEdit !== void 0 ? { bundle_edit: bundleEdit } : {},
846
849
  product_quantity: toBundleNumber(num ?? submitProduct.product_quantity, 1),
847
850
  product_sku: productSku,
848
851
  discount_list: collectSubmitProductDiscountList(submitProduct),
@@ -543,7 +543,6 @@ var WalletPassPaymentImpl = class {
543
543
  vouchers: allList
544
544
  });
545
545
  const { recommended, transformList, noApplicableVoucher, recommendedAmount } = res;
546
- console.log(res, "resres12");
547
546
  this.walletRecommendList = recommended;
548
547
  this.walletInitData = {
549
548
  transformList,
@@ -4094,7 +4094,7 @@ var Server = class {
4094
4094
  var _a, _b, _c, _d, _e;
4095
4095
  if (((_b = (_a = this.core.context) == null ? void 0 : _a.getPlatform) == null ? void 0 : _b.call(_a)) !== "android")
4096
4096
  return true;
4097
- return ((_e = (_d = (_c = this.app) == null ? void 0 : _c.storage) == null ? void 0 : _d.getStorage) == null ? void 0 : _e.call(_d, AUTO_PRINT_STORAGE_KEY)) === "true";
4097
+ return ((_e = (_d = (_c = this.app) == null ? void 0 : _c.storage) == null ? void 0 : _d.getStorage) == null ? void 0 : _e.call(_d, AUTO_PRINT_STORAGE_KEY)) !== "false";
4098
4098
  }
4099
4099
  shouldBuildSmallTicketData(order) {
4100
4100
  if (!order || typeof order !== "object")
@@ -274,6 +274,7 @@ export declare class OrderModule extends BaseModule implements Module {
274
274
  * // => 'S-1001'
275
275
  */
276
276
  private getOrderStorageKey;
277
+ private getPersistedOrderStorageKey;
277
278
  private getOrderIdentityMatchKeys;
278
279
  private doOrdersShareIdentity;
279
280
  private findOrderIndexByIdentity;
@@ -39,6 +39,7 @@ var import_orderCollectionIdentity = require("../../../modules/Order/utils/order
39
39
  var import_types = require("./types");
40
40
  var import_payment_utils = require("../../../modules/Order/payment-utils");
41
41
  var INDEXDB_STORE_NAME = "orders";
42
+ var ORDER_STORAGE_KEY_FIELD = "__order_storage_key";
42
43
  var ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY = "server_order_last_full_fetch_at";
43
44
  var ORDER_SYNC_THROTTLE_MS_STORAGE_KEY = "order_sync_throttle_ms";
44
45
  var DEFAULT_ORDER_SYNC_THROTTLE_MS = 2e3;
@@ -1533,6 +1534,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1533
1534
  const patchedOrders = [];
1534
1535
  const remoteProductMembershipChanges = [];
1535
1536
  const forceWriteStorageKeys = /* @__PURE__ */ new Set();
1537
+ const storageKeyMigrations = [];
1536
1538
  const mergeActions = {};
1537
1539
  const existingProductsHaveStableIdentity = this.store.list.map(
1538
1540
  (order) => this.doProductsHaveStableMembershipIdentity(
@@ -1557,6 +1559,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1557
1559
  const mergeKey = storageKey || (fresh.order_id !== void 0 && fresh.order_id !== null ? this.getIdKey(fresh.order_id) : "");
1558
1560
  if (matchIndex >= 0) {
1559
1561
  const existingOrder = updatedList[matchIndex];
1562
+ const previousStorageKey = this.getPersistedOrderStorageKey(existingOrder);
1560
1563
  if (this.isPendingSyncOrder(existingOrder) && this.isRemoteEchoMergeSource(source)) {
1561
1564
  this.logInfo("mergeOrdersToStore-跳过 pending 订单远端覆盖", {
1562
1565
  source,
@@ -1618,6 +1621,14 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1618
1621
  }
1619
1622
  }
1620
1623
  }
1624
+ const nextStorageKey = this.getOrderStorageKey(mergedOrder);
1625
+ if (previousStorageKey && nextStorageKey && previousStorageKey !== nextStorageKey) {
1626
+ storageKeyMigrations.push({
1627
+ orderId: mergedOrder.order_id ?? existingOrder.order_id ?? fresh.order_id ?? null,
1628
+ from: previousStorageKey,
1629
+ to: nextStorageKey
1630
+ });
1631
+ }
1621
1632
  updatedList[adjustedMatchIndex] = mergedOrder;
1622
1633
  existingProductsHaveStableIdentity[adjustedMatchIndex] = mergedProductsHaveStableIdentity;
1623
1634
  if (membershipChange) {
@@ -1655,7 +1666,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1655
1666
  patchedOrders,
1656
1667
  source,
1657
1668
  mergeActions,
1658
- {},
1669
+ { storageKeyMigrations },
1659
1670
  forceWriteStorageKeys
1660
1671
  );
1661
1672
  this.logInfo("mergeOrdersToStore-结束", {
@@ -1860,6 +1871,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
1860
1871
  }
1861
1872
  return "";
1862
1873
  }
1874
+ getPersistedOrderStorageKey(order) {
1875
+ const persistedStorageKey = order == null ? void 0 : order[ORDER_STORAGE_KEY_FIELD];
1876
+ if (persistedStorageKey !== void 0 && persistedStorageKey !== null && persistedStorageKey !== "") {
1877
+ return String(persistedStorageKey);
1878
+ }
1879
+ return this.getOrderStorageKey(order);
1880
+ }
1863
1881
  getOrderIdentityMatchKeys(order) {
1864
1882
  return this.getOrderIdentityEntries(order).map((entry) => `${entry.field}:${entry.key}`);
1865
1883
  }
@@ -2290,7 +2308,18 @@ var OrderModule = class extends import_BaseModule.BaseModule {
2290
2308
  throw new Error("订单 SQLite 数据库未初始化");
2291
2309
  return;
2292
2310
  }
2293
- const ordersSnapshot = (0, import_lodash_es.cloneDeep)(orders).map((order) => this.normalizeOrderCollectionsForIngress(order, `${source}.sqliteIngress`)).filter((order) => this.getOrderStorageKey(order));
2311
+ const migrationTargetStorageKeys = new Set(
2312
+ (options.storageKeyMigrations || []).map((migration) => migration.to)
2313
+ );
2314
+ const ordersSnapshot = (0, import_lodash_es.cloneDeep)(orders).map((order) => this.normalizeOrderCollectionsForIngress(order, `${source}.sqliteIngress`)).map((order) => {
2315
+ const storageKey = this.getOrderStorageKey(order);
2316
+ if (!storageKey || !migrationTargetStorageKeys.has(storageKey))
2317
+ return order;
2318
+ return {
2319
+ ...order,
2320
+ [ORDER_STORAGE_KEY_FIELD]: storageKey
2321
+ };
2322
+ }).filter((order) => this.getOrderStorageKey(order));
2294
2323
  if (ordersSnapshot.length === 0) {
2295
2324
  return;
2296
2325
  }
@@ -2307,6 +2336,17 @@ var OrderModule = class extends import_BaseModule.BaseModule {
2307
2336
  if (compactedToWrite.length === 0) {
2308
2337
  return;
2309
2338
  }
2339
+ const writtenStorageKeys = new Set(
2340
+ compactedToWrite.map((order) => this.getOrderStorageKey(order)).filter(Boolean)
2341
+ );
2342
+ const storageKeyMigrations = /* @__PURE__ */ new Map();
2343
+ for (const migration of options.storageKeyMigrations || []) {
2344
+ if (!writtenStorageKeys.has(migration.to))
2345
+ continue;
2346
+ if (writtenStorageKeys.has(migration.from))
2347
+ continue;
2348
+ storageKeyMigrations.set(migration.from, migration);
2349
+ }
2310
2350
  try {
2311
2351
  await this.runInOrderSQLiteSaveQueue(async () => {
2312
2352
  let writeMethod = "none";
@@ -2330,6 +2370,30 @@ var OrderModule = class extends import_BaseModule.BaseModule {
2330
2370
  throw new Error("订单 SQLite 数据库不支持写入");
2331
2371
  }
2332
2372
  this.recordRecentSqliteWrite(source, compactedToWrite);
2373
+ if (writeMethod !== "none") {
2374
+ for (const migration of storageKeyMigrations.values()) {
2375
+ try {
2376
+ await this.dbManager.delete(INDEXDB_STORE_NAME, migration.from);
2377
+ this.recentSqliteWriteByStorageKey.delete(migration.from);
2378
+ for (const order of orders) {
2379
+ if (this.getOrderStorageKey(order) !== migration.to)
2380
+ continue;
2381
+ const orderRecord = order;
2382
+ if (String(orderRecord[ORDER_STORAGE_KEY_FIELD] ?? "") !== migration.from)
2383
+ continue;
2384
+ orderRecord[ORDER_STORAGE_KEY_FIELD] = migration.to;
2385
+ }
2386
+ } catch (error) {
2387
+ this.logError("删除订单旧 SQLite storage key 失败", {
2388
+ source,
2389
+ order_id: migration.orderId,
2390
+ oldStorageKey: migration.from,
2391
+ newStorageKey: migration.to,
2392
+ error: error instanceof Error ? error.message : String(error)
2393
+ });
2394
+ }
2395
+ }
2396
+ }
2333
2397
  this.logInfo("patchOrdersInSQLite-完成", {
2334
2398
  source,
2335
2399
  count: compactedToWrite.length,
@@ -230,6 +230,7 @@ function transformBaseProductToOrderProduct(params) {
230
230
  },
231
231
  product_bundle: productBundle,
232
232
  discount_list: manualDiscountList,
233
+ ...payload.bundle_edit !== void 0 ? { bundle_edit: payload.bundle_edit } : {},
233
234
  // 折后行价由 normalizeOrderProduct 按 main + bundle 合成;手动改价时 bundle 已为分摊后单价
234
235
  selling_price: lineCompositeTotal,
235
236
  original_price: lineOriginalPrice,
@@ -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 | 1 | 2 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -63,6 +63,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
63
63
  scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
64
64
  private hydrateOrderCustomerFromScanDiscounts;
65
65
  private getDiscountCustomerId;
66
+ resolveCustomerById(customerId: string | number): Promise<ICustomer | null>;
67
+ /** 兼容既有优惠码扫码逻辑。 */
66
68
  private resolveCustomerByDiscountCustomerId;
67
69
  private findCustomerById;
68
70
  private normalizeCustomer;
@@ -396,7 +396,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
396
396
  }
397
397
  return null;
398
398
  }
399
- async resolveCustomerByDiscountCustomerId(customerId) {
399
+ async resolveCustomerById(customerId) {
400
400
  var _a;
401
401
  const localCustomers = this.store.customer.getCustomers();
402
402
  const localCustomer = this.findCustomerById(localCustomers, customerId);
@@ -410,7 +410,23 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
410
410
  num: 1
411
411
  });
412
412
  const remoteCustomer = this.findCustomerById((result == null ? void 0 : result.list) || [], customerId) || ((_a = result == null ? void 0 : result.list) == null ? void 0 : _a[0]) || null;
413
- return remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null;
413
+ if (remoteCustomer) {
414
+ return this.normalizeCustomer(remoteCustomer);
415
+ }
416
+ try {
417
+ const detailCustomer = await this.store.customer.queryCustomerDetail(customerId);
418
+ return detailCustomer ? this.normalizeCustomer(detailCustomer) : null;
419
+ } catch (error) {
420
+ console.warn(
421
+ "[BookingTicket] resolveCustomerById detail request failed",
422
+ { customerId, error }
423
+ );
424
+ return null;
425
+ }
426
+ }
427
+ /** 兼容既有优惠码扫码逻辑。 */
428
+ resolveCustomerByDiscountCustomerId(customerId) {
429
+ return this.resolveCustomerById(customerId);
414
430
  }
415
431
  findCustomerById(customers = [], customerId) {
416
432
  return customers.find((customer) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.63",
4
+ "version": "2.3.64",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",