@pisell/pisellos 2.2.282 → 2.2.284

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 (285) hide show
  1. package/dist/core/index.js +6 -9
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  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 +2 -2
  11. package/dist/modules/Order/index.js +75 -91
  12. package/dist/modules/Order/types.d.ts +3 -1
  13. package/dist/modules/Payment/index.js +97 -162
  14. package/dist/modules/Rules/index.js +1 -4
  15. package/dist/modules/Schedule/index.js +0 -1
  16. package/dist/modules/Schedule/utils.js +0 -1
  17. package/dist/modules/Step/index.js +0 -1
  18. package/dist/modules/Summary/utils.d.ts +1 -1
  19. package/dist/plugins/request.js +1 -4
  20. package/dist/plugins/window.js +2 -6
  21. package/dist/server/index.js +97 -129
  22. package/dist/server/modules/menu/index.js +32 -41
  23. package/dist/server/modules/order/index.js +2 -4
  24. package/dist/server/modules/products/index.js +24 -42
  25. package/dist/server/modules/quotation/index.js +29 -38
  26. package/dist/server/modules/resource/index.js +3 -4
  27. package/dist/server/modules/schedule/index.js +27 -35
  28. package/dist/server/utils/product.js +0 -1
  29. package/dist/solution/BaseSales/index.js +100 -72
  30. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  31. package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
  32. package/dist/solution/BookingByStep/index.d.ts +1 -1
  33. package/dist/solution/BookingByStep/index.js +7 -59
  34. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  35. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  36. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  37. package/dist/solution/BookingTicket/index.js +8 -4
  38. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  39. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  40. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  41. package/dist/solution/BuyTickets/index.js +9 -12
  42. package/dist/solution/Checkout/index.js +177 -252
  43. package/dist/solution/Checkout/utils/index.js +4 -16
  44. package/dist/solution/RegisterAndLogin/index.js +30 -76
  45. package/dist/solution/ScanOrder/index.js +50 -60
  46. package/dist/solution/ShopDiscount/index.js +2 -7
  47. package/dist/solution/VenueBooking/index.js +45 -55
  48. package/dist/utils/task.js +15 -18
  49. package/dist/utils/watch.js +0 -1
  50. package/lib/apis/picoding.js +2 -0
  51. package/lib/core/index.js +131 -131
  52. package/lib/effects/index.js +46 -57
  53. package/lib/index.js +82 -49
  54. package/lib/model/index.js +14 -21
  55. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  56. package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
  57. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  58. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  59. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  60. package/lib/model/strategy/adapter/index.js +100 -64
  61. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  62. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  63. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  64. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  65. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  66. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  67. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  68. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  69. package/lib/model/strategy/adapter/promotion/index.js +1 -51
  70. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  71. package/lib/model/strategy/adapter/type.js +4 -16
  72. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  73. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  74. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  75. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  76. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  77. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  78. package/lib/model/strategy/engine.js +270 -168
  79. package/lib/model/strategy/index.js +49 -34
  80. package/lib/model/strategy/strategy-example.js +243 -239
  81. package/lib/model/strategy/type.js +100 -40
  82. package/lib/modules/Account/index.js +39 -53
  83. package/lib/modules/Account/types.js +20 -33
  84. package/lib/modules/AccountList/index.js +116 -154
  85. package/lib/modules/AccountList/types.js +30 -31
  86. package/lib/modules/AccountList/utils.js +18 -30
  87. package/lib/modules/BaseModule.js +23 -42
  88. package/lib/modules/BookingContext/index.js +158 -136
  89. package/lib/modules/BookingContext/types.js +46 -32
  90. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  91. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  92. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  93. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  94. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  95. package/lib/modules/BookingContext/utils/index.js +124 -41
  96. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  97. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  98. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  99. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  100. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  101. package/lib/modules/BookingContext/utils/resources.js +209 -167
  102. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  103. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  104. package/lib/modules/Cart/index.js +170 -124
  105. package/lib/modules/Cart/types.js +46 -51
  106. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  107. package/lib/modules/Cart/utils/cartDate.js +56 -61
  108. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  109. package/lib/modules/Cart/utils/cartNote.js +27 -32
  110. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  111. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  112. package/lib/modules/Cart/utils/cartResource.js +70 -78
  113. package/lib/modules/Cart/utils/changePrice.js +22 -50
  114. package/lib/modules/Cart/utils/index.js +106 -48
  115. package/lib/modules/Customer/constants.js +13 -34
  116. package/lib/modules/Customer/index.js +235 -172
  117. package/lib/modules/Customer/types.js +38 -35
  118. package/lib/modules/Date/index.js +116 -115
  119. package/lib/modules/Date/types.js +16 -28
  120. package/lib/modules/Date/utils.js +174 -123
  121. package/lib/modules/Discount/index.js +122 -127
  122. package/lib/modules/Discount/types.js +9 -31
  123. package/lib/modules/Guests/index.js +30 -56
  124. package/lib/modules/Guests/types.js +23 -33
  125. package/lib/modules/Holder/index.js +209 -189
  126. package/lib/modules/Holder/types.js +4 -16
  127. package/lib/modules/Holder/utils.js +20 -49
  128. package/lib/modules/OpenData/index.js +70 -76
  129. package/lib/modules/OpenData/types.js +4 -16
  130. package/lib/modules/OpenData/utils.js +44 -78
  131. package/lib/modules/Order/index.d.ts +2 -2
  132. package/lib/modules/Order/index.js +1733 -2121
  133. package/lib/modules/Order/payment-utils.js +77 -120
  134. package/lib/modules/Order/types.d.ts +3 -1
  135. package/lib/modules/Order/types.js +87 -35
  136. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  137. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  138. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  139. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  140. package/lib/modules/Order/utils.js +814 -647
  141. package/lib/modules/Payment/cash.js +20 -33
  142. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  143. package/lib/modules/Payment/eftpos.js +16 -30
  144. package/lib/modules/Payment/index.js +532 -399
  145. package/lib/modules/Payment/mx51.js +1 -0
  146. package/lib/modules/Payment/types.js +230 -108
  147. package/lib/modules/Payment/utils.js +52 -51
  148. package/lib/modules/Payment/walletpass.js +485 -660
  149. package/lib/modules/Product/index.js +51 -46
  150. package/lib/modules/Product/types.js +4 -16
  151. package/lib/modules/Product/utils.js +32 -33
  152. package/lib/modules/ProductList/index.js +113 -123
  153. package/lib/modules/ProductList/types.js +9 -31
  154. package/lib/modules/Quotation/index.js +66 -100
  155. package/lib/modules/Quotation/types.js +4 -16
  156. package/lib/modules/Resource/index.js +27 -59
  157. package/lib/modules/Resource/types.js +22 -32
  158. package/lib/modules/Resource/utils.js +30 -38
  159. package/lib/modules/ResourcePlanner/index.js +60 -61
  160. package/lib/modules/ResourcePlanner/planner.js +346 -384
  161. package/lib/modules/ResourcePlanner/types.js +4 -16
  162. package/lib/modules/Rules/index.js +1218 -959
  163. package/lib/modules/Rules/types.js +17 -40
  164. package/lib/modules/SalesSummary/index.js +85 -90
  165. package/lib/modules/SalesSummary/types.js +4 -16
  166. package/lib/modules/SalesSummary/utils.js +355 -430
  167. package/lib/modules/ScanOrderLogger/index.js +59 -79
  168. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  169. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  170. package/lib/modules/ScanOrderLogger/types.js +4 -16
  171. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  172. package/lib/modules/Schedule/index.js +100 -114
  173. package/lib/modules/Schedule/type.js +4 -16
  174. package/lib/modules/Schedule/types.js +4 -16
  175. package/lib/modules/Schedule/utils.js +433 -291
  176. package/lib/modules/Step/index.js +40 -52
  177. package/lib/modules/Step/tyeps.js +4 -16
  178. package/lib/modules/Summary/index.js +66 -71
  179. package/lib/modules/Summary/types.js +4 -16
  180. package/lib/modules/Summary/utils.d.ts +1 -1
  181. package/lib/modules/Summary/utils.js +773 -418
  182. package/lib/modules/SurchargeList/index.js +46 -60
  183. package/lib/modules/SurchargeList/types.js +4 -16
  184. package/lib/modules/index.js +245 -63
  185. package/lib/plugins/app.js +4 -16
  186. package/lib/plugins/index.js +36 -25
  187. package/lib/plugins/request.js +137 -126
  188. package/lib/plugins/shopStore.js +4 -16
  189. package/lib/plugins/user.js +4 -16
  190. package/lib/plugins/window.js +171 -179
  191. package/lib/server/index.js +3027 -2655
  192. package/lib/server/modules/floor-plan/index.js +102 -123
  193. package/lib/server/modules/floor-plan/types.js +15 -30
  194. package/lib/server/modules/index.js +106 -68
  195. package/lib/server/modules/menu/index.js +146 -122
  196. package/lib/server/modules/menu/types.js +18 -31
  197. package/lib/server/modules/order/index.js +758 -956
  198. package/lib/server/modules/order/types.js +122 -33
  199. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  200. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  201. package/lib/server/modules/payment/index.js +59 -83
  202. package/lib/server/modules/payment/types.js +4 -16
  203. package/lib/server/modules/products/index.js +575 -459
  204. package/lib/server/modules/products/types.js +44 -34
  205. package/lib/server/modules/quotation/index.js +137 -172
  206. package/lib/server/modules/quotation/types.js +21 -31
  207. package/lib/server/modules/resource/index.js +213 -184
  208. package/lib/server/modules/resource/types.js +42 -33
  209. package/lib/server/modules/schedule/index.js +135 -123
  210. package/lib/server/modules/schedule/types.js +14 -21
  211. package/lib/server/modules/schedule/utils.js +334 -163
  212. package/lib/server/types.js +4 -16
  213. package/lib/server/utils/index.js +25 -23
  214. package/lib/server/utils/product.js +196 -139
  215. package/lib/server/utils/schedule.js +34 -41
  216. package/lib/server/utils/small-ticket.js +479 -456
  217. package/lib/server/utils/time.js +40 -49
  218. package/lib/solution/BaseSales/index.js +1209 -1412
  219. package/lib/solution/BaseSales/types.js +42 -38
  220. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
  221. package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
  222. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  223. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  224. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +108 -145
  225. package/lib/solution/BaseSales/utils.js +158 -143
  226. package/lib/solution/BookingByStep/index.d.ts +1 -1
  227. package/lib/solution/BookingByStep/index.js +1527 -1340
  228. package/lib/solution/BookingByStep/types.js +40 -99
  229. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  230. package/lib/solution/BookingByStep/utils/products.js +42 -52
  231. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  232. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  233. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  234. package/lib/solution/BookingTicket/index.js +598 -514
  235. package/lib/solution/BookingTicket/types.js +99 -77
  236. package/lib/solution/BookingTicket/utils/addProductDecision.js +225 -187
  237. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  238. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  239. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  240. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  241. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  242. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  243. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  244. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  245. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  246. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  247. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  248. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  249. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  250. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  251. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  252. package/lib/solution/BuyTickets/index.js +67 -70
  253. package/lib/solution/BuyTickets/types.js +22 -38
  254. package/lib/solution/Checkout/index.js +1451 -1158
  255. package/lib/solution/Checkout/types.js +91 -61
  256. package/lib/solution/Checkout/utils/index.js +228 -156
  257. package/lib/solution/PlaceOrder/index.js +55 -0
  258. package/lib/solution/RegisterAndLogin/config.js +493 -460
  259. package/lib/solution/RegisterAndLogin/index.js +633 -630
  260. package/lib/solution/RegisterAndLogin/types.js +189 -76
  261. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  262. package/lib/solution/Sales/index.js +328 -324
  263. package/lib/solution/Sales/types.js +27 -33
  264. package/lib/solution/ScanOrder/index.js +832 -864
  265. package/lib/solution/ScanOrder/types.js +33 -34
  266. package/lib/solution/ScanOrder/utils.js +409 -374
  267. package/lib/solution/ShopDiscount/index.js +226 -232
  268. package/lib/solution/ShopDiscount/types.js +15 -37
  269. package/lib/solution/ShopDiscount/utils.js +300 -172
  270. package/lib/solution/UnifiedBookingSales/index.js +437 -487
  271. package/lib/solution/UnifiedBookingSales/types.js +12 -31
  272. package/lib/solution/VenueBooking/index.js +811 -879
  273. package/lib/solution/VenueBooking/types.js +19 -39
  274. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  275. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  276. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  277. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  278. package/lib/solution/VenueBooking/utils.js +130 -67
  279. package/lib/solution/index.js +124 -41
  280. package/lib/store/createStore.js +32 -29
  281. package/lib/types/index.js +4 -16
  282. package/lib/utils/payment-number.js +26 -46
  283. package/lib/utils/task.js +36 -36
  284. package/lib/utils/watch.js +81 -47
  285. package/package.json +2 -1
