@pisell/pisellos 2.2.243 → 2.2.244

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 (315) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +2 -3
  2. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  3. package/dist/model/strategy/adapter/walletPass/utils.js +4 -7
  4. package/dist/modules/Cart/utils/cartProduct.js +3 -24
  5. package/dist/modules/Cart/utils/changePrice.js +11 -11
  6. package/dist/modules/Customer/index.d.ts +0 -20
  7. package/dist/modules/Customer/index.js +83 -172
  8. package/dist/modules/Customer/types.d.ts +0 -2
  9. package/dist/modules/Discount/index.js +3 -4
  10. package/dist/modules/Discount/types.d.ts +0 -1
  11. package/dist/modules/OpenData/index.d.ts +0 -8
  12. package/dist/modules/OpenData/index.js +17 -37
  13. package/dist/modules/Order/index.d.ts +18 -268
  14. package/dist/modules/Order/index.js +757 -3306
  15. package/dist/modules/Order/types.d.ts +31 -279
  16. package/dist/modules/Order/types.js +0 -38
  17. package/dist/modules/Order/utils.d.ts +5 -147
  18. package/dist/modules/Order/utils.js +103 -746
  19. package/dist/modules/Payment/index.d.ts +13 -10
  20. package/dist/modules/Payment/index.js +837 -467
  21. package/dist/modules/Payment/types.d.ts +0 -2
  22. package/dist/modules/Payment/utils.js +1 -2
  23. package/dist/modules/Payment/walletpass.js +7 -14
  24. package/dist/modules/ProductList/index.d.ts +12 -16
  25. package/dist/modules/ProductList/index.js +59 -133
  26. package/dist/modules/ProductList/types.d.ts +0 -14
  27. package/dist/modules/Quotation/index.d.ts +1 -0
  28. package/dist/modules/Quotation/index.js +22 -25
  29. package/dist/modules/Rules/index.d.ts +0 -4
  30. package/dist/modules/Rules/index.js +69 -93
  31. package/dist/modules/Rules/types.d.ts +0 -1
  32. package/dist/modules/SalesSummary/index.d.ts +25 -8
  33. package/dist/modules/SalesSummary/index.js +35 -86
  34. package/dist/modules/SalesSummary/types.d.ts +1 -4
  35. package/dist/modules/SalesSummary/utils.d.ts +25 -2
  36. package/dist/modules/SalesSummary/utils.js +162 -794
  37. package/dist/modules/Schedule/index.d.ts +0 -7
  38. package/dist/modules/Schedule/index.js +2 -24
  39. package/dist/modules/Summary/index.js +3 -4
  40. package/dist/modules/index.d.ts +0 -2
  41. package/dist/modules/index.js +1 -3
  42. package/dist/plugins/request.d.ts +0 -1
  43. package/dist/server/index.d.ts +1 -204
  44. package/dist/server/index.js +928 -3658
  45. package/dist/server/modules/index.d.ts +0 -2
  46. package/dist/server/modules/index.js +0 -2
  47. package/dist/server/modules/order/index.d.ts +4 -120
  48. package/dist/server/modules/order/index.js +483 -1779
  49. package/dist/server/modules/order/types.d.ts +3 -32
  50. package/dist/server/modules/order/types.js +0 -8
  51. package/dist/server/modules/order/utils/filterBookings.js +3 -26
  52. package/dist/server/modules/order/utils/filterOrders.js +8 -23
  53. package/dist/server/modules/products/index.d.ts +7 -34
  54. package/dist/server/modules/products/index.js +317 -631
  55. package/dist/server/modules/resource/index.d.ts +0 -2
  56. package/dist/server/modules/resource/index.js +3 -29
  57. package/dist/server/modules/schedule/index.d.ts +4 -4
  58. package/dist/server/modules/schedule/index.js +88 -111
  59. package/dist/solution/BaseSales/index.d.ts +9 -131
  60. package/dist/solution/BaseSales/index.js +447 -1944
  61. package/dist/solution/BaseSales/types.d.ts +6 -76
  62. package/dist/solution/BaseSales/types.js +4 -5
  63. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  64. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +24 -105
  65. package/dist/solution/BaseSales/utils.d.ts +1 -1
  66. package/dist/solution/BaseSales/utils.js +21 -62
  67. package/dist/solution/BookingByStep/index.d.ts +1 -1
  68. package/dist/solution/BookingTicket/index.d.ts +10 -270
  69. package/dist/solution/BookingTicket/index.js +237 -1772
  70. package/dist/solution/BookingTicket/types.d.ts +1 -118
  71. package/dist/solution/BookingTicket/types.js +2 -41
  72. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  73. package/dist/solution/BookingTicket/utils/bookingStatus.js +0 -70
  74. package/dist/solution/BookingTicket/utils/cartView.d.ts +1 -9
  75. package/dist/solution/BookingTicket/utils/cartView.js +7 -94
  76. package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  77. package/dist/solution/BookingTicket/utils/scan/index.js +8 -20
  78. package/dist/solution/Checkout/appointmentDemo.json +1 -0
  79. package/dist/solution/Checkout/index.d.ts +0 -1
  80. package/dist/solution/Checkout/index.js +9 -10
  81. package/dist/solution/RegisterAndLogin/config.js +10 -2
  82. package/dist/solution/ScanOrder/index.d.ts +3 -9
  83. package/dist/solution/ScanOrder/index.js +134 -241
  84. package/dist/solution/ScanOrder/types.d.ts +5 -9
  85. package/dist/solution/ScanOrder/types.js +3 -2
  86. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  87. package/dist/solution/ScanOrder/utils.js +22 -84
  88. package/dist/solution/VenueBooking/index.d.ts +2 -5
  89. package/dist/solution/VenueBooking/index.js +59 -110
  90. package/dist/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
  93. package/dist/types/index.d.ts +0 -10
  94. package/lib/model/strategy/adapter/promotion/evaluator.js +1 -2
  95. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  96. package/lib/model/strategy/adapter/walletPass/utils.js +2 -3
  97. package/lib/modules/Cart/utils/cartProduct.js +3 -20
  98. package/lib/modules/Cart/utils/changePrice.js +20 -12
  99. package/lib/modules/Customer/index.d.ts +0 -20
  100. package/lib/modules/Customer/index.js +11 -64
  101. package/lib/modules/Customer/types.d.ts +0 -2
  102. package/lib/modules/Discount/index.js +1 -5
  103. package/lib/modules/Discount/types.d.ts +0 -1
  104. package/lib/modules/OpenData/index.d.ts +0 -8
  105. package/lib/modules/OpenData/index.js +5 -19
  106. package/lib/modules/Order/index.d.ts +18 -268
  107. package/lib/modules/Order/index.js +344 -2149
  108. package/lib/modules/Order/types.d.ts +31 -279
  109. package/lib/modules/Order/types.js +0 -1
  110. package/lib/modules/Order/utils.d.ts +5 -147
  111. package/lib/modules/Order/utils.js +46 -614
  112. package/lib/modules/Payment/index.d.ts +13 -10
  113. package/lib/modules/Payment/index.js +150 -18
  114. package/lib/modules/Payment/types.d.ts +0 -2
  115. package/lib/modules/Payment/utils.js +1 -2
  116. package/lib/modules/Payment/walletpass.js +3 -7
  117. package/lib/modules/ProductList/index.d.ts +12 -16
  118. package/lib/modules/ProductList/index.js +4 -41
  119. package/lib/modules/ProductList/types.d.ts +0 -14
  120. package/lib/modules/Quotation/index.d.ts +1 -0
  121. package/lib/modules/Quotation/index.js +16 -19
  122. package/lib/modules/Rules/index.d.ts +0 -4
  123. package/lib/modules/Rules/index.js +120 -136
  124. package/lib/modules/Rules/types.d.ts +0 -1
  125. package/lib/modules/SalesSummary/index.d.ts +25 -8
  126. package/lib/modules/SalesSummary/index.js +4 -30
  127. package/lib/modules/SalesSummary/types.d.ts +1 -4
  128. package/lib/modules/SalesSummary/utils.d.ts +25 -2
  129. package/lib/modules/SalesSummary/utils.js +91 -645
  130. package/lib/modules/Schedule/index.d.ts +0 -7
  131. package/lib/modules/Schedule/index.js +1 -17
  132. package/lib/modules/Summary/index.js +4 -5
  133. package/lib/modules/index.d.ts +0 -2
  134. package/lib/modules/index.js +1 -5
  135. package/lib/plugins/request.d.ts +0 -1
  136. package/lib/server/index.d.ts +1 -204
  137. package/lib/server/index.js +57 -1888
  138. package/lib/server/modules/index.d.ts +0 -2
  139. package/lib/server/modules/index.js +0 -3
  140. package/lib/server/modules/order/index.d.ts +4 -120
  141. package/lib/server/modules/order/index.js +142 -919
  142. package/lib/server/modules/order/types.d.ts +3 -32
  143. package/lib/server/modules/order/utils/filterBookings.js +5 -24
  144. package/lib/server/modules/order/utils/filterOrders.js +6 -15
  145. package/lib/server/modules/products/index.d.ts +7 -34
  146. package/lib/server/modules/products/index.js +54 -189
  147. package/lib/server/modules/resource/index.d.ts +0 -2
  148. package/lib/server/modules/resource/index.js +3 -27
  149. package/lib/server/modules/schedule/index.d.ts +4 -4
  150. package/lib/server/modules/schedule/index.js +40 -47
  151. package/lib/solution/BaseSales/index.d.ts +9 -131
  152. package/lib/solution/BaseSales/index.js +63 -1106
  153. package/lib/solution/BaseSales/types.d.ts +6 -76
  154. package/lib/solution/BaseSales/types.js +1 -3
  155. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
  156. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +18 -106
  157. package/lib/solution/BaseSales/utils.d.ts +1 -1
  158. package/lib/solution/BaseSales/utils.js +10 -54
  159. package/lib/solution/BookingByStep/index.d.ts +1 -1
  160. package/lib/solution/BookingTicket/index.d.ts +10 -270
  161. package/lib/solution/BookingTicket/index.js +29 -922
  162. package/lib/solution/BookingTicket/types.d.ts +1 -118
  163. package/lib/solution/BookingTicket/types.js +0 -11
  164. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
  165. package/lib/solution/BookingTicket/utils/bookingStatus.js +2 -44
  166. package/lib/solution/BookingTicket/utils/cartView.d.ts +1 -9
  167. package/lib/solution/BookingTicket/utils/cartView.js +6 -61
  168. package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -5
  169. package/lib/solution/BookingTicket/utils/scan/index.js +3 -17
  170. package/lib/solution/Checkout/appointmentDemo.json +1 -0
  171. package/lib/solution/Checkout/index.d.ts +0 -1
  172. package/lib/solution/Checkout/index.js +2 -1
  173. package/lib/solution/RegisterAndLogin/config.js +10 -2
  174. package/lib/solution/ScanOrder/index.d.ts +3 -9
  175. package/lib/solution/ScanOrder/index.js +70 -153
  176. package/lib/solution/ScanOrder/types.d.ts +5 -9
  177. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  178. package/lib/solution/ScanOrder/utils.js +17 -83
  179. package/lib/solution/VenueBooking/index.d.ts +2 -5
  180. package/lib/solution/VenueBooking/index.js +17 -54
  181. package/lib/solution/VenueBooking/sales-section-4-annotated.json +2 -0
  182. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  183. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
  184. package/lib/types/index.d.ts +0 -10
  185. package/package.json +1 -1
  186. package/dist/modules/BookingContext/index.d.ts +0 -48
  187. package/dist/modules/BookingContext/index.js +0 -566
  188. package/dist/modules/BookingContext/types.d.ts +0 -102
  189. package/dist/modules/BookingContext/types.js +0 -51
  190. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  191. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -284
  192. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  193. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -145
  194. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  195. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -218
  196. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  197. package/dist/modules/BookingContext/utils/flexible.js +0 -56
  198. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  199. package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
  200. package/dist/modules/BookingContext/utils/index.d.ts +0 -11
  201. package/dist/modules/BookingContext/utils/index.js +0 -11
  202. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  203. package/dist/modules/BookingContext/utils/noResource.js +0 -77
  204. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  205. package/dist/modules/BookingContext/utils/orderLineDisplay.js +0 -36
  206. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
  207. package/dist/modules/BookingContext/utils/productExtend.js +0 -339
  208. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  209. package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
  210. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  211. package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
  212. package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
  213. package/dist/modules/BookingContext/utils/resources.js +0 -486
  214. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  215. package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
  216. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  217. package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
  218. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  219. package/dist/modules/Order/utils/manualProductDiscount.js +0 -210
  220. package/dist/modules/SurchargeList/index.d.ts +0 -16
  221. package/dist/modules/SurchargeList/index.js +0 -162
  222. package/dist/modules/SurchargeList/types.d.ts +0 -11
  223. package/dist/modules/SurchargeList/types.js +0 -1
  224. package/dist/server/modules/payment/index.d.ts +0 -28
  225. package/dist/server/modules/payment/index.js +0 -305
  226. package/dist/server/modules/payment/types.d.ts +0 -9
  227. package/dist/server/modules/payment/types.js +0 -1
  228. package/dist/server/test.json +0 -713
  229. package/dist/server/utils/small-ticket.d.ts +0 -71
  230. package/dist/server/utils/small-ticket.js +0 -830
  231. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  232. package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1438
  233. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  234. package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
  235. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  236. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
  237. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  238. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +0 -95
  239. package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  240. package/dist/solution/BookingTicket/utils/exampleData.js +0 -183
  241. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  242. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -438
  243. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  244. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -399
  245. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  246. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -56
  247. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  248. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +0 -150
  249. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  250. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +0 -78
  251. package/lib/modules/BookingContext/index.d.ts +0 -48
  252. package/lib/modules/BookingContext/index.js +0 -368
  253. package/lib/modules/BookingContext/types.d.ts +0 -102
  254. package/lib/modules/BookingContext/types.js +0 -34
  255. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  256. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -276
  257. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  258. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -151
  259. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
  260. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -201
  261. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  262. package/lib/modules/BookingContext/utils/flexible.js +0 -80
  263. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  264. package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
  265. package/lib/modules/BookingContext/utils/index.d.ts +0 -11
  266. package/lib/modules/BookingContext/utils/index.js +0 -43
  267. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  268. package/lib/modules/BookingContext/utils/noResource.js +0 -90
  269. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
  270. package/lib/modules/BookingContext/utils/orderLineDisplay.js +0 -56
  271. package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
  272. package/lib/modules/BookingContext/utils/productExtend.js +0 -283
  273. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  274. package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
  275. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  276. package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
  277. package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
  278. package/lib/modules/BookingContext/utils/resources.js +0 -377
  279. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  280. package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
  281. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  282. package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
  283. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  284. package/lib/modules/Order/utils/manualProductDiscount.js +0 -206
  285. package/lib/modules/SurchargeList/index.d.ts +0 -16
  286. package/lib/modules/SurchargeList/index.js +0 -89
  287. package/lib/modules/SurchargeList/types.d.ts +0 -11
  288. package/lib/modules/SurchargeList/types.js +0 -17
  289. package/lib/server/modules/payment/index.d.ts +0 -28
  290. package/lib/server/modules/payment/index.js +0 -192
  291. package/lib/server/modules/payment/types.d.ts +0 -9
  292. package/lib/server/modules/payment/types.js +0 -17
  293. package/lib/server/test.json +0 -713
  294. package/lib/server/utils/small-ticket.d.ts +0 -71
  295. package/lib/server/utils/small-ticket.js +0 -781
  296. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
  297. package/lib/solution/BaseSales/utils/cartPromotion.js +0 -992
  298. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  299. package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
  300. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
  301. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
  302. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
  303. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +0 -125
  304. package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
  305. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  306. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
  307. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -254
  308. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
  309. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -168
  310. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
  311. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -51
  312. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
  313. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +0 -127
  314. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
  315. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +0 -85
