@pisell/pisellos 2.2.278 → 2.2.280

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 (188) hide show
  1. package/dist/modules/BaseModule.d.ts +1 -0
  2. package/dist/modules/BaseModule.js +24 -28
  3. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
  4. package/dist/modules/BookingContext/utils/productExtend.js +5 -9
  5. package/dist/modules/BookingContext/utils/timeSlices.js +24 -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/Discount/index.d.ts +1 -0
  10. package/dist/modules/Discount/index.js +40 -11
  11. package/dist/modules/Discount/types.d.ts +1 -0
  12. package/dist/modules/Holder/index.d.ts +48 -0
  13. package/dist/modules/Holder/index.js +640 -0
  14. package/dist/modules/Holder/types.d.ts +123 -0
  15. package/dist/modules/Holder/types.js +1 -0
  16. package/dist/modules/Holder/utils.d.ts +13 -0
  17. package/dist/modules/Holder/utils.js +34 -0
  18. package/dist/modules/OpenData/index.js +2 -2
  19. package/dist/modules/Order/index.d.ts +32 -4
  20. package/dist/modules/Order/index.js +868 -675
  21. package/dist/modules/Order/types.d.ts +22 -1
  22. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  23. package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
  24. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  25. package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
  26. package/dist/modules/Order/utils.d.ts +10 -0
  27. package/dist/modules/Order/utils.js +71 -34
  28. package/dist/modules/Payment/index.d.ts +4 -0
  29. package/dist/modules/Payment/index.js +14 -4
  30. package/dist/modules/Payment/walletpass.js +21 -7
  31. package/dist/modules/Product/types.d.ts +1 -0
  32. package/dist/modules/ProductList/index.js +33 -13
  33. package/dist/modules/Quotation/index.d.ts +1 -1
  34. package/dist/modules/Quotation/index.js +2 -2
  35. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  36. package/dist/modules/ResourcePlanner/index.js +181 -0
  37. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  38. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  39. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  40. package/dist/modules/ResourcePlanner/types.js +1 -0
  41. package/dist/modules/Rules/index.js +153 -56
  42. package/dist/modules/SalesSummary/index.js +12 -13
  43. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  44. package/dist/modules/ScanOrderLogger/index.js +15 -2
  45. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  46. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  47. package/dist/modules/Schedule/index.d.ts +3 -1
  48. package/dist/modules/Schedule/index.js +21 -16
  49. package/dist/modules/Summary/utils.js +38 -13
  50. package/dist/modules/index.d.ts +2 -0
  51. package/dist/modules/index.js +3 -1
  52. package/dist/plugins/window.d.ts +1 -0
  53. package/dist/server/index.d.ts +20 -0
  54. package/dist/server/index.js +1101 -909
  55. package/dist/server/modules/order/index.d.ts +2 -0
  56. package/dist/server/modules/order/index.js +261 -96
  57. package/dist/server/modules/order/types.d.ts +1 -1
  58. package/dist/solution/BaseSales/index.d.ts +20 -1
  59. package/dist/solution/BaseSales/index.js +989 -881
  60. package/dist/solution/BaseSales/utils/cartPromotion.js +19 -1
  61. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  62. package/dist/solution/BaseSales/utils.js +31 -20
  63. package/dist/solution/BookingByStep/index.d.ts +17 -2
  64. package/dist/solution/BookingByStep/index.js +294 -215
  65. package/dist/solution/BookingByStep/types.d.ts +2 -1
  66. package/dist/solution/BookingByStep/types.js +3 -1
  67. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  68. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  69. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  70. package/dist/solution/BookingTicket/index.d.ts +21 -3
  71. package/dist/solution/BookingTicket/index.js +312 -226
  72. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  73. package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
  74. package/dist/solution/ScanOrder/index.d.ts +26 -14
  75. package/dist/solution/ScanOrder/index.js +1142 -739
  76. package/dist/solution/ScanOrder/types.d.ts +21 -1
  77. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  78. package/dist/solution/ScanOrder/utils.js +97 -45
  79. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  80. package/dist/solution/ShopDiscount/index.js +125 -87
  81. package/dist/solution/UnifiedBookingSales/index.d.ts +204 -0
  82. package/dist/solution/UnifiedBookingSales/index.js +2211 -0
  83. package/dist/solution/UnifiedBookingSales/types.d.ts +150 -0
  84. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  85. package/dist/solution/VenueBooking/index.d.ts +39 -11
  86. package/dist/solution/VenueBooking/index.js +1167 -841
  87. package/dist/solution/VenueBooking/types.d.ts +3 -0
  88. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  89. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  90. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  91. package/dist/solution/index.d.ts +1 -0
  92. package/dist/solution/index.js +2 -1
  93. package/dist/types/index.d.ts +1 -0
  94. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  95. package/lib/modules/BaseModule.d.ts +1 -0
  96. package/lib/modules/BaseModule.js +24 -37
  97. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
  98. package/lib/modules/BookingContext/utils/productExtend.js +4 -3
  99. package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
  100. package/lib/modules/Customer/index.d.ts +4 -0
  101. package/lib/modules/Customer/index.js +11 -0
  102. package/lib/modules/Customer/types.d.ts +2 -0
  103. package/lib/modules/Discount/index.d.ts +1 -0
  104. package/lib/modules/Discount/index.js +9 -0
  105. package/lib/modules/Discount/types.d.ts +1 -0
  106. package/lib/modules/Holder/index.d.ts +48 -0
  107. package/lib/modules/Holder/index.js +402 -0
  108. package/lib/modules/Holder/types.d.ts +123 -0
  109. package/lib/modules/Holder/types.js +17 -0
  110. package/lib/modules/Holder/utils.d.ts +13 -0
  111. package/lib/modules/Holder/utils.js +71 -0
  112. package/lib/modules/OpenData/index.js +1 -1
  113. package/lib/modules/Order/index.d.ts +32 -4
  114. package/lib/modules/Order/index.js +372 -156
  115. package/lib/modules/Order/types.d.ts +22 -1
  116. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  117. package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
  118. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  119. package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
  120. package/lib/modules/Order/utils.d.ts +10 -0
  121. package/lib/modules/Order/utils.js +39 -6
  122. package/lib/modules/Payment/index.d.ts +4 -0
  123. package/lib/modules/Payment/index.js +7 -0
  124. package/lib/modules/Payment/walletpass.js +12 -0
  125. package/lib/modules/Product/types.d.ts +1 -0
  126. package/lib/modules/ProductList/index.js +49 -31
  127. package/lib/modules/Quotation/index.d.ts +1 -1
  128. package/lib/modules/Quotation/index.js +2 -2
  129. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  130. package/lib/modules/ResourcePlanner/index.js +148 -0
  131. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  132. package/lib/modules/ResourcePlanner/planner.js +933 -0
  133. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  134. package/lib/modules/ResourcePlanner/types.js +17 -0
  135. package/lib/modules/Rules/index.js +117 -25
  136. package/lib/modules/SalesSummary/index.js +6 -7
  137. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  138. package/lib/modules/ScanOrderLogger/index.js +13 -1
  139. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  140. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  141. package/lib/modules/Schedule/index.d.ts +3 -1
  142. package/lib/modules/Schedule/index.js +10 -8
  143. package/lib/modules/Summary/utils.js +21 -1
  144. package/lib/modules/index.d.ts +2 -0
  145. package/lib/modules/index.js +5 -1
  146. package/lib/plugins/window.d.ts +1 -0
  147. package/lib/server/index.d.ts +20 -0
  148. package/lib/server/index.js +124 -19
  149. package/lib/server/modules/order/index.d.ts +2 -0
  150. package/lib/server/modules/order/index.js +75 -5
  151. package/lib/server/modules/order/types.d.ts +1 -1
  152. package/lib/solution/BaseSales/index.d.ts +20 -1
  153. package/lib/solution/BaseSales/index.js +105 -31
  154. package/lib/solution/BaseSales/utils/cartPromotion.js +18 -0
  155. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
  156. package/lib/solution/BaseSales/utils.js +29 -18
  157. package/lib/solution/BookingByStep/index.d.ts +17 -2
  158. package/lib/solution/BookingByStep/index.js +60 -18
  159. package/lib/solution/BookingByStep/types.d.ts +2 -1
  160. package/lib/solution/BookingByStep/types.js +5 -0
  161. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  162. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  163. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  164. package/lib/solution/BookingTicket/index.d.ts +21 -3
  165. package/lib/solution/BookingTicket/index.js +75 -16
  166. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  167. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  168. package/lib/solution/ScanOrder/index.d.ts +26 -14
  169. package/lib/solution/ScanOrder/index.js +449 -182
  170. package/lib/solution/ScanOrder/types.d.ts +21 -1
  171. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  172. package/lib/solution/ScanOrder/utils.js +60 -18
  173. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  174. package/lib/solution/ShopDiscount/index.js +14 -0
  175. package/lib/solution/UnifiedBookingSales/index.d.ts +204 -0
  176. package/lib/solution/UnifiedBookingSales/index.js +1273 -0
  177. package/lib/solution/UnifiedBookingSales/types.d.ts +150 -0
  178. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  179. package/lib/solution/VenueBooking/index.d.ts +39 -11
  180. package/lib/solution/VenueBooking/index.js +322 -110
  181. package/lib/solution/VenueBooking/types.d.ts +3 -0
  182. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  183. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  184. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  185. package/lib/solution/index.d.ts +1 -0
  186. package/lib/solution/index.js +3 -1
  187. package/lib/types/index.d.ts +1 -0
  188. package/package.json +1 -1
