@pisell/pisellos 0.10.15 → 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 (299) hide show
  1. package/dist/core/index.js +6 -9
  2. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  3. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  4. package/dist/model/strategy/strategy-example.js +5 -19
  5. package/dist/modules/Cart/index.js +0 -3
  6. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  7. package/dist/modules/Date/index.js +1 -5
  8. package/dist/modules/Discount/index.js +2 -4
  9. package/dist/modules/OpenData/index.js +0 -2
  10. package/dist/modules/Order/index.d.ts +1 -1
  11. package/dist/modules/Order/index.js +75 -91
  12. package/dist/modules/Order/types.d.ts +5 -1
  13. package/dist/modules/Order/utils.js +7 -1
  14. package/dist/modules/Payment/index.js +97 -162
  15. package/dist/modules/Product/types.d.ts +2 -0
  16. package/dist/modules/Rules/index.js +1 -4
  17. package/dist/modules/Schedule/index.js +0 -1
  18. package/dist/modules/Schedule/utils.js +0 -1
  19. package/dist/modules/Step/index.js +0 -1
  20. package/dist/plugins/request.js +1 -4
  21. package/dist/plugins/window.js +2 -6
  22. package/dist/server/index.js +97 -129
  23. package/dist/server/modules/menu/index.js +32 -41
  24. package/dist/server/modules/order/index.js +2 -4
  25. package/dist/server/modules/products/index.js +24 -42
  26. package/dist/server/modules/quotation/index.js +29 -38
  27. package/dist/server/modules/resource/index.js +3 -4
  28. package/dist/server/modules/schedule/index.js +27 -35
  29. package/dist/server/utils/product.js +0 -1
  30. package/dist/solution/BaseSales/index.js +100 -72
  31. package/dist/solution/BaseSales/types.d.ts +2 -0
  32. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  33. package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
  34. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  35. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +7 -1
  36. package/dist/solution/BaseSales/utils.js +6 -3
  37. package/dist/solution/BookingByStep/index.d.ts +1 -1
  38. package/dist/solution/BookingByStep/index.js +7 -59
  39. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  40. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  41. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  42. package/dist/solution/BookingTicket/index.js +8 -4
  43. package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
  44. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  45. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  46. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  47. package/dist/solution/BuyTickets/index.js +9 -12
  48. package/dist/solution/Checkout/index.js +177 -252
  49. package/dist/solution/Checkout/utils/index.js +4 -16
  50. package/dist/solution/RegisterAndLogin/index.js +30 -76
  51. package/dist/solution/ScanOrder/index.js +50 -60
  52. package/dist/solution/ScanOrder/types.d.ts +2 -0
  53. package/dist/solution/ScanOrder/utils.js +6 -3
  54. package/dist/solution/ShopDiscount/index.js +2 -7
  55. package/dist/solution/VenueBooking/index.js +45 -55
  56. package/dist/utils/task.js +15 -18
  57. package/dist/utils/watch.js +0 -1
  58. package/lib/apis/picoding.js +2 -0
  59. package/lib/core/index.js +131 -131
  60. package/lib/effects/index.js +46 -57
  61. package/lib/index.js +82 -49
  62. package/lib/model/index.js +14 -21
  63. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  64. package/lib/model/strategy/adapter/dataVariant/evaluator.js +209 -315
  65. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  66. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  67. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  68. package/lib/model/strategy/adapter/index.js +100 -64
  69. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  70. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  71. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  72. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  73. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  74. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  75. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  76. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  77. package/lib/model/strategy/adapter/promotion/index.js +43 -48
  78. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  79. package/lib/model/strategy/adapter/type.js +4 -16
  80. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  81. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  82. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  83. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  84. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  85. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  86. package/lib/model/strategy/engine.js +270 -168
  87. package/lib/model/strategy/index.js +49 -34
  88. package/lib/model/strategy/strategy-example.js +243 -239
  89. package/lib/model/strategy/type.js +100 -40
  90. package/lib/modules/Account/index.js +39 -53
  91. package/lib/modules/Account/types.js +20 -33
  92. package/lib/modules/AccountList/index.js +116 -154
  93. package/lib/modules/AccountList/types.js +30 -31
  94. package/lib/modules/AccountList/utils.js +18 -30
  95. package/lib/modules/BaseModule.js +23 -42
  96. package/lib/modules/BookingContext/index.js +158 -136
  97. package/lib/modules/BookingContext/types.js +46 -32
  98. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  99. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  100. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  101. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  102. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  103. package/lib/modules/BookingContext/utils/index.js +124 -41
  104. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  105. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  106. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  107. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  108. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  109. package/lib/modules/BookingContext/utils/resources.js +209 -167
  110. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  111. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  112. package/lib/modules/Cart/index.js +170 -124
  113. package/lib/modules/Cart/types.js +46 -51
  114. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  115. package/lib/modules/Cart/utils/cartDate.js +56 -61
  116. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  117. package/lib/modules/Cart/utils/cartNote.js +27 -32
  118. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  119. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  120. package/lib/modules/Cart/utils/cartResource.js +70 -78
  121. package/lib/modules/Cart/utils/changePrice.js +22 -50
  122. package/lib/modules/Cart/utils/index.js +106 -48
  123. package/lib/modules/Customer/constants.js +13 -34
  124. package/lib/modules/Customer/index.js +235 -172
  125. package/lib/modules/Customer/types.js +38 -35
  126. package/lib/modules/Date/index.js +116 -115
  127. package/lib/modules/Date/types.js +16 -28
  128. package/lib/modules/Date/utils.js +174 -123
  129. package/lib/modules/Discount/index.js +133 -143
  130. package/lib/modules/Discount/types.js +9 -31
  131. package/lib/modules/Guests/index.js +30 -56
  132. package/lib/modules/Guests/types.js +23 -33
  133. package/lib/modules/Holder/index.js +209 -189
  134. package/lib/modules/Holder/types.js +4 -16
  135. package/lib/modules/Holder/utils.js +20 -49
  136. package/lib/modules/OpenData/index.js +70 -76
  137. package/lib/modules/OpenData/types.js +4 -16
  138. package/lib/modules/OpenData/utils.js +44 -78
  139. package/lib/modules/Order/index.d.ts +1 -1
  140. package/lib/modules/Order/index.js +1810 -2238
  141. package/lib/modules/Order/payment-utils.js +77 -120
  142. package/lib/modules/Order/types.d.ts +5 -1
  143. package/lib/modules/Order/types.js +87 -35
  144. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  145. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  146. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  147. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  148. package/lib/modules/Order/utils/virtualSettlement.js +120 -171
  149. package/lib/modules/Order/utils.js +834 -668
  150. package/lib/modules/Payment/cash.js +20 -33
  151. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  152. package/lib/modules/Payment/eftpos.js +16 -30
  153. package/lib/modules/Payment/index.js +532 -399
  154. package/lib/modules/Payment/mx51.js +1 -0
  155. package/lib/modules/Payment/types.js +230 -108
  156. package/lib/modules/Payment/utils.js +52 -51
  157. package/lib/modules/Payment/walletpass.js +485 -660
  158. package/lib/modules/Product/index.js +51 -46
  159. package/lib/modules/Product/types.d.ts +2 -0
  160. package/lib/modules/Product/types.js +4 -16
  161. package/lib/modules/Product/utils.js +32 -33
  162. package/lib/modules/ProductList/index.js +138 -161
  163. package/lib/modules/ProductList/types.js +9 -31
  164. package/lib/modules/Quotation/index.js +66 -100
  165. package/lib/modules/Quotation/types.js +4 -16
  166. package/lib/modules/Resource/index.js +27 -59
  167. package/lib/modules/Resource/types.js +22 -32
  168. package/lib/modules/Resource/utils.js +30 -38
  169. package/lib/modules/ResourcePlanner/index.js +25 -23
  170. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  171. package/lib/modules/ResourcePlanner/planner.js +591 -772
  172. package/lib/modules/ResourcePlanner/types.js +10 -29
  173. package/lib/modules/Rules/index.js +1218 -959
  174. package/lib/modules/Rules/types.js +17 -40
  175. package/lib/modules/SalesSummary/index.js +78 -89
  176. package/lib/modules/SalesSummary/types.js +4 -16
  177. package/lib/modules/SalesSummary/utils.js +359 -442
  178. package/lib/modules/ScanOrderLogger/index.js +59 -79
  179. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  180. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  181. package/lib/modules/ScanOrderLogger/types.js +4 -16
  182. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  183. package/lib/modules/Schedule/index.js +100 -114
  184. package/lib/modules/Schedule/type.js +4 -16
  185. package/lib/modules/Schedule/types.js +4 -16
  186. package/lib/modules/Schedule/utils.js +433 -291
  187. package/lib/modules/Step/index.js +40 -52
  188. package/lib/modules/Step/tyeps.js +4 -16
  189. package/lib/modules/Summary/index.js +66 -71
  190. package/lib/modules/Summary/types.js +4 -16
  191. package/lib/modules/Summary/utils.js +773 -418
  192. package/lib/modules/SurchargeList/index.js +46 -60
  193. package/lib/modules/SurchargeList/types.js +4 -16
  194. package/lib/modules/index.js +245 -63
  195. package/lib/plugins/app.js +4 -16
  196. package/lib/plugins/index.js +36 -25
  197. package/lib/plugins/request.js +137 -126
  198. package/lib/plugins/shopStore.js +4 -16
  199. package/lib/plugins/user.js +4 -16
  200. package/lib/plugins/window.js +171 -179
  201. package/lib/server/index.js +3027 -2655
  202. package/lib/server/modules/floor-plan/index.js +102 -123
  203. package/lib/server/modules/floor-plan/types.js +15 -30
  204. package/lib/server/modules/index.js +106 -68
  205. package/lib/server/modules/menu/index.js +146 -122
  206. package/lib/server/modules/menu/types.js +18 -31
  207. package/lib/server/modules/order/index.js +758 -956
  208. package/lib/server/modules/order/types.js +122 -33
  209. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  210. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  211. package/lib/server/modules/payment/index.js +59 -83
  212. package/lib/server/modules/payment/types.js +4 -16
  213. package/lib/server/modules/products/index.js +575 -459
  214. package/lib/server/modules/products/types.js +44 -34
  215. package/lib/server/modules/quotation/index.js +137 -172
  216. package/lib/server/modules/quotation/types.js +21 -31
  217. package/lib/server/modules/resource/index.js +213 -184
  218. package/lib/server/modules/resource/types.js +42 -33
  219. package/lib/server/modules/schedule/index.js +135 -123
  220. package/lib/server/modules/schedule/types.js +14 -21
  221. package/lib/server/modules/schedule/utils.js +334 -163
  222. package/lib/server/types.js +4 -16
  223. package/lib/server/utils/index.js +25 -23
  224. package/lib/server/utils/product.js +196 -139
  225. package/lib/server/utils/schedule.js +34 -41
  226. package/lib/server/utils/small-ticket.js +479 -456
  227. package/lib/server/utils/time.js +40 -49
  228. package/lib/solution/BaseSales/index.js +1274 -1489
  229. package/lib/solution/BaseSales/types.d.ts +2 -0
  230. package/lib/solution/BaseSales/types.js +42 -38
  231. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  232. package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
  233. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  234. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  235. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  236. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +138 -180
  237. package/lib/solution/BaseSales/utils.js +161 -143
  238. package/lib/solution/BookingByStep/index.d.ts +1 -1
  239. package/lib/solution/BookingByStep/index.js +1527 -1340
  240. package/lib/solution/BookingByStep/types.js +40 -99
  241. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  242. package/lib/solution/BookingByStep/utils/products.js +42 -52
  243. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  244. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  245. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  246. package/lib/solution/BookingTicket/index.js +598 -514
  247. package/lib/solution/BookingTicket/types.js +99 -77
  248. package/lib/solution/BookingTicket/utils/addProductDecision.js +229 -190
  249. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  250. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  251. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  252. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  253. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  254. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  255. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  256. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  257. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  258. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  259. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  260. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  261. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  262. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  263. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  264. package/lib/solution/BuyTickets/index.js +67 -70
  265. package/lib/solution/BuyTickets/types.js +22 -38
  266. package/lib/solution/Checkout/index.js +1451 -1158
  267. package/lib/solution/Checkout/types.js +91 -61
  268. package/lib/solution/Checkout/utils/index.js +228 -156
  269. package/lib/solution/PlaceOrder/index.js +55 -0
  270. package/lib/solution/RegisterAndLogin/config.js +493 -460
  271. package/lib/solution/RegisterAndLogin/index.js +633 -630
  272. package/lib/solution/RegisterAndLogin/types.js +189 -76
  273. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  274. package/lib/solution/Sales/index.js +328 -324
  275. package/lib/solution/Sales/types.js +27 -33
  276. package/lib/solution/ScanOrder/index.js +822 -852
  277. package/lib/solution/ScanOrder/types.d.ts +2 -0
  278. package/lib/solution/ScanOrder/types.js +33 -34
  279. package/lib/solution/ScanOrder/utils.js +412 -374
  280. package/lib/solution/ShopDiscount/index.js +226 -232
  281. package/lib/solution/ShopDiscount/types.js +15 -37
  282. package/lib/solution/ShopDiscount/utils.js +300 -172
  283. package/lib/solution/UnifiedBookingSales/index.js +1052 -1213
  284. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  285. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  286. package/lib/solution/VenueBooking/index.js +811 -879
  287. package/lib/solution/VenueBooking/types.js +19 -39
  288. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  289. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  290. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  291. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  292. package/lib/solution/VenueBooking/utils.js +130 -67
  293. package/lib/solution/index.js +124 -41
  294. package/lib/store/createStore.js +32 -29
  295. package/lib/types/index.js +4 -16
  296. package/lib/utils/payment-number.js +26 -46
  297. package/lib/utils/task.js +36 -36
  298. package/lib/utils/watch.js +81 -47
  299. package/package.json +2 -1