@@ -222,22 +222,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
222
222
  return item.type === type || item.tag === type;
223
223
  });
224
224
  }
225
-
226
- /** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
227
- }, {
228
- key: "excludeDiscountListByType",
229
- value: function excludeDiscountListByType(discountList, type) {
230
- return (discountList || []).filter(function (item) {
231
- return item.type !== type && item.tag !== type;
232
- });
233
- }
234
-
235
- /** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
236
- }, {
237
- key: "resolveDiscountListForManualOverride",
238
- value: function resolveDiscountListForManualOverride(discountList) {
239
- return this.excludeDiscountListByType(discountList, 'promotion');
240
- }
241
225
  // 获取券不可用的原因
242
226
  }, {
243
227
  key: "getUnavailableReason",
@@ -314,8 +298,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
314
298
  }, {
315
299
  key: "calcDiscount",
316
300
  value: function calcDiscount(_ref2, options) {
317
- var _options$selectedList,
318
- _this3 = this;
301
+ var _this3 = this;
319
302
  var discountList = _ref2.discountList,
320
303
  productList = _ref2.productList,
321
304
  holders = _ref2.holders,
@@ -361,13 +344,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
361
344
  var filteredDiscountList = addModeDiscount.filter(function (discount) {
362
345
  return !discount.isManualSelect;
363
346
  });
364
- var hasDiscountInput = editModeDiscount.length > 0 || addModeDiscount.length > 0 || Boolean(options === null || options === void 0 ? void 0 : options.discountId) || Boolean(options === null || options === void 0 || (_options$selectedList = options.selectedList) === null || _options$selectedList === void 0 ? void 0 : _options$selectedList.length) || Boolean(options === null || options === void 0 ? void 0 : options.scan);
365
- if (!hasDiscountInput) {
366
- return {
367
- discountList: discountList,
368
- productList: productList
369
- };
370
- }
371
347
 
372
348
  // 🔥 扁平化商品列表:将 bundle 子商品展开为虚拟商品
373
349
  var flattenProductsWithBundle = function flattenProductsWithBundle(productList) {
@@ -784,6 +760,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
784
760
  }
785
761
  }
786
762
  });
763
+ console.log('occupiedItems', occupiedItems, 'orderLevelDiscountApplicableItems', orderLevelDiscountApplicableItems);
787
764
 
788
765
  // 🔥 第三步:识别 order_level 折扣卡并预计算分摊(排除被其他专属折扣卡占用的商品)
789
766
  sortedDiscountList.forEach(function (discount) {
@@ -1000,7 +977,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1000
977
  // 然后再处理应用哪些优惠券,此时只考虑filteredDiscountList中的优惠券
1001
978
  // 🔥 使用扁平化后的列表进行处理
1002
979
  sortedFlattenedList.forEach(function (flatItem, index) {
1003
- var _product10, _originProduct, _originProduct2, _originProduct3, _product$discount_lis2, _product11;
980
+ var _product10, _product$discount_lis2, _product11;
1004
981
  // 获取商品数据
1005
982
  var product, originProduct;
1006
983
  if (flatItem.type === 'main') {
@@ -1024,16 +1001,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1024
1001
  };
1025
1002
  originProduct = flatItem.originProduct;
1026
1003
  }
1027
- var isPersistedProduct = ((_product10 = product) === null || _product10 === void 0 ? void 0 : _product10.booking_id) || ((_originProduct = originProduct) === null || _originProduct === void 0 ? void 0 : _originProduct.order_detail_id) || ((_originProduct2 = originProduct) === null || _originProduct2 === void 0 ? void 0 : _originProduct2.orderDetailId) || ((_originProduct3 = originProduct) === null || _originProduct3 === void 0 ? void 0 : _originProduct3.booking_id);
1028
- var hasExistingWalletDiscount = ((_product$discount_lis2 = product.discount_list) === null || _product$discount_lis2 === void 0 ? void 0 : _product$discount_lis2.length) && ((_product11 = product) === null || _product11 === void 0 || (_product11 = _product11.discount_list) === null || _product11 === void 0 ? void 0 : _product11.every(function (discount) {
1029
- var _discount$id, _discount$discount4;
1030
- var discountIdentity = (_discount$id = discount.id) !== null && _discount$id !== void 0 ? _discount$id : (_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.resource_id;
1031
- var discountType = discount.tag || discount.type;
1032
- return Boolean(discountIdentity && ['good_pass', 'discount_card', 'product_discount_card'].includes(discountType));
1033
- }));
1034
1004
 
1035
- // 已持久化且已有钱包券/折扣卡的商品行跳过,保留后端历史折扣结果。
1036
- if (isPersistedProduct && hasExistingWalletDiscount) {
1005
+ // 已有优惠的商品跳过
1006
+ if ((_product10 = product) !== null && _product10 !== void 0 && _product10.booking_id && (_product$discount_lis2 = product.discount_list) !== null && _product$discount_lis2 !== void 0 && _product$discount_lis2.length && (_product11 = product) !== null && _product11 !== void 0 && (_product11 = _product11.discount_list) !== null && _product11 !== void 0 && _product11.every(function (discount) {
1007
+ return discount.id && ['good_pass', 'discount_card', 'product_discount_card'].includes(discount.tag || discount.type);
1008
+ })) {
1037
1009
  if (flatItem.type === 'main') {
1038
1010
  processedProductsMap.set(product._id, [originProduct]);
1039
1011
  } else {
@@ -1128,14 +1100,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1128
1100
  // 如果是手动折扣,则不适用优惠券
1129
1101
  var isManualDiscount = false;
1130
1102
  if (flatItem.type === 'main') {
1131
- var _product$discount_lis5, _product$discount_lis6, _product12, _product12$every;
1103
+ var _product$discount_lis5, _product12, _product12$every;
1132
1104
  // 主商品:判断自身是否手动折扣
1133
- isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : ((_product$discount_lis5 = product.discount_list) === null || _product$discount_lis5 === void 0 ? void 0 : _product$discount_lis5.some(function (item) {
1134
- return item.type === 'product';
1135
- })) || product.total != product.origin_total && (product.bundle || []).every(function (item) {
1105
+ isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : product.total != product.origin_total && (product.bundle || []).every(function (item) {
1136
1106
  var _ref11;
1137
1107
  return !((_ref11 = item.discount_list || []) !== null && _ref11 !== void 0 && _ref11.length);
1138
- }) && (!((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.length) || ((_product12 = product) === null || _product12 === void 0 || (_product12 = _product12.discount_list) === null || _product12 === void 0 || (_product12$every = _product12.every) === null || _product12$every === void 0 ? void 0 : _product12$every.call(_product12, function (item) {
1108
+ }) && (!((_product$discount_lis5 = product.discount_list) !== null && _product$discount_lis5 !== void 0 && _product$discount_lis5.length) || ((_product12 = product) === null || _product12 === void 0 || (_product12 = _product12.discount_list) === null || _product12 === void 0 || (_product12$every = _product12.every) === null || _product12$every === void 0 ? void 0 : _product12$every.call(_product12, function (item) {
1139
1109
  return item.type === 'product';
1140
1110
  })));
1141
1111
  if (product.inPromotion) {
@@ -1145,13 +1115,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1145
1115
  // bundle子商品:判断父主商品是否手动折扣
1146
1116
  var parentProduct = flatItem.parentProduct;
1147
1117
  if (parentProduct) {
1148
- var _parentProduct$discou, _parentProduct$discou2, _parentProduct$discou3, _parentProduct$discou4;
1149
- isManualDiscount = typeof parentProduct.isManualDiscount === 'boolean' ? parentProduct.isManualDiscount : ((_parentProduct$discou = parentProduct.discount_list) === null || _parentProduct$discou === void 0 ? void 0 : _parentProduct$discou.some(function (item) {
1150
- return item.type === 'product';
1151
- })) || parentProduct.total != parentProduct.origin_total && (parentProduct.bundle || []).every(function (item) {
1118
+ var _parentProduct$discou, _parentProduct$discou2, _parentProduct$discou3;
1119
+ isManualDiscount = typeof parentProduct.isManualDiscount === 'boolean' ? parentProduct.isManualDiscount : parentProduct.total != parentProduct.origin_total && (parentProduct.bundle || []).every(function (item) {
1152
1120
  var _ref12;
1153
1121
  return !((_ref12 = item.discount_list || []) !== null && _ref12 !== void 0 && _ref12.length);
1154
- }) && (!((_parentProduct$discou2 = parentProduct.discount_list) !== null && _parentProduct$discou2 !== void 0 && _parentProduct$discou2.length) || (parentProduct === null || parentProduct === void 0 || (_parentProduct$discou3 = parentProduct.discount_list) === null || _parentProduct$discou3 === void 0 || (_parentProduct$discou4 = _parentProduct$discou3.every) === null || _parentProduct$discou4 === void 0 ? void 0 : _parentProduct$discou4.call(_parentProduct$discou3, function (item) {
1122
+ }) && (!((_parentProduct$discou = parentProduct.discount_list) !== null && _parentProduct$discou !== void 0 && _parentProduct$discou.length) || (parentProduct === null || parentProduct === void 0 || (_parentProduct$discou2 = parentProduct.discount_list) === null || _parentProduct$discou2 === void 0 || (_parentProduct$discou3 = _parentProduct$discou2.every) === null || _parentProduct$discou3 === void 0 ? void 0 : _parentProduct$discou3.call(_parentProduct$discou2, function (item) {
1155
1123
  return item.type === 'product';
1156
1124
  })));
1157
1125
  }
@@ -1159,9 +1127,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1159
1127
 
1160
1128
  // 勾选时覆盖手动折扣
1161
1129
  if (options !== null && options !== void 0 && options.discountId) {
1162
- var _product$discount_lis7;
1130
+ var _product$discount_lis6;
1163
1131
  // 主商品:检查自己的 discount_list
1164
- if (flatItem.type === 'main' && (_product$discount_lis7 = product.discount_list) !== null && _product$discount_lis7 !== void 0 && _product$discount_lis7.some(function (item) {
1132
+ if (flatItem.type === 'main' && (_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.some(function (item) {
1165
1133
  var _item$discount;
1166
1134
  return ((_item$discount = item.discount) === null || _item$discount === void 0 ? void 0 : _item$discount.resource_id) === options.discountId;
1167
1135
  })) {
@@ -1169,8 +1137,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1169
1137
  }
1170
1138
  // bundle子商品:检查自己的 discount_list 或父主商品的 discount_list
1171
1139
  if (flatItem.type === 'bundle') {
1172
- var _product$discount_lis8, _flatItem$parentProdu7;
1173
- if ((_product$discount_lis8 = product.discount_list) !== null && _product$discount_lis8 !== void 0 && _product$discount_lis8.some(function (item) {
1140
+ var _product$discount_lis7, _flatItem$parentProdu7;
1141
+ if ((_product$discount_lis7 = product.discount_list) !== null && _product$discount_lis7 !== void 0 && _product$discount_lis7.some(function (item) {
1174
1142
  var _item$discount2;
1175
1143
  return ((_item$discount2 = item.discount) === null || _item$discount2 === void 0 ? void 0 : _item$discount2.resource_id) === options.discountId;
1176
1144
  }) || (_flatItem$parentProdu7 = flatItem.parentProduct) !== null && _flatItem$parentProdu7 !== void 0 && (_flatItem$parentProdu7 = _flatItem$parentProdu7.discount_list) !== null && _flatItem$parentProdu7 !== void 0 && _flatItem$parentProdu7.some(function (item) {
@@ -1182,11 +1150,11 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1182
1150
  }
1183
1151
  }
1184
1152
  if (options !== null && options !== void 0 && options.selectedList) {
1185
- var _product$discount_lis9;
1153
+ var _product$discount_lis8;
1186
1154
  // 主商品:检查自己的 discount_list
1187
- if (flatItem.type === 'main' && (_product$discount_lis9 = product.discount_list) !== null && _product$discount_lis9 !== void 0 && _product$discount_lis9.some(function (item) {
1188
- var _options$selectedList2;
1189
- return options === null || options === void 0 || (_options$selectedList2 = options.selectedList) === null || _options$selectedList2 === void 0 ? void 0 : _options$selectedList2.some(function (n) {
1155
+ if (flatItem.type === 'main' && (_product$discount_lis8 = product.discount_list) !== null && _product$discount_lis8 !== void 0 && _product$discount_lis8.some(function (item) {
1156
+ var _options$selectedList;
1157
+ return options === null || options === void 0 || (_options$selectedList = options.selectedList) === null || _options$selectedList === void 0 ? void 0 : _options$selectedList.some(function (n) {
1190
1158
  var _item$discount4;
1191
1159
  return n.discountId === ((_item$discount4 = item.discount) === null || _item$discount4 === void 0 ? void 0 : _item$discount4.resource_id);
1192
1160
  });
@@ -1195,16 +1163,16 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1195
1163
  }
1196
1164
  // bundle子商品:检查自己的 discount_list 或父主商品的 discount_list
1197
1165
  if (flatItem.type === 'bundle') {
1198
- var _product$discount_lis10, _flatItem$parentProdu8;
1199
- if ((_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.some(function (item) {
1200
- var _options$selectedList3;
1201
- return options === null || options === void 0 || (_options$selectedList3 = options.selectedList) === null || _options$selectedList3 === void 0 ? void 0 : _options$selectedList3.some(function (n) {
1166
+ var _product$discount_lis9, _flatItem$parentProdu8;
1167
+ if ((_product$discount_lis9 = product.discount_list) !== null && _product$discount_lis9 !== void 0 && _product$discount_lis9.some(function (item) {
1168
+ var _options$selectedList2;
1169
+ return options === null || options === void 0 || (_options$selectedList2 = options.selectedList) === null || _options$selectedList2 === void 0 ? void 0 : _options$selectedList2.some(function (n) {
1202
1170
  var _item$discount5;
1203
1171
  return n.discountId === ((_item$discount5 = item.discount) === null || _item$discount5 === void 0 ? void 0 : _item$discount5.resource_id);
1204
1172
  });
1205
1173
  }) || (_flatItem$parentProdu8 = flatItem.parentProduct) !== null && _flatItem$parentProdu8 !== void 0 && (_flatItem$parentProdu8 = _flatItem$parentProdu8.discount_list) !== null && _flatItem$parentProdu8 !== void 0 && _flatItem$parentProdu8.some(function (item) {
1206
- var _options$selectedList4;
1207
- return options === null || options === void 0 || (_options$selectedList4 = options.selectedList) === null || _options$selectedList4 === void 0 ? void 0 : _options$selectedList4.some(function (n) {
1174
+ var _options$selectedList3;
1175
+ return options === null || options === void 0 || (_options$selectedList3 = options.selectedList) === null || _options$selectedList3 === void 0 ? void 0 : _options$selectedList3.some(function (n) {
1208
1176
  var _item$discount6;
1209
1177
  return n.discountId === ((_item$discount6 = item.discount) === null || _item$discount6 === void 0 ? void 0 : _item$discount6.resource_id);
1210
1178
  });
@@ -1240,7 +1208,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1240
1208
  price: product.price,
1241
1209
  options: restoredOptions
1242
1210
  }), {}, {
1243
- discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(product.discount_list) : _this3.filterDiscountListByType(product.discount_list, 'promotion')
1211
+ discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
1244
1212
  }))]);
1245
1213
  } else {
1246
1214
  var _ref13, _product$_promotion$f, _product13, _product$origin_total;
@@ -1263,14 +1231,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1263
1231
  main_product_selling_price: main_product_selling_price,
1264
1232
  options: restoredOptions
1265
1233
  }), {}, {
1266
- discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(product.discount_list) : _this3.filterDiscountListByType(product.discount_list, 'promotion')
1234
+ discount_list: _this3.filterDiscountListByType(product.discount_list, 'promotion')
1267
1235
  }))]);
1268
1236
  }
1269
1237
  } else {
1270
- var _flatItem$bundleItem8, _flatItem$bundleItem9;
1238
+ var _flatItem$bundleItem8;
1271
1239
  // bundle子商品:保存到扁平化Map
1272
1240
  processedFlatItemsMap.set(flatItem._id, [_objectSpread(_objectSpread({}, flatItem), {}, {
1273
- discount_list: isManualDiscount ? _this3.resolveDiscountListForManualOverride(((_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.discount_list) || []) : _this3.filterDiscountListByType(((_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.discount_list) || [], 'promotion'),
1241
+ discount_list: _this3.filterDiscountListByType(((_flatItem$bundleItem8 = flatItem.bundleItem) === null || _flatItem$bundleItem8 === void 0 ? void 0 : _flatItem$bundleItem8.discount_list) || [], 'promotion'),
1274
1242
  price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
1275
1243
  processed: true
1276
1244
  })]);
@@ -1318,7 +1286,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1318
1286
  }));
1319
1287
  }
1320
1288
  for (var i = 0; i < splitCount; i++) {
1321
- var _originProduct4, _selectedDiscount$con, _product$options, _product$options2, _selectedDiscount$met, _selectedDiscount$met2;
1289
+ var _originProduct, _selectedDiscount$con, _product$options, _product$options2, _selectedDiscount$met, _selectedDiscount$met2;
1322
1290
  // 如果用过折扣卡,也就不存在拆分的情况了,这里直接使用上面计算出来的折扣卡
1323
1291
  var _selectedDiscount = selectedDiscountCard || applicableDiscounts[i];
1324
1292
  // 标记优惠券为已使用
@@ -1339,7 +1307,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1339
1307
  productOriginTotal = product.origin_total;
1340
1308
  }
1341
1309
  // 如果originProduct?._productInit?.original_price为 0,product.origin_total可能为空,此时取 product.total
1342
- if (Number(((_originProduct4 = originProduct) === null || _originProduct4 === void 0 || (_originProduct4 = _originProduct4._productInit) === null || _originProduct4 === void 0 ? void 0 : _originProduct4.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
1310
+ if (Number(((_originProduct = originProduct) === null || _originProduct === void 0 || (_originProduct = _originProduct._productInit) === null || _originProduct === void 0 ? void 0 : _originProduct.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
1343
1311
  productOriginTotal = product.total;
1344
1312
  }
1345
1313
 
@@ -1879,7 +1847,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1879
1847
  } else {
1880
1848
  // 🔥 没有子商品被拆分,使用原有逻辑
1881
1849
  mainProductArr.forEach(function (mainProduct) {
1882
- var _ref15, _mainProductData$main, _mainProductData$disc, _mainProductData$disc2, _mainProductData$disc3;
1850
+ var _mainProductData$disc, _mainProductData$disc2, _mainProductData$disc3;
1883
1851
  var mainProductData = _this3.hooks.getProduct(mainProduct);
1884
1852
 
1885
1853
  // 重组bundle
@@ -1894,9 +1862,6 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1894
1862
  } else {
1895
1863
  // 🔥 关键:拆分后的bundle item
1896
1864
  processedBundleItems.forEach(function (item) {
1897
- var _item$price, _ref14, _item$bundle_selling_;
1898
- var nextBundlePrice = (_item$price = item.price) !== null && _item$price !== void 0 ? _item$price : bundleItem.price;
1899
- var nextBundleSellingPrice = (_ref14 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref14 !== void 0 ? _ref14 : bundleItem.bundle_selling_price;
1900
1865
  // 🔥 更新 discount_list 中的 num,使其与拆分后的 item.num 一致
1901
1866
  var updatedDiscountList = (item.discount_list || []).map(function (discount) {
1902
1867
  var _discount$metadata10;
@@ -1911,20 +1876,18 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1911
1876
  newBundle.push(_objectSpread(_objectSpread({}, bundleItem), {}, {
1912
1877
  _id: item._id,
1913
1878
  product_id: bundleItem.product_id,
1914
- price: nextBundlePrice,
1879
+ price: item.price,
1915
1880
  num: item.num,
1916
1881
  discount_list: updatedDiscountList,
1917
- bundle_selling_price: bundleItem.bundle_selling_price !== undefined ? nextBundleSellingPrice : undefined
1882
+ bundle_selling_price: bundleItem.bundle_selling_price !== undefined ? item.price : undefined
1918
1883
  }));
1919
1884
  });
1920
1885
  }
1921
1886
  });
1922
1887
  }
1923
1888
 
1924
- // 主商品已经在前面的 setProduct 中应用过折扣;这里只替换 bundle
1925
- // 避免把主商品 discount_list 再扣一次。
1926
- var mainSellingPrice = (_ref15 = (_mainProductData$main = mainProductData.main_product_selling_price) !== null && _mainProductData$main !== void 0 ? _mainProductData$main : mainProductData.price) !== null && _ref15 !== void 0 ? _ref15 : 0;
1927
- var newTotal = Number(mainSellingPrice || 0);
1889
+ // 🔥 重新计算主商品的总价(包含bundle
1890
+ var newTotal = Number(mainProductData.price || 0);
1928
1891
  var newOriginTotal = Number(mainProductData.original_price || mainProductData.price || 0);
1929
1892
 
1930
1893
  // 判断是否是手动折扣
@@ -1938,12 +1901,24 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1938
1901
  newTotal = (_mainProductData$tota = mainProductData.total) !== null && _mainProductData$tota !== void 0 ? _mainProductData$tota : newTotal;
1939
1902
  newOriginTotal = (_mainProductData$orig3 = mainProductData.origin_total) !== null && _mainProductData$orig3 !== void 0 ? _mainProductData$orig3 : newOriginTotal;
1940
1903
  } else {
1941
- // 累加 bundle 的折后价格(只累加一次)
1904
+ // 不是手动折扣时,才重新计算
1905
+ var _mainDiscountList = mainProductData.discount_list.filter(function (item) {
1906
+ var _item$metadata5;
1907
+ return !(item !== null && item !== void 0 && (_item$metadata5 = item.metadata) !== null && _item$metadata5 !== void 0 && _item$metadata5.custom_product_bundle_map_id);
1908
+ });
1909
+
1910
+ // 如果主商品本身有折扣,需要重新计算主商品价格
1911
+ if (_mainDiscountList && _mainDiscountList.length > 0) {
1912
+ var _Decimal$minus$toNumb3, _mainProductData$orig4;
1913
+ var _allDiscountAmount2 = getDiscountListAmount(_mainDiscountList);
1914
+ newTotal = (_Decimal$minus$toNumb3 = new Decimal(mainProductData.price || 0).minus(_allDiscountAmount2).toNumber()) !== null && _Decimal$minus$toNumb3 !== void 0 ? _Decimal$minus$toNumb3 : newTotal;
1915
+ newOriginTotal = (_mainProductData$orig4 = mainProductData.origin_total) !== null && _mainProductData$orig4 !== void 0 ? _mainProductData$orig4 : newOriginTotal;
1916
+ }
1917
+
1918
+ // 累加bundle的价格(只累加一次)
1942
1919
  if (newBundle.length > 0) {
1943
1920
  newBundle.forEach(function (item) {
1944
- var _item$bundle_selling_2;
1945
- var bundleSellingPrice = (_item$bundle_selling_2 = item.bundle_selling_price) !== null && _item$bundle_selling_2 !== void 0 ? _item$bundle_selling_2 : item.price;
1946
- newTotal += Number(bundleSellingPrice) * Number(item.num);
1921
+ newTotal += Number(item.price) * Number(item.num);
1947
1922
  });
1948
1923
 
1949
1924
  // 计算原始总价(不考虑折扣)
@@ -2045,6 +2020,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
2045
2020
  appliedProductDetails: []
2046
2021
  });
2047
2022
  });
2023
+ console.log(processedProductList, 'processedProductList');
2048
2024
  return {
2049
2025
  productList: processedProductList,
2050
2026
  discountList: [].concat(editModeDiscount, _toConsumableArray(updatedDiscountList))
@@ -2071,14 +2047,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
2071
2047
  var ruleType = usageRules.type;
2072
2048
  // 套餐适用范围配置
2073
2049
  var packageScope = usageRules === null || usageRules === void 0 ? void 0 : usageRules.package_scope;
2074
- var _ref16 = packageScope || {},
2075
- scopeType = _ref16.type,
2076
- _ref16$exclude_bundle = _ref16.exclude_bundle_product_ids,
2077
- exclude_bundle_product_ids = _ref16$exclude_bundle === void 0 ? [] : _ref16$exclude_bundle,
2078
- _ref16$include_bundle = _ref16.include_bundle_product_ids,
2079
- include_bundle_product_ids = _ref16$include_bundle === void 0 ? [] : _ref16$include_bundle,
2080
- _ref16$filter = _ref16.filter,
2081
- filter = _ref16$filter === void 0 ? 0 : _ref16$filter;
2050
+ var _ref14 = packageScope || {},
2051
+ scopeType = _ref14.type,
2052
+ _ref14$exclude_bundle = _ref14.exclude_bundle_product_ids,
2053
+ exclude_bundle_product_ids = _ref14$exclude_bundle === void 0 ? [] : _ref14$exclude_bundle,
2054
+ _ref14$include_bundle = _ref14.include_bundle_product_ids,
2055
+ include_bundle_product_ids = _ref14$include_bundle === void 0 ? [] : _ref14$include_bundle,
2056
+ _ref14$filter = _ref14.filter,
2057
+ filter = _ref14$filter === void 0 ? 0 : _ref14$filter;
2082
2058
  var isMainProduct = flatItem.type === 'main'; // 单独购买
2083
2059
  var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
2084
2060
 
@@ -2093,10 +2069,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
2093
2069
  return true; // 单独购买时可用
2094
2070
  }
2095
2071
  if (isBundleItem) {
2096
- var _flatItem$bundleItem10, _flatItem$bundleItem11, _flatItem$originProdu, _flatItem$parentProdu10;
2072
+ var _flatItem$bundleItem9, _flatItem$bundleItem10, _flatItem$originProdu, _flatItem$parentProdu10;
2097
2073
  // 套餐中购买时,判断是否为原价
2098
- var priceType = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type;
2099
- var priceTypeExt = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type_ext;
2074
+ var priceType = (_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.price_type;
2075
+ var priceTypeExt = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type_ext;
2100
2076
  // 主商品id
2101
2077
  var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 || (_flatItem$originProdu = _flatItem$originProdu._productOrigin) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.id) || (flatItem === null || flatItem === void 0 || (_flatItem$parentProdu10 = flatItem.parentProduct) === null || _flatItem$parentProdu10 === void 0 ? void 0 : _flatItem$parentProdu10.id) || 0;
2102
2078
  // original_price 对应:
@@ -2163,10 +2139,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
2163
2139
  return false; // 单独购买时不可用
2164
2140
  }
2165
2141
  if (isBundleItem) {
2166
- var _flatItem$bundleItem12, _flatItem$bundleItem13;
2142
+ var _flatItem$bundleItem11, _flatItem$bundleItem12;
2167
2143
  // 套餐中购买时,判断是否为原价
2168
- var _priceType = (_flatItem$bundleItem12 = flatItem.bundleItem) === null || _flatItem$bundleItem12 === void 0 ? void 0 : _flatItem$bundleItem12.price_type;
2169
- var _priceTypeExt = (_flatItem$bundleItem13 = flatItem.bundleItem) === null || _flatItem$bundleItem13 === void 0 ? void 0 : _flatItem$bundleItem13.price_type_ext;
2144
+ var _priceType = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type;
2145
+ var _priceTypeExt = (_flatItem$bundleItem12 = flatItem.bundleItem) === null || _flatItem$bundleItem12 === void 0 ? void 0 : _flatItem$bundleItem12.price_type_ext;
2170
2146
 
2171
2147
  // original_price 对应:
2172
2148
  // 1. price_type: "markup" && price_type_ext: "product_price"
@@ -53,7 +53,6 @@ type ProductDetail = {
53
53
  vouchersApplicable?: boolean;
54
54
  holder_id?: number;
55
55
  startDate?: any;
56
- main_product_selling_price?: number | string;
57
56
  };
58
57
  export interface RulesParamsHooks {
59
58
  getProduct: (product: Record<string, any>) => ProductDetail;
@@ -8,16 +8,8 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
8
8
  private appPlugin;
9
9
  private store;
10
10
  private request;
11
- private surchargeListModuleName;
12
11
  constructor(name?: string, version?: string);
13
12
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
14
- /**
15
- * 更新父级解决方案透传的运行态参数,并在 surcharge 模块名变化时刷新附加费列表。
16
- *
17
- * @example
18
- * await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
19
- */
20
- updateOtherParams(params: Record<string, any>): Promise<void>;
21
13
  getSurchargeList(): Promise<void>;
