@pisell/pisellos 2.2.171 → 2.2.173

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 (160) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/BookingContext/index.d.ts +37 -0
  3. package/dist/modules/BookingContext/index.js +436 -0
  4. package/dist/modules/BookingContext/types.d.ts +102 -0
  5. package/dist/modules/BookingContext/types.js +51 -0
  6. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  7. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +193 -0
  8. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  9. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
  10. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
  11. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +215 -0
  12. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  13. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  14. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  15. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  16. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  17. package/dist/modules/BookingContext/utils/index.js +11 -0
  18. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  19. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  20. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  21. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  22. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  23. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  24. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  25. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  26. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  27. package/dist/modules/BookingContext/utils/resources.js +486 -0
  28. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  29. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  30. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  31. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  32. package/dist/modules/Customer/index.d.ts +6 -0
  33. package/dist/modules/Customer/index.js +129 -83
  34. package/dist/modules/Customer/types.d.ts +2 -0
  35. package/dist/modules/Discount/index.d.ts +2 -4
  36. package/dist/modules/Discount/index.js +8 -93
  37. package/dist/modules/Discount/types.d.ts +1 -7
  38. package/dist/modules/Order/index.d.ts +33 -17
  39. package/dist/modules/Order/index.js +757 -395
  40. package/dist/modules/Order/types.d.ts +58 -17
  41. package/dist/modules/Order/types.js +2 -0
  42. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  43. package/dist/modules/Order/utils/manualProductDiscount.js +212 -0
  44. package/dist/modules/Order/utils.d.ts +39 -1
  45. package/dist/modules/Order/utils.js +219 -31
  46. package/dist/modules/Quotation/index.js +16 -5
  47. package/dist/modules/Rules/index.d.ts +4 -0
  48. package/dist/modules/Rules/index.js +26 -10
  49. package/dist/modules/SalesSummary/index.js +4 -2
  50. package/dist/modules/Schedule/index.js +6 -2
  51. package/dist/modules/index.d.ts +1 -0
  52. package/dist/modules/index.js +2 -1
  53. package/dist/server/index.js +10 -6
  54. package/dist/server/modules/order/utils/filterOrders.js +20 -6
  55. package/dist/server/modules/products/index.js +113 -94
  56. package/dist/server/modules/schedule/index.js +13 -6
  57. package/dist/solution/BaseSales/index.d.ts +53 -7
  58. package/dist/solution/BaseSales/index.js +1160 -339
  59. package/dist/solution/BaseSales/types.d.ts +67 -1
  60. package/dist/solution/BaseSales/types.js +3 -1
  61. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  62. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  63. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +65 -15
  64. package/dist/solution/BaseSales/utils.js +46 -8
  65. package/dist/solution/BookingByStep/index.d.ts +1 -1
  66. package/dist/solution/BookingTicket/index.d.ts +134 -2
  67. package/dist/solution/BookingTicket/index.js +776 -175
  68. package/dist/solution/BookingTicket/types.d.ts +2 -0
  69. package/dist/solution/BookingTicket/types.js +3 -0
  70. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
  71. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  72. package/dist/solution/ScanOrder/index.d.ts +9 -3
  73. package/dist/solution/ScanOrder/index.js +231 -128
  74. package/dist/solution/ScanOrder/utils.js +46 -8
  75. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  76. package/dist/solution/ShopDiscount/index.js +18 -23
  77. package/dist/solution/VenueBooking/index.d.ts +5 -9
  78. package/dist/solution/VenueBooking/index.js +103 -55
  79. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  80. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  81. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  82. package/lib/modules/BookingContext/index.d.ts +37 -0
  83. package/lib/modules/BookingContext/index.js +297 -0
  84. package/lib/modules/BookingContext/types.d.ts +102 -0
  85. package/lib/modules/BookingContext/types.js +34 -0
  86. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  87. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +207 -0
  88. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  89. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
  90. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
  91. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +198 -0
  92. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  93. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  94. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  95. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  96. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  97. package/lib/modules/BookingContext/utils/index.js +43 -0
  98. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  99. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  100. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  101. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  102. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  103. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  104. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  105. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  106. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  107. package/lib/modules/BookingContext/utils/resources.js +377 -0
  108. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  109. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  110. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  111. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  112. package/lib/modules/Customer/index.d.ts +6 -0
  113. package/lib/modules/Customer/index.js +26 -11
  114. package/lib/modules/Customer/types.d.ts +2 -0
  115. package/lib/modules/Discount/index.d.ts +2 -4
  116. package/lib/modules/Discount/index.js +8 -63
  117. package/lib/modules/Discount/types.d.ts +1 -7
  118. package/lib/modules/Order/index.d.ts +33 -17
  119. package/lib/modules/Order/index.js +402 -148
  120. package/lib/modules/Order/types.d.ts +58 -17
  121. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  122. package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
  123. package/lib/modules/Order/utils.d.ts +39 -1
  124. package/lib/modules/Order/utils.js +197 -22
  125. package/lib/modules/Quotation/index.js +17 -6
  126. package/lib/modules/Rules/index.d.ts +4 -0
  127. package/lib/modules/Rules/index.js +22 -14
  128. package/lib/modules/SalesSummary/index.js +4 -2
  129. package/lib/modules/Schedule/index.js +3 -1
  130. package/lib/modules/index.d.ts +1 -0
  131. package/lib/modules/index.js +3 -1
  132. package/lib/server/index.js +2 -0
  133. package/lib/server/modules/order/utils/filterOrders.js +12 -4
  134. package/lib/server/modules/products/index.js +23 -12
  135. package/lib/server/modules/schedule/index.js +2 -1
  136. package/lib/solution/BaseSales/index.d.ts +53 -7
  137. package/lib/solution/BaseSales/index.js +527 -20
  138. package/lib/solution/BaseSales/types.d.ts +67 -1
  139. package/lib/solution/BaseSales/types.js +3 -1
  140. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  141. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  142. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +70 -11
  143. package/lib/solution/BaseSales/utils.js +46 -6
  144. package/lib/solution/BookingByStep/index.d.ts +1 -1
  145. package/lib/solution/BookingTicket/index.d.ts +134 -2
  146. package/lib/solution/BookingTicket/index.js +349 -8
  147. package/lib/solution/BookingTicket/types.d.ts +2 -0
  148. package/lib/solution/BookingTicket/types.js +6 -0
  149. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
  150. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  151. package/lib/solution/ScanOrder/index.d.ts +9 -3
  152. package/lib/solution/ScanOrder/index.js +147 -66
  153. package/lib/solution/ScanOrder/utils.js +46 -6
  154. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  155. package/lib/solution/ShopDiscount/index.js +2 -4
  156. package/lib/solution/VenueBooking/index.d.ts +5 -9
  157. package/lib/solution/VenueBooking/index.js +50 -14
  158. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  159. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  160. package/package.json +2 -2
