@pisell/pisellos 2.2.244 → 2.2.245

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 (317) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
  2. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  3. package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
  4. package/dist/modules/BookingContext/index.d.ts +48 -0
  5. package/dist/modules/BookingContext/index.js +566 -0
  6. package/dist/modules/BookingContext/types.d.ts +102 -0
  7. package/dist/modules/BookingContext/types.js +51 -0
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  9. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +284 -0
  10. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  11. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +145 -0
  12. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  13. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +218 -0
  14. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  15. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  16. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  17. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  18. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  19. package/dist/modules/BookingContext/utils/index.js +11 -0
  20. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  21. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  22. package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  23. package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
  24. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  25. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  26. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  27. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  28. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  29. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  30. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  31. package/dist/modules/BookingContext/utils/resources.js +486 -0
  32. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  33. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  34. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  35. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  36. package/dist/modules/Cart/utils/cartProduct.js +24 -3
  37. package/dist/modules/Cart/utils/changePrice.js +11 -11
  38. package/dist/modules/Customer/index.d.ts +20 -0
  39. package/dist/modules/Customer/index.js +172 -83
  40. package/dist/modules/Customer/types.d.ts +2 -0
  41. package/dist/modules/Discount/index.d.ts +1 -1
  42. package/dist/modules/Discount/index.js +13 -6
  43. package/dist/modules/Discount/types.d.ts +1 -0
  44. package/dist/modules/OpenData/index.d.ts +8 -0
  45. package/dist/modules/OpenData/index.js +37 -17
  46. package/dist/modules/Order/index.d.ts +275 -19
  47. package/dist/modules/Order/index.js +3493 -809
  48. package/dist/modules/Order/types.d.ts +286 -31
  49. package/dist/modules/Order/types.js +38 -0
  50. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  51. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  52. package/dist/modules/Order/utils.d.ts +147 -5
  53. package/dist/modules/Order/utils.js +750 -104
  54. package/dist/modules/Payment/index.d.ts +10 -13
  55. package/dist/modules/Payment/index.js +467 -837
  56. package/dist/modules/Payment/types.d.ts +2 -0
  57. package/dist/modules/Payment/utils.js +2 -1
  58. package/dist/modules/Payment/walletpass.js +41 -25
  59. package/dist/modules/ProductList/index.d.ts +16 -12
  60. package/dist/modules/ProductList/index.js +133 -59
  61. package/dist/modules/ProductList/types.d.ts +14 -0
  62. package/dist/modules/Quotation/index.d.ts +0 -1
  63. package/dist/modules/Quotation/index.js +25 -22
  64. package/dist/modules/Rules/index.d.ts +4 -0
  65. package/dist/modules/Rules/index.js +97 -70
  66. package/dist/modules/Rules/types.d.ts +1 -0
  67. package/dist/modules/SalesSummary/index.d.ts +8 -25
  68. package/dist/modules/SalesSummary/index.js +86 -35
  69. package/dist/modules/SalesSummary/types.d.ts +4 -1
  70. package/dist/modules/SalesSummary/utils.d.ts +2 -25
  71. package/dist/modules/SalesSummary/utils.js +794 -162
  72. package/dist/modules/Schedule/index.d.ts +7 -0
  73. package/dist/modules/Schedule/index.js +24 -2
  74. package/dist/modules/Summary/index.js +4 -3
  75. package/dist/modules/SurchargeList/index.d.ts +16 -0
  76. package/dist/modules/SurchargeList/index.js +162 -0
  77. package/dist/modules/SurchargeList/types.d.ts +11 -0
  78. package/dist/modules/SurchargeList/types.js +1 -0
  79. package/dist/modules/index.d.ts +2 -0
  80. package/dist/modules/index.js +3 -1
  81. package/dist/plugins/request.d.ts +1 -0
  82. package/dist/server/index.d.ts +204 -1
  83. package/dist/server/index.js +3654 -922
  84. package/dist/server/modules/index.d.ts +2 -0
  85. package/dist/server/modules/index.js +2 -0
  86. package/dist/server/modules/order/index.d.ts +120 -3
  87. package/dist/server/modules/order/index.js +1758 -448
  88. package/dist/server/modules/order/types.d.ts +32 -3
  89. package/dist/server/modules/order/types.js +8 -0
  90. package/dist/server/modules/order/utils/filterBookings.js +26 -3
  91. package/dist/server/modules/order/utils/filterOrders.js +23 -8
  92. package/dist/server/modules/payment/index.d.ts +28 -0
  93. package/dist/server/modules/payment/index.js +305 -0
  94. package/dist/server/modules/payment/types.d.ts +9 -0
  95. package/dist/server/modules/payment/types.js +1 -0
  96. package/dist/server/modules/products/index.d.ts +34 -7
  97. package/dist/server/modules/products/index.js +631 -317
  98. package/dist/server/modules/resource/index.d.ts +2 -0
  99. package/dist/server/modules/resource/index.js +29 -3
  100. package/dist/server/modules/schedule/index.d.ts +4 -4
  101. package/dist/server/modules/schedule/index.js +111 -88
  102. package/dist/server/test.json +713 -0
  103. package/dist/server/utils/small-ticket.d.ts +71 -0
  104. package/dist/server/utils/small-ticket.js +840 -0
  105. package/dist/solution/BaseSales/index.d.ts +133 -10
  106. package/dist/solution/BaseSales/index.js +1950 -447
  107. package/dist/solution/BaseSales/types.d.ts +82 -6
  108. package/dist/solution/BaseSales/types.js +5 -4
  109. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  110. package/dist/solution/BaseSales/utils/cartPromotion.js +1438 -0
  111. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  112. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  113. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  114. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +105 -24
  115. package/dist/solution/BaseSales/utils.d.ts +1 -1
  116. package/dist/solution/BaseSales/utils.js +62 -21
  117. package/dist/solution/BookingByStep/index.d.ts +1 -1
  118. package/dist/solution/BookingTicket/index.d.ts +271 -11
  119. package/dist/solution/BookingTicket/index.js +1777 -242
  120. package/dist/solution/BookingTicket/types.d.ts +118 -1
  121. package/dist/solution/BookingTicket/types.js +41 -2
  122. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  123. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  124. package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  125. package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
  126. package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  127. package/dist/solution/BookingTicket/utils/bookingStatus.js +70 -0
  128. package/dist/solution/BookingTicket/utils/cartView.d.ts +9 -1
  129. package/dist/solution/BookingTicket/utils/cartView.js +94 -7
  130. package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  131. package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
  132. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  133. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
  134. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  135. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
  136. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  137. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
  138. package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  139. package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
  140. package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  141. package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
  142. package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  143. package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
  144. package/dist/solution/Checkout/index.d.ts +1 -0
  145. package/dist/solution/Checkout/index.js +10 -9
  146. package/dist/solution/RegisterAndLogin/config.js +2 -10
  147. package/dist/solution/ScanOrder/index.d.ts +9 -3
  148. package/dist/solution/ScanOrder/index.js +241 -134
  149. package/dist/solution/ScanOrder/types.d.ts +9 -5
  150. package/dist/solution/ScanOrder/types.js +2 -3
  151. package/dist/solution/ScanOrder/utils.d.ts +1 -1
  152. package/dist/solution/ScanOrder/utils.js +84 -22
  153. package/dist/solution/VenueBooking/index.d.ts +5 -2
  154. package/dist/solution/VenueBooking/index.js +110 -59
  155. package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  156. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  157. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  158. package/dist/types/index.d.ts +10 -0
  159. package/lib/model/strategy/adapter/promotion/evaluator.js +2 -1
  160. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  161. package/lib/model/strategy/adapter/walletPass/utils.js +3 -2
  162. package/lib/modules/BookingContext/index.d.ts +48 -0
  163. package/lib/modules/BookingContext/index.js +368 -0
  164. package/lib/modules/BookingContext/types.d.ts +102 -0
  165. package/lib/modules/BookingContext/types.js +34 -0
  166. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  167. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
  168. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  169. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +151 -0
  170. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
  171. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +201 -0
  172. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  173. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  174. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  175. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  176. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  177. package/lib/modules/BookingContext/utils/index.js +43 -0
  178. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  179. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  180. package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
  181. package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
  182. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  183. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  184. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  185. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  186. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  187. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  188. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  189. package/lib/modules/BookingContext/utils/resources.js +377 -0
  190. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  191. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  192. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  193. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  194. package/lib/modules/Cart/utils/cartProduct.js +20 -3
  195. package/lib/modules/Cart/utils/changePrice.js +12 -20
  196. package/lib/modules/Customer/index.d.ts +20 -0
  197. package/lib/modules/Customer/index.js +64 -11
  198. package/lib/modules/Customer/types.d.ts +2 -0
  199. package/lib/modules/Discount/index.d.ts +1 -1
  200. package/lib/modules/Discount/index.js +9 -1
  201. package/lib/modules/Discount/types.d.ts +1 -0
  202. package/lib/modules/OpenData/index.d.ts +8 -0
  203. package/lib/modules/OpenData/index.js +19 -5
  204. package/lib/modules/Order/index.d.ts +275 -19
  205. package/lib/modules/Order/index.js +2245 -336
  206. package/lib/modules/Order/types.d.ts +286 -31
  207. package/lib/modules/Order/types.js +1 -0
  208. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  209. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  210. package/lib/modules/Order/utils.d.ts +147 -5
  211. package/lib/modules/Order/utils.js +615 -46
  212. package/lib/modules/Payment/index.d.ts +10 -13
  213. package/lib/modules/Payment/index.js +18 -150
  214. package/lib/modules/Payment/types.d.ts +2 -0
  215. package/lib/modules/Payment/utils.js +2 -1
  216. package/lib/modules/Payment/walletpass.js +16 -3
  217. package/lib/modules/ProductList/index.d.ts +16 -12
  218. package/lib/modules/ProductList/index.js +41 -4
  219. package/lib/modules/ProductList/types.d.ts +14 -0
  220. package/lib/modules/Quotation/index.d.ts +0 -1
  221. package/lib/modules/Quotation/index.js +19 -16
  222. package/lib/modules/Rules/index.d.ts +4 -0
  223. package/lib/modules/Rules/index.js +137 -120
  224. package/lib/modules/Rules/types.d.ts +1 -0
  225. package/lib/modules/SalesSummary/index.d.ts +8 -25
  226. package/lib/modules/SalesSummary/index.js +30 -4
  227. package/lib/modules/SalesSummary/types.d.ts +4 -1
  228. package/lib/modules/SalesSummary/utils.d.ts +2 -25
  229. package/lib/modules/SalesSummary/utils.js +645 -91
  230. package/lib/modules/Schedule/index.d.ts +7 -0
  231. package/lib/modules/Schedule/index.js +17 -1
  232. package/lib/modules/Summary/index.js +5 -4
  233. package/lib/modules/SurchargeList/index.d.ts +16 -0
  234. package/lib/modules/SurchargeList/index.js +89 -0
  235. package/lib/modules/SurchargeList/types.d.ts +11 -0
  236. package/lib/modules/SurchargeList/types.js +17 -0
  237. package/lib/modules/index.d.ts +2 -0
  238. package/lib/modules/index.js +5 -1
  239. package/lib/plugins/request.d.ts +1 -0
  240. package/lib/server/index.d.ts +204 -1
  241. package/lib/server/index.js +1891 -59
  242. package/lib/server/modules/index.d.ts +2 -0
  243. package/lib/server/modules/index.js +3 -0
  244. package/lib/server/modules/order/index.d.ts +120 -3
  245. package/lib/server/modules/order/index.js +883 -94
  246. package/lib/server/modules/order/types.d.ts +32 -3
  247. package/lib/server/modules/order/utils/filterBookings.js +24 -5
  248. package/lib/server/modules/order/utils/filterOrders.js +15 -6
  249. package/lib/server/modules/payment/index.d.ts +28 -0
  250. package/lib/server/modules/payment/index.js +192 -0
  251. package/lib/server/modules/payment/types.d.ts +9 -0
  252. package/lib/server/modules/payment/types.js +17 -0
  253. package/lib/server/modules/products/index.d.ts +34 -7
  254. package/lib/server/modules/products/index.js +189 -54
  255. package/lib/server/modules/resource/index.d.ts +2 -0
  256. package/lib/server/modules/resource/index.js +27 -3
  257. package/lib/server/modules/schedule/index.d.ts +4 -4
  258. package/lib/server/modules/schedule/index.js +47 -40
  259. package/lib/server/test.json +713 -0
  260. package/lib/server/utils/small-ticket.d.ts +71 -0
  261. package/lib/server/utils/small-ticket.js +800 -0
  262. package/lib/solution/BaseSales/index.d.ts +133 -10
  263. package/lib/solution/BaseSales/index.js +1111 -63
  264. package/lib/solution/BaseSales/types.d.ts +82 -6
  265. package/lib/solution/BaseSales/types.js +3 -1
  266. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
  267. package/lib/solution/BaseSales/utils/cartPromotion.js +992 -0
  268. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  269. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  270. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  271. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +106 -18
  272. package/lib/solution/BaseSales/utils.d.ts +1 -1
  273. package/lib/solution/BaseSales/utils.js +54 -10
  274. package/lib/solution/BookingByStep/index.d.ts +1 -1
  275. package/lib/solution/BookingTicket/index.d.ts +271 -11
  276. package/lib/solution/BookingTicket/index.js +922 -29
  277. package/lib/solution/BookingTicket/types.d.ts +118 -1
  278. package/lib/solution/BookingTicket/types.js +11 -0
  279. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
  280. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  281. package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
  282. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
  283. package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +40 -0
  284. package/lib/solution/BookingTicket/utils/bookingStatus.js +44 -2
  285. package/lib/solution/BookingTicket/utils/cartView.d.ts +9 -1
  286. package/lib/solution/BookingTicket/utils/cartView.js +61 -6
  287. package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
  288. package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
  289. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
  290. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
  291. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
  292. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
  293. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
  294. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
  295. package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
  296. package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
  297. package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
  298. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
  299. package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
  300. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
  301. package/lib/solution/Checkout/index.d.ts +1 -0
  302. package/lib/solution/Checkout/index.js +1 -2
  303. package/lib/solution/RegisterAndLogin/config.js +2 -10
  304. package/lib/solution/ScanOrder/index.d.ts +9 -3
  305. package/lib/solution/ScanOrder/index.js +153 -70
  306. package/lib/solution/ScanOrder/types.d.ts +9 -5
  307. package/lib/solution/ScanOrder/utils.d.ts +1 -1
  308. package/lib/solution/ScanOrder/utils.js +83 -17
  309. package/lib/solution/VenueBooking/index.d.ts +5 -2
  310. package/lib/solution/VenueBooking/index.js +54 -17
  311. package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
  312. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  313. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  314. package/lib/types/index.d.ts +10 -0
  315. package/package.json +1 -1
  316. package/dist/solution/Checkout/appointmentDemo.json +0 -1
  317. package/lib/solution/Checkout/appointmentDemo.json +0 -1
