@pisell/pisellos 0.0.569 → 0.10.2

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 (328) hide show
  1. package/dist/core/index.js +10 -6
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +0 -3
  4. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  5. package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
  6. package/dist/model/strategy/adapter/walletPass/example.js +26 -3
  7. package/dist/model/strategy/adapter/walletPass/index.js +5 -5
  8. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
  9. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
  10. package/dist/model/strategy/adapter/walletPass/utils.js +17 -92
  11. package/dist/model/strategy/strategy-example.js +19 -5
  12. package/dist/modules/BaseModule.d.ts +1 -1
  13. package/dist/modules/BaseModule.js +8 -10
  14. package/dist/modules/Cart/index.js +3 -0
  15. package/dist/modules/Cart/utils/cartProduct.js +1 -0
  16. package/dist/modules/Cart/utils/cartResource.js +0 -2
  17. package/dist/modules/Cart/utils/changePrice.js +9 -16
  18. package/dist/modules/Date/index.js +5 -1
  19. package/dist/modules/Discount/index.d.ts +0 -1
  20. package/dist/modules/Discount/index.js +7 -22
  21. package/dist/modules/Discount/types.d.ts +0 -1
  22. package/dist/modules/OpenData/index.js +2 -0
  23. package/dist/modules/Order/index.js +70 -40
  24. package/dist/modules/Payment/index.js +162 -97
  25. package/dist/modules/Payment/types.d.ts +4 -8
  26. package/dist/modules/Payment/walletpass.d.ts +0 -2
  27. package/dist/modules/Payment/walletpass.js +5 -4
  28. package/dist/modules/ProductList/index.d.ts +1 -1
  29. package/dist/modules/ProductList/index.js +3 -12
  30. package/dist/modules/ProductList/types.d.ts +0 -1
  31. package/dist/modules/Rules/index.js +126 -427
  32. package/dist/modules/SalesSummary/utils.js +1 -2
  33. package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
  34. package/dist/modules/Schedule/index.js +1 -0
  35. package/dist/modules/Schedule/utils.js +1 -0
  36. package/dist/modules/Step/index.js +1 -0
  37. package/dist/modules/Summary/utils.js +22 -43
  38. package/dist/plugins/request.js +4 -1
  39. package/dist/plugins/window.js +6 -2
  40. package/dist/server/index.js +129 -97
  41. package/dist/server/modules/menu/index.js +41 -32
  42. package/dist/server/modules/order/index.js +4 -2
  43. package/dist/server/modules/products/index.js +42 -24
  44. package/dist/server/modules/quotation/index.js +38 -29
  45. package/dist/server/modules/resource/index.js +4 -3
  46. package/dist/server/modules/schedule/index.js +35 -27
  47. package/dist/server/utils/product.js +1 -0
  48. package/dist/solution/BaseSales/index.js +41 -38
  49. package/dist/solution/BookingByStep/index.d.ts +1 -1
  50. package/dist/solution/BookingByStep/index.js +60 -11
  51. package/dist/solution/BookingByStep/utils/capacity.js +11 -1
  52. package/dist/solution/BookingByStep/utils/resources.js +3 -1
  53. package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
  54. package/dist/solution/BookingTicket/index.d.ts +1 -1
  55. package/dist/solution/BookingTicket/index.js +2 -0
  56. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +7 -6
  57. package/dist/solution/BookingTicket/utils/scan/handleScan.js +31 -25
  58. package/dist/solution/BookingTicket/utils/scan/index.js +10 -6
  59. package/dist/solution/BuyTickets/index.js +12 -9
  60. package/dist/solution/Checkout/index.js +252 -177
  61. package/dist/solution/Checkout/utils/index.js +16 -4
  62. package/dist/solution/RegisterAndLogin/index.js +76 -30
  63. package/dist/solution/ScanOrder/index.js +60 -50
  64. package/dist/solution/ShopDiscount/index.js +14 -15
  65. package/dist/solution/ShopDiscount/types.d.ts +4 -5
  66. package/dist/solution/ShopDiscount/utils.d.ts +0 -9
  67. package/dist/solution/ShopDiscount/utils.js +0 -9
  68. package/dist/solution/VenueBooking/index.d.ts +3 -31
  69. package/dist/solution/VenueBooking/index.js +496 -651
  70. package/dist/solution/VenueBooking/types.d.ts +1 -3
  71. package/dist/solution/VenueBooking/types.js +0 -1
  72. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  73. package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
  74. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  75. package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
  76. package/dist/types/index.d.ts +1 -1
  77. package/dist/utils/task.js +18 -15
  78. package/dist/utils/watch.js +1 -0
  79. package/lib/apis/picoding.js +0 -2
  80. package/lib/core/index.js +132 -130
  81. package/lib/effects/index.js +57 -46
  82. package/lib/index.d.ts +0 -1
  83. package/lib/index.js +50 -92
  84. package/lib/model/index.js +21 -14
  85. package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
  86. package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
  87. package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
  88. package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
  89. package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
  90. package/lib/model/strategy/adapter/index.js +64 -100
  91. package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
  92. package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
  93. package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
  94. package/lib/model/strategy/adapter/itemRule/index.js +57 -83
  95. package/lib/model/strategy/adapter/itemRule/type.js +36 -97
  96. package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
  97. package/lib/model/strategy/adapter/promotion/evaluator.js +231 -381
  98. package/lib/model/strategy/adapter/promotion/examples.js +159 -139
  99. package/lib/model/strategy/adapter/promotion/index.js +49 -1
  100. package/lib/model/strategy/adapter/promotion/type.js +35 -199
  101. package/lib/model/strategy/adapter/type.js +16 -4
  102. package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
  103. package/lib/model/strategy/adapter/walletPass/example.js +190 -217
  104. package/lib/model/strategy/adapter/walletPass/index.js +51 -75
  105. package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
  106. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
  107. package/lib/model/strategy/adapter/walletPass/type.js +16 -4
  108. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
  109. package/lib/model/strategy/adapter/walletPass/utils.js +383 -678
  110. package/lib/model/strategy/engine.js +168 -270
  111. package/lib/model/strategy/index.js +34 -49
  112. package/lib/model/strategy/strategy-example.js +239 -243
  113. package/lib/model/strategy/type.js +40 -100
  114. package/lib/modules/Account/index.js +53 -39
  115. package/lib/modules/Account/types.js +33 -20
  116. package/lib/modules/AccountList/index.js +154 -116
  117. package/lib/modules/AccountList/types.js +31 -30
  118. package/lib/modules/AccountList/utils.js +30 -18
  119. package/lib/modules/BaseModule.d.ts +1 -1
  120. package/lib/modules/BaseModule.js +46 -25
  121. package/lib/modules/BookingContext/index.js +136 -158
  122. package/lib/modules/BookingContext/types.js +32 -46
  123. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +143 -131
  124. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +82 -75
  125. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +150 -170
  126. package/lib/modules/BookingContext/utils/flexible.js +55 -38
  127. package/lib/modules/BookingContext/utils/formatResourceList.js +34 -19
  128. package/lib/modules/BookingContext/utils/index.js +41 -124
  129. package/lib/modules/BookingContext/utils/noResource.js +70 -58
  130. package/lib/modules/BookingContext/utils/orderLineDisplay.js +41 -14
  131. package/lib/modules/BookingContext/utils/productExtend.js +155 -202
  132. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  133. package/lib/modules/BookingContext/utils/resourceSelection.js +41 -19
  134. package/lib/modules/BookingContext/utils/resources.js +167 -209
  135. package/lib/modules/BookingContext/utils/serviceTimes.js +116 -115
  136. package/lib/modules/BookingContext/utils/timeSlices.js +80 -70
  137. package/lib/modules/Cart/index.js +124 -170
  138. package/lib/modules/Cart/types.js +51 -46
  139. package/lib/modules/Cart/utils/cartAccount.js +39 -40
  140. package/lib/modules/Cart/utils/cartDate.js +61 -56
  141. package/lib/modules/Cart/utils/cartDiscount.js +33 -28
  142. package/lib/modules/Cart/utils/cartNote.js +32 -27
  143. package/lib/modules/Cart/utils/cartProduct.js +251 -321
  144. package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
  145. package/lib/modules/Cart/utils/cartResource.js +78 -72
  146. package/lib/modules/Cart/utils/changePrice.js +50 -28
  147. package/lib/modules/Cart/utils/index.js +48 -106
  148. package/lib/modules/Customer/constants.js +34 -13
  149. package/lib/modules/Customer/index.js +169 -232
  150. package/lib/modules/Customer/types.js +35 -38
  151. package/lib/modules/Date/index.js +115 -116
  152. package/lib/modules/Date/types.js +28 -16
  153. package/lib/modules/Date/utils.js +123 -174
  154. package/lib/modules/Discount/index.d.ts +0 -1
  155. package/lib/modules/Discount/index.js +128 -130
  156. package/lib/modules/Discount/types.d.ts +0 -1
  157. package/lib/modules/Discount/types.js +31 -9
  158. package/lib/modules/Guests/index.js +56 -30
  159. package/lib/modules/Guests/types.js +33 -23
  160. package/lib/modules/Holder/index.js +189 -209
  161. package/lib/modules/Holder/types.js +16 -4
  162. package/lib/modules/Holder/utils.js +49 -20
  163. package/lib/modules/OpenData/index.js +76 -69
  164. package/lib/modules/OpenData/types.js +16 -4
  165. package/lib/modules/OpenData/utils.js +78 -44
  166. package/lib/modules/Order/index.js +1909 -1572
  167. package/lib/modules/Order/types.js +35 -78
  168. package/lib/modules/Order/utils/bundleDiscountHydration.js +74 -41
  169. package/lib/modules/Order/utils/manualProductDiscount.js +123 -124
  170. package/lib/modules/Order/utils/orderCollectionIdentity.js +210 -148
  171. package/lib/modules/Order/utils.js +634 -799
  172. package/lib/modules/Payment/cash.js +33 -20
  173. package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
  174. package/lib/modules/Payment/eftpos.js +30 -16
  175. package/lib/modules/Payment/index.js +378 -518
  176. package/lib/modules/Payment/mx51.js +0 -1
  177. package/lib/modules/Payment/types.d.ts +4 -8
  178. package/lib/modules/Payment/types.js +107 -216
  179. package/lib/modules/Payment/utils.js +48 -51
  180. package/lib/modules/Payment/walletpass.d.ts +0 -2
  181. package/lib/modules/Payment/walletpass.js +211 -226
  182. package/lib/modules/Product/index.js +46 -51
  183. package/lib/modules/Product/types.js +16 -4
  184. package/lib/modules/Product/utils.js +33 -32
  185. package/lib/modules/ProductList/index.d.ts +1 -1
  186. package/lib/modules/ProductList/index.js +117 -117
  187. package/lib/modules/ProductList/types.d.ts +0 -1
  188. package/lib/modules/ProductList/types.js +31 -9
  189. package/lib/modules/Quotation/index.js +100 -66
  190. package/lib/modules/Quotation/types.js +16 -4
  191. package/lib/modules/Resource/index.js +59 -27
  192. package/lib/modules/Resource/types.js +32 -22
  193. package/lib/modules/Resource/utils.js +38 -30
  194. package/lib/modules/ResourcePlanner/index.js +61 -60
  195. package/lib/modules/ResourcePlanner/planner.js +384 -346
  196. package/lib/modules/ResourcePlanner/types.js +16 -4
  197. package/lib/modules/Rules/index.js +903 -1475
  198. package/lib/modules/Rules/types.js +40 -17
  199. package/lib/modules/SalesSummary/index.js +90 -85
  200. package/lib/modules/SalesSummary/types.js +16 -4
  201. package/lib/modules/SalesSummary/utils.js +427 -351
  202. package/lib/modules/ScanOrderLogger/index.js +79 -59
  203. package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
  204. package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
  205. package/lib/modules/ScanOrderLogger/types.js +16 -4
  206. package/lib/modules/Schedule/getDateIsInSchedule.js +163 -339
  207. package/lib/modules/Schedule/index.js +114 -100
  208. package/lib/modules/Schedule/type.js +16 -4
  209. package/lib/modules/Schedule/types.js +16 -4
  210. package/lib/modules/Schedule/utils.js +291 -433
  211. package/lib/modules/Step/index.js +52 -40
  212. package/lib/modules/Step/tyeps.js +16 -4
  213. package/lib/modules/Summary/index.js +71 -66
  214. package/lib/modules/Summary/types.js +16 -4
  215. package/lib/modules/Summary/utils.js +418 -791
  216. package/lib/modules/SurchargeList/index.js +60 -46
  217. package/lib/modules/SurchargeList/types.js +16 -4
  218. package/lib/modules/index.js +63 -245
  219. package/lib/plugins/app.js +16 -4
  220. package/lib/plugins/index.js +25 -36
  221. package/lib/plugins/request.js +126 -137
  222. package/lib/plugins/shopStore.js +16 -4
  223. package/lib/plugins/user.js +16 -4
  224. package/lib/plugins/window.js +179 -171
  225. package/lib/server/index.js +2337 -2675
  226. package/lib/server/modules/floor-plan/index.js +123 -102
  227. package/lib/server/modules/floor-plan/types.js +30 -15
  228. package/lib/server/modules/index.js +68 -106
  229. package/lib/server/modules/menu/index.js +122 -146
  230. package/lib/server/modules/menu/types.js +31 -18
  231. package/lib/server/modules/order/index.js +642 -567
  232. package/lib/server/modules/order/types.js +32 -117
  233. package/lib/server/modules/order/utils/filterBookings.js +194 -219
  234. package/lib/server/modules/order/utils/filterOrders.js +92 -118
  235. package/lib/server/modules/payment/index.js +83 -59
  236. package/lib/server/modules/payment/types.js +16 -4
  237. package/lib/server/modules/products/index.js +459 -575
  238. package/lib/server/modules/products/types.js +34 -44
  239. package/lib/server/modules/quotation/index.js +172 -137
  240. package/lib/server/modules/quotation/types.js +31 -21
  241. package/lib/server/modules/resource/index.js +184 -213
  242. package/lib/server/modules/resource/types.js +33 -42
  243. package/lib/server/modules/schedule/index.js +123 -135
  244. package/lib/server/modules/schedule/types.js +21 -14
  245. package/lib/server/modules/schedule/utils.js +163 -334
  246. package/lib/server/types.js +16 -4
  247. package/lib/server/utils/index.js +23 -25
  248. package/lib/server/utils/product.js +139 -196
  249. package/lib/server/utils/schedule.js +41 -34
  250. package/lib/server/utils/small-ticket.js +456 -478
  251. package/lib/server/utils/time.js +49 -40
  252. package/lib/solution/BaseSales/index.js +1016 -850
  253. package/lib/solution/BaseSales/types.js +37 -41
  254. package/lib/solution/BaseSales/utils/cartPromotion.js +460 -611
  255. package/lib/solution/BaseSales/utils/parseSalesResponse.js +105 -85
  256. package/lib/solution/BaseSales/utils/quotationPrice.js +114 -56
  257. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +143 -102
  258. package/lib/solution/BaseSales/utils.js +140 -155
  259. package/lib/solution/BookingByStep/index.d.ts +1 -1
  260. package/lib/solution/BookingByStep/index.js +1340 -1530
  261. package/lib/solution/BookingByStep/types.js +99 -40
  262. package/lib/solution/BookingByStep/utils/capacity.js +160 -192
  263. package/lib/solution/BookingByStep/utils/products.js +52 -42
  264. package/lib/solution/BookingByStep/utils/resources.js +330 -527
  265. package/lib/solution/BookingByStep/utils/stock.js +44 -65
  266. package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
  267. package/lib/solution/BookingTicket/index.d.ts +1 -1
  268. package/lib/solution/BookingTicket/index.js +459 -543
  269. package/lib/solution/BookingTicket/types.js +77 -99
  270. package/lib/solution/BookingTicket/utils/addProductDecision.js +184 -219
  271. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +89 -58
  272. package/lib/solution/BookingTicket/utils/bookingStatus.js +78 -107
  273. package/lib/solution/BookingTicket/utils/cartView.js +94 -110
  274. package/lib/solution/BookingTicket/utils/exampleData.js +0 -185
  275. package/lib/solution/BookingTicket/utils/orderCustomer.js +41 -18
  276. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +86 -219
  277. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +93 -144
  278. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +91 -79
  279. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +41 -54
  280. package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -84
  281. package/lib/solution/BookingTicket/utils/scan/index.js +104 -98
  282. package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
  283. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +64 -52
  284. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +58 -56
  285. package/lib/solution/BuyTickets/index.js +70 -67
  286. package/lib/solution/BuyTickets/types.js +38 -22
  287. package/lib/solution/Checkout/index.js +1158 -1451
  288. package/lib/solution/Checkout/types.js +61 -91
  289. package/lib/solution/Checkout/utils/index.js +156 -228
  290. package/lib/solution/PlaceOrder/index.js +0 -55
  291. package/lib/solution/RegisterAndLogin/config.js +460 -493
  292. package/lib/solution/RegisterAndLogin/index.js +630 -633
  293. package/lib/solution/RegisterAndLogin/types.js +76 -189
  294. package/lib/solution/RegisterAndLogin/utils.js +125 -183
  295. package/lib/solution/Sales/index.js +320 -317
  296. package/lib/solution/Sales/types.js +33 -27
  297. package/lib/solution/ScanOrder/index.js +862 -831
  298. package/lib/solution/ScanOrder/types.js +34 -33
  299. package/lib/solution/ScanOrder/utils.js +371 -406
  300. package/lib/solution/ShopDiscount/index.js +233 -235
  301. package/lib/solution/ShopDiscount/types.d.ts +4 -5
  302. package/lib/solution/ShopDiscount/types.js +37 -15
  303. package/lib/solution/ShopDiscount/utils.d.ts +0 -9
  304. package/lib/solution/ShopDiscount/utils.js +172 -309
  305. package/lib/solution/UnifiedBookingSales/index.js +405 -379
  306. package/lib/solution/UnifiedBookingSales/types.js +31 -12
  307. package/lib/solution/VenueBooking/index.d.ts +3 -31
  308. package/lib/solution/VenueBooking/index.js +916 -967
  309. package/lib/solution/VenueBooking/types.d.ts +1 -3
  310. package/lib/solution/VenueBooking/types.js +39 -20
  311. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  312. package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
  313. package/lib/solution/VenueBooking/utils/resource.js +54 -31
  314. package/lib/solution/VenueBooking/utils/slotMerge.js +107 -94
  315. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  316. package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
  317. package/lib/solution/VenueBooking/utils.js +67 -130
  318. package/lib/solution/index.js +41 -124
  319. package/lib/store/createStore.js +29 -32
  320. package/lib/types/index.d.ts +1 -1
  321. package/lib/types/index.js +16 -4
  322. package/lib/utils/task.js +36 -36
  323. package/lib/utils/watch.js +47 -81
  324. package/package.json +2 -4
  325. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  326. package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
  327. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  328. package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