22
14
  private getAppData;
23
15
  private getTaxConfig;
@@ -51,5 +43,30 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
51
43
  rounding_amount: string;
52
44
  pay_service_charge_amount: string;
53
45
  is_price_include_tax?: number | undefined;
46
+ } | {
47
+ tax_title: string;
48
+ tax_rate: number | undefined;
49
+ product_quantity: number;
50
+ product_original_amount: string;
51
+ product_amount: string;
52
+ product_expect_amount: string;
53
+ product_tax_fee: string;
54
+ shipping_fee: string;
55
+ shipping_tax_fee: string;
56
+ tax_fee: string;
57
+ surcharge_fee: string;
58
+ surcharges: any;
59
+ discount_amount: string;
60
+ deposit_amount: string;
61
+ deposit: import("./types").DepositInfo | undefined;
62
+ expect_amount: string;
63
+ total_amount: string;
64
+ total_refund_amount: string;
65
+ customer_paid_amount: string;
66
+ order_paid_amount: string;
67
+ amount_gap: string;
68
+ rounding_amount: string;
69
+ pay_service_charge_amount: string;
70
+ is_price_include_tax: number;
54
71
  }>;
55
72
  }
@@ -27,8 +27,7 @@ export * from "./types";
27
27
  var salesSummaryDataKeys = {
28
28
  isPriceIncludeTax: 'is_price_include_tax',
29
29
  taxRate: 'tax_rate',
30
- taxTitle: 'tax_title',
31
- taxCountryCode: 'tax_country_code'
30
+ taxTitle: 'tax_title'
32
31
  };