@@ -157,9 +157,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
157
157
  app = appPlugin.getApp();
158
158
  this.dbManager = app.sqlite;
159
159
  this.logger = app.logger;
160
- if (this.dbManager) {
161
- console.log('[Schedule] SQLite 已初始化');
162
- } else {
160
+ if (this.dbManager) {} else {
163
161
  console.warn('[Schedule] SQLite 未找到');
164
162
  }
165
163
  }
@@ -323,7 +321,6 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
323
321
  } finally {
324
322
  _iterator2.f();
325
323
  }
326
- console.log("[Schedule] Map \u7F13\u5B58\u5DF2\u540C\u6B65\uFF0C\u5171 ".concat(this.store.map.size, " \u4E2A\u65E5\u7A0B"));
327
324
  }
328
325
 
329
326
  /**
@@ -344,32 +341,31 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
344
341
  this.store.map.clear();
345
342
  // 同时清空 SQLite 中的数据
346
343
  if (!this.dbManager) {
347
- _context3.next = 16;
344
+ _context3.next = 15;
348
345
  break;
349
346
  }
350
347
  _context3.prev = 4;
351
348
  _context3.next = 7;
352
349
  return this.dbManager.clear(SCHEDULE_STORE_NAME);
353
350
  case 7:
354
- console.log('[Schedule] SQLite 缓存已清空');
355
351
  this.logInfo('SQLite 缓存已清空');
356
- _context3.next = 16;
352
+ _context3.next = 15;
357
353
  break;
358
- case 11:
359
- _context3.prev = 11;
354
+ case 10:
355
+ _context3.prev = 10;
360
356
  _context3.t0 = _context3["catch"](4);
361
357
  errorMessage = _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0);
362
358
  console.error('[Schedule] 清空 SQLite 缓存失败:', _context3.t0);
363
359
  this.logError('清空 SQLite 缓存失败', {
364
360
  error: errorMessage
365
361
  });
366
- case 16:
362
+ case 15:
367
363
  this.logInfo('缓存清空完成');
368
- case 17:
364
+ case 16:
369
365
  case "end":
370
366
  return _context3.stop();
371
367
  }
372
- }, _callee3, this, [[4, 11]]);
368
+ }, _callee3, this, [[4, 10]]);
373
369
  }));
374
370
  function clear() {
375
371
  return _clear.apply(this, arguments);
@@ -509,14 +505,13 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
509
505
  return _this4.dbManager.add(SCHEDULE_STORE_NAME, schedule);
510
506
  }));
511
507
  case 20:
512
- console.log("[Schedule] \u5DF2\u5C06 ".concat(scheduleList.length, " \u6761\u65E5\u7A0B\u6570\u636E\u4FDD\u5B58\u5230 SQLite"));
513
508
  this.logInfo('日程数据已保存到 SQLite', {
514
509
  scheduleCount: scheduleList.length
515
510
  });
516
- _context5.next = 29;
511
+ _context5.next = 28;
517
512
  break;
518
- case 24:
519
- _context5.prev = 24;
513
+ case 23:
514
+ _context5.prev = 23;
520
515
  _context5.t0 = _context5["catch"](4);
521
516
  errorMessage = _context5.t0 instanceof Error ? _context5.t0.message : String(_context5.t0);
522
517
  console.error('[Schedule] 保存数据到 SQLite 失败:', _context5.t0);
@@ -524,11 +519,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
524
519
  scheduleCount: scheduleList.length,
525
520
  error: errorMessage
526
521
  });
527
- case 29:
522
+ case 28:
528
523
  case "end":
529
524
  return _context5.stop();
530
525
  }
531
- }, _callee5, this, [[4, 24]]);
526
+ }, _callee5, this, [[4, 23]]);
532
527
  }));
533
528
  function saveScheduleToSQLite(_x3) {
534
529
  return _saveScheduleToSQLite.apply(this, arguments);
@@ -548,19 +543,17 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
548
543
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
549
544
  while (1) switch (_context6.prev = _context6.next) {
550
545
  case 0:
551
- console.log('[Schedule] 开始预加载数据...');
552
546
  startTime = Date.now();
553
547
  this.logInfo('开始预加载数据');
554
- _context6.prev = 3;
555
- _context6.next = 6;
548
+ _context6.prev = 2;
549
+ _context6.next = 5;
556
550
  return this.loadScheduleFromSQLite();
557
- case 6:
551
+ case 5:
558
552
  cachedData = _context6.sent;
559
553
  if (!(cachedData && cachedData.length > 0)) {
560
- _context6.next = 14;
554
+ _context6.next = 12;
561
555
  break;
562
556
  }
563
- console.log("[Schedule] \u4ECE SQLite \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u65E5\u7A0B\u6570\u636E"));
564
557
  // 将缓存数据放入 store
565
558
  this.store.scheduleList = cloneDeep(cachedData);
566
559
  // 同步更新 Map 缓存
@@ -572,23 +565,22 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
572
565
  source: 'SQLite'
573
566
  });
574
567
  return _context6.abrupt("return");
575
- case 14:
576
- console.log('[Schedule] SQLite 中没有缓存数据,从服务器加载...');
568
+ case 12:
577
569
  this.logInfo('SQLite 中没有缓存数据,准备从服务器加载');
578
- _context6.next = 23;
570
+ _context6.next = 20;
579
571
  break;
580
- case 18:
581
- _context6.prev = 18;
582
- _context6.t0 = _context6["catch"](3);
572
+ case 15:
573
+ _context6.prev = 15;
574
+ _context6.t0 = _context6["catch"](2);
583
575
  errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
584
576
  console.warn('[Schedule] 从 SQLite 加载数据失败:', _context6.t0);
585
577
  this.logWarning('从 SQLite 加载数据失败,准备从服务器加载', {
586
578
  error: errorMessage
587
579
  });
588
- case 23:
589
- _context6.next = 25;
580
+ case 20:
581
+ _context6.next = 22;
590
582
  return this.loadAllSchedule();
591
- case 25:
583
+ case 22:
592
584
  scheduleList = _context6.sent;
593
585
  // 3. 将服务器数据放入 store
594
586
  if (scheduleList && scheduleList.length > 0) {
@@ -607,11 +599,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
607
599
  duration: "".concat(_duration3, "ms")
608
600
  });
609
601
  }
610
- case 27:
602
+ case 24:
611
603
  case "end":
612
604
  return _context6.stop();
613
605
  }
614
- }, _callee6, this, [[3, 18]]);
606
+ }, _callee6, this, [[2, 15]]);
615
607
  }));
616
608
  function preload() {
617
609
  return _preload.apply(this, arguments);
@@ -82,7 +82,6 @@ function buildPriceIndexMap(priceData) {
82
82
  export function applyPriceDataToProducts(products, priceData) {
83
83
  var t0 = performance.now();
84
84
  if (!priceData || priceData.length === 0) {
85
- console.log('[applyPriceDataToProducts] 没有价格数据,返回原商品');
86
85
  return products;
87
86
  }
88
87
  var t1 = performance.now();
@@ -371,6 +371,24 @@ function filterPendingPaymentsFromLoadedSalesDetail(sourceRecord) {
371
371
  }
372
372
  return record;
373
373
  }
374
+
375
+ /**
376
+ * merge hydrate 不会统一给所有商品补 saved 标记,因此先只标记远端已保存商品。
377
+ * 当前 tempOrder 中尚未提交的本地商品会在 merge 后继续保持 current item 语义。
378
+ */
379
+ function markLoadedSalesDetailProductsAsSaved(sourceRecord) {
380
+ if (!sourceRecord || _typeof(sourceRecord) !== 'object') return sourceRecord;
381
+ if (!Array.isArray(sourceRecord.products)) return sourceRecord;
382
+ return _objectSpread(_objectSpread({}, sourceRecord), {}, {
383
+ products: sourceRecord.products.map(function (product) {
384
+ return _objectSpread(_objectSpread({}, product || {}), {}, {
385
+ metadata: _objectSpread(_objectSpread({}, product !== null && product !== void 0 && product.metadata && _typeof(product.metadata) === 'object' ? product.metadata : {}), {}, {
386
+ is_edit_for_runtime: true
387
+ })
388
+ });
389
+ })
390
+ });
391
+ }
374
392
  export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