@@ -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";
@@ -2305,6 +2305,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2305
2305
  }, {
2306
2306
  key: "restoreOriginalSnapshotIfProductsUnchanged",
2307
2307
  value: function restoreOriginalSnapshotIfProductsUnchanged(tempOrder, snapshot) {
2308
+ // merge hydrate 的商品集合包含本地未提交行,但 summary 仍来自远端旧订单,不能复用。
2309
+ if (snapshot.requiresFullSummaryRecalculation === true) return null;
2308
2310
  var currentFingerprint = this.buildOrderProductsFingerprint(tempOrder.products);
2309
2311
  var manualDepositOverride = this.getManualDepositOverride(tempOrder);
2310
2312
  if (currentFingerprint !== snapshot.productFingerprint) {
@@ -4018,8 +4020,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4018
4020
  booking: booking
4019
4021
  }) : null;
4020
4022
  var productToAdd = (linked === null || linked === void 0 ? void 0 : linked.product) || product;
4021
- var incomingFingerprint = buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
4023
+ var disableMerge = (options === null || options === void 0 ? void 0 : options.disableMerge) === true;
4024
+ var incomingFingerprint = disableMerge ? '' : buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
4022
4025
  var normalizedIncoming = mergeOrderProductDisplayFields(productToAdd, normalizeOrderProduct(productToAdd));
4026
+ if (disableMerge) {
4027
+ normalizedIncoming.metadata = _objectSpread(_objectSpread({}, normalizedIncoming.metadata || {}), {}, _defineProperty({}, PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY, true));
4028
+ }
4023
4029
  var isWeighingProduct = Number(((_normalizedIncoming$p = normalizedIncoming.product_sku) === null || _normalizedIncoming$p === void 0 ? void 0 : _normalizedIncoming$p.open_sold_weight) || 0) === 1;
4024
4030
  var netWeight = Number((_normalizedIncoming$p2 = normalizedIncoming.product_sku) === null || _normalizedIncoming$p2 === void 0 ? void 0 : _normalizedIncoming$p2.net_weight);
4025
4031
  if (isWeighingProduct && (!Number.isFinite(netWeight) || netWeight <= 0)) {
@@ -4038,7 +4044,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4038
4044
  var hasIncomingManualProductDiscount = isManualProductDiscountProduct(normalizedIncoming);
4039
4045
  var hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
4040
4046
  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;
4041
- var shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
4047
+ var shouldForceNewLine = disableMerge || !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
4042
4048
  var matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
4043
4049
  var _item$metadata3;
4044
4050
  if (_this27.hasGoodPassDiscount(item)) return false;
@@ -4168,7 +4174,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4168
4174
  singleLine.num = 1;
4169
4175
  delete singleLine.product_quantity;
4170
4176
  _appendResult = this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking), {
4171
- insertAtIndex: insertAtIndex
4177
+ insertAtIndex: insertAtIndex,
4178
+ disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
4172
4179
  });
