@pisell/pisellos 0.0.567 → 0.0.568
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +6 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -3
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +1 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +14 -41
- package/dist/modules/Payment/index.js +142 -270
- package/dist/modules/Payment/walletpass.js +4 -5
- package/dist/modules/Rules/index.js +0 -7
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.js +88 -121
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/products/index.js +29 -49
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +32 -40
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +5 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -246
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +364 -327
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +381 -231
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +652 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +22 -45
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +306 -241
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +26 -62
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +216 -153
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +117 -113
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +63 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +332 -320
- package/lib/modules/Order/types.js +24 -33
- package/lib/modules/Order/utils.js +350 -284
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +566 -432
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.js +50 -47
- package/lib/modules/Payment/walletpass.js +221 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +111 -110
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +60 -82
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/Rules/index.js +1172 -872
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +59 -68
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +176 -193
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -167
- package/lib/modules/Schedule/index.js +97 -107
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/index.js +212 -57
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.js +882 -623
- package/lib/server/modules/index.js +85 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.js +195 -231
- package/lib/server/modules/order/types.js +107 -32
- package/lib/server/modules/order/utils/filterBookings.js +174 -140
- package/lib/server/modules/order/utils/filterOrders.js +89 -60
- package/lib/server/modules/products/index.js +430 -335
- package/lib/server/modules/products/types.js +41 -34
- package/lib/server/modules/quotation/index.js +76 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +216 -187
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +134 -119
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +147 -122
- package/lib/solution/BookingTicket/types.js +38 -64
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +64 -80
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +82 -80
- package/lib/solution/BookingTicket/utils/scan/index.js +90 -94
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +227 -158
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +218 -200
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +803 -840
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.js +372 -331
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +886 -929
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +88 -106
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +102 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -192,12 +192,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
192
192
|
payload: payload,
|
|
193
193
|
extra: extra
|
|
194
194
|
});
|
|
195
|
-
} else {
|
|
196
|
-
console.log('[VenueBooking][log-fallback]', params.title, {
|
|
197
|
-
payload: payload,
|
|
198
|
-
extra: extra
|
|
199
|
-
});
|
|
200
|
-
}
|
|
195
|
+
} else {}
|
|
201
196
|
return _context.abrupt("return");
|
|
202
197
|
case 6:
|
|
203
198
|
_context.next = 8;
|
|
@@ -767,42 +762,40 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
767
762
|
this.store.scanOrderLogger.setContext(this.getLoggerContext());
|
|
768
763
|
}
|
|
769
764
|
this.registerCustomerLoginListeners();
|
|
770
|
-
|
|
771
|
-
_context7.
|
|
772
|
-
_context7.next = 58;
|
|
765
|
+
_context7.prev = 54;
|
|
766
|
+
_context7.next = 57;
|
|
773
767
|
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
774
768
|
createIfMissing: false
|
|
775
769
|
});
|
|
776
|
-
case
|
|
770
|
+
case 57:
|
|
777
771
|
(_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
|
|
778
|
-
_context7.next =
|
|
772
|
+
_context7.next = 60;
|
|
779
773
|
return this.loadRuntimeConfigs();
|
|
780
|
-
case
|
|
774
|
+
case 60:
|
|
781
775
|
if (!this.store.schedule) {
|
|
782
|
-
_context7.next =
|
|
776
|
+
_context7.next = 63;
|
|
783
777
|
break;
|
|
784
778
|
}
|
|
785
|
-
_context7.next =
|
|
779
|
+
_context7.next = 63;
|
|
786
780
|
return this.store.schedule.loadAllSchedule();
|
|
787
|
-
case
|
|
788
|
-
_context7.next =
|
|
781
|
+
case 63:
|
|
782
|
+
_context7.next = 65;
|
|
789
783
|
return this.refreshItemRuleQuantityLimits();
|
|
790
|
-
case
|
|
784
|
+
case 65:
|
|
791
785
|
this.store.status = 'ready';
|
|
792
|
-
|
|
793
|
-
_context7.next = 70;
|
|
786
|
+
_context7.next = 68;
|
|
794
787
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
795
788
|
status: this.store.status
|
|
796
789
|
});
|
|
797
|
-
case
|
|
790
|
+
case 68:
|
|
798
791
|
this.logMethodSuccess('initialize', {
|
|
799
792
|
status: this.store.status
|
|
800
793
|
});
|
|
801
|
-
_context7.next =
|
|
794
|
+
_context7.next = 78;
|
|
802
795
|
break;
|
|
803
|
-
case
|
|
804
|
-
_context7.prev =
|
|
805
|
-
_context7.t0 = _context7["catch"](
|
|
796
|
+
case 71:
|
|
797
|
+
_context7.prev = 71;
|
|
798
|
+
_context7.t0 = _context7["catch"](54);
|
|
806
799
|
this.store.status = 'error';
|
|
807
800
|
this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
|
|
808
801
|
console.error('[VenueBooking] 初始化失败', _context7.t0);
|
|
@@ -810,11 +803,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
810
803
|
status: this.store.status
|
|
811
804
|
});
|
|
812
805
|
throw _context7.t0;
|
|
813
|
-
case
|
|
806
|
+
case 78:
|
|
814
807
|
case "end":
|
|
815
808
|
return _context7.stop();
|
|
816
809
|
}
|
|
817
|
-
}, _callee7, this, [[
|
|
810
|
+
}, _callee7, this, [[54, 71]]);
|
|
818
811
|
}));
|
|
819
812
|
function initialize(_x6) {
|
|
820
813
|
return _initialize.apply(this, arguments);
|
|
@@ -833,9 +826,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
833
826
|
_context8.next = 4;
|
|
834
827
|
return this.core.effects.emit(VenueBookingHooks.onDestroy, {});
|
|
835
828
|
case 4:
|
|
836
|
-
console.log('[VenueBooking] 已销毁');
|
|
837
829
|
this.logMethodSuccess('destroy');
|
|
838
|
-
case
|
|
830
|
+
case 5:
|
|
839
831
|
case "end":
|
|
840
832
|
return _context8.stop();
|
|
841
833
|
}
|
|
@@ -854,27 +846,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
854
846
|
while (1) switch (_context9.prev = _context9.next) {
|
|
855
847
|
case 0:
|
|
856
848
|
this.logMethodStart('retryInit');
|
|
857
|
-
|
|
858
|
-
_context9.next = 4;
|
|
849
|
+
_context9.next = 3;
|
|
859
850
|
return this.core.effects.emit(VenueBookingHooks.onRetryInit, {});
|
|
860
|
-
case
|
|
861
|
-
_context9.prev =
|
|
862
|
-
_context9.next =
|
|
851
|
+
case 3:
|
|
852
|
+
_context9.prev = 3;
|
|
853
|
+
_context9.next = 6;
|
|
863
854
|
return this.initialize(this.core, this.initializeOptions);
|
|
864
|
-
case
|
|
855
|
+
case 6:
|
|
865
856
|
this.logMethodSuccess('retryInit');
|
|
866
|
-
_context9.next =
|
|
857
|
+
_context9.next = 13;
|
|
867
858
|
break;
|
|
868
|
-
case
|
|
869
|
-
_context9.prev =
|
|
870
|
-
_context9.t0 = _context9["catch"](
|
|
859
|
+
case 9:
|
|
860
|
+
_context9.prev = 9;
|
|
861
|
+
_context9.t0 = _context9["catch"](3);
|
|
871
862
|
this.logMethodError('retryInit', _context9.t0);
|
|
872
863
|
throw _context9.t0;
|
|
873
|
-
case
|
|
864
|
+
case 13:
|
|
874
865
|
case "end":
|
|
875
866
|
return _context9.stop();
|
|
876
867
|
}
|
|
877
|
-
}, _callee9, this, [[
|
|
868
|
+
}, _callee9, this, [[3, 9]]);
|
|
878
869
|
}));
|
|
879
870
|
function retryInit() {
|
|
880
871
|
return _retryInit.apply(this, arguments);
|
|
@@ -889,36 +880,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
889
880
|
while (1) switch (_context10.prev = _context10.next) {
|
|
890
881
|
case 0:
|
|
891
882
|
this.logMethodStart('refresh');
|
|
892
|
-
|
|
893
|
-
_context10.prev = 2;
|
|
883
|
+
_context10.prev = 1;
|
|
894
884
|
this.store.status = 'initializing';
|
|
895
|
-
_context10.next =
|
|
885
|
+
_context10.next = 5;
|
|
896
886
|
return this.loadRuntimeConfigs();
|
|
897
|
-
case
|
|
898
|
-
_context10.next =
|
|
887
|
+
case 5:
|
|
888
|
+
_context10.next = 7;
|
|
899
889
|
return this.refreshItemRuleQuantityLimits();
|
|
900
|
-
case
|
|
890
|
+
case 7:
|
|
901
891
|
this.store.status = 'ready';
|
|
902
|
-
_context10.next =
|
|
892
|
+
_context10.next = 10;
|
|
903
893
|
return this.core.effects.emit(VenueBookingHooks.onRefresh, {
|
|
904
894
|
status: this.store.status
|
|
905
895
|
});
|
|
906
|
-
case
|
|
896
|
+
case 10:
|
|
907
897
|
this.logMethodSuccess('refresh', {
|
|
908
898
|
status: this.store.status
|
|
909
899
|
});
|
|
910
|
-
_context10.next =
|
|
900
|
+
_context10.next = 17;
|
|
911
901
|
break;
|
|
912
|
-
case
|
|
913
|
-
_context10.prev =
|
|
914
|
-
_context10.t0 = _context10["catch"](
|
|
902
|
+
case 13:
|
|
903
|
+
_context10.prev = 13;
|
|
904
|
+
_context10.t0 = _context10["catch"](1);
|
|
915
905
|
this.logMethodError('refresh', _context10.t0);
|
|
916
906
|
throw _context10.t0;
|
|
917
|
-
case
|
|
907
|
+
case 17:
|
|
918
908
|
case "end":
|
|
919
909
|
return _context10.stop();
|
|
920
910
|
}
|
|
921
|
-
}, _callee10, this, [[
|
|
911
|
+
}, _callee10, this, [[1, 13]]);
|
|
922
912
|
}));
|
|
923
913
|
function refresh() {
|
|
924
914
|
return _refresh.apply(this, arguments);
|
|
@@ -2657,21 +2647,68 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2657
2647
|
}
|
|
2658
2648
|
return submitOrder;
|
|
2659
2649
|
}()
|
|
2650
|
+
/**
|
|
2651
|
+
* 0 元订单免费领取(非定金场景)
|
|
2652
|
+
* 与 appointment getFreeProduct 同接口:POST /pay/order/free-pay/:id
|
|
2653
|
+
*/
|
|
2654
|
+
}, {
|
|
2655
|
+
key: "submitFreeOrder",
|
|
2656
|
+
value: (function () {
|
|
2657
|
+
var _submitFreeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(id) {
|
|
2658
|
+
var res;
|
|
2659
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2660
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2661
|
+
case 0:
|
|
2662
|
+
this.logMethodStart('submitFreeOrder', {
|
|
2663
|
+
id: id
|
|
2664
|
+
});
|
|
2665
|
+
_context26.prev = 1;
|
|
2666
|
+
if (id) {
|
|
2667
|
+
_context26.next = 4;
|
|
2668
|
+
break;
|
|
2669
|
+
}
|
|
2670
|
+
throw new Error('订单 ID 不能为空');
|
|
2671
|
+
case 4:
|
|
2672
|
+
_context26.next = 6;
|
|
2673
|
+
return this.request.post("/pay/order/free-pay/".concat(id));
|
|
2674
|
+
case 6:
|
|
2675
|
+
res = _context26.sent;
|
|
2676
|
+
this.logMethodSuccess('submitFreeOrder', {
|
|
2677
|
+
id: id,
|
|
2678
|
+
status: res === null || res === void 0 ? void 0 : res.status
|
|
2679
|
+
});
|
|
2680
|
+
return _context26.abrupt("return", res);
|
|
2681
|
+
case 11:
|
|
2682
|
+
_context26.prev = 11;
|
|
2683
|
+
_context26.t0 = _context26["catch"](1);
|
|
2684
|
+
this.logMethodError('submitFreeOrder', _context26.t0);
|
|
2685
|
+
throw _context26.t0;
|
|
2686
|
+
case 15:
|
|
2687
|
+
case "end":
|
|
2688
|
+
return _context26.stop();
|
|
2689
|
+
}
|
|
2690
|
+
}, _callee26, this, [[1, 11]]);
|
|
2691
|
+
}));
|
|
2692
|
+
function submitFreeOrder(_x17) {
|
|
2693
|
+
return _submitFreeOrder.apply(this, arguments);
|
|
2694
|
+
}
|
|
2695
|
+
return submitFreeOrder;
|
|
2696
|
+
}())
|
|
2660
2697
|
}, {
|
|
2661
2698
|
key: "addProductToOrder",
|
|
2662
2699
|
value: function () {
|
|
2663
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2700
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(product) {
|
|
2664
2701
|
var _product$metadata5, _product$metadata6, smartPrice, products;
|
|
2665
|
-
return _regeneratorRuntime().wrap(function
|
|
2666
|
-
while (1) switch (
|
|
2702
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2703
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2667
2704
|
case 0:
|
|
2668
2705
|
this.logMethodStart('addProductToOrder', {
|
|
2669
2706
|
product_id: product.product_id,
|
|
2670
2707
|
product_variant_id: product.product_variant_id
|
|
2671
2708
|
});
|
|
2672
|
-
|
|
2709
|
+
_context27.prev = 1;
|
|
2673
2710
|
if (this.store.order) {
|
|
2674
|
-
|
|
2711
|
+
_context27.next = 4;
|
|
2675
2712
|
break;
|
|
2676
2713
|
}
|
|
2677
2714
|
throw new Error('order 模块未初始化');
|
|
@@ -2689,32 +2726,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2689
2726
|
} else if (product.selling_price != null && !((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking)) {
|
|
2690
2727
|
product.original_price = product.selling_price;
|
|
2691
2728
|
}
|
|
2692
|
-
|
|
2729
|
+
_context27.next = 7;
|
|
2693
2730
|
return this.store.order.addProductToOrder(product);
|
|
2694
2731
|
case 7:
|
|
2695
|
-
products =
|
|
2696
|
-
|
|
2732
|
+
products = _context27.sent;
|
|
2733
|
+
_context27.next = 10;
|
|
2697
2734
|
return this.refreshItemRuleQuantityLimits();
|
|
2698
2735
|
case 10:
|
|
2699
|
-
|
|
2736
|
+
_context27.next = 12;
|
|
2700
2737
|
return this.refreshCartValidationPassed();
|
|
2701
2738
|
case 12:
|
|
2702
2739
|
this.logMethodSuccess('addProductToOrder', {
|
|
2703
2740
|
productCount: products.length
|
|
2704
2741
|
});
|
|
2705
|
-
return
|
|
2742
|
+
return _context27.abrupt("return", products);
|
|
2706
2743
|
case 16:
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
this.logMethodError('addProductToOrder',
|
|
2710
|
-
throw
|
|
2744
|
+
_context27.prev = 16;
|
|
2745
|
+
_context27.t0 = _context27["catch"](1);
|
|
2746
|
+
this.logMethodError('addProductToOrder', _context27.t0);
|
|
2747
|
+
throw _context27.t0;
|
|
2711
2748
|
case 20:
|
|
2712
2749
|
case "end":
|
|
2713
|
-
return
|
|
2750
|
+
return _context27.stop();
|
|
2714
2751
|
}
|
|
2715
|
-
},
|
|
2752
|
+
}, _callee27, this, [[1, 16]]);
|
|
2716
2753
|
}));
|
|
2717
|
-
function addProductToOrder(
|
|
2754
|
+
function addProductToOrder(_x18) {
|
|
2718
2755
|
return _addProductToOrder.apply(this, arguments);
|
|
2719
2756
|
}
|
|
2720
2757
|
return addProductToOrder;
|
|
@@ -2722,48 +2759,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2722
2759
|
}, {
|
|
2723
2760
|
key: "updateProductInOrder",
|
|
2724
2761
|
value: function () {
|
|
2725
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2762
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2726
2763
|
var products;
|
|
2727
|
-
return _regeneratorRuntime().wrap(function
|
|
2728
|
-
while (1) switch (
|
|
2764
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2765
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2729
2766
|
case 0:
|
|
2730
2767
|
this.logMethodStart('updateProductInOrder', {
|
|
2731
2768
|
product_id: params.product_id,
|
|
2732
2769
|
product_variant_id: params.product_variant_id
|
|
2733
2770
|
});
|
|
2734
|
-
|
|
2771
|
+
_context28.prev = 1;
|
|
2735
2772
|
if (this.store.order) {
|
|
2736
|
-
|
|
2773
|
+
_context28.next = 4;
|
|
2737
2774
|
break;
|
|
2738
2775
|
}
|
|
2739
2776
|
throw new Error('order 模块未初始化');
|
|
2740
2777
|
case 4:
|
|
2741
|
-
|
|
2778
|
+
_context28.next = 6;
|
|
2742
2779
|
return this.store.order.updateProductInOrder(params);
|
|
2743
2780
|
case 6:
|
|
2744
|
-
products =
|
|
2745
|
-
|
|
2781
|
+
products = _context28.sent;
|
|
2782
|
+
_context28.next = 9;
|
|
2746
2783
|
return this.refreshItemRuleQuantityLimits();
|
|
2747
2784
|
case 9:
|
|
2748
|
-
|
|
2785
|
+
_context28.next = 11;
|
|
2749
2786
|
return this.refreshCartValidationPassed();
|
|
2750
2787
|
case 11:
|
|
2751
2788
|
this.logMethodSuccess('updateProductInOrder', {
|
|
2752
2789
|
productCount: products.length
|
|
2753
2790
|
});
|
|
2754
|
-
return
|
|
2791
|
+
return _context28.abrupt("return", products);
|
|
2755
2792
|
case 15:
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
this.logMethodError('updateProductInOrder',
|
|
2759
|
-
throw
|
|
2793
|
+
_context28.prev = 15;
|
|
2794
|
+
_context28.t0 = _context28["catch"](1);
|
|
2795
|
+
this.logMethodError('updateProductInOrder', _context28.t0);
|
|
2796
|
+
throw _context28.t0;
|
|
2760
2797
|
case 19:
|
|
2761
2798
|
case "end":
|
|
2762
|
-
return
|
|
2799
|
+
return _context28.stop();
|
|
2763
2800
|
}
|
|
2764
|
-
},
|
|
2801
|
+
}, _callee28, this, [[1, 15]]);
|
|
2765
2802
|
}));
|
|
2766
|
-
function updateProductInOrder(
|
|
2803
|
+
function updateProductInOrder(_x19) {
|
|
2767
2804
|
return _updateProductInOrder.apply(this, arguments);
|
|
2768
2805
|
}
|
|
2769
2806
|
return updateProductInOrder;
|
|
@@ -2771,66 +2808,66 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2771
2808
|
}, {
|
|
2772
2809
|
key: "removeProductFromOrder",
|
|
2773
2810
|
value: function () {
|
|
2774
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2811
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identity) {
|
|
2775
2812
|
var _this$store$order$get3, _this$store$order9, _this$store$order$ens, _this$store$order10, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator17, _step17, _product$metadata7, _product$metadata8, product, beforeBookingCount, _this$store$order$per, _this$store$order11;
|
|
2776
|
-
return _regeneratorRuntime().wrap(function
|
|
2777
|
-
while (1) switch (
|
|
2813
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2814
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2778
2815
|
case 0:
|
|
2779
2816
|
this.logMethodStart('removeProductFromOrder', {
|
|
2780
2817
|
product_id: identity.product_id,
|
|
2781
2818
|
product_variant_id: identity.product_variant_id
|
|
2782
2819
|
});
|
|
2783
|
-
|
|
2820
|
+
_context29.prev = 1;
|
|
2784
2821
|
if (this.store.order) {
|
|
2785
|
-
|
|
2822
|
+
_context29.next = 4;
|
|
2786
2823
|
break;
|
|
2787
2824
|
}
|
|
2788
2825
|
throw new Error('order 模块未初始化');
|
|
2789
2826
|
case 4:
|
|
2790
2827
|
tempOrder = ((_this$store$order$get3 = (_this$store$order9 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order9)) || ((_this$store$order$ens = (_this$store$order10 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order10));
|
|
2791
|
-
|
|
2828
|
+
_context29.next = 7;
|
|
2792
2829
|
return this.store.order.removeProductFromOrder(identity);
|
|
2793
2830
|
case 7:
|
|
2794
|
-
products =
|
|
2831
|
+
products = _context29.sent;
|
|
2795
2832
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
2796
|
-
|
|
2833
|
+
_context29.next = 33;
|
|
2797
2834
|
break;
|
|
2798
2835
|
}
|
|
2799
2836
|
venueProductUids = new Set();
|
|
2800
2837
|
venueBookingUids = new Set();
|
|
2801
2838
|
_iterator17 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2802
|
-
|
|
2839
|
+
_context29.prev = 12;
|
|
2803
2840
|
_iterator17.s();
|
|
2804
2841
|
case 14:
|
|
2805
2842
|
if ((_step17 = _iterator17.n()).done) {
|
|
2806
|
-
|
|
2843
|
+
_context29.next = 22;
|
|
2807
2844
|
break;
|
|
2808
2845
|
}
|
|
2809
2846
|
product = _step17.value;
|
|
2810
2847
|
if (product !== null && product !== void 0 && (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking) {
|
|
2811
|
-
|
|
2848
|
+
_context29.next = 18;
|
|
2812
2849
|
break;
|
|
2813
2850
|
}
|
|
2814
|
-
return
|
|
2851
|
+
return _context29.abrupt("continue", 20);
|
|
2815
2852
|
case 18:
|
|
2816
2853
|
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
2817
2854
|
if ((_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.booking_uid) {
|
|
2818
2855
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2819
2856
|
}
|
|
2820
2857
|
case 20:
|
|
2821
|
-
|
|
2858
|
+
_context29.next = 14;
|
|
2822
2859
|
break;
|
|
2823
2860
|
case 22:
|
|
2824
|
-
|
|
2861
|
+
_context29.next = 27;
|
|
2825
2862
|
break;
|
|
2826
2863
|
case 24:
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
_iterator17.e(
|
|
2864
|
+
_context29.prev = 24;
|
|
2865
|
+
_context29.t0 = _context29["catch"](12);
|
|
2866
|
+
_iterator17.e(_context29.t0);
|
|
2830
2867
|
case 27:
|
|
2831
|
-
|
|
2868
|
+
_context29.prev = 27;
|
|
2832
2869
|
_iterator17.f();
|
|
2833
|
-
return
|
|
2870
|
+
return _context29.finish(27);
|
|
2834
2871
|
case 30:
|
|
2835
2872
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2836
2873
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
@@ -2847,28 +2884,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2847
2884
|
(_this$store$order$per = (_this$store$order11 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order11);
|
|
2848
2885
|
}
|
|
2849
2886
|
case 33:
|
|
2850
|
-
|
|
2887
|
+
_context29.next = 35;
|
|
2851
2888
|
return this.refreshItemRuleQuantityLimits();
|
|
2852
2889
|
case 35:
|
|
2853
|
-
|
|
2890
|
+
_context29.next = 37;
|
|
2854
2891
|
return this.refreshCartValidationPassed();
|
|
2855
2892
|
case 37:
|
|
2856
2893
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2857
2894
|
productCount: products.length
|
|
2858
2895
|
});
|
|
2859
|
-
return
|
|
2896
|
+
return _context29.abrupt("return", products);
|
|
2860
2897
|
case 41:
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
this.logMethodError('removeProductFromOrder',
|
|
2864
|
-
throw
|
|
2898
|
+
_context29.prev = 41;
|
|
2899
|
+
_context29.t1 = _context29["catch"](1);
|
|
2900
|
+
this.logMethodError('removeProductFromOrder', _context29.t1);
|
|
2901
|
+
throw _context29.t1;
|
|
2865
2902
|
case 45:
|
|
2866
2903
|
case "end":
|
|
2867
|
-
return
|
|
2904
|
+
return _context29.stop();
|
|
2868
2905
|
}
|
|
2869
|
-
},
|
|
2906
|
+
}, _callee29, this, [[1, 41], [12, 24, 27, 30]]);
|
|
2870
2907
|
}));
|
|
2871
|
-
function removeProductFromOrder(
|
|
2908
|
+
function removeProductFromOrder(_x20) {
|
|
2872
2909
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2873
2910
|
}
|
|
2874
2911
|
return removeProductFromOrder;
|
|
@@ -2876,27 +2913,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2876
2913
|
}, {
|
|
2877
2914
|
key: "getProductList",
|
|
2878
2915
|
value: function () {
|
|
2879
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2916
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2880
2917
|
var result;
|
|
2881
|
-
return _regeneratorRuntime().wrap(function
|
|
2882
|
-
while (1) switch (
|
|
2918
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2919
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2883
2920
|
case 0:
|
|
2884
2921
|
if (!this.productsLoaded) {
|
|
2885
|
-
|
|
2922
|
+
_context30.next = 2;
|
|
2886
2923
|
break;
|
|
2887
2924
|
}
|
|
2888
|
-
return
|
|
2925
|
+
return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
2889
2926
|
case 2:
|
|
2890
|
-
|
|
2927
|
+
_context30.next = 4;
|
|
2891
2928
|
return this.loadAllProducts();
|
|
2892
2929
|
case 4:
|
|
2893
|
-
result =
|
|
2894
|
-
return
|
|
2930
|
+
result = _context30.sent;
|
|
2931
|
+
return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2895
2932
|
case 6:
|
|
2896
2933
|
case "end":
|
|
2897
|
-
return
|
|
2934
|
+
return _context30.stop();
|
|
2898
2935
|
}
|
|
2899
|
-
},
|
|
2936
|
+
}, _callee30, this);
|
|
2900
2937
|
}));
|
|
2901
2938
|
function getProductList() {
|
|
2902
2939
|
return _getProductList.apply(this, arguments);
|
|
@@ -2906,13 +2943,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2906
2943
|
}, {
|
|
2907
2944
|
key: "loadOpenDataConfig",
|
|
2908
2945
|
value: function () {
|
|
2909
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2946
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2910
2947
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
2911
|
-
return _regeneratorRuntime().wrap(function
|
|
2912
|
-
while (1) switch (
|
|
2948
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2949
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2913
2950
|
case 0:
|
|
2914
2951
|
if (this.store.openData) {
|
|
2915
|
-
|
|
2952
|
+
_context31.next = 2;
|
|
2916
2953
|
break;
|
|
2917
2954
|
}
|
|
2918
2955
|
throw new Error('openData 模块未初始化');
|
|
@@ -2920,42 +2957,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2920
2957
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
2921
2958
|
cachedData = this.store.openData.getOpenData();
|
|
2922
2959
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
2923
|
-
|
|
2960
|
+
_context31.next = 7;
|
|
2924
2961
|
break;
|
|
2925
2962
|
}
|
|
2926
2963
|
this.otherParams.openData = cachedData;
|
|
2927
|
-
return
|
|
2964
|
+
return _context31.abrupt("return", cachedData);
|
|
2928
2965
|
case 7:
|
|
2929
2966
|
if (!this.loadOpenDataConfigInFlight) {
|
|
2930
|
-
|
|
2967
|
+
_context31.next = 11;
|
|
2931
2968
|
break;
|
|
2932
2969
|
}
|
|
2933
|
-
|
|
2970
|
+
_context31.next = 10;
|
|
2934
2971
|
return this.loadOpenDataConfigInFlight;
|
|
2935
2972
|
case 10:
|
|
2936
|
-
return
|
|
2973
|
+
return _context31.abrupt("return", _context31.sent);
|
|
2937
2974
|
case 11:
|
|
2938
2975
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2939
2976
|
scope: 'board',
|
|
2940
2977
|
target: 'venue_booking+online_store',
|
|
2941
2978
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2942
2979
|
});
|
|
2943
|
-
|
|
2944
|
-
|
|
2980
|
+
_context31.prev = 12;
|
|
2981
|
+
_context31.next = 15;
|
|
2945
2982
|
return this.loadOpenDataConfigInFlight;
|
|
2946
2983
|
case 15:
|
|
2947
|
-
openDataConfig =
|
|
2984
|
+
openDataConfig = _context31.sent;
|
|
2948
2985
|
this.otherParams.openData = openDataConfig;
|
|
2949
|
-
return
|
|
2986
|
+
return _context31.abrupt("return", openDataConfig);
|
|
2950
2987
|
case 18:
|
|
2951
|
-
|
|
2988
|
+
_context31.prev = 18;
|
|
2952
2989
|
this.loadOpenDataConfigInFlight = null;
|
|
2953
|
-
return
|
|
2990
|
+
return _context31.finish(18);
|
|
2954
2991
|
case 21:
|
|
2955
2992
|
case "end":
|
|
2956
|
-
return
|
|
2993
|
+
return _context31.stop();
|
|
2957
2994
|
}
|
|
2958
|
-
},
|
|
2995
|
+
}, _callee31, this, [[12,, 18, 21]]);
|
|
2959
2996
|
}));
|
|
2960
2997
|
function loadOpenDataConfig() {
|
|
2961
2998
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2965,29 +3002,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2965
3002
|
}, {
|
|
2966
3003
|
key: "loadRuntimeConfigs",
|
|
2967
3004
|
value: function () {
|
|
2968
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3005
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2969
3006
|
var itemRuleConfigs;
|
|
2970
|
-
return _regeneratorRuntime().wrap(function
|
|
2971
|
-
while (1) switch (
|
|
3007
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3008
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2972
3009
|
case 0:
|
|
2973
|
-
|
|
3010
|
+
_context32.next = 2;
|
|
2974
3011
|
return this.loadOpenDataConfig();
|
|
2975
3012
|
case 2:
|
|
2976
|
-
|
|
3013
|
+
_context32.next = 4;
|
|
2977
3014
|
return this.ensureItemRuleConfigsLoaded();
|
|
2978
3015
|
case 4:
|
|
2979
|
-
itemRuleConfigs =
|
|
3016
|
+
itemRuleConfigs = _context32.sent;
|
|
2980
3017
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2981
3018
|
itemRuleCount: itemRuleConfigs.length
|
|
2982
3019
|
});
|
|
2983
|
-
return
|
|
3020
|
+
return _context32.abrupt("return", {
|
|
2984
3021
|
itemRuleConfigs: itemRuleConfigs
|
|
2985
3022
|
});
|
|
2986
3023
|
case 7:
|
|
2987
3024
|
case "end":
|
|
2988
|
-
return
|
|
3025
|
+
return _context32.stop();
|
|
2989
3026
|
}
|
|
2990
|
-
},
|
|
3027
|
+
}, _callee32, this);
|
|
2991
3028
|
}));
|
|
2992
3029
|
function loadRuntimeConfigs() {
|
|
2993
3030
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -2997,22 +3034,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2997
3034
|
}, {
|
|
2998
3035
|
key: "fetchItemRuleConfigsByModelIds",
|
|
2999
3036
|
value: function () {
|
|
3000
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3037
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(strategyModelIds) {
|
|
3001
3038
|
var result, configs;
|
|
3002
|
-
return _regeneratorRuntime().wrap(function
|
|
3003
|
-
while (1) switch (
|
|
3039
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3040
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3004
3041
|
case 0:
|
|
3005
3042
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
3006
3043
|
strategyModelIds: strategyModelIds
|
|
3007
3044
|
});
|
|
3008
3045
|
if (strategyModelIds.length) {
|
|
3009
|
-
|
|
3046
|
+
_context33.next = 3;
|
|
3010
3047
|
break;
|
|
3011
3048
|
}
|
|
3012
|
-
return
|
|
3049
|
+
return _context33.abrupt("return", []);
|
|
3013
3050
|
case 3:
|
|
3014
|
-
|
|
3015
|
-
|
|
3051
|
+
_context33.prev = 3;
|
|
3052
|
+
_context33.next = 6;
|
|
3016
3053
|
return this.request.get('/promotion', {
|
|
3017
3054
|
skip: 1,
|
|
3018
3055
|
num: 99,
|
|
@@ -3020,7 +3057,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3020
3057
|
ids: strategyModelIds
|
|
3021
3058
|
});
|
|
3022
3059
|
case 6:
|
|
3023
|
-
result =
|
|
3060
|
+
result = _context33.sent;
|
|
3024
3061
|
configs = [];
|
|
3025
3062
|
if (result.code === 200) {
|
|
3026
3063
|
configs = result.data.list.map(function (item) {
|
|
@@ -3031,21 +3068,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3031
3068
|
strategyModelIds: strategyModelIds,
|
|
3032
3069
|
strategyCount: configs.length
|
|
3033
3070
|
});
|
|
3034
|
-
return
|
|
3071
|
+
return _context33.abrupt("return", configs);
|
|
3035
3072
|
case 13:
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
3073
|
+
_context33.prev = 13;
|
|
3074
|
+
_context33.t0 = _context33["catch"](3);
|
|
3075
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context33.t0, {
|
|
3039
3076
|
strategyModelIds: strategyModelIds
|
|
3040
3077
|
});
|
|
3041
|
-
return
|
|
3078
|
+
return _context33.abrupt("return", []);
|
|
3042
3079
|
case 17:
|
|
3043
3080
|
case "end":
|
|
3044
|
-
return
|
|
3081
|
+
return _context33.stop();
|
|
3045
3082
|
}
|
|
3046
|
-
},
|
|
3083
|
+
}, _callee33, this, [[3, 13]]);
|
|
3047
3084
|
}));
|
|
3048
|
-
function fetchItemRuleConfigsByModelIds(
|
|
3085
|
+
function fetchItemRuleConfigsByModelIds(_x21) {
|
|
3049
3086
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
3050
3087
|
}
|
|
3051
3088
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -3053,22 +3090,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3053
3090
|
}, {
|
|
3054
3091
|
key: "buildPrefillProductSourceMap",
|
|
3055
3092
|
value: function () {
|
|
3056
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3093
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3057
3094
|
var sourceMap, productList, visited, collectFromValue;
|
|
3058
|
-
return _regeneratorRuntime().wrap(function
|
|
3059
|
-
while (1) switch (
|
|
3095
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3096
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3060
3097
|
case 0:
|
|
3061
3098
|
sourceMap = new Map();
|
|
3062
|
-
|
|
3063
|
-
|
|
3099
|
+
_context34.prev = 1;
|
|
3100
|
+
_context34.next = 4;
|
|
3064
3101
|
return this.getProductList();
|
|
3065
3102
|
case 4:
|
|
3066
|
-
productList =
|
|
3103
|
+
productList = _context34.sent;
|
|
3067
3104
|
if (Array.isArray(productList)) {
|
|
3068
|
-
|
|
3105
|
+
_context34.next = 7;
|
|
3069
3106
|
break;
|
|
3070
3107
|
}
|
|
3071
|
-
return
|
|
3108
|
+
return _context34.abrupt("return", sourceMap);
|
|
3072
3109
|
case 7:
|
|
3073
3110
|
visited = new Set();
|
|
3074
3111
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -3107,19 +3144,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3107
3144
|
}
|
|
3108
3145
|
};
|
|
3109
3146
|
collectFromValue(productList);
|
|
3110
|
-
|
|
3147
|
+
_context34.next = 15;
|
|
3111
3148
|
break;
|
|
3112
3149
|
case 12:
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
3150
|
+
_context34.prev = 12;
|
|
3151
|
+
_context34.t0 = _context34["catch"](1);
|
|
3152
|
+
this.logMethodError('buildPrefillProductSourceMap', _context34.t0);
|
|
3116
3153
|
case 15:
|
|
3117
|
-
return
|
|
3154
|
+
return _context34.abrupt("return", sourceMap);
|
|
3118
3155
|
case 16:
|
|
3119
3156
|
case "end":
|
|
3120
|
-
return
|
|
3157
|
+
return _context34.stop();
|
|
3121
3158
|
}
|
|
3122
|
-
},
|
|
3159
|
+
}, _callee34, this, [[1, 12]]);
|
|
3123
3160
|
}));
|
|
3124
3161
|
function buildPrefillProductSourceMap() {
|
|
3125
3162
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -3134,56 +3171,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3134
3171
|
}, {
|
|
3135
3172
|
key: "ensureItemRuleConfigsLoaded",
|
|
3136
3173
|
value: function () {
|
|
3137
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3174
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
3138
3175
|
var _this10 = this;
|
|
3139
|
-
return _regeneratorRuntime().wrap(function
|
|
3140
|
-
while (1) switch (
|
|
3176
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3177
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3141
3178
|
case 0:
|
|
3142
3179
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
3143
|
-
|
|
3180
|
+
_context36.next = 2;
|
|
3144
3181
|
break;
|
|
3145
3182
|
}
|
|
3146
|
-
return
|
|
3183
|
+
return _context36.abrupt("return", this.itemRuleConfigs);
|
|
3147
3184
|
case 2:
|
|
3148
3185
|
if (!this.itemRuleConfigsPromise) {
|
|
3149
|
-
|
|
3186
|
+
_context36.next = 4;
|
|
3150
3187
|
break;
|
|
3151
3188
|
}
|
|
3152
|
-
return
|
|
3189
|
+
return _context36.abrupt("return", this.itemRuleConfigsPromise);
|
|
3153
3190
|
case 4:
|
|
3154
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3191
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
3155
3192
|
var runtimeConfig, staticConfigs;
|
|
3156
|
-
return _regeneratorRuntime().wrap(function
|
|
3157
|
-
while (1) switch (
|
|
3193
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3194
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3158
3195
|
case 0:
|
|
3159
3196
|
runtimeConfig = _this10.getItemRuleRuntimeConfig();
|
|
3160
3197
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
3161
3198
|
if (!(staticConfigs.length > 0)) {
|
|
3162
|
-
|
|
3199
|
+
_context35.next = 6;
|
|
3163
3200
|
break;
|
|
3164
3201
|
}
|
|
3165
3202
|
_this10.itemRuleConfigs = staticConfigs;
|
|
3166
3203
|
_this10.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3167
|
-
return
|
|
3204
|
+
return _context35.abrupt("return", _this10.itemRuleConfigs);
|
|
3168
3205
|
case 6:
|
|
3169
3206
|
_this10.itemRuleConfigs = [];
|
|
3170
3207
|
_this10.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3171
|
-
return
|
|
3208
|
+
return _context35.abrupt("return", _this10.itemRuleConfigs);
|
|
3172
3209
|
case 9:
|
|
3173
3210
|
case "end":
|
|
3174
|
-
return
|
|
3211
|
+
return _context35.stop();
|
|
3175
3212
|
}
|
|
3176
|
-
},
|
|
3213
|
+
}, _callee35);
|
|
3177
3214
|
}))();
|
|
3178
|
-
|
|
3215
|
+
_context36.next = 7;
|
|
3179
3216
|
return this.itemRuleConfigsPromise;
|
|
3180
3217
|
case 7:
|
|
3181
|
-
return
|
|
3218
|
+
return _context36.abrupt("return", _context36.sent);
|
|
3182
3219
|
case 8:
|
|
3183
3220
|
case "end":
|
|
3184
|
-
return
|
|
3221
|
+
return _context36.stop();
|
|
3185
3222
|
}
|
|
3186
|
-
},
|
|
3223
|
+
}, _callee36, this);
|
|
3187
3224
|
}));
|
|
3188
3225
|
function ensureItemRuleConfigsLoaded() {
|
|
3189
3226
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -3193,22 +3230,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3193
3230
|
}, {
|
|
3194
3231
|
key: "refreshItemRuleQuantityLimits",
|
|
3195
3232
|
value: function () {
|
|
3196
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3233
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
3197
3234
|
var strategyConfigs, businessData, limits;
|
|
3198
|
-
return _regeneratorRuntime().wrap(function
|
|
3199
|
-
while (1) switch (
|
|
3235
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3236
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3200
3237
|
case 0:
|
|
3201
|
-
|
|
3202
|
-
|
|
3238
|
+
_context37.prev = 0;
|
|
3239
|
+
_context37.next = 3;
|
|
3203
3240
|
return this.ensureItemRuleConfigsLoaded();
|
|
3204
3241
|
case 3:
|
|
3205
|
-
strategyConfigs =
|
|
3242
|
+
strategyConfigs = _context37.sent;
|
|
3206
3243
|
if (strategyConfigs.length) {
|
|
3207
|
-
|
|
3244
|
+
_context37.next = 7;
|
|
3208
3245
|
break;
|
|
3209
3246
|
}
|
|
3210
3247
|
this.store.itemRuleQuantityLimits = [];
|
|
3211
|
-
return
|
|
3248
|
+
return _context37.abrupt("return", []);
|
|
3212
3249
|
case 7:
|
|
3213
3250
|
businessData = buildItemRuleBusinessData({
|
|
3214
3251
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -3220,18 +3257,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3220
3257
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
3221
3258
|
limitCount: limits.length
|
|
3222
3259
|
});
|
|
3223
|
-
return
|
|
3260
|
+
return _context37.abrupt("return", limits);
|
|
3224
3261
|
case 14:
|
|
3225
|
-
|
|
3226
|
-
|
|
3262
|
+
_context37.prev = 14;
|
|
3263
|
+
_context37.t0 = _context37["catch"](0);
|
|
3227
3264
|
this.store.itemRuleQuantityLimits = [];
|
|
3228
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
3229
|
-
return
|
|
3265
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context37.t0);
|
|
3266
|
+
return _context37.abrupt("return", []);
|
|
3230
3267
|
case 19:
|
|
3231
3268
|
case "end":
|
|
3232
|
-
return
|
|
3269
|
+
return _context37.stop();
|
|
3233
3270
|
}
|
|
3234
|
-
},
|
|
3271
|
+
}, _callee37, this, [[0, 14]]);
|
|
3235
3272
|
}));
|
|
3236
3273
|
function refreshItemRuleQuantityLimits() {
|
|
3237
3274
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -3241,32 +3278,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3241
3278
|
}, {
|
|
3242
3279
|
key: "applyPrefillByItemRule",
|
|
3243
3280
|
value: function () {
|
|
3244
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3281
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3245
3282
|
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator19, _step19, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
|
|
3246
|
-
return _regeneratorRuntime().wrap(function
|
|
3247
|
-
while (1) switch (
|
|
3283
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3284
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3248
3285
|
case 0:
|
|
3249
3286
|
if (!this.itemRulePrefillApplied) {
|
|
3250
|
-
|
|
3287
|
+
_context38.next = 2;
|
|
3251
3288
|
break;
|
|
3252
3289
|
}
|
|
3253
|
-
return
|
|
3290
|
+
return _context38.abrupt("return");
|
|
3254
3291
|
case 2:
|
|
3255
3292
|
if (this.store.order) {
|
|
3256
|
-
|
|
3293
|
+
_context38.next = 4;
|
|
3257
3294
|
break;
|
|
3258
3295
|
}
|
|
3259
|
-
return
|
|
3296
|
+
return _context38.abrupt("return");
|
|
3260
3297
|
case 4:
|
|
3261
|
-
|
|
3298
|
+
_context38.next = 6;
|
|
3262
3299
|
return this.ensureItemRuleConfigsLoaded();
|
|
3263
3300
|
case 6:
|
|
3264
|
-
strategyConfigs =
|
|
3301
|
+
strategyConfigs = _context38.sent;
|
|
3265
3302
|
if (strategyConfigs.length) {
|
|
3266
|
-
|
|
3303
|
+
_context38.next = 9;
|
|
3267
3304
|
break;
|
|
3268
3305
|
}
|
|
3269
|
-
return
|
|
3306
|
+
return _context38.abrupt("return");
|
|
3270
3307
|
case 9:
|
|
3271
3308
|
businessData = buildItemRuleBusinessData({
|
|
3272
3309
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -3275,24 +3312,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3275
3312
|
});
|
|
3276
3313
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3277
3314
|
if (prefillItems.length) {
|
|
3278
|
-
|
|
3315
|
+
_context38.next = 14;
|
|
3279
3316
|
break;
|
|
3280
3317
|
}
|
|
3281
3318
|
this.itemRulePrefillApplied = true;
|
|
3282
|
-
return
|
|
3319
|
+
return _context38.abrupt("return");
|
|
3283
3320
|
case 14:
|
|
3284
|
-
|
|
3321
|
+
_context38.next = 16;
|
|
3285
3322
|
return this.buildPrefillProductSourceMap();
|
|
3286
3323
|
case 16:
|
|
3287
|
-
productSourceMap =
|
|
3324
|
+
productSourceMap = _context38.sent;
|
|
3288
3325
|
tempOrder = this.ensureTempOrder();
|
|
3289
3326
|
hasChanges = false;
|
|
3290
3327
|
_iterator19 = _createForOfIteratorHelper(prefillItems);
|
|
3291
|
-
|
|
3328
|
+
_context38.prev = 20;
|
|
3292
3329
|
_iterator19.s();
|
|
3293
3330
|
case 22:
|
|
3294
3331
|
if ((_step19 = _iterator19.n()).done) {
|
|
3295
|
-
|
|
3332
|
+
_context38.next = 45;
|
|
3296
3333
|
break;
|
|
3297
3334
|
}
|
|
3298
3335
|
prefillItem = _step19.value;
|
|
@@ -3300,16 +3337,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3300
3337
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3301
3338
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3302
3339
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3303
|
-
|
|
3340
|
+
_context38.next = 29;
|
|
3304
3341
|
break;
|
|
3305
3342
|
}
|
|
3306
|
-
return
|
|
3343
|
+
return _context38.abrupt("continue", 43);
|
|
3307
3344
|
case 29:
|
|
3308
3345
|
if (!Number.isNaN(productVariantId)) {
|
|
3309
|
-
|
|
3346
|
+
_context38.next = 31;
|
|
3310
3347
|
break;
|
|
3311
3348
|
}
|
|
3312
|
-
return
|
|
3349
|
+
return _context38.abrupt("continue", 43);
|
|
3313
3350
|
case 31:
|
|
3314
3351
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3315
3352
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3317,7 +3354,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3317
3354
|
product_variant_id: productVariantId
|
|
3318
3355
|
});
|
|
3319
3356
|
if (!(productIndex === -1)) {
|
|
3320
|
-
|
|
3357
|
+
_context38.next = 38;
|
|
3321
3358
|
break;
|
|
3322
3359
|
}
|
|
3323
3360
|
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');
|
|
@@ -3337,7 +3374,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3337
3374
|
})
|
|
3338
3375
|
}));
|
|
3339
3376
|
hasChanges = true;
|
|
3340
|
-
return
|
|
3377
|
+
return _context38.abrupt("continue", 43);
|
|
3341
3378
|
case 38:
|
|
3342
3379
|
targetProduct = tempOrder.products[productIndex];
|
|
3343
3380
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
@@ -3356,34 +3393,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3356
3393
|
hasChanges = true;
|
|
3357
3394
|
}
|
|
3358
3395
|
case 43:
|
|
3359
|
-
|
|
3396
|
+
_context38.next = 22;
|
|
3360
3397
|
break;
|
|
3361
3398
|
case 45:
|
|
3362
|
-
|
|
3399
|
+
_context38.next = 50;
|
|
3363
3400
|
break;
|
|
3364
3401
|
case 47:
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
_iterator19.e(
|
|
3402
|
+
_context38.prev = 47;
|
|
3403
|
+
_context38.t0 = _context38["catch"](20);
|
|
3404
|
+
_iterator19.e(_context38.t0);
|
|
3368
3405
|
case 50:
|
|
3369
|
-
|
|
3406
|
+
_context38.prev = 50;
|
|
3370
3407
|
_iterator19.f();
|
|
3371
|
-
return
|
|
3408
|
+
return _context38.finish(50);
|
|
3372
3409
|
case 53:
|
|
3373
3410
|
if (!hasChanges) {
|
|
3374
|
-
|
|
3411
|
+
_context38.next = 58;
|
|
3375
3412
|
break;
|
|
3376
3413
|
}
|
|
3377
3414
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3378
3415
|
this.store.order.applyDiscount();
|
|
3379
|
-
|
|
3416
|
+
_context38.next = 57;
|
|
3380
3417
|
return this.store.order.recalculateSummary({
|
|
3381
3418
|
createIfMissing: true
|
|
3382
3419
|
});
|
|
3383
3420
|
case 57:
|
|
3384
3421
|
this.store.order.persistTempOrder();
|
|
3385
3422
|
case 58:
|
|
3386
|
-
|
|
3423
|
+
_context38.next = 60;
|
|
3387
3424
|
return this.refreshItemRuleQuantityLimits();
|
|
3388
3425
|
case 60:
|
|
3389
3426
|
this.itemRulePrefillApplied = true;
|
|
@@ -3393,9 +3430,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3393
3430
|
});
|
|
3394
3431
|
case 62:
|
|
3395
3432
|
case "end":
|
|
3396
|
-
return
|
|
3433
|
+
return _context38.stop();
|
|
3397
3434
|
}
|
|
3398
|
-
},
|
|
3435
|
+
}, _callee38, this, [[20, 47, 50, 53]]);
|
|
3399
3436
|
}));
|
|
3400
3437
|
function applyPrefillByItemRule() {
|
|
3401
3438
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -3405,24 +3442,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3405
3442
|
}, {
|
|
3406
3443
|
key: "applyItemRulePrefill",
|
|
3407
3444
|
value: function () {
|
|
3408
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3409
|
-
return _regeneratorRuntime().wrap(function
|
|
3410
|
-
while (1) switch (
|
|
3445
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3446
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3447
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3411
3448
|
case 0:
|
|
3412
3449
|
this.logMethodStart('applyItemRulePrefill');
|
|
3413
|
-
|
|
3450
|
+
_context39.next = 3;
|
|
3414
3451
|
return this.applyPrefillByItemRule();
|
|
3415
3452
|
case 3:
|
|
3416
|
-
|
|
3453
|
+
_context39.next = 5;
|
|
3417
3454
|
return this.refreshItemRuleQuantityLimits();
|
|
3418
3455
|
case 5:
|
|
3419
|
-
|
|
3456
|
+
_context39.next = 7;
|
|
3420
3457
|
return this.refreshCartValidationPassed();
|
|
3421
3458
|
case 7:
|
|
3422
3459
|
case "end":
|
|
3423
|
-
return
|
|
3460
|
+
return _context39.stop();
|
|
3424
3461
|
}
|
|
3425
|
-
},
|
|
3462
|
+
}, _callee39, this);
|
|
3426
3463
|
}));
|
|
3427
3464
|
function applyItemRulePrefill() {
|
|
3428
3465
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -3432,20 +3469,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3432
3469
|
}, {
|
|
3433
3470
|
key: "evaluateCartValidationByItemRule",
|
|
3434
3471
|
value: function () {
|
|
3435
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3472
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3436
3473
|
var strategyConfigs, businessData;
|
|
3437
|
-
return _regeneratorRuntime().wrap(function
|
|
3438
|
-
while (1) switch (
|
|
3474
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3475
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3439
3476
|
case 0:
|
|
3440
|
-
|
|
3477
|
+
_context40.next = 2;
|
|
3441
3478
|
return this.ensureItemRuleConfigsLoaded();
|
|
3442
3479
|
case 2:
|
|
3443
|
-
strategyConfigs =
|
|
3480
|
+
strategyConfigs = _context40.sent;
|
|
3444
3481
|
if (strategyConfigs.length) {
|
|
3445
|
-
|
|
3482
|
+
_context40.next = 5;
|
|
3446
3483
|
break;
|
|
3447
3484
|
}
|
|
3448
|
-
return
|
|
3485
|
+
return _context40.abrupt("return", {
|
|
3449
3486
|
passed: true,
|
|
3450
3487
|
failures: []
|
|
3451
3488
|
});
|
|
@@ -3455,12 +3492,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3455
3492
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3456
3493
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3457
3494
|
});
|
|
3458
|
-
return
|
|
3495
|
+
return _context40.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3459
3496
|
case 7:
|
|
3460
3497
|
case "end":
|
|
3461
|
-
return
|
|
3498
|
+
return _context40.stop();
|
|
3462
3499
|
}
|
|
3463
|
-
},
|
|
3500
|
+
}, _callee40, this);
|
|
3464
3501
|
}));
|
|
3465
3502
|
function evaluateCartValidationByItemRule() {
|
|
3466
3503
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -3470,20 +3507,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3470
3507
|
}, {
|
|
3471
3508
|
key: "validateBeforeSubmitByItemRule",
|
|
3472
3509
|
value: function () {
|
|
3473
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3510
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3474
3511
|
var validationResult, firstFailure, errorMessage, error;
|
|
3475
|
-
return _regeneratorRuntime().wrap(function
|
|
3476
|
-
while (1) switch (
|
|
3512
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3513
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3477
3514
|
case 0:
|
|
3478
|
-
|
|
3515
|
+
_context41.next = 2;
|
|
3479
3516
|
return this.evaluateCartValidationByItemRule();
|
|
3480
3517
|
case 2:
|
|
3481
|
-
validationResult =
|
|
3518
|
+
validationResult = _context41.sent;
|
|
3482
3519
|
if (!validationResult.passed) {
|
|
3483
|
-
|
|
3520
|
+
_context41.next = 5;
|
|
3484
3521
|
break;
|
|
3485
3522
|
}
|
|
3486
|
-
return
|
|
3523
|
+
return _context41.abrupt("return");
|
|
3487
3524
|
case 5:
|
|
3488
3525
|
firstFailure = validationResult.failures[0];
|
|
3489
3526
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3492,9 +3529,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3492
3529
|
throw error;
|
|
3493
3530
|
case 10:
|
|
3494
3531
|
case "end":
|
|
3495
|
-
return
|
|
3532
|
+
return _context41.stop();
|
|
3496
3533
|
}
|
|
3497
|
-
},
|
|
3534
|
+
}, _callee41, this);
|
|
3498
3535
|
}));
|
|
3499
3536
|
function validateBeforeSubmitByItemRule() {
|
|
3500
3537
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -3504,10 +3541,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3504
3541
|
}, {
|
|
3505
3542
|
key: "refreshCartValidationPassed",
|
|
3506
3543
|
value: function () {
|
|
3507
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3544
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3508
3545
|
var previous, nextState, validationResult, changed;
|
|
3509
|
-
return _regeneratorRuntime().wrap(function
|
|
3510
|
-
while (1) switch (
|
|
3546
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3547
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3511
3548
|
case 0:
|
|
3512
3549
|
previous = this.store.cartValidation || {
|
|
3513
3550
|
passed: null,
|
|
@@ -3517,20 +3554,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3517
3554
|
passed: null,
|
|
3518
3555
|
failures: []
|
|
3519
3556
|
};
|
|
3520
|
-
|
|
3521
|
-
|
|
3557
|
+
_context42.prev = 2;
|
|
3558
|
+
_context42.next = 5;
|
|
3522
3559
|
return this.evaluateCartValidationByItemRule();
|
|
3523
3560
|
case 5:
|
|
3524
|
-
validationResult =
|
|
3561
|
+
validationResult = _context42.sent;
|
|
3525
3562
|
nextState = {
|
|
3526
3563
|
passed: validationResult.passed,
|
|
3527
3564
|
failures: validationResult.failures || []
|
|
3528
3565
|
};
|
|
3529
|
-
|
|
3566
|
+
_context42.next = 12;
|
|
3530
3567
|
break;
|
|
3531
3568
|
case 9:
|
|
3532
|
-
|
|
3533
|
-
|
|
3569
|
+
_context42.prev = 9;
|
|
3570
|
+
_context42.t0 = _context42["catch"](2);
|
|
3534
3571
|
nextState = {
|
|
3535
3572
|
passed: false,
|
|
3536
3573
|
failures: []
|
|
@@ -3539,21 +3576,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3539
3576
|
this.store.cartValidation = nextState;
|
|
3540
3577
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3541
3578
|
if (!changed) {
|
|
3542
|
-
|
|
3579
|
+
_context42.next = 17;
|
|
3543
3580
|
break;
|
|
3544
3581
|
}
|
|
3545
|
-
|
|
3582
|
+
_context42.next = 17;
|
|
3546
3583
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3547
3584
|
cartValidation: nextState,
|
|
3548
3585
|
cartValidationPassed: nextState.passed
|
|
3549
3586
|
});
|
|
3550
3587
|
case 17:
|
|
3551
|
-
return
|
|
3588
|
+
return _context42.abrupt("return", nextState.passed);
|
|
3552
3589
|
case 18:
|
|
3553
3590
|
case "end":
|
|
3554
|
-
return
|
|
3591
|
+
return _context42.stop();
|
|
3555
3592
|
}
|
|
3556
|
-
},
|
|
3593
|
+
}, _callee42, this, [[2, 9]]);
|
|
3557
3594
|
}));
|
|
3558
3595
|
function refreshCartValidationPassed() {
|
|
3559
3596
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -3563,14 +3600,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3563
3600
|
}, {
|
|
3564
3601
|
key: "setItemRuleRuntimeConfig",
|
|
3565
3602
|
value: function () {
|
|
3566
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3603
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
3567
3604
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3568
3605
|
var config,
|
|
3569
|
-
|
|
3570
|
-
return _regeneratorRuntime().wrap(function
|
|
3571
|
-
while (1) switch (
|
|
3606
|
+
_args43 = arguments;
|
|
3607
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3608
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3572
3609
|
case 0:
|
|
3573
|
-
config =
|
|
3610
|
+
config = _args43.length > 0 && _args43[0] !== undefined ? _args43[0] : {};
|
|
3574
3611
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3575
3612
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3576
3613
|
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) || {}),
|
|
@@ -3582,10 +3619,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3582
3619
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3583
3620
|
}
|
|
3584
3621
|
this.itemRulePrefillApplied = false;
|
|
3585
|
-
|
|
3622
|
+
_context43.next = 7;
|
|
3586
3623
|
return this.refreshItemRuleQuantityLimits();
|
|
3587
3624
|
case 7:
|
|
3588
|
-
|
|
3625
|
+
_context43.next = 9;
|
|
3589
3626
|
return this.refreshCartValidationPassed();
|
|
3590
3627
|
case 9:
|
|
3591
3628
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3593,9 +3630,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3593
3630
|
});
|
|
3594
3631
|
case 10:
|
|
3595
3632
|
case "end":
|
|
3596
|
-
return
|
|
3633
|
+
return _context43.stop();
|
|
3597
3634
|
}
|
|
3598
|
-
},
|
|
3635
|
+
}, _callee43, this);
|
|
3599
3636
|
}));
|
|
3600
3637
|
function setItemRuleRuntimeConfig() {
|
|
3601
3638
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -3715,30 +3752,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3715
3752
|
}, {
|
|
3716
3753
|
key: "refreshAllHolderFormRecords",
|
|
3717
3754
|
value: (function () {
|
|
3718
|
-
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3755
|
+
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3719
3756
|
var _params$customer_id, _params$useCache;
|
|
3720
3757
|
var customer_id;
|
|
3721
|
-
return _regeneratorRuntime().wrap(function
|
|
3722
|
-
while (1) switch (
|
|
3758
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3759
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3723
3760
|
case 0:
|
|
3724
3761
|
if (this.store.holder) {
|
|
3725
|
-
|
|
3762
|
+
_context44.next = 2;
|
|
3726
3763
|
break;
|
|
3727
3764
|
}
|
|
3728
3765
|
throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3729
3766
|
case 2:
|
|
3730
3767
|
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();
|
|
3731
|
-
return
|
|
3768
|
+
return _context44.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
|
|
3732
3769
|
customer_id: customer_id,
|
|
3733
3770
|
useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
|
|
3734
3771
|
})));
|
|
3735
3772
|
case 4:
|
|
3736
3773
|
case "end":
|
|
3737
|
-
return
|
|
3774
|
+
return _context44.stop();
|
|
3738
3775
|
}
|
|
3739
|
-
},
|
|
3776
|
+
}, _callee44, this);
|
|
3740
3777
|
}));
|
|
3741
|
-
function refreshAllHolderFormRecords(
|
|
3778
|
+
function refreshAllHolderFormRecords(_x22) {
|
|
3742
3779
|
return _refreshAllHolderFormRecords.apply(this, arguments);
|
|
3743
3780
|
}
|
|
3744
3781
|
return refreshAllHolderFormRecords;
|
|
@@ -3758,25 +3795,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3758
3795
|
}, {
|
|
3759
3796
|
key: "checkOpenDataAvailability",
|
|
3760
3797
|
value: function () {
|
|
3761
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3762
|
-
return _regeneratorRuntime().wrap(function
|
|
3763
|
-
while (1) switch (
|
|
3798
|
+
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
3799
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3800
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3764
3801
|
case 0:
|
|
3765
3802
|
if (this.store.openData) {
|
|
3766
|
-
|
|
3803
|
+
_context45.next = 2;
|
|
3767
3804
|
break;
|
|
3768
3805
|
}
|
|
3769
3806
|
throw new Error('openData 模块未初始化');
|
|
3770
3807
|
case 2:
|
|
3771
|
-
|
|
3808
|
+
_context45.next = 4;
|
|
3772
3809
|
return this.loadOpenDataConfig();
|
|
3773
3810
|
case 4:
|
|
3774
|
-
return
|
|
3811
|
+
return _context45.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
3775
3812
|
case 5:
|
|
3776
3813
|
case "end":
|
|
3777
|
-
return
|
|
3814
|
+
return _context45.stop();
|
|
3778
3815
|
}
|
|
3779
|
-
},
|
|
3816
|
+
}, _callee45, this);
|
|
3780
3817
|
}));
|
|
3781
3818
|
function checkOpenDataAvailability() {
|
|
3782
3819
|
return _checkOpenDataAvailability.apply(this, arguments);
|
|
@@ -3786,15 +3823,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3786
3823
|
}, {
|
|
3787
3824
|
key: "setOtherParams",
|
|
3788
3825
|
value: function () {
|
|
3789
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3826
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
3790
3827
|
var _ref5,
|
|
3791
3828
|
_ref5$cover,
|
|
3792
3829
|
cover,
|
|
3793
|
-
|
|
3794
|
-
return _regeneratorRuntime().wrap(function
|
|
3795
|
-
while (1) switch (
|
|
3830
|
+
_args46 = arguments;
|
|
3831
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3832
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3796
3833
|
case 0:
|
|
3797
|
-
_ref5 =
|
|
3834
|
+
_ref5 = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
|
|
3798
3835
|
if (cover) {
|
|
3799
3836
|
this.otherParams = params;
|
|
3800
3837
|
} else {
|
|
@@ -3802,11 +3839,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3802
3839
|
}
|
|
3803
3840
|
case 2:
|
|
3804
3841
|
case "end":
|
|
3805
|
-
return
|
|
3842
|
+
return _context46.stop();
|
|
3806
3843
|
}
|
|
3807
|
-
},
|
|
3844
|
+
}, _callee46, this);
|
|
3808
3845
|
}));
|
|
3809
|
-
function setOtherParams(
|
|
3846
|
+
function setOtherParams(_x23) {
|
|
3810
3847
|
return _setOtherParams.apply(this, arguments);
|
|
3811
3848
|
}
|
|
3812
3849
|
return setOtherParams;
|