@@ -60,6 +60,30 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
60
60
  return _this;
61
61
  }
62
62
  _createClass(CustomerModule, [{
63
+ key: "isSameSelectedCustomer",
64
+ value:
65
+ /**
66
+ * 判断两份选中客户的核心展示字段是否一致,用于避免重复 clone / emit。
67
+ *
68
+ * @example
69
+ * this.isSameSelectedCustomer(currentCustomer, nextCustomer);
70
+ */
71
+ function isSameSelectedCustomer(current, next) {
72
+ var _id, _id2;
73
+ var normalizedNext = !next ? DEFAULT_CUSTOMER : next;
74
+ var normalizedCurrent = current || null;
75
+ if (!normalizedCurrent) return false;
76
+ // Walk-In 是默认客户,展示文案 / 默认区号可能来自不同入口;同为 id=1 时视为同一客户。
77
+ if (String((_id = normalizedCurrent === null || normalizedCurrent === void 0 ? void 0 : normalizedCurrent.id) !== null && _id !== void 0 ? _id : '') === '1' && String((_id2 = normalizedNext === null || normalizedNext === void 0 ? void 0 : normalizedNext.id) !== null && _id2 !== void 0 ? _id2 : '') === '1') {
78
+ return true;
79
+ }
80
+ var keys = ['id', 'name', 'phone', 'email', 'country_calling_code'];
81
+ return keys.every(function (key) {
82
+ var _key, _key2;
83
+ return String((_key = normalizedCurrent === null || normalizedCurrent === void 0 ? void 0 : normalizedCurrent[key]) !== null && _key !== void 0 ? _key : '') === String((_key2 = normalizedNext === null || normalizedNext === void 0 ? void 0 : normalizedNext[key]) !== null && _key2 !== void 0 ? _key2 : '');
84
+ });
85
+ }
86
+ }, {
63
87
  key: "initialize",
64
88
  value: function () {
65
89
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
@@ -95,7 +119,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
95
119
  } else {
96
120
  this.store.currentPage = 1;
97
121
  }
98
- if (typeof (options === null || options === void 0 || (_options$initialState5 = options.initialState) === null || _options$initialState5 === void 0 ? void 0 : _options$initialState5.pageSize) === 'number') {
122
+ if (typeof (options === null || options === void 0 || (_options$initialState5 = options.initialState) === null || _options$initialState5 === void 0 ? void 0 : _options$initialState5.pageSize) === 'number' && options.initialState.pageSize > 1) {
99
123
  this.store.pageSize = options.initialState.pageSize;
100
124
  } else {
101
125
  this.store.pageSize = DEFAULT_PAGE_SIZE;
@@ -125,6 +149,22 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
125
149
  }
126
150
  return initialize;
127
151
  }()
152
+ /**
153
+ * 更新父级解决方案透传的运行态参数,并刷新客户模块缓存配置。
154
+ *
155
+ * @example
156
+ * customerModule.updateOtherParams({ isFranchisee: true, cacheId: 'cache-2' });
157
+ */
158
+ }, {
159
+ key: "updateOtherParams",
160
+ value: function updateOtherParams(params) {
161
+ var _this$otherParams$ope;
162
+ this.otherParams = params || {};
163
+ this.openCache = (_this$otherParams$ope = this.otherParams.openCache) !== null && _this$otherParams$ope !== void 0 ? _this$otherParams$ope : false;
164
+ this.cacheId = this.otherParams.cacheId;
165
+ this.fatherModule = this.otherParams.fatherModule;
166
+ }
167
+
128
168
  /**
129
169
  * 获取客户列表数据(内部方法)
130
170
  * @param params 查询参数
@@ -236,6 +276,52 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
236
276
  }
237
277
  return handleCustomerListError;
238
278
  }()
279
+ /**
280
+ * 查询客户列表但不写入 customerList / pagination 状态。
281
+ *
282
+ * 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
283
+ */
284
+ )
285
+ }, {
286
+ key: "queryCustomerList",
287
+ value: (function () {
288
+ var _queryCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
289
+ var params,
290
+ _yield$this$fetchCust,
291
+ customerList,
292
+ total,
293
+ page,
294
+ pageSize,
295
+ _args4 = arguments;
296
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
297
+ while (1) switch (_context4.prev = _context4.next) {
298
+ case 0:
299
+ params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
300
+ _context4.next = 3;
301
+ return this.fetchCustomerListData(params);
302
+ case 3:
303
+ _yield$this$fetchCust = _context4.sent;
304
+ customerList = _yield$this$fetchCust.customerList;
305
+ total = _yield$this$fetchCust.total;
306
+ page = _yield$this$fetchCust.page;
307
+ pageSize = _yield$this$fetchCust.pageSize;
308
+ return _context4.abrupt("return", {
309
+ list: customerList,
310
+ total: total,
311
+ page: page,
312
+ pageSize: pageSize
313
+ });
314
+ case 9:
315
+ case "end":
316
+ return _context4.stop();
317
+ }
318
+ }, _callee4, this);
319
+ }));
320
+ function queryCustomerList() {
321
+ return _queryCustomerList.apply(this, arguments);
322
+ }
323
+ return queryCustomerList;
324
+ }()
239
325
  /**
240
326
  * 获取客户列表
241
327
  * @param params 查询参数
@@ -245,9 +331,9 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
245
331
  }, {
246
332
  key: "getCustomerList",
247
333
  value: (function () {
248
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
334
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
249
335
  var params,
250
- _yield$this$fetchCust,
336
+ _yield$this$fetchCust2,
251
337
  customerList,
252
338
  total,
253
339
  page,
@@ -256,22 +342,22 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
256
342
  num,
257
343
  searchParams,
258
344
  response,
259
- _args4 = arguments;
260
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
261
- while (1) switch (_context4.prev = _context4.next) {
345
+ _args5 = arguments;
346
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
347
+ while (1) switch (_context5.prev = _context5.next) {
262
348
  case 0:
263
- params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
264
- _context4.prev = 1;
349
+ params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
350
+ _context5.prev = 1;
265
351
  this.store.loading = true;
266
352
  this.store.error = null;
267
- _context4.next = 6;
353
+ _context5.next = 6;
268
354
  return this.fetchCustomerListData(params);
269
355
  case 6:
270
- _yield$this$fetchCust = _context4.sent;
271
- customerList = _yield$this$fetchCust.customerList;
272
- total = _yield$this$fetchCust.total;
273
- page = _yield$this$fetchCust.page;
274
- pageSize = _yield$this$fetchCust.pageSize;
356
+ _yield$this$fetchCust2 = _context5.sent;
357
+ customerList = _yield$this$fetchCust2.customerList;
358
+ total = _yield$this$fetchCust2.total;
359
+ page = _yield$this$fetchCust2.page;
360
+ pageSize = _yield$this$fetchCust2.pageSize;
275
361
  // 保存搜索条件(排除skip和num)
276
362
  skip = params.skip, num = params.num, searchParams = _objectWithoutProperties(params, _excluded2);
277
363
  this.store.searchParams = cloneDeep(searchParams);
@@ -286,9 +372,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
286
372
 
287
373
  // 设置客户列表(替换模式)
288
374
  this.store.customerList = cloneDeep(customerList);
289
- _context4.next = 20;
290
- return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
291
- case 20:
375
+
292
376
  // 触发分页变化事件
293
377
  this.triggerPaginationChange({
294
378
  page: page,
@@ -302,24 +386,27 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
302
386
  page: page,
303
387
  pageSize: pageSize
304
388
  };
305
- return _context4.abrupt("return", response);
306
- case 25:
307
- _context4.prev = 25;
308
- _context4.t0 = _context4["catch"](1);
309
- _context4.next = 29;
310
- return this.handleCustomerListError(_context4.t0, 'fetch customer list');
311
- case 29:
312
- throw _context4.t0;
313
- case 30:
314
- _context4.prev = 30;
389
+ return _context5.abrupt("return", response);
390
+ case 23:
391
+ _context5.prev = 23;
392
+ _context5.t0 = _context5["catch"](1);
393
+ _context5.next = 27;
394
+ return this.handleCustomerListError(_context5.t0, 'fetch customer list');
395
+ case 27:
396
+ throw _context5.t0;
397
+ case 28:
398
+ _context5.prev = 28;
315
399
  this.store.loading = false;
316
400
  this.storeChange();
317
- return _context4.finish(30);
401
+ _context5.next = 33;
402
+ return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
403
+ case 33:
404
+ return _context5.finish(28);
318
405
  case 34:
319
406
  case "end":
320
- return _context4.stop();
407
+ return _context5.stop();
321
408
  }
322
- }, _callee4, this, [[1, 25, 30, 34]]);
409
+ }, _callee5, this, [[1, 23, 28, 34]]);
323
410
  }));
324
411
  function getCustomerList() {
325
412
  return _getCustomerList.apply(this, arguments);
@@ -349,6 +436,9 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
349
436
  }, {
350
437
  key: "setSelectedCustomer",
351
438
  value: function setSelectedCustomer(customer) {
439
+ if (this.isSameSelectedCustomer(this.store.selectedCustomer, customer)) {
440
+ return;
441
+ }
352
442
  this.store.selectedCustomer = !customer ? DEFAULT_CUSTOMER : cloneDeep(customer);
353
443
  this.core.effects.emit("".concat(this.name, ":onCustomerSelected"), this.store.selectedCustomer);
354
444
  this.storeChange();
@@ -493,10 +583,10 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
493
583
  }, {
494
584
  key: "changeCustomerPage",
495
585
  value: (function () {
496
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(page, pageSize) {
586
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, pageSize) {
497
587
  var targetPageSize, skip, num;
498
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
499
- while (1) switch (_context5.prev = _context5.next) {
588
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
589
+ while (1) switch (_context6.prev = _context6.next) {
500
590
  case 0:
501
591
  targetPageSize = pageSize || this.store.pageSize; // 先更新分页状态
502
592
  this.setPaginationInfo(page, targetPageSize);
@@ -504,18 +594,18 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
504
594
  // skip直接使用page,num使用pageSize
505
595
  skip = page;
506
596
  num = targetPageSize; // 自动调用获取客户列表,使用存储的搜索条件
507
- _context5.next = 6;
597
+ _context6.next = 6;
508
598
  return this.getCustomerList(_objectSpread({
509
599
  skip: skip,
510
600
  num: num
511
601
  }, this.store.searchParams));
512
602
  case 6:
513
- return _context5.abrupt("return", _context5.sent);
603
+ return _context6.abrupt("return", _context6.sent);
514
604
  case 7:
515
605
  case "end":
516
- return _context5.stop();
606
+ return _context6.stop();
517
607
  }
518
- }, _callee5, this);
608
+ }, _callee6, this);
519
609
  }));
520
610
  function changeCustomerPage(_x5, _x6) {
521
611
  return _changeCustomerPage.apply(this, arguments);
@@ -530,16 +620,16 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
530
620
  }, {
531
621
  key: "loadMoreCustomers",
532
622
  value: (function () {
533
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
534
- var nextPage, _yield$this$fetchCust2, newCustomers, total, page, pageSize, updatedCustomerList, response;
535
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
536
- while (1) switch (_context6.prev = _context6.next) {
623
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
624
+ var nextPage, loadMoreParams, _yield$this$fetchCust3, newCustomers, total, page, pageSize, updatedCustomerList, response;
625
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
626
+ while (1) switch (_context7.prev = _context7.next) {
537
627
  case 0:
538
628
  if (!(!this.store.hasMore || this.store.loadingMore)) {
539
- _context6.next = 2;
629
+ _context7.next = 2;
540
630
  break;
541
631
  }
542
- return _context6.abrupt("return", {
632
+ return _context7.abrupt("return", {
543
633
  list: [],
544
634
  total: this.store.total,
545
635
  page: this.store.currentPage,
@@ -548,22 +638,21 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
548
638
  case 2:
549
639
  // 计算下一页
550
640
  nextPage = this.store.currentPage + 1;
551
- _context6.prev = 3;
641
+ _context7.prev = 3;
552
642
  this.store.loadingMore = true;
553
643
  this.store.error = null;
554
-
555
- // 使用公共方法获取数据,传入存储的搜索条件
556
- _context6.next = 8;
557
- return this.fetchCustomerListData(_objectSpread({
644
+ loadMoreParams = _objectSpread({
558
645
  skip: nextPage,
559
646
  num: this.store.pageSize
560
- }, this.store.searchParams));
561
- case 8:
562
- _yield$this$fetchCust2 = _context6.sent;
563
- newCustomers = _yield$this$fetchCust2.customerList;
564
- total = _yield$this$fetchCust2.total;
565
- page = _yield$this$fetchCust2.page;
566
- pageSize = _yield$this$fetchCust2.pageSize;
647
+ }, this.store.searchParams); // 使用公共方法获取数据,传入存储的搜索条件
648
+ _context7.next = 9;
649
+ return this.fetchCustomerListData(loadMoreParams);
650
+ case 9:
651
+ _yield$this$fetchCust3 = _context7.sent;
652
+ newCustomers = _yield$this$fetchCust3.customerList;
653
+ total = _yield$this$fetchCust3.total;
654
+ page = _yield$this$fetchCust3.page;
655
+ pageSize = _yield$this$fetchCust3.pageSize;
567
656
  // 将新数据追加到现有列表(追加模式)
568
657
  updatedCustomerList = [].concat(_toConsumableArray(this.store.customerList), _toConsumableArray(cloneDeep(newCustomers))); // 更新状态
569
658
  this.store.customerList = updatedCustomerList;
@@ -572,17 +661,14 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
572
661
  this.store.hasMore = page * pageSize < total;
573
662
 
574
663
  // 触发滚动加载特定事件
575
- _context6.next = 20;
664
+ _context7.next = 21;
576
665
  return this.core.effects.emit("".concat(this.name, ":onScrollLoadMore"), {
577
666
  newCustomers: newCustomers,
578
667
  allCustomers: this.store.customerList,
579
668
  currentPage: page,
580
669
  hasMore: this.store.hasMore
581
670
  });
582
- case 20:
583
- _context6.next = 22;
584
- return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
585
- case 22:
671
+ case 21:
586
672
  // 触发分页变化事件
587
673
  this.triggerPaginationChange({
588
674
  page: page,
@@ -597,24 +683,27 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
597
683
  page: page,
598
684
  pageSize: pageSize
599
685
  };
600
- return _context6.abrupt("return", response);
601
- case 27:
602
- _context6.prev = 27;
603
- _context6.t0 = _context6["catch"](3);
604
- _context6.next = 31;
605
- return this.handleCustomerListError(_context6.t0, 'load more customers');
686
+ return _context7.abrupt("return", response);
687
+ case 26:
688
+ _context7.prev = 26;
689
+ _context7.t0 = _context7["catch"](3);
690
+ _context7.next = 30;
691
+ return this.handleCustomerListError(_context7.t0, 'load more customers');
692
+ case 30:
693
+ throw _context7.t0;
606
694
  case 31:
607
- throw _context6.t0;
608
- case 32:
609
- _context6.prev = 32;
695
+ _context7.prev = 31;
610
696
  this.store.loadingMore = false;
611
697
  this.storeChange();
612
- return _context6.finish(32);
698
+ _context7.next = 36;
699
+ return this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), this.store);
613
700
  case 36:
701
+ return _context7.finish(31);
702
+ case 37:
614
703
  case "end":
615
- return _context6.stop();
704
+ return _context7.stop();
616
705
  }
617
- }, _callee6, this, [[3, 27, 32, 36]]);
706
+ }, _callee7, this, [[3, 26, 31, 37]]);
618
707
  }));
619
708
  function loadMoreCustomers() {
620
709
  return _loadMoreCustomers.apply(this, arguments);
@@ -630,15 +719,15 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
630
719
  }, {
631
720
  key: "resetAndLoadCustomers",
632
721
  value: (function () {
633
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
722
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
634
723
  var params,
635
724
  resetParams,
636
725
  response,
637
- _args7 = arguments;
638
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
639
- while (1) switch (_context7.prev = _context7.next) {
726
+ _args8 = arguments;
727
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
728
+ while (1) switch (_context8.prev = _context8.next) {
640
729
  case 0:
641
- params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
730
+ params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
642
731
  // 重置状态
643
732
  this.store.customerList = [];
644
733
  this.store.currentPage = 1;
@@ -650,23 +739,23 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
650
739
  skip: 1,
651
740
  num: params.num || this.store.pageSize
652
741
  }); // 调用普通的获取列表方法
653
- _context7.next = 8;
742
+ _context8.next = 8;
654
743
  return this.getCustomerList(resetParams);
655
744
  case 8:
656
- response = _context7.sent;
657
- _context7.next = 11;
745
+ response = _context8.sent;
746
+ _context8.next = 11;
658
747
  return this.core.effects.emit("".concat(this.name, ":onScrollLoadComplete"), {
659
748
  customers: this.store.customerList,
660
749
  total: this.store.total,
661
750
  hasMore: this.store.hasMore
662
751
  });
663
752
  case 11:
664
- return _context7.abrupt("return", response);
753
+ return _context8.abrupt("return", response);
665
754
  case 12:
666
755
  case "end":
667
- return _context7.stop();
756
+ return _context8.stop();
668
757
  }
669
- }, _callee7, this);
758
+ }, _callee8, this);
670
759
  }));
671
760
  function resetAndLoadCustomers() {
672
761
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -110,6 +110,8 @@ export interface CustomerState {
110
110
  export interface CustomerModuleAPI {
111
111
  /** 获取客户列表 */