4173
4180
  if (!_appendResult) {
4174
4181
  _context21.next = 17;
@@ -4189,7 +4196,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4189
4196
  return _context21.abrupt("return", tempOrder.products);
4190
4197
  case 24:
4191
4198
  appendResult = this.appendProductLineToTempOrder(tempOrder, product, booking, {
4192
- insertAtIndex: insertAtIndex
4199
+ insertAtIndex: insertAtIndex,
4200
+ disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
4193
4201
  });
4194
4202
  if (!appendResult) {
4195
4203
  _context21.next = 28;
@@ -5266,7 +5274,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5266
5274
  request_unique_idempotency_token: params === null || params === void 0 ? void 0 : params.request_unique_idempotency_token,
5267
5275
  enhance: enhancePayload
5268
5276
  });
5269
- console.log('[Order.runSubmitTempOrder.payload]', payload);
5270
5277
  if (params !== null && params !== void 0 && params.syncMode) {
5271
5278
  payload.sync_mode = true;
5272
5279
  }
@@ -5274,10 +5281,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5274
5281
  if (!payload.created_at) {
5275
5282
  payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
5276
5283
  }
5277
- _context35.next = 26;
5284
+ _context35.next = 25;
5278
5285
  return this.saveDraft();
5279
- case 26:
5280
- _context35.prev = 26;
5286
+ case 25:
5287
+ _context35.prev = 25;
5281
5288
  this.logInfo('submitTempOrder calling sales checkout', {
5282
5289
  orderId: payload.order_id,
5283
5290
  externalSaleNumber: payload.external_sale_number,
@@ -5287,26 +5294,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5287
5294
  smallTicketDataFlag: payload.small_ticket_data_flag,
5288
5295
  syncMode: payload.sync_mode
5289
5296
  });