375
393
  _inherits(BaseSalesImpl, _BaseModule);
376
394
  var _super = _createSuper(BaseSalesImpl);
@@ -670,7 +688,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
670
688
  }, {
671
689
  key: "hydrateLatestLoadedSalesDetail",
672
690
  value: function () {
673
- var _hydrateLatestLoadedSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(record, loadSequence, hydrateSource) {
691
+ var _hydrateLatestLoadedSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(record, loadSequence, options) {
674
692
  var _this4 = this;
675
693
  var hydratedSales, skippedBeforeHydrate, hydrateTask, queuedTask;
676
694
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
@@ -680,7 +698,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
680
698
  skippedBeforeHydrate = false;
681
699
  hydrateTask = /*#__PURE__*/function () {
682
700
  var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
683
- var sales;
701
+ var hydrateOptions, sales;
684
702
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
685
703
  while (1) switch (_context4.prev = _context4.next) {
686
704
  case 0:
@@ -697,30 +715,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
697
715
  }
698
716
  throw new Error('order 模块未初始化');
699
717
  case 5:
700
- _context4.next = 7;
701
- return _this4.store.order.hydrateTempOrderFromRecord(record, hydrateSource === 'sessionStorage' ? {
702
- recalcOnHydrate: true,
703
- source: 'sessionStorage'
704
- } : {
718
+ hydrateOptions = {
705
719
  recalcOnHydrate: false
706
- });
707
- case 7:
720
+ };
721
+ if ((options === null || options === void 0 ? void 0 : options.hydrateSource) === 'sessionStorage') {
722
+ hydrateOptions = {
723
+ recalcOnHydrate: true,
724
+ source: 'sessionStorage'
725
+ };
726
+ } else if (options !== null && options !== void 0 && options.merge) {
727
+ hydrateOptions = {
728
+ recalcOnHydrate: true,
729
+ source: 'mergedSalesDetail'
730
+ };
731
+ }
732
+ _context4.next = 9;
733
+ return _this4.store.order.hydrateTempOrderFromRecord(record, hydrateOptions);
734
+ case 9:
708
735
  sales = _context4.sent;
709
736
  hydratedSales = sales;
710
737
 
711
738
  // hydrate 期间可能又发起了更新请求;后续任务已串行排队,将负责最终状态。
712
739
  if (!(loadSequence !== _this4.salesDetailLoadSequence)) {
713
- _context4.next = 11;
740
+ _context4.next = 13;
714
741
  break;
715
742
  }
716
743
  return _context4.abrupt("return");
717
- case 11:
744
+ case 13:
718
745
  _this4.currentSalesDetail = sales;
719
- _context4.next = 14;
746
+ _context4.next = 16;
720
747
  return _this4.core.effects.emit("".concat(_this4.name, ":onSalesOrderLoaded"), {
721
748
  sales: sales
722
749
  });
723
- case 14:
750
+ case 16:
724
751
  case "end":
725
752
  return _context4.stop();
726
753
  }
@@ -1569,7 +1596,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1569
1596
  key: "loadSalesDetail",
1570
1597
  value: (function () {
1571
1598
  var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
1572
- var loadSequence, _ref31, _ref32, _ref33, _ref34, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, currentTempOrder, mergedRecord, record;
1599
+ var loadSequence, _ref31, _ref32, _ref33, _ref34, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
1573
1600
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1574
1601
  while (1) switch (_context14.prev = _context14.next) {
1575
1602
  case 0:
@@ -1621,39 +1648,43 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1621
1648
  loadedSalesDetail = preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data; // payment_pending 只存在于本地;远端详情需过滤,但会话快照必须完整恢复。
1622
1649
  shouldFilterPendingPayments = params.hydrateSource !== 'sessionStorage';
1623
1650
  remoteRecord = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(loadedSalesDetail) : loadedSalesDetail;
1651
+ mergeSourceRecord = params.merge ? markLoadedSalesDetailProductsAsSaved(remoteRecord) : remoteRecord;
1624
1652
  currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
1625
- mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord, 'preserve-local') : remoteRecord;
1653
+ mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, mergeSourceRecord, 'preserve-local') : mergeSourceRecord;
1626
1654
  record = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(mergedRecord) : mergedRecord;
1627
- _context14.next = 30;
1628
- return this.hydrateLatestLoadedSalesDetail(record, loadSequence, params.hydrateSource);
1629
- case 30:
1630
- return _context14.abrupt("return", _context14.sent);
1655
+ _context14.next = 31;
1656
+ return this.hydrateLatestLoadedSalesDetail(record, loadSequence, {
1657
+ hydrateSource: params.hydrateSource,
1658
+ merge: params.merge
1659
+ });
1631
1660
  case 31:
1632
- _context14.prev = 31;
1661
+ return _context14.abrupt("return", _context14.sent);
1662
+ case 32:
1663
+ _context14.prev = 32;
1633
1664
  this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
1634
1665
  if (!(this.salesDetailLoadInFlightCount === 0)) {
1635
- _context14.next = 42;
1666
+ _context14.next = 43;
1636
1667
  break;
1637
1668
  }
1638
- _context14.prev = 34;
1639
- _context14.next = 37;
1669
+ _context14.prev = 35;
1670
+ _context14.next = 38;
1640
1671
  return this.drainQueuedServerOrderChanges();
1641
- case 37:
1642
- _context14.next = 42;
1672
+ case 38:
1673
+ _context14.next = 43;
1643
1674
  break;
1644
- case 39:
1645
- _context14.prev = 39;
1646
- _context14.t1 = _context14["catch"](34);
1675
+ case 40:
1676
+ _context14.prev = 40;
1677
+ _context14.t1 = _context14["catch"](35);
1647
1678
  this.logError('drain queued server order changes failed', {
1648
1679
  error: _context14.t1 instanceof Error ? _context14.t1.message : String(_context14.t1)
1649
1680
  });
1650
- case 42:
1651
- return _context14.finish(31);
1652
1681
  case 43:
1682
+ return _context14.finish(32);
1683
+ case 44:
1653
1684
  case "end":
1654
1685
  return _context14.stop();
1655
1686
  }
1656
- }, _callee14, this, [[4,, 31, 43], [34, 39]]);
1687
+ }, _callee14, this, [[4,, 32, 44], [35, 40]]);
1657
1688
  }));