@@ -1,46 +1,53 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- CustomerModule: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
8
  };
9
- exports.CustomerModule = void 0;
10
- var _lodashEs = require("lodash-es");
11
- var _BaseModule = require("../BaseModule");
12
- var _plugins = require("../../plugins");
13
- var _constants = require("./constants");
14
- var _types = require("./types");
15
- Object.keys(_types).forEach(function (key) {
16
- if (key === "default" || key === "__esModule") return;
17
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
18
- if (key in exports && exports[key] === _types[key]) return;
19
- Object.defineProperty(exports, key, {
20
- enumerable: true,
21
- get: function () {
22
- return _types[key];
23
- }
24
- });
25
- });
26
- class CustomerModule extends _BaseModule.BaseModule {
27
- defaultName = 'customer';
28
- defaultVersion = '1.0.0';
29
- store = {
30
- customerList: [],
31
- selectedCustomer: null,
32
- total: 0,
33
- currentPage: 1,
34
- pageSize: _constants.DEFAULT_PAGE_SIZE,
35
- loading: false,
36
- error: null,
37
- hasMore: true,
38
- loadingMore: false,
39
- searchParams: {}
40
- };
41
- request;
42
- cacheId;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
43
19
 
20
+ // src/modules/Customer/index.ts
21
+ var Customer_exports = {};
22
+ __export(Customer_exports, {
23
+ CustomerModule: () => CustomerModule
24
+ });
25
+ module.exports = __toCommonJS(Customer_exports);
26
+ var import_lodash_es = require("lodash-es");
27
+ var import_BaseModule = require("../BaseModule");
28
+ var import_plugins = require("../../plugins");
29
+ var import_constants = require("./constants");
30
+ __reExport(Customer_exports, require("./types"), module.exports);
31
+ var CustomerModule = class extends import_BaseModule.BaseModule {
32
+ constructor(name, version) {
33
+ super(name, version);
34
+ this.defaultName = "customer";
35
+ this.defaultVersion = "1.0.0";
36
+ this.store = {
37
+ customerList: [],
38
+ selectedCustomer: null,
39
+ total: 0,
40
+ currentPage: 1,
41
+ pageSize: import_constants.DEFAULT_PAGE_SIZE,
42
+ loading: false,
43
+ error: null,
44
+ hasMore: true,
45
+ loadingMore: false,
46
+ searchParams: {}
47
+ };
48
+ this.openCache = false;
49
+ this.otherParams = {};
50
+ }
44
51
  /**
45
52
  * 判断两份选中客户的核心展示字段是否一致,用于避免重复 clone / emit。
46
53
  *
@@ -48,71 +55,65 @@ class CustomerModule extends _BaseModule.BaseModule {
48
55
  * this.isSameSelectedCustomer(currentCustomer, nextCustomer);
49
56
  */
50
57
  isSameSelectedCustomer(current, next) {
51
- const normalizedNext = !next ? _constants.DEFAULT_CUSTOMER : next;
58
+ const normalizedNext = !next ? import_constants.DEFAULT_CUSTOMER : next;
52
59
  const normalizedCurrent = current || null;
53
- if (!normalizedCurrent) return false;
54
- // Walk-In 是默认客户,展示文案 / 默认区号可能来自不同入口;同为 id=1 时视为同一客户。
55
- if (String(normalizedCurrent?.id ?? '') === '1' && String(normalizedNext?.id ?? '') === '1') {
60
+ if (!normalizedCurrent)
61
+ return false;
62
+ if (String((normalizedCurrent == null ? void 0 : normalizedCurrent.id) ?? "") === "1" && String((normalizedNext == null ? void 0 : normalizedNext.id) ?? "") === "1") {
56
63
  return true;
57
64
  }
58
- const keys = ['id', 'name', 'phone', 'email', 'country_calling_code'];
59
- return keys.every(key => String(normalizedCurrent?.[key] ?? '') === String(normalizedNext?.[key] ?? ''));
60
- }
61
- openCache = false;
62
- fatherModule;
63
- otherParams = {};
64
- constructor(name, version) {
65
- super(name, version);
65
+ const keys = [
66
+ "id",
67
+ "name",
68
+ "phone",
69
+ "email",
70
+ "country_calling_code"
71
+ ];
72
+ return keys.every((key) => String((normalizedCurrent == null ? void 0 : normalizedCurrent[key]) ?? "") === String((normalizedNext == null ? void 0 : normalizedNext[key]) ?? ""));
66
73
  }
67
74
  async initialize(core, options) {
75
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
68
76
  this.core = core;
69
- this.store = options?.store;
70
- this.request = this.core.getPlugin('request');
71
- this.otherParams = options?.otherParams || {};
72
-
73
- // 初始化状态
74
- if (Array.isArray(options?.initialState?.customerList)) {
75
- const customerList = (0, _lodashEs.cloneDeep)(options.initialState.customerList || []);
77
+ this.store = options == null ? void 0 : options.store;
78
+ this.request = this.core.getPlugin("request");
79
+ this.otherParams = (options == null ? void 0 : options.otherParams) || {};
80
+ if (Array.isArray((_a = options == null ? void 0 : options.initialState) == null ? void 0 : _a.customerList)) {
81
+ const customerList = (0, import_lodash_es.cloneDeep)(options.initialState.customerList || []);
76
82
  this.store.customerList = customerList;
77
83
  } else {
78
84
  this.store.customerList = [];
79
85
  }
80
- if (options?.initialState?.selectedCustomer) {
81
- this.store.selectedCustomer = (0, _lodashEs.cloneDeep)(options.initialState.selectedCustomer);
86
+ if ((_b = options == null ? void 0 : options.initialState) == null ? void 0 : _b.selectedCustomer) {
87
+ this.store.selectedCustomer = (0, import_lodash_es.cloneDeep)(options.initialState.selectedCustomer);
82
88
  } else {
83
89
  this.store.selectedCustomer = null;
84
90
  }
85
- if (typeof options?.initialState?.total === 'number') {
91
+ if (typeof ((_c = options == null ? void 0 : options.initialState) == null ? void 0 : _c.total) === "number") {
86
92
  this.store.total = options.initialState.total;
87
93
  } else {
88
94
  this.store.total = 0;
89
95
  }
90
- if (typeof options?.initialState?.currentPage === 'number') {
96
+ if (typeof ((_d = options == null ? void 0 : options.initialState) == null ? void 0 : _d.currentPage) === "number") {
91
97
  this.store.currentPage = options.initialState.currentPage;
92
98
  } else {
93
99
  this.store.currentPage = 1;
94
100
  }
95
- if (typeof options?.initialState?.pageSize === 'number' && options.initialState.pageSize > 1) {
101
+ if (typeof ((_e = options == null ? void 0 : options.initialState) == null ? void 0 : _e.pageSize) === "number" && options.initialState.pageSize > 1) {
96
102
  this.store.pageSize = options.initialState.pageSize;
97
103
  } else {
98
- this.store.pageSize = _constants.DEFAULT_PAGE_SIZE;
104
+ this.store.pageSize = import_constants.DEFAULT_PAGE_SIZE;
99
105
  }
100
-
101
- // 初始化滚动加载相关状态
102
- this.store.hasMore = options?.initialState?.hasMore ?? true;
103
- this.store.loadingMore = options?.initialState?.loadingMore ?? false;
104
- this.store.searchParams = options?.initialState?.searchParams ?? {};
105
-
106
- // 缓存配置
107
- if (options?.otherParams?.cacheId) {
106
+ this.store.hasMore = ((_f = options == null ? void 0 : options.initialState) == null ? void 0 : _f.hasMore) ?? true;
107
+ this.store.loadingMore = ((_g = options == null ? void 0 : options.initialState) == null ? void 0 : _g.loadingMore) ?? false;
108
+ this.store.searchParams = ((_h = options == null ? void 0 : options.initialState) == null ? void 0 : _h.searchParams) ?? {};
109
+ if ((_i = options == null ? void 0 : options.otherParams) == null ? void 0 : _i.cacheId) {
108
110
  this.openCache = options.otherParams.openCache;
109
111
  this.cacheId = options.otherParams.cacheId;
110
112
  }
111
- if (options?.otherParams?.fatherModule) {
113
+ if ((_j = options == null ? void 0 : options.otherParams) == null ? void 0 : _j.fatherModule) {
112
114
  this.fatherModule = options.otherParams.fatherModule;
113
115
  }
114
116
  }
115
-
116
117
  /**
117
118
  * 更新父级解决方案透传的运行态参数,并刷新客户模块缓存配置。
118
119
  *
@@ -125,64 +126,54 @@ class CustomerModule extends _BaseModule.BaseModule {
125
126
  this.cacheId = this.otherParams.cacheId;
126
127
  this.fatherModule = this.otherParams.fatherModule;
127
128
  }
128
-
129
129
  /**
130
130
  * 获取客户列表数据(内部方法)
131
131
  * @param params 查询参数
132
132
  * @returns API响应数据
133
133
  */
134
134
  async fetchCustomerListData(params = {}) {
135
- let url = '/customer/select-list';
136
- // 如果是加盟子店铺,则使用加盟商的客户列表接口
137
- if (this.otherParams?.isFranchisee) {
138
- url = '/franchisee/customer/select-list';
135
+ var _a, _b, _c, _d;
136
+ let url = "/customer/select-list";
137
+ if ((_a = this.otherParams) == null ? void 0 : _a.isFranchisee) {
138
+ url = "/franchisee/customer/select-list";
139
139
  }
140
- const {
141
- skip = 1,
142
- num = _constants.DEFAULT_PAGE_SIZE,
143
- search,
144
- ..._otherParams
145
- } = params;
140
+ const { skip = 1, num = import_constants.DEFAULT_PAGE_SIZE, search, ..._otherParams } = params;
146
141
  const queryParams = {
147
142
  skip,
148
143
  num,
149
- sort_by: _constants.SORT_BY,
150
- with: ['latestWalletDetail.wallet', 'contactsInfo', 'formRecord'],
144
+ sort_by: import_constants.SORT_BY,
145
+ with: ["latestWalletDetail.wallet", "contactsInfo", "formRecord"],
151
146
  search_wallet_flag: 1,
152
147
  search_wallet_pass_flag: 1,
153
- ...(search && {
154
- search
155
- }),
148
+ ...search && { search },
156
149
  ..._otherParams
157
150
  };
158
151
  const res = await this.request.get(url, queryParams, {
159
152
  cache: {
160
- mode: _plugins.RequestModeENUM.REMOTE_LOCAL,
153
+ mode: import_plugins.RequestModeENUM.REMOTE_LOCAL,
161
154
  type: "memory"
162
155
  }
163
156
  });
164
- if (res?.code !== 200) {
165
- throw new Error(res?.message);
157
+ if ((res == null ? void 0 : res.code) !== 200) {
158
+ throw new Error(res == null ? void 0 : res.message);
166
159
  }
167
-
168
- // 如果是加盟子店铺,查询的接口返回的数据都是总店的客户数据,需要加上标识
169
- let _customerList = res?.data?.list || [];
170
- if (this.otherParams?.isFranchisee && _customerList?.length > 0) {
171
- _customerList = _customerList?.map(item => {
160
+ let _customerList = ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.list) || [];
161
+ if (((_c = this.otherParams) == null ? void 0 : _c.isFranchisee) && (_customerList == null ? void 0 : _customerList.length) > 0) {
162
+ _customerList = _customerList == null ? void 0 : _customerList.map((item) => {
172
163
  return {
173
- ...(item || {}),
174
- is_franchisor_customer: 1 // 标识是总店的客户
164
+ ...item || {},
165
+ is_franchisor_customer: 1
166
+ // 标识是总店的客户
175
167
  };
176
168
  });
177
169
  }
178
170
  return {
179
171
  customerList: _customerList,
180
- total: res?.data?.count || 0,
172
+ total: ((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.count) || 0,
181
173
  page: skip,
182
174
  pageSize: num
183
175
  };
184
176
  }
185
-
186
177
  /**
187
178
  * 处理客户列表操作的错误(内部方法)
188
179
  * @param error 错误对象
@@ -191,21 +182,18 @@ class CustomerModule extends _BaseModule.BaseModule {
191
182
  async handleCustomerListError(error, operation) {
192
183
  console.error(`Failed to ${operation}:`, error);
193
184
  this.store.error = error instanceof Error ? error.message : `Failed to ${operation}`;
194
- await this.core.effects.emit(`${this.name}:onCustomerListError`, this.store.error);
185
+ await this.core.effects.emit(
186
+ `${this.name}:onCustomerListError`,
187
+ this.store.error
188
+ );
195
189
  }
196
-
197
190
  /**
198
191
  * 查询客户列表但不写入 customerList / pagination 状态。
199
192
  *
200
193
  * 用于按 ID 补齐客户等内部查询,避免把临时的 num/searchParams 污染到滚动列表。
201
194
  */
202
195
  async queryCustomerList(params = {}) {
203
- const {
204
- customerList,
205
- total,
206
- page,
207
- pageSize
208
- } = await this.fetchCustomerListData(params);
196
+ const { customerList, total, page, pageSize } = await this.fetchCustomerListData(params);
209
197
  return {
210
198
  list: customerList,
211
199
  total,
@@ -213,7 +201,6 @@ class CustomerModule extends _BaseModule.BaseModule {
213
201
  pageSize
214
202
  };
215
203
  }
216
-
217
204
  /**
218
205
  * 获取客户列表
219
206
  * @param params 查询参数
@@ -223,33 +210,14 @@ class CustomerModule extends _BaseModule.BaseModule {
223
210
  try {
224
211
  this.store.loading = true;
225
212
  this.store.error = null;
226
- const {
227
- customerList,
228
- total,
229
- page,
230
- pageSize
231
- } = await this.fetchCustomerListData(params);
232
-
233
- // 保存搜索条件(排除skip和num)
234
- const {
235
- skip,
236
- num,
237
- ...searchParams
238
- } = params;
239
- this.store.searchParams = (0, _lodashEs.cloneDeep)(searchParams);
240
-
241
- // 更新分页状态
213
+ const { customerList, total, page, pageSize } = await this.fetchCustomerListData(params);
214
+ const { skip, num, ...searchParams } = params;
215
+ this.store.searchParams = (0, import_lodash_es.cloneDeep)(searchParams);
242
216
  this.store.currentPage = page;
243
217
  this.store.pageSize = pageSize;
244
218
  this.store.total = total;
245
-
246
- // 计算是否还有更多数据
247
219
  this.store.hasMore = page * pageSize < total;
248
-
249
- // 设置客户列表(替换模式)
250
- this.store.customerList = (0, _lodashEs.cloneDeep)(customerList);
251
-
252
- // 触发分页变化事件
220
+ this.store.customerList = (0, import_lodash_es.cloneDeep)(customerList);
253
221
  this.triggerPaginationChange({
254
222
  page,
255
223
  pageSize,
@@ -264,28 +232,29 @@ class CustomerModule extends _BaseModule.BaseModule {
264
232
  };
265
233
  return response;
266
234
  } catch (error) {
267
- await this.handleCustomerListError(error, 'fetch customer list');
235
+ await this.handleCustomerListError(error, "fetch customer list");
268
236
  throw error;
269
237
  } finally {
270
238
  this.store.loading = false;
271
239
  this.storeChange();
272
- await this.core.effects.emit(`${this.name}:onCustomerListUpdate`, this.store);
240
+ await this.core.effects.emit(
241
+ `${this.name}:onCustomerListUpdate`,
242
+ this.store
243
+ );
273
244
  }
274
245
  }
275
-
276
246
  /**
277
247
  * 设置客户列表
278
248
  * @param customers 客户列表
279
249
  * @param total 总数
280
250
  */
281
251
  setCustomerList(customers, total) {
282
- this.store.customerList = (0, _lodashEs.cloneDeep)(customers);
283
- if (typeof total === 'number') {
252
+ this.store.customerList = (0, import_lodash_es.cloneDeep)(customers);
253
+ if (typeof total === "number") {
284
254
  this.store.total = total;
285
255
  }
286
256
  this.storeChange();
287
257
  }
288
-
289
258
  /**
290
259
  * 设置当前选择的客户
291
260
  * @param customer 选择的客户
@@ -294,11 +263,13 @@ class CustomerModule extends _BaseModule.BaseModule {
294
263
  if (this.isSameSelectedCustomer(this.store.selectedCustomer, customer)) {
295
264
  return;
296
265
  }
297
- this.store.selectedCustomer = !customer ? _constants.DEFAULT_CUSTOMER : (0, _lodashEs.cloneDeep)(customer);
298
- this.core.effects.emit(`${this.name}:onCustomerSelected`, this.store.selectedCustomer);
266
+ this.store.selectedCustomer = !customer ? import_constants.DEFAULT_CUSTOMER : (0, import_lodash_es.cloneDeep)(customer);
267
+ this.core.effects.emit(
268
+ `${this.name}:onCustomerSelected`,
269
+ this.store.selectedCustomer
270
+ );
299
271
  this.storeChange();
300
272
  }
301
-
302
273
  /**
303
274
  * 获取当前选择的客户
304
275
  * @returns 当前选择的客户
@@ -306,7 +277,6 @@ class CustomerModule extends _BaseModule.BaseModule {
306
277
  getSelectedCustomer() {
307
278
  return this.store.selectedCustomer;
308
279
  }
309
-
310
280
  /**
311
281
  * 获取客户列表
312
282
  * @returns 客户列表
@@ -314,16 +284,14 @@ class CustomerModule extends _BaseModule.BaseModule {
314
284
  getCustomers() {
315
285
  return [...this.store.customerList];
316
286
  }
317
-
318
287
  /**
319
288
  * 根据ID查找客户
320
289
  * @param id 客户ID
321
290
  * @returns 客户信息
322
291
  */
323
292
  getCustomerById(id) {
324
- return this.store.customerList.find(customer => customer.id === id) || null;
293
+ return this.store.customerList.find((customer) => customer.id === id) || null;
325
294
  }
326
-
327
295
  /**
328
296
  * 清空客户列表
329
297
  */
@@ -332,43 +300,37 @@ class CustomerModule extends _BaseModule.BaseModule {
332
300
  this.store.selectedCustomer = null;
333
301
  this.store.total = 0;
334
302
  this.store.currentPage = 1;
335
- this.store.pageSize = _constants.DEFAULT_PAGE_SIZE;
303
+ this.store.pageSize = import_constants.DEFAULT_PAGE_SIZE;
336
304
  this.store.hasMore = true;
337
305
  this.store.loadingMore = false;
338
306
  this.store.searchParams = {};
339
- this.core.effects.emit(`${this.name}:onCustomerListUpdate`, this.store);
307
+ this.core.effects.emit(
308
+ `${this.name}:onCustomerListUpdate`,
309
+ this.store
310
+ );
340
311
  this.storeChange();
341
312
  }
342
-
343
313
  /**
344
314
  * 添加客户到列表第一位
345
315
  * @param customer 要添加的客户信息
346
316
  */
347
317
  addCustomerToFirst(customer) {
348
- // 深拷贝客户对象以避免引用问题
349
- const newCustomer = (0, _lodashEs.cloneDeep)(customer);
350
-
351
- // 将客户添加到列表第一位
318
+ const newCustomer = (0, import_lodash_es.cloneDeep)(customer);
352
319
  this.store.customerList = [newCustomer, ...this.store.customerList];
353
-
354
- // 更新总数
355
320
  this.store.total += 1;
356
-
357
- // 触发客户列表更新事件
358
- this.core.effects.emit(`${this.name}:onCustomerListUpdate`, this.store);
359
-
360
- // 保存状态变化
321
+ this.core.effects.emit(
322
+ `${this.name}:onCustomerListUpdate`,
323
+ this.store
324
+ );
361
325
  this.storeChange();
362
326
  }
363
-
364
327
  /**
365
328
  * 获取当前状态
366
329
  * @returns 当前状态
367
330
  */
368
331
  getState() {
369
- return (0, _lodashEs.cloneDeep)(this.store);
332
+ return (0, import_lodash_es.cloneDeep)(this.store);
370
333
  }
371
-
372
334
  /**
373
335
  * 获取分页信息
374
336
  * @returns 分页信息
@@ -381,15 +343,16 @@ class CustomerModule extends _BaseModule.BaseModule {
381
343
  totalPages: Math.ceil(this.store.total / this.store.pageSize)
382
344
  };
383
345
  }
384
-
385
346
  /**
386
347
  * 触发分页变化事件
387
348
  * @param pagination 分页信息
388
349
  */
389
350
  triggerPaginationChange(pagination) {
390
- this.core.effects.emit(`${this.name}:onPaginationChange`, pagination);
351
+ this.core.effects.emit(
352
+ `${this.name}:onPaginationChange`,
353
+ pagination
354
+ );
391
355
  }
392
-
393
356
  /**
394
357
  * 设置分页信息
395
358
  * @param page 页码
@@ -399,8 +362,6 @@ class CustomerModule extends _BaseModule.BaseModule {
399
362
  this.store.currentPage = page;
400
363
  this.store.pageSize = pageSize;
401
364
  this.storeChange();
402
-
403
- // 触发分页变化事件
404
365
  this.triggerPaginationChange({
405
366
  page,
406
367
  pageSize,
@@ -408,7 +369,6 @@ class CustomerModule extends _BaseModule.BaseModule {
408
369
  totalPages: Math.ceil(this.store.total / pageSize)
409
370
  });
410
371
  }
411
-
412
372
  /**
413
373
  * 便捷方法:切换分页并自动获取数据
414
374
  * @param page 页码
@@ -417,28 +377,21 @@ class CustomerModule extends _BaseModule.BaseModule {
417
377
  */
418
378
  async changeCustomerPage(page, pageSize) {
419
379
  const targetPageSize = pageSize || this.store.pageSize;
420
-
421
- // 先更新分页状态
422
380
  this.setPaginationInfo(page, targetPageSize);
423
-
424
- // skip直接使用page,num使用pageSize
425
381
  const skip = page;
426
382
  const num = targetPageSize;
427
-
428
- // 自动调用获取客户列表,使用存储的搜索条件
429
383
  return await this.getCustomerList({
430
384
  skip,
431
385
  num,
432
- ...this.store.searchParams // 使用存储的搜索条件
386
+ ...this.store.searchParams
387
+ // 使用存储的搜索条件
433
388
  });
434
389
  }
435
-
436
390
  /**
437
391
  * 滚动加载更多客户数据 - 数据会追加到现有列表中
438
392
  * @returns 客户列表响应
439
393
  */
440
394
  async loadMoreCustomers() {
441
- // 如果没有更多数据或正在加载,直接返回
442
395
  if (!this.store.hasMore || this.store.loadingMore) {
443
396
  return {
444
397
  list: [],
@@ -447,8 +400,6 @@ class CustomerModule extends _BaseModule.BaseModule {
447
400
  pageSize: this.store.pageSize
448
401
  };
449
402
  }
450
-
451
- // 计算下一页
452
403
  const nextPage = this.store.currentPage + 1;
453
404
  try {
454
405
  this.store.loadingMore = true;
@@ -456,35 +407,24 @@ class CustomerModule extends _BaseModule.BaseModule {
456
407
  const loadMoreParams = {
457
408
  skip: nextPage,
458
409
  num: this.store.pageSize,
459
- ...this.store.searchParams // 使用存储的搜索条件
410
+ ...this.store.searchParams
411
+ // 使用存储的搜索条件
460
412
  };
461
-
462
- // 使用公共方法获取数据,传入存储的搜索条件
463
- const {
464
- customerList: newCustomers,
465
- total,
466
- page,
467
- pageSize
468
- } = await this.fetchCustomerListData(loadMoreParams);
469
-
470
- // 将新数据追加到现有列表(追加模式)
471
- const updatedCustomerList = [...this.store.customerList, ...(0, _lodashEs.cloneDeep)(newCustomers)];
472
-
473
- // 更新状态
413
+ const { customerList: newCustomers, total, page, pageSize } = await this.fetchCustomerListData(loadMoreParams);
414
+ const updatedCustomerList = [...this.store.customerList, ...(0, import_lodash_es.cloneDeep)(newCustomers)];
474
415
  this.store.customerList = updatedCustomerList;
475
416
  this.store.currentPage = page;
476
417
  this.store.total = total;
477
418
  this.store.hasMore = page * pageSize < total;
478
-
479
- // 触发滚动加载特定事件
480
- await this.core.effects.emit(`${this.name}:onScrollLoadMore`, {
481
- newCustomers,
482
- allCustomers: this.store.customerList,
483
- currentPage: page,
484
- hasMore: this.store.hasMore
485
- });
486
-
487
- // 触发分页变化事件
419
+ await this.core.effects.emit(
420
+ `${this.name}:onScrollLoadMore`,
421
+ {
422
+ newCustomers,
423
+ allCustomers: this.store.customerList,
424
+ currentPage: page,
425
+ hasMore: this.store.hasMore
426
+ }
427
+ );
488
428
  this.triggerPaginationChange({
489
429
  page,
490
430
  pageSize,
@@ -500,46 +440,43 @@ class CustomerModule extends _BaseModule.BaseModule {
500
440
  };
501
441
  return response;
502
442
  } catch (error) {
503
- await this.handleCustomerListError(error, 'load more customers');
443
+ await this.handleCustomerListError(error, "load more customers");
504
444
  throw error;
505
445
  } finally {
506
446
  this.store.loadingMore = false;
507
447
  this.storeChange();
508
- await this.core.effects.emit(`${this.name}:onCustomerListUpdate`, this.store);
448
+ await this.core.effects.emit(
449
+ `${this.name}:onCustomerListUpdate`,
450
+ this.store
451
+ );
509
452
  }
510
453
  }
511
-
512
454
  /**
513
455
  * 重置并重新开始滚动加载
514
456
  * @param params 查询参数
515
457
  * @returns 客户列表响应
516
458
  */
517
459
  async resetAndLoadCustomers(params = {}) {
518
- // 重置状态
519
460
  this.store.customerList = [];
520
461
  this.store.currentPage = 1;
521
462
  this.store.hasMore = true;
522
463
  this.store.loadingMore = false;
523
-
524
- // 使用第一页参数
525
464
  const resetParams = {
526
465
  ...params,
527
466
  skip: 1,
528
467
  num: params.num || this.store.pageSize
529
468
  };
530
-
531
- // 调用普通的获取列表方法
532
469
  const response = await this.getCustomerList(resetParams);
533
-
534
- // 触发滚动加载完成事件
535
- await this.core.effects.emit(`${this.name}:onScrollLoadComplete`, {
536
- customers: this.store.customerList,
537
- total: this.store.total,
538
- hasMore: this.store.hasMore
539
- });
470
+ await this.core.effects.emit(
471
+ `${this.name}:onScrollLoadComplete`,
472
+ {
473
+ customers: this.store.customerList,
474
+ total: this.store.total,
475
+ hasMore: this.store.hasMore
476
+ }
477
+ );
540
478
  return response;
541
479
  }
542
-
543
480
  /**
544
481
  * 检查是否还有更多数据可以加载
545
482
  * @returns 是否还有更多数据
@@ -547,30 +484,30 @@ class CustomerModule extends _BaseModule.BaseModule {
547
484
  hasMoreCustomers() {
548
485
  return this.store.hasMore && !this.store.loadingMore;
549
486
  }
550
-
551
487
  /**
552
488
  * 获取当前的搜索条件
553
489
  * @returns 当前搜索条件
554
490
  */
555
491
  getCurrentSearchParams() {
556
- return (0, _lodashEs.cloneDeep)(this.store.searchParams);
492
+ return (0, import_lodash_es.cloneDeep)(this.store.searchParams);
557
493
  }
558
-
559
494
  /**
560
495
  * 缓存状态变化
561
496
  */
562
497
  storeChange() {
563
498
  if (this.openCache) {
564
- const store = (0, _lodashEs.cloneDeep)(this.store);
499
+ const store = (0, import_lodash_es.cloneDeep)(this.store);
565
500
  this.checkSaveCache({
566
501
  cacheId: this.cacheId,
567
502
  fatherModule: this.fatherModule,
568
503
  store,
569
- cacheKey: ['customerList', 'selectedCustomer', 'total', 'currentPage', 'pageSize', 'hasMore', 'loadingMore', 'searchParams']
504
+ cacheKey: ["customerList", "selectedCustomer", "total", "currentPage", "pageSize", "hasMore", "loadingMore", "searchParams"]
570
505
  });
571
506
  }
572
507
  }
573
- }
574
-
575
- // 导出类型和模块
576
- exports.CustomerModule = CustomerModule;
508
+ };
509
+ // Annotate the CommonJS export names for ESM import in node:
510
+ 0 && (module.exports = {
511
+ CustomerModule,
512
+ ...require("./types")
513
+ });