33
32
  export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
34
33
  _inherits(SalesSummaryModule, _BaseModule);
@@ -42,14 +41,13 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
42
41
  _defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
43
42
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
44
43
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
45
- _defineProperty(_assertThisInitialized(_this), "surchargeListModuleName", 'surchargeList');
46
44
  return _this;
47
45
  }
48
46
  _createClass(SalesSummaryModule, [{
49
47
  key: "initialize",
50
48
  value: function () {
51
49
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
52
- var _options$initialState, _options$initialState2, _options$otherParams;
50
+ var _options$initialState, _options$initialState2;
53
51
  return _regeneratorRuntime().wrap(function _callee$(_context) {
54
52
  while (1) switch (_context.prev = _context.next) {
55
53
  case 0:
@@ -59,22 +57,21 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
59
57
  this.request = this.core.getPlugin('request');
60
58
  this.store.surchargeList = ((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList) || [];
61
59
  this.store.summary = ((_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.summary) || createEmptySalesSummary();
62
- this.surchargeListModuleName = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.surchargeListModuleName) || 'surchargeList';
63
60
  if (this.appPlugin) {
64
- _context.next = 9;
61
+ _context.next = 8;
65
62
  break;
66
63
  }
67
64
  throw new Error('SalesSummaryModule 需要 app 插件支持');
68
- case 9:
65
+ case 8:
69
66
  if (this.request) {
70
- _context.next = 11;
67
+ _context.next = 10;
71
68
  break;
72
69
  }
73
70
  throw new Error('SalesSummaryModule 需要 request 插件支持');
74
- case 11:
75
- _context.next = 13;
71
+ case 10:
72
+ _context.next = 12;
76
73
  return this.getSurchargeList();
77
- case 13:
74
+ case 12:
78
75
  case "end":
79
76
  return _context.stop();
80
77
  }
@@ -85,84 +82,37 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
85
82
  }
86
83
  return initialize;
87
84
  }()
88
- /**
89
- * 更新父级解决方案透传的运行态参数,并在 surcharge 模块名变化时刷新附加费列表。
90
- *
91
- * @example
92
- * await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
93
- */
94
- }, {
95
- key: "updateOtherParams",
96
- value: (function () {
97
- var _updateOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
98
- var nextSurchargeListModuleName;
99
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
100
- while (1) switch (_context2.prev = _context2.next) {
101
- case 0:
102
- nextSurchargeListModuleName = (params === null || params === void 0 ? void 0 : params.surchargeListModuleName) || 'surchargeList';
103
- if (!(nextSurchargeListModuleName === this.surchargeListModuleName)) {
104
- _context2.next = 3;
105
- break;
106
- }
107
- return _context2.abrupt("return");
108
- case 3:
109
- this.surchargeListModuleName = nextSurchargeListModuleName;
110
- _context2.next = 6;
111
- return this.getSurchargeList();
112
- case 6:
113
- case "end":
114
- return _context2.stop();
115
- }
116
- }, _callee2, this);
117
- }));
118
- function updateOtherParams(_x3) {
119
- return _updateOtherParams.apply(this, arguments);
120
- }
121
- return updateOtherParams;
122
- }())
123
85
  }, {
124
86
  key: "getSurchargeList",
125
87
  value: function () {
126
- var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
127
- var surchargeListModule, surchargeList;
128
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
129
- while (1) switch (_context3.prev = _context3.next) {
88
+ var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
89
+ var surchargeList;
90
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
91
+ while (1) switch (_context2.prev = _context2.next) {
130
92
  case 0:
131
- _context3.prev = 0;
132
- surchargeListModule = this.core.getModule(this.surchargeListModuleName);
133
- if (!(surchargeListModule !== null && surchargeListModule !== void 0 && surchargeListModule.getSurchargeList)) {
134
- _context3.next = 7;
135
- break;
136
- }
137
- _context3.next = 5;
138
- return surchargeListModule.getSurchargeList();
139
- case 5:
140
- this.store.surchargeList = _context3.sent;
141
- return _context3.abrupt("return");
142
- case 7:
143
- _context3.next = 9;
93
+ _context2.prev = 0;
94
+ _context2.next = 3;
144
95
  return this.request.get('/order/custom-surcharge/available/v2', {
145
- // TODO 真实的渠道
146
96
  channel: 'online-store',
147
97
  is_assemble_product_data: 1,
148
98
  is_assemble_schedule_data: 1,
149
99
  with: ['relationSchedule']
150
100
  });
151
- case 9:
152
- surchargeList = _context3.sent;
101
+ case 3:
102
+ surchargeList = _context2.sent;
153
103
  this.store.surchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
154
- _context3.next = 17;
104
+ _context2.next = 11;
155
105
  break;
156
- case 13:
157
- _context3.prev = 13;
158
- _context3.t0 = _context3["catch"](0);
159
- console.warn('[SalesSummaryModule] 加载附加费配置失败', _context3.t0);
106
+ case 7:
107
+ _context2.prev = 7;
108
+ _context2.t0 = _context2["catch"](0);
109
+ console.warn('[SalesSummaryModule] 加载附加费配置失败', _context2.t0);
160
110
  this.store.surchargeList = [];
161
- case 17:
111
+ case 11:
162
112
  case "end":
163
- return _context3.stop();
113
+ return _context2.stop();
164
114
  }
165
- }, _callee3, this, [[0, 13]]);
115
+ }, _callee2, this, [[0, 7]]);
166
116
  }));