1658
1689
  function loadSalesDetail(_x13) {
1659
1690
  return _loadSalesDetail.apply(this, arguments);
@@ -2357,11 +2388,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2357
2388
  });
2358
2389
  case 48:
2359
2390
  if (!rulesModule) {
2360
- _context22.next = 85;
2391
+ _context22.next = 84;
2361
2392
  break;
2362
2393
  }
2363
2394
  orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
2364
- console.log('[BaseSales.applyDiscountConfig.calcDiscount]');
2365
2395
  result = rulesModule.calcDiscount({
2366
2396
  productList: tempOrder.products,
2367
2397
  discountList: nextDiscountList,
@@ -2378,22 +2408,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2378
2408
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
2379
2409
  }
2380
2410
  _iterator2 = _createForOfIteratorHelper(tempOrder.products || []);
2381
- _context22.prev = 54;
2411
+ _context22.prev = 53;
2382
2412
  _iterator2.s();
2383
- case 56:
2413
+ case 55:
2384
2414
  if ((_step2 = _iterator2.n()).done) {
2385
- _context22.next = 71;
2415
+ _context22.next = 70;
2386
2416
  break;
2387
2417
  }
2388
2418
  product = _step2.value;
2389
2419
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
2390
2420
  runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
2391
2421
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
2392
- _context22.next = 62;
2422
+ _context22.next = 61;
2393
2423
  break;
2394
2424
  }