@@ -73,8 +73,11 @@ function isRejectedSalesSubmitResult(result) {
73
73
  return candidates.some((candidate) => {
74
74
  if (!candidate || typeof candidate !== "object")
75
75
  return false;
76
- const responseCode = Number(candidate.code ?? candidate.statusCode);
77
- if (Number.isFinite(responseCode) && responseCode >= 400)
76
+ if (candidate.code !== void 0 && candidate.code !== 200 && candidate.code !== "200") {
77
+ return true;
78
+ }
79
+ const statusCode = Number(candidate.statusCode);
80
+ if (Number.isFinite(statusCode) && statusCode >= 400)
78
81
  return true;
79
82
  if (candidate.status === false || candidate.success === false || candidate.result === false) {
80
83
  return true;
@@ -84,9 +87,9 @@ function isRejectedSalesSubmitResult(result) {
84
87
  );
85
88
  });
86
89
  }
87
- function getSalesSubmitErrorMessage(result) {
90
+ function getSalesSubmitErrorMessage(result, fallbackMessage) {
88
91
  var _a, _b;
89
- return (result == null ? void 0 : result.message) || (result == null ? void 0 : result.msg) || ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.message) || ((_b = result == null ? void 0 : result.data) == null ? void 0 : _b.msg) || "Wallet 支付确认失败";
92
+ return (result == null ? void 0 : result.message) || (result == null ? void 0 : result.msg) || ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.message) || ((_b = result == null ? void 0 : result.data) == null ? void 0 : _b.msg) || fallbackMessage;
90
93
  }
