@pisell/pisellos 0.10.14 → 0.10.16

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 (301) hide show
  1. package/dist/core/index.js +6 -9
  2. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  3. package/dist/model/strategy/strategy-example.js +5 -19
  4. package/dist/modules/Cart/index.js +0 -3
  5. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  6. package/dist/modules/Date/index.js +1 -5
  7. package/dist/modules/Discount/index.js +2 -4
  8. package/dist/modules/OpenData/index.js +0 -2
  9. package/dist/modules/Order/index.d.ts +1 -1
  10. package/dist/modules/Order/index.js +75 -91
  11. package/dist/modules/Order/types.d.ts +5 -1
  12. package/dist/modules/Order/utils/virtualSettlement.d.ts +8 -1
  13. package/dist/modules/Order/utils/virtualSettlement.js +15 -2
  14. package/dist/modules/Order/utils.js +7 -1
  15. package/dist/modules/Payment/index.js +97 -162
  16. package/dist/modules/Product/types.d.ts +2 -0
  17. package/dist/modules/Rules/index.js +1 -4
  18. package/dist/modules/Schedule/index.js +0 -1
  19. package/dist/modules/Schedule/utils.js +0 -1
  20. package/dist/modules/Step/index.js +0 -1
  21. package/dist/plugins/request.js +1 -4
  22. package/dist/plugins/window.js +2 -6
  23. package/dist/server/index.js +97 -129
  24. package/dist/server/modules/menu/index.js +32 -41
  25. package/dist/server/modules/order/index.js +2 -4
  26. package/dist/server/modules/products/index.js +24 -42
  27. package/dist/server/modules/quotation/index.js +29 -38
  28. package/dist/server/modules/resource/index.js +3 -4
  29. package/dist/server/modules/schedule/index.js +27 -35
  30. package/dist/server/utils/product.js +0 -1
  31. package/dist/solution/BaseSales/index.js +107 -76
  32. package/dist/solution/BaseSales/types.d.ts +2 -0
  33. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  34. package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
  35. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  36. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +7 -1
  37. package/dist/solution/BaseSales/utils.js +6 -3
  38. package/dist/solution/BookingByStep/index.d.ts +2 -2
  39. package/dist/solution/BookingByStep/index.js +7 -59
  40. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  41. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  42. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  43. package/dist/solution/BookingTicket/index.js +8 -4
  44. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
  45. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  46. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  47. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  48. package/dist/solution/BuyTickets/index.js +9 -12
  49. package/dist/solution/Checkout/index.js +177 -252
  50. package/dist/solution/Checkout/utils/index.js +4 -16
  51. package/dist/solution/RegisterAndLogin/index.js +30 -76
  52. package/dist/solution/ScanOrder/index.js +50 -60
  53. package/dist/solution/ScanOrder/types.d.ts +2 -0
  54. package/dist/solution/ScanOrder/utils.js +6 -3
  55. package/dist/solution/ShopDiscount/index.js +2 -7
  56. package/dist/solution/VenueBooking/index.js +45 -55
  57. package/dist/utils/task.js +15 -18
  58. package/dist/utils/watch.js +0 -1
  59. package/lib/apis/picoding.js +2 -0
  60. package/lib/core/index.js +131 -131
  61. package/lib/effects/index.js +46 -57
  62. package/lib/index.js +82 -49
  63. package/lib/model/index.js +14 -21
  64. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  65. package/lib/model/strategy/adapter/dataVariant/evaluator.js +209 -315
  66. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  67. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  68. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  69. package/lib/model/strategy/adapter/index.js +100 -64
  70. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  71. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  72. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  73. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  74. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  75. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  76. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  77. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  78. package/lib/model/strategy/adapter/promotion/index.js +43 -48
  79. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  80. package/lib/model/strategy/adapter/type.js +4 -16
  81. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  82. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  83. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  84. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  85. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  86. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  87. package/lib/model/strategy/engine.js +270 -168
  88. package/lib/model/strategy/index.js +49 -34
  89. package/lib/model/strategy/strategy-example.js +243 -239
  90. package/lib/model/strategy/type.js +100 -40
  91. package/lib/modules/Account/index.js +39 -53
  92. package/lib/modules/Account/types.js +20 -33
  93. package/lib/modules/AccountList/index.js +116 -154
  94. package/lib/modules/AccountList/types.js +30 -31
  95. package/lib/modules/AccountList/utils.js +18 -30
  96. package/lib/modules/BaseModule.js +23 -42
  97. package/lib/modules/BookingContext/index.js +158 -136
  98. package/lib/modules/BookingContext/types.js +46 -32
  99. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  100. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  101. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  102. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  103. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  104. package/lib/modules/BookingContext/utils/index.js +124 -41
  105. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  106. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  107. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  108. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  109. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  110. package/lib/modules/BookingContext/utils/resources.js +209 -167
  111. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  112. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  113. package/lib/modules/Cart/index.js +170 -124
  114. package/lib/modules/Cart/types.js +46 -51
  115. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  116. package/lib/modules/Cart/utils/cartDate.js +56 -61
  117. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  118. package/lib/modules/Cart/utils/cartNote.js +27 -32
  119. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  120. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  121. package/lib/modules/Cart/utils/cartResource.js +70 -78
  122. package/lib/modules/Cart/utils/changePrice.js +22 -50
  123. package/lib/modules/Cart/utils/index.js +106 -48
  124. package/lib/modules/Customer/constants.js +13 -34
  125. package/lib/modules/Customer/index.js +235 -172
  126. package/lib/modules/Customer/types.js +38 -35
  127. package/lib/modules/Date/index.js +116 -115
  128. package/lib/modules/Date/types.js +16 -28
  129. package/lib/modules/Date/utils.js +174 -123
  130. package/lib/modules/Discount/index.js +133 -143
  131. package/lib/modules/Discount/types.js +9 -31
  132. package/lib/modules/Guests/index.js +30 -56
  133. package/lib/modules/Guests/types.js +23 -33
  134. package/lib/modules/Holder/index.js +209 -189
  135. package/lib/modules/Holder/types.js +4 -16
  136. package/lib/modules/Holder/utils.js +20 -49
  137. package/lib/modules/OpenData/index.js +70 -76
  138. package/lib/modules/OpenData/types.js +4 -16
  139. package/lib/modules/OpenData/utils.js +44 -78
  140. package/lib/modules/Order/index.d.ts +1 -1
  141. package/lib/modules/Order/index.js +1810 -2238
  142. package/lib/modules/Order/payment-utils.js +77 -120
  143. package/lib/modules/Order/types.d.ts +5 -1
  144. package/lib/modules/Order/types.js +87 -35
  145. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  146. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  147. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  148. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  149. package/lib/modules/Order/utils/virtualSettlement.d.ts +8 -1
  150. package/lib/modules/Order/utils/virtualSettlement.js +126 -164
  151. package/lib/modules/Order/utils.js +834 -668
  152. package/lib/modules/Payment/cash.js +20 -33
  153. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  154. package/lib/modules/Payment/eftpos.js +16 -30
  155. package/lib/modules/Payment/index.js +532 -399
  156. package/lib/modules/Payment/mx51.js +1 -0
  157. package/lib/modules/Payment/types.js +230 -108
  158. package/lib/modules/Payment/utils.js +52 -51
  159. package/lib/modules/Payment/walletpass.js +485 -660
  160. package/lib/modules/Product/index.js +51 -46
  161. package/lib/modules/Product/types.d.ts +2 -0
  162. package/lib/modules/Product/types.js +4 -16
  163. package/lib/modules/Product/utils.js +32 -33
  164. package/lib/modules/ProductList/index.js +138 -161
  165. package/lib/modules/ProductList/types.js +9 -31
  166. package/lib/modules/Quotation/index.js +66 -100
  167. package/lib/modules/Quotation/types.js +4 -16
  168. package/lib/modules/Resource/index.js +27 -59
  169. package/lib/modules/Resource/types.js +22 -32
  170. package/lib/modules/Resource/utils.js +30 -38
  171. package/lib/modules/ResourcePlanner/index.js +25 -23
  172. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  173. package/lib/modules/ResourcePlanner/planner.js +591 -772
  174. package/lib/modules/ResourcePlanner/types.js +10 -29
  175. package/lib/modules/Rules/index.js +1218 -959
  176. package/lib/modules/Rules/types.js +17 -40
  177. package/lib/modules/SalesSummary/index.js +78 -89
  178. package/lib/modules/SalesSummary/types.js +4 -16
  179. package/lib/modules/SalesSummary/utils.js +359 -442
  180. package/lib/modules/ScanOrderLogger/index.js +59 -79
  181. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  182. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  183. package/lib/modules/ScanOrderLogger/types.js +4 -16
  184. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  185. package/lib/modules/Schedule/index.js +100 -114
  186. package/lib/modules/Schedule/type.js +4 -16
  187. package/lib/modules/Schedule/types.js +4 -16
  188. package/lib/modules/Schedule/utils.js +433 -291
  189. package/lib/modules/Step/index.js +40 -52
  190. package/lib/modules/Step/tyeps.js +4 -16
  191. package/lib/modules/Summary/index.js +66 -71
  192. package/lib/modules/Summary/types.js +4 -16
  193. package/lib/modules/Summary/utils.js +773 -418
  194. package/lib/modules/SurchargeList/index.js +46 -60
  195. package/lib/modules/SurchargeList/types.js +4 -16
  196. package/lib/modules/index.js +245 -63
  197. package/lib/plugins/app.js +4 -16
  198. package/lib/plugins/index.js +36 -25
  199. package/lib/plugins/request.js +137 -126
  200. package/lib/plugins/shopStore.js +4 -16
  201. package/lib/plugins/user.js +4 -16
  202. package/lib/plugins/window.js +171 -179
  203. package/lib/server/index.js +3027 -2655
  204. package/lib/server/modules/floor-plan/index.js +102 -123
  205. package/lib/server/modules/floor-plan/types.js +15 -30
  206. package/lib/server/modules/index.js +106 -68
  207. package/lib/server/modules/menu/index.js +146 -122
  208. package/lib/server/modules/menu/types.js +18 -31
  209. package/lib/server/modules/order/index.js +758 -956
  210. package/lib/server/modules/order/types.js +122 -33
  211. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  212. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  213. package/lib/server/modules/payment/index.js +59 -83
  214. package/lib/server/modules/payment/types.js +4 -16
  215. package/lib/server/modules/products/index.js +575 -459
  216. package/lib/server/modules/products/types.js +44 -34
  217. package/lib/server/modules/quotation/index.js +137 -172
  218. package/lib/server/modules/quotation/types.js +21 -31
  219. package/lib/server/modules/resource/index.js +213 -184
  220. package/lib/server/modules/resource/types.js +42 -33
  221. package/lib/server/modules/schedule/index.js +135 -123
  222. package/lib/server/modules/schedule/types.js +14 -21
  223. package/lib/server/modules/schedule/utils.js +334 -163
  224. package/lib/server/types.js +4 -16
  225. package/lib/server/utils/index.js +25 -23
  226. package/lib/server/utils/product.js +196 -139
  227. package/lib/server/utils/schedule.js +34 -41
  228. package/lib/server/utils/small-ticket.js +479 -456
  229. package/lib/server/utils/time.js +40 -49
  230. package/lib/solution/BaseSales/index.js +1276 -1485
  231. package/lib/solution/BaseSales/types.d.ts +2 -0
  232. package/lib/solution/BaseSales/types.js +42 -38
  233. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  234. package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
  235. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  236. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  237. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  238. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +138 -180
  239. package/lib/solution/BaseSales/utils.js +161 -143
  240. package/lib/solution/BookingByStep/index.d.ts +2 -2
  241. package/lib/solution/BookingByStep/index.js +1527 -1340
  242. package/lib/solution/BookingByStep/types.js +40 -99
  243. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  244. package/lib/solution/BookingByStep/utils/products.js +42 -52
  245. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  246. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  247. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  248. package/lib/solution/BookingTicket/index.js +598 -514
  249. package/lib/solution/BookingTicket/types.js +99 -77
  250. package/lib/solution/BookingTicket/utils/addProductDecision.js +229 -190
  251. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  252. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  253. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  254. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  255. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  256. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  257. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  258. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  259. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  260. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  261. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  262. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  263. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  264. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  265. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  266. package/lib/solution/BuyTickets/index.js +67 -70
  267. package/lib/solution/BuyTickets/types.js +22 -38
  268. package/lib/solution/Checkout/index.js +1451 -1158
  269. package/lib/solution/Checkout/types.js +91 -61
  270. package/lib/solution/Checkout/utils/index.js +228 -156
  271. package/lib/solution/PlaceOrder/index.js +55 -0
  272. package/lib/solution/RegisterAndLogin/config.js +493 -460
  273. package/lib/solution/RegisterAndLogin/index.js +633 -630
  274. package/lib/solution/RegisterAndLogin/types.js +189 -76
  275. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  276. package/lib/solution/Sales/index.js +328 -324
  277. package/lib/solution/Sales/types.js +27 -33
  278. package/lib/solution/ScanOrder/index.js +822 -852
  279. package/lib/solution/ScanOrder/types.d.ts +2 -0
  280. package/lib/solution/ScanOrder/types.js +33 -34
  281. package/lib/solution/ScanOrder/utils.js +412 -374
  282. package/lib/solution/ShopDiscount/index.js +226 -232
  283. package/lib/solution/ShopDiscount/types.js +15 -37
  284. package/lib/solution/ShopDiscount/utils.js +300 -172
  285. package/lib/solution/UnifiedBookingSales/index.js +1052 -1213
  286. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  287. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  288. package/lib/solution/VenueBooking/index.js +811 -879
  289. package/lib/solution/VenueBooking/types.js +19 -39
  290. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  291. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  292. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  293. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  294. package/lib/solution/VenueBooking/utils.js +130 -67
  295. package/lib/solution/index.js +124 -41
  296. package/lib/store/createStore.js +32 -29
  297. package/lib/types/index.js +4 -16
  298. package/lib/utils/payment-number.js +26 -46
  299. package/lib/utils/task.js +36 -36
  300. package/lib/utils/watch.js +81 -47
  301. package/package.json +2 -1
