@pisell/pisellos 2.3.73 → 2.3.75

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 (296) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +111 -71
  3. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  4. package/dist/model/strategy/adapter/walletPass/example.js +3 -26
  5. package/dist/model/strategy/strategy-example.js +5 -19
  6. package/dist/modules/Cart/index.js +0 -3
  7. package/dist/modules/Cart/utils/cartProduct.js +0 -1
  8. package/dist/modules/Date/index.js +1 -5
  9. package/dist/modules/Discount/index.js +2 -4
  10. package/dist/modules/OpenData/index.js +0 -2
  11. package/dist/modules/Order/index.d.ts +1 -1
  12. package/dist/modules/Order/index.js +36 -64
  13. package/dist/modules/Payment/index.js +97 -162
  14. package/dist/modules/Quotation/index.d.ts +6 -0
  15. package/dist/modules/Quotation/index.js +75 -19
  16. package/dist/modules/Rules/index.js +1 -4
  17. package/dist/modules/Schedule/index.js +0 -1
  18. package/dist/modules/Schedule/utils.js +0 -1
  19. package/dist/modules/Step/index.js +0 -1
  20. package/dist/plugins/request.d.ts +1 -0
  21. package/dist/plugins/request.js +1 -4
  22. package/dist/plugins/window.js +2 -6
  23. package/dist/server/index.d.ts +8 -2
  24. package/dist/server/index.js +303 -269
  25. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  26. package/dist/server/modules/floor-plan/index.js +240 -98
  27. package/dist/server/modules/menu/index.js +75 -59
  28. package/dist/server/modules/order/index.d.ts +17 -7
  29. package/dist/server/modules/order/index.js +421 -211
  30. package/dist/server/modules/products/index.d.ts +8 -2
  31. package/dist/server/modules/products/index.js +191 -117
  32. package/dist/server/modules/quotation/index.js +29 -38
  33. package/dist/server/modules/resource/index.js +24 -17
  34. package/dist/server/modules/schedule/index.js +27 -35
  35. package/dist/server/utils/product.js +0 -1
  36. package/dist/solution/BaseSales/index.js +38 -41
  37. package/dist/solution/BookingByStep/index.d.ts +1 -1
  38. package/dist/solution/BookingByStep/index.js +7 -59
  39. package/dist/solution/BookingByStep/utils/capacity.js +1 -11
  40. package/dist/solution/BookingByStep/utils/resources.js +1 -3
  41. package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
  42. package/dist/solution/BookingTicket/index.js +0 -2
  43. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
  44. package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
  45. package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
  46. package/dist/solution/BuyTickets/index.js +9 -12
  47. package/dist/solution/Checkout/index.js +177 -252
  48. package/dist/solution/Checkout/utils/index.js +4 -16
  49. package/dist/solution/RegisterAndLogin/index.js +30 -76
  50. package/dist/solution/ScanOrder/index.js +50 -60
  51. package/dist/solution/ShopDiscount/index.js +2 -7
  52. package/dist/solution/VenueBooking/index.js +45 -55
  53. package/dist/utils/task.js +15 -18
  54. package/dist/utils/watch.js +0 -1
  55. package/lib/apis/picoding.js +2 -0
  56. package/lib/core/index.d.ts +7 -0
  57. package/lib/core/index.js +149 -131
  58. package/lib/effects/index.js +46 -57
  59. package/lib/index.js +82 -49
  60. package/lib/model/index.js +14 -21
  61. package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
  62. package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
  63. package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
  64. package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
  65. package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
  66. package/lib/model/strategy/adapter/index.js +100 -64
  67. package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
  68. package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
  69. package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
  70. package/lib/model/strategy/adapter/itemRule/index.js +83 -57
  71. package/lib/model/strategy/adapter/itemRule/type.js +97 -36
  72. package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
  73. package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
  74. package/lib/model/strategy/adapter/promotion/examples.js +222 -234
  75. package/lib/model/strategy/adapter/promotion/index.js +1 -0
  76. package/lib/model/strategy/adapter/promotion/type.js +243 -36
  77. package/lib/model/strategy/adapter/type.js +4 -16
  78. package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
  79. package/lib/model/strategy/adapter/walletPass/example.js +217 -190
  80. package/lib/model/strategy/adapter/walletPass/index.js +75 -51
  81. package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
  82. package/lib/model/strategy/adapter/walletPass/type.js +4 -16
  83. package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
  84. package/lib/model/strategy/engine.js +270 -168
  85. package/lib/model/strategy/index.js +49 -34
  86. package/lib/model/strategy/strategy-example.js +243 -239
  87. package/lib/model/strategy/type.js +100 -40
  88. package/lib/modules/Account/index.js +39 -53
  89. package/lib/modules/Account/types.js +20 -33
  90. package/lib/modules/AccountList/index.js +116 -154
  91. package/lib/modules/AccountList/types.js +30 -31
  92. package/lib/modules/AccountList/utils.js +18 -30
  93. package/lib/modules/BaseModule.js +23 -42
  94. package/lib/modules/BookingContext/index.js +158 -136
  95. package/lib/modules/BookingContext/types.js +46 -32
  96. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
  97. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
  98. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
  99. package/lib/modules/BookingContext/utils/flexible.js +38 -55
  100. package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
  101. package/lib/modules/BookingContext/utils/index.js +124 -41
  102. package/lib/modules/BookingContext/utils/noResource.js +58 -70
  103. package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
  104. package/lib/modules/BookingContext/utils/productExtend.js +202 -155
  105. package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
  106. package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
  107. package/lib/modules/BookingContext/utils/resources.js +209 -167
  108. package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
  109. package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
  110. package/lib/modules/Cart/index.js +170 -124
  111. package/lib/modules/Cart/types.js +46 -51
  112. package/lib/modules/Cart/utils/cartAccount.js +40 -39
  113. package/lib/modules/Cart/utils/cartDate.js +56 -61
  114. package/lib/modules/Cart/utils/cartDiscount.js +28 -33
  115. package/lib/modules/Cart/utils/cartNote.js +27 -32
  116. package/lib/modules/Cart/utils/cartProduct.js +321 -251
  117. package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
  118. package/lib/modules/Cart/utils/cartResource.js +70 -78
  119. package/lib/modules/Cart/utils/changePrice.js +22 -50
  120. package/lib/modules/Cart/utils/index.js +106 -48
  121. package/lib/modules/Customer/constants.js +13 -34
  122. package/lib/modules/Customer/index.js +235 -172
  123. package/lib/modules/Customer/types.js +38 -35
  124. package/lib/modules/Date/index.js +116 -115
  125. package/lib/modules/Date/types.js +16 -28
  126. package/lib/modules/Date/utils.js +174 -123
  127. package/lib/modules/Discount/index.js +122 -127
  128. package/lib/modules/Discount/types.js +9 -31
  129. package/lib/modules/Guests/index.js +30 -56
  130. package/lib/modules/Guests/types.js +23 -33
  131. package/lib/modules/Holder/index.js +209 -189
  132. package/lib/modules/Holder/types.js +4 -16
  133. package/lib/modules/Holder/utils.js +20 -49
  134. package/lib/modules/OpenData/index.js +70 -76
  135. package/lib/modules/OpenData/types.js +4 -16
  136. package/lib/modules/OpenData/utils.js +44 -78
  137. package/lib/modules/Order/index.d.ts +1 -1
  138. package/lib/modules/Order/index.js +1713 -2118
  139. package/lib/modules/Order/payment-utils.js +77 -120
  140. package/lib/modules/Order/types.js +88 -35
  141. package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
  142. package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
  143. package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
  144. package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
  145. package/lib/modules/Order/utils.js +814 -647
  146. package/lib/modules/Payment/cash.js +20 -33
  147. package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
  148. package/lib/modules/Payment/eftpos.js +16 -30
  149. package/lib/modules/Payment/index.js +532 -399
  150. package/lib/modules/Payment/mx51.js +1 -0
  151. package/lib/modules/Payment/types.js +230 -108
  152. package/lib/modules/Payment/utils.js +52 -51
  153. package/lib/modules/Payment/walletpass.js +485 -660
  154. package/lib/modules/Product/index.js +51 -46
  155. package/lib/modules/Product/types.js +4 -16
  156. package/lib/modules/Product/utils.js +32 -33
  157. package/lib/modules/ProductList/index.js +113 -123
  158. package/lib/modules/ProductList/types.js +9 -31
  159. package/lib/modules/Quotation/index.d.ts +6 -0
  160. package/lib/modules/Quotation/index.js +110 -103
  161. package/lib/modules/Quotation/types.js +4 -16
  162. package/lib/modules/Resource/index.js +27 -59
  163. package/lib/modules/Resource/types.js +22 -32
  164. package/lib/modules/Resource/utils.js +30 -38
  165. package/lib/modules/ResourcePlanner/index.js +25 -23
  166. package/lib/modules/ResourcePlanner/localClock.js +54 -119
  167. package/lib/modules/ResourcePlanner/planner.js +589 -770
  168. package/lib/modules/ResourcePlanner/types.js +10 -29
  169. package/lib/modules/Rules/index.js +1218 -959
  170. package/lib/modules/Rules/types.js +17 -40
  171. package/lib/modules/SalesSummary/index.js +85 -90
  172. package/lib/modules/SalesSummary/types.js +4 -16
  173. package/lib/modules/SalesSummary/utils.js +355 -430
  174. package/lib/modules/ScanOrderLogger/index.js +59 -79
  175. package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
  176. package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
  177. package/lib/modules/ScanOrderLogger/types.js +4 -16
  178. package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
  179. package/lib/modules/Schedule/index.js +100 -114
  180. package/lib/modules/Schedule/type.js +4 -16
  181. package/lib/modules/Schedule/types.js +4 -16
  182. package/lib/modules/Schedule/utils.js +433 -291
  183. package/lib/modules/Step/index.js +40 -52
  184. package/lib/modules/Step/tyeps.js +4 -16
  185. package/lib/modules/Summary/index.js +66 -71
  186. package/lib/modules/Summary/types.js +4 -16
  187. package/lib/modules/Summary/utils.js +773 -418
  188. package/lib/modules/SurchargeList/index.js +46 -60
  189. package/lib/modules/SurchargeList/types.js +4 -16
  190. package/lib/modules/index.js +245 -63
  191. package/lib/plugins/app.js +4 -16
  192. package/lib/plugins/index.js +36 -25
  193. package/lib/plugins/request.d.ts +1 -0
  194. package/lib/plugins/request.js +137 -126
  195. package/lib/plugins/shopStore.js +4 -16
  196. package/lib/plugins/user.js +4 -16
  197. package/lib/plugins/window.js +171 -179
  198. package/lib/server/index.d.ts +8 -2
  199. package/lib/server/index.js +3083 -2663
  200. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  201. package/lib/server/modules/floor-plan/index.js +159 -127
  202. package/lib/server/modules/floor-plan/types.js +15 -30
  203. package/lib/server/modules/index.js +106 -68
  204. package/lib/server/modules/menu/index.js +170 -124
  205. package/lib/server/modules/menu/types.js +18 -31
  206. package/lib/server/modules/order/index.d.ts +17 -7
  207. package/lib/server/modules/order/index.js +916 -977
  208. package/lib/server/modules/order/types.js +122 -33
  209. package/lib/server/modules/order/utils/filterBookings.js +219 -194
  210. package/lib/server/modules/order/utils/filterOrders.js +118 -92
  211. package/lib/server/modules/payment/index.js +59 -83
  212. package/lib/server/modules/payment/types.js +4 -16
  213. package/lib/server/modules/products/index.d.ts +8 -2
  214. package/lib/server/modules/products/index.js +656 -471
  215. package/lib/server/modules/products/types.js +44 -34
  216. package/lib/server/modules/quotation/index.js +137 -172
  217. package/lib/server/modules/quotation/types.js +21 -31
  218. package/lib/server/modules/resource/index.js +225 -186
  219. package/lib/server/modules/resource/types.js +42 -33
  220. package/lib/server/modules/schedule/index.js +135 -123
  221. package/lib/server/modules/schedule/types.js +14 -21
  222. package/lib/server/modules/schedule/utils.js +334 -163
  223. package/lib/server/types.js +4 -16
  224. package/lib/server/utils/index.js +25 -23
  225. package/lib/server/utils/product.js +196 -139
  226. package/lib/server/utils/schedule.js +34 -41
  227. package/lib/server/utils/small-ticket.js +479 -456
  228. package/lib/server/utils/time.js +40 -49
  229. package/lib/solution/BaseSales/index.js +1186 -1410
  230. package/lib/solution/BaseSales/types.js +42 -38
  231. package/lib/solution/BaseSales/utils/cartPromotion.js +642 -498
  232. package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
  233. package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
  234. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +108 -145
  235. package/lib/solution/BaseSales/utils.js +158 -143
  236. package/lib/solution/BookingByStep/index.d.ts +1 -1
  237. package/lib/solution/BookingByStep/index.js +1527 -1340
  238. package/lib/solution/BookingByStep/types.js +40 -99
  239. package/lib/solution/BookingByStep/utils/capacity.js +192 -160
  240. package/lib/solution/BookingByStep/utils/products.js +42 -52
  241. package/lib/solution/BookingByStep/utils/resources.js +527 -330
  242. package/lib/solution/BookingByStep/utils/stock.js +65 -44
  243. package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
  244. package/lib/solution/BookingTicket/index.js +607 -522
  245. package/lib/solution/BookingTicket/types.js +99 -77
  246. package/lib/solution/BookingTicket/utils/addProductDecision.js +226 -189
  247. package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
  248. package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
  249. package/lib/solution/BookingTicket/utils/cartView.js +114 -99
  250. package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
  251. package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
  252. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
  253. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
  254. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
  255. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
  256. package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
  257. package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
  258. package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
  259. package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
  260. package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
  261. package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
  262. package/lib/solution/BuyTickets/index.js +67 -70
  263. package/lib/solution/BuyTickets/types.js +22 -38
  264. package/lib/solution/Checkout/index.js +1451 -1158
  265. package/lib/solution/Checkout/types.js +91 -61
  266. package/lib/solution/Checkout/utils/index.js +228 -156
  267. package/lib/solution/PlaceOrder/index.js +55 -0
  268. package/lib/solution/RegisterAndLogin/config.js +493 -460
  269. package/lib/solution/RegisterAndLogin/index.js +633 -630
  270. package/lib/solution/RegisterAndLogin/types.js +189 -76
  271. package/lib/solution/RegisterAndLogin/utils.js +183 -125
  272. package/lib/solution/Sales/index.js +328 -324
  273. package/lib/solution/Sales/types.js +27 -33
  274. package/lib/solution/ScanOrder/index.js +832 -864
  275. package/lib/solution/ScanOrder/types.js +33 -34
  276. package/lib/solution/ScanOrder/utils.js +409 -374
  277. package/lib/solution/ShopDiscount/index.js +226 -232
  278. package/lib/solution/ShopDiscount/types.js +15 -37
  279. package/lib/solution/ShopDiscount/utils.js +300 -172
  280. package/lib/solution/UnifiedBookingSales/index.js +1035 -1201
  281. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
  282. package/lib/solution/UnifiedBookingSales/types.js +10 -32
  283. package/lib/solution/VenueBooking/index.js +811 -879
  284. package/lib/solution/VenueBooking/types.js +19 -39
  285. package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
  286. package/lib/solution/VenueBooking/utils/resource.js +31 -54
  287. package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
  288. package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
  289. package/lib/solution/VenueBooking/utils.js +130 -67
  290. package/lib/solution/index.js +124 -41
  291. package/lib/store/createStore.js +32 -29
  292. package/lib/types/index.js +4 -16
  293. package/lib/utils/payment-number.js +26 -46
  294. package/lib/utils/task.js +36 -36
  295. package/lib/utils/watch.js +81 -47
  296. package/package.json +2 -1