2395
- return _context22.abrupt("continue", 69);
2396
- case 62:
2425
+ return _context22.abrupt("continue", 68);
2426
+ case 61:
2397
2427
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2398
2428
  return sum + Number(pd.amount || 0);
2399
2429
  }, 0);
@@ -2409,60 +2439,60 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2409
2439
  mainPrice: newMainSellingPrice,
2410
2440
  bundle: product.product_bundle
2411
2441
  });
2412
- case 69:
2413
- _context22.next = 56;
2442
+ case 68:
2443
+ _context22.next = 55;
2414
2444
  break;
2415
- case 71:
2416
- _context22.next = 76;
2445
+ case 70:
2446
+ _context22.next = 75;
2417
2447
  break;
2418
- case 73:
2419
- _context22.prev = 73;
2420
- _context22.t0 = _context22["catch"](54);
2448
+ case 72:
2449
+ _context22.prev = 72;
2450
+ _context22.t0 = _context22["catch"](53);
2421
2451
  _iterator2.e(_context22.t0);
2422
- case 76:
2423
- _context22.prev = 76;
2452
+ case 75:
2453
+ _context22.prev = 75;
2424
2454
  _iterator2.f();
2425
- return _context22.finish(76);
2426
- case 79:
2455
+ return _context22.finish(75);
2456
+ case 78:
2427
2457
  if (!result.discountList) {
2428
- _context22.next = 85;
2458
+ _context22.next = 84;
2429
2459
  break;
2430
2460
  }