112
112
  getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
113
+ /** 查询客户列表但不更新列表分页状态 */
114
+ queryCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
113
115
  /** 设置客户列表 */
114
116
  setCustomerList: (customers: ShopCustomer[], total?: number) => void;
115
117
  /** 设置当前选择的客户 */
@@ -23,7 +23,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
23
23
  customer_id: number;
24
24
  with_wallet_pass_holder: 0 | 1;
25
25
  request_timezone: string;
26
- order_id?: number;
26
+ order_id?: number | string;
27
27
  }): Promise<Discount[]>;
28
28
  batchSearch(code: string, options?: {
29
29
  customerId?: number;
@@ -13,6 +13,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
13
13
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
14
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
15
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
17
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
16
18
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
17
19
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
18
20
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -154,17 +156,21 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
154
156
  value: function () {
155
157
  var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
156
158
  var _prepareConfig$data, _prepareConfig$data2;
157
- var prepareConfig, goodPassList;
159
+ var prepareConfig, rawDiscountList, goodPassList;
158
160
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
159
161
  while (1) switch (_context4.prev = _context4.next) {
160
162
  case 0:
161
- _context4.next = 2;
163
+ if (typeof params.order_id === 'string' && params.order_id.startsWith('LOCAL_')) {
164
+ params.order_id = undefined;
165
+ }
166
+ _context4.next = 3;
162
167
  return this.request.post("/order/prepare/config", params);
163
- case 2:
168
+ case 3:
164
169
  prepareConfig = _context4.sent;
165
- goodPassList = this.filterEnabledDiscountList([].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.discount_card_list) || []))) || []; // this.setDiscountList(goodPassList);
170
+ rawDiscountList = [].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.good_pass_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.discount_card_list) || []));
171
+ goodPassList = this.filterEnabledDiscountList(rawDiscountList) || []; // this.setDiscountList(goodPassList);
166
172
  return _context4.abrupt("return", goodPassList);