@@ -34,13 +34,16 @@ __export(BaseSales_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(BaseSales_exports);
36
36
  var import_BaseModule = require("../../modules/BaseModule");
37
+ var import_types = require("./types");
37
38
  var import_Order = require("../../modules/Order");
38
39
  var import_decimal = __toESM(require("decimal.js"));
39
- var import_types = require("../BookingByStep/types");
40
+ var import_types2 = require("../BookingByStep/types");
40
41
  var import_utils = require("../../modules/Order/utils");
41
42
  var import_dayjs = __toESM(require("dayjs"));
42
43
  __reExport(BaseSales_exports, require("./types"), module.exports);
44
+ var import_Quotation = require("../../modules/Quotation");
43
45
  var import_transformBaseProductToOrderProduct = require("./utils/transformBaseProductToOrderProduct");
46
+ var import_quotationPrice = require("./utils/quotationPrice");
44
47
  var BaseSalesImpl = class extends import_BaseModule.BaseModule {
45
48
  constructor(name, version) {
46
49
  super(name, version);
@@ -48,20 +51,21 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
48
51
  this.defaultVersion = "1.0.0";
49
52
  this.isSolution = true;
50
53
  this.initializeOptions = {};
51
- // LoggerManager 实例
52
54
  this.store = {
53
55
  order: void 0
54
56
  };
55
57
  this.otherParams = {};
56
58
  // 当前缓存中已加载的最新 SalesDetail;只读 getter 走它对外暴露详情数据。
57
59
  this.currentSalesDetail = null;
60
+ this.discountConfigCacheKey = null;
61
+ this.hasManualDiscountSelection = false;
58
62
  }
59
63
  /**
60
64
  * 子类可覆盖此方法以追加/收敛要注册的子模块。
61
- * 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
65
+ * 默认包含通用销售模块:products / order / salesSummary / schedule / payment / quotation
62
66
  */
63
67
  getRegisteredModuleNames() {
64
- return ["products", "order", "salesSummary", "schedule", "payment"];
68
+ return ["products", "order", "salesSummary", "schedule", "payment", "quotation"];
65
69
  }
66
70
  /**
67
71
  * 记录信息日志
@@ -105,13 +109,48 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
105
109
  get payment() {
106
110
  return this.store.payment;
107
111
  }
112
+ getCurrentOrderCustomerId() {
113
+ var _a, _b;
114
+ const tempOrder = (_b = (_a = this.store.order) == null ? void 0 : _a.getTempOrder) == null ? void 0 : _b.call(_a);
115
+ const customerId = tempOrder == null ? void 0 : tempOrder.customer_id;
116
+ if (customerId === null || customerId === void 0)
117
+ return void 0;
118
+ return customerId;
119
+ }
120
+ applyQuotationScheduleResolver(quotation) {
121
+ const scheduleModule = this.store.schedule;
122
+ if (!scheduleModule)
123
+ return;
124
+ quotation.setScheduleResolver((id) => {
125
+ var _a;
126
+ const schedules = ((_a = scheduleModule.getScheduleListByIds) == null ? void 0 : _a.call(scheduleModule, [id])) || [];
127
+ return schedules[0];
128
+ });
129
+ }
130
+ async loadQuotationForPriceQuery(params) {
131
+ var _a;
132
+ if (!params.quotation)
133
+ return;
134
+ this.applyQuotationScheduleResolver(params.quotation);
135
+ await params.quotation.loadQuotations({
136
+ channel: params.channel || ((_a = this.otherParams) == null ? void 0 : _a.channel),
137
+ customer_id: params.customer_id
138
+ });
139
+ }
140
+ getSubmitOrderSalesChannel() {
141
+ var _a;
142
+ return (_a = this.otherParams) == null ? void 0 : _a.channel;
143
+ }
108
144
  /**
109
145
  * 工厂入口:根据子模块名实例化对应模块。
110
146
  * 默认使用 BookingByStep 公共 `createModule`。子类若需引入额外类型(如 customer),
111
147
  * 可覆盖此方法并把未识别的 name 委托给 `super.createSubModule(name)`。
112
148
  */
113
149
  createSubModule(moduleName) {
114
- return (0, import_types.createModule)(moduleName, this.name);
150
+ if (moduleName === "quotation") {
151
+ return new import_Quotation.QuotationModule(`${this.name}_quotation`);
152
+ }
153
+ return (0, import_types2.createModule)(moduleName, this.name);
115
154
  }
116
155
  getSubModuleHooks(moduleName) {
117
156
  var _a, _b;
@@ -140,6 +179,43 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
140
179
  return {};
141
180
  }
142
181
  }
182
+ getAppData(key) {
183
+ var _a, _b, _c, _d, _e, _f;
184
+ const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
185
+ if (typeof getData === "function")
186
+ return getData(key);
187
+ const app = this.appPlugin.getApp();
188
+ const coreData = (_f = (_d = (_c = app == null ? void 0 : app.models) == null ? void 0 : _c.getStore) == null ? void 0 : (_e = _d.call(_c)).getDataByModel) == null ? void 0 : _f.call(_e, "core", "core");
189
+ return coreData == null ? void 0 : coreData[key];
190
+ }
191
+ syncAppDataToTempOrder(tempOrder) {
192
+ const taxCountryCode = this.getAppData("tax_country_code");
193
+ const currencyCode = this.getAppData("shop_currency_code");
194
+ const currencySymbol = this.getAppData("shop_symbol");
195
+ let isChanged = false;
196
+ if (taxCountryCode !== void 0) {
197
+ const nextTaxCountryCode = String(taxCountryCode || "");
198
+ if (tempOrder.tax_country_code !== nextTaxCountryCode) {
199
+ tempOrder.tax_country_code = nextTaxCountryCode;
200
+ isChanged = true;
201
+ }
202
+ }
203
+ if (currencyCode !== void 0) {
204
+ const nextCurrencyCode = String(currencyCode || "");
205
+ if (tempOrder.currency_code !== nextCurrencyCode) {
206
+ tempOrder.currency_code = nextCurrencyCode;
207
+ isChanged = true;
208
+ }
209
+ }
210
+ if (currencySymbol !== void 0) {
211
+ const nextCurrencySymbol = String(currencySymbol || "");
212
+ if (tempOrder.currency_symbol !== nextCurrencySymbol) {
213
+ tempOrder.currency_symbol = nextCurrencySymbol;
214
+ isChanged = true;
215
+ }
216
+ }
217
+ return isChanged;
218
+ }
143
219
  async initialize(core, options = {}) {
144
220
  var _a;
145
221
  this.core = core;
@@ -148,11 +224,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
148
224
  this.cacheId = (_a = this.otherParams) == null ? void 0 : _a.cacheId;
149
225
  this.window = core.getPlugin("window");
150
226
  this.request = core.getPlugin("request");
151
- const appPlugin = core.getPlugin("app");
152
- if (!appPlugin) {
227
+ this.appPlugin = core.getPlugin("app");
228
+ if (!this.appPlugin) {
153
229
  throw new Error("Checkout 解决方案需要 app 插件支持");
154
230
  }
155
- const app = appPlugin.getApp();
231
+ const app = this.appPlugin.getApp();
156
232
  this.logger = app.logger;
157
233
  const targetCacheData = this.readSessionCacheData();
158
234
  const moduleNames = this.getRegisteredModuleNames();
@@ -286,6 +362,13 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
286
362
  const result = ((_a = this.store.order) == null ? void 0 : _a.getTempOrder()) || null;
287
363
  return result;
288
364
  }
365
+ async replaceTempOrder(tempOrder) {
366
+ if (!this.store.order)
367
+ throw new Error("order 模块未初始化");
368
+ const nextTempOrder = await this.store.order.replaceTempOrder(tempOrder);
369
+ await this.effectsEmit("onTempOrderReplaced", { tempOrder: nextTempOrder });
370
+ return nextTempOrder;
371
+ }
289
372
  getOrderIdentity() {
290
373
  if (!this.store.order)
291
374
  return null;
@@ -311,16 +394,21 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
311
394
  return "";
312
395
  return this.store.order.getTempOrderNote();
313
396
  }
314
- updateTempOrderNote(note) {
397
+ updateTempOrderNote(note, sync = false) {
315
398
  try {
316
399
  if (!this.store.order)
317
400
  throw new Error("order 模块未初始化");
318
- const result = this.store.order.updateTempOrderNote(note);
401
+ const result = this.store.order.updateTempOrderNote(note, sync);
319
402
  return result;
320
403
  } catch (error) {
321
404
  throw error;
322
405
  }
323
406
  }
407
+ updateRemoteOrderNote(orderId, note) {
408
+ if (!this.store.order)
409
+ throw new Error("order 模块未初始化");
410
+ this.store.order.syncTempOrderNoteToRemote(orderId, note);
411
+ }
324
412
  updateTempOrderShopDiscount(amount) {
325
413
  if (!this.store.order)
326
414
  throw new Error("order 模块未初始化");
@@ -331,6 +419,18 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
331
419
  throw new Error("order 模块未初始化");
332
420
  return this.store.order.updateTempOrderContactsInfo(contactsInfo);
333
421
  }
422
+ /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
423
+ setEnableTempOrderPersist(enabled) {
424
+ if (!this.store.order)
425
+ throw new Error("order 模块未初始化");
426
+ this.store.order.setEnableTempOrderPersist(enabled);
427
+ }
428
+ /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
429
+ isTempOrderPersistEnabled() {
430
+ if (!this.store.order)
431
+ return false;
432
+ return this.store.order.isTempOrderPersistEnabled();
433
+ }
334
434
  ensureTempOrder() {
335
435
  if (!this.store.order)
336
436
  throw new Error("order 模块未初始化");
@@ -342,6 +442,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
342
442
  if (!this.store.order)
343
443
  throw new Error("order 模块未初始化");
344
444
  const tempOrder = await this.store.order.addNewOrder();
445
+ if (this.syncAppDataToTempOrder(tempOrder)) {
446
+ this.store.order.persistTempOrder();
447
+ await this.store.order.saveDraft();
448
+ }
345
449
  return tempOrder;
346
450
  } catch (error) {
347
451
  throw error;
@@ -360,6 +464,43 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
360
464
  throw new Error("scanOrder 解决方案需要 order 模块支持");
361
465
  }
362
466
  const tempOrder = this.store.order.restoreOrder();
467
+ this.currentSalesDetail = null;
468
+ this.discountConfigCacheKey = null;
469
+ this.hasManualDiscountSelection = false;
470
+ await this.effectsEmit("onTempOrderReplaced", { tempOrder });
471
+ if (this.syncAppDataToTempOrder(tempOrder)) {
472
+ this.store.order.persistTempOrder();
473
+ await this.store.order.saveDraft();
474
+ }
475
+ return tempOrder;
476
+ } catch (error) {
477
+ throw error;
478
+ }
479
+ }
480
+ /**
481
+ * 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
482
+ * 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
483
+ */
484
+ async clearOrderCartLines() {
485
+ try {
486
+ if (!this.store.order)
487
+ throw new Error("order 模块未初始化");
488
+ const tempOrder = await this.store.order.clearOrderCartLines();
489
+ if (this.currentSalesDetail) {
490
+ this.currentSalesDetail = {
491
+ ...this.currentSalesDetail,
492
+ products: [],
493
+ bookings: [],
494
+ rootBooking: null,
495
+ bookingsByProductUid: {},
496
+ discount_list: []
497
+ };
498
+ }
499
+ await this.effectsEmit("onTempOrderReplaced", { tempOrder });
500
+ if (this.syncAppDataToTempOrder(tempOrder)) {
501
+ this.store.order.persistTempOrder();
502
+ await this.store.order.saveDraft();
503
+ }
363
504
  return tempOrder;
364
505
  } catch (error) {
365
506
  throw error;
@@ -381,6 +522,246 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
381
522
  throw error;
382
523
  }
383
524
  }
525
+ getHistoricalProductDiscountList(products) {
526
+ const historyDiscountList = [];
527
+ products.forEach((item) => {
528
+ if (!this.isPersistedOrderProduct(item))
529
+ return;
530
+ (item.discount_list || []).forEach((discount) => {
531
+ var _a, _b, _c, _d, _e, _f;
532
+ const discountId = ((_a = discount.discount) == null ? void 0 : _a.resource_id) || discount.id;
533
+ if (!discountId || !["good_pass", "discount_card"].includes(discount.type))
534
+ return;
535
+ const quantity = item.quantity || item.num || item.product_quantity || 1;
536
+ const savedAmount = new import_decimal.default(discount.amount || 0).times(quantity).plus(((_b = discount == null ? void 0 : discount.metadata) == null ? void 0 : _b.product_discount_difference) || 0);
537
+ const index = historyDiscountList.findIndex((n) => n.id === discountId);
538
+ if (index !== -1) {
539
+ historyDiscountList[index] = {
540
+ ...historyDiscountList[index],
541
+ amount: new import_decimal.default(historyDiscountList[index].amount || 0).plus(discount.amount || 0).toNumber(),
542
+ savedAmount: savedAmount.plus(historyDiscountList[index].savedAmount || 0).toNumber()
543
+ };
544
+ return;
545
+ }
546
+ historyDiscountList.push({
547
+ ...discount,
548
+ id: discountId,
549
+ tag: discount.tag || discount.type,
550
+ name: discount.name || ((_d = (_c = discount.discount) == null ? void 0 : _c.title) == null ? void 0 : _d.auto),
551
+ format_title: ((_e = discount.discount) == null ? void 0 : _e.title) || discount.format_title,
552
+ isEditMode: true,
553
+ limited_relation_product_data: {},
554
+ savedAmount: savedAmount.toNumber(),
555
+ isAvailable: true,
556
+ isDisabled: true,
557
+ isSelected: true,
558
+ product_id: ((_f = discount.discount) == null ? void 0 : _f.product_id) || discount.product_id
559
+ });
560
+ });
561
+ });
562
+ return historyDiscountList;
563
+ }
564
+ isPersistedOrderProduct(product) {
565
+ const orderDetailId = product.order_detail_id ?? product.orderDetailId;
566
+ if (orderDetailId !== void 0 && orderDetailId !== null && orderDetailId !== "") {
567
+ return true;
568
+ }
569
+ const bookingId = product.booking_id ?? product.bookingId;
570
+ return bookingId !== void 0 && bookingId !== null && bookingId !== "";
571
+ }
572
+ mergeHistoricalDiscountList(discountList, products) {
573
+ const historyDiscountList = this.getHistoricalProductDiscountList(products);
574
+ const historyIds = new Set(historyDiscountList.map((discount) => discount.id));
575
+ return [
576
+ ...historyDiscountList,
577
+ ...(discountList || []).filter((discount) => !historyIds.has(discount.id))
578
+ ];
579
+ }
580
+ mergeCurrentDiscountSelectionState(discountList, currentDiscountList) {
581
+ if (!currentDiscountList.length)
582
+ return discountList;
583
+ const currentDiscountMap = new Map(
584
+ currentDiscountList.map((discount) => [discount.id, discount])
585
+ );
586
+ return discountList.map((discount) => {
587
+ const currentDiscount = currentDiscountMap.get(discount.id);
588
+ if (!currentDiscount)
589
+ return discount;
590
+ if (currentDiscount.isManualSelect) {
591
+ return {
592
+ ...discount,
593
+ isSelected: false,
594
+ isManualSelect: true
595
+ };
596
+ }
597
+ if (currentDiscount.isSelected) {
598
+ return {
599
+ ...discount,
600
+ isSelected: true,
601
+ isManualSelect: false
602
+ };
603
+ }
604
+ return discount;
605
+ });
606
+ }
607
+ async loadDiscountConfig(params) {
608
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
609
+ if (!this.store.order)
610
+ throw new Error("order 模块未初始化");
611
+ const tempOrder = this.store.order.ensureTempOrder();
612
+ const orderStore = this.store.order.store || {};
613
+ const discountModule = orderStore.discount;
614
+ const rulesModule = orderStore.rules;
615
+ const orderId = tempOrder.order_id || ((_b = (_a = this.getOrderIdentity) == null ? void 0 : _a.call(this)) == null ? void 0 : _b.orderId);
616
+ const customerId = Number(
617
+ (params == null ? void 0 : params.customerId) || tempOrder.customer_id || ((_c = tempOrder.customer) == null ? void 0 : _c.id) || ((_e = (_d = tempOrder._extend) == null ? void 0 : _d.customerSnapshot) == null ? void 0 : _e.id) || ((_g = (_f = tempOrder._extend) == null ? void 0 : _f.customerSnapshot) == null ? void 0 : _g.customer_id) || 0
618
+ );
619
+ const currentDiscountList = ((_h = discountModule == null ? void 0 : discountModule.getDiscountList) == null ? void 0 : _h.call(discountModule)) || [];
620
+ const originalDiscountList = ((_i = discountModule == null ? void 0 : discountModule.getOriginalDiscountList) == null ? void 0 : _i.call(discountModule)) || [];
621
+ const hasManualDiscountSelection = this.hasManualDiscountSelection || currentDiscountList.some((discount) => discount.isManualSelect);
622
+ const discountAction = (params == null ? void 0 : params.action) || (orderId ? "edit" : "create");
623
+ const discountConfigCacheKey = [
624
+ customerId,
625
+ discountAction,
626
+ Number(orderId) || 0
627
+ ].join(":");
628
+ let preparedDiscountList = [];
629
+ if (customerId && customerId !== 1) {
630
+ if (this.discountConfigCacheKey === discountConfigCacheKey) {
631
+ preparedDiscountList = originalDiscountList;
632
+ } else {
633
+ preparedDiscountList = await this.store.order.loadDiscountConfig({
634
+ customerId,
635
+ action: discountAction,
636
+ orderId: Number(orderId) || void 0,
637
+ apply: false
638
+ });
639
+ this.discountConfigCacheKey = discountConfigCacheKey;
640
+ await ((_j = discountModule == null ? void 0 : discountModule.setOriginalDiscountList) == null ? void 0 : _j.call(discountModule, preparedDiscountList));
641
+ }
642
+ }
643
+ if (hasManualDiscountSelection && currentDiscountList.length) {
644
+ return {
645
+ productList: tempOrder.products || [],
646
+ discountList: currentDiscountList
647
+ };
648
+ }
649
+ let nextDiscountList = this.mergeHistoricalDiscountList(
650
+ preparedDiscountList || ((_k = discountModule == null ? void 0 : discountModule.getDiscountList) == null ? void 0 : _k.call(discountModule)) || [],
651
+ tempOrder.products || []
652
+ );
653
+ nextDiscountList = this.mergeCurrentDiscountSelectionState(
654
+ nextDiscountList,
655
+ currentDiscountList
656
+ );
657
+ await (discountModule == null ? void 0 : discountModule.setDiscountList(nextDiscountList));
658
+ if (rulesModule) {
659
+ const holders = ((_l = tempOrder.holder) == null ? void 0 : _l.form_record_id) ? [{ form_record_id: tempOrder.holder.form_record_id }] : [];
660
+ const result = rulesModule.calcDiscount({
661
+ productList: tempOrder.products,
662
+ discountList: nextDiscountList,
663
+ holders,
664
+ isFormSubject: !!((_m = tempOrder.holder) == null ? void 0 : _m.type) && tempOrder.holder.type === "form",
665
+ orderTotalAmount: Number(((_n = orderStore.summary) == null ? void 0 : _n.total_amount) || 0)
666
+ }) || { productList: tempOrder.products, discountList: nextDiscountList };
667
+ if (result.productList) {
668
+ tempOrder.products = result.productList;
669
+ }
670
+ for (const product of tempOrder.products || []) {
671
+ const productUid = (_o = product.metadata) == null ? void 0 : _o.unique_identification_number;
672
+ const runtimeOrigin = productUid ? (_r = (_q = (_p = tempOrder._extend) == null ? void 0 : _p.productsByUid) == null ? void 0 : _q[productUid]) == null ? void 0 : _r.origin : void 0;
673
+ if ((runtimeOrigin == null ? void 0 : runtimeOrigin.isManualDiscount) || ((_s = product.metadata) == null ? void 0 : _s.is_manual_discount))
674
+ continue;
675
+ const totalPerUnitDiscount = (product.discount_list || []).reduce(
676
+ (sum, pd) => sum + Number(pd.amount || 0),
677
+ 0
678
+ );
679
+ const optionSum = (0, import_utils.sumOptionUnitPrice)(product.product_option_item);
680
+ const sourcePrice = ((_t = product.metadata) == null ? void 0 : _t.source_product_price) ?? (((_u = product.metadata) == null ? void 0 : _u.main_product_original_price) != null ? new import_decimal.default(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : product.original_price ?? "0");
681
+ const newSourceSellingPrice = new import_decimal.default(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
682
+ const newMainSellingPrice = new import_decimal.default(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
683
+ if (product.metadata) {
684
+ product.metadata.main_product_selling_price = newMainSellingPrice;
685
+ product.metadata.price_schema_version = 2;
686
+ }
687
+ product.selling_price = (0, import_utils.composeLinePrice)({
688
+ mainPrice: newMainSellingPrice,
689
+ bundle: product.product_bundle
690
+ });
691
+ }
692
+ if (result.discountList) {
693
+ nextDiscountList = this.mergeHistoricalDiscountList(
694
+ result.discountList,
695
+ tempOrder.products || []
696
+ );
697
+ import_Order.OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
698
+ await (discountModule == null ? void 0 : discountModule.setDiscountList(nextDiscountList));
699
+ tempOrder.discount_list = nextDiscountList.filter((discount) => discount.isSelected);
700
+ }
701
+ }
702
+ const summary = await this.store.order.recalculateSummary({ createIfMissing: true });
703
+ this.store.order.persistTempOrder();
704
+ await this.effectsEmit("onDiscountApplied", {
705
+ productList: tempOrder.products || [],
706
+ discountList: nextDiscountList,
707
+ selectedDiscountList: tempOrder.discount_list || [],
708
+ tempOrder
709
+ });
710
+ return {
711
+ productList: tempOrder.products || [],
712
+ discountList: nextDiscountList
713
+ };
714
+ }
715
+ async bestDiscount(cb) {
716
+ var _a, _b, _c, _d, _e;
717
+ if (!this.store.order)
718
+ throw new Error("order 模块未初始化");
719
+ const tempOrder = this.store.order.ensureTempOrder();
720
+ const orderStore = this.store.order.store || {};
721
+ const discountModule = orderStore.discount;
722
+ const rulesModule = orderStore.rules;
723
+ const originalDiscountList = ((_a = discountModule == null ? void 0 : discountModule.getOriginalDiscountList) == null ? void 0 : _a.call(discountModule)) || this.getDiscountList();
724
+ const currentDiscountList = ((_b = discountModule == null ? void 0 : discountModule.getDiscountList) == null ? void 0 : _b.call(discountModule)) || [];
725
+ let nextDiscountList = this.mergeHistoricalDiscountList(
726
+ originalDiscountList || [],
727
+ tempOrder.products || []
728
+ );
729
+ let result = {
730
+ productList: tempOrder.products || [],
731
+ discountList: nextDiscountList
732
+ };
733
+ await (discountModule == null ? void 0 : discountModule.setDiscountList(nextDiscountList));
734
+ if (rulesModule) {
735
+ const holders = ((_c = tempOrder.holder) == null ? void 0 : _c.form_record_id) ? [{ form_record_id: tempOrder.holder.form_record_id }] : [];
736
+ result = rulesModule.calcDiscount({
737
+ productList: tempOrder.products,
738
+ discountList: nextDiscountList,
739
+ holders,
740
+ isFormSubject: !!((_d = tempOrder.holder) == null ? void 0 : _d.type) && tempOrder.holder.type === "form",
741
+ orderTotalAmount: Number(((_e = orderStore.summary) == null ? void 0 : _e.total_amount) || 0)
742
+ }) || result;
743
+ if (result.productList) {
744
+ tempOrder.products = result.productList;
745
+ }
746
+ if (result.discountList) {
747
+ nextDiscountList = this.mergeHistoricalDiscountList(
748
+ result.discountList,
749
+ tempOrder.products || []
750
+ );
751
+ import_Order.OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
752
+ await (discountModule == null ? void 0 : discountModule.setDiscountList(nextDiscountList));
753
+ tempOrder.discount_list = nextDiscountList.filter((discount) => discount.isSelected);
754
+ result = {
755
+ productList: tempOrder.products,
756
+ discountList: nextDiscountList
757
+ };
758
+ }
759
+ }
760
+ await this.store.order.recalculateSummary({ createIfMissing: true });
761
+ this.store.order.persistTempOrder();
762
+ cb == null ? void 0 : cb(result);
763
+ return result;
764
+ }
384
765
  getDiscountList() {
385
766
  if (!this.store.order)
386
767
  return [];
@@ -418,6 +799,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
418
799
  isManualSelect: !params.isSelected
419
800
  } : d
420
801
  );
802
+ this.hasManualDiscountSelection = true;
421
803
  const tempOrder = this.store.order.ensureTempOrder();
422
804
  const orderStore = this.store.order.store || {};
423
805
  const discountModule = orderStore.discount;
@@ -450,6 +832,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
450
832
  for (const d of nextDiscountList) {
451
833
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
452
834
  d.isSelected = false;
835
+ d.isManualSelect = true;
453
836
  }
454
837
  }
455
838
  }
@@ -490,6 +873,40 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
490
873
  tempOrder.discount_list = (nextDiscountList || []).filter((d) => d.isSelected);
491
874
  await this.store.order.recalculateSummary({ createIfMissing: true });
492
875
  this.store.order.persistTempOrder();
876
+ this.effectsEmit("onDiscountApplied", {
877
+ productList: tempOrder.products,
878
+ discountList: nextDiscountList,
879
+ selectedDiscountList: tempOrder.discount_list,
880
+ tempOrder
881
+ });
882
+ } catch (error) {
883
+ throw error;
884
+ }
885
+ }
886
+ async applyDiscountCalculationResult(result) {
887
+ try {
888
+ if (!this.store.order)
889
+ throw new Error("order 模块未初始化");
890
+ if (!result)
891
+ return;
892
+ const tempOrder = this.store.order.ensureTempOrder();
893
+ const orderStore = this.store.order.store || {};
894
+ const discountModule = orderStore.discount;
895
+ if (result.productList) {
896
+ tempOrder.products = result.productList;
897
+ }
898
+ if (result.discountList) {
899
+ import_Order.OrderModule.populateSavedAmounts(
900
+ tempOrder.products,
901
+ result.discountList
902
+ );
903
+ await (discountModule == null ? void 0 : discountModule.setDiscountList(result.discountList));
904
+ tempOrder.discount_list = result.discountList.filter(
905
+ (discount) => discount.isSelected
906
+ );
907
+ }
908
+ await this.store.order.recalculateSummary({ createIfMissing: true });
909
+ this.store.order.persistTempOrder();
493
910
  } catch (error) {
494
911
  throw error;
495
912
  }
@@ -504,7 +921,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
504
921
  * payments 会交给 OrderModule 统一映射为 Sales 协议支付项。
505
922
  */
506
923
  async submitSalesOrder(params) {
507
- var _a, _b, _c, _d;
924
+ var _a, _b, _c;
508
925
  if (!this.store.order) {
509
926
  throw new Error("BaseSales 解决方案需要 order 模块支持");
510
927
  }
@@ -513,19 +930,57 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
513
930
  cacheId: this.cacheId,
514
931
  platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
515
932
  businessCode: (_b = this.otherParams) == null ? void 0 : _b.businessCode,
516
- channel: (_c = this.otherParams) == null ? void 0 : _c.channel,
517
- type: (_d = this.otherParams) == null ? void 0 : _d.type,
933
+ channel: this.getSubmitOrderSalesChannel(),
934
+ type: (_c = this.otherParams) == null ? void 0 : _c.type,
518
935
  ...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
519
936
  ...(params == null ? void 0 : params.paymentStatus) !== void 0 ? { paymentStatus: params.paymentStatus } : {},
520
937
  ...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
521
938
  ...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
522
939
  };
940
+ console.log(submitParams, "submitParams123");
523
941
  return this.store.order.submitTempOrder(submitParams);
524
942
  }