91
94
  function toWalletFundValue(value) {
92
95
  try {
@@ -588,7 +591,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
588
591
  });
589
592
  });
590
593
  }
591
- async hydrateLatestLoadedSalesDetail(record, loadSequence) {
594
+ async hydrateLatestLoadedSalesDetail(record, loadSequence, hydrateSource) {
592
595
  let hydratedSales = null;
593
596
  let skippedBeforeHydrate = false;
594
597
  const hydrateTask = async () => {
@@ -598,9 +601,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
598
601
  }
599
602
  if (!this.store.order)
600
603
  throw new Error("order 模块未初始化");
601
- const sales = await this.store.order.hydrateTempOrderFromRecord(record, {
602
- recalcOnHydrate: false
603
- });
604
+ const sales = await this.store.order.hydrateTempOrderFromRecord(
605
+ record,
606
+ hydrateSource === "sessionStorage" ? { recalcOnHydrate: true, source: "sessionStorage" } : { recalcOnHydrate: false }
607
+ );
604
608
  hydratedSales = sales;
605
609
  if (loadSequence !== this.salesDetailLoadSequence)
606
610
  return;
@@ -730,8 +734,24 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
730
734
  if (businessCode !== void 0 && businessCode !== null && String(businessCode).trim() !== "") {
731
735
  strategyContext.business_code = String(businessCode).trim();
732
736
  }
737
+ const availableWalletIds = this.getAvailableWalletIds();
738
+ if (availableWalletIds.length > 0 && !Array.isArray(strategyContext.available_wallet_ids)) {
739
+ strategyContext.available_wallet_ids = availableWalletIds;
740
+ }
733
741
  return strategyContext;
734
742
  }
743
+ /**
744
+ * 子类可在商品重报价前准备客户维度的策略上下文,例如等待 Wallet/优惠资产加载。
745
+ */
746
+ async prepareProductPriceQueryContext(_customerId) {
747
+ }
748
+ /**
749
+ * 默认保留 BaseSales 的 legacy quotation 行为;已由 /product/query 统一完成
750
+ * 智能定价与报价合并的业务可在子类中覆盖,避免二次覆盖权威价格。
751
+ */
752
+ preferAuthoritativeProductQueryPrice() {
753
+ return false;
754
+ }
735
755
  getPriceQuerySchedule(params) {
736
756
  const booking = params.booking || {};
737
757
  if (typeof booking.start_date === "string" && booking.start_date.trim()) {
@@ -924,12 +944,18 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
924
944
  * const params = this.buildSubModuleOtherParams();
925
945
  * this.core.registerModule(orderModule, { otherParams: params });
926
946
  */
927
- buildSubModuleOtherParams() {
947
+ isSessionStoragePersistEnabled() {
948
+ return Boolean(this.cacheId);
949
+ }
950
+ shouldUseSessionStorageForSubModule(_moduleName) {
951
+ return this.isSessionStoragePersistEnabled();
952
+ }
953
+ buildSubModuleOtherParams(moduleName) {
928
954
  return {
929
955
  ...this.otherParams,
930
956
  salesSummaryModuleName: `${this.name}_salesSummary`,
931
957
  fatherModule: this.name,
932
- openCache: this.cacheId ? true : false,
958
+ openCache: this.shouldUseSessionStorageForSubModule(moduleName),
933
959
  cacheId: this.cacheId
934
960
  };
935
961
  }
@@ -940,7 +966,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
940
966
  * await this.syncOtherParamsToSubModules({ channel: 'pos' });
941
967
  */
942
968
  async syncOtherParamsToSubModules(changedParams, { cover = false } = {}) {
943
- const nextSubModuleOtherParams = this.buildSubModuleOtherParams();
944
969
  await Promise.all(
945
970
  Object.entries(this.store).map(async ([moduleName, subModule]) => {
946
971
  if (this.reusedSharedSubModuleNames.has(moduleName)) {
@@ -950,6 +975,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
950
975
  if (!targetModule || typeof targetModule.updateOtherParams !== "function") {
951
976
  return;
952
977
  }
978
+ const nextSubModuleOtherParams = this.buildSubModuleOtherParams(moduleName);
953
979
  await targetModule.updateOtherParams(nextSubModuleOtherParams, {
954
980
  changedParams,
955
981
  cover
@@ -962,14 +988,16 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
962
988
  * sessionStorage 损坏时静默忽略,按空状态注册。
963
989
  */
964
990
  readSessionCacheData() {
965
- if (!this.cacheId || !this.window)
991
+ const cacheId = this.cacheId;
992
+ if (!cacheId || !this.isSessionStoragePersistEnabled() || !this.window) {
966
993
  return {};
994
+ }
967
995
  try {
968
996
  const sessionData = this.window.sessionStorage.getItem(this.name);
969
997
  if (!sessionData)
970
998
  return {};
971
999
  const data = JSON.parse(sessionData);
972
- return data && data[this.cacheId] || {};
1000
+ return data && data[cacheId] || {};
973
1001
  } catch {
974
1002
  return {};
975
1003
  }
@@ -1041,7 +1069,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1041
1069
  return isChanged;
1042
1070
  }
1043
1071
  async initialize(core, options = {}) {
1044
- var _a, _b;
1072
+ var _a, _b, _c, _d;
1045
1073
  this.core = core;
1046
1074
  this.initializeOptions = options || {};
1047
1075
  this.paymentNumberDevicePrefix = null;
@@ -1052,10 +1080,9 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1052
1080
  this.request = core.getPlugin("request");
1053
1081
  this.appPlugin = core.getPlugin("app");
1054
1082
  if (!this.appPlugin) {
1055
- throw new Error("Checkout 解决方案需要 app 插件支持");
1056
1083
  }
1057
- const app = this.appPlugin.getApp();
1058
- this.logger = app.logger;
1084
+ const app = (_c = (_b = this.appPlugin) == null ? void 0 : _b.getApp) == null ? void 0 : _c.call(_b);
1085
+ this.logger = app == null ? void 0 : app.logger;
1059
1086
  const targetCacheData = this.readSessionCacheData();
1060
1087
  const moduleNames = this.getRegisteredModuleNames();
1061
1088
  moduleNames.forEach((step) => {
@@ -1072,15 +1099,15 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1072
1099
  const hooks = this.getSubModuleHooks(step);
1073
1100
  this.store[step] = targetModule;
1074
1101
  this.core.registerModule(targetModule, {
1075
- initialState: (targetCacheData == null ? void 0 : targetCacheData[targetModule.name]) || {},
1102
+ initialState: this.shouldUseSessionStorageForSubModule(step) ? (targetCacheData == null ? void 0 : targetCacheData[targetModule.name]) || {} : {},
1076
1103
  ...hooks ? { hooks } : {},
1077
- otherParams: this.buildSubModuleOtherParams()
1104
+ otherParams: this.buildSubModuleOtherParams(step)
1078
1105
  });
1079
1106
  });
1080
1107
  if (this.store.schedule && !this.isScheduleListLoaded(this.store.schedule)) {
1081
1108
  await this.store.schedule.loadAllSchedule();
1082
1109
  }
1083
- if (this.store.order && typeof ((_b = this.otherParams) == null ? void 0 : _b.enableTempOrderPersist) === "boolean") {
1110
+ if (this.store.order && typeof ((_d = this.otherParams) == null ? void 0 : _d.enableTempOrderPersist) === "boolean") {
1084
1111
  this.store.order.setEnableTempOrderPersist(
1085
1112
  this.otherParams.enableTempOrderPersist
1086
1113
  );
@@ -1141,17 +1168,21 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1141
1168
  const message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || `加载销售详情失败: ${lookup}`;
1142
1169
  throw new Error(message);
1143
1170
  }
1144
- const remoteRecord = filterPendingPaymentsFromLoadedSalesDetail(
1145
- preloadedSalesDetail ?? loadedRecord.data
1146
- );
1171
+ const loadedSalesDetail = preloadedSalesDetail ?? loadedRecord.data;
1172
+ const shouldFilterPendingPayments = params.hydrateSource !== "sessionStorage";
1173
+ const remoteRecord = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(loadedSalesDetail) : loadedSalesDetail;
1147
1174
  const currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
1148
1175
  const mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(
1149
1176
  currentTempOrder,
1150
1177
  remoteRecord,
1151
1178
  "preserve-local"
1152
1179
  ) : remoteRecord;
1153
- const record = filterPendingPaymentsFromLoadedSalesDetail(mergedRecord);
1154
- return await this.hydrateLatestLoadedSalesDetail(record, loadSequence);
1180
+ const record = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(mergedRecord) : mergedRecord;
1181
+ return await this.hydrateLatestLoadedSalesDetail(
1182
+ record,
1183
+ loadSequence,
1184
+ params.hydrateSource
1185
+ );
1155
1186
  } finally {
1156
1187
  this.salesDetailLoadInFlightCount = Math.max(
1157
1188
  0,
@@ -1934,6 +1965,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1934
1965
  throw new Error("BaseSales 解决方案需要 order 模块支持");
1935
1966
  }
1936
1967
  const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
1968
+ const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
1937
1969
  const submitParams = {
1938
1970
  cacheId: this.cacheId,
1939
1971
  platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
@@ -1943,11 +1975,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1943
1975
  request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
1944
1976
  ...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
1945
1977
  ...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
1946
- ...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
1978
+ ...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
1947
1979
  ...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
1948
1980
  ...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
1949
1981
  };
1950
- return this.store.order.submitTempOrder(submitParams);
1982
+ return this.shouldUseCheckoutSyncTask() ? this.store.order.submitTempOrder(submitParams) : this.store.order.submitTempOrderAsync(submitParams);
1951
1983
  }
1952
1984
  async saveSalesOrderDraft(params) {
1953
1985
  var _a, _b, _c, _d;
@@ -1969,20 +2001,35 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
1969
2001
  throw new Error("BaseSales 解决方案需要 order 模块支持");
1970
2002
  }
1971
2003
  const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
2004
+ const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
1972
2005
  const submitParams = {
1973
2006
  cacheId: this.cacheId,
1974
2007
  platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
1975
2008
  businessCode: ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code),
1976
2009
  channel: this.getSubmitOrderSalesChannel(),
1977
2010
  type: (_d = this.otherParams) == null ? void 0 : _d.type,
2011
+ request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
1978
2012
  ...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
1979
2013
  ...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
1980
- ...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
2014
+ ...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
1981
2015
  ...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
1982
2016
  ...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
1983
2017
  };
1984
2018
  return this.store.order.submitTempOrderAsync(submitParams);
1985
2019
  }
2020
+ /**
2021
+ * 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
2022
+ * otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
2023
+ */
2024
+ shouldUseCheckoutSyncTask() {
2025
+ var _a;
2026
+ const configured = (_a = this.otherParams) == null ? void 0 : _a.checkoutSyncTaskEnabled;
2027
+ return typeof configured === "boolean" ? configured : true;
2028
+ }
2029
+ /** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
2030
+ getDefaultCheckoutSmallTicketDataFlag() {
2031
+ return void 0;
2032
+ }
1986
2033
  async printLocalOrderReceipt(lookup) {
1987
2034
  var _a, _b, _c, _d, _e, _f, _g;
1988
2035
  if (!this.store.order) {
@@ -2042,6 +2089,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2042
2089
  const channel = params.channel ?? this.getSubmitOrderSalesChannel();
2043
2090
  const syncParams = {
2044
2091
  ...params,
2092
+ checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask(),
2045
2093
  ...businessCode !== void 0 ? { businessCode } : {},
2046
2094
  ...channel !== void 0 ? { channel } : {}
2047
2095
  };
@@ -2786,7 +2834,9 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2786
2834
  confirmPendingVoucherPayments: true
2787
2835
  });
2788
2836
  if (isRejectedSalesSubmitResult(submitResult)) {
2789
- throw new Error(getSalesSubmitErrorMessage(submitResult));
2837
+ throw new Error(
2838
+ getSalesSubmitErrorMessage(submitResult, "Wallet 支付确认失败")
2839
+ );
2790
2840
  }
2791
2841
  } catch (error) {
2792
2842
  this.store.order.setOrderPayments(beforePayments);
@@ -2889,6 +2939,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2889
2939
  smallTicketDataFlag: 1,
2890
2940
  confirmPendingVoucherPayments: true
2891
2941
  });
2942
+ if (isRejectedSalesSubmitResult(syncResult.submitResult)) {
2943
+ throw new Error(
2944
+ getSalesSubmitErrorMessage(syncResult.submitResult, "订单提交失败")
2945
+ );
2946
+ }
2892
2947
  if (this.store.payment) {
2893
2948
  const committed = this.getCommittedWalletAssets();
2894
2949
  const walletState = this.store.payment.wallet.setCommittedWalletAssets(
@@ -2999,6 +3054,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2999
3054
  smallTicketDataFlag: 1,
3000
3055
  confirmPendingVoucherPayments: true
3001
3056
  });
3057
+ if (isRejectedSalesSubmitResult(syncResult.submitResult)) {
3058
+ throw new Error(
3059
+ getSalesSubmitErrorMessage(syncResult.submitResult, "订单提交失败")
3060
+ );
3061
+ }
3002
3062
  if (this.store.payment) {
3003
3063
  const committed = this.getCommittedWalletAssets();
3004
3064
  const walletState = this.store.payment.wallet.setCommittedWalletAssets(
@@ -3085,6 +3145,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3085
3145
  async calculateProductBookingPrice(params) {
3086
3146
  const quotation = this.store.quotation;
3087
3147
  const customerId = params.customer_id ?? this.getCurrentOrderCustomerId();
3148
+ await this.prepareProductPriceQueryContext(customerId);
3088
3149
  const authoritativeProduct = await this.loadProductForPriceQuery(params, customerId);
3089
3150
  const product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
3090
3151
  await this.loadQuotationForPriceQuery({
@@ -3097,7 +3158,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3097
3158
  product,
3098
3159
  fallback_price: authoritativeProduct ? void 0 : params.fallback_price,
3099
3160
  customer_id: customerId,
3100
- quotation
3161
+ quotation: authoritativeProduct && this.preferAuthoritativeProductQueryPrice() ? void 0 : quotation
3101
3162
  });
3102
3163
  }
3103
3164
  getQuotationCustomerScopeInfo() {
@@ -3134,11 +3195,23 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3134
3195
  quotationScopes
3135
3196
  };
3136
3197
  }
3198
+ hasSmartPricingStrategies() {
3199
+ var _a, _b;
3200
+ const evaluator = (_b = (_a = this.core) == null ? void 0 : _a.context) == null ? void 0 : _b.dataVariantEvaluator;
3201
+ if (!evaluator || typeof evaluator.getStrategyConfigs !== "function") {
3202
+ return false;
3203
+ }
3204
+ const configs = evaluator.getStrategyConfigs();
3205
+ return Array.isArray(configs) && configs.length > 0;
3206
+ }
3137
3207
  shouldRecalculateProductBookingPricesForContextChange(params) {
3138
3208
  const scopeInfo = this.getQuotationCustomerScopeInfo();
3139
3209
  const scopedCustomerIds = new Set(scopeInfo.customerIds.map((id) => String(id)));
3140
3210
  const previousCustomerId = this.normalizePriceContextCustomerId(params.previousCustomerId);
3141
3211
  const nextCustomerId = this.normalizePriceContextCustomerId(params.nextCustomerId);
3212
+ if (this.hasSmartPricingStrategies()) {
3213
+ return previousCustomerId !== nextCustomerId;
3214
+ }
3142
3215
  const previousInScope = previousCustomerId ? scopedCustomerIds.has(previousCustomerId) : false;
3143
3216
  const nextInScope = nextCustomerId ? scopedCustomerIds.has(nextCustomerId) : false;
3144
3217
  let shouldRecalculate = false;
@@ -3159,6 +3232,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3159
3232
  return [];
3160
3233
  const quotation = this.store.quotation;
3161
3234
  const customerId = ((_a = paramsList[0]) == null ? void 0 : _a.customer_id) ?? this.getCurrentOrderCustomerId();
3235
+ await this.prepareProductPriceQueryContext(customerId);
3162
3236
  const productMapsByGroup = /* @__PURE__ */ new Map();
3163
3237
  const groups = /* @__PURE__ */ new Map();
3164
3238
  paramsList.forEach((params) => {
@@ -3216,7 +3290,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
3216
3290
  product,
3217
3291
  fallback_price: authoritativeProduct ? void 0 : params.fallback_price,
3218
3292
  customer_id: customerId,
3219
- quotation
3293
+ quotation: authoritativeProduct && this.preferAuthoritativeProductQueryPrice() ? void 0 : quotation
3220
3294
  });
3221
3295
  });
3222
3296
  }
@@ -366,11 +366,29 @@ function getProductLineNoteSignature(product) {
366
366
  const uid = getOrderProductUid(product);
367
367
  return uid ? `note:${uid}` : `note:${normalizedNote}`;
368
368
  }
369
+ function hasGoodPassDiscount(product) {
370
+ var _a, _b;
371
+ const productBundle = Array.isArray(product == null ? void 0 : product.product_bundle) ? product.product_bundle : [];
372
+ const extendedBundle = Array.isArray((_b = (_a = product == null ? void 0 : product._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) ? product._extend.other.bundle : [];
373
+ const discountLists = [
374
+ product == null ? void 0 : product.discount_list,
375
+ ...productBundle.map((item) => item == null ? void 0 : item.discount_list),
376
+ ...extendedBundle.map((item) => item == null ? void 0 : item.discount_list)
377
+ ];
378
+ return discountLists.some(
379
+ (discountList) => Array.isArray(discountList) && discountList.some(
380
+ (item) => (item == null ? void 0 : item.type) === "good_pass" || (item == null ? void 0 : item.tag) === "good_pass"
381
+ )
382
+ );
383
+ }
369
384
  function getPromotionLineMergeBoundary(product) {
370
385
  var _a, _b;
371
386
  if ((product == null ? void 0 : product.product_id) === void 0 || (product == null ? void 0 : product.product_id) === null) {
372
387
  return `custom:${getOrderProductUid(product)}`;
373
388
  }
389
+ if (hasGoodPassDiscount(product)) {
390
+ return `good-pass:${getOrderProductUid(product)}`;
391
+ }
374
392
  if (Number(((_a = product == null ? void 0 : product.product_sku) == null ? void 0 : _a.open_sold_weight) || 0) === 1) {
375
393
  return `weighing:${getOrderProductUid(product)}`;
376
394
  }
@@ -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,
@@ -60,33 +60,44 @@ function createEmptySummary() {
60
60
  };
61
61
  }
62
62
  function buildProductLineFingerprint(productOptionItem, productBundle) {
63
- const optArr = Array.isArray(productOptionItem) ? productOptionItem : [];
64
- const normalizedOpts = optArr.map((item) => ({
65
- option_group_item_id: Number(item == null ? void 0 : item.option_group_item_id) || 0,
66
- option_group_id: Number(item == null ? void 0 : item.option_group_id) || 0,
67
- num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
68
- price: String((item == null ? void 0 : item.add_price) ?? (item == null ? void 0 : item.price) ?? "")
69
- })).sort((p, q) => {
70
- if (p.option_group_item_id !== q.option_group_item_id) {
71
- return p.option_group_item_id - q.option_group_item_id;
72
- }
73
- if (p.option_group_id !== q.option_group_id)
74
- return p.option_group_id - q.option_group_id;
75
- if (p.num !== q.num)
76
- return p.num - q.num;
77
- return p.price.localeCompare(q.price);
78
- });
63
+ const normalizeOptions = (options) => {
64
+ const optionArr = Array.isArray(options) ? options : [];
65
+ return optionArr.map((item) => ({
66
+ option_group_item_id: Number(item == null ? void 0 : item.option_group_item_id) || 0,
67
+ option_group_id: Number(item == null ? void 0 : item.option_group_id) || 0,
68
+ num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
69
+ price: String((item == null ? void 0 : item.add_price) ?? (item == null ? void 0 : item.price) ?? "")
70
+ })).sort((p, q) => {
71
+ if (p.option_group_item_id !== q.option_group_item_id) {
72
+ return p.option_group_item_id - q.option_group_item_id;
73
+ }
74
+ if (p.option_group_id !== q.option_group_id) {
75
+ return p.option_group_id - q.option_group_id;
76
+ }
77
+ if (p.num !== q.num)
78
+ return p.num - q.num;
79
+ return p.price.localeCompare(q.price);
80
+ });
81
+ };
82
+ const normalizedOpts = normalizeOptions(productOptionItem);
79
83
  const bundleArr = Array.isArray(productBundle) ? productBundle : [];
80
84
  const normalizedBundles = bundleArr.map((item) => ({
81
85
  bundle_id: Number((item == null ? void 0 : item.bundle_id) ?? (item == null ? void 0 : item.id) ?? 0) || 0,
82
86
  product_id: Number(item == null ? void 0 : item.product_id) || 0,
83
- num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1
87
+ product_variant_id: Number((item == null ? void 0 : item.bundle_variant_id) ?? (item == null ? void 0 : item.product_variant_id)) || 0,
88
+ num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
89
+ option: normalizeOptions(item == null ? void 0 : item.option)
84
90
  })).sort((p, q) => {
85
91
  if (p.bundle_id !== q.bundle_id)
86
92
  return p.bundle_id - q.bundle_id;
87
93
  if (p.product_id !== q.product_id)
88
94
  return p.product_id - q.product_id;
89
- return p.num - q.num;
95
+ if (p.product_variant_id !== q.product_variant_id) {
96
+ return p.product_variant_id - q.product_variant_id;
97
+ }
98
+ if (p.num !== q.num)
99
+ return p.num - q.num;
100
+ return JSON.stringify(p.option).localeCompare(JSON.stringify(q.option));
90
101
  });
91
102
  return JSON.stringify([normalizedOpts, normalizedBundles]);
92
103
  }
@@ -10,6 +10,7 @@ import { ITime } from '../../modules/Date/types';
10
10
  import dayjs from 'dayjs';
11
11
  import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
12
12
  import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
13
+ import { IAppendFormRecordParams } from '../../modules/Holder/types';
13
14
  export declare class BookingByStepImpl extends BaseModule implements Module {
14
15
  protected defaultName: string;
15
16
  protected defaultVersion: string;
@@ -126,6 +127,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
126
127
  * @param params
127
128
  */
128
129
  fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
130
+ /**
131
+ * 获取 holder 表单 map
132
+ */
133
+ getHolderFormMap(): import("../../modules").HolderFormMap;
134
+ /**
135
+ * 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
136
+ */
137
+ refreshAllHolderFormRecords(params?: {
138
+ customer_id?: number;
139
+ }): Promise<import("../../modules").HolderFormMap>;
140
+ /**
141
+ * 添加表单记录
142
+ */
143
+ appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
129
144
  setDateRange(dateRange: ITime[]): Promise<void>;
130
145
  clearDateRange(): void;
131
146
  getDateRange(): Promise<ITime[]>;
@@ -302,7 +317,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
302
317
  autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
303
318
  errorList: any[];
304
319
  };
305
- getTimeSlotByAllResources(resources_code: string): any[];
320
+ getTimeSlotByAllResources(resources_code: string, split?: number): any[];
306
321
  getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
307
322
  resources_code: string;
308
323
  startDate: string;
@@ -311,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
326
  date: string;
312
327
  status: string;
313
328
  week: string;
314
- weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
315
330
  }[]>;
316
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
332
  private getScheduleDataByIds;