167
117
  function getSurchargeList() {
168
118
  return _getSurchargeList.apply(this, arguments);
@@ -185,25 +135,24 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
185
135
  return {
186
136
  isPriceIncludeTax: this.getAppData(salesSummaryDataKeys.isPriceIncludeTax),
187
137
  taxRate: this.getAppData(salesSummaryDataKeys.taxRate),
188
- taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle),
189
- taxCountryCode: this.getAppData(salesSummaryDataKeys.taxCountryCode)
138
+ taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle)
190
139
  };
191
140
  }
192
141
  }, {
193
142
  key: "getSummary",
194
143
  value: function () {
195
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
196
- var _this$store$surcharge, _ref;
144
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
145
+ var _ref;
197
146
  var _params$products, products, isPriceIncludeTax, taxRate, shopDiscount, taxConfig, summarySchedule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary, summaryWithTaxMeta;
198
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
199
- while (1) switch (_context4.prev = _context4.next) {
147
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
148
+ while (1) switch (_context3.prev = _context3.next) {
200
149
  case 0:
201
150
  _params$products = params.products, products = _params$products === void 0 ? [] : _params$products, isPriceIncludeTax = params.isPriceIncludeTax, taxRate = params.taxRate, shopDiscount = params.shopDiscount;
202
151
  taxConfig = this.getTaxConfig();
203
152
  summarySchedule = this.core.getModule("".concat(this.name.split('_')[0], "_schedule"));
204
- needScheduleIds = (_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 || (_this$store$surcharge = _this$store$surcharge.map(function (item) {
153
+ needScheduleIds = this.store.surchargeList.map(function (item) {
205
154
  return item.available_schedule_ids;
206
- })) === null || _this$store$surcharge === void 0 ? void 0 : _this$store$surcharge.flat();
155
+ }).flat();
207
156
  scheduleList = summarySchedule === null || summarySchedule === void 0 ? void 0 : summarySchedule.getScheduleListByIds(needScheduleIds);
208
157
  scheduleById = {};
209
158
  if (Array.isArray(scheduleList)) {
@@ -233,14 +182,14 @@ export var SalesSummaryModule = /*#__PURE__*/function (_BaseModule) {
233
182
  tax_rate: taxRate !== null && taxRate !== void 0 ? taxRate : taxConfig.taxRate
234
183
  });
235
184
  this.store.summary = summaryWithTaxMeta;
236
- return _context4.abrupt("return", summaryWithTaxMeta);
185
+ return _context3.abrupt("return", summaryWithTaxMeta);
237
186
  case 11:
238
187
  case "end":
239
- return _context4.stop();
188
+ return _context3.stop();
240
189
  }
241
- }, _callee4, this);
190
+ }, _callee3, this);
242
191
  }));
243
- function getSummary(_x4) {
192
+ function getSummary(_x3) {
244
193
  return _getSummary.apply(this, arguments);
245
194
  }
246
195
  return getSummary;