2431
2461
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
2432
2462
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2433
- _context22.next = 84;
2463
+ _context22.next = 83;
2434
2464
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2435
- case 84:
2465
+ case 83:
2436
2466
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
2437
2467
  return discount.isSelected;
2438
2468
  });
2439
- case 85:
2440
- _context22.next = 87;
2469
+ case 84:
2470
+ _context22.next = 86;
2441
2471
  return this.store.order.recalculateSummary({
2442
2472
  createIfMissing: true
2443
2473
  });
2444
- case 87:
2474
+ case 86:
2445
2475
  summary = _context22.sent;
2446
2476
  this.store.order.persistTempOrder();
2447
- _context22.next = 91;
2477
+ _context22.next = 90;
2448
2478
  return this.effectsEmit('onDiscountApplied', {
2449
2479
  productList: tempOrder.products || [],
2450
2480
  discountList: nextDiscountList,
2451
2481
  selectedDiscountList: tempOrder.discount_list || [],
2452
2482
  tempOrder: tempOrder
2453
2483
  });
2454
- case 91:
2484
+ case 90:
2455
2485
  return _context22.abrupt("return", {
2456
2486
  productList: tempOrder.products || [],
2457
2487
  discountList: nextDiscountList,
2458
2488
  availableWalletIds: this.getAvailableWalletIds(),
2459
2489
  virtualCurrencyList: this.store.order.getVirtualCurrencyList()
2460
2490
  });