167
- case 5:
173
+ case 7:
168
174
  case "end":
169
175
  return _context4.stop();
170
176
  }
@@ -411,7 +417,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
411
417
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
412
418
  case 4:
413
419
  console.log('[Discount] 已销毁');
414
- case 5:
420
+ _get(_getPrototypeOf(DiscountModule.prototype), "destroy", this).call(this);
421
+ case 6:
415
422
  case "end":
416
423
  return _context6.stop();
417
424
  }
@@ -140,6 +140,7 @@ export interface Discount {
140
140
  appliedProductDetails: ApplicableProductDetails[];
141
141
  isDisabledForProductUsed?: boolean;
142
142
  amount?: number;
143
+ customer_id?: number | string | null;
143
144
  extension_data?: ExtensionData[];
144
145
  total_order_behavior_count?: number;
145
146
  today_order_behavior_count?: number;
@@ -9,6 +9,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
9
9
  protected defaultVersion: string;
10
10
  private request;
11
11
  private window;
12
+ private appPlugin;
12
13
  private store;
13
14
  private cacheId;
14
15
  private openCache;
@@ -16,6 +17,13 @@ export declare class OpenDataModule extends BaseModule implements Module {
16
17
  private otherParams;
17
18
  constructor(name?: string, version?: string);
18
19
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
20
+ /**
21
+ * 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
22
+ *
23
+ * @example
24
+ * openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
25
+ */
26
+ updateOtherParams(params: Record<string, any>): void;
19
27
  fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
20
28
  getOpenData(): OpenDataConfig | null;
21
29
  getLastFetchedAt(): number | null;
@@ -30,6 +30,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
30
30
  _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
31
31
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
32
32
  _defineProperty(_assertThisInitialized(_this), "window", void 0);
33
+ _defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
33
34
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
34
35
  _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
35
36
  _defineProperty(_assertThisInitialized(_this), "openCache", false);
@@ -60,20 +61,21 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
60
61
  }
61
62
  this.request = core.getPlugin('request');
62
63
  this.window = core.getPlugin('window');
64
+ this.appPlugin = core.getPlugin('app');
63
65
  if (this.request) {
64
- _context.next = 11;
66
+ _context.next = 12;
65
67
  break;
66
68
  }
67
69
  throw new Error('OpenDataModule 需要 request 插件支持');
68
- case 11:
70
+ case 12:
69
71
  if (this.window) {
70
- _context.next = 13;
72
+ _context.next = 14;
71
73
  break;
72
74
  }
73
75
  throw new Error('OpenDataModule 需要 window 插件支持');
74
- case 13:
75
- console.log('[OpenDataModule] 初始化完成');
76
76
  case 14:
77
+ console.log('[OpenDataModule] 初始化完成');
78
+ case 15:
77
79
  case "end":
78
80
  return _context.stop();
79
81
  }
