@pisell/pisellos 0.10.15 → 0.10.17
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.
- package/dist/core/index.js +6 -9
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +2 -4
- package/dist/modules/OpenData/index.d.ts +5 -2
- package/dist/modules/OpenData/index.js +27 -14
- package/dist/modules/OpenData/types.d.ts +42 -0
- package/dist/modules/OpenData/types.js +7 -1
- package/dist/modules/OpenData/utils.d.ts +15 -1
- package/dist/modules/OpenData/utils.js +85 -0
- package/dist/modules/Order/index.d.ts +4 -2
- package/dist/modules/Order/index.js +131 -123
- package/dist/modules/Order/types.d.ts +8 -1
- package/dist/modules/Order/types.js +1 -0
- package/dist/modules/Order/utils.js +7 -1
- package/dist/modules/Payment/index.js +97 -162
- package/dist/modules/Product/types.d.ts +2 -0
- package/dist/modules/ProductList/index.js +96 -74
- package/dist/modules/Rules/index.js +12 -12
- package/dist/modules/SalesSummary/index.js +6 -4
- package/dist/modules/Schedule/index.js +0 -1
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.d.ts +11 -0
- package/dist/server/index.js +977 -641
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/order/index.d.ts +8 -0
- package/dist/server/modules/order/index.js +253 -219
- package/dist/server/modules/products/index.js +24 -42
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +27 -35
- package/dist/server/utils/product.js +0 -1
- package/dist/server/utils/small-ticket.d.ts +9 -1
- package/dist/server/utils/small-ticket.js +117 -43
- package/dist/solution/BaseSales/index.d.ts +7 -0
- package/dist/solution/BaseSales/index.js +350 -215
- package/dist/solution/BaseSales/types.d.ts +2 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +15 -6
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +7 -1
- package/dist/solution/BaseSales/utils.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +14 -19
- package/dist/solution/BookingTicket/index.js +553 -433
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -1
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +6 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -252
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/Sales/index.d.ts +20 -4
- package/dist/solution/Sales/index.js +348 -75
- package/dist/solution/Sales/types.d.ts +10 -0
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ScanOrder/types.d.ts +2 -0
- package/dist/solution/ScanOrder/utils.js +6 -3
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +495 -422
- package/dist/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/dist/solution/VenueBooking/index.js +45 -55
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +131 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +82 -49
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +209 -315
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +91 -69
- package/lib/model/strategy/adapter/promotion/evaluator.js +444 -310
- package/lib/model/strategy/adapter/promotion/examples.js +222 -234
- package/lib/model/strategy/adapter/promotion/index.js +1 -51
- package/lib/model/strategy/adapter/promotion/type.js +243 -36
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -150
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +588 -378
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +23 -42
- package/lib/modules/BookingContext/index.js +158 -136
- package/lib/modules/BookingContext/types.js +46 -32
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +138 -146
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +78 -83
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +170 -150
- package/lib/modules/BookingContext/utils/flexible.js +38 -55
- package/lib/modules/BookingContext/utils/formatResourceList.js +19 -34
- package/lib/modules/BookingContext/utils/index.js +124 -41
- package/lib/modules/BookingContext/utils/noResource.js +58 -70
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +14 -41
- package/lib/modules/BookingContext/utils/productExtend.js +202 -155
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +19 -41
- package/lib/modules/BookingContext/utils/resources.js +209 -167
- package/lib/modules/BookingContext/utils/serviceTimes.js +115 -116
- package/lib/modules/BookingContext/utils/timeSlices.js +76 -86
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +321 -251
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +70 -78
- package/lib/modules/Cart/utils/changePrice.js +22 -50
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +235 -172
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +133 -143
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.d.ts +5 -2
- package/lib/modules/OpenData/index.js +119 -78
- package/lib/modules/OpenData/types.d.ts +42 -0
- package/lib/modules/OpenData/types.js +12 -16
- package/lib/modules/OpenData/utils.d.ts +15 -1
- package/lib/modules/OpenData/utils.js +129 -78
- package/lib/modules/Order/index.d.ts +4 -2
- package/lib/modules/Order/index.js +1843 -2251
- package/lib/modules/Order/payment-utils.js +77 -120
- package/lib/modules/Order/types.d.ts +8 -1
- package/lib/modules/Order/types.js +88 -35
- package/lib/modules/Order/utils/bundleDiscountHydration.js +41 -74
- package/lib/modules/Order/utils/discountProductLineIdentity.js +142 -100
- package/lib/modules/Order/utils/manualProductDiscount.js +124 -123
- package/lib/modules/Order/utils/orderCollectionIdentity.js +184 -244
- package/lib/modules/Order/utils/virtualSettlement.js +120 -171
- package/lib/modules/Order/utils.js +834 -668
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +532 -399
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +230 -108
- package/lib/modules/Payment/utils.js +52 -51
- package/lib/modules/Payment/walletpass.js +485 -660
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.d.ts +2 -0
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +141 -161
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +66 -100
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.js +25 -23
- package/lib/modules/ResourcePlanner/localClock.js +54 -119
- package/lib/modules/ResourcePlanner/planner.js +591 -772
- package/lib/modules/ResourcePlanner/types.js +10 -29
- package/lib/modules/Rules/index.js +1224 -963
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +80 -89
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +359 -442
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -163
- package/lib/modules/Schedule/index.js +100 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -71
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +773 -418
- package/lib/modules/SurchargeList/index.js +46 -60
- package/lib/modules/SurchargeList/types.js +4 -16
- package/lib/modules/index.js +245 -63
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.d.ts +11 -0
- package/lib/server/index.js +3432 -2757
- package/lib/server/modules/floor-plan/index.js +102 -123
- package/lib/server/modules/floor-plan/types.js +15 -30
- package/lib/server/modules/index.js +106 -68
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.d.ts +8 -0
- package/lib/server/modules/order/index.js +781 -956
- package/lib/server/modules/order/types.js +122 -33
- package/lib/server/modules/order/utils/filterBookings.js +219 -194
- package/lib/server/modules/order/utils/filterOrders.js +118 -92
- package/lib/server/modules/payment/index.js +59 -83
- package/lib/server/modules/payment/types.js +4 -16
- package/lib/server/modules/products/index.js +575 -459
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.js +137 -172
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +213 -184
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +135 -123
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.d.ts +9 -1
- package/lib/server/utils/small-ticket.js +565 -470
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.d.ts +7 -0
- package/lib/solution/BaseSales/index.js +1385 -1503
- package/lib/solution/BaseSales/types.d.ts +2 -0
- package/lib/solution/BaseSales/types.js +42 -38
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +5 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +652 -498
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +85 -105
- package/lib/solution/BaseSales/utils/quotationPrice.js +56 -114
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +138 -180
- package/lib/solution/BaseSales/utils.js +161 -143
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingByStep/index.js +1527 -1340
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +14 -19
- package/lib/solution/BookingTicket/index.js +663 -526
- package/lib/solution/BookingTicket/types.js +99 -77
- package/lib/solution/BookingTicket/utils/addProductDecision.js +229 -190
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +58 -89
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -78
- package/lib/solution/BookingTicket/utils/cartView.js +114 -99
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +18 -41
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +219 -86
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +168 -116
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +79 -91
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +54 -41
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +98 -104
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +52 -64
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +56 -58
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +34 -48
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -156
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.d.ts +20 -4
- package/lib/solution/Sales/index.js +502 -330
- package/lib/solution/Sales/types.d.ts +10 -0
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +822 -852
- package/lib/solution/ScanOrder/types.d.ts +2 -0
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.js +412 -374
- package/lib/solution/ShopDiscount/index.js +226 -232
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +300 -172
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +1087 -1222
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
- package/lib/solution/UnifiedBookingSales/types.d.ts +7 -1
- package/lib/solution/UnifiedBookingSales/types.js +10 -32
- package/lib/solution/VenueBooking/index.js +811 -879
- package/lib/solution/VenueBooking/types.js +19 -39
- package/lib/solution/VenueBooking/utils/dateSummary.js +27 -56
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +94 -107
- package/lib/solution/VenueBooking/utils/timeSlot.js +132 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +124 -41
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/payment-number.js +26 -46
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -124,9 +124,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
124
124
|
app = appPlugin.getApp();
|
|
125
125
|
this.dbManager = app.dbManager;
|
|
126
126
|
this.logger = app.logger;
|
|
127
|
-
if (this.dbManager) {
|
|
128
|
-
console.log('[Products] IndexDB Manager 已初始化');
|
|
129
|
-
} else {
|
|
127
|
+
if (this.dbManager) {} else {
|
|
130
128
|
console.warn('[Products] IndexDB Manager 未找到');
|
|
131
129
|
}
|
|
132
130
|
}
|
|
@@ -847,14 +845,13 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
847
845
|
_context7.prev = 29;
|
|
848
846
|
_context7.t0 = _context7["catch"](4);
|
|
849
847
|
errorMessage = _context7.t0 instanceof Error ? _context7.t0.message : String(_context7.t0);
|
|
850
|
-
console.log("[ProductsModule] \uD83C\uDF10 ERROR", _context7.t0);
|
|
851
848
|
this.logError('prepareProductsWithPrice 处理失败', {
|
|
852
849
|
schedule_date: schedule_date,
|
|
853
850
|
error: errorMessage
|
|
854
851
|
});
|
|
855
|
-
case
|
|
852
|
+
case 33:
|
|
856
853
|
return _context7.abrupt("return", []);
|
|
857
|
-
case
|
|
854
|
+
case 34:
|
|
858
855
|
case "end":
|
|
859
856
|
return _context7.stop();
|
|
860
857
|
}
|
|
@@ -1083,10 +1080,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1083
1080
|
// 创建 legacy 报价单格式化器
|
|
1084
1081
|
var legacyPriceFormatter = function legacyPriceFormatter(products, context) {
|
|
1085
1082
|
if (!context.priceData || context.priceData.length === 0) {
|
|
1086
|
-
console.log('[ProductsModule] 💰 没有价格数据,跳过 legacy 报价单价格应用');
|
|
1087
1083
|
return products;
|
|
1088
1084
|
}
|
|
1089
|
-
console.log("[ProductsModule] \uD83D\uDCB0 \u5E94\u7528 legacy \u62A5\u4EF7\u5355\u4EF7\u683C\u5230 ".concat(products.length, " \u4E2A\u5546\u54C1"));
|
|
1090
1085
|
return applyPriceDataToProducts(products, context.priceData);
|
|
1091
1086
|
};
|
|
1092
1087
|
var i18nFormatter = function i18nFormatter(products, context) {
|
|
@@ -1102,7 +1097,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1102
1097
|
this.formatters.push(i18nFormatter);
|
|
1103
1098
|
this.formatters.push(detailValueFormatter);
|
|
1104
1099
|
this.isBuiltinFormatterRegistered = true;
|
|
1105
|
-
console.log('[ProductsModule] ✅ 内置商品格式化器已注册(智能定价优先)');
|
|
1106
1100
|
}
|
|
1107
1101
|
|
|
1108
1102
|
/**
|
|
@@ -1150,11 +1144,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1150
1144
|
// 插入到内置智能定价格式化器之后;legacy 报价单启用时需跳过它。
|
|
1151
1145
|
var insertIndex = this.isBuiltinFormatterRegistered ? this.isLegacyPriceFormatterEnabled ? 2 : 1 : 0;
|
|
1152
1146
|
this.formatters.splice(insertIndex, 0, formatter);
|
|
1153
|
-
console.log("[ProductsModule] \uD83D\uDCCC \u5DF2\u5728\u4F4D\u7F6E ".concat(insertIndex + 1, " \u63D2\u5165\u683C\u5F0F\u5316\u5668\uFF0C\u5F53\u524D\u5171 ").concat(this.formatters.length, " \u4E2A"));
|
|
1154
1147
|
} else {
|
|
1155
1148
|
// 追加到末尾
|
|
1156
1149
|
this.formatters.push(formatter);
|
|
1157
|
-
console.log("[ProductsModule] \uD83D\uDCCC \u5DF2\u6CE8\u518C\u683C\u5F0F\u5316\u5668\uFF0C\u5F53\u524D\u5171 ".concat(this.formatters.length, " \u4E2A"));
|
|
1158
1150
|
}
|
|
1159
1151
|
}
|
|
1160
1152
|
|
|
@@ -1170,11 +1162,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1170
1162
|
// 保留 legacy 兜底(如果启用)和智能定价格式化器。
|
|
1171
1163
|
var builtinCount = this.isLegacyPriceFormatterEnabled ? 2 : 1;
|
|
1172
1164
|
this.formatters = this.formatters.slice(0, builtinCount);
|
|
1173
|
-
console.log('[ProductsModule] 🧹 已清空自定义格式化器,保留内置智能定价格式化器');
|
|
1174
1165
|
} else {
|
|
1175
1166
|
this.formatters = [];
|
|
1176
1167
|
this.isBuiltinFormatterRegistered = false;
|
|
1177
|
-
console.log('[ProductsModule] 🧹 已清空所有格式化器');
|
|
1178
1168
|
}
|
|
1179
1169
|
}
|
|
1180
1170
|
|
|
@@ -1190,7 +1180,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1190
1180
|
var keys = Array.from(this.productsPriceCache.keys());
|
|
1191
1181
|
var oldestKey = keys[0];
|
|
1192
1182
|
this.productsPriceCache.delete(oldestKey);
|
|
1193
|
-
console.log("[ProductsModule] \uD83E\uDDF9 \u6E05\u7406\u8FC7\u671F\u5546\u54C1\u4EF7\u683C\u7F13\u5B58: ".concat(oldestKey));
|
|
1194
1183
|
}
|
|
1195
1184
|
}
|
|
1196
1185
|
|
|
@@ -1202,7 +1191,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1202
1191
|
key: "clearPriceCache",
|
|
1203
1192
|
value: function clearPriceCache() {
|
|
1204
1193
|
this.productsPriceCache.clear();
|
|
1205
|
-
console.log('[ProductsModule] 🗑️ 商品价格缓存已清空');
|
|
1206
1194
|
}
|
|
1207
1195
|
|
|
1208
1196
|
/**
|
|
@@ -1714,33 +1702,31 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1714
1702
|
|
|
1715
1703
|
// 同时清空 IndexDB 中的所有数据(包括商品和元数据)
|
|
1716
1704
|
if (!this.dbManager) {
|
|
1717
|
-
_context17.next =
|
|
1705
|
+
_context17.next = 15;
|
|
1718
1706
|
break;
|
|
1719
1707
|
}
|
|
1720
1708
|
_context17.prev = 4;
|
|
1721
1709
|
_context17.next = 7;
|
|
1722
1710
|
return this.dbManager.clear(INDEXDB_STORE_NAME);
|
|
1723
1711
|
case 7:
|
|
1724
|
-
console.log('[Products] IndexDB 缓存已清空');
|
|
1725
1712
|
this.logInfo('IndexDB 缓存已清空');
|
|
1726
|
-
_context17.next =
|
|
1713
|
+
_context17.next = 15;
|
|
1727
1714
|
break;
|
|
1728
|
-
case
|
|
1729
|
-
_context17.prev =
|
|
1715
|
+
case 10:
|
|
1716
|
+
_context17.prev = 10;
|
|
1730
1717
|
_context17.t0 = _context17["catch"](4);
|
|
1731
1718
|
errorMessage = _context17.t0 instanceof Error ? _context17.t0.message : String(_context17.t0);
|
|
1732
1719
|
console.error('[Products] 清空 IndexDB 缓存失败:', _context17.t0);
|
|
1733
1720
|
this.logError('清空 IndexDB 缓存失败', {
|
|
1734
1721
|
error: errorMessage
|
|
1735
1722
|
});
|
|
1736
|
-
case
|
|
1737
|
-
console.log('[Products] 缓存已清空');
|
|
1723
|
+
case 15:
|
|
1738
1724
|
this.logInfo('缓存清空完成');
|
|
1739
|
-
case
|
|
1725
|
+
case 16:
|
|
1740
1726
|
case "end":
|
|
1741
1727
|
return _context17.stop();
|
|
1742
1728
|
}
|
|
1743
|
-
}, _callee17, this, [[4,
|
|
1729
|
+
}, _callee17, this, [[4, 10]]);
|
|
1744
1730
|
}));
|
|
1745
1731
|
function clear() {
|
|
1746
1732
|
return _clear.apply(this, arguments);
|
|
@@ -2080,23 +2066,21 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2080
2066
|
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2081
2067
|
while (1) switch (_context24.prev = _context24.next) {
|
|
2082
2068
|
case 0:
|
|
2083
|
-
console.log('[Products] 开始预加载数据...');
|
|
2084
2069
|
tTotal = performance.now();
|
|
2085
2070
|
this.logInfo('开始预加载数据');
|
|
2086
|
-
_context24.prev =
|
|
2071
|
+
_context24.prev = 2;
|
|
2087
2072
|
tIndexDB = performance.now();
|
|
2088
|
-
_context24.next =
|
|
2073
|
+
_context24.next = 6;
|
|
2089
2074
|
return this.loadProductsFromIndexDB();
|
|
2090
|
-
case
|
|
2075
|
+
case 6:
|
|
2091
2076
|
cachedData = _context24.sent;
|
|
2092
2077
|
perfMark('preload.loadFromIndexDB', performance.now() - tIndexDB, {
|
|
2093
2078
|
count: (_cachedData$length = cachedData === null || cachedData === void 0 ? void 0 : cachedData.length) !== null && _cachedData$length !== void 0 ? _cachedData$length : 0
|
|
2094
2079
|
});
|
|
2095
2080
|
if (!(cachedData && cachedData.length > 0)) {
|
|
2096
|
-
_context24.next =
|
|
2081
|
+
_context24.next = 18;
|
|
2097
2082
|
break;
|
|
2098
2083
|
}
|
|
2099
|
-
console.log("[Products] \u4ECE IndexDB \u52A0\u8F7D\u4E86 ".concat(cachedData.length, " \u4E2A\u5546\u54C1"));
|
|
2100
2084
|
// IndexDB 反序列化的数据已经是全新的,无需 cloneDeep
|
|
2101
2085
|
this.store.list = cachedData;
|
|
2102
2086
|
tSync = performance.now();
|
|
@@ -2116,24 +2100,23 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2116
2100
|
});
|
|
2117
2101
|
this.lastPreloadCompletedAtMs = Date.now();
|
|
2118
2102
|
return _context24.abrupt("return");
|
|
2119
|
-
case
|
|
2120
|
-
console.log('[Products] IndexDB 中没有缓存数据,从服务器加载...');
|
|
2103
|
+
case 18:
|
|
2121
2104
|
this.logInfo('IndexDB 中没有缓存数据,准备从服务器加载');
|
|
2122
|
-
_context24.next =
|
|
2105
|
+
_context24.next = 26;
|
|
2123
2106
|
break;
|
|
2124
|
-
case
|
|
2125
|
-
_context24.prev =
|
|
2126
|
-
_context24.t0 = _context24["catch"](
|
|
2107
|
+
case 21:
|
|
2108
|
+
_context24.prev = 21;
|
|
2109
|
+
_context24.t0 = _context24["catch"](2);
|
|
2127
2110
|
errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : String(_context24.t0);
|
|
2128
2111
|
console.warn('[Products] 从 IndexDB 加载数据失败:', _context24.t0);
|
|
2129
2112
|
this.logWarning('从 IndexDB 加载数据失败,准备从服务器加载', {
|
|
2130
2113
|
error: errorMessage
|
|
2131
2114
|
});
|
|
2132
|
-
case
|
|
2115
|
+
case 26:
|
|
2133
2116
|
tServer = performance.now();
|
|
2134
|
-
_context24.next =
|
|
2117
|
+
_context24.next = 29;
|
|
2135
2118
|
return this.loadProductsByServer();
|
|
2136
|
-
case
|
|
2119
|
+
case 29:
|
|
2137
2120
|
products = _context24.sent;
|
|
2138
2121
|
perfMark('preload.loadFromServer', performance.now() - tServer, {
|
|
2139
2122
|
count: (_products$length3 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length3 !== void 0 ? _products$length3 : 0
|
|
@@ -2165,11 +2148,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2165
2148
|
duration: "".concat(Math.round(performance.now() - tTotal), "ms")
|
|
2166
2149
|
});
|
|
2167
2150
|
}
|
|
2168
|
-
case
|
|
2151
|
+
case 32:
|
|
2169
2152
|
case "end":
|
|
2170
2153
|
return _context24.stop();
|
|
2171
2154
|
}
|
|
2172
|
-
}, _callee24, this, [[
|
|
2155
|
+
}, _callee24, this, [[2, 21]]);
|
|
2173
2156
|
}));
|
|
2174
2157
|
function preload() {
|
|
2175
2158
|
return _preload.apply(this, arguments);
|
|
@@ -2213,7 +2196,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2213
2196
|
return function (message) {
|
|
2214
2197
|
var data = (message === null || message === void 0 ? void 0 : message.data) || message;
|
|
2215
2198
|
if (!data) return;
|
|
2216
|
-
console.log("[ProductsModule] \u6536\u5230\u540C\u6B65\u6D88\u606F [".concat(channelKey, "]:"), data);
|
|
2217
2199
|
_this11.logInfo('收到同步消息', {
|
|
2218
2200
|
channelKey: channelKey,
|
|
2219
2201
|
action: data.action,
|
|
@@ -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 =
|
|
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
|
-
|
|
330
|
-
_context5.next = 11;
|
|
327
|
+
_context5.next = 10;
|
|
331
328
|
break;
|
|
332
|
-
case
|
|
333
|
-
_context5.prev =
|
|
329
|
+
case 7:
|
|
330
|
+
_context5.prev = 7;
|
|
334
331
|
_context5.t0 = _context5["catch"](2);
|
|
335
332
|
console.error('[Quotation] 清空 IndexDB 缓存失败:', _context5.t0);
|
|
336
|
-
case
|
|
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,
|
|
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
|
-
|
|
499
|
-
_context7.next = 14;
|
|
493
|
+
_context7.next = 13;
|
|
500
494
|
break;
|
|
501
|
-
case
|
|
502
|
-
_context7.prev =
|
|
495
|
+
case 10:
|
|
496
|
+
_context7.prev = 10;
|
|
503
497
|
_context7.t0 = _context7["catch"](2);
|
|
504
498
|
console.error('[Quotation] 保存数据到 IndexDB 失败:', _context7.t0);
|
|
505
|
-
case
|
|
499
|
+
case 13:
|
|
506
500
|
case "end":
|
|
507
501
|
return _context7.stop();
|
|
508
502
|
}
|
|
509
|
-
}, _callee7, this, [[2,
|
|
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
|
-
|
|
530
|
-
_context8.
|
|
531
|
-
_context8.next = 4;
|
|
523
|
+
_context8.prev = 0;
|
|
524
|
+
_context8.next = 3;
|
|
532
525
|
return this.loadQuotationFromIndexDB();
|
|
533
|
-
case
|
|
526
|
+
case 3:
|
|
534
527
|
cachedData = _context8.sent;
|
|
535
528
|
if (!(cachedData && cachedData.length > 0)) {
|
|
536
|
-
_context8.next =
|
|
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
|
|
545
|
-
|
|
546
|
-
_context8.next = 16;
|
|
536
|
+
case 8:
|
|
537
|
+
_context8.next = 13;
|
|
547
538
|
break;
|
|
548
|
-
case
|
|
549
|
-
_context8.prev =
|
|
550
|
-
_context8.t0 = _context8["catch"](
|
|
539
|
+
case 10:
|
|
540
|
+
_context8.prev = 10;
|
|
541
|
+
_context8.t0 = _context8["catch"](0);
|
|
551
542
|
console.warn('[Quotation] 从 IndexDB 加载数据失败:', _context8.t0);
|
|
552
|
-
case
|
|
553
|
-
_context8.next =
|
|
543
|
+
case 13:
|
|
544
|
+
_context8.next = 15;
|
|
554
545
|
return this.loadQuotationList();
|
|
555
|
-
case
|
|
546
|
+
case 15:
|
|
556
547
|
quotationList = _context8.sent;
|
|
557
548
|
if (!(quotationList && quotationList.length > 0)) {
|
|
558
|
-
_context8.next =
|
|
549
|
+
_context8.next = 21;
|
|
559
550
|
break;
|
|
560
551
|
}
|
|
561
|
-
_context8.next =
|
|
552
|
+
_context8.next = 19;
|
|
562
553
|
return this.saveQuotationToIndexDB(quotationList);
|
|
563
|
-
case
|
|
554
|
+
case 19:
|
|
564
555
|
this.store.quotationList = cloneDeep(quotationList);
|
|
565
556
|
this.core.effects.emit(QuotationHooks.onQuotationChanged, this.store.quotationList);
|
|
566
|
-
case
|
|
557
|
+
case 21:
|
|
567
558
|
case "end":
|
|
568
559
|
return _context8.stop();
|
|
569
560
|
}
|
|
570
|
-
}, _callee8, this, [[
|
|
561
|
+
}, _callee8, this, [[0, 10]]);
|
|
571
562
|
}));
|
|
572
563
|
function preload() {
|
|
573
564
|
return _preload.apply(this, arguments);
|
|
@@ -790,17 +790,16 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
790
790
|
});
|
|
791
791
|
case 4:
|
|
792
792
|
result = _context8.sent;
|
|
793
|
-
console.log('result', result);
|
|
794
793
|
this.logInfo('setupResourceSync: 资源列表查询结果', {
|
|
795
794
|
result: result
|
|
796
795
|
});
|
|
797
796
|
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 =
|
|
797
|
+
_context8.next = 9;
|
|
799
798
|
break;
|
|
800
799
|
}
|
|
801
|
-
_context8.next =
|
|
800
|
+
_context8.next = 9;
|
|
802
801
|
return this.mergeResourcesToStore(result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.list);
|
|
803
|
-
case
|
|
802
|
+
case 9:
|
|
804
803
|
case "end":
|
|
805
804
|
return _context8.stop();
|
|
806
805
|
}
|
|
@@ -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 =
|
|
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 =
|
|
352
|
+
_context3.next = 15;
|
|
357
353
|
break;
|
|
358
|
-
case
|
|
359
|
-
_context3.prev =
|
|
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
|
|
362
|
+
case 15:
|
|
367
363
|
this.logInfo('缓存清空完成');
|
|
368
|
-
case
|
|
364
|
+
case 16:
|
|
369
365
|
case "end":
|
|
370
366
|
return _context3.stop();
|
|
371
367
|
}
|
|
372
|
-
}, _callee3, this, [[4,
|
|
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 =
|
|
511
|
+
_context5.next = 28;
|
|
517
512
|
break;
|
|
518
|
-
case
|
|
519
|
-
_context5.prev =
|
|
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
|
|
522
|
+
case 28:
|
|
528
523
|
case "end":
|
|
529
524
|
return _context5.stop();
|
|
530
525
|
}
|
|
531
|
-
}, _callee5, this, [[4,
|
|
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 =
|
|
555
|
-
_context6.next =
|
|
548
|
+
_context6.prev = 2;
|
|
549
|
+
_context6.next = 5;
|
|
556
550
|
return this.loadScheduleFromSQLite();
|
|
557
|
-
case
|
|
551
|
+
case 5:
|
|
558
552
|
cachedData = _context6.sent;
|
|
559
553
|
if (!(cachedData && cachedData.length > 0)) {
|
|
560
|
-
_context6.next =
|
|
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
|
|
576
|
-
console.log('[Schedule] SQLite 中没有缓存数据,从服务器加载...');
|
|
568
|
+
case 12:
|
|
577
569
|
this.logInfo('SQLite 中没有缓存数据,准备从服务器加载');
|
|
578
|
-
_context6.next =
|
|
570
|
+
_context6.next = 20;
|
|
579
571
|
break;
|
|
580
|
-
case
|
|
581
|
-
_context6.prev =
|
|
582
|
-
_context6.t0 = _context6["catch"](
|
|
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
|
|
589
|
-
_context6.next =
|
|
580
|
+
case 20:
|
|
581
|
+
_context6.next = 22;
|
|
590
582
|
return this.loadAllSchedule();
|
|
591
|
-
case
|
|
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
|
|
602
|
+
case 24:
|
|
611
603
|
case "end":
|
|
612
604
|
return _context6.stop();
|
|
613
605
|
}
|
|
614
|
-
}, _callee6, this, [[
|
|
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();
|
|
@@ -35,6 +35,8 @@ export interface SmallTicketProduct {
|
|
|
35
35
|
original_price: string;
|
|
36
36
|
total_original_price: string;
|
|
37
37
|
extension_list: any[];
|
|
38
|
+
product_uid?: string | number;
|
|
39
|
+
booking_uid?: string | number;
|
|
38
40
|
options?: Array<{
|
|
39
41
|
name: string;
|
|
40
42
|
num?: number;
|
|
@@ -44,6 +46,11 @@ export interface SmallTicketProduct {
|
|
|
44
46
|
variant?: string;
|
|
45
47
|
combinations?: any[];
|
|
46
48
|
}
|
|
49
|
+
export interface SmallTicketBookingSnapshot extends Record<string, any> {
|
|
50
|
+
product_uid?: string | number;
|
|
51
|
+
booking_uid?: string | number;
|
|
52
|
+
}
|
|
53
|
+
export type SmallTicketAppointment = SmallTicketItem[] | SmallTicketBookingSnapshot[];
|
|
47
54
|
export interface SmallTicketLocaleData {
|
|
48
55
|
base_data: Record<string, any>;
|
|
49
56
|
products: SmallTicketProduct[];
|
|
@@ -52,7 +59,7 @@ export interface SmallTicketLocaleData {
|
|
|
52
59
|
countFee: Record<string, any>;
|
|
53
60
|
};
|
|
54
61
|
customer: SmallTicketItem[];
|
|
55
|
-
appointment:
|
|
62
|
+
appointment: SmallTicketAppointment;
|
|
56
63
|
delivery?: SmallTicketItem[];
|
|
57
64
|
resources: Array<{
|
|
58
65
|
id: string | number;
|
|
@@ -61,6 +68,7 @@ export interface SmallTicketLocaleData {
|
|
|
61
68
|
form_title: string;
|
|
62
69
|
}>;
|
|
63
70
|
payment_data: SmallTicketItem[][];
|
|
71
|
+
wallets: SmallTicketItem[][];
|
|
64
72
|
tickets: any[];
|
|
65
73
|
source_shop: any[];
|
|
66
74
|
refund_data: any[];
|