5290
- _context35.next = 30;
5297
+ _context35.next = 29;
5291
5298
  return this.submitSalesOrder({
5292
5299
  query: payload
5293
5300
  });
5294
- case 30:
5301
+ case 29:
5295
5302
  result = _context35.sent;
5296
- _context35.next = 43;
5303
+ _context35.next = 42;
5297
5304
  break;
5298
- case 33:
5299
- _context35.prev = 33;
5300
- _context35.t2 = _context35["catch"](26);
5305
+ case 32:
5306
+ _context35.prev = 32;
5307
+ _context35.t2 = _context35["catch"](25);
5301
5308
  backendErrorResponse = this.extractSubmitErrorResponse(_context35.t2);
5302
5309
  if (!backendErrorResponse) {
5303
- _context35.next = 40;
5310
+ _context35.next = 39;
5304
5311
  break;
5305
5312
  }
5306
5313
  this.store.syncState = 'failed';
5307
5314
  this.logSubmitBackendRejected(backendErrorResponse, payload);
5308
5315
  return _context35.abrupt("return", backendErrorResponse);
5309
- case 40:
5316
+ case 39:
5310
5317
  this.store.syncState = 'failed';
5311
5318
  this.logError('submitTempOrder failed', {
5312
5319
  error: _context35.t2 instanceof Error ? _context35.t2.message : String(_context35.t2),
@@ -5316,15 +5323,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5316
5323
  paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
5317
5324
  });