@@ -84,47 +86,65 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
84
86
  }
85
87
  return initialize;
86
88
  }()
89
+ /**
90
+ * 更新父级解决方案透传的运行态参数,并刷新 OpenData 缓存配置。
91
+ *
92
+ * @example
93
+ * openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
94
+ */
95
+ }, {
96
+ key: "updateOtherParams",
97
+ value: function updateOtherParams(params) {
98
+ var _this$otherParams$ope2;
99
+ this.otherParams = params || {};
100
+ this.openCache = (_this$otherParams$ope2 = this.otherParams.openCache) !== null && _this$otherParams$ope2 !== void 0 ? _this$otherParams$ope2 : false;
101
+ this.cacheId = this.otherParams.cacheId;
102
+ this.fatherModule = this.otherParams.fatherModule;
103
+ }
87
104
  }, {
88
105
  key: "fetchOpenData",
89
106
  value: function () {
90
107
  var _fetchOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
91
- var _this$otherParams, _this$otherParams$get, _this$otherParams2, _this$otherParams2$ge;
92
- var shopId, tenantId, headers, response, data;
108
+ var _this$appPlugin$getDa, _this$appPlugin;
109
+ var getData, shopId, tenantId, headers, response, data;
93
110
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
94
111
  while (1) switch (_context2.prev = _context2.next) {
95
112
  case 0:
96
- shopId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 || (_this$otherParams$get = _this$otherParams.getStateData) === null || _this$otherParams$get === void 0 ? void 0 : _this$otherParams$get.call(_this$otherParams, 'shop_id');
113
+ getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
114
+ shopId = getData === null || getData === void 0 ? void 0 : getData('shop_id');
97
115
  if (shopId) {
98
- _context2.next = 3;
116
+ _context2.next = 4;
99
117
  break;
100
118
  }
101
119
  throw new Error('[OpenDataModule] 无法获取 shop_id');
102
- case 3:
103
- tenantId = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 || (_this$otherParams2$ge = _this$otherParams2.getStateData) === null || _this$otherParams2$ge === void 0 ? void 0 : _this$otherParams2$ge.call(_this$otherParams2, 'tenant_id');
120
+ case 4:
121
+ tenantId = getData === null || getData === void 0 ? void 0 : getData('tenant_id');
104
122
  headers = {};
105
123
  if (tenantId) headers['Tenant-Id'] = String(tenantId);
106
- _context2.next = 8;
124
+ _context2.next = 9;
107
125
  return this.request.post("/open/my-pisell/".concat(shopId, "/setting"), {
108
126
  scope: params.scope,
109
127
  target: params.target,
110
128
  section_code: params.section_code
111
129
  }, {
112
130
  pisell2: true,
131
+ isPisell2: true,
132
+ prefix: false,
113
133
  headers: headers
114
134
  });
115
- case 8:
135
+ case 9:
116
136
  response = _context2.sent;
117
137
  if (!((response === null || response === void 0 ? void 0 : response.status) === false)) {
118
- _context2.next = 11;
138
+ _context2.next = 12;
119
139
  break;
120
140
  }
121
141
  throw new Error((response === null || response === void 0 ? void 0 : response.message) || '获取 OpenData 配置失败');
122
- case 11:
142
+ case 12:
123
143
  data = (response === null || response === void 0 ? void 0 : response.data) || {};
124
144
  this.store.data = data;
125
145
  this.store.lastFetchedAt = Date.now();
126
146
  return _context2.abrupt("return", data);
127
- case 15:
147
+ case 16:
128
148
  case "end":
129
149
  return _context2.stop();
130
150
  }
@@ -150,7 +170,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
150
170
  key: "checkAvailability",
151
171
  value: function checkAvailability(scheduleModule) {
152
172
  var _this$store$data;
153
- var scheduleList = scheduleModule ? scheduleModule.getScheduleListByIds(((_this$store$data = this.store.data) === null || _this$store$data === void 0 ? void 0 : _this$store$data['availability.operating_hours']) || []) : undefined;
173
+ var scheduleList = scheduleModule ? scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(((_this$store$data = this.store.data) === null || _this$store$data === void 0 ? void 0 : _this$store$data['availability.operating_hours']) || []) : undefined;
154
174
  return computeAvailability({
155
175
  config: this.store.data,
156
176
  scheduleList: scheduleList