525
943
  async syncPaymentsToOrder(params) {
526
944
  if (!this.store.order)
527
945
  throw new Error("order 模块未初始化");
528
- return this.store.order.syncPaymentsToOrder(params);
946
+ const channel = params.channel ?? this.getSubmitOrderSalesChannel();
947
+ const syncParams = {
948
+ ...params,
949
+ ...channel !== void 0 ? { channel } : {}
950
+ };
951
+ const syncState = this.store.order.getOrderSyncState();
952
+ if (params.submitWhenPaid && syncState === "submitting") {
953
+ return this.store.order.syncPaymentsToOrder(syncParams);
954
+ }
955
+ const payments = params.payments || [];
956
+ await this.effectsEmit(import_types.BaseSalesHookNames.onPaymentSyncStart, {
957
+ payments,
958
+ params: syncParams,
959
+ amountSnapshot: this.store.order.getOrderAmountSnapshot(),
960
+ orderSnapshot: this.store.order.getOrderSnapshot()
961
+ });
962
+ try {
963
+ const syncResult = await this.store.order.syncPaymentsToOrder(syncParams);
964
+ await this.effectsEmit(import_types.BaseSalesHookNames.onPaymentSyncEnd, {
965
+ ok: true,
966
+ syncResult,
967
+ payments: this.store.order.getOrderPayments(),
968
+ params: syncParams,
969
+ amountSnapshot: this.store.order.getOrderAmountSnapshot(),
970
+ orderSnapshot: this.store.order.getOrderSnapshot()
971
+ });
972
+ return syncResult;
973
+ } catch (error) {
974
+ await this.effectsEmit(import_types.BaseSalesHookNames.onPaymentSyncEnd, {
975
+ ok: false,
976
+ error,
977
+ payments: this.store.order.getOrderPayments(),
978
+ params: syncParams,
979
+ amountSnapshot: this.store.order.getOrderAmountSnapshot(),
980
+ orderSnapshot: this.store.order.getOrderSnapshot()
981
+ });
982
+ throw error;
983
+ }
529
984
  }