5318
5325
  throw _context35.t2;
5319
- case 43:
5326
+ case 42:
5320
5327
  if (!this.isSubmitResponseRejected(result)) {
5321
- _context35.next = 47;
5328
+ _context35.next = 46;
5322
5329
  break;
5323
5330
  }
5324
5331
  this.store.syncState = 'failed';
5325
5332
  this.logSubmitBackendRejected(result, payload);
5326
5333
  return _context35.abrupt("return", result);
5327
- case 47:
5334
+ case 46:
5328
5335
  submittedOrderId = this.extractOrderIdFromSubmitResult(result);
5329
5336
  this.logInfo('runSubmitTempOrder: 提交成功', {
5330
5337
  submittedOrderId: submittedOrderId,
@@ -5334,29 +5341,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5334
5341
  })
5335
5342
  });
5336
5343
  if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
5337
- _context35.next = 56;
5344
+ _context35.next = 55;
5338
5345
  break;
5339
5346
  }
5340
5347
  tempOrder.order_id = submittedOrderId;
5341
5348
  resultRecord = result;
5342
- _context35.next = 54;
5349
+ _context35.next = 53;
5343
5350
  return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
5344
- case 54:
5345
- _context35.next = 57;
5351
+ case 53:
5352
+ _context35.next = 56;
5346
5353
  break;
5347
- case 56:
5354
+ case 55:
5348
5355
  if (this.isLocalPendingSubmitResult(result)) {
5349
5356
  this.store.syncState = 'local';
5350
5357
  } else {
5351
5358
  this.store.syncState = 'submitted';
5352
5359
  }
5353
- case 57:
5360
+ case 56:
5354
5361
  return _context35.abrupt("return", result);
5355
- case 58:
5362
+ case 57:
5356
5363
  case "end":
5357
5364
  return _context35.stop();
5358
5365
  }
5359
- }, _callee32, this, [[26, 33]]);
5366
+ }, _callee32, this, [[25, 32]]);
5360
5367
  }));
