@pisell/pisellos 0.0.569 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +17 -92
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +1 -1
- package/dist/modules/BaseModule.js +8 -10
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +9 -16
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +7 -22
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -0
- package/dist/modules/Order/index.js +70 -40
- package/dist/modules/Payment/index.js +162 -97
- package/dist/modules/Payment/types.d.ts +4 -8
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +5 -4
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +3 -12
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +126 -427
- package/dist/modules/SalesSummary/utils.js +1 -2
- package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
- package/dist/modules/Schedule/index.js +1 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.js +129 -97
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.js +4 -2
- package/dist/server/modules/products/index.js +42 -24
- package/dist/server/modules/quotation/index.js +38 -29
- package/dist/server/modules/resource/index.js +4 -3
- package/dist/server/modules/schedule/index.js +35 -27
- package/dist/server/utils/product.js +1 -0
- package/dist/solution/BaseSales/index.js +41 -38
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +2 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +7 -6
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +31 -25
- package/dist/solution/BookingTicket/utils/scan/index.js +10 -6
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.js +252 -177
- package/dist/solution/Checkout/utils/index.js +16 -4
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/ScanOrder/index.js +60 -50
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- package/dist/solution/VenueBooking/index.d.ts +3 -31
- package/dist/solution/VenueBooking/index.js +496 -651
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +231 -381
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +49 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -678
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +1 -1
- package/lib/modules/BaseModule.js +46 -25
- package/lib/modules/BookingContext/index.js +136 -158
- package/lib/modules/BookingContext/types.js +32 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +143 -131
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +82 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +150 -170
- package/lib/modules/BookingContext/utils/flexible.js +55 -38
- package/lib/modules/BookingContext/utils/formatResourceList.js +34 -19
- package/lib/modules/BookingContext/utils/index.js +41 -124
- package/lib/modules/BookingContext/utils/noResource.js +70 -58
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +41 -14
- package/lib/modules/BookingContext/utils/productExtend.js +155 -202
- package/lib/modules/BookingContext/utils/resourceErrors.js +53 -53
- package/lib/modules/BookingContext/utils/resourceSelection.js +41 -19
- package/lib/modules/BookingContext/utils/resources.js +167 -209
- package/lib/modules/BookingContext/utils/serviceTimes.js +116 -115
- package/lib/modules/BookingContext/utils/timeSlices.js +80 -70
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +251 -321
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +50 -28
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.js +169 -232
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +128 -130
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.js +76 -69
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.js +1909 -1572
- package/lib/modules/Order/types.js +35 -78
- package/lib/modules/Order/utils/bundleDiscountHydration.js +74 -41
- package/lib/modules/Order/utils/manualProductDiscount.js +123 -124
- package/lib/modules/Order/utils/orderCollectionIdentity.js +210 -148
- package/lib/modules/Order/utils.js +634 -799
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.js +378 -518
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +4 -8
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.js +48 -51
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +211 -226
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +117 -117
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.js +100 -66
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.js +61 -60
- package/lib/modules/ResourcePlanner/planner.js +384 -346
- package/lib/modules/ResourcePlanner/types.js +16 -4
- package/lib/modules/Rules/index.js +903 -1475
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.js +90 -85
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.js +427 -351
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +163 -339
- package/lib/modules/Schedule/index.js +114 -100
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.js +60 -46
- package/lib/modules/SurchargeList/types.js +16 -4
- package/lib/modules/index.js +63 -245
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.js +2337 -2675
- package/lib/server/modules/floor-plan/index.js +123 -102
- package/lib/server/modules/floor-plan/types.js +30 -15
- package/lib/server/modules/index.js +68 -106
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.js +642 -567
- package/lib/server/modules/order/types.js +32 -117
- package/lib/server/modules/order/utils/filterBookings.js +194 -219
- package/lib/server/modules/order/utils/filterOrders.js +92 -118
- package/lib/server/modules/payment/index.js +83 -59
- package/lib/server/modules/payment/types.js +16 -4
- package/lib/server/modules/products/index.js +459 -575
- package/lib/server/modules/products/types.js +34 -44
- package/lib/server/modules/quotation/index.js +172 -137
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.js +184 -213
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.js +123 -135
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +139 -196
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.js +456 -478
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.js +1016 -850
- package/lib/solution/BaseSales/types.js +37 -41
- package/lib/solution/BaseSales/utils/cartPromotion.js +460 -611
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +105 -85
- package/lib/solution/BaseSales/utils/quotationPrice.js +114 -56
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +143 -102
- package/lib/solution/BaseSales/utils.js +140 -155
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +459 -543
- package/lib/solution/BookingTicket/types.js +77 -99
- package/lib/solution/BookingTicket/utils/addProductDecision.js +184 -219
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +89 -58
- package/lib/solution/BookingTicket/utils/bookingStatus.js +78 -107
- package/lib/solution/BookingTicket/utils/cartView.js +94 -110
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -185
- package/lib/solution/BookingTicket/utils/orderCustomer.js +41 -18
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +86 -219
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +93 -144
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +91 -79
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +41 -54
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -84
- package/lib/solution/BookingTicket/utils/scan/index.js +104 -98
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +64 -52
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +58 -56
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.js +1158 -1451
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +460 -493
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.js +320 -317
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.js +862 -831
- package/lib/solution/ScanOrder/types.js +34 -33
- package/lib/solution/ScanOrder/utils.js +371 -406
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.js +405 -379
- package/lib/solution/UnifiedBookingSales/types.js +31 -12
- package/lib/solution/VenueBooking/index.d.ts +3 -31
- package/lib/solution/VenueBooking/index.js +916 -967
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.js +107 -94
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.js +41 -124
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -47,7 +47,6 @@ import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
|
|
|
47
47
|
import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
|
|
48
48
|
import { buildDateRangeSummary } from "./utils/dateSummary";
|
|
49
49
|
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
|
|
50
|
-
import { buildSlotPriceMapByScheduleSegments, formatProductsWithDataVariant, getPriceForProductAtDatetime, getSlotPriceFromMap } from "./utils/smartPricing";
|
|
51
50
|
import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
52
51
|
import { OrderModule } from "../../modules/Order";
|
|
53
52
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
@@ -103,15 +102,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
103
102
|
_defineProperty(_assertThisInitialized(_this), "loginEffectDisposers", []);
|
|
104
103
|
_defineProperty(_assertThisInitialized(_this), "customerLoginRefreshInFlight", null);
|
|
105
104
|
_defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
|
|
106
|
-
/** 最近一次确认登录的客户;登录事件与 user 插件更新之间可能存在时序差。 */
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "smartPricingCustomerId", void 0);
|
|
108
105
|
_defineProperty(_assertThisInitialized(_this), "loadAllProductsInFlight", null);
|
|
109
106
|
_defineProperty(_assertThisInitialized(_this), "productsLoaded", false);
|
|
110
107
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
|
|
111
|
-
/** 按日期缓存 slot 智能定价 Map,避免同周重复 resolveProducts */
|
|
112
|
-
_defineProperty(_assertThisInitialized(_this), "slotPriceMapCache", new Map());
|
|
113
|
-
/** loadProducts 后缓存的全量商品(venue + addon),供分段算价复用 */
|
|
114
|
-
_defineProperty(_assertThisInitialized(_this), "smartPricingProductCatalog", []);
|
|
115
108
|
return _this;
|
|
116
109
|
}
|
|
117
110
|
_createClass(VenueBookingImpl, [{
|
|
@@ -194,7 +187,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
194
187
|
payload: payload,
|
|
195
188
|
extra: extra
|
|
196
189
|
});
|
|
197
|
-
} else {
|
|
190
|
+
} else {
|
|
191
|
+
console.log('[VenueBooking][log-fallback]', params.title, {
|
|
192
|
+
payload: payload,
|
|
193
|
+
extra: extra
|
|
194
|
+
});
|
|
195
|
+
}
|
|
198
196
|
return _context.abrupt("return");
|
|
199
197
|
case 6:
|
|
200
198
|
_context.next = 8;
|
|
@@ -492,9 +490,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
492
490
|
}, {
|
|
493
491
|
key: "registerCustomerLoginListeners",
|
|
494
492
|
value: function registerCustomerLoginListeners() {
|
|
495
|
-
var
|
|
493
|
+
var _this$core2,
|
|
494
|
+
_this$core3,
|
|
495
|
+
_accountModule$getCur,
|
|
496
|
+
_accountModule$getAcc,
|
|
497
|
+
_this2 = this;
|
|
496
498
|
this.clearLoginEffectListeners();
|
|
497
|
-
var
|
|
499
|
+
var accountModule = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.getModule('account');
|
|
500
|
+
var registerAndLoginModule = (_this$core3 = this.core) === null || _this$core3 === void 0 ? void 0 : _this$core3.getModule('registerAndLogin');
|
|
501
|
+
var currentAccount = (accountModule === null || accountModule === void 0 || (_accountModule$getCur = accountModule.getCurrentAccount) === null || _accountModule$getCur === void 0 ? void 0 : _accountModule$getCur.call(accountModule)) || (accountModule === null || accountModule === void 0 || (_accountModule$getAcc = accountModule.getAccount) === null || _accountModule$getAcc === void 0 ? void 0 : _accountModule$getAcc.call(accountModule)) || null;
|
|
502
|
+
var createHandleLogin = function createHandleLogin(eventName) {
|
|
498
503
|
return /*#__PURE__*/function () {
|
|
499
504
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
|
|
500
505
|
var customerId;
|
|
@@ -523,9 +528,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
523
528
|
};
|
|
524
529
|
}();
|
|
525
530
|
};
|
|
526
|
-
this.registerLoginEffect(
|
|
527
|
-
this.registerLoginEffect(
|
|
528
|
-
this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, createHandleLogin());
|
|
531
|
+
this.registerLoginEffect(AccountHooks.OnLogin, createHandleLogin(AccountHooks.OnLogin));
|
|
532
|
+
this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, createHandleLogin(RegisterAndLoginHooks.onLoginSuccess));
|
|
529
533
|
}
|
|
530
534
|
}, {
|
|
531
535
|
key: "refreshOrderMarketingAfterLogin",
|
|
@@ -560,57 +564,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
560
564
|
case 9:
|
|
561
565
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
562
566
|
refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
563
|
-
var _this3$core, _this3$core$emit;
|
|
564
567
|
var _this3$otherParams;
|
|
565
568
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
566
569
|
while (1) switch (_context5.prev = _context5.next) {
|
|
567
570
|
case 0:
|
|
568
|
-
// 用户插件可能晚于登录 effect 更新;以已确认的登录 payload 作为本次及后续网格算价的身份来源。
|
|
569
|
-
_this3.smartPricingCustomerId = params.customerId;
|
|
570
|
-
_context5.next = 3;
|
|
571
|
-
return _this3.store.order.loadDiscountConfig({
|
|
572
|
-
customerId: params.customerId
|
|
573
|
-
});
|
|
574
|
-
case 3:
|
|
575
|
-
_this3.clearSlotPriceMapCache();
|
|
576
|
-
_this3.recalculateOrderPricesFromSmartPricing();
|
|
577
|
-
// 刷新 holder 表单数据
|
|
578
571
|
if (!_this3.store.holder) {
|
|
579
|
-
_context5.next =
|
|
572
|
+
_context5.next = 3;
|
|
580
573
|
break;
|
|
581
574
|
}
|
|
582
|
-
_context5.next =
|
|
575
|
+
_context5.next = 3;
|
|
583
576
|
return _this3.store.holder.refreshAllFormRecords({
|
|
584
577
|
customer_id: params.customerId,
|
|
585
578
|
useCache: false
|
|
586
579
|
});
|
|
587
|
-
case
|
|
580
|
+
case 3:
|
|
588
581
|
if (!_this3.store.quotation) {
|
|
589
|
-
_context5.next =
|
|
582
|
+
_context5.next = 6;
|
|
590
583
|
break;
|
|
591
584
|
}
|
|
592
|
-
_context5.next =
|
|
585
|
+
_context5.next = 6;
|
|
593
586
|
return _this3.store.quotation.loadQuotations({
|
|
594
587
|
channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
|
|
595
588
|
});
|
|
596
|
-
case
|
|
597
|
-
|
|
589
|
+
case 6:
|
|
590
|
+
_this3.recalculateOrderPricesFromQuotation();
|
|
591
|
+
_context5.next = 9;
|
|
592
|
+
return _this3.store.order.loadDiscountConfig({
|
|
593
|
+
customerId: params.customerId
|
|
594
|
+
});
|
|
595
|
+
case 9:
|
|
596
|
+
_context5.next = 11;
|
|
598
597
|
return _this3.store.order.recalculateSummary({
|
|
599
598
|
createIfMissing: true
|
|
600
599
|
});
|
|
601
|
-
case
|
|
600
|
+
case 11:
|
|
602
601
|
_this3.store.order.persistTempOrder();
|
|
603
|
-
_context5.next =
|
|
602
|
+
_context5.next = 14;
|
|
604
603
|
return _this3.refreshItemRuleQuantityLimits();
|
|
605
|
-
case
|
|
606
|
-
_context5.next =
|
|
604
|
+
case 14:
|
|
605
|
+
_context5.next = 16;
|
|
607
606
|
return _this3.refreshCartValidationPassed();
|
|
608
|
-
case
|
|
609
|
-
_context5.next = 20;
|
|
610
|
-
return (_this3$core = _this3.core) === null || _this3$core === void 0 || (_this3$core = _this3$core.effects) === null || _this3$core === void 0 || (_this3$core$emit = _this3$core.emit) === null || _this3$core$emit === void 0 ? void 0 : _this3$core$emit.call(_this3$core, VenueBookingHooks.onSmartPricingUpdated, {
|
|
611
|
-
customerId: params.customerId
|
|
612
|
-
});
|
|
613
|
-
case 20:
|
|
607
|
+
case 16:
|
|
614
608
|
case "end":
|
|
615
609
|
return _context5.stop();
|
|
616
610
|
}
|
|
@@ -677,6 +671,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
677
671
|
holderModule,
|
|
678
672
|
_this$store$order,
|
|
679
673
|
_this$store$order2,
|
|
674
|
+
_this$store$quotation,
|
|
675
|
+
_this$otherParams11,
|
|
680
676
|
_args7 = arguments;
|
|
681
677
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
682
678
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -684,7 +680,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
684
680
|
options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
685
681
|
this.logMethodStart('initialize');
|
|
686
682
|
this.store = _objectSpread(_objectSpread({}, this.store), options.store);
|
|
687
|
-
this.smartPricingCustomerId = undefined;
|
|
688
683
|
this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
|
|
689
684
|
this.store.status = 'initializing';
|
|
690
685
|
this.store.error = null;
|
|
@@ -702,9 +697,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
702
697
|
passed: null,
|
|
703
698
|
failures: []
|
|
704
699
|
};
|
|
705
|
-
_context7.next =
|
|
700
|
+
_context7.next = 19;
|
|
706
701
|
return _get(_getPrototypeOf(VenueBookingImpl.prototype), "initialize", this).call(this, core, options);
|
|
707
|
-
case
|
|
702
|
+
case 19:
|
|
708
703
|
if (this.store.scanOrderLogger) {
|
|
709
704
|
this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.loggerProvider) || 'feishu');
|
|
710
705
|
this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.loggerConfig) || {
|
|
@@ -828,6 +823,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
828
823
|
})
|
|
829
824
|
});
|
|
830
825
|
this.registerCustomerLoginListeners();
|
|
826
|
+
console.log('[VenueBooking] 初始化开始');
|
|
831
827
|
_context7.prev = 46;
|
|
832
828
|
_context7.next = 49;
|
|
833
829
|
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
@@ -839,28 +835,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
839
835
|
return this.loadRuntimeConfigs();
|
|
840
836
|
case 52:
|
|
841
837
|
if (!this.store.schedule) {
|
|
842
|
-
_context7.next =
|
|
838
|
+
_context7.next = 57;
|
|
843
839
|
break;
|
|
844
840
|
}
|
|
845
841
|
_context7.next = 55;
|
|
846
842
|
return this.store.schedule.loadAllSchedule();
|
|
847
843
|
case 55:
|
|
848
|
-
|
|
849
|
-
|
|
844
|
+
this.injectScheduleResolverToQuotation();
|
|
845
|
+
(_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
|
|
846
|
+
channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel
|
|
847
|
+
});
|
|
850
848
|
case 57:
|
|
849
|
+
_context7.next = 59;
|
|
850
|
+
return this.refreshItemRuleQuantityLimits();
|
|
851
|
+
case 59:
|
|
851
852
|
this.store.status = 'ready';
|
|
852
|
-
|
|
853
|
+
console.log('[VenueBooking] 初始化完成');
|
|
854
|
+
_context7.next = 63;
|
|
853
855
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
854
856
|
status: this.store.status
|
|
855
857
|
});
|
|
856
|
-
case
|
|
858
|
+
case 63:
|
|
857
859
|
this.logMethodSuccess('initialize', {
|
|
858
860
|
status: this.store.status
|
|
859
861
|
});
|
|
860
|
-
_context7.next =
|
|
862
|
+
_context7.next = 73;
|
|
861
863
|
break;
|
|
862
|
-
case
|
|
863
|
-
_context7.prev =
|
|
864
|
+
case 66:
|
|
865
|
+
_context7.prev = 66;
|
|
864
866
|
_context7.t0 = _context7["catch"](46);
|
|
865
867
|
this.store.status = 'error';
|
|
866
868
|
this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
|
|
@@ -869,11 +871,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
869
871
|
status: this.store.status
|
|
870
872
|
});
|
|
871
873
|
throw _context7.t0;
|
|
872
|
-
case
|
|
874
|
+
case 73:
|
|
873
875
|
case "end":
|
|
874
876
|
return _context7.stop();
|
|
875
877
|
}
|
|
876
|
-
}, _callee7, this, [[46,
|
|
878
|
+
}, _callee7, this, [[46, 66]]);
|
|
877
879
|
}));
|
|
878
880
|
function initialize(_x6) {
|
|
879
881
|
return _initialize.apply(this, arguments);
|
|
@@ -892,8 +894,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
892
894
|
_context8.next = 4;
|
|
893
895
|
return this.core.effects.emit(VenueBookingHooks.onDestroy, {});
|
|
894
896
|
case 4:
|
|
897
|
+
console.log('[VenueBooking] 已销毁');
|
|
895
898
|
this.logMethodSuccess('destroy');
|
|
896
|
-
case
|
|
899
|
+
case 6:
|
|
897
900
|
case "end":
|
|
898
901
|
return _context8.stop();
|
|
899
902
|
}
|
|
@@ -912,26 +915,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
912
915
|
while (1) switch (_context9.prev = _context9.next) {
|
|
913
916
|
case 0:
|
|
914
917
|
this.logMethodStart('retryInit');
|
|
915
|
-
|
|
918
|
+
console.log('[VenueBooking] retryInit 调用');
|
|
919
|
+
_context9.next = 4;
|
|
916
920
|
return this.core.effects.emit(VenueBookingHooks.onRetryInit, {});
|
|
917
|
-
case
|
|
918
|
-
_context9.prev =
|
|
919
|
-
_context9.next =
|
|
921
|
+
case 4:
|
|
922
|
+
_context9.prev = 4;
|
|
923
|
+
_context9.next = 7;
|
|
920
924
|
return this.initialize(this.core, this.initializeOptions);
|
|
921
|
-
case
|
|
925
|
+
case 7:
|
|
922
926
|
this.logMethodSuccess('retryInit');
|
|
923
|
-
_context9.next =
|
|
927
|
+
_context9.next = 14;
|
|
924
928
|
break;
|
|
925
|
-
case
|
|
926
|
-
_context9.prev =
|
|
927
|
-
_context9.t0 = _context9["catch"](
|
|
929
|
+
case 10:
|
|
930
|
+
_context9.prev = 10;
|
|
931
|
+
_context9.t0 = _context9["catch"](4);
|
|
928
932
|
this.logMethodError('retryInit', _context9.t0);
|
|
929
933
|
throw _context9.t0;
|
|
930
|
-
case
|
|
934
|
+
case 14:
|
|
931
935
|
case "end":
|
|
932
936
|
return _context9.stop();
|
|
933
937
|
}
|
|
934
|
-
}, _callee9, this, [[
|
|
938
|
+
}, _callee9, this, [[4, 10]]);
|
|
935
939
|
}));
|
|
936
940
|
function retryInit() {
|
|
937
941
|
return _retryInit.apply(this, arguments);
|
|
@@ -946,35 +950,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
946
950
|
while (1) switch (_context10.prev = _context10.next) {
|
|
947
951
|
case 0:
|
|
948
952
|
this.logMethodStart('refresh');
|
|
949
|
-
|
|
953
|
+
console.log('[VenueBooking] refresh 调用');
|
|
954
|
+
_context10.prev = 2;
|
|
950
955
|
this.store.status = 'initializing';
|
|
951
|
-
_context10.next =
|
|
956
|
+
_context10.next = 6;
|
|
952
957
|
return this.loadRuntimeConfigs();
|
|
953
|
-
case
|
|
954
|
-
_context10.next =
|
|
958
|
+
case 6:
|
|
959
|
+
_context10.next = 8;
|
|
955
960
|
return this.refreshItemRuleQuantityLimits();
|
|
956
|
-
case
|
|
961
|
+
case 8:
|
|
957
962
|
this.store.status = 'ready';
|
|
958
|
-
_context10.next =
|
|
963
|
+
_context10.next = 11;
|
|
959
964
|
return this.core.effects.emit(VenueBookingHooks.onRefresh, {
|
|
960
965
|
status: this.store.status
|
|
961
966
|
});
|
|
962
|
-
case
|
|
967
|
+
case 11:
|
|
963
968
|
this.logMethodSuccess('refresh', {
|
|
964
969
|
status: this.store.status
|
|
965
970
|
});
|
|
966
|
-
_context10.next =
|
|
971
|
+
_context10.next = 18;
|
|
967
972
|
break;
|
|
968
|
-
case
|
|
969
|
-
_context10.prev =
|
|
970
|
-
_context10.t0 = _context10["catch"](
|
|
973
|
+
case 14:
|
|
974
|
+
_context10.prev = 14;
|
|
975
|
+
_context10.t0 = _context10["catch"](2);
|
|
971
976
|
this.logMethodError('refresh', _context10.t0);
|
|
972
977
|
throw _context10.t0;
|
|
973
|
-
case
|
|
978
|
+
case 18:
|
|
974
979
|
case "end":
|
|
975
980
|
return _context10.stop();
|
|
976
981
|
}
|
|
977
|
-
}, _callee10, this, [[
|
|
982
|
+
}, _callee10, this, [[2, 14]]);
|
|
978
983
|
}));
|
|
979
984
|
function refresh() {
|
|
980
985
|
return _refresh.apply(this, arguments);
|
|
@@ -1011,113 +1016,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1011
1016
|
};
|
|
1012
1017
|
}
|
|
1013
1018
|
|
|
1014
|
-
/** 清除 slot 价格分段缓存(商品重载 / 登录后 customerId 变化时调用) */
|
|
1015
|
-
}, {
|
|
1016
|
-
key: "clearSlotPriceMapCache",
|
|
1017
|
-
value: function clearSlotPriceMapCache() {
|
|
1018
|
-
this.slotPriceMapCache.clear();
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
/** 读取当前登录 customerId */
|
|
1022
|
-
}, {
|
|
1023
|
-
key: "resolveCustomerIdForSmartPricing",
|
|
1024
|
-
value: function resolveCustomerIdForSmartPricing() {
|
|
1025
|
-
if (this.smartPricingCustomerId) return this.smartPricingCustomerId;
|
|
1026
|
-
try {
|
|
1027
|
-
var _this$core2, _userPlugin$get;
|
|
1028
|
-
var userPlugin = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.getPlugin('user');
|
|
1029
|
-
var customerId = Number(userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get) === null || _userPlugin$get === void 0 || (_userPlugin$get = _userPlugin$get.call(userPlugin)) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id);
|
|
1030
|
-
return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
|
|
1031
|
-
} catch (_unused3) {
|
|
1032
|
-
return undefined;
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
}, {
|
|
1036
|
-
key: "resolveAvailableWalletIdsForSmartPricing",
|
|
1037
|
-
value: function resolveAvailableWalletIdsForSmartPricing() {
|
|
1038
|
-
var _this$store$order3, _this$store$order3$ge, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14;
|
|
1039
|
-
var orderWalletIds = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getAvailableWalletIds) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
1040
|
-
var fallbackWalletIds = ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.available_wallet_ids) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.availableWalletIds) || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.strategy_context) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.available_wallet_ids) || ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 || (_this$otherParams14 = _this$otherParams14.strategy_context) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.availableWalletIds);
|
|
1041
|
-
var source = Array.isArray(orderWalletIds) && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
|
|
1042
|
-
if (!Array.isArray(source)) return [];
|
|
1043
|
-
var ids = source.map(function (item) {
|
|
1044
|
-
return Number(item);
|
|
1045
|
-
}).filter(function (item) {
|
|
1046
|
-
return Number.isFinite(item) && item > 0;
|
|
1047
|
-
});
|
|
1048
|
-
return Array.from(new Set(ids));
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
/** 读取 schedule 全量列表,供智能定价 schedule_match 使用 */
|
|
1052
|
-
}, {
|
|
1053
|
-
key: "getScheduleListForSmartPricing",
|
|
1054
|
-
value: function getScheduleListForSmartPricing() {
|
|
1055
|
-
var _store;
|
|
1056
|
-
var scheduleModule = this.store.schedule;
|
|
1057
|
-
var list = scheduleModule === null || scheduleModule === void 0 || (_store = scheduleModule.store) === null || _store === void 0 ? void 0 : _store.scheduleList;
|
|
1058
|
-
return Array.isArray(list) ? list : [];
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
/** 构建智能定价上下文,对齐 OS Server buildProductFormatterContext */
|
|
1062
|
-
}, {
|
|
1063
|
-
key: "buildSmartPricingContext",
|
|
1064
|
-
value: function buildSmartPricingContext(customerId) {
|
|
1065
|
-
var _this$core3, _this$otherParams15, _this$otherParams16, _this$otherParams17, _this$otherParams18, _this$otherParams19, _this$otherParams20, _this$otherParams21;
|
|
1066
|
-
var evaluator = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.dataVariantEvaluator;
|
|
1067
|
-
return {
|
|
1068
|
-
evaluator: evaluator,
|
|
1069
|
-
scheduleList: this.getScheduleListForSmartPricing(),
|
|
1070
|
-
menuList: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.menuList) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 || (_this$otherParams16 = _this$otherParams16.openData) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.menuList) || [],
|
|
1071
|
-
customerId: customerId !== null && customerId !== void 0 ? customerId : this.resolveCustomerIdForSmartPricing(),
|
|
1072
|
-
availableWalletIds: this.resolveAvailableWalletIdsForSmartPricing(),
|
|
1073
|
-
channel: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.channel,
|
|
1074
|
-
businessCode: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
|
|
1075
|
-
orderType: ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.orderType) || ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.type),
|
|
1076
|
-
strategy_context: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.strategy_context
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
/** venue + addon 全量商品,供智能定价评估 */
|
|
1081
|
-
}, {
|
|
1082
|
-
key: "getAllProductsForSmartPricing",
|
|
1083
|
-
value: function getAllProductsForSmartPricing() {
|
|
1084
|
-
if (this.smartPricingProductCatalog.length) {
|
|
1085
|
-
return this.smartPricingProductCatalog;
|
|
1086
|
-
}
|
|
1087
|
-
var venueList = this.getVenueProducts();
|
|
1088
|
-
var addonList = this.getAddonProductsList();
|
|
1089
|
-
return [].concat(_toConsumableArray(venueList), _toConsumableArray(addonList));
|
|
1090
|
-
}
|
|
1091
|
-
}, {
|
|
1092
|
-
key: "getSlotPriceMapCacheKey",
|
|
1093
|
-
value: function getSlotPriceMapCacheKey(date, context) {
|
|
1094
|
-
var _context$customerId, _context$channel, _context$businessCode;
|
|
1095
|
-
return [date, (_context$customerId = context.customerId) !== null && _context$customerId !== void 0 ? _context$customerId : '', (context.availableWalletIds || []).join(','), (_context$channel = context.channel) !== null && _context$channel !== void 0 ? _context$channel : '', (_context$businessCode = context.businessCode) !== null && _context$businessCode !== void 0 ? _context$businessCode : ''].join('|');
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
/**
|
|
1099
|
-
* 按 schedule 分段构建 slot 价格 Map,带实例级缓存。
|
|
1100
|
-
*/
|
|
1101
|
-
}, {
|
|
1102
|
-
key: "buildSlotPriceMapForDate",
|
|
1103
|
-
value: function buildSlotPriceMapForDate(date, config, productIds) {
|
|
1104
|
-
var context = this.buildSmartPricingContext();
|
|
1105
|
-
var cacheKey = this.getSlotPriceMapCacheKey(date, context);
|
|
1106
|
-
var cached = this.slotPriceMapCache.get(cacheKey);
|
|
1107
|
-
if (cached) return cached;
|
|
1108
|
-
var timeLabels = generateTimeLabels(config);
|
|
1109
|
-
var slotPriceMap = buildSlotPriceMapByScheduleSegments({
|
|
1110
|
-
products: this.getAllProductsForSmartPricing(),
|
|
1111
|
-
productIds: productIds,
|
|
1112
|
-
date: date,
|
|
1113
|
-
timeLabels: timeLabels,
|
|
1114
|
-
config: config,
|
|
1115
|
-
context: context
|
|
1116
|
-
});
|
|
1117
|
-
this.slotPriceMapCache.set(cacheKey, slotPriceMap);
|
|
1118
|
-
return slotPriceMap;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
1019
|
// ─── 场地商品 & 附加商品 ───
|
|
1122
1020
|
}, {
|
|
1123
1021
|
key: "loadAllProducts",
|
|
@@ -1152,7 +1050,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1152
1050
|
key: "_doLoadAllProducts",
|
|
1153
1051
|
value: function () {
|
|
1154
1052
|
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1155
|
-
var _this$
|
|
1053
|
+
var _this$otherParams12, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore, _this$store$order3, _this$store$order3$ge, products;
|
|
1156
1054
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1157
1055
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1158
1056
|
case 0:
|
|
@@ -1173,7 +1071,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1173
1071
|
_context12.next = 8;
|
|
1174
1072
|
return this.loadOpenDataConfig();
|
|
1175
1073
|
case 8:
|
|
1176
|
-
associatedMenus = ((_this$
|
|
1074
|
+
associatedMenus = ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12 = _this$otherParams12.openData) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12['menu.associated_menus']) || [];
|
|
1177
1075
|
if (associatedMenus.length) {
|
|
1178
1076
|
_context12.next = 12;
|
|
1179
1077
|
break;
|
|
@@ -1189,16 +1087,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1189
1087
|
menu_list_ids: menuListIds,
|
|
1190
1088
|
cacheId: this.cacheId,
|
|
1191
1089
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
1192
|
-
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
1193
|
-
with_extra: ['dataVariants']
|
|
1090
|
+
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
1194
1091
|
});
|
|
1195
1092
|
case 15:
|
|
1196
1093
|
allProducts = _context12.sent;
|
|
1197
|
-
|
|
1198
|
-
list = rawList;
|
|
1199
|
-
this.smartPricingProductCatalog = rawList.slice();
|
|
1200
|
-
list = formatProductsWithDataVariant(list, this.buildSmartPricingContext(), dayjs().format('YYYY-MM-DD HH:mm:ss'));
|
|
1201
|
-
this.clearSlotPriceMapCache();
|
|
1094
|
+
list = Array.isArray(allProducts) ? allProducts : [];
|
|
1202
1095
|
venueList = list.filter(function (p) {
|
|
1203
1096
|
return p.duration != null;
|
|
1204
1097
|
});
|
|
@@ -1216,13 +1109,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1216
1109
|
|
|
1217
1110
|
// 加载 holder 表单
|
|
1218
1111
|
if (!this.store.order) {
|
|
1219
|
-
_context12.next =
|
|
1112
|
+
_context12.next = 27;
|
|
1220
1113
|
break;
|
|
1221
1114
|
}
|
|
1222
|
-
products = ((_this$store$
|
|
1223
|
-
_context12.next =
|
|
1115
|
+
products = ((_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderProducts) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3)) || [];
|
|
1116
|
+
_context12.next = 27;
|
|
1224
1117
|
return this.preloadHolderForms(products);
|
|
1225
|
-
case
|
|
1118
|
+
case 27:
|
|
1226
1119
|
this.productsLoaded = true;
|
|
1227
1120
|
this.logMethodSuccess('loadAllProducts', {
|
|
1228
1121
|
total: list.length,
|
|
@@ -1234,16 +1127,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1234
1127
|
venueProducts: venueList,
|
|
1235
1128
|
addonProducts: addonList
|
|
1236
1129
|
});
|
|
1237
|
-
case
|
|
1238
|
-
_context12.prev =
|
|
1130
|
+
case 32:
|
|
1131
|
+
_context12.prev = 32;
|
|
1239
1132
|
_context12.t0 = _context12["catch"](1);
|
|
1240
1133
|
this.logMethodError('loadAllProducts', _context12.t0);
|
|
1241
1134
|
throw _context12.t0;
|
|
1242
|
-
case
|
|
1135
|
+
case 36:
|
|
1243
1136
|
case "end":
|
|
1244
1137
|
return _context12.stop();
|
|
1245
1138
|
}
|
|
1246
|
-
}, _callee12, this, [[1,
|
|
1139
|
+
}, _callee12, this, [[1, 32]]);
|
|
1247
1140
|
}));
|
|
1248
1141
|
function _doLoadAllProducts() {
|
|
1249
1142
|
return _doLoadAllProducts2.apply(this, arguments);
|
|
@@ -1562,11 +1455,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1562
1455
|
config: this.baseSlotConfig,
|
|
1563
1456
|
rawResources: this.store.rawResourceData,
|
|
1564
1457
|
resourceProductMap: this.resourceProductMap,
|
|
1458
|
+
quotationModule: this.store.quotation,
|
|
1565
1459
|
resolveConfig: function resolveConfig(date) {
|
|
1566
1460
|
return _this6.resolveSlotConfigForDate(date);
|
|
1567
|
-
},
|
|
1568
|
-
buildSlotPriceMap: function buildSlotPriceMap(date, config, productIds) {
|
|
1569
|
-
return _this6.buildSlotPriceMapForDate(date, config, productIds);
|
|
1570
1461
|
}
|
|
1571
1462
|
});
|
|
1572
1463
|
}
|
|
@@ -1574,16 +1465,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1574
1465
|
key: "getTimeSlotGrid",
|
|
1575
1466
|
value: function getTimeSlotGrid(date) {
|
|
1576
1467
|
var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
|
|
1577
|
-
var
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1468
|
+
var quotationPriceMap;
|
|
1469
|
+
if (this.store.quotation) {
|
|
1470
|
+
var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
|
|
1471
|
+
return m.productId;
|
|
1472
|
+
})));
|
|
1473
|
+
var timeLabels = generateTimeLabels(resolvedSlotConfig);
|
|
1474
|
+
var timePoints = timeLabels.map(function (label) {
|
|
1475
|
+
return "".concat(date, " ").concat(label);
|
|
1476
|
+
});
|
|
1477
|
+
quotationPriceMap = this.store.quotation.buildProductPriceMap({
|
|
1478
|
+
productIds: productIds,
|
|
1479
|
+
timePoints: timePoints
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1581
1482
|
return buildTimeSlotGrid({
|
|
1582
1483
|
date: date,
|
|
1583
1484
|
config: resolvedSlotConfig,
|
|
1584
1485
|
rawResources: this.store.rawResourceData,
|
|
1585
1486
|
resourceProductMap: this.resourceProductMap,
|
|
1586
|
-
|
|
1487
|
+
quotationPriceMap: quotationPriceMap
|
|
1587
1488
|
});
|
|
1588
1489
|
}
|
|
1589
1490
|
|
|
@@ -1683,8 +1584,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1683
1584
|
}, {
|
|
1684
1585
|
key: "getSelectedSlotsForResource",
|
|
1685
1586
|
value: function getSelectedSlotsForResource(resourceId, productId) {
|
|
1686
|
-
var _this$store$
|
|
1687
|
-
var tempOrder = (_this$store$
|
|
1587
|
+
var _this$store$order4;
|
|
1588
|
+
var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
|
|
1688
1589
|
if (!tempOrder) return [];
|
|
1689
1590
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1690
1591
|
var _p$metadata, _p$metadata2;
|
|
@@ -1845,9 +1746,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1845
1746
|
}, {
|
|
1846
1747
|
key: "getAllSelectedSlots",
|
|
1847
1748
|
value: function getAllSelectedSlots() {
|
|
1848
|
-
var _this$store$
|
|
1749
|
+
var _this$store$order5;
|
|
1849
1750
|
var result = new Map();
|
|
1850
|
-
var tempOrder = (_this$store$
|
|
1751
|
+
var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder();
|
|
1851
1752
|
if (!tempOrder) return result;
|
|
1852
1753
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1853
1754
|
var _p$metadata3;
|
|
@@ -1907,7 +1808,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1907
1808
|
key: "reconcileOrderForResourceProduct",
|
|
1908
1809
|
value: (function () {
|
|
1909
1810
|
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(resourceId, productId, slots) {
|
|
1910
|
-
var _this$store$
|
|
1811
|
+
var _this$store$order6, _this$store$order6$ge;
|
|
1911
1812
|
var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, productTitle, resourceEntry, venueProductOrigin, normalizedVenueOrderProduct, venueOrderProduct, booking, products;
|
|
1912
1813
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1913
1814
|
while (1) switch (_context18.prev = _context18.next) {
|
|
@@ -2086,7 +1987,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2086
1987
|
}
|
|
2087
1988
|
|
|
2088
1989
|
// 获取表单信息
|
|
2089
|
-
products = ((_this$store$
|
|
1990
|
+
products = ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getOrderProducts) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6)) || [];
|
|
2090
1991
|
_context18.next = 25;
|
|
2091
1992
|
return this.preloadHolderForms(products);
|
|
2092
1993
|
case 25:
|
|
@@ -2171,25 +2072,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2171
2072
|
_context19.next = 6;
|
|
2172
2073
|
return this.store.schedule.loadAllSchedule();
|
|
2173
2074
|
case 6:
|
|
2075
|
+
this.injectScheduleResolverToQuotation();
|
|
2174
2076
|
this.logMethodSuccess('loadSchedules');
|
|
2175
|
-
_context19.next =
|
|
2077
|
+
_context19.next = 14;
|
|
2176
2078
|
break;
|
|
2177
|
-
case
|
|
2178
|
-
_context19.prev =
|
|
2079
|
+
case 10:
|
|
2080
|
+
_context19.prev = 10;
|
|
2179
2081
|
_context19.t0 = _context19["catch"](1);
|
|
2180
2082
|
this.logMethodError('loadSchedules', _context19.t0);
|
|
2181
2083
|
throw _context19.t0;
|
|
2182
|
-
case
|
|
2084
|
+
case 14:
|
|
2183
2085
|
case "end":
|
|
2184
2086
|
return _context19.stop();
|
|
2185
2087
|
}
|
|
2186
|
-
}, _callee19, this, [[1,
|
|
2088
|
+
}, _callee19, this, [[1, 10]]);
|
|
2187
2089
|
}));
|
|
2188
2090
|
function loadSchedules() {
|
|
2189
2091
|
return _loadSchedules.apply(this, arguments);
|
|
2190
2092
|
}
|
|
2191
2093
|
return loadSchedules;
|
|
2192
2094
|
}()
|
|
2095
|
+
}, {
|
|
2096
|
+
key: "injectScheduleResolverToQuotation",
|
|
2097
|
+
value: function injectScheduleResolverToQuotation() {
|
|
2098
|
+
var _this9 = this;
|
|
2099
|
+
if (this.store.quotation && this.store.schedule) {
|
|
2100
|
+
this.store.quotation.setScheduleResolver(function (id) {
|
|
2101
|
+
return _this9.store.schedule.getScheduleListByIds([id])[0];
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2193
2105
|
}, {
|
|
2194
2106
|
key: "getScheduleListByIds",
|
|
2195
2107
|
value: function getScheduleListByIds(ids) {
|
|
@@ -2201,8 +2113,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2201
2113
|
}, {
|
|
2202
2114
|
key: "getTempOrder",
|
|
2203
2115
|
value: function getTempOrder() {
|
|
2204
|
-
var _this$store$
|
|
2205
|
-
var result = ((_this$store$
|
|
2116
|
+
var _this$store$order7;
|
|
2117
|
+
var result = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getTempOrder()) || null;
|
|
2206
2118
|
return result;
|
|
2207
2119
|
}
|
|
2208
2120
|
}, {
|
|
@@ -2262,16 +2174,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2262
2174
|
return onCustomerLogin;
|
|
2263
2175
|
}()
|
|
2264
2176
|
}, {
|
|
2265
|
-
key: "
|
|
2266
|
-
value: function
|
|
2177
|
+
key: "recalculateOrderPricesFromQuotation",
|
|
2178
|
+
value: function recalculateOrderPricesFromQuotation() {
|
|
2267
2179
|
var _tempOrder$products,
|
|
2268
|
-
|
|
2269
|
-
if (!this.store.order) return;
|
|
2180
|
+
_this10 = this;
|
|
2181
|
+
if (!this.store.order || !this.store.quotation) return;
|
|
2270
2182
|
var tempOrder = this.store.order.getTempOrder();
|
|
2271
2183
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
2272
2184
|
var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
2273
|
-
var catalog = this.getAllProductsForSmartPricing();
|
|
2274
|
-
var context = this.buildSmartPricingContext();
|
|
2275
2185
|
var _iterator13 = _createForOfIteratorHelper(tempOrder.products),
|
|
2276
2186
|
_step13;
|
|
2277
2187
|
try {
|
|
@@ -2279,40 +2189,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2279
2189
|
var _product$metadata3;
|
|
2280
2190
|
var product = _step13.value;
|
|
2281
2191
|
if ((_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.venue_booking) {
|
|
2282
|
-
var mappings =
|
|
2192
|
+
var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
|
|
2283
2193
|
if (!mappings || !mappings.length) return 0; // continue
|
|
2284
2194
|
var mapping = mappings.find(function (m) {
|
|
2285
2195
|
return Number(m.productId) === Number(product.product_id);
|
|
2286
2196
|
}) || mappings[0];
|
|
2287
2197
|
if (!mapping) return 0; // continue
|
|
2288
|
-
var slots = expandMergedSlotToIndividual(product,
|
|
2289
|
-
var uniqueDates = _toConsumableArray(new Set(slots.map(function (slot) {
|
|
2290
|
-
return dayjs(slot.startTime).format('YYYY-MM-DD');
|
|
2291
|
-
})));
|
|
2292
|
-
var slotPriceMaps = new Map();
|
|
2293
|
-
var _iterator14 = _createForOfIteratorHelper(uniqueDates),
|
|
2294
|
-
_step14;
|
|
2295
|
-
try {
|
|
2296
|
-
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
2297
|
-
var slotDate = _step14.value;
|
|
2298
|
-
slotPriceMaps.set(slotDate, _this9.buildSlotPriceMapForDate(slotDate, _this9.store.slotConfig, [mapping.productId]));
|
|
2299
|
-
}
|
|
2300
|
-
} catch (err) {
|
|
2301
|
-
_iterator14.e(err);
|
|
2302
|
-
} finally {
|
|
2303
|
-
_iterator14.f();
|
|
2304
|
-
}
|
|
2198
|
+
var slots = expandMergedSlotToIndividual(product, _this10.store.slotConfig.slotDurationMinutes);
|
|
2305
2199
|
var updatedSlots = slots.map(function (slot) {
|
|
2306
|
-
var
|
|
2307
|
-
var slotPriceMap = slotPriceMaps.get(slotDate);
|
|
2200
|
+
var _getPriceForProduct;
|
|
2308
2201
|
return _objectSpread(_objectSpread({}, slot), {}, {
|
|
2309
2202
|
productId: mapping.productId,
|
|
2310
|
-
price:
|
|
2311
|
-
slotPriceMap: slotPriceMap,
|
|
2203
|
+
price: (_getPriceForProduct = _this10.store.quotation.getPriceForProduct({
|
|
2312
2204
|
productId: mapping.productId,
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
}) : mapping.price
|
|
2205
|
+
datetime: slot.startTime
|
|
2206
|
+
})) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
|
|
2316
2207
|
});
|
|
2317
2208
|
});
|
|
2318
2209
|
var merged = mergeConsecutiveSlots(updatedSlots);
|
|
@@ -2321,19 +2212,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2321
2212
|
product.original_price = merged[0].totalPrice;
|
|
2322
2213
|
product.metadata.price_breakdown = buildPriceBreakdown({
|
|
2323
2214
|
group: merged[0],
|
|
2324
|
-
productId: mapping.productId
|
|
2215
|
+
productId: mapping.productId,
|
|
2216
|
+
quotation: _this10.store.quotation
|
|
2325
2217
|
});
|
|
2326
2218
|
}
|
|
2327
2219
|
} else if (product.product_id != null) {
|
|
2328
|
-
var
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
datetime: now
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2220
|
+
var _product$product_vari;
|
|
2221
|
+
var quotationPrice = _this10.store.quotation.getPriceForProduct({
|
|
2222
|
+
productId: product.product_id,
|
|
2223
|
+
variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
|
|
2224
|
+
datetime: now
|
|
2225
|
+
});
|
|
2226
|
+
if (quotationPrice !== null) {
|
|
2227
|
+
product.selling_price = quotationPrice;
|
|
2228
|
+
product.original_price = quotationPrice;
|
|
2229
|
+
}
|
|
2337
2230
|
}
|
|
2338
2231
|
},
|
|
2339
2232
|
_ret;
|
|
@@ -2412,7 +2305,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2412
2305
|
key: "setDiscountSelected",
|
|
2413
2306
|
value: (function () {
|
|
2414
2307
|
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2415
|
-
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds,
|
|
2308
|
+
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator14, _step14, d, selectedResourceIds, _iterator15, _step15, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, origin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
2416
2309
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2417
2310
|
while (1) switch (_context22.prev = _context22.next) {
|
|
2418
2311
|
case 0:
|
|
@@ -2472,18 +2365,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2472
2365
|
}).map(function (d) {
|
|
2473
2366
|
return d.id;
|
|
2474
2367
|
}));
|
|
2475
|
-
|
|
2368
|
+
_iterator14 = _createForOfIteratorHelper(nextDiscountList);
|
|
2476
2369
|
try {
|
|
2477
|
-
for (
|
|
2478
|
-
d =
|
|
2370
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
2371
|
+
d = _step14.value;
|
|
2479
2372
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
2480
2373
|
d.isSelected = false;
|
|
2481
2374
|
}
|
|
2482
2375
|
}
|
|
2483
2376
|
} catch (err) {
|
|
2484
|
-
|
|
2377
|
+
_iterator14.e(err);
|
|
2485
2378
|
} finally {
|
|
2486
|
-
|
|
2379
|
+
_iterator14.f();
|
|
2487
2380
|
}
|
|
2488
2381
|
}
|
|
2489
2382
|
}
|
|
@@ -2496,15 +2389,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2496
2389
|
// 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
|
|
2497
2390
|
// 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
|
|
2498
2391
|
// 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
|
|
2499
|
-
|
|
2392
|
+
_iterator15 = _createForOfIteratorHelper(tempOrder.products);
|
|
2500
2393
|
_context22.prev = 19;
|
|
2501
|
-
|
|
2394
|
+
_iterator15.s();
|
|
2502
2395
|
case 21:
|
|
2503
|
-
if ((
|
|
2396
|
+
if ((_step15 = _iterator15.n()).done) {
|
|
2504
2397
|
_context22.next = 36;
|
|
2505
2398
|
break;
|
|
2506
2399
|
}
|
|
2507
|
-
product =
|
|
2400
|
+
product = _step15.value;
|
|
2508
2401
|
origin = this.readProductOriginFromTempOrder(tempOrder, product);
|
|
2509
2402
|
if (!(origin !== null && origin !== void 0 && origin.isManualDiscount)) {
|
|
2510
2403
|
_context22.next = 26;
|
|
@@ -2545,10 +2438,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2545
2438
|
case 38:
|
|
2546
2439
|
_context22.prev = 38;
|
|
2547
2440
|
_context22.t0 = _context22["catch"](19);
|
|
2548
|
-
|
|
2441
|
+
_iterator15.e(_context22.t0);
|
|
2549
2442
|
case 41:
|
|
2550
2443
|
_context22.prev = 41;
|
|
2551
|
-
|
|
2444
|
+
_iterator15.f();
|
|
2552
2445
|
return _context22.finish(41);
|
|
2553
2446
|
case 44:
|
|
2554
2447
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
@@ -2681,7 +2574,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2681
2574
|
key: "submitOrder",
|
|
2682
2575
|
value: function () {
|
|
2683
2576
|
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2684
|
-
var _this$
|
|
2577
|
+
var _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16, _tempOrder$products2, result, tempOrder;
|
|
2685
2578
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2686
2579
|
while (1) switch (_context25.prev = _context25.next) {
|
|
2687
2580
|
case 0:
|
|
@@ -2699,10 +2592,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2699
2592
|
_context25.next = 8;
|
|
2700
2593
|
return this.store.order.submitTempOrder({
|
|
2701
2594
|
cacheId: this.cacheId,
|
|
2702
|
-
platform: (_this$
|
|
2703
|
-
businessCode: (_this$
|
|
2704
|
-
channel: (_this$
|
|
2705
|
-
type: (_this$
|
|
2595
|
+
platform: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.platform,
|
|
2596
|
+
businessCode: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode,
|
|
2597
|
+
channel: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.channel,
|
|
2598
|
+
type: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.type
|
|
2706
2599
|
});
|
|
2707
2600
|
case 8:
|
|
2708
2601
|
result = _context25.sent;
|
|
@@ -2727,111 +2620,64 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2727
2620
|
}
|
|
2728
2621
|
return submitOrder;
|
|
2729
2622
|
}()
|
|
2730
|
-
/**
|
|
2731
|
-
* 0 元订单免费领取(非定金场景)
|
|
2732
|
-
* 与 appointment getFreeProduct 同接口:POST /pay/order/free-pay/:id
|
|
2733
|
-
*/
|
|
2734
|
-
}, {
|
|
2735
|
-
key: "submitFreeOrder",
|
|
2736
|
-
value: (function () {
|
|
2737
|
-
var _submitFreeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(id) {
|
|
2738
|
-
var res;
|
|
2739
|
-
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2740
|
-
while (1) switch (_context26.prev = _context26.next) {
|
|
2741
|
-
case 0:
|
|
2742
|
-
this.logMethodStart('submitFreeOrder', {
|
|
2743
|
-
id: id
|
|
2744
|
-
});
|
|
2745
|
-
_context26.prev = 1;
|
|
2746
|
-
if (id) {
|
|
2747
|
-
_context26.next = 4;
|
|
2748
|
-
break;
|
|
2749
|
-
}
|
|
2750
|
-
throw new Error('订单 ID 不能为空');
|
|
2751
|
-
case 4:
|
|
2752
|
-
_context26.next = 6;
|
|
2753
|
-
return this.request.post("/pay/order/free-pay/".concat(id));
|
|
2754
|
-
case 6:
|
|
2755
|
-
res = _context26.sent;
|
|
2756
|
-
this.logMethodSuccess('submitFreeOrder', {
|
|
2757
|
-
id: id,
|
|
2758
|
-
status: res === null || res === void 0 ? void 0 : res.status
|
|
2759
|
-
});
|
|
2760
|
-
return _context26.abrupt("return", res);
|
|
2761
|
-
case 11:
|
|
2762
|
-
_context26.prev = 11;
|
|
2763
|
-
_context26.t0 = _context26["catch"](1);
|
|
2764
|
-
this.logMethodError('submitFreeOrder', _context26.t0);
|
|
2765
|
-
throw _context26.t0;
|
|
2766
|
-
case 15:
|
|
2767
|
-
case "end":
|
|
2768
|
-
return _context26.stop();
|
|
2769
|
-
}
|
|
2770
|
-
}, _callee26, this, [[1, 11]]);
|
|
2771
|
-
}));
|
|
2772
|
-
function submitFreeOrder(_x17) {
|
|
2773
|
-
return _submitFreeOrder.apply(this, arguments);
|
|
2774
|
-
}
|
|
2775
|
-
return submitFreeOrder;
|
|
2776
|
-
}())
|
|
2777
2623
|
}, {
|
|
2778
2624
|
key: "addProductToOrder",
|
|
2779
2625
|
value: function () {
|
|
2780
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2781
|
-
var _product$metadata6, _product$
|
|
2782
|
-
return _regeneratorRuntime().wrap(function
|
|
2783
|
-
while (1) switch (
|
|
2626
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
|
|
2627
|
+
var _product$metadata6, _product$product_vari2, quotationPrice, products;
|
|
2628
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2629
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2784
2630
|
case 0:
|
|
2785
2631
|
this.logMethodStart('addProductToOrder', {
|
|
2786
2632
|
product_id: product.product_id,
|
|
2787
2633
|
product_variant_id: product.product_variant_id
|
|
2788
2634
|
});
|
|
2789
|
-
|
|
2635
|
+
_context26.prev = 1;
|
|
2790
2636
|
if (this.store.order) {
|
|
2791
|
-
|
|
2637
|
+
_context26.next = 4;
|
|
2792
2638
|
break;
|
|
2793
2639
|
}
|
|
2794
2640
|
throw new Error('order 模块未初始化');
|
|
2795
2641
|
case 4:
|
|
2796
|
-
if (!((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) && product.product_id != null) {
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
2802
|
-
fallbackPrice: product.selling_price
|
|
2642
|
+
if (!((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) && this.store.quotation && product.product_id != null) {
|
|
2643
|
+
quotationPrice = this.store.quotation.getPriceForProduct({
|
|
2644
|
+
productId: product.product_id,
|
|
2645
|
+
variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
|
|
2646
|
+
datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2803
2647
|
});
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2648
|
+
if (quotationPrice !== null) {
|
|
2649
|
+
product.selling_price = quotationPrice;
|
|
2650
|
+
product.original_price = quotationPrice;
|
|
2651
|
+
} else if (product.selling_price != null) {
|
|
2652
|
+
product.original_price = product.selling_price;
|
|
2653
|
+
}
|
|
2808
2654
|
}
|
|
2809
|
-
|
|
2655
|
+
_context26.next = 7;
|
|
2810
2656
|
return this.store.order.addProductToOrder(product);
|
|
2811
2657
|
case 7:
|
|
2812
|
-
products =
|
|
2813
|
-
|
|
2658
|
+
products = _context26.sent;
|
|
2659
|
+
_context26.next = 10;
|
|
2814
2660
|
return this.refreshItemRuleQuantityLimits();
|
|
2815
2661
|
case 10:
|
|
2816
|
-
|
|
2662
|
+
_context26.next = 12;
|
|
2817
2663
|
return this.refreshCartValidationPassed();
|
|
2818
2664
|
case 12:
|
|
2819
2665
|
this.logMethodSuccess('addProductToOrder', {
|
|
2820
2666
|
productCount: products.length
|
|
2821
2667
|
});
|
|
2822
|
-
return
|
|
2668
|
+
return _context26.abrupt("return", products);
|
|
2823
2669
|
case 16:
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
this.logMethodError('addProductToOrder',
|
|
2827
|
-
throw
|
|
2670
|
+
_context26.prev = 16;
|
|
2671
|
+
_context26.t0 = _context26["catch"](1);
|
|
2672
|
+
this.logMethodError('addProductToOrder', _context26.t0);
|
|
2673
|
+
throw _context26.t0;
|
|
2828
2674
|
case 20:
|
|
2829
2675
|
case "end":
|
|
2830
|
-
return
|
|
2676
|
+
return _context26.stop();
|
|
2831
2677
|
}
|
|
2832
|
-
},
|
|
2678
|
+
}, _callee26, this, [[1, 16]]);
|
|
2833
2679
|
}));
|
|
2834
|
-
function addProductToOrder(
|
|
2680
|
+
function addProductToOrder(_x17) {
|
|
2835
2681
|
return _addProductToOrder.apply(this, arguments);
|
|
2836
2682
|
}
|
|
2837
2683
|
return addProductToOrder;
|
|
@@ -2839,48 +2685,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2839
2685
|
}, {
|
|
2840
2686
|
key: "updateOrderProduct",
|
|
2841
2687
|
value: function () {
|
|
2842
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2688
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2843
2689
|
var products;
|
|
2844
|
-
return _regeneratorRuntime().wrap(function
|
|
2845
|
-
while (1) switch (
|
|
2690
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2691
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2846
2692
|
case 0:
|
|
2847
2693
|
this.logMethodStart('updateOrderProduct', {
|
|
2848
2694
|
product_id: params.product_id,
|
|
2849
2695
|
product_variant_id: params.product_variant_id
|
|
2850
2696
|
});
|
|
2851
|
-
|
|
2697
|
+
_context27.prev = 1;
|
|
2852
2698
|
if (this.store.order) {
|
|
2853
|
-
|
|
2699
|
+
_context27.next = 4;
|
|
2854
2700
|
break;
|
|
2855
2701
|
}
|
|
2856
2702
|
throw new Error('order 模块未初始化');
|
|
2857
2703
|
case 4:
|
|
2858
|
-
|
|
2704
|
+
_context27.next = 6;
|
|
2859
2705
|
return this.store.order.updateOrderProduct(params);
|
|
2860
2706
|
case 6:
|
|
2861
|
-
products =
|
|
2862
|
-
|
|
2707
|
+
products = _context27.sent;
|
|
2708
|
+
_context27.next = 9;
|
|
2863
2709
|
return this.refreshItemRuleQuantityLimits();
|
|
2864
2710
|
case 9:
|
|
2865
|
-
|
|
2711
|
+
_context27.next = 11;
|
|
2866
2712
|
return this.refreshCartValidationPassed();
|
|
2867
2713
|
case 11:
|
|
2868
2714
|
this.logMethodSuccess('updateOrderProduct', {
|
|
2869
2715
|
productCount: products.length
|
|
2870
2716
|
});
|
|
2871
|
-
return
|
|
2717
|
+
return _context27.abrupt("return", products);
|
|
2872
2718
|
case 15:
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
this.logMethodError('updateOrderProduct',
|
|
2876
|
-
throw
|
|
2719
|
+
_context27.prev = 15;
|
|
2720
|
+
_context27.t0 = _context27["catch"](1);
|
|
2721
|
+
this.logMethodError('updateOrderProduct', _context27.t0);
|
|
2722
|
+
throw _context27.t0;
|
|
2877
2723
|
case 19:
|
|
2878
2724
|
case "end":
|
|
2879
|
-
return
|
|
2725
|
+
return _context27.stop();
|
|
2880
2726
|
}
|
|
2881
|
-
},
|
|
2727
|
+
}, _callee27, this, [[1, 15]]);
|
|
2882
2728
|
}));
|
|
2883
|
-
function updateOrderProduct(
|
|
2729
|
+
function updateOrderProduct(_x18) {
|
|
2884
2730
|
return _updateOrderProduct.apply(this, arguments);
|
|
2885
2731
|
}
|
|
2886
2732
|
return updateOrderProduct;
|
|
@@ -2888,66 +2734,66 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2888
2734
|
}, {
|
|
2889
2735
|
key: "removeProductFromOrder",
|
|
2890
2736
|
value: function () {
|
|
2891
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2892
|
-
var _this$store$order$get3, _this$store$
|
|
2893
|
-
return _regeneratorRuntime().wrap(function
|
|
2894
|
-
while (1) switch (
|
|
2737
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
|
|
2738
|
+
var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata7, _product$metadata8, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
|
|
2739
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2740
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2895
2741
|
case 0:
|
|
2896
2742
|
this.logMethodStart('removeProductFromOrder', {
|
|
2897
2743
|
product_id: identity.product_id,
|
|
2898
2744
|
product_variant_id: identity.product_variant_id
|
|
2899
2745
|
});
|
|
2900
|
-
|
|
2746
|
+
_context28.prev = 1;
|
|
2901
2747
|
if (this.store.order) {
|
|
2902
|
-
|
|
2748
|
+
_context28.next = 4;
|
|
2903
2749
|
break;
|
|
2904
2750
|
}
|
|
2905
2751
|
throw new Error('order 模块未初始化');
|
|
2906
2752
|
case 4:
|
|
2907
|
-
tempOrder = ((_this$store$order$get3 = (_this$store$
|
|
2908
|
-
|
|
2753
|
+
tempOrder = ((_this$store$order$get3 = (_this$store$order8 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order8)) || ((_this$store$order$ens = (_this$store$order9 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order9));
|
|
2754
|
+
_context28.next = 7;
|
|
2909
2755
|
return this.store.order.removeProductFromOrder(identity);
|
|
2910
2756
|
case 7:
|
|
2911
|
-
products =
|
|
2757
|
+
products = _context28.sent;
|
|
2912
2758
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
2913
|
-
|
|
2759
|
+
_context28.next = 33;
|
|
2914
2760
|
break;
|
|
2915
2761
|
}
|
|
2916
2762
|
venueProductUids = new Set();
|
|
2917
2763
|
venueBookingUids = new Set();
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2764
|
+
_iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2765
|
+
_context28.prev = 12;
|
|
2766
|
+
_iterator16.s();
|
|
2921
2767
|
case 14:
|
|
2922
|
-
if ((
|
|
2923
|
-
|
|
2768
|
+
if ((_step16 = _iterator16.n()).done) {
|
|
2769
|
+
_context28.next = 22;
|
|
2924
2770
|
break;
|
|
2925
2771
|
}
|
|
2926
|
-
product =
|
|
2927
|
-
if (product !== null && product !== void 0 && (_product$
|
|
2928
|
-
|
|
2772
|
+
product = _step16.value;
|
|
2773
|
+
if (product !== null && product !== void 0 && (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking) {
|
|
2774
|
+
_context28.next = 18;
|
|
2929
2775
|
break;
|
|
2930
2776
|
}
|
|
2931
|
-
return
|
|
2777
|
+
return _context28.abrupt("continue", 20);
|
|
2932
2778
|
case 18:
|
|
2933
2779
|
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
2934
|
-
if ((_product$
|
|
2780
|
+
if ((_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.booking_uid) {
|
|
2935
2781
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2936
2782
|
}
|
|
2937
2783
|
case 20:
|
|
2938
|
-
|
|
2784
|
+
_context28.next = 14;
|
|
2939
2785
|
break;
|
|
2940
2786
|
case 22:
|
|
2941
|
-
|
|
2787
|
+
_context28.next = 27;
|
|
2942
2788
|
break;
|
|
2943
2789
|
case 24:
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2790
|
+
_context28.prev = 24;
|
|
2791
|
+
_context28.t0 = _context28["catch"](12);
|
|
2792
|
+
_iterator16.e(_context28.t0);
|
|
2947
2793
|
case 27:
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
return
|
|
2794
|
+
_context28.prev = 27;
|
|
2795
|
+
_iterator16.f();
|
|
2796
|
+
return _context28.finish(27);
|
|
2951
2797
|
case 30:
|
|
2952
2798
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2953
2799
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
@@ -2961,31 +2807,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2961
2807
|
return true;
|
|
2962
2808
|
});
|
|
2963
2809
|
if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
|
|
2964
|
-
(_this$store$order$per = (_this$store$
|
|
2810
|
+
(_this$store$order$per = (_this$store$order10 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order10);
|
|
2965
2811
|
}
|
|
2966
2812
|
case 33:
|
|
2967
|
-
|
|
2813
|
+
_context28.next = 35;
|
|
2968
2814
|
return this.refreshItemRuleQuantityLimits();
|
|
2969
2815
|
case 35:
|
|
2970
|
-
|
|
2816
|
+
_context28.next = 37;
|
|
2971
2817
|
return this.refreshCartValidationPassed();
|
|
2972
2818
|
case 37:
|
|
2973
2819
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2974
2820
|
productCount: products.length
|
|
2975
2821
|
});
|
|
2976
|
-
return
|
|
2822
|
+
return _context28.abrupt("return", products);
|
|
2977
2823
|
case 41:
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
this.logMethodError('removeProductFromOrder',
|
|
2981
|
-
throw
|
|
2824
|
+
_context28.prev = 41;
|
|
2825
|
+
_context28.t1 = _context28["catch"](1);
|
|
2826
|
+
this.logMethodError('removeProductFromOrder', _context28.t1);
|
|
2827
|
+
throw _context28.t1;
|
|
2982
2828
|
case 45:
|
|
2983
2829
|
case "end":
|
|
2984
|
-
return
|
|
2830
|
+
return _context28.stop();
|
|
2985
2831
|
}
|
|
2986
|
-
},
|
|
2832
|
+
}, _callee28, this, [[1, 41], [12, 24, 27, 30]]);
|
|
2987
2833
|
}));
|
|
2988
|
-
function removeProductFromOrder(
|
|
2834
|
+
function removeProductFromOrder(_x19) {
|
|
2989
2835
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2990
2836
|
}
|
|
2991
2837
|
return removeProductFromOrder;
|
|
@@ -2993,27 +2839,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2993
2839
|
}, {
|
|
2994
2840
|
key: "getProductList",
|
|
2995
2841
|
value: function () {
|
|
2996
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2842
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2997
2843
|
var result;
|
|
2998
|
-
return _regeneratorRuntime().wrap(function
|
|
2999
|
-
while (1) switch (
|
|
2844
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2845
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3000
2846
|
case 0:
|
|
3001
2847
|
if (!this.productsLoaded) {
|
|
3002
|
-
|
|
2848
|
+
_context29.next = 2;
|
|
3003
2849
|
break;
|
|
3004
2850
|
}
|
|
3005
|
-
return
|
|
2851
|
+
return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
3006
2852
|
case 2:
|
|
3007
|
-
|
|
2853
|
+
_context29.next = 4;
|
|
3008
2854
|
return this.loadAllProducts();
|
|
3009
2855
|
case 4:
|
|
3010
|
-
result =
|
|
3011
|
-
return
|
|
2856
|
+
result = _context29.sent;
|
|
2857
|
+
return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
3012
2858
|
case 6:
|
|
3013
2859
|
case "end":
|
|
3014
|
-
return
|
|
2860
|
+
return _context29.stop();
|
|
3015
2861
|
}
|
|
3016
|
-
},
|
|
2862
|
+
}, _callee29, this);
|
|
3017
2863
|
}));
|
|
3018
2864
|
function getProductList() {
|
|
3019
2865
|
return _getProductList.apply(this, arguments);
|
|
@@ -3023,13 +2869,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3023
2869
|
}, {
|
|
3024
2870
|
key: "loadOpenDataConfig",
|
|
3025
2871
|
value: function () {
|
|
3026
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2872
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
3027
2873
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
3028
|
-
return _regeneratorRuntime().wrap(function
|
|
3029
|
-
while (1) switch (
|
|
2874
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2875
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3030
2876
|
case 0:
|
|
3031
2877
|
if (this.store.openData) {
|
|
3032
|
-
|
|
2878
|
+
_context30.next = 2;
|
|
3033
2879
|
break;
|
|
3034
2880
|
}
|
|
3035
2881
|
throw new Error('openData 模块未初始化');
|
|
@@ -3037,42 +2883,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3037
2883
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
3038
2884
|
cachedData = this.store.openData.getOpenData();
|
|
3039
2885
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
3040
|
-
|
|
2886
|
+
_context30.next = 7;
|
|
3041
2887
|
break;
|
|
3042
2888
|
}
|
|
3043
2889
|
this.otherParams.openData = cachedData;
|
|
3044
|
-
return
|
|
2890
|
+
return _context30.abrupt("return", cachedData);
|
|
3045
2891
|
case 7:
|
|
3046
2892
|
if (!this.loadOpenDataConfigInFlight) {
|
|
3047
|
-
|
|
2893
|
+
_context30.next = 11;
|
|
3048
2894
|
break;
|
|
3049
2895
|
}
|
|
3050
|
-
|
|
2896
|
+
_context30.next = 10;
|
|
3051
2897
|
return this.loadOpenDataConfigInFlight;
|
|
3052
2898
|
case 10:
|
|
3053
|
-
return
|
|
2899
|
+
return _context30.abrupt("return", _context30.sent);
|
|
3054
2900
|
case 11:
|
|
3055
2901
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
3056
2902
|
scope: 'board',
|
|
3057
2903
|
target: 'venue_booking+online_store',
|
|
3058
2904
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
3059
2905
|
});
|
|
3060
|
-
|
|
3061
|
-
|
|
2906
|
+
_context30.prev = 12;
|
|
2907
|
+
_context30.next = 15;
|
|
3062
2908
|
return this.loadOpenDataConfigInFlight;
|
|
3063
2909
|
case 15:
|
|
3064
|
-
openDataConfig =
|
|
2910
|
+
openDataConfig = _context30.sent;
|
|
3065
2911
|
this.otherParams.openData = openDataConfig;
|
|
3066
|
-
return
|
|
2912
|
+
return _context30.abrupt("return", openDataConfig);
|
|
3067
2913
|
case 18:
|
|
3068
|
-
|
|
2914
|
+
_context30.prev = 18;
|
|
3069
2915
|
this.loadOpenDataConfigInFlight = null;
|
|
3070
|
-
return
|
|
2916
|
+
return _context30.finish(18);
|
|
3071
2917
|
case 21:
|
|
3072
2918
|
case "end":
|
|
3073
|
-
return
|
|
2919
|
+
return _context30.stop();
|
|
3074
2920
|
}
|
|
3075
|
-
},
|
|
2921
|
+
}, _callee30, this, [[12,, 18, 21]]);
|
|
3076
2922
|
}));
|
|
3077
2923
|
function loadOpenDataConfig() {
|
|
3078
2924
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -3082,29 +2928,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3082
2928
|
}, {
|
|
3083
2929
|
key: "loadRuntimeConfigs",
|
|
3084
2930
|
value: function () {
|
|
3085
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2931
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
3086
2932
|
var itemRuleConfigs;
|
|
3087
|
-
return _regeneratorRuntime().wrap(function
|
|
3088
|
-
while (1) switch (
|
|
2933
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2934
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3089
2935
|
case 0:
|
|
3090
|
-
|
|
2936
|
+
_context31.next = 2;
|
|
3091
2937
|
return this.loadOpenDataConfig();
|
|
3092
2938
|
case 2:
|
|
3093
|
-
|
|
2939
|
+
_context31.next = 4;
|
|
3094
2940
|
return this.ensureItemRuleConfigsLoaded();
|
|
3095
2941
|
case 4:
|
|
3096
|
-
itemRuleConfigs =
|
|
2942
|
+
itemRuleConfigs = _context31.sent;
|
|
3097
2943
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
3098
2944
|
itemRuleCount: itemRuleConfigs.length
|
|
3099
2945
|
});
|
|
3100
|
-
return
|
|
2946
|
+
return _context31.abrupt("return", {
|
|
3101
2947
|
itemRuleConfigs: itemRuleConfigs
|
|
3102
2948
|
});
|
|
3103
2949
|
case 7:
|
|
3104
2950
|
case "end":
|
|
3105
|
-
return
|
|
2951
|
+
return _context31.stop();
|
|
3106
2952
|
}
|
|
3107
|
-
},
|
|
2953
|
+
}, _callee31, this);
|
|
3108
2954
|
}));
|
|
3109
2955
|
function loadRuntimeConfigs() {
|
|
3110
2956
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -3114,22 +2960,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3114
2960
|
}, {
|
|
3115
2961
|
key: "fetchItemRuleConfigsByModelIds",
|
|
3116
2962
|
value: function () {
|
|
3117
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2963
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(strategyModelIds) {
|
|
3118
2964
|
var result, configs;
|
|
3119
|
-
return _regeneratorRuntime().wrap(function
|
|
3120
|
-
while (1) switch (
|
|
2965
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2966
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3121
2967
|
case 0:
|
|
3122
2968
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
3123
2969
|
strategyModelIds: strategyModelIds
|
|
3124
2970
|
});
|
|
3125
2971
|
if (strategyModelIds.length) {
|
|
3126
|
-
|
|
2972
|
+
_context32.next = 3;
|
|
3127
2973
|
break;
|
|
3128
2974
|
}
|
|
3129
|
-
return
|
|
2975
|
+
return _context32.abrupt("return", []);
|
|
3130
2976
|
case 3:
|
|
3131
|
-
|
|
3132
|
-
|
|
2977
|
+
_context32.prev = 3;
|
|
2978
|
+
_context32.next = 6;
|
|
3133
2979
|
return this.request.get('/promotion', {
|
|
3134
2980
|
skip: 1,
|
|
3135
2981
|
num: 99,
|
|
@@ -3137,7 +2983,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3137
2983
|
ids: strategyModelIds
|
|
3138
2984
|
});
|
|
3139
2985
|
case 6:
|
|
3140
|
-
result =
|
|
2986
|
+
result = _context32.sent;
|
|
3141
2987
|
configs = [];
|
|
3142
2988
|
if (result.code === 200) {
|
|
3143
2989
|
configs = result.data.list.map(function (item) {
|
|
@@ -3148,21 +2994,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3148
2994
|
strategyModelIds: strategyModelIds,
|
|
3149
2995
|
strategyCount: configs.length
|
|
3150
2996
|
});
|
|
3151
|
-
return
|
|
2997
|
+
return _context32.abrupt("return", configs);
|
|
3152
2998
|
case 13:
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
2999
|
+
_context32.prev = 13;
|
|
3000
|
+
_context32.t0 = _context32["catch"](3);
|
|
3001
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context32.t0, {
|
|
3156
3002
|
strategyModelIds: strategyModelIds
|
|
3157
3003
|
});
|
|
3158
|
-
return
|
|
3004
|
+
return _context32.abrupt("return", []);
|
|
3159
3005
|
case 17:
|
|
3160
3006
|
case "end":
|
|
3161
|
-
return
|
|
3007
|
+
return _context32.stop();
|
|
3162
3008
|
}
|
|
3163
|
-
},
|
|
3009
|
+
}, _callee32, this, [[3, 13]]);
|
|
3164
3010
|
}));
|
|
3165
|
-
function fetchItemRuleConfigsByModelIds(
|
|
3011
|
+
function fetchItemRuleConfigsByModelIds(_x20) {
|
|
3166
3012
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
3167
3013
|
}
|
|
3168
3014
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -3170,22 +3016,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3170
3016
|
}, {
|
|
3171
3017
|
key: "buildPrefillProductSourceMap",
|
|
3172
3018
|
value: function () {
|
|
3173
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3019
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
3174
3020
|
var sourceMap, productList, visited, collectFromValue;
|
|
3175
|
-
return _regeneratorRuntime().wrap(function
|
|
3176
|
-
while (1) switch (
|
|
3021
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3022
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3177
3023
|
case 0:
|
|
3178
3024
|
sourceMap = new Map();
|
|
3179
|
-
|
|
3180
|
-
|
|
3025
|
+
_context33.prev = 1;
|
|
3026
|
+
_context33.next = 4;
|
|
3181
3027
|
return this.getProductList();
|
|
3182
3028
|
case 4:
|
|
3183
|
-
productList =
|
|
3029
|
+
productList = _context33.sent;
|
|
3184
3030
|
if (Array.isArray(productList)) {
|
|
3185
|
-
|
|
3031
|
+
_context33.next = 7;
|
|
3186
3032
|
break;
|
|
3187
3033
|
}
|
|
3188
|
-
return
|
|
3034
|
+
return _context33.abrupt("return", sourceMap);
|
|
3189
3035
|
case 7:
|
|
3190
3036
|
visited = new Set();
|
|
3191
3037
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -3194,17 +3040,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3194
3040
|
if (visited.has(value)) return;
|
|
3195
3041
|
visited.add(value);
|
|
3196
3042
|
if (Array.isArray(value)) {
|
|
3197
|
-
var
|
|
3198
|
-
|
|
3043
|
+
var _iterator17 = _createForOfIteratorHelper(value),
|
|
3044
|
+
_step17;
|
|
3199
3045
|
try {
|
|
3200
|
-
for (
|
|
3201
|
-
var item =
|
|
3046
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
3047
|
+
var item = _step17.value;
|
|
3202
3048
|
collectFromValue(item);
|
|
3203
3049
|
}
|
|
3204
3050
|
} catch (err) {
|
|
3205
|
-
|
|
3051
|
+
_iterator17.e(err);
|
|
3206
3052
|
} finally {
|
|
3207
|
-
|
|
3053
|
+
_iterator17.f();
|
|
3208
3054
|
}
|
|
3209
3055
|
return;
|
|
3210
3056
|
}
|
|
@@ -3224,19 +3070,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3224
3070
|
}
|
|
3225
3071
|
};
|
|
3226
3072
|
collectFromValue(productList);
|
|
3227
|
-
|
|
3073
|
+
_context33.next = 15;
|
|
3228
3074
|
break;
|
|
3229
3075
|
case 12:
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
3076
|
+
_context33.prev = 12;
|
|
3077
|
+
_context33.t0 = _context33["catch"](1);
|
|
3078
|
+
this.logMethodError('buildPrefillProductSourceMap', _context33.t0);
|
|
3233
3079
|
case 15:
|
|
3234
|
-
return
|
|
3080
|
+
return _context33.abrupt("return", sourceMap);
|
|
3235
3081
|
case 16:
|
|
3236
3082
|
case "end":
|
|
3237
|
-
return
|
|
3083
|
+
return _context33.stop();
|
|
3238
3084
|
}
|
|
3239
|
-
},
|
|
3085
|
+
}, _callee33, this, [[1, 12]]);
|
|
3240
3086
|
}));
|
|
3241
3087
|
function buildPrefillProductSourceMap() {
|
|
3242
3088
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -3251,56 +3097,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3251
3097
|
}, {
|
|
3252
3098
|
key: "ensureItemRuleConfigsLoaded",
|
|
3253
3099
|
value: function () {
|
|
3254
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3255
|
-
var
|
|
3256
|
-
return _regeneratorRuntime().wrap(function
|
|
3257
|
-
while (1) switch (
|
|
3100
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
3101
|
+
var _this11 = this;
|
|
3102
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3103
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3258
3104
|
case 0:
|
|
3259
3105
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
3260
|
-
|
|
3106
|
+
_context35.next = 2;
|
|
3261
3107
|
break;
|
|
3262
3108
|
}
|
|
3263
|
-
return
|
|
3109
|
+
return _context35.abrupt("return", this.itemRuleConfigs);
|
|
3264
3110
|
case 2:
|
|
3265
3111
|
if (!this.itemRuleConfigsPromise) {
|
|
3266
|
-
|
|
3112
|
+
_context35.next = 4;
|
|
3267
3113
|
break;
|
|
3268
3114
|
}
|
|
3269
|
-
return
|
|
3115
|
+
return _context35.abrupt("return", this.itemRuleConfigsPromise);
|
|
3270
3116
|
case 4:
|
|
3271
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3117
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3272
3118
|
var runtimeConfig, staticConfigs;
|
|
3273
|
-
return _regeneratorRuntime().wrap(function
|
|
3274
|
-
while (1) switch (
|
|
3119
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3120
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3275
3121
|
case 0:
|
|
3276
|
-
runtimeConfig =
|
|
3122
|
+
runtimeConfig = _this11.getItemRuleRuntimeConfig();
|
|
3277
3123
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
3278
3124
|
if (!(staticConfigs.length > 0)) {
|
|
3279
|
-
|
|
3125
|
+
_context34.next = 6;
|
|
3280
3126
|
break;
|
|
3281
3127
|
}
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
return
|
|
3128
|
+
_this11.itemRuleConfigs = staticConfigs;
|
|
3129
|
+
_this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3130
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
3285
3131
|
case 6:
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
return
|
|
3132
|
+
_this11.itemRuleConfigs = [];
|
|
3133
|
+
_this11.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3134
|
+
return _context34.abrupt("return", _this11.itemRuleConfigs);
|
|
3289
3135
|
case 9:
|
|
3290
3136
|
case "end":
|
|
3291
|
-
return
|
|
3137
|
+
return _context34.stop();
|
|
3292
3138
|
}
|
|
3293
|
-
},
|
|
3139
|
+
}, _callee34);
|
|
3294
3140
|
}))();
|
|
3295
|
-
|
|
3141
|
+
_context35.next = 7;
|
|
3296
3142
|
return this.itemRuleConfigsPromise;
|
|
3297
3143
|
case 7:
|
|
3298
|
-
return
|
|
3144
|
+
return _context35.abrupt("return", _context35.sent);
|
|
3299
3145
|
case 8:
|
|
3300
3146
|
case "end":
|
|
3301
|
-
return
|
|
3147
|
+
return _context35.stop();
|
|
3302
3148
|
}
|
|
3303
|
-
},
|
|
3149
|
+
}, _callee35, this);
|
|
3304
3150
|
}));
|
|
3305
3151
|
function ensureItemRuleConfigsLoaded() {
|
|
3306
3152
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -3310,22 +3156,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3310
3156
|
}, {
|
|
3311
3157
|
key: "refreshItemRuleQuantityLimits",
|
|
3312
3158
|
value: function () {
|
|
3313
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3159
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
3314
3160
|
var strategyConfigs, businessData, limits;
|
|
3315
|
-
return _regeneratorRuntime().wrap(function
|
|
3316
|
-
while (1) switch (
|
|
3161
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3162
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3317
3163
|
case 0:
|
|
3318
|
-
|
|
3319
|
-
|
|
3164
|
+
_context36.prev = 0;
|
|
3165
|
+
_context36.next = 3;
|
|
3320
3166
|
return this.ensureItemRuleConfigsLoaded();
|
|
3321
3167
|
case 3:
|
|
3322
|
-
strategyConfigs =
|
|
3168
|
+
strategyConfigs = _context36.sent;
|
|
3323
3169
|
if (strategyConfigs.length) {
|
|
3324
|
-
|
|
3170
|
+
_context36.next = 7;
|
|
3325
3171
|
break;
|
|
3326
3172
|
}
|
|
3327
3173
|
this.store.itemRuleQuantityLimits = [];
|
|
3328
|
-
return
|
|
3174
|
+
return _context36.abrupt("return", []);
|
|
3329
3175
|
case 7:
|
|
3330
3176
|
businessData = buildItemRuleBusinessData({
|
|
3331
3177
|
tempOrder: this.ensureVenueTempOrder(),
|
|
@@ -3337,18 +3183,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3337
3183
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
3338
3184
|
limitCount: limits.length
|
|
3339
3185
|
});
|
|
3340
|
-
return
|
|
3186
|
+
return _context36.abrupt("return", limits);
|
|
3341
3187
|
case 14:
|
|
3342
|
-
|
|
3343
|
-
|
|
3188
|
+
_context36.prev = 14;
|
|
3189
|
+
_context36.t0 = _context36["catch"](0);
|
|
3344
3190
|
this.store.itemRuleQuantityLimits = [];
|
|
3345
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
3346
|
-
return
|
|
3191
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context36.t0);
|
|
3192
|
+
return _context36.abrupt("return", []);
|
|
3347
3193
|
case 19:
|
|
3348
3194
|
case "end":
|
|
3349
|
-
return
|
|
3195
|
+
return _context36.stop();
|
|
3350
3196
|
}
|
|
3351
|
-
},
|
|
3197
|
+
}, _callee36, this, [[0, 14]]);
|
|
3352
3198
|
}));
|
|
3353
3199
|
function refreshItemRuleQuantityLimits() {
|
|
3354
3200
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -3358,32 +3204,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3358
3204
|
}, {
|
|
3359
3205
|
key: "applyPrefillByItemRule",
|
|
3360
3206
|
value: function () {
|
|
3361
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3362
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
3363
|
-
return _regeneratorRuntime().wrap(function
|
|
3364
|
-
while (1) switch (
|
|
3207
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
3208
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _product$metadata9, sellingPrice, origin, product, productUid, targetProduct, previousOrigin, nextOrigin, existedQuantity, delta, nextProduct, _nextProduct$metadata, _productUid;
|
|
3209
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3210
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3365
3211
|
case 0:
|
|
3366
3212
|
if (!this.itemRulePrefillApplied) {
|
|
3367
|
-
|
|
3213
|
+
_context37.next = 2;
|
|
3368
3214
|
break;
|
|
3369
3215
|
}
|
|
3370
|
-
return
|
|
3216
|
+
return _context37.abrupt("return");
|
|
3371
3217
|
case 2:
|
|
3372
3218
|
if (this.store.order) {
|
|
3373
|
-
|
|
3219
|
+
_context37.next = 4;
|
|
3374
3220
|
break;
|
|
3375
3221
|
}
|
|
3376
|
-
return
|
|
3222
|
+
return _context37.abrupt("return");
|
|
3377
3223
|
case 4:
|
|
3378
|
-
|
|
3224
|
+
_context37.next = 6;
|
|
3379
3225
|
return this.ensureItemRuleConfigsLoaded();
|
|
3380
3226
|
case 6:
|
|
3381
|
-
strategyConfigs =
|
|
3227
|
+
strategyConfigs = _context37.sent;
|
|
3382
3228
|
if (strategyConfigs.length) {
|
|
3383
|
-
|
|
3229
|
+
_context37.next = 9;
|
|
3384
3230
|
break;
|
|
3385
3231
|
}
|
|
3386
|
-
return
|
|
3232
|
+
return _context37.abrupt("return");
|
|
3387
3233
|
case 9:
|
|
3388
3234
|
businessData = buildItemRuleBusinessData({
|
|
3389
3235
|
tempOrder: this.ensureVenueTempOrder(),
|
|
@@ -3392,41 +3238,41 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3392
3238
|
});
|
|
3393
3239
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3394
3240
|
if (prefillItems.length) {
|
|
3395
|
-
|
|
3241
|
+
_context37.next = 14;
|
|
3396
3242
|
break;
|
|
3397
3243
|
}
|
|
3398
3244
|
this.itemRulePrefillApplied = true;
|
|
3399
|
-
return
|
|
3245
|
+
return _context37.abrupt("return");
|
|
3400
3246
|
case 14:
|
|
3401
|
-
|
|
3247
|
+
_context37.next = 16;
|
|
3402
3248
|
return this.buildPrefillProductSourceMap();
|
|
3403
3249
|
case 16:
|
|
3404
|
-
productSourceMap =
|
|
3250
|
+
productSourceMap = _context37.sent;
|
|
3405
3251
|
tempOrder = this.ensureVenueTempOrder();
|
|
3406
3252
|
hasChanges = false;
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3253
|
+
_iterator18 = _createForOfIteratorHelper(prefillItems);
|
|
3254
|
+
_context37.prev = 20;
|
|
3255
|
+
_iterator18.s();
|
|
3410
3256
|
case 22:
|
|
3411
|
-
if ((
|
|
3412
|
-
|
|
3257
|
+
if ((_step18 = _iterator18.n()).done) {
|
|
3258
|
+
_context37.next = 51;
|
|
3413
3259
|
break;
|
|
3414
3260
|
}
|
|
3415
|
-
prefillItem =
|
|
3261
|
+
prefillItem = _step18.value;
|
|
3416
3262
|
productId = Number(prefillItem.product_id);
|
|
3417
3263
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3418
3264
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3419
3265
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3420
|
-
|
|
3266
|
+
_context37.next = 29;
|
|
3421
3267
|
break;
|
|
3422
3268
|
}
|
|
3423
|
-
return
|
|
3269
|
+
return _context37.abrupt("continue", 49);
|
|
3424
3270
|
case 29:
|
|
3425
3271
|
if (!Number.isNaN(productVariantId)) {
|
|
3426
|
-
|
|
3272
|
+
_context37.next = 31;
|
|
3427
3273
|
break;
|
|
3428
3274
|
}
|
|
3429
|
-
return
|
|
3275
|
+
return _context37.abrupt("continue", 49);
|
|
3430
3276
|
case 31:
|
|
3431
3277
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3432
3278
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3434,7 +3280,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3434
3280
|
product_variant_id: productVariantId
|
|
3435
3281
|
});
|
|
3436
3282
|
if (!(productIndex === -1)) {
|
|
3437
|
-
|
|
3283
|
+
_context37.next = 42;
|
|
3438
3284
|
break;
|
|
3439
3285
|
}
|
|
3440
3286
|
sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
|
|
@@ -3454,11 +3300,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3454
3300
|
},
|
|
3455
3301
|
_origin: origin
|
|
3456
3302
|
});
|
|
3457
|
-
productUid = String(((_product$
|
|
3303
|
+
productUid = String(((_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.unique_identification_number) || '');
|
|
3458
3304
|
this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
|
|
3459
3305
|
tempOrder.products.push(product);
|
|
3460
3306
|
hasChanges = true;
|
|
3461
|
-
return
|
|
3307
|
+
return _context37.abrupt("continue", 49);
|
|
3462
3308
|
case 42:
|
|
3463
3309
|
targetProduct = tempOrder.products[productIndex];
|
|
3464
3310
|
previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
|
|
@@ -3480,34 +3326,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3480
3326
|
hasChanges = true;
|
|
3481
3327
|
}
|
|
3482
3328
|
case 49:
|
|
3483
|
-
|
|
3329
|
+
_context37.next = 22;
|
|
3484
3330
|
break;
|
|
3485
3331
|
case 51:
|
|
3486
|
-
|
|
3332
|
+
_context37.next = 56;
|
|
3487
3333
|
break;
|
|
3488
3334
|
case 53:
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3335
|
+
_context37.prev = 53;
|
|
3336
|
+
_context37.t0 = _context37["catch"](20);
|
|
3337
|
+
_iterator18.e(_context37.t0);
|
|
3492
3338
|
case 56:
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
return
|
|
3339
|
+
_context37.prev = 56;
|
|
3340
|
+
_iterator18.f();
|
|
3341
|
+
return _context37.finish(56);
|
|
3496
3342
|
case 59:
|
|
3497
3343
|
if (!hasChanges) {
|
|
3498
|
-
|
|
3344
|
+
_context37.next = 64;
|
|
3499
3345
|
break;
|
|
3500
3346
|
}
|
|
3501
3347
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3502
3348
|
this.store.order.applyDiscount();
|
|
3503
|
-
|
|
3349
|
+
_context37.next = 63;
|
|
3504
3350
|
return this.store.order.recalculateSummary({
|
|
3505
3351
|
createIfMissing: true
|
|
3506
3352
|
});
|
|
3507
3353
|
case 63:
|
|
3508
3354
|
this.store.order.persistTempOrder();
|
|
3509
3355
|
case 64:
|
|
3510
|
-
|
|
3356
|
+
_context37.next = 66;
|
|
3511
3357
|
return this.refreshItemRuleQuantityLimits();
|
|
3512
3358
|
case 66:
|
|
3513
3359
|
this.itemRulePrefillApplied = true;
|
|
@@ -3517,9 +3363,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3517
3363
|
});
|
|
3518
3364
|
case 68:
|
|
3519
3365
|
case "end":
|
|
3520
|
-
return
|
|
3366
|
+
return _context37.stop();
|
|
3521
3367
|
}
|
|
3522
|
-
},
|
|
3368
|
+
}, _callee37, this, [[20, 53, 56, 59]]);
|
|
3523
3369
|
}));
|
|
3524
3370
|
function applyPrefillByItemRule() {
|
|
3525
3371
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -3529,24 +3375,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3529
3375
|
}, {
|
|
3530
3376
|
key: "applyItemRulePrefill",
|
|
3531
3377
|
value: function () {
|
|
3532
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3533
|
-
return _regeneratorRuntime().wrap(function
|
|
3534
|
-
while (1) switch (
|
|
3378
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3379
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3380
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3535
3381
|
case 0:
|
|
3536
3382
|
this.logMethodStart('applyItemRulePrefill');
|
|
3537
|
-
|
|
3383
|
+
_context38.next = 3;
|
|
3538
3384
|
return this.applyPrefillByItemRule();
|
|
3539
3385
|
case 3:
|
|
3540
|
-
|
|
3386
|
+
_context38.next = 5;
|
|
3541
3387
|
return this.refreshItemRuleQuantityLimits();
|
|
3542
3388
|
case 5:
|
|
3543
|
-
|
|
3389
|
+
_context38.next = 7;
|
|
3544
3390
|
return this.refreshCartValidationPassed();
|
|
3545
3391
|
case 7:
|
|
3546
3392
|
case "end":
|
|
3547
|
-
return
|
|
3393
|
+
return _context38.stop();
|
|
3548
3394
|
}
|
|
3549
|
-
},
|
|
3395
|
+
}, _callee38, this);
|
|
3550
3396
|
}));
|
|
3551
3397
|
function applyItemRulePrefill() {
|
|
3552
3398
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -3556,20 +3402,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3556
3402
|
}, {
|
|
3557
3403
|
key: "evaluateCartValidationByItemRule",
|
|
3558
3404
|
value: function () {
|
|
3559
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3405
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3560
3406
|
var strategyConfigs, businessData;
|
|
3561
|
-
return _regeneratorRuntime().wrap(function
|
|
3562
|
-
while (1) switch (
|
|
3407
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3408
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3563
3409
|
case 0:
|
|
3564
|
-
|
|
3410
|
+
_context39.next = 2;
|
|
3565
3411
|
return this.ensureItemRuleConfigsLoaded();
|
|
3566
3412
|
case 2:
|
|
3567
|
-
strategyConfigs =
|
|
3413
|
+
strategyConfigs = _context39.sent;
|
|
3568
3414
|
if (strategyConfigs.length) {
|
|
3569
|
-
|
|
3415
|
+
_context39.next = 5;
|
|
3570
3416
|
break;
|
|
3571
3417
|
}
|
|
3572
|
-
return
|
|
3418
|
+
return _context39.abrupt("return", {
|
|
3573
3419
|
passed: true,
|
|
3574
3420
|
failures: []
|
|
3575
3421
|
});
|
|
@@ -3579,12 +3425,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3579
3425
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3580
3426
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3581
3427
|
});
|
|
3582
|
-
return
|
|
3428
|
+
return _context39.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3583
3429
|
case 7:
|
|
3584
3430
|
case "end":
|
|
3585
|
-
return
|
|
3431
|
+
return _context39.stop();
|
|
3586
3432
|
}
|
|
3587
|
-
},
|
|
3433
|
+
}, _callee39, this);
|
|
3588
3434
|
}));
|
|
3589
3435
|
function evaluateCartValidationByItemRule() {
|
|
3590
3436
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -3594,20 +3440,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3594
3440
|
}, {
|
|
3595
3441
|
key: "validateBeforeSubmitByItemRule",
|
|
3596
3442
|
value: function () {
|
|
3597
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3443
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3598
3444
|
var validationResult, firstFailure, errorMessage, error;
|
|
3599
|
-
return _regeneratorRuntime().wrap(function
|
|
3600
|
-
while (1) switch (
|
|
3445
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3446
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3601
3447
|
case 0:
|
|
3602
|
-
|
|
3448
|
+
_context40.next = 2;
|
|
3603
3449
|
return this.evaluateCartValidationByItemRule();
|
|
3604
3450
|
case 2:
|
|
3605
|
-
validationResult =
|
|
3451
|
+
validationResult = _context40.sent;
|
|
3606
3452
|
if (!validationResult.passed) {
|
|
3607
|
-
|
|
3453
|
+
_context40.next = 5;
|
|
3608
3454
|
break;
|
|
3609
3455
|
}
|
|
3610
|
-
return
|
|
3456
|
+
return _context40.abrupt("return");
|
|
3611
3457
|
case 5:
|
|
3612
3458
|
firstFailure = validationResult.failures[0];
|
|
3613
3459
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3616,9 +3462,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3616
3462
|
throw error;
|
|
3617
3463
|
case 10:
|
|
3618
3464
|
case "end":
|
|
3619
|
-
return
|
|
3465
|
+
return _context40.stop();
|
|
3620
3466
|
}
|
|
3621
|
-
},
|
|
3467
|
+
}, _callee40, this);
|
|
3622
3468
|
}));
|
|
3623
3469
|
function validateBeforeSubmitByItemRule() {
|
|
3624
3470
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -3628,10 +3474,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3628
3474
|
}, {
|
|
3629
3475
|
key: "refreshCartValidationPassed",
|
|
3630
3476
|
value: function () {
|
|
3631
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3477
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3632
3478
|
var previous, nextState, validationResult, changed;
|
|
3633
|
-
return _regeneratorRuntime().wrap(function
|
|
3634
|
-
while (1) switch (
|
|
3479
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3480
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3635
3481
|
case 0:
|
|
3636
3482
|
previous = this.store.cartValidation || {
|
|
3637
3483
|
passed: null,
|
|
@@ -3641,20 +3487,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3641
3487
|
passed: null,
|
|
3642
3488
|
failures: []
|
|
3643
3489
|
};
|
|
3644
|
-
|
|
3645
|
-
|
|
3490
|
+
_context41.prev = 2;
|
|
3491
|
+
_context41.next = 5;
|
|
3646
3492
|
return this.evaluateCartValidationByItemRule();
|
|
3647
3493
|
case 5:
|
|
3648
|
-
validationResult =
|
|
3494
|
+
validationResult = _context41.sent;
|
|
3649
3495
|
nextState = {
|
|
3650
3496
|
passed: validationResult.passed,
|
|
3651
3497
|
failures: validationResult.failures || []
|
|
3652
3498
|
};
|
|
3653
|
-
|
|
3499
|
+
_context41.next = 12;
|
|
3654
3500
|
break;
|
|
3655
3501
|
case 9:
|
|
3656
|
-
|
|
3657
|
-
|
|
3502
|
+
_context41.prev = 9;
|
|
3503
|
+
_context41.t0 = _context41["catch"](2);
|
|
3658
3504
|
nextState = {
|
|
3659
3505
|
passed: false,
|
|
3660
3506
|
failures: []
|
|
@@ -3663,21 +3509,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3663
3509
|
this.store.cartValidation = nextState;
|
|
3664
3510
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3665
3511
|
if (!changed) {
|
|
3666
|
-
|
|
3512
|
+
_context41.next = 17;
|
|
3667
3513
|
break;
|
|
3668
3514
|
}
|
|
3669
|
-
|
|
3515
|
+
_context41.next = 17;
|
|
3670
3516
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3671
3517
|
cartValidation: nextState,
|
|
3672
3518
|
cartValidationPassed: nextState.passed
|
|
3673
3519
|
});
|
|
3674
3520
|
case 17:
|
|
3675
|
-
return
|
|
3521
|
+
return _context41.abrupt("return", nextState.passed);
|
|
3676
3522
|
case 18:
|
|
3677
3523
|
case "end":
|
|
3678
|
-
return
|
|
3524
|
+
return _context41.stop();
|
|
3679
3525
|
}
|
|
3680
|
-
},
|
|
3526
|
+
}, _callee41, this, [[2, 9]]);
|
|
3681
3527
|
}));
|
|
3682
3528
|
function refreshCartValidationPassed() {
|
|
3683
3529
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -3687,14 +3533,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3687
3533
|
}, {
|
|
3688
3534
|
key: "setItemRuleRuntimeConfig",
|
|
3689
3535
|
value: function () {
|
|
3690
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3536
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3691
3537
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3692
3538
|
var config,
|
|
3693
|
-
|
|
3694
|
-
return _regeneratorRuntime().wrap(function
|
|
3695
|
-
while (1) switch (
|
|
3539
|
+
_args42 = arguments;
|
|
3540
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3541
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3696
3542
|
case 0:
|
|
3697
|
-
config =
|
|
3543
|
+
config = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
|
|
3698
3544
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3699
3545
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3700
3546
|
pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
|
|
@@ -3706,10 +3552,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3706
3552
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3707
3553
|
}
|
|
3708
3554
|
this.itemRulePrefillApplied = false;
|
|
3709
|
-
|
|
3555
|
+
_context42.next = 7;
|
|
3710
3556
|
return this.refreshItemRuleQuantityLimits();
|
|
3711
3557
|
case 7:
|
|
3712
|
-
|
|
3558
|
+
_context42.next = 9;
|
|
3713
3559
|
return this.refreshCartValidationPassed();
|
|
3714
3560
|
case 9:
|
|
3715
3561
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3717,9 +3563,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3717
3563
|
});
|
|
3718
3564
|
case 10:
|
|
3719
3565
|
case "end":
|
|
3720
|
-
return
|
|
3566
|
+
return _context42.stop();
|
|
3721
3567
|
}
|
|
3722
|
-
},
|
|
3568
|
+
}, _callee42, this);
|
|
3723
3569
|
}));
|
|
3724
3570
|
function setItemRuleRuntimeConfig() {
|
|
3725
3571
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -3753,7 +3599,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3753
3599
|
var raw = this.window.sessionStorage.getItem(key) || '{}';
|
|
3754
3600
|
var parsed = JSON.parse(raw);
|
|
3755
3601
|
return parsed && _typeof(parsed) === 'object' ? parsed : {};
|
|
3756
|
-
} catch (
|
|
3602
|
+
} catch (_unused4) {
|
|
3757
3603
|
return {};
|
|
3758
3604
|
}
|
|
3759
3605
|
}
|
|
@@ -3803,12 +3649,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3803
3649
|
if (booking) {
|
|
3804
3650
|
booking.holder = holder;
|
|
3805
3651
|
}
|
|
3806
|
-
var
|
|
3807
|
-
|
|
3652
|
+
var _iterator19 = _createForOfIteratorHelper(tempOrder.products),
|
|
3653
|
+
_step19;
|
|
3808
3654
|
try {
|
|
3809
|
-
for (
|
|
3655
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
3810
3656
|
var _runtimeProduct$metad, _runtimeProduct$metad2, _runtimeProduct$_orig;
|
|
3811
|
-
var product =
|
|
3657
|
+
var product = _step19.value;
|
|
3812
3658
|
var runtimeProduct = product;
|
|
3813
3659
|
var productBookingUid = (_runtimeProduct$metad = (_runtimeProduct$metad2 = runtimeProduct.metadata) === null || _runtimeProduct$metad2 === void 0 ? void 0 : _runtimeProduct$metad2.booking_uid) !== null && _runtimeProduct$metad !== void 0 ? _runtimeProduct$metad : (_runtimeProduct$_orig = runtimeProduct._origin) === null || _runtimeProduct$_orig === void 0 || (_runtimeProduct$_orig = _runtimeProduct$_orig.product) === null || _runtimeProduct$_orig === void 0 ? void 0 : _runtimeProduct$_orig.bookingUuid;
|
|
3814
3660
|
if (String(productBookingUid) !== String(bookingUid)) continue;
|
|
@@ -3817,9 +3663,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3817
3663
|
runtimeProduct._origin = origin;
|
|
3818
3664
|
}
|
|
3819
3665
|
} catch (err) {
|
|
3820
|
-
|
|
3666
|
+
_iterator19.e(err);
|
|
3821
3667
|
} finally {
|
|
3822
|
-
|
|
3668
|
+
_iterator19.f();
|
|
3823
3669
|
}
|
|
3824
3670
|
this.store.order.notifyTempOrderChanged();
|
|
3825
3671
|
}
|
|
@@ -3840,30 +3686,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3840
3686
|
}, {
|
|
3841
3687
|
key: "refreshAllHolderFormRecords",
|
|
3842
3688
|
value: (function () {
|
|
3843
|
-
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3689
|
+
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
3844
3690
|
var _params$customer_id, _params$useCache;
|
|
3845
3691
|
var customer_id;
|
|
3846
|
-
return _regeneratorRuntime().wrap(function
|
|
3847
|
-
while (1) switch (
|
|
3692
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3693
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3848
3694
|
case 0:
|
|
3849
3695
|
if (this.store.holder) {
|
|
3850
|
-
|
|
3696
|
+
_context43.next = 2;
|
|
3851
3697
|
break;
|
|
3852
3698
|
}
|
|
3853
3699
|
throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3854
3700
|
case 2:
|
|
3855
3701
|
customer_id = (_params$customer_id = params === null || params === void 0 ? void 0 : params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.resolveHolderCustomerId();
|
|
3856
|
-
return
|
|
3702
|
+
return _context43.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
|
|
3857
3703
|
customer_id: customer_id,
|
|
3858
3704
|
useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
|
|
3859
3705
|
})));
|
|
3860
3706
|
case 4:
|
|
3861
3707
|
case "end":
|
|
3862
|
-
return
|
|
3708
|
+
return _context43.stop();
|
|
3863
3709
|
}
|
|
3864
|
-
},
|
|
3710
|
+
}, _callee43, this);
|
|
3865
3711
|
}));
|
|
3866
|
-
function refreshAllHolderFormRecords(
|
|
3712
|
+
function refreshAllHolderFormRecords(_x21) {
|
|
3867
3713
|
return _refreshAllHolderFormRecords.apply(this, arguments);
|
|
3868
3714
|
}
|
|
3869
3715
|
return refreshAllHolderFormRecords;
|
|
@@ -3883,25 +3729,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3883
3729
|
}, {
|
|
3884
3730
|
key: "checkOpenDataAvailability",
|
|
3885
3731
|
value: function () {
|
|
3886
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3887
|
-
return _regeneratorRuntime().wrap(function
|
|
3888
|
-
while (1) switch (
|
|
3732
|
+
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3733
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3734
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3889
3735
|
case 0:
|
|
3890
3736
|
if (this.store.openData) {
|
|
3891
|
-
|
|
3737
|
+
_context44.next = 2;
|
|
3892
3738
|
break;
|
|
3893
3739
|
}
|
|
3894
3740
|
throw new Error('openData 模块未初始化');
|
|
3895
3741
|
case 2:
|
|
3896
|
-
|
|
3742
|
+
_context44.next = 4;
|
|
3897
3743
|
return this.loadOpenDataConfig();
|
|
3898
3744
|
case 4:
|
|
3899
|
-
return
|
|
3745
|
+
return _context44.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
3900
3746
|
case 5:
|
|
3901
3747
|
case "end":
|
|
3902
|
-
return
|
|
3748
|
+
return _context44.stop();
|
|
3903
3749
|
}
|
|
3904
|
-
},
|
|
3750
|
+
}, _callee44, this);
|
|
3905
3751
|
}));
|
|
3906
3752
|
function checkOpenDataAvailability() {
|
|
3907
3753
|
return _checkOpenDataAvailability.apply(this, arguments);
|
|
@@ -3911,15 +3757,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3911
3757
|
}, {
|
|
3912
3758
|
key: "setOtherParams",
|
|
3913
3759
|
value: function () {
|
|
3914
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3760
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
|
|
3915
3761
|
var _ref7,
|
|
3916
3762
|
_ref7$cover,
|
|
3917
3763
|
cover,
|
|
3918
|
-
|
|
3919
|
-
return _regeneratorRuntime().wrap(function
|
|
3920
|
-
while (1) switch (
|
|
3764
|
+
_args45 = arguments;
|
|
3765
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3766
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3921
3767
|
case 0:
|
|
3922
|
-
_ref7 =
|
|
3768
|
+
_ref7 = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
|
|
3923
3769
|
if (cover) {
|
|
3924
3770
|
this.otherParams = params;
|
|
3925
3771
|
} else {
|
|
@@ -3927,11 +3773,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3927
3773
|
}
|
|
3928
3774
|
case 2:
|
|
3929
3775
|
case "end":
|
|
3930
|
-
return
|
|
3776
|
+
return _context45.stop();
|
|
3931
3777
|
}
|
|
3932
|
-
},
|
|
3778
|
+
}, _callee45, this);
|
|
3933
3779
|
}));
|
|
3934
|
-
function setOtherParams(
|
|
3780
|
+
function setOtherParams(_x22) {
|
|
3935
3781
|
return _setOtherParams.apply(this, arguments);
|
|
3936
3782
|
}
|
|
3937
3783
|
return setOtherParams;
|
|
@@ -3940,5 +3786,4 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3940
3786
|
return VenueBookingImpl;
|
|
3941
3787
|
}(BaseSalesImpl);
|
|
3942
3788
|
_defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
|
|
3943
|
-
_defineProperty(VenueBookingImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
|
|
3944
3789
|
_defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');
|