2461
- case 92:
2491
+ case 91:
2462
2492
  case "end":
2463
2493
  return _context22.stop();
2464
2494
  }
2465
- }, _callee22, this, [[54, 73, 76, 79]]);
2495
+ }, _callee22, this, [[53, 72, 75, 78]]);
2466
2496
  }));
2467
2497
  function loadDiscountConfig(_x16) {
2468
2498
  return _loadDiscountConfig.apply(this, arguments);
@@ -2524,11 +2554,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2524
2554
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2525
2555
  case 16:
2526
2556
  if (!rulesModule) {
2527
- _context23.next = 28;
2557
+ _context23.next = 27;
2528
2558
  break;
2529
2559
  }
2530
2560
  orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
2531
- console.log('[BaseSales.bestDiscount.calcDiscount]');
2532
2561
  result = rulesModule.calcDiscount({
2533
2562
  productList: tempOrder.products,
2534
2563
  discountList: nextDiscountList,
@@ -2542,14 +2571,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2542
2571
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
2543
2572
  }
2544
2573
  if (!result.discountList) {
2545
- _context23.next = 28;
2574
+ _context23.next = 27;
2546
2575
  break;
2547
2576
  }
2548
2577
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
2549
2578
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2550
- _context23.next = 26;
2579
+ _context23.next = 25;
2551
2580
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2552
- case 26:
2581
+ case 25:
2553
2582
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
2554
2583
  return discount.isSelected;
2555
2584
  });
@@ -2557,24 +2586,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2557
2586
  productList: tempOrder.products,
2558
2587
  discountList: nextDiscountList
2559
2588
  };
2560
- case 28:
2561
- _context23.next = 30;
2589
+ case 27:
2590
+ _context23.next = 29;
2562
2591
  return this.store.order.recalculateSummary({
2563
2592
  createIfMissing: true
2564
2593
  });
2565
- case 30:
2594
+ case 29:
2566
2595
  this.store.order.persistTempOrder();
2567
- _context23.next = 33;
2596
+ _context23.next = 32;
2568
2597
  return this.effectsEmit('onDiscountApplied', {
2569
2598
  productList: tempOrder.products || [],
2570
2599
  discountList: nextDiscountList,
2571
2600
  selectedDiscountList: tempOrder.discount_list || [],
2572
2601
  tempOrder: tempOrder
2573
2602
  });
2574
- case 33:
2603
+ case 32:
2575
2604
  cb === null || cb === void 0 || cb(result);
2576
2605
  return _context23.abrupt("return", result);
2577
- case 35:
2606
+ case 34:
2578
2607
  case "end":
2579
2608
  return _context23.stop();
2580
2609
  }
@@ -2761,7 +2790,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2761
2790
  case 23:
2762
2791
  if (rulesModule) {
2763
2792
  orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
2764
- console.log('[BaseSales.setDiscountSelected.calcDiscount]');
2765
2793
  result = rulesModule.calcDiscount({
2766
2794
  productList: tempOrder.products,
2767
2795
  discountList: updated,
@@ -112,6 +112,8 @@ export interface BaseSalesUpdateOrderProductQuantityParams extends BaseSalesOrde
112
112
  export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
113
113
  order_detail_id: number | null;
114
114
  num: number;
115
+ /** Product 或当前 Variant 的生产编码 */
116
+ production_code?: string;
115
117
  product_sku: BaseSalesProductSku;
116
118
  /**
117
119
  * 券后 **行 composite 单价** = `metadata.main_product_selling_price`
@@ -1,4 +1,9 @@
1
1
  import type { OrderProduct } from '../../../modules/Order/types';
2
+ /**
3
+ * 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
4
+ * `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
5
+ */
6
+ export declare const PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = "_productLineMergeDisabled";
2
7
  /**
3
8
  * Cart promotion 工具集(OS 内部纯函数)
4
9
  *
@@ -23,6 +23,12 @@ import { cloneDeep } from 'lodash-es';
23
23
  import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
24
24
  import { buildProductLineFingerprint, getSafeProductNum } from "../../ScanOrder/utils";
25
25
 
26
+ /**
27
+ * 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
28
+ * `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
29
+ */
30
+ export var PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = '_productLineMergeDisabled';
31
+
26
32
  /**
27
33
  * Cart promotion 工具集(OS 内部纯函数)
28
34
  *
@@ -483,10 +489,13 @@ function hasGoodPassDiscount(product) {
483
489
  }
484
490
 
485
491
  /**
486
- * 商品券、自定义商品、称重行以及编辑订单历史行都有各自的促销合并边界。
492
+ * 不合并商品、商品券、自定义商品、称重行以及编辑订单历史行都有各自的促销合并边界。
487
493
  */
488
494
  function getPromotionLineMergeBoundary(product) {
489
- var _product$product_sku, _product$metadata3;
495
+ var _product$metadata3, _product$product_sku, _product$metadata4;
496
+ if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3[PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY]) === true) {
497
+ return "separate:".concat(getOrderProductUid(product));
498
+ }
490
499
  if ((product === null || product === void 0 ? void 0 : product.product_id) === undefined || (product === null || product === void 0 ? void 0 : product.product_id) === null) {
491
500
  return "custom:".concat(getOrderProductUid(product));
492
501
  }
@@ -496,7 +505,7 @@ function getPromotionLineMergeBoundary(product) {
496
505
  if (Number((product === null || product === void 0 || (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1) {
497
506
  return "weighing:".concat(getOrderProductUid(product));
498
507
  }
499
- if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.is_edit_for_runtime) !== true) return '';
508
+ if ((product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.is_edit_for_runtime) !== true) return '';
500
509
  return "edit:".concat(getOrderProductUid(product));
501
510
  }
502
511
  function isPersistedGeneratedVoucher(product) {
@@ -921,13 +930,13 @@ export function resolveStrategyEligibleProducts(matched) {
921
930
  export function calculateUnfulfilledPromotions(processedProducts, applicableStrategiesResult, mainProducts) {
922
931
  var unfulfilledMap = new Map();
923
932
  var _loop2 = function _loop2() {
924
- var _product$metadata4, _ref13, _product$_originalPro, _product$metadata5, _product$num2;
933
+ var _product$metadata5, _ref13, _product$_originalPro, _product$metadata6, _product$num2;
925
934
  var product = processedProducts[i];
926
- var promotion = product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4._promotion;
935
+ var promotion = product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5._promotion;
927
936
  if (!promotion || promotion.inPromotion !== false) return 0; // continue
928
937
  var strategyId = promotion.strategyId;
929
938
  if (!strategyId) return 0; // continue
930
- var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
939
+ var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
931
940
  var originalIndex = mainProducts.findIndex(function (item) {
932
941
  return getOrderProductUid(item) === lookupUid;
933
942
  });
@@ -3,6 +3,7 @@ import type { ProductData } from '../../../modules/Product/types';
3
3
  export interface BaseProductDetailOptionItem {
4
4
  option_group_item_id?: number | string;
5
5
  option_group_id?: number | string;
6
+ production_code?: string;
6
7
  num?: number | string;
7
8
  quantity?: number | string;
8
9
  price?: number | string;
@@ -10,6 +11,7 @@ export interface BaseProductDetailOptionItem {
10
11
  [key: string]: any;
11
12
  }
12
13
  export interface BaseProductDetailBundleItem {
14
+ production_code?: string;
13
15
  option?: BaseProductDetailOptionItem[];
14
16
  [key: string]: any;
15
17
  }
@@ -18,6 +20,7 @@ export interface BaseProductDetailPayload {
18
20
  product_id?: number | string | null;
19
21
  variant_id?: number | string | null;
20
22
  product_variant_id?: number | string | null;
23
+ production_code?: string;
21
24
  quantity?: number | string;
22
25
  num?: number | string;
23
26
  option?: BaseProductDetailOptionItem[];