530
985
  /** 读取当前 BaseSales 订单上下文中的 Sales 协议支付项。 */
531
986
  getOrderPayments() {
@@ -543,7 +998,23 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
543
998
  addOrderPayment(payment) {
544
999
  if (!this.store.order)
545
1000
  throw new Error("order 模块未初始化");
546
- return this.store.order.addOrderPayment(payment);
1001
+ const payments = this.store.order.addOrderPayment(payment);
1002
+ const amountSnapshot = this.store.order.getOrderAmountSnapshot();
1003
+ const syncState = this.store.order.getOrderSyncState();
1004
+ if (amountSnapshot && syncState !== "submitting") {
1005
+ const paymentStatus = Number(amountSnapshot.amountGap || 0) <= 0 ? "paid" : "partially_paid";
1006
+ void this.syncPaymentsToOrder({
1007
+ payments,
1008
+ paymentStatus,
1009
+ submitWhenPaid: true,
1010
+ smallTicketDataFlag: 1
1011
+ }).catch((error) => {
1012
+ this.logError("auto sync payments failed", {
1013
+ error: error instanceof Error ? error.message : String(error)
1014
+ });
1015
+ });
1016
+ }
1017
+ return payments;
547
1018
  }
548
1019
  /** 更新当前订单中的指定支付项。 */
549
1020
  updateOrderPayment(paymentIdentity, updates) {
@@ -578,6 +1049,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
578
1049
  is_charge_tax: product.is_charge_tax ?? 0,
579
1050
  tax_fee: product.tax_fee,
580
1051
  selling_price: Number(product.selling_price || 0),
1052
+ discount_list: product.discount_list || [],
581
1053
  holder_id: product.holder_id ?? metadata.holder_id,
582
1054
  original_price: product.original_price,
583
1055
  main_product_original_price: metadata.main_product_original_price ?? product.original_price,
@@ -591,8 +1063,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
591
1063
  const bundleMetadata = bundle.metadata || {};
592
1064
  return {
593
1065
  is_price_include_tax: tempOrder.is_price_include_tax,
594
- bundle_id: bundle.bundle_id,
595
- bundle_product_id: bundle.bundle_product_id,
1066
+ // 套餐子项在 tempOrder 上常为 id(如 1718),prepare/deduction 协议要求 bundle_id
1067
+ bundle_id: bundle.bundle_id ?? bundle.id,
1068
+ bundle_product_id: bundle.bundle_product_id ?? bundle._bundle_product_id,
1069
+ bundle_group_id: bundle.bundle_group_id ?? bundle.group_id,
596
1070
  bundle_variant_id: bundle.bundle_variant_id,
597
1071
  price_type: bundle.price_type,
598
1072
  price_type_ext: bundle.price_type_ext,
@@ -731,6 +1205,20 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
731
1205
  transformBaseProductToOrderProduct(params) {
732
1206
  return (0, import_transformBaseProductToOrderProduct.transformBaseProductToOrderProduct)(params);
733
1207
  }
1208
+ async calculateProductBookingPrice(params) {
1209
+ const quotation = this.store.quotation;
1210
+ const customerId = params.customer_id ?? this.getCurrentOrderCustomerId();
1211
+ await this.loadQuotationForPriceQuery({
1212
+ quotation,
1213
+ customer_id: customerId,
1214
+ channel: params.channel
1215
+ });
1216
+ return (0, import_quotationPrice.calculateBaseSalesProductBookingPrice)({
1217
+ ...params,
1218
+ customer_id: customerId,
1219
+ quotation
1220
+ });
1221
+ }
734
1222
  async addProductToOrder(product, booking) {
735
1223
  try {
736
1224
  if (!this.store.order)
@@ -741,16 +1229,35 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
741
1229
  throw error;
742
1230
  }
743
1231
  }
744
- async updateProductInOrder(params) {
1232
+ async updateOrderProduct(params) {
745
1233
  try {
746
1234
  if (!this.store.order)
747
1235
  throw new Error("order 模块未初始化");
748
- const products = await this.store.order.updateProductInOrder(params);
1236
+ const products = await this.store.order.updateOrderProduct(params);
749
1237
  return products;
750
1238
  } catch (error) {
751
1239
  throw error;
752
1240
  }
753
1241
  }
1242
+ async updateOrderProductQuantity(params) {
1243
+ try {
1244
+ if (!this.store.order)
1245
+ throw new Error("order 模块未初始化");
1246
+ const products = await this.store.order.updateOrderProductQuantity(params);
1247
+ return products;
1248
+ } catch (error) {
1249
+ throw error;
1250
+ }
1251
+ }
1252
+ updateOrderBooking(params) {
1253
+ try {
1254
+ if (!this.store.order)
1255
+ throw new Error("order 模块未初始化");
1256
+ return this.store.order.updateOrderBooking(params);
1257
+ } catch (error) {
1258
+ throw error;
1259
+ }
1260
+ }
754
1261
  /**
755
1262
  * 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
756
1263
  * 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
@@ -770,7 +1277,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
770
1277
  }
771
1278
  if (identity.product_bundle !== void 0)
772
1279
  params.product_bundle = identity.product_bundle;
773
- const products = await this.updateProductInOrder(params);
1280
+ const products = await this.updateOrderProduct(params);
774
1281
  return products;
775
1282
  } catch (error) {
776
1283
  throw error;