5361
5368
  function runSubmitTempOrder(_x39) {
5362
5369
  return _runSubmitTempOrder.apply(this, arguments);
@@ -5784,8 +5791,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5784
5791
  key: "createOrderByCheckout",
5785
5792
  value: (function () {
5786
5793
  var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
5787
- var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
5788
- 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;
5794
+ var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3;
5795
+ var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, orderData, response;
5789
5796
  return _regeneratorRuntime().wrap(function _callee38$(_context41) {
5790
5797
  while (1) switch (_context41.prev = _context41.next) {
5791
5798
  case 0:
@@ -5812,16 +5819,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5812
5819
  return p.code;
5813
5820
  })) || []
5814
5821
  });
5815
- console.log('[Order] createOrderByCheckout 开始创建订单:', {
5816
- type: params.type,
5817
- platform: params.platform,
5818
- is_deposit: params.is_deposit,
5819
- customer_id: params.customer_id,
5820
- bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
5821
- relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
5822
- paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
5823
- });
5824
- _context41.prev = 4;
5822
+ _context41.prev = 3;
5825
5823
  // 构建订单数据,设置默认值并允许 params 覆盖
5826
5824
  orderData = _objectSpread({
5827
5825
  sales_channel: 'my_pisel',
@@ -5843,20 +5841,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5843
5841
  if (!params.order_id && !orderData.schedule_date) {
5844
5842
  orderData.schedule_date = dayjs().format('YYYY-MM-DD HH:mm:ss');
5845
5843
  }
5846
- console.log('[Order] 调用后端接口创建订单:', {
5847
- url: '/shop/order/checkout',
5848
- orderType: orderData.type,
5849
- platform: orderData.platform,
5850
- isDeposit: orderData.is_deposit,
5851
- customerId: orderData.customer_id,
5852
- bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
5853
- relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
5854
- paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
5855
- paymentsMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
5856
- return p.code;
5857
- })) || []
5858
- });
5859
-
5860
5844
  // 记录接口调用详情
5861
5845
  this.logInfo('Calling backend checkout API', {
5862
5846
  url: '/shop/order/checkout',
@@ -5865,10 +5849,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5865
5849
  isDeposit: orderData.is_deposit,
5866
5850
  customerId: orderData.customer_id,
5867
5851
  depositAmount: orderData.deposit_amount,
5868
- bookingsCount: ((_orderData$bookings2 = orderData.bookings) === null || _orderData$bookings2 === void 0 ? void 0 : _orderData$bookings2.length) || 0,
5869
- relationProductsCount: ((_orderData$relation_p2 = orderData.relation_products) === null || _orderData$relation_p2 === void 0 ? void 0 : _orderData$relation_p2.length) || 0,
5870
- paymentsCount: ((_orderData$payments4 = orderData.payments) === null || _orderData$payments4 === void 0 ? void 0 : _orderData$payments4.length) || 0,
5871
- paymentMethods: ((_orderData$payments5 = orderData.payments) === null || _orderData$payments5 === void 0 ? void 0 : _orderData$payments5.map(function (p) {
5852
+ bookingsCount: ((_orderData$bookings = orderData.bookings) === null || _orderData$bookings === void 0 ? void 0 : _orderData$bookings.length) || 0,
5853
+ relationProductsCount: ((_orderData$relation_p = orderData.relation_products) === null || _orderData$relation_p === void 0 ? void 0 : _orderData$relation_p.length) || 0,
5854
+ paymentsCount: ((_orderData$payments2 = orderData.payments) === null || _orderData$payments2 === void 0 ? void 0 : _orderData$payments2.length) || 0,
5855
+ paymentMethods: ((_orderData$payments3 = orderData.payments) === null || _orderData$payments3 === void 0 ? void 0 : _orderData$payments3.map(function (p) {
5872
5856
  return {
5873
5857
  code: p.code,
5874
5858
  amount: p.amount,
@@ -5883,34 +5867,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5883
5867
  hasOrderId: !!orderData.order_id,
5884
5868
  smallTicketDataFlag: orderData.small_ticket_data_flag
5885
5869
  });
5886
- _context41.next = 12;
5870
+ _context41.next = 10;
5887
5871
  return this.request.post('/order/checkout', orderData, {
5888
5872
  osServer: true,
5889
5873
  customToast: function customToast() {}
5890
5874
  });
5891
- case 12:
5875
+ case 10:
5892
5876
  response = _context41.sent;
5893
5877
  this.logInfo('Order API called successfully', {
5894
5878
  response: response
5895
5879
  });
5896
- console.log('[Order] 订单创建成功,后端响应:', {
5897
- success: !!response,
5898
- 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)
5899
- });
5900
5880
  return _context41.abrupt("return", response);
5901
- case 18:
5902
- _context41.prev = 18;
5903
- _context41.t0 = _context41["catch"](4);
5881
+ case 15:
5882
+ _context41.prev = 15;
5883
+ _context41.t0 = _context41["catch"](3);
5904
5884
  console.error('[Order] createOrderByCheckout 创建订单失败:', _context41.t0);
5905
5885
  this.logInfo('Order API called failed', {
5906
5886
  error: _context41.t0 instanceof Error ? _context41.t0.message : String(_context41.t0)
5907
5887
  });
5908
5888
  throw _context41.t0;
5909
- case 23:
5889
+ case 20:
5910
5890
  case "end":
5911
5891
  return _context41.stop();
5912
5892
  }
5913
- }, _callee38, this, [[4, 18]]);
5893
+ }, _callee38, this, [[3, 15]]);
5914
5894
  }));