@@ -106,21 +106,20 @@ var PisellOSCore = /*#__PURE__*/function () {
106
106
  _context.next = 16;
107
107
  return this.server.initialize(this.serverOptions.modules, this.serverOptions.autoInitData !== false, options);
108
108
  case 16:
109
- console.log('[PisellOS] ✅ Server 初始化完成,所有数据已预加载');
110
109
  this.log('[PisellOS] Server 初始化完成');
111
- _context.next = 25;
110
+ _context.next = 24;
112
111
  break;
113
- case 20:
114
- _context.prev = 20;
112
+ case 19:
113
+ _context.prev = 19;
115
114
  _context.t0 = _context["catch"](6);
116
115
  console.error('[PisellOS] ❌ Server 初始化失败:', _context.t0);
117
116
  this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context.t0), 'error');
118
117
  throw _context.t0;
119
- case 25:
118
+ case 24:
120
119
  case "end":
121
120
  return _context.stop();
122
121
  }
123
- }, _callee, this, [[6, 20]]);
122
+ }, _callee, this, [[6, 19]]);
124
123
  }));
125
124
  function initializeServer(_x) {
126
125
  return _initializeServer.apply(this, arguments);
@@ -138,11 +137,10 @@ var PisellOSCore = /*#__PURE__*/function () {
138
137
  var prefix = '[PisellOS]';
139
138
  switch (level) {
140
139
  case 'info':
141
- console.log("".concat(prefix, " ").concat(message));
142
140
  break;
143
141
  case 'warn':
144
142
  // 使用 console.log 避免显示堆栈跟踪,提升性能
145
- console.log("%c".concat(prefix, "%c ").concat(message), 'color: #f59e0b; font-weight: bold;', 'color: #f59e0b;');
143
+
146
144
  break;
147
145
  case 'error':
148
146
  console.error("".concat(prefix, " ").concat(message));
@@ -249,7 +247,6 @@ var PisellOSCore = /*#__PURE__*/function () {
249
247
  }
250
248
  // 预先给模块初始化值系统
251
249
  var _createStore = createStore((options === null || options === void 0 ? void 0 : options.initialState) || {}, module.name, function (path, value) {
252
- console.log('core 检测到模块值更新', module.name, path, value);
253
250
  _this3.effects.emit("".concat(module.name, ":changed"), {
254
251
  path: path,
255
252
  value: value
@@ -164,8 +164,6 @@ var strategyConfigs = [
164
164
  // ============================================
165
165
 
166
166
  function runExample() {
167
- console.log('========== WalletPass 评估器示例 ==========\n');
168
-
169
167
  // 创建评估器实例
170
168
  var evaluator = new WalletPassEvaluator();
171
169
 
@@ -178,38 +176,17 @@ function runExample() {
178
176
  });
179
177
 
180
178
  // 输出结果
181
- console.log('订单信息:');
182
- console.log("- \u603B\u91D1\u989D: ".concat(180, " \u5143"));
183
- console.log("- \u5546\u54C1: ".concat(products.map(function (p) {
184
- return "".concat(p.name, "(").concat(p.quantity, "\u4EF6)");
185
- }).join(', '), "\n"));
186
- console.log('评估结果:\n');
179
+
187
180
  results.forEach(function (result, index) {
188
- console.log("Voucher ".concat(index + 1, ": ").concat(result.voucher.id));
189
- console.log(" \u9762\u989D: ".concat(result.voucher.amount, " \u5143"));
190
- console.log(" \u53EF\u7528: ".concat(result.isApplicable ? '✅ 是' : '❌ 否'));
191
- if (result.isApplicable) {
192
- console.log(" \u6700\u5927\u62B5\u6263: ".concat(result.maxDeduction, " \u5143"));
193
- console.log(" \u6BCF\u5355\u53EF\u7528: ".concat(result.canUseCount, " \u5F20"));
194
- console.log(" \u62B5\u6263\u7A0E\u8D39: ".concat(result.deductTaxAndFee ? '是' : '否'));
195
- console.log(" \u9002\u7528\u5546\u54C1: ".concat(result.applicableProductIds.join(', ')));
196
- } else {
197
- console.log(" \u539F\u56E0: ".concat(result.reason));
198
- console.log(" \u539F\u56E0\u7801: ".concat(result.reasonCode));
199
- }
200
- console.log('');
181
+ if (result.isApplicable) {} else {}
201
182
  });
202
183
 
203
184
  // 筛选可用的 vouchers
204
185
  var availableVouchers = results.filter(function (r) {
205
186
  return r.isApplicable;
206
187
  });
207
- console.log("\n\u5171 ".concat(availableVouchers.length, " \u5F20\u53EF\u7528"));
208
188
  if (availableVouchers.length > 0) {
209
- console.log('可用 voucher ID:');
210
- availableVouchers.forEach(function (v) {
211
- console.log(" - ".concat(v.voucher.id, ": \u6700\u591A\u62B5\u6263 ").concat(v.maxDeduction, " \u5143"));
212
- });
189
+ availableVouchers.forEach(function (v) {});
213
190
  }
214
191
  }
215
192
 
@@ -246,8 +246,6 @@ var codeContext = {
246
246
  // ============================================
247
247
 
248
248
  function runExamples() {
249
- console.log('====== 策略模型使用示例 ======\n');
250
-
251
249
  // 创建引擎实例(开启调试和追踪)
252
250
  var engine = createStrategyEngine({
253
251
  debug: true,
@@ -255,32 +253,23 @@ function runExamples() {
255
253
  });
256
254
 
257
255
  // 示例1: 代金券
258
- console.log('示例1: 10元代金券');
256
+
259
257
  var result1 = engine.evaluate(voucherConfig, voucherContext);
260
- console.log('结果:', JSON.stringify(result1, null, 2));
261
- console.log('\n');
262
258
 
263
259
  // 示例2: 阶梯满减
264
- console.log('示例2: 阶梯满减(订单金额250)');
260
+
265
261
  var result2 = engine.evaluate(tieredDiscountConfig, tieredContext);
266
- console.log('结果:', JSON.stringify(result2, null, 2));
267
- console.log('\n');
268
262
 
269
263
  // 示例3: Code 模式
270
- console.log('示例3: Code 模式条件');
264
+
271
265
  var result3 = engine.evaluate(codeConditionConfig, codeContext);
272
- console.log('结果:', JSON.stringify(result3, null, 2));
273
- console.log('\n');
274
266
 
275
267
  // 快速评估(不需要创建引擎实例)
276
- console.log('示例4: 快速评估');
268
+
277
269
  var result4 = evaluate(voucherConfig, voucherContext);
278
- console.log('适用:', result4.applicable);
279
- console.log('匹配动作数:', result4.matchedActions.length);
280
- console.log('\n');
281
270
 
282
271
  // 注册自定义运算符
283
- console.log('示例5: 自定义运算符');
272
+
284
273
  engine.registerOperator('divisible_by', function (fieldValue, compareValue) {
285
274
  return Number(fieldValue) % Number(compareValue) === 0;
286
275
  });
@@ -317,11 +306,8 @@ function runExamples() {
317
306
  }
318
307
  };
319
308
  var result5 = engine.evaluate(customOperatorConfig, customContext);
320
- console.log('结果:', result5.applicable ? '适用' : '不适用');
321
- console.log('匹配动作:', result5.matchedActions);
322
309
 
323
310
  // 调试信息
324
- console.log('\n引擎调试信息:', engine.getDebugInfo());
325
311
  }
326
312
 
327
313
  // 运行示例(如果直接执行此文件)
@@ -95,9 +95,6 @@ export var CartModule = /*#__PURE__*/function (_BaseModule) {
95
95
  }
96
96
  throw new Error('购物车模块需要 window 插件支持');
97
97
  case 11:
98
- // this.store.temp = {};
99
- console.log('[CartModule] 初始化完成');
100
- case 12:
101
98
  case "end":
102
99
  return _context.stop();
103
100
  }
@@ -63,7 +63,6 @@ export var handleVariantProduct = function handleVariantProduct(product) {
63
63
  */
64
64
  export var formatProductToCartItem = function formatProductToCartItem(params) {
65
65
  var _product$custom_depos;
66
- console.log('formatProductToCartItem>>>>>>', params);
67
66
  var cartItem = params.cartItem,
68
67
  product = params.product,
69
68
  bundle = params.bundle,
@@ -294,8 +294,6 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
294
294
  // 将 start_time 向上取整到下一个10分钟整数
295
295
  var roundedStartTime = _this3.roundUpToNext10Minutes(resourceStartTime);
296
296
  var roundedStartTimeDayjs = dayjs(roundedStartTime);
297
- console.log("[DateModule] \u4FEE\u6B63\u65F6\u95F4\u6BB5\u5F00\u59CB\u65F6\u95F4: ".concat(timeSlot.start_at, " -> ").concat(roundedStartTime, " (\u8D44\u6E90ID: ").concat(resource.id, ", \u539F\u59CBstart_time: ").concat(resource.start_time, ")"));
298
-
299
297
  // 将 start_at 修正为向上取整后的时间
300
298
  var correctedTimeSlot = _objectSpread(_objectSpread({}, timeSlot), {}, {
301
299
  start_at: roundedStartTime
@@ -303,7 +301,6 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
303
301
 
304
302
  // 检查修正后的 end_at 是否也早于修正后的 start_time
305
303
  if (endAt.isBefore(roundedStartTimeDayjs)) {
306
- console.log("[DateModule] \u65F6\u95F4\u6BB5\u65E0\u6548\uFF0C\u5C06\u88AB\u5220\u9664: ".concat(timeSlot.start_at, " - ").concat(timeSlot.end_at, " (\u8D44\u6E90ID: ").concat(resource.id, ", \u4FEE\u6B63\u540Estart_time: ").concat(roundedStartTime, ")"));
307
304
  return null; // 标记为删除
308
305
  }
309
306
  return correctedTimeSlot;
@@ -366,9 +363,8 @@ export var DateModule = /*#__PURE__*/function (_BaseModule) {
366
363
  case 18:
367
364
  _context4.prev = 18;
368
365
  _context4.t0 = _context4["catch"](7);
369
- console.log('getAvailableTimeList_error', _context4.t0);
370
366
  return _context4.abrupt("return", disableAllDates(dates));
371
- case 22:
367
+ case 21:
372
368
  case "end":
373
369
  return _context4.stop();
374
370
  }
@@ -501,9 +501,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
501
501
  _context7.next = 4;
502
502
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
503
503
  case 4:
504
- console.log('[Discount] 已销毁');
505
504
  _get(_getPrototypeOf(DiscountModule.prototype), "destroy", this).call(this);
506
- case 6:
505
+ case 5:
507
506
  case "end":
508
507
  return _context7.stop();
509
508
  }
@@ -523,8 +522,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
523
522
  case 0:
524
523
  this.store.discountList = [];
525
524
  this.store.originalDiscountList = [];
526
- console.log('[Discount] clear');
527
- case 3:
525
+ case 2:
528
526
  case "end":
529
527
  return _context8.stop();
530
528
  }
@@ -74,8 +74,6 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
74
74
  }
75
75
  throw new Error('OpenDataModule 需要 window 插件支持');
76
76
  case 14:
77
- console.log('[OpenDataModule] 初始化完成');
78
- case 15:
79
77
  case "end":
80
78
  return _context.stop();
81
79
  }
@@ -576,7 +576,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
576
576
  */
577
577
  hydrateTempOrderFromRecord(record: Record<string, any>, options?: {
578
578
  recalcOnHydrate?: boolean;
579
- source?: 'salesDetail' | 'sessionStorage';
579
+ source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
580
580
  }): Promise<OrderTempOrder>;
581
581
  /**
582
582
  * 兼容后端详情将 holder 放在 metadata.holder 的历史形态,统一补到运行时展示路径。
@@ -37,7 +37,7 @@ import { isNormalProduct } from "../Product/utils";
37
37
  import dayjs from 'dayjs';
38
38
  import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
39
39
  import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
40
- import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid } from "../../solution/BaseSales/utils/cartPromotion";
40
+ import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid, PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY } from "../../solution/BaseSales/utils/cartPromotion";
41
41
  import { buildProductLineFingerprint, getProductIdentityIndex, getSafeProductNum, isIdentityMatch, normalizeOrderProduct } from "../../solution/ScanOrder/utils";
42
42
  import { hasManualProductDiscountFlag, syncManualProductDiscountProductNum } from "./utils/manualProductDiscount";
43
43
  import { expandHydratedProductsForDiscountCollection, restoreHydratedBundleDiscounts } from "./utils/bundleDiscountHydration";
@@ -2355,6 +2355,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2355
2355
  }, {
2356
2356
  key: "restoreOriginalSnapshotIfProductsUnchanged",
2357
2357
  value: function restoreOriginalSnapshotIfProductsUnchanged(tempOrder, snapshot) {
2358
+ // merge hydrate 的商品集合包含本地未提交行,但 summary 仍来自远端旧订单,不能复用。
2359
+ if (snapshot.requiresFullSummaryRecalculation === true) return null;
2358
2360
  var currentFingerprint = this.buildOrderProductsFingerprint(tempOrder.products);
2359
2361
  var manualDepositOverride = this.getManualDepositOverride(tempOrder);
2360
2362
  if (currentFingerprint !== snapshot.productFingerprint) {
@@ -4168,9 +4170,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4168
4170
  booking: booking
4169
4171
  }) : null;
4170
4172
  var productToAdd = (linked === null || linked === void 0 ? void 0 : linked.product) || product;
4173
+ var disableMerge = (options === null || options === void 0 ? void 0 : options.disableMerge) === true;
4171
4174
  this.assertAndLockProductSettlement(tempOrder, productToAdd);
4172
- var incomingFingerprint = buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
4175
+ var incomingFingerprint = disableMerge ? '' : buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
4173
4176
  var normalizedIncoming = this.normalizeVirtualSettlementProductIfEnabled(mergeOrderProductDisplayFields(productToAdd, normalizeOrderProduct(productToAdd)));
4177
+ if (disableMerge) {
4178
+ normalizedIncoming.metadata = _objectSpread(_objectSpread({}, normalizedIncoming.metadata || {}), {}, _defineProperty({}, PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY, true));
4179
+ }
4174
4180
  var isWeighingProduct = Number(((_normalizedIncoming$p = normalizedIncoming.product_sku) === null || _normalizedIncoming$p === void 0 ? void 0 : _normalizedIncoming$p.open_sold_weight) || 0) === 1;
4175
4181
  var netWeight = Number((_normalizedIncoming$p2 = normalizedIncoming.product_sku) === null || _normalizedIncoming$p2 === void 0 ? void 0 : _normalizedIncoming$p2.net_weight);
4176
4182
  if (isWeighingProduct && (!Number.isFinite(netWeight) || netWeight <= 0)) {
@@ -4189,7 +4195,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4189
4195
  var hasIncomingManualProductDiscount = isManualProductDiscountProduct(normalizedIncoming);
4190
4196
  var hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
4191
4197
  var isIncomingCustomItem = ((_productToAdd$metadat = productToAdd.metadata) === null || _productToAdd$metadat === void 0 || (_productToAdd$metadat = _productToAdd$metadat.origin) === null || _productToAdd$metadat === void 0 ? void 0 : _productToAdd$metadat.isCustomItem) === true || ((_origin = productToAdd._origin) === null || _origin === void 0 ? void 0 : _origin.isCustomItem) === true;
4192
- var shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
4198
+ var shouldForceNewLine = disableMerge || !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
4193
4199
  var matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
4194
4200
  var _item$metadata3;
4195
4201
  if (_this27.hasGoodPassDiscount(item)) return false;
@@ -4319,7 +4325,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4319
4325
  singleLine.num = 1;
4320
4326
  delete singleLine.product_quantity;
4321
4327
  _appendResult = this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking), {
4322
- insertAtIndex: insertAtIndex
4328
+ insertAtIndex: insertAtIndex,
4329
+ disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
4323
4330
  });
4324
4331
  if (!_appendResult) {
4325
4332
  _context21.next = 17;
@@ -4340,7 +4347,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4340
4347
  return _context21.abrupt("return", tempOrder.products);
4341
4348
  case 24:
4342
4349
  appendResult = this.appendProductLineToTempOrder(tempOrder, product, booking, {
4343
- insertAtIndex: insertAtIndex
4350
+ insertAtIndex: insertAtIndex,
4351
+ disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
4344
4352
  });
4345
4353
  if (!appendResult) {
4346
4354
  _context21.next = 28;
@@ -5512,7 +5520,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5512
5520
  includePaymentStatus: !isOnlineStorePlatform,
5513
5521
  enhance: enhancePayload
5514
5522
  });
5515
- console.log('[Order.runSubmitTempOrder.payload]', payload);
5516
5523
  if (params !== null && params !== void 0 && params.syncMode) {
5517
5524
  payload.sync_mode = true;
5518
5525
  }
@@ -5520,10 +5527,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5520
5527
  if (!payload.created_at) {
5521
5528
  payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
5522
5529
  }
5523
- _context36.next = 28;
5530
+ _context36.next = 27;
5524
5531
  return this.saveDraft();
5525
- case 28:
5526
- _context36.prev = 28;
5532
+ case 27:
5533
+ _context36.prev = 27;
5527
5534
  this.logInfo('submitTempOrder calling sales checkout', {
5528
5535
  orderId: payload.order_id,
5529
5536
  externalSaleNumber: payload.external_sale_number,
@@ -5533,26 +5540,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5533
5540
  smallTicketDataFlag: payload.small_ticket_data_flag,
5534
5541
  syncMode: payload.sync_mode
5535
5542
  });
5536
- _context36.next = 32;
5543
+ _context36.next = 31;
5537
5544
  return this.submitSalesOrder({
5538
5545
  query: payload
5539
5546
  });
5540
- case 32:
5547
+ case 31:
5541
5548
  result = _context36.sent;
5542
- _context36.next = 45;
5549
+ _context36.next = 44;
5543
5550
  break;
5544
- case 35:
5545
- _context36.prev = 35;
5546
- _context36.t2 = _context36["catch"](28);
5551
+ case 34:
5552
+ _context36.prev = 34;
5553
+ _context36.t2 = _context36["catch"](27);
5547
5554
  backendErrorResponse = this.extractSubmitErrorResponse(_context36.t2);
5548
5555
  if (!backendErrorResponse) {
5549
- _context36.next = 42;
5556
+ _context36.next = 41;
5550
5557
  break;
5551
5558
  }
5552
5559
  this.store.syncState = 'failed';
5553
5560
  this.logSubmitBackendRejected(backendErrorResponse, payload);
5554
5561
  return _context36.abrupt("return", backendErrorResponse);
5555
- case 42:
5562
+ case 41:
5556
5563
  this.store.syncState = 'failed';
5557
5564
  this.logError('submitTempOrder failed', {
5558
5565
  error: _context36.t2 instanceof Error ? _context36.t2.message : String(_context36.t2),
@@ -5562,15 +5569,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5562
5569
  paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
5563
5570
  });
5564
5571
  throw _context36.t2;
5565
- case 45:
5572
+ case 44:
5566
5573
  if (!this.isSubmitResponseRejected(result)) {
5567
- _context36.next = 49;
5574
+ _context36.next = 48;
5568
5575
  break;
5569
5576
  }
5570
5577
  this.store.syncState = 'failed';
5571
5578
  this.logSubmitBackendRejected(result, payload);
5572
5579
  return _context36.abrupt("return", result);
5573
- case 49:
5580
+ case 48:
5574
5581
  submittedOrderId = this.extractOrderIdFromSubmitResult(result);
5575
5582
  this.logInfo('runSubmitTempOrder: 提交成功', {
5576
5583
  submittedOrderId: submittedOrderId,
@@ -5580,29 +5587,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5580
5587
  })
5581
5588
  });
5582
5589
  if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
5583
- _context36.next = 58;
5590
+ _context36.next = 57;
5584
5591
  break;
5585
5592
  }
5586
5593
  tempOrder.order_id = submittedOrderId;
5587
5594
  resultRecord = result;
5588
- _context36.next = 56;
5595
+ _context36.next = 55;
5589
5596
  return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
5590
- case 56:
5591
- _context36.next = 59;
5597
+ case 55:
5598
+ _context36.next = 58;
5592
5599
  break;
5593
- case 58:
5600
+ case 57:
5594
5601
  if (this.isLocalPendingSubmitResult(result)) {
5595
5602
  this.store.syncState = 'local';
5596
5603
  } else {
5597
5604
  this.store.syncState = 'submitted';
5598
5605
  }
5599
- case 59:
5606
+ case 58:
5600
5607
  return _context36.abrupt("return", result);
5601
- case 60:
5608
+ case 59:
5602
5609
  case "end":
5603
5610
  return _context36.stop();
5604
5611
  }
5605
- }, _callee33, this, [[28, 35]]);
5612
+ }, _callee33, this, [[27, 34]]);
5606
5613
  }));
5607
5614
  function runSubmitTempOrder(_x39) {
5608
5615
  return _runSubmitTempOrder.apply(this, arguments);
@@ -6030,8 +6037,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6030
6037
  key: "createOrderByCheckout",
6031
6038
  value: (function () {
6032
6039
  var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
6033
- var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
6034
- var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _orderData$bookings2, _orderData$relation_p2, _orderData$payments4, _orderData$payments5, _response$data, orderData, response;
6040
+ var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3;
6041
+ var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, orderData, response;
6035
6042
  return _regeneratorRuntime().wrap(function _callee39$(_context42) {
6036
6043
  while (1) switch (_context42.prev = _context42.next) {
6037
6044
  case 0:
@@ -6058,16 +6065,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6058
6065
  return p.code;
6059
6066
  })) || []
6060
6067
  });
6061
- console.log('[Order] createOrderByCheckout 开始创建订单:', {
6062
- type: params.type,
6063
- platform: params.platform,
6064
- is_deposit: params.is_deposit,
6065
- customer_id: params.customer_id,
6066
- bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
6067
- relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
6068
- paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
6069
- });
6070
- _context42.prev = 4;
6068
+ _context42.prev = 3;
6071
6069
  // 构建订单数据,设置默认值并允许 params 覆盖
6072
6070
  orderData = _objectSpread({
6073
6071
  sales_channel: 'my_pisel',
@@ -6089,20 +6087,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6089
6087
  if (!params.order_id && !orderData.schedule_date) {
6090
6088
  orderData.schedule_date = dayjs().format('YYYY-MM-DD HH:mm:ss');
6091
6089
  }
6092
- console.log('[Order] 调用后端接口创建订单:', {
6093
- url: '/shop/order/checkout',
6094
- orderType: orderData.type,
6095
- platform: orderData.platform,
6096
- isDeposit: orderData.is_deposit,
6097
- customerId: orderData.customer_id,
6098
- bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
6099
- relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
6100
- paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
6101
- paymentsMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
6102
- return p.code;
6103
- })) || []
6104
- });
6105
-
6106
6090
  // 记录接口调用详情
6107
6091
  this.logInfo('Calling backend checkout API', {
6108
6092
  url: '/shop/order/checkout',
@@ -6111,10 +6095,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6111
6095
  isDeposit: orderData.is_deposit,
6112
6096
  customerId: orderData.customer_id,
6113
6097
  depositAmount: orderData.deposit_amount,
6114
- bookingsCount: ((_orderData$bookings2 = orderData.bookings) === null || _orderData$bookings2 === void 0 ? void 0 : _orderData$bookings2.length) || 0,
6115
- relationProductsCount: ((_orderData$relation_p2 = orderData.relation_products) === null || _orderData$relation_p2 === void 0 ? void 0 : _orderData$relation_p2.length) || 0,
6116
- paymentsCount: ((_orderData$payments4 = orderData.payments) === null || _orderData$payments4 === void 0 ? void 0 : _orderData$payments4.length) || 0,
6117
- paymentMethods: ((_orderData$payments5 = orderData.payments) === null || _orderData$payments5 === void 0 ? void 0 : _orderData$payments5.map(function (p) {
6098
+ bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
6099
+ relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
6100
+ paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
6101
+ paymentMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
6118
6102
  return {
6119
6103
  code: p.code,
6120
6104
  amount: p.amount,
@@ -6129,34 +6113,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6129
6113
  hasOrderId: !!orderData.order_id,
6130
6114
  smallTicketDataFlag: orderData.small_ticket_data_flag
6131
6115
  });
6132
- _context42.next = 12;
6116
+ _context42.next = 10;
6133
6117
  return this.request.post('/order/checkout', orderData, {
6134
6118
  osServer: true,
6135
6119
  customToast: function customToast() {}
6136
6120
  });
6137
- case 12:
6121
+ case 10:
6138
6122
  response = _context42.sent;
6139
6123
  this.logInfo('Order API called successfully', {
6140
6124
  response: response
6141
6125
  });
6142
- console.log('[Order] 订单创建成功,后端响应:', {
6143
- success: !!response,
6144
- hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
6145
- });
6146
6126
  return _context42.abrupt("return", response);
6147
- case 18:
6148
- _context42.prev = 18;
6149
- _context42.t0 = _context42["catch"](4);
6127
+ case 15:
6128
+ _context42.prev = 15;
6129
+ _context42.t0 = _context42["catch"](3);
6150
6130
  console.error('[Order] createOrderByCheckout 创建订单失败:', _context42.t0);
6151
6131
  this.logInfo('Order API called failed', {
6152
6132
  error: _context42.t0 instanceof Error ? _context42.t0.message : String(_context42.t0)
6153
6133
  });
6154
6134
  throw _context42.t0;
6155
- case 23:
6135
+ case 20:
6156
6136
  case "end":
6157
6137
  return _context42.stop();
6158
6138
  }
6159
- }, _callee39, this, [[4, 18]]);
6139
+ }, _callee39, this, [[3, 15]]);
6160
6140
  }));
6161
6141
  function createOrderByCheckout(_x46) {
6162
6142
  return _createOrderByCheckout.apply(this, arguments);
@@ -6287,7 +6267,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6287
6267
  value: (function () {
6288
6268
  var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(record, options) {
6289
6269
  var _sourceRaw$_extend, _this$store$discount26;
6290
- var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, nextTempOrder, _this$store$discount24, _this$store$discount25, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount27, _this$store$discount28;
6270
+ var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, isMergedSalesDetailHydrate, nextTempOrder, _this$store$discount24, _this$store$discount25, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount27, _this$store$discount28;
6291
6271
  return _regeneratorRuntime().wrap(function _callee43$(_context46) {
6292
6272
  while (1) switch (_context46.prev = _context46.next) {
6293
6273
  case 0:
@@ -6322,12 +6302,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6322
6302
  }
6323
6303
  }
6324
6304
  isSessionStorageHydrate = (options === null || options === void 0 ? void 0 : options.source) === 'sessionStorage';
6305
+ isMergedSalesDetailHydrate = (options === null || options === void 0 ? void 0 : options.source) === 'mergedSalesDetail';
6325
6306
  nextTempOrder = this.normalizeTempOrderForRuntime(raw, {
6326
- makeEditMark: !isSessionStorageHydrate
6307
+ // merge 前已只给远端商品补标记;这里不能把本地未提交商品一并变成 saved item。
6308
+ makeEditMark: !isSessionStorageHydrate && !isMergedSalesDetailHydrate
6327
6309
  });
6328
6310
  this.store.tempOrder = nextTempOrder;
6329
6311
  if (!isSessionStorageHydrate) {
6330
- _context46.next = 29;
6312
+ _context46.next = 30;
6331
6313
  break;
6332
6314
  }
6333
6315
  // 会话快照是未提交购物车,不应获得编辑订单的 saved/edit 标记与服务端基线。
@@ -6343,24 +6325,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6343
6325
  nextTempOrder.discount_list = restoredSessionDiscounts;
6344
6326
  this.store.summary = createEmptySummary();
6345
6327
  this.store.lastOrderInfo = undefined;
6346
- _context46.next = 22;
6328
+ _context46.next = 23;
6347
6329
  return (_this$store$discount24 = this.store.discount) === null || _this$store$discount24 === void 0 ? void 0 : _this$store$discount24.setOriginalDiscountList(cloneDeep(restoredSessionDiscounts));
6348
- case 22:
6349
- _context46.next = 24;
6330
+ case 23:
6331
+ _context46.next = 25;
6350
6332
  return (_this$store$discount25 = this.store.discount) === null || _this$store$discount25 === void 0 ? void 0 : _this$store$discount25.setDiscountList(cloneDeep(restoredSessionDiscounts));
6351
- case 24:
6333
+ case 25:
6352
6334
  if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
6353
- _context46.next = 27;
6335
+ _context46.next = 28;
6354
6336
  break;
6355
6337
  }
6356
- _context46.next = 27;
6338
+ _context46.next = 28;
6357
6339
  return this.recalculateSummary({
6358
6340
  createIfMissing: false
6359
6341
  });
6360
- case 27:
6342
+ case 28:
6361
6343
  this.persistTempOrder();
6362
6344
  return _context46.abrupt("return", nextTempOrder);
6363
- case 29:
6345
+ case 30:
6364
6346
  // Server list compatibility may synthesize order_id from external_sale_number; tempOrder must not.
6365
6347
  sourceLastOrderInfo = sourceRaw.lastOrderInfo || sourceRaw;
6366
6348
  isDraftOrder = Number(nextTempOrder.is_draft_order || 0) === 1;
@@ -6376,7 +6358,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6376
6358
  surcharges: summarySurcharges
6377
6359
  });
6378
6360
  nextTempOrder._extend = _objectSpread(_objectSpread({}, nextTempOrder._extend || {}), {}, {
6379
- originalSalesSnapshot: {
6361
+ originalSalesSnapshot: _objectSpread({
6380
6362
  summary: cloneDeep(this.store.summary),
6381
6363
  products: cloneDeep(nextTempOrder.products || []),
6382
6364
  bookings: cloneDeep(nextTempOrder.bookings || []),
@@ -6384,7 +6366,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6384
6366
  surcharges: cloneDeep(nextTempOrder.surcharges || []),
6385
6367
  shop_discount: nextTempOrder.shop_discount || '0.00',
6386
6368
  productFingerprint: this.buildOrderProductsFingerprint(nextTempOrder.products || [])
6387
- }
6369
+ }, isMergedSalesDetailHydrate ? {
6370
+ requiresFullSummaryRecalculation: true
6371
+ } : {})
6388
6372
  });
6389
6373
  this.store.lastOrderInfo = this.withoutSyntheticDraftOrderIdForRuntime(sourceLastOrderInfo, syntheticIdentityOptions);
6390
6374
  hadSyntheticDraftOrderId = this.isSyntheticDraftOrderIdForRuntime(raw, syntheticIdentityOptions) || this.isSyntheticDraftOrderIdForRuntime(sourceLastOrderInfo, syntheticIdentityOptions);
@@ -6405,28 +6389,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6405
6389
  nextDiscounts = [].concat(_toConsumableArray(hydratedEditDiscounts), _toConsumableArray(retainedScanDiscounts));
6406
6390
  shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
6407
6391
  if (shouldSkipEmptyDiscountSync) {
6408
- _context46.next = 52;
6392
+ _context46.next = 53;
6409
6393
  break;
6410
6394
  }
6411
6395
  OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
6412
- _context46.next = 50;
6396
+ _context46.next = 51;
6413
6397
  return (_this$store$discount27 = this.store.discount) === null || _this$store$discount27 === void 0 ? void 0 : _this$store$discount27.setOriginalDiscountList(nextDiscounts);
6414
- case 50:
6415
- _context46.next = 52;
6398
+ case 51:
6399
+ _context46.next = 53;
6416
6400
  return (_this$store$discount28 = this.store.discount) === null || _this$store$discount28 === void 0 ? void 0 : _this$store$discount28.setDiscountList(nextDiscounts);
6417
- case 52:
6401
+ case 53:
6418
6402
  if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
6419
- _context46.next = 55;
6403
+ _context46.next = 56;
6420
6404
  break;
6421
6405
  }
6422
- _context46.next = 55;
6406
+ _context46.next = 56;
6423
6407
  return this.recalculateSummary({
6424
6408
  createIfMissing: false
6425
6409
  });
6426
- case 55:
6410
+ case 56:
6427
6411
  this.persistTempOrder();
6428
6412
  return _context46.abrupt("return", nextTempOrder);
6429
- case 57:
6413
+ case 58:
6430
6414
  case "end":
6431
6415
  return _context46.stop();
6432
6416
  }