@@ -82,9 +82,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
82
82
  if (appPlugin) {
83
83
  app = appPlugin.getApp();
84
84
  this.dbManager = app.dbManager;
85
- if (this.dbManager) {
86
- console.log('[Quotation] IndexDB Manager 已初始化');
87
- } else {
85
+ if (this.dbManager) {} else {
88
86
  console.warn('[Quotation] IndexDB Manager 未找到');
89
87
  }
90
88
  }
@@ -319,27 +317,24 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
319
317
 
320
318
  // 同时清空 IndexDB 中的数据
321
319
  if (!this.dbManager) {
322
- _context5.next = 11;
320
+ _context5.next = 10;
323
321
  break;
324
322
  }
325
323
  _context5.prev = 2;
326
324
  _context5.next = 5;
327
325
  return this.dbManager.clear(INDEXDB_STORE_NAME);
328
326
  case 5:
329
- console.log('[Quotation] IndexDB 缓存已清空');
330
- _context5.next = 11;
327
+ _context5.next = 10;
331
328
  break;
332
- case 8:
333
- _context5.prev = 8;
329
+ case 7:
330
+ _context5.prev = 7;
334
331
  _context5.t0 = _context5["catch"](2);
335
332
  console.error('[Quotation] 清空 IndexDB 缓存失败:', _context5.t0);
336
- case 11:
337
- console.log('[Quotation] 缓存已清空');
338
- case 12:
333
+ case 10:
339
334
  case "end":
340
335
  return _context5.stop();
341
336
  }