5915
5895
  function createOrderByCheckout(_x46) {
5916
5896
  return _createOrderByCheckout.apply(this, arguments);
@@ -6041,7 +6021,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6041
6021
  value: (function () {
6042
6022
  var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(record, options) {
6043
6023
  var _sourceRaw$_extend, _this$store$discount22;
6044
- var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, nextTempOrder, _this$store$discount20, _this$store$discount21, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount23, _this$store$discount24;
6024
+ var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, isMergedSalesDetailHydrate, nextTempOrder, _this$store$discount20, _this$store$discount21, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount23, _this$store$discount24;
6045
6025
  return _regeneratorRuntime().wrap(function _callee42$(_context45) {
6046
6026
  while (1) switch (_context45.prev = _context45.next) {
6047
6027
  case 0:
@@ -6076,12 +6056,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6076
6056
  }
6077
6057
  }
6078
6058
  isSessionStorageHydrate = (options === null || options === void 0 ? void 0 : options.source) === 'sessionStorage';
6059
+ isMergedSalesDetailHydrate = (options === null || options === void 0 ? void 0 : options.source) === 'mergedSalesDetail';
6079
6060
  nextTempOrder = this.normalizeTempOrderForRuntime(raw, {
6080
- makeEditMark: !isSessionStorageHydrate
6061
+ // merge 前已只给远端商品补标记;这里不能把本地未提交商品一并变成 saved item。
6062
+ makeEditMark: !isSessionStorageHydrate && !isMergedSalesDetailHydrate
6081
6063
  });
6082
6064
  this.store.tempOrder = nextTempOrder;
6083
6065
  if (!isSessionStorageHydrate) {
6084
- _context45.next = 29;
6066
+ _context45.next = 30;
6085
6067
  break;
6086
6068
  }
6087
6069
  // 会话快照是未提交购物车,不应获得编辑订单的 saved/edit 标记与服务端基线。
@@ -6097,24 +6079,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6097
6079
  nextTempOrder.discount_list = restoredSessionDiscounts;
6098
6080
  this.store.summary = createEmptySummary();
6099
6081
  this.store.lastOrderInfo = undefined;
6100
- _context45.next = 22;
6082
+ _context45.next = 23;
6101
6083
  return (_this$store$discount20 = this.store.discount) === null || _this$store$discount20 === void 0 ? void 0 : _this$store$discount20.setOriginalDiscountList(cloneDeep(restoredSessionDiscounts));
6102
- case 22:
6103
- _context45.next = 24;
6084
+ case 23:
6085
+ _context45.next = 25;
6104
6086
  return (_this$store$discount21 = this.store.discount) === null || _this$store$discount21 === void 0 ? void 0 : _this$store$discount21.setDiscountList(cloneDeep(restoredSessionDiscounts));
6105
- case 24:
6087
+ case 25:
6106
6088
  if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
6107
- _context45.next = 27;
6089
+ _context45.next = 28;
6108
6090
  break;
6109
6091
  }
6110
- _context45.next = 27;
6092
+ _context45.next = 28;
6111
6093
  return this.recalculateSummary({
6112
6094
  createIfMissing: false
6113
6095
  });
6114
- case 27:
6096
+ case 28:
6115
6097
  this.persistTempOrder();
6116
6098
  return _context45.abrupt("return", nextTempOrder);
6117
- case 29:
6099
+ case 30:
6118
6100
  // Server list compatibility may synthesize order_id from external_sale_number; tempOrder must not.
6119
6101
  sourceLastOrderInfo = sourceRaw.lastOrderInfo || sourceRaw;
6120
6102
  isDraftOrder = Number(nextTempOrder.is_draft_order || 0) === 1;
@@ -6130,7 +6112,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6130
6112
  surcharges: summarySurcharges
6131
6113
  });
6132
6114
  nextTempOrder._extend = _objectSpread(_objectSpread({}, nextTempOrder._extend || {}), {}, {
6133
- originalSalesSnapshot: {
6115
+ originalSalesSnapshot: _objectSpread({
6134
6116
  summary: cloneDeep(this.store.summary),
6135
6117
  products: cloneDeep(nextTempOrder.products || []),
6136
6118
  bookings: cloneDeep(nextTempOrder.bookings || []),
@@ -6138,7 +6120,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6138
6120
  surcharges: cloneDeep(nextTempOrder.surcharges || []),
6139
6121
  shop_discount: nextTempOrder.shop_discount || '0.00',
6140
6122
  productFingerprint: this.buildOrderProductsFingerprint(nextTempOrder.products || [])
6141
- }
6123
+ }, isMergedSalesDetailHydrate ? {
6124
+ requiresFullSummaryRecalculation: true
6125
+ } : {})
6142
6126
  });
6143
6127
  this.store.lastOrderInfo = this.withoutSyntheticDraftOrderIdForRuntime(sourceLastOrderInfo, syntheticIdentityOptions);
6144
6128
  hadSyntheticDraftOrderId = this.isSyntheticDraftOrderIdForRuntime(raw, syntheticIdentityOptions) || this.isSyntheticDraftOrderIdForRuntime(sourceLastOrderInfo, syntheticIdentityOptions);
@@ -6159,28 +6143,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6159
6143
  nextDiscounts = [].concat(_toConsumableArray(hydratedEditDiscounts), _toConsumableArray(retainedScanDiscounts));
6160
6144
  shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
6161
6145
  if (shouldSkipEmptyDiscountSync) {
6162
- _context45.next = 52;
6146
+ _context45.next = 53;
6163
6147
  break;
6164
6148
  }
6165
6149
  OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
6166
- _context45.next = 50;
6150
+ _context45.next = 51;
6167
6151
  return (_this$store$discount23 = this.store.discount) === null || _this$store$discount23 === void 0 ? void 0 : _this$store$discount23.setOriginalDiscountList(nextDiscounts);
6168
- case 50:
6169
- _context45.next = 52;
6152
+ case 51:
6153
+ _context45.next = 53;
6170
6154
  return (_this$store$discount24 = this.store.discount) === null || _this$store$discount24 === void 0 ? void 0 : _this$store$discount24.setDiscountList(nextDiscounts);
6171
- case 52:
6155
+ case 53:
6172
6156
  if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
6173
- _context45.next = 55;
6157
+ _context45.next = 56;
6174
6158
  break;
6175
6159
  }
6176
- _context45.next = 55;
6160
+ _context45.next = 56;
6177
6161
  return this.recalculateSummary({
6178
6162
  createIfMissing: false
6179
6163
  });
6180
- case 55:
6164
+ case 56:
6181
6165
  this.persistTempOrder();
6182
6166
  return _context45.abrupt("return", nextTempOrder);
6183
- case 57:
6167
+ case 58:
6184
6168
  case "end":
6185
6169
  return _context45.stop();
6186
6170
  }
@@ -328,6 +328,8 @@ export type AddProductBookingInput = Record<string, any>;
328
328
  */
329
329
  export interface AddProductToOrderOptions {
330
330
  insertAfterProductUid?: string;
331
+ /** 跳过同商品/规格匹配,始终新增购物车行。 */
332
+ disableMerge?: boolean;
331
333
  }
332
334
  /**
333
335
  * 删除商品后的可选位置保持策略。
@@ -819,7 +821,7 @@ export interface OrderModuleAPI {
819
821
  saveDraft: () => Promise<void>;
820
822
  hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
821
823
  recalcOnHydrate?: boolean;
822
- source?: 'salesDetail' | 'sessionStorage';
824
+ source?: 'salesDetail' | 'mergedSalesDetail' | 'sessionStorage';
823
825
  }) => Promise<OrderTempOrder>;
824
826
  syncPaymentsToOrder: <T = any>(params: SyncPaymentsToOrderParams) => Promise<SyncPaymentsToOrderResult<T>>;
825
827
  getSalesOrderByLookup: (params: SalesOrderLookupParams) => Promise<any>;