@pisell/pisellos 0.10.14 → 0.10.16
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/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.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +75 -91
- package/dist/modules/Order/types.d.ts +5 -1
- package/dist/modules/Order/utils/virtualSettlement.d.ts +8 -1
- package/dist/modules/Order/utils/virtualSettlement.js +15 -2
- 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/Rules/index.js +1 -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.js +97 -129
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/order/index.js +2 -4
- 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/solution/BaseSales/index.js +107 -76
- 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.js +8 -4
- 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/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/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 +43 -48
- 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.js +70 -76
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +1810 -2238
- package/lib/modules/Order/payment-utils.js +77 -120
- package/lib/modules/Order/types.d.ts +5 -1
- package/lib/modules/Order/types.js +87 -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.d.ts +8 -1
- package/lib/modules/Order/utils/virtualSettlement.js +126 -164
- 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 +138 -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 +1218 -959
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +78 -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.js +3027 -2655
- 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.js +758 -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.js +479 -456
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.js +1276 -1485
- 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.js +598 -514
- 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.js +328 -324
- 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.js +1052 -1213
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +99 -159
- 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
|
@@ -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();
|
|
@@ -37,7 +37,7 @@ import Decimal from 'decimal.js';
|
|
|
37
37
|
import { cloneDeep, mergeWith } from 'lodash-es';
|
|
38
38
|
import { createModule } from "../BookingByStep/types";
|
|
39
39
|
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
40
|
-
import { getTempOrderSettlementSnapshot, isVirtualSettlementOrder } from "../../modules/Order/utils/virtualSettlement";
|
|
40
|
+
import { buildCurrencyDisplaySnapshot, getTempOrderSettlementSnapshot, isVirtualSettlementOrder } from "../../modules/Order/utils/virtualSettlement";
|
|
41
41
|
import { ensureOrderPaymentNumber, isIdentifiedPendingOrderPayment, isPendingOrderPayment, mergeOrderPaymentListsByIdentity, resolveOrderPaymentIdentity } from "../../modules/Order/payment-utils";
|
|
42
42
|
import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
|
|
43
43
|
import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
|
|
@@ -371,6 +371,24 @@ function filterPendingPaymentsFromLoadedSalesDetail(sourceRecord) {
|
|
|
371
371
|
}
|
|
372
372
|
return record;
|
|
373
373
|
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* merge hydrate 不会统一给所有商品补 saved 标记,因此先只标记远端已保存商品。
|
|
377
|
+
* 当前 tempOrder 中尚未提交的本地商品会在 merge 后继续保持 current item 语义。
|
|
378
|
+
*/
|
|
379
|
+
function markLoadedSalesDetailProductsAsSaved(sourceRecord) {
|
|
380
|
+
if (!sourceRecord || _typeof(sourceRecord) !== 'object') return sourceRecord;
|
|
381
|
+
if (!Array.isArray(sourceRecord.products)) return sourceRecord;
|
|
382
|
+
return _objectSpread(_objectSpread({}, sourceRecord), {}, {
|
|
383
|
+
products: sourceRecord.products.map(function (product) {
|
|
384
|
+
return _objectSpread(_objectSpread({}, product || {}), {}, {
|
|
385
|
+
metadata: _objectSpread(_objectSpread({}, product !== null && product !== void 0 && product.metadata && _typeof(product.metadata) === 'object' ? product.metadata : {}), {}, {
|
|
386
|
+
is_edit_for_runtime: true
|
|
387
|
+
})
|
|
388
|
+
});
|
|
389
|
+
})
|
|
390
|
+
});
|
|
391
|
+
}
|
|
374
392
|
export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
375
393
|
_inherits(BaseSalesImpl, _BaseModule);
|
|
376
394
|
var _super = _createSuper(BaseSalesImpl);
|
|
@@ -670,7 +688,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
670
688
|
}, {
|
|
671
689
|
key: "hydrateLatestLoadedSalesDetail",
|
|
672
690
|
value: function () {
|
|
673
|
-
var _hydrateLatestLoadedSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(record, loadSequence,
|
|
691
|
+
var _hydrateLatestLoadedSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(record, loadSequence, options) {
|
|
674
692
|
var _this4 = this;
|
|
675
693
|
var hydratedSales, skippedBeforeHydrate, hydrateTask, queuedTask;
|
|
676
694
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
@@ -680,7 +698,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
680
698
|
skippedBeforeHydrate = false;
|
|
681
699
|
hydrateTask = /*#__PURE__*/function () {
|
|
682
700
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
683
|
-
var sales;
|
|
701
|
+
var hydrateOptions, sales;
|
|
684
702
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
685
703
|
while (1) switch (_context4.prev = _context4.next) {
|
|
686
704
|
case 0:
|
|
@@ -697,30 +715,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
697
715
|
}
|
|
698
716
|
throw new Error('order 模块未初始化');
|
|
699
717
|
case 5:
|
|
700
|
-
|
|
701
|
-
return _this4.store.order.hydrateTempOrderFromRecord(record, hydrateSource === 'sessionStorage' ? {
|
|
702
|
-
recalcOnHydrate: true,
|
|
703
|
-
source: 'sessionStorage'
|
|
704
|
-
} : {
|
|
718
|
+
hydrateOptions = {
|
|
705
719
|
recalcOnHydrate: false
|
|
706
|
-
}
|
|
707
|
-
|
|
720
|
+
};
|
|
721
|
+
if ((options === null || options === void 0 ? void 0 : options.hydrateSource) === 'sessionStorage') {
|
|
722
|
+
hydrateOptions = {
|
|
723
|
+
recalcOnHydrate: true,
|
|
724
|
+
source: 'sessionStorage'
|
|
725
|
+
};
|
|
726
|
+
} else if (options !== null && options !== void 0 && options.merge) {
|
|
727
|
+
hydrateOptions = {
|
|
728
|
+
recalcOnHydrate: true,
|
|
729
|
+
source: 'mergedSalesDetail'
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
_context4.next = 9;
|
|
733
|
+
return _this4.store.order.hydrateTempOrderFromRecord(record, hydrateOptions);
|
|
734
|
+
case 9:
|
|
708
735
|
sales = _context4.sent;
|
|
709
736
|
hydratedSales = sales;
|
|
710
737
|
|
|
711
738
|
// hydrate 期间可能又发起了更新请求;后续任务已串行排队,将负责最终状态。
|
|
712
739
|
if (!(loadSequence !== _this4.salesDetailLoadSequence)) {
|
|
713
|
-
_context4.next =
|
|
740
|
+
_context4.next = 13;
|
|
714
741
|
break;
|
|
715
742
|
}
|
|
716
743
|
return _context4.abrupt("return");
|
|
717
|
-
case
|
|
744
|
+
case 13:
|
|
718
745
|
_this4.currentSalesDetail = sales;
|
|
719
|
-
_context4.next =
|
|
746
|
+
_context4.next = 16;
|
|
720
747
|
return _this4.core.effects.emit("".concat(_this4.name, ":onSalesOrderLoaded"), {
|
|
721
748
|
sales: sales
|
|
722
749
|
});
|
|
723
|
-
case
|
|
750
|
+
case 16:
|
|
724
751
|
case "end":
|
|
725
752
|
return _context4.stop();
|
|
726
753
|
}
|
|
@@ -1569,7 +1596,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1569
1596
|
key: "loadSalesDetail",
|
|
1570
1597
|
value: (function () {
|
|
1571
1598
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
|
|
1572
|
-
var loadSequence, _ref31, _ref32, _ref33, _ref34, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, currentTempOrder, mergedRecord, record;
|
|
1599
|
+
var loadSequence, _ref31, _ref32, _ref33, _ref34, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
|
|
1573
1600
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1574
1601
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1575
1602
|
case 0:
|
|
@@ -1621,39 +1648,43 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1621
1648
|
loadedSalesDetail = preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data; // payment_pending 只存在于本地;远端详情需过滤,但会话快照必须完整恢复。
|
|
1622
1649
|
shouldFilterPendingPayments = params.hydrateSource !== 'sessionStorage';
|
|
1623
1650
|
remoteRecord = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(loadedSalesDetail) : loadedSalesDetail;
|
|
1651
|
+
mergeSourceRecord = params.merge ? markLoadedSalesDetailProductsAsSaved(remoteRecord) : remoteRecord;
|
|
1624
1652
|
currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
1625
|
-
mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder,
|
|
1653
|
+
mergedRecord = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, mergeSourceRecord, 'preserve-local') : mergeSourceRecord;
|
|
1626
1654
|
record = shouldFilterPendingPayments ? filterPendingPaymentsFromLoadedSalesDetail(mergedRecord) : mergedRecord;
|
|
1627
|
-
_context14.next =
|
|
1628
|
-
return this.hydrateLatestLoadedSalesDetail(record, loadSequence,
|
|
1629
|
-
|
|
1630
|
-
|
|
1655
|
+
_context14.next = 31;
|
|
1656
|
+
return this.hydrateLatestLoadedSalesDetail(record, loadSequence, {
|
|
1657
|
+
hydrateSource: params.hydrateSource,
|
|
1658
|
+
merge: params.merge
|
|
1659
|
+
});
|
|
1631
1660
|
case 31:
|
|
1632
|
-
_context14.
|
|
1661
|
+
return _context14.abrupt("return", _context14.sent);
|
|
1662
|
+
case 32:
|
|
1663
|
+
_context14.prev = 32;
|
|
1633
1664
|
this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
|
|
1634
1665
|
if (!(this.salesDetailLoadInFlightCount === 0)) {
|
|
1635
|
-
_context14.next =
|
|
1666
|
+
_context14.next = 43;
|
|
1636
1667
|
break;
|
|
1637
1668
|
}
|
|
1638
|
-
_context14.prev =
|
|
1639
|
-
_context14.next =
|
|
1669
|
+
_context14.prev = 35;
|
|
1670
|
+
_context14.next = 38;
|
|
1640
1671
|
return this.drainQueuedServerOrderChanges();
|
|
1641
|
-
case
|
|
1642
|
-
_context14.next =
|
|
1672
|
+
case 38:
|
|
1673
|
+
_context14.next = 43;
|
|
1643
1674
|
break;
|
|
1644
|
-
case
|
|
1645
|
-
_context14.prev =
|
|
1646
|
-
_context14.t1 = _context14["catch"](
|
|
1675
|
+
case 40:
|
|
1676
|
+
_context14.prev = 40;
|
|
1677
|
+
_context14.t1 = _context14["catch"](35);
|
|
1647
1678
|
this.logError('drain queued server order changes failed', {
|
|
1648
1679
|
error: _context14.t1 instanceof Error ? _context14.t1.message : String(_context14.t1)
|
|
1649
1680
|
});
|
|
1650
|
-
case 42:
|
|
1651
|
-
return _context14.finish(31);
|
|
1652
1681
|
case 43:
|
|
1682
|
+
return _context14.finish(32);
|
|
1683
|
+
case 44:
|
|
1653
1684
|
case "end":
|
|
1654
1685
|
return _context14.stop();
|
|
1655
1686
|
}
|
|
1656
|
-
}, _callee14, this, [[4,,
|
|
1687
|
+
}, _callee14, this, [[4,, 32, 44], [35, 40]]);
|
|
1657
1688
|
}));
|
|
1658
1689
|
function loadSalesDetail(_x13) {
|
|
1659
1690
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -2357,11 +2388,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2357
2388
|
});
|
|
2358
2389
|
case 48:
|
|
2359
2390
|
if (!rulesModule) {
|
|
2360
|
-
_context22.next =
|
|
2391
|
+
_context22.next = 84;
|
|
2361
2392
|
break;
|
|
2362
2393
|
}
|
|
2363
2394
|
orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
|
|
2364
|
-
console.log('[BaseSales.applyDiscountConfig.calcDiscount]');
|
|
2365
2395
|
result = rulesModule.calcDiscount({
|
|
2366
2396
|
productList: tempOrder.products,
|
|
2367
2397
|
discountList: nextDiscountList,
|
|
@@ -2378,22 +2408,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2378
2408
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2379
2409
|
}
|
|
2380
2410
|
_iterator2 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2381
|
-
_context22.prev =
|
|
2411
|
+
_context22.prev = 53;
|
|
2382
2412
|
_iterator2.s();
|
|
2383
|
-
case
|
|
2413
|
+
case 55:
|
|
2384
2414
|
if ((_step2 = _iterator2.n()).done) {
|
|
2385
|
-
_context22.next =
|
|
2415
|
+
_context22.next = 70;
|
|
2386
2416
|
break;
|
|
2387
2417
|
}
|
|
2388
2418
|
product = _step2.value;
|
|
2389
2419
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
2390
2420
|
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;
|
|
2391
2421
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
2392
|
-
_context22.next =
|
|
2422
|
+
_context22.next = 61;
|
|
2393
2423
|
break;
|
|
2394
2424
|
}
|
|
2395
|
-
return _context22.abrupt("continue",
|
|
2396
|
-
case
|
|
2425
|
+
return _context22.abrupt("continue", 68);
|
|
2426
|
+
case 61:
|
|
2397
2427
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
2398
2428
|
return sum + Number(pd.amount || 0);
|
|
2399
2429
|
}, 0);
|
|
@@ -2409,60 +2439,60 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2409
2439
|
mainPrice: newMainSellingPrice,
|
|
2410
2440
|
bundle: product.product_bundle
|
|
2411
2441
|
});
|
|
2412
|
-
case
|
|
2413
|
-
_context22.next =
|
|
2442
|
+
case 68:
|
|
2443
|
+
_context22.next = 55;
|
|
2414
2444
|
break;
|
|
2415
|
-
case
|
|
2416
|
-
_context22.next =
|
|
2445
|
+
case 70:
|
|
2446
|
+
_context22.next = 75;
|
|
2417
2447
|
break;
|
|
2418
|
-
case
|
|
2419
|
-
_context22.prev =
|
|
2420
|
-
_context22.t0 = _context22["catch"](
|
|
2448
|
+
case 72:
|
|
2449
|
+
_context22.prev = 72;
|
|
2450
|
+
_context22.t0 = _context22["catch"](53);
|
|
2421
2451
|
_iterator2.e(_context22.t0);
|
|
2422
|
-
case
|
|
2423
|
-
_context22.prev =
|
|
2452
|
+
case 75:
|
|
2453
|
+
_context22.prev = 75;
|
|
2424
2454
|
_iterator2.f();
|
|
2425
|
-
return _context22.finish(
|
|
2426
|
-
case
|
|
2455
|
+
return _context22.finish(75);
|
|
2456
|
+
case 78:
|
|
2427
2457
|
if (!result.discountList) {
|
|
2428
|
-
_context22.next =
|
|
2458
|
+
_context22.next = 84;
|
|
2429
2459
|
break;
|
|
2430
2460
|
}
|
|
2431
2461
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2432
2462
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2433
|
-
_context22.next =
|
|
2463
|
+
_context22.next = 83;
|
|
2434
2464
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2435
|
-
case
|
|
2465
|
+
case 83:
|
|
2436
2466
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2437
2467
|
return discount.isSelected;
|
|
2438
2468
|
});
|
|
2439
|
-
case
|
|
2440
|
-
_context22.next =
|
|
2469
|
+
case 84:
|
|
2470
|
+
_context22.next = 86;
|
|
2441
2471
|
return this.store.order.recalculateSummary({
|
|
2442
2472
|
createIfMissing: true
|
|
2443
2473
|
});
|
|
2444
|
-
case
|
|
2474
|
+
case 86:
|
|
2445
2475
|
summary = _context22.sent;
|
|
2446
2476
|
this.store.order.persistTempOrder();
|
|
2447
|
-
_context22.next =
|
|
2477
|
+
_context22.next = 90;
|
|
2448
2478
|
return this.effectsEmit('onDiscountApplied', {
|
|
2449
2479
|
productList: tempOrder.products || [],
|
|
2450
2480
|
discountList: nextDiscountList,
|
|
2451
2481
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2452
2482
|
tempOrder: tempOrder
|
|
2453
2483
|
});
|
|
2454
|
-
case
|
|
2484
|
+
case 90:
|
|
2455
2485
|
return _context22.abrupt("return", {
|
|
2456
2486
|
productList: tempOrder.products || [],
|
|
2457
2487
|
discountList: nextDiscountList,
|
|
2458
2488
|
availableWalletIds: this.getAvailableWalletIds(),
|
|
2459
2489
|
virtualCurrencyList: this.store.order.getVirtualCurrencyList()
|
|
2460
2490
|
});
|
|
2461
|
-
case
|
|
2491
|
+
case 91:
|
|
2462
2492
|
case "end":
|
|
2463
2493
|
return _context22.stop();
|
|
2464
2494
|
}
|
|
2465
|
-
}, _callee22, this, [[
|
|
2495
|
+
}, _callee22, this, [[53, 72, 75, 78]]);
|
|
2466
2496
|
}));
|
|
2467
2497
|
function loadDiscountConfig(_x16) {
|
|
2468
2498
|
return _loadDiscountConfig.apply(this, arguments);
|
|
@@ -2524,11 +2554,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2524
2554
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2525
2555
|
case 16:
|
|
2526
2556
|
if (!rulesModule) {
|
|
2527
|
-
_context23.next =
|
|
2557
|
+
_context23.next = 27;
|
|
2528
2558
|
break;
|
|
2529
2559
|
}
|
|
2530
2560
|
orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
|
|
2531
|
-
console.log('[BaseSales.bestDiscount.calcDiscount]');
|
|
2532
2561
|
result = rulesModule.calcDiscount({
|
|
2533
2562
|
productList: tempOrder.products,
|
|
2534
2563
|
discountList: nextDiscountList,
|
|
@@ -2542,14 +2571,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2542
2571
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2543
2572
|
}
|
|
2544
2573
|
if (!result.discountList) {
|
|
2545
|
-
_context23.next =
|
|
2574
|
+
_context23.next = 27;
|
|
2546
2575
|
break;
|
|
2547
2576
|
}
|
|
2548
2577
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2549
2578
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2550
|
-
_context23.next =
|
|
2579
|
+
_context23.next = 25;
|
|
2551
2580
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2552
|
-
case
|
|
2581
|
+
case 25:
|
|
2553
2582
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2554
2583
|
return discount.isSelected;
|
|
2555
2584
|
});
|
|
@@ -2557,24 +2586,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2557
2586
|
productList: tempOrder.products,
|
|
2558
2587
|
discountList: nextDiscountList
|
|
2559
2588
|
};
|
|
2560
|
-
case
|
|
2561
|
-
_context23.next =
|
|
2589
|
+
case 27:
|
|
2590
|
+
_context23.next = 29;
|
|
2562
2591
|
return this.store.order.recalculateSummary({
|
|
2563
2592
|
createIfMissing: true
|
|
2564
2593
|
});
|
|
2565
|
-
case
|
|
2594
|
+
case 29:
|
|
2566
2595
|
this.store.order.persistTempOrder();
|
|
2567
|
-
_context23.next =
|
|
2596
|
+
_context23.next = 32;
|
|
2568
2597
|
return this.effectsEmit('onDiscountApplied', {
|
|
2569
2598
|
productList: tempOrder.products || [],
|
|
2570
2599
|
discountList: nextDiscountList,
|
|
2571
2600
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2572
2601
|
tempOrder: tempOrder
|
|
2573
2602
|
});
|
|
2574
|
-
case
|
|
2603
|
+
case 32:
|
|
2575
2604
|
cb === null || cb === void 0 || cb(result);
|
|
2576
2605
|
return _context23.abrupt("return", result);
|
|
2577
|
-
case
|
|
2606
|
+
case 34:
|
|
2578
2607
|
case "end":
|
|
2579
2608
|
return _context23.stop();
|
|
2580
2609
|
}
|
|
@@ -2761,7 +2790,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2761
2790
|
case 23:
|
|
2762
2791
|
if (rulesModule) {
|
|
2763
2792
|
orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
|
|
2764
|
-
console.log('[BaseSales.setDiscountSelected.calcDiscount]');
|
|
2765
2793
|
result = rulesModule.calcDiscount({
|
|
2766
2794
|
productList: tempOrder.products,
|
|
2767
2795
|
discountList: updated,
|
|
@@ -3213,13 +3241,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3213
3241
|
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
3214
3242
|
} : {}), virtualSettlement ? {
|
|
3215
3243
|
enhancePayload: function enhancePayload(payload, ctx) {
|
|
3244
|
+
var _callerPayload$metada, _currencySettlementCo;
|
|
3216
3245
|
var callerPayload = params !== null && params !== void 0 && params.enhancePayload ? params.enhancePayload(payload, ctx) : payload;
|
|
3246
|
+
var currencySettlementConfig = ((_callerPayload$metada = callerPayload.metadata) === null || _callerPayload$metada === void 0 ? void 0 : _callerPayload$metada.currency_settlement_config) || {};
|
|
3217
3247
|
return _objectSpread(_objectSpread({}, callerPayload), {}, {
|
|
3218
3248
|
metadata: _objectSpread(_objectSpread({}, callerPayload.metadata || {}), {}, {
|
|
3219
|
-
currency_settlement_config: {
|
|
3249
|
+
currency_settlement_config: _objectSpread(_objectSpread({}, currencySettlementConfig), {}, {
|
|
3220
3250
|
settlement_type: 'virtual_currency',
|
|
3221
|
-
settlement_ids: [virtualSettlement.currencyProductId]
|
|
3222
|
-
|
|
3251
|
+
settlement_ids: [virtualSettlement.currencyProductId],
|
|
3252
|
+
currency_display_snapshot: cloneDeep((_currencySettlementCo = currencySettlementConfig.currency_display_snapshot) !== null && _currencySettlementCo !== void 0 ? _currencySettlementCo : buildCurrencyDisplaySnapshot(virtualSettlement.snapshot))
|
|
3253
|
+
})
|
|
3223
3254
|
}),
|
|
3224
3255
|
currency_code: virtualSettlement.currencyCode,
|
|
3225
3256
|
currency_symbol: virtualSettlement.currencySymbol,
|
|
@@ -112,6 +112,8 @@ export interface BaseSalesUpdateOrderProductQuantityParams extends BaseSalesOrde
|
|
|
112
112
|
export interface BaseSalesOrderProduct extends BaseSalesOrderProductIdentity {
|
|
113
113
|
order_detail_id: number | null;
|
|
114
114
|
num: number;
|
|
115
|
+
/** Product 或当前 Variant 的生产编码 */
|
|
116
|
+
production_code?: string;
|
|
115
117
|
product_sku: BaseSalesProductSku;
|
|
116
118
|
/**
|
|
117
119
|
* 券后 **行 composite 单价** = `metadata.main_product_selling_price`
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { OrderProduct } from '../../../modules/Order/types';
|
|
2
|
+
/**
|
|
3
|
+
* 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
|
|
4
|
+
* `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
|
|
5
|
+
*/
|
|
6
|
+
export declare const PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = "_productLineMergeDisabled";
|
|
2
7
|
/**
|
|
3
8
|
* Cart promotion 工具集(OS 内部纯函数)
|
|
4
9
|
*
|
|
@@ -23,6 +23,12 @@ import { cloneDeep } from 'lodash-es';
|
|
|
23
23
|
import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
|
|
24
24
|
import { buildProductLineFingerprint, getSafeProductNum } from "../../ScanOrder/utils";
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
|
|
28
|
+
* `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
|
|
29
|
+
*/
|
|
30
|
+
export var PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = '_productLineMergeDisabled';
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* Cart promotion 工具集(OS 内部纯函数)
|
|
28
34
|
*
|
|
@@ -483,10 +489,13 @@ function hasGoodPassDiscount(product) {
|
|
|
483
489
|
}
|
|
484
490
|
|
|
485
491
|
/**
|
|
486
|
-
*
|
|
492
|
+
* 不合并商品、商品券、自定义商品、称重行以及编辑订单历史行都有各自的促销合并边界。
|
|
487
493
|
*/
|
|
488
494
|
function getPromotionLineMergeBoundary(product) {
|
|
489
|
-
var _product$product_sku, _product$
|
|
495
|
+
var _product$metadata3, _product$product_sku, _product$metadata4;
|
|
496
|
+
if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3[PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY]) === true) {
|
|
497
|
+
return "separate:".concat(getOrderProductUid(product));
|
|
498
|
+
}
|
|
490
499
|
if ((product === null || product === void 0 ? void 0 : product.product_id) === undefined || (product === null || product === void 0 ? void 0 : product.product_id) === null) {
|
|
491
500
|
return "custom:".concat(getOrderProductUid(product));
|
|
492
501
|
}
|
|
@@ -496,7 +505,7 @@ function getPromotionLineMergeBoundary(product) {
|
|
|
496
505
|
if (Number((product === null || product === void 0 || (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1) {
|
|
497
506
|
return "weighing:".concat(getOrderProductUid(product));
|
|
498
507
|
}
|
|
499
|
-
if ((product === null || product === void 0 || (_product$
|
|
508
|
+
if ((product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.is_edit_for_runtime) !== true) return '';
|
|
500
509
|
return "edit:".concat(getOrderProductUid(product));
|
|
501
510
|
}
|
|
502
511
|
function isPersistedGeneratedVoucher(product) {
|
|
@@ -921,13 +930,13 @@ export function resolveStrategyEligibleProducts(matched) {
|
|
|
921
930
|
export function calculateUnfulfilledPromotions(processedProducts, applicableStrategiesResult, mainProducts) {
|
|
922
931
|
var unfulfilledMap = new Map();
|
|
923
932
|
var _loop2 = function _loop2() {
|
|
924
|
-
var _product$
|
|
933
|
+
var _product$metadata5, _ref13, _product$_originalPro, _product$metadata6, _product$num2;
|
|
925
934
|
var product = processedProducts[i];
|
|
926
|
-
var promotion = product === null || product === void 0 || (_product$
|
|
935
|
+
var promotion = product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5._promotion;
|
|
927
936
|
if (!promotion || promotion.inPromotion !== false) return 0; // continue
|
|
928
937
|
var strategyId = promotion.strategyId;
|
|
929
938
|
if (!strategyId) return 0; // continue
|
|
930
|
-
var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$
|
|
939
|
+
var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
|
|
931
940
|
var originalIndex = mainProducts.findIndex(function (item) {
|
|
932
941
|
return getOrderProductUid(item) === lookupUid;
|
|
933
942
|
});
|
|
@@ -3,6 +3,7 @@ import type { ProductData } from '../../../modules/Product/types';
|
|
|
3
3
|
export interface BaseProductDetailOptionItem {
|
|
4
4
|
option_group_item_id?: number | string;
|
|
5
5
|
option_group_id?: number | string;
|
|
6
|
+
production_code?: string;
|
|
6
7
|
num?: number | string;
|
|
7
8
|
quantity?: number | string;
|
|
8
9
|
price?: number | string;
|
|
@@ -10,6 +11,7 @@ export interface BaseProductDetailOptionItem {
|
|
|
10
11
|
[key: string]: any;
|
|
11
12
|
}
|
|
12
13
|
export interface BaseProductDetailBundleItem {
|
|
14
|
+
production_code?: string;
|
|
13
15
|
option?: BaseProductDetailOptionItem[];
|
|
14
16
|
[key: string]: any;
|
|
15
17
|
}
|
|
@@ -18,6 +20,7 @@ export interface BaseProductDetailPayload {
|
|
|
18
20
|
product_id?: number | string | null;
|
|
19
21
|
variant_id?: number | string | null;
|
|
20
22
|
product_variant_id?: number | string | null;
|
|
23
|
+
production_code?: string;
|
|
21
24
|
quantity?: number | string;
|
|
22
25
|
num?: number | string;
|
|
23
26
|
option?: BaseProductDetailOptionItem[];
|