342
- }, _callee5, this, [[2, 8]]);
337
+ }, _callee5, this, [[2, 7]]);
343
338
  }));
344
339
  function clear() {
345
340
  return _clear.apply(this, arguments);
@@ -495,18 +490,17 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
495
490
  _context7.next = 8;
496
491
  return Promise.all(savePromises);
497
492
  case 8:
498
- console.log("[Quotation] \u5DF2\u5C06 ".concat(quotationList.length, " \u6761\u62A5\u4EF7\u5355\u6570\u636E\u4FDD\u5B58\u5230 IndexDB"));
499
- _context7.next = 14;
493
+ _context7.next = 13;
500
494
  break;
501
- case 11:
502
- _context7.prev = 11;
495
+ case 10:
496
+ _context7.prev = 10;
503
497
  _context7.t0 = _context7["catch"](2);
504
498
  console.error('[Quotation] 保存数据到 IndexDB 失败:', _context7.t0);
505
- case 14:
499
+ case 13:
506
500
  case "end":
507
501
  return _context7.stop();
508
502
  }
509
- }, _callee7, this, [[2, 11]]);
503
+ }, _callee7, this, [[2, 10]]);
510
504
  }));
511
505
  function saveQuotationToIndexDB(_x5) {
512
506
  return _saveQuotationToIndexDB.apply(this, arguments);
@@ -526,48 +520,45 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
526
520
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
527
521
  while (1) switch (_context8.prev = _context8.next) {
528
522
  case 0:
529
- console.log('[Quotation] 开始预加载数据...');
530
- _context8.prev = 1;
531
- _context8.next = 4;
523
+ _context8.prev = 0;
524
+ _context8.next = 3;
532
525
  return this.loadQuotationFromIndexDB();
533
- case 4:
526
+ case 3:
534
527
  cachedData = _context8.sent;
535
528
  if (!(cachedData && cachedData.length > 0)) {
536
- _context8.next = 10;
529
+ _context8.next = 8;
537
530
  break;
538
531
  }
539
- console.log("[Quotation] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u62A5\u4EF7\u5355\u6570\u636E"));
540
532
  // 将缓存数据放入 store
541
533
  this.store.quotationList = cloneDeep(cachedData);
542
534
  this.core.effects.emit(QuotationHooks.onQuotationChanged, this.store.quotationList);
543
535
  return _context8.abrupt("return");
544
- case 10:
545
- console.log('[Quotation] IndexDB 中没有缓存数据,从服务器加载...');
546
- _context8.next = 16;
536
+ case 8:
537
+ _context8.next = 13;
547
538
  break;
548
- case 13:
549
- _context8.prev = 13;
550
- _context8.t0 = _context8["catch"](1);
539
+ case 10:
540
+ _context8.prev = 10;
541
+ _context8.t0 = _context8["catch"](0);
551
542
  console.warn('[Quotation] 从 IndexDB 加载数据失败:', _context8.t0);
552
- case 16:
553
- _context8.next = 18;
543
+ case 13:
544
+ _context8.next = 15;
554
545
  return this.loadQuotationList();
555
- case 18:
546
+ case 15:
556
547
  quotationList = _context8.sent;
557
548
  if (!(quotationList && quotationList.length > 0)) {
558
- _context8.next = 24;
549
+ _context8.next = 21;
559
550
  break;
560
551
  }
561
- _context8.next = 22;
552
+ _context8.next = 19;
562
553
  return this.saveQuotationToIndexDB(quotationList);
563
- case 22:
554
+ case 19:
564
555
  this.store.quotationList = cloneDeep(quotationList);
565
556
  this.core.effects.emit(QuotationHooks.onQuotationChanged, this.store.quotationList);
566
- case 24:
557
+ case 21:
567
558
  case "end":
568
559
  return _context8.stop();
569
560
  }
570
- }, _callee8, this, [[1, 13]]);
561
+ }, _callee8, this, [[0, 10]]);
571
562
  }));
572
563
  function preload() {
573
564
  return _preload.apply(this, arguments);
@@ -149,41 +149,49 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
149
149
  while (1) switch (_context2.prev = _context2.next) {
150
150
  case 0:
151
151
  _context2.next = 2;
152
- return this.setupResourceSync();
153
- case 2:
154
- _context2.next = 4;
155
152
  return this.loadResourcesFromSQLite();
156
- case 4:
153
+ case 2:
157
154
  cachedResources = _context2.sent;
158
155
  if (!(cachedResources.length > 0)) {
159
- _context2.next = 12;
156
+ _context2.next = 10;
160
157
  break;
161
158
  }
162
159
  this.store.list = cloneDeep(cachedResources).map(function (item) {
163
160
  return _this3.normalizeResource(item);
164
161
  });
165
162
  this.syncResourcesMap();
166
- _context2.next = 10;
163
+ _context2.next = 8;
167
164
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
165
+ case 8:
166
+ // 二次启动优先使用 SQLite。pubsub 注册及远端校准继续在后台执行,
167
+ // setupResourceSync 完成后会合并最新数据并回写 SQLite。
168
+ void this.setupResourceSync().catch(function (error) {
169
+ _this3.logError('后台初始化资源同步失败', error);
170
+ });
171
+ return _context2.abrupt("return");
168
172
  case 10:
169
- _context2.next = 20;
170
- break;
173
+ _context2.next = 12;
174
+ return this.setupResourceSync();
171
175
  case 12:
172
- _context2.next = 14;
176
+ if (!(this.store.list.length === 0)) {
177
+ _context2.next = 21;
178
+ break;
179
+ }
180
+ _context2.next = 15;
173
181
  return this.loadResourcesByServer();
174
- case 14:
182
+ case 15:
175
183
  resources = _context2.sent;
176
184
  if (!(resources.length > 0)) {
177
- _context2.next = 20;
185
+ _context2.next = 21;
178
186
  break;
179
187
  }
180
188
  this.store.list = cloneDeep(resources).map(function (item) {
181
189
  return _this3.normalizeResource(item);
182
190
  });
183
191
  this.syncResourcesMap();
184
- _context2.next = 20;
192
+ _context2.next = 21;
185
193
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
186
- case 20:
194
+ case 21:
187
195
  case "end":
188
196
  return _context2.stop();
189
197
  }
@@ -790,17 +798,16 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
790
798
  });
791
799
  case 4:
792
800
  result = _context8.sent;
793
- console.log('result', result);
794
801
  this.logInfo('setupResourceSync: 资源列表查询结果', {
795
802
  result: result
796
803
  });
797
804
  if (!(result !== null && result !== void 0 && (_result$data = result.data) !== null && _result$data !== void 0 && (_result$data = _result$data.list) !== null && _result$data !== void 0 && _result$data.length)) {
798
- _context8.next = 10;
805
+ _context8.next = 9;
799
806
  break;
800
807
  }
801
- _context8.next = 10;
808
+ _context8.next = 9;
802
809
  return this.mergeResourcesToStore(result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.list);
803
- case 10:
810
+ case 9:
804
811
  case "end":
805
812
  return _context8.stop();
806
813
  }
@@ -157,9 +157,7 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
157
157
  app = appPlugin.getApp();
158
158
  this.dbManager = app.sqlite;
159
159
  this.logger = app.logger;
160
- if (this.dbManager) {
161
- console.log('[Schedule] SQLite 已初始化');
162
- } else {
160
+ if (this.dbManager) {} else {
163
161
  console.warn('[Schedule] SQLite 未找到');
164
162
  }
165
163
  }
@@ -323,7 +321,6 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
323
321
  } finally {
324
322
  _iterator2.f();
325
323
  }
326
- console.log("[Schedule] Map \u7F13\u5B58\u5DF2\u540C\u6B65\uFF0C\u5171 ".concat(this.store.map.size, " \u4E2A\u65E5\u7A0B"));
327
324
  }
328
325
 
329
326
  /**
@@ -344,32 +341,31 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
344
341
  this.store.map.clear();
345
342
  // 同时清空 SQLite 中的数据
346
343
  if (!this.dbManager) {
347
- _context3.next = 16;
344
+ _context3.next = 15;
348
345
  break;
349
346
  }
350
347
  _context3.prev = 4;
351
348
  _context3.next = 7;
352
349
  return this.dbManager.clear(SCHEDULE_STORE_NAME);
353
350
  case 7:
354
- console.log('[Schedule] SQLite 缓存已清空');
355
351
  this.logInfo('SQLite 缓存已清空');
356
- _context3.next = 16;
352
+ _context3.next = 15;
357
353
  break;
358
- case 11:
359
- _context3.prev = 11;
354
+ case 10:
355
+ _context3.prev = 10;
360
356
  _context3.t0 = _context3["catch"](4);
361
357
  errorMessage = _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0);
362
358
  console.error('[Schedule] 清空 SQLite 缓存失败:', _context3.t0);
363
359
  this.logError('清空 SQLite 缓存失败', {
364
360
  error: errorMessage
365
361
  });
366
- case 16:
362
+ case 15:
367
363
  this.logInfo('缓存清空完成');
368
- case 17:
364
+ case 16:
369
365
  case "end":
370
366
  return _context3.stop();
371
367
  }
372
- }, _callee3, this, [[4, 11]]);
368
+ }, _callee3, this, [[4, 10]]);
373
369
  }));
374
370
  function clear() {
375
371
  return _clear.apply(this, arguments);
@@ -509,14 +505,13 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
509
505
  return _this4.dbManager.add(SCHEDULE_STORE_NAME, schedule);
510
506
  }));
511
507
  case 20:
512
- console.log("[Schedule] \u5DF2\u5C06 ".concat(scheduleList.length, " \u6761\u65E5\u7A0B\u6570\u636E\u4FDD\u5B58\u5230 SQLite"));
513
508
  this.logInfo('日程数据已保存到 SQLite', {
514
509
  scheduleCount: scheduleList.length
515
510
  });
516
- _context5.next = 29;
511
+ _context5.next = 28;
517
512
  break;
518
- case 24:
519
- _context5.prev = 24;
513
+ case 23:
514
+ _context5.prev = 23;
520
515
  _context5.t0 = _context5["catch"](4);
521
516
  errorMessage = _context5.t0 instanceof Error ? _context5.t0.message : String(_context5.t0);
522
517
  console.error('[Schedule] 保存数据到 SQLite 失败:', _context5.t0);
@@ -524,11 +519,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
524
519
  scheduleCount: scheduleList.length,
525
520
  error: errorMessage
526
521
  });
527
- case 29:
522
+ case 28:
528
523
  case "end":
529
524
  return _context5.stop();
530
525
  }
531
- }, _callee5, this, [[4, 24]]);
526
+ }, _callee5, this, [[4, 23]]);
532
527
  }));
533
528
  function saveScheduleToSQLite(_x3) {
534
529
  return _saveScheduleToSQLite.apply(this, arguments);
@@ -548,19 +543,17 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
548
543
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
549
544
  while (1) switch (_context6.prev = _context6.next) {
550
545
  case 0:
551
- console.log('[Schedule] 开始预加载数据...');
552
546
  startTime = Date.now();
553
547
  this.logInfo('开始预加载数据');
554
- _context6.prev = 3;
555
- _context6.next = 6;
548
+ _context6.prev = 2;
549
+ _context6.next = 5;
556
550
  return this.loadScheduleFromSQLite();
557
- case 6:
551
+ case 5:
558
552
  cachedData = _context6.sent;
559
553
  if (!(cachedData && cachedData.length > 0)) {
560
- _context6.next = 14;
554
+ _context6.next = 12;
561
555
  break;
562
556
  }
563
- console.log("[Schedule] \u4ECE SQLite \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u6761\u65E5\u7A0B\u6570\u636E"));
564
557
  // 将缓存数据放入 store
565
558
  this.store.scheduleList = cloneDeep(cachedData);
566
559
  // 同步更新 Map 缓存
@@ -572,23 +565,22 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
572
565
  source: 'SQLite'
573
566
  });
574
567
  return _context6.abrupt("return");
575
- case 14:
576
- console.log('[Schedule] SQLite 中没有缓存数据,从服务器加载...');
568
+ case 12:
577
569
  this.logInfo('SQLite 中没有缓存数据,准备从服务器加载');
578
- _context6.next = 23;
570
+ _context6.next = 20;
579
571
  break;
580
- case 18:
581
- _context6.prev = 18;
582
- _context6.t0 = _context6["catch"](3);
572
+ case 15:
573
+ _context6.prev = 15;
574
+ _context6.t0 = _context6["catch"](2);
583
575
  errorMessage = _context6.t0 instanceof Error ? _context6.t0.message : String(_context6.t0);
584
576
  console.warn('[Schedule] 从 SQLite 加载数据失败:', _context6.t0);
585
577
  this.logWarning('从 SQLite 加载数据失败,准备从服务器加载', {
586
578
  error: errorMessage
587
579
  });
588
- case 23:
589
- _context6.next = 25;
580
+ case 20:
581
+ _context6.next = 22;
590
582
  return this.loadAllSchedule();
591
- case 25:
583
+ case 22:
592
584
  scheduleList = _context6.sent;
593
585
  // 3. 将服务器数据放入 store
594
586
  if (scheduleList && scheduleList.length > 0) {
@@ -607,11 +599,11 @@ export var ScheduleModuleEx = /*#__PURE__*/function (_BaseModule) {
607
599
  duration: "".concat(_duration3, "ms")
608
600
  });
609
601
  }
610
- case 27:
602
+ case 24:
611
603
  case "end":
612
604
  return _context6.stop();
613
605
  }
614
- }, _callee6, this, [[3, 18]]);
606
+ }, _callee6, this, [[2, 15]]);
615
607
  }));
616
608
  function preload() {
617
609
  return _preload.apply(this, arguments);
@@ -82,7 +82,6 @@ function buildPriceIndexMap(priceData) {
82
82
  export function applyPriceDataToProducts(products, priceData) {
83
83
  var t0 = performance.now();
84
84
  if (!priceData || priceData.length === 0) {
85
- console.log('[applyPriceDataToProducts] 没有价格数据,返回原商品');
86
85
  return products;
87
86
  }
88
87
  var t1 = performance.now();
@@ -2272,11 +2272,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2272
2272
  });
2273
2273
  case 40:
2274
2274
  if (!rulesModule) {
2275
- _context21.next = 77;
2275
+ _context21.next = 76;
2276
2276
  break;
2277
2277
  }
2278
2278
  orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
2279
- console.log('[BaseSales.applyDiscountConfig.calcDiscount]');
2280
2279
  result = rulesModule.calcDiscount({
2281
2280
  productList: tempOrder.products,
2282
2281
  discountList: nextDiscountList,
@@ -2293,22 +2292,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2293
2292
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
2294
2293
  }
2295
2294
  _iterator2 = _createForOfIteratorHelper(tempOrder.products || []);
2296
- _context21.prev = 46;
2295
+ _context21.prev = 45;
2297
2296
  _iterator2.s();
2298
- case 48:
2297
+ case 47:
2299
2298
  if ((_step2 = _iterator2.n()).done) {
2300
- _context21.next = 63;
2299
+ _context21.next = 62;
2301
2300
  break;
2302
2301
  }
2303
2302
  product = _step2.value;
2304
2303
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
2305
2304
  runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
2306
2305
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
2307
- _context21.next = 54;
2306
+ _context21.next = 53;
2308
2307
  break;
2309
2308
  }
2310
- return _context21.abrupt("continue", 61);
2311
- case 54:
2309
+ return _context21.abrupt("continue", 60);
2310
+ case 53:
2312
2311
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2313
2312
  return sum + Number(pd.amount || 0);
2314
2313
  }, 0);
@@ -2324,59 +2323,59 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2324
2323
  mainPrice: newMainSellingPrice,
2325
2324
  bundle: product.product_bundle
2326
2325
  });
2327
- case 61:
2328
- _context21.next = 48;
2326
+ case 60:
2327
+ _context21.next = 47;
2329
2328
  break;
2330
- case 63:
2331
- _context21.next = 68;
2329
+ case 62:
2330
+ _context21.next = 67;
2332
2331
  break;
2333
- case 65:
2334
- _context21.prev = 65;
2335
- _context21.t0 = _context21["catch"](46);
2332
+ case 64:
2333
+ _context21.prev = 64;
2334
+ _context21.t0 = _context21["catch"](45);
2336
2335
  _iterator2.e(_context21.t0);
2337
- case 68:
2338
- _context21.prev = 68;
2336
+ case 67:
2337
+ _context21.prev = 67;
2339
2338
  _iterator2.f();
2340
- return _context21.finish(68);
2341
- case 71:
2339
+ return _context21.finish(67);
2340
+ case 70:
2342
2341
  if (!result.discountList) {
2343
- _context21.next = 77;
2342
+ _context21.next = 76;
2344
2343
  break;
2345
2344
  }
2346
2345
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
2347
2346
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2348
- _context21.next = 76;
2347
+ _context21.next = 75;
2349
2348
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2350
- case 76:
2349
+ case 75:
2351
2350
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
2352
2351
  return discount.isSelected;
2353
2352
  });
2354
- case 77:
2355
- _context21.next = 79;
2353
+ case 76:
2354
+ _context21.next = 78;
2356
2355
  return this.store.order.recalculateSummary({
2357
2356
  createIfMissing: true
2358
2357
  });
2359
- case 79:
2358
+ case 78:
2360
2359
  summary = _context21.sent;
2361
2360
  this.store.order.persistTempOrder();
2362
- _context21.next = 83;
2361
+ _context21.next = 82;
2363
2362
  return this.effectsEmit('onDiscountApplied', {
2364
2363
  productList: tempOrder.products || [],
2365
2364
  discountList: nextDiscountList,
2366
2365
  selectedDiscountList: tempOrder.discount_list || [],
2367
2366
  tempOrder: tempOrder
2368
2367
  });
2369
- case 83:
2368
+ case 82:
2370
2369
  return _context21.abrupt("return", {
2371
2370
  productList: tempOrder.products || [],
2372
2371
  discountList: nextDiscountList,
2373
2372
  availableWalletIds: this.getAvailableWalletIds()
2374
2373
  });
2375
- case 84:
2374
+ case 83:
2376
2375
  case "end":
2377
2376
  return _context21.stop();
2378
2377
  }
2379
- }, _callee21, this, [[46, 65, 68, 71]]);
2378
+ }, _callee21, this, [[45, 64, 67, 70]]);
2380
2379
  }));
2381
2380
  function loadDiscountConfig(_x16) {
2382
2381
  return _loadDiscountConfig.apply(this, arguments);
@@ -2420,11 +2419,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2420
2419
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2421
2420
  case 12:
2422
2421
  if (!rulesModule) {
2423
- _context22.next = 24;
2422
+ _context22.next = 23;
2424
2423
  break;
2425
2424
  }
2426
2425
  orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
2427
- console.log('[BaseSales.bestDiscount.calcDiscount]');
2428
2426
  result = rulesModule.calcDiscount({
2429
2427
  productList: tempOrder.products,
2430
2428
  discountList: nextDiscountList,
@@ -2438,14 +2436,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2438
2436
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
2439
2437
  }
2440
2438
  if (!result.discountList) {
2441
- _context22.next = 24;
2439
+ _context22.next = 23;
2442
2440
  break;
2443
2441
  }
2444
2442
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
2445
2443
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2446
- _context22.next = 22;
2444
+ _context22.next = 21;
2447
2445
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2448
- case 22:
2446
+ case 21:
2449
2447
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
2450
2448
  return discount.isSelected;
2451
2449
  });
@@ -2453,24 +2451,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2453
2451
  productList: tempOrder.products,
2454
2452
  discountList: nextDiscountList
2455
2453
  };
2456
- case 24:
2457
- _context22.next = 26;
2454
+ case 23:
2455
+ _context22.next = 25;
2458
2456
  return this.store.order.recalculateSummary({
2459
2457
  createIfMissing: true
2460
2458
  });
2461
- case 26:
2459
+ case 25:
2462
2460
  this.store.order.persistTempOrder();
2463
- _context22.next = 29;
2461
+ _context22.next = 28;
2464
2462
  return this.effectsEmit('onDiscountApplied', {
2465
2463
  productList: tempOrder.products || [],
2466
2464
  discountList: nextDiscountList,
2467
2465
  selectedDiscountList: tempOrder.discount_list || [],
2468
2466
  tempOrder: tempOrder
2469
2467
  });
2470
- case 29:
2468
+ case 28:
2471
2469
  cb === null || cb === void 0 || cb(result);
2472
2470
  return _context22.abrupt("return", result);
2473
- case 31:
2471
+ case 30:
2474
2472
  case "end":
2475
2473
  return _context22.stop();
2476
2474
  }
@@ -2639,7 +2637,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2639
2637
  case 13:
2640
2638
  if (rulesModule) {
2641
2639
  orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
2642
- console.log('[BaseSales.setDiscountSelected.calcDiscount]');
2643
2640
  result = rulesModule.calcDiscount({
2644
2641
  productList: tempOrder.products,
2645
2642
  discountList: updated,
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 5 | 2 | 4 | 3 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;