@pisell/pisellos 2.1.120 → 2.1.121
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/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +6 -0
- package/dist/modules/Order/index.js +18 -2
- package/dist/modules/Order/utils.d.ts +3 -0
- package/dist/modules/Order/utils.js +26 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/VenueBooking/index.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +522 -464
- package/dist/solution/VenueBooking/utils/slotMerge.js +1 -2
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +3 -0
- package/lib/modules/Order/index.js +15 -1
- package/lib/modules/Order/utils.d.ts +3 -0
- package/lib/modules/Order/utils.js +22 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +37 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +1 -2
- package/package.json +1 -1
|
@@ -96,6 +96,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
96
96
|
_defineProperty(_assertThisInitialized(_this), "loginEffectDisposers", []);
|
|
97
97
|
_defineProperty(_assertThisInitialized(_this), "customerLoginRefreshInFlight", null);
|
|
98
98
|
_defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
|
|
99
|
+
_defineProperty(_assertThisInitialized(_this), "loadAllProductsInFlight", null);
|
|
100
|
+
_defineProperty(_assertThisInitialized(_this), "productsLoaded", false);
|
|
101
|
+
_defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
|
|
99
102
|
return _this;
|
|
100
103
|
}
|
|
101
104
|
_createClass(VenueBookingImpl, [{
|
|
@@ -595,23 +598,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
595
598
|
case 58:
|
|
596
599
|
this.injectScheduleResolverToQuotation();
|
|
597
600
|
case 59:
|
|
598
|
-
|
|
601
|
+
this.loadQuotations();
|
|
602
|
+
_context6.next = 62;
|
|
599
603
|
return this.refreshItemRuleQuantityLimits();
|
|
600
|
-
case
|
|
604
|
+
case 62:
|
|
601
605
|
this.store.status = 'ready';
|
|
602
606
|
console.log('[VenueBooking] 初始化完成');
|
|
603
|
-
_context6.next =
|
|
607
|
+
_context6.next = 66;
|
|
604
608
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
605
609
|
status: this.store.status
|
|
606
610
|
});
|
|
607
|
-
case
|
|
611
|
+
case 66:
|
|
608
612
|
this.logMethodSuccess('initialize', {
|
|
609
613
|
status: this.store.status
|
|
610
614
|
});
|
|
611
|
-
_context6.next =
|
|
615
|
+
_context6.next = 76;
|
|
612
616
|
break;
|
|
613
|
-
case
|
|
614
|
-
_context6.prev =
|
|
617
|
+
case 69:
|
|
618
|
+
_context6.prev = 69;
|
|
615
619
|
_context6.t0 = _context6["catch"](49);
|
|
616
620
|
this.store.status = 'error';
|
|
617
621
|
this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : '初始化失败';
|
|
@@ -620,11 +624,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
620
624
|
status: this.store.status
|
|
621
625
|
});
|
|
622
626
|
throw _context6.t0;
|
|
623
|
-
case
|
|
627
|
+
case 76:
|
|
624
628
|
case "end":
|
|
625
629
|
return _context6.stop();
|
|
626
630
|
}
|
|
627
|
-
}, _callee6, this, [[49,
|
|
631
|
+
}, _callee6, this, [[49, 69]]);
|
|
628
632
|
}));
|
|
629
633
|
function initialize(_x5) {
|
|
630
634
|
return _initialize.apply(this, arguments);
|
|
@@ -770,27 +774,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
770
774
|
key: "loadAllProducts",
|
|
771
775
|
value: function () {
|
|
772
776
|
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
773
|
-
var
|
|
777
|
+
var _this5 = this;
|
|
774
778
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
775
779
|
while (1) switch (_context10.prev = _context10.next) {
|
|
780
|
+
case 0:
|
|
781
|
+
if (!this.loadAllProductsInFlight) {
|
|
782
|
+
_context10.next = 2;
|
|
783
|
+
break;
|
|
784
|
+
}
|
|
785
|
+
return _context10.abrupt("return", this.loadAllProductsInFlight);
|
|
786
|
+
case 2:
|
|
787
|
+
this.loadAllProductsInFlight = this._doLoadAllProducts().finally(function () {
|
|
788
|
+
_this5.loadAllProductsInFlight = null;
|
|
789
|
+
});
|
|
790
|
+
return _context10.abrupt("return", this.loadAllProductsInFlight);
|
|
791
|
+
case 4:
|
|
792
|
+
case "end":
|
|
793
|
+
return _context10.stop();
|
|
794
|
+
}
|
|
795
|
+
}, _callee10, this);
|
|
796
|
+
}));
|
|
797
|
+
function loadAllProducts() {
|
|
798
|
+
return _loadAllProducts.apply(this, arguments);
|
|
799
|
+
}
|
|
800
|
+
return loadAllProducts;
|
|
801
|
+
}()
|
|
802
|
+
}, {
|
|
803
|
+
key: "_doLoadAllProducts",
|
|
804
|
+
value: function () {
|
|
805
|
+
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
806
|
+
var _this$otherParams6, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
|
|
807
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
808
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
776
809
|
case 0:
|
|
777
810
|
this.logMethodStart('loadAllProducts');
|
|
778
|
-
|
|
811
|
+
_context11.prev = 1;
|
|
779
812
|
if (this.store.venueProducts) {
|
|
780
|
-
|
|
813
|
+
_context11.next = 4;
|
|
781
814
|
break;
|
|
782
815
|
}
|
|
783
816
|
throw new Error('venueProducts 模块未初始化');
|
|
784
817
|
case 4:
|
|
785
818
|
if (this.store.addonProducts) {
|
|
786
|
-
|
|
819
|
+
_context11.next = 6;
|
|
787
820
|
break;
|
|
788
821
|
}
|
|
789
822
|
throw new Error('addonProducts 模块未初始化');
|
|
790
823
|
case 6:
|
|
791
824
|
associatedMenus = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 || (_this$otherParams6 = _this$otherParams6.openData) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6['menu.associated_menus']) || [];
|
|
792
825
|
if (associatedMenus.length) {
|
|
793
|
-
|
|
826
|
+
_context11.next = 9;
|
|
794
827
|
break;
|
|
795
828
|
}
|
|
796
829
|
throw new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置');
|
|
@@ -798,7 +831,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
798
831
|
menuListIds = associatedMenus.map(function (n) {
|
|
799
832
|
return Number(n.value);
|
|
800
833
|
});
|
|
801
|
-
|
|
834
|
+
_context11.next = 12;
|
|
802
835
|
return this.store.venueProducts.loadProducts({
|
|
803
836
|
menu_list_ids: menuListIds,
|
|
804
837
|
cacheId: this.cacheId,
|
|
@@ -806,7 +839,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
806
839
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
807
840
|
});
|
|
808
841
|
case 12:
|
|
809
|
-
allProducts =
|
|
842
|
+
allProducts = _context11.sent;
|
|
810
843
|
list = Array.isArray(allProducts) ? allProducts : [];
|
|
811
844
|
venueList = list.filter(function (p) {
|
|
812
845
|
return p.duration != null;
|
|
@@ -822,50 +855,51 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
822
855
|
}
|
|
823
856
|
this.store.addonProducts.addProduct(addonList);
|
|
824
857
|
this.resourceProductMap = buildResourceProductMap(venueList);
|
|
858
|
+
this.productsLoaded = true;
|
|
825
859
|
this.logMethodSuccess('loadAllProducts', {
|
|
826
860
|
total: list.length,
|
|
827
861
|
venueCount: venueList.length,
|
|
828
862
|
addonCount: addonList.length,
|
|
829
863
|
resourceCount: this.resourceProductMap.size
|
|
830
864
|
});
|
|
831
|
-
return
|
|
865
|
+
return _context11.abrupt("return", {
|
|
832
866
|
venueProducts: venueList,
|
|
833
867
|
addonProducts: addonList
|
|
834
868
|
});
|
|
835
|
-
case
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
this.logMethodError('loadAllProducts',
|
|
839
|
-
throw
|
|
840
|
-
case
|
|
869
|
+
case 25:
|
|
870
|
+
_context11.prev = 25;
|
|
871
|
+
_context11.t0 = _context11["catch"](1);
|
|
872
|
+
this.logMethodError('loadAllProducts', _context11.t0);
|
|
873
|
+
throw _context11.t0;
|
|
874
|
+
case 29:
|
|
841
875
|
case "end":
|
|
842
|
-
return
|
|
876
|
+
return _context11.stop();
|
|
843
877
|
}
|
|
844
|
-
},
|
|
878
|
+
}, _callee11, this, [[1, 25]]);
|
|
845
879
|
}));
|
|
846
|
-
function
|
|
847
|
-
return
|
|
880
|
+
function _doLoadAllProducts() {
|
|
881
|
+
return _doLoadAllProducts2.apply(this, arguments);
|
|
848
882
|
}
|
|
849
|
-
return
|
|
883
|
+
return _doLoadAllProducts;
|
|
850
884
|
}()
|
|
851
885
|
}, {
|
|
852
886
|
key: "loadVenueProducts",
|
|
853
887
|
value: function () {
|
|
854
|
-
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
888
|
+
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
855
889
|
var result;
|
|
856
|
-
return _regeneratorRuntime().wrap(function
|
|
857
|
-
while (1) switch (
|
|
890
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
891
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
858
892
|
case 0:
|
|
859
|
-
|
|
893
|
+
_context12.next = 2;
|
|
860
894
|
return this.loadAllProducts();
|
|
861
895
|
case 2:
|
|
862
|
-
result =
|
|
863
|
-
return
|
|
896
|
+
result = _context12.sent;
|
|
897
|
+
return _context12.abrupt("return", result.venueProducts);
|
|
864
898
|
case 4:
|
|
865
899
|
case "end":
|
|
866
|
-
return
|
|
900
|
+
return _context12.stop();
|
|
867
901
|
}
|
|
868
|
-
},
|
|
902
|
+
}, _callee12, this);
|
|
869
903
|
}));
|
|
870
904
|
function loadVenueProducts() {
|
|
871
905
|
return _loadVenueProducts.apply(this, arguments);
|
|
@@ -875,21 +909,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
875
909
|
}, {
|
|
876
910
|
key: "loadAddonProducts",
|
|
877
911
|
value: function () {
|
|
878
|
-
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
912
|
+
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
879
913
|
var result;
|
|
880
|
-
return _regeneratorRuntime().wrap(function
|
|
881
|
-
while (1) switch (
|
|
914
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
915
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
882
916
|
case 0:
|
|
883
|
-
|
|
917
|
+
_context13.next = 2;
|
|
884
918
|
return this.loadAllProducts();
|
|
885
919
|
case 2:
|
|
886
|
-
result =
|
|
887
|
-
return
|
|
920
|
+
result = _context13.sent;
|
|
921
|
+
return _context13.abrupt("return", result.addonProducts);
|
|
888
922
|
case 4:
|
|
889
923
|
case "end":
|
|
890
|
-
return
|
|
924
|
+
return _context13.stop();
|
|
891
925
|
}
|
|
892
|
-
},
|
|
926
|
+
}, _callee13, this);
|
|
893
927
|
}));
|
|
894
928
|
function loadAddonProducts() {
|
|
895
929
|
return _loadAddonProducts.apply(this, arguments);
|
|
@@ -913,36 +947,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
913
947
|
}, {
|
|
914
948
|
key: "loadQuotations",
|
|
915
949
|
value: function () {
|
|
916
|
-
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
917
|
-
return _regeneratorRuntime().wrap(function
|
|
918
|
-
while (1) switch (
|
|
950
|
+
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
951
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
952
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
919
953
|
case 0:
|
|
920
954
|
this.logMethodStart('loadQuotations');
|
|
921
|
-
|
|
955
|
+
_context14.prev = 1;
|
|
922
956
|
if (this.store.quotation) {
|
|
923
|
-
|
|
957
|
+
_context14.next = 4;
|
|
924
958
|
break;
|
|
925
959
|
}
|
|
926
960
|
throw new Error('quotation 模块未初始化');
|
|
927
961
|
case 4:
|
|
928
|
-
|
|
962
|
+
_context14.next = 6;
|
|
929
963
|
return this.store.quotation.loadQuotations(params);
|
|
930
964
|
case 6:
|
|
931
965
|
this.logMethodSuccess('loadQuotations', {
|
|
932
966
|
count: this.store.quotation.getQuotationList().length
|
|
933
967
|
});
|
|
934
|
-
|
|
968
|
+
_context14.next = 13;
|
|
935
969
|
break;
|
|
936
970
|
case 9:
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
this.logMethodError('loadQuotations',
|
|
940
|
-
throw
|
|
971
|
+
_context14.prev = 9;
|
|
972
|
+
_context14.t0 = _context14["catch"](1);
|
|
973
|
+
this.logMethodError('loadQuotations', _context14.t0);
|
|
974
|
+
throw _context14.t0;
|
|
941
975
|
case 13:
|
|
942
976
|
case "end":
|
|
943
|
-
return
|
|
977
|
+
return _context14.stop();
|
|
944
978
|
}
|
|
945
|
-
},
|
|
979
|
+
}, _callee14, this, [[1, 9]]);
|
|
946
980
|
}));
|
|
947
981
|
function loadQuotations(_x6) {
|
|
948
982
|
return _loadQuotations.apply(this, arguments);
|
|
@@ -952,46 +986,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
952
986
|
}, {
|
|
953
987
|
key: "fetchResourceAvailability",
|
|
954
988
|
value: function () {
|
|
955
|
-
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
989
|
+
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
956
990
|
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i2, _rawData, _item, mapping;
|
|
957
|
-
return _regeneratorRuntime().wrap(function
|
|
958
|
-
while (1) switch (
|
|
991
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
992
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
959
993
|
case 0:
|
|
960
994
|
this.logMethodStart('fetchResourceAvailability', params);
|
|
961
|
-
|
|
995
|
+
_context15.prev = 1;
|
|
962
996
|
venueProducts = this.getVenueProducts();
|
|
963
997
|
if (venueProducts.length) {
|
|
964
|
-
|
|
998
|
+
_context15.next = 7;
|
|
965
999
|
break;
|
|
966
1000
|
}
|
|
967
1001
|
this.store.rawResourceData = [];
|
|
968
1002
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
969
1003
|
resourceCount: 0
|
|
970
1004
|
});
|
|
971
|
-
return
|
|
1005
|
+
return _context15.abrupt("return");
|
|
972
1006
|
case 7:
|
|
973
1007
|
resourceIds = extractResourceIds(venueProducts);
|
|
974
1008
|
if (resourceIds.length) {
|
|
975
|
-
|
|
1009
|
+
_context15.next = 12;
|
|
976
1010
|
break;
|
|
977
1011
|
}
|
|
978
1012
|
this.store.rawResourceData = [];
|
|
979
1013
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
980
1014
|
resourceIds: []
|
|
981
1015
|
});
|
|
982
|
-
return
|
|
1016
|
+
return _context15.abrupt("return");
|
|
983
1017
|
case 12:
|
|
984
1018
|
// 跨天营业时,endDate 扩展一天以覆盖次日凌晨时段
|
|
985
1019
|
config = this.store.slotConfig;
|
|
986
1020
|
crossDay = isBusinessHoursCrossDay(config);
|
|
987
1021
|
effectiveEndDate = crossDay ? dayjs(params.endDate).add(1, 'day').format('YYYY-MM-DD') : params.endDate;
|
|
988
1022
|
if (this.store.date) {
|
|
989
|
-
|
|
1023
|
+
_context15.next = 17;
|
|
990
1024
|
break;
|
|
991
1025
|
}
|
|
992
1026
|
throw new Error('date 模块未初始化');
|
|
993
1027
|
case 17:
|
|
994
|
-
|
|
1028
|
+
_context15.next = 19;
|
|
995
1029
|
return this.store.date.fetchResourceDates({
|
|
996
1030
|
query: {
|
|
997
1031
|
start_date: params.startDate,
|
|
@@ -1001,7 +1035,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1001
1035
|
useCache: false
|
|
1002
1036
|
});
|
|
1003
1037
|
case 19:
|
|
1004
|
-
res =
|
|
1038
|
+
res = _context15.sent;
|
|
1005
1039
|
rawData = [];
|
|
1006
1040
|
if (res !== null && res !== void 0 && res.data && Array.isArray(res.data)) {
|
|
1007
1041
|
_iterator2 = _createForOfIteratorHelper(res.data);
|
|
@@ -1037,19 +1071,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1037
1071
|
return sum + r.times.length;
|
|
1038
1072
|
}, 0)
|
|
1039
1073
|
});
|
|
1040
|
-
|
|
1074
|
+
_context15.next = 32;
|
|
1041
1075
|
break;
|
|
1042
1076
|
case 27:
|
|
1043
|
-
|
|
1044
|
-
|
|
1077
|
+
_context15.prev = 27;
|
|
1078
|
+
_context15.t0 = _context15["catch"](1);
|
|
1045
1079
|
this.store.rawResourceData = [];
|
|
1046
|
-
this.logMethodError('fetchResourceAvailability',
|
|
1047
|
-
throw
|
|
1080
|
+
this.logMethodError('fetchResourceAvailability', _context15.t0);
|
|
1081
|
+
throw _context15.t0;
|
|
1048
1082
|
case 32:
|
|
1049
1083
|
case "end":
|
|
1050
|
-
return
|
|
1084
|
+
return _context15.stop();
|
|
1051
1085
|
}
|
|
1052
|
-
},
|
|
1086
|
+
}, _callee15, this, [[1, 27]]);
|
|
1053
1087
|
}));
|
|
1054
1088
|
function fetchResourceAvailability(_x7) {
|
|
1055
1089
|
return _fetchResourceAvailability.apply(this, arguments);
|
|
@@ -1103,25 +1137,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1103
1137
|
}, {
|
|
1104
1138
|
key: "toggleSlot",
|
|
1105
1139
|
value: function () {
|
|
1106
|
-
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1140
|
+
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(slot) {
|
|
1107
1141
|
var mapping, currentSlots, existIndex, nextSlots, products;
|
|
1108
|
-
return _regeneratorRuntime().wrap(function
|
|
1109
|
-
while (1) switch (
|
|
1142
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1143
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1110
1144
|
case 0:
|
|
1111
1145
|
this.logMethodStart('toggleSlot', {
|
|
1112
1146
|
resourceId: slot.resourceId,
|
|
1113
1147
|
startTime: slot.startTime
|
|
1114
1148
|
});
|
|
1115
|
-
|
|
1149
|
+
_context16.prev = 1;
|
|
1116
1150
|
mapping = this.resourceProductMap.get(slot.resourceId);
|
|
1117
1151
|
if (mapping) {
|
|
1118
|
-
|
|
1152
|
+
_context16.next = 5;
|
|
1119
1153
|
break;
|
|
1120
1154
|
}
|
|
1121
1155
|
throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
|
|
1122
1156
|
case 5:
|
|
1123
1157
|
if (this.store.order) {
|
|
1124
|
-
|
|
1158
|
+
_context16.next = 7;
|
|
1125
1159
|
break;
|
|
1126
1160
|
}
|
|
1127
1161
|
throw new Error('order 模块未初始化');
|
|
@@ -1137,14 +1171,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1137
1171
|
} else {
|
|
1138
1172
|
nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
|
|
1139
1173
|
}
|
|
1140
|
-
|
|
1174
|
+
_context16.next = 12;
|
|
1141
1175
|
return this.reconcileOrderForResource(slot.resourceId, nextSlots);
|
|
1142
1176
|
case 12:
|
|
1143
1177
|
products = this.store.order.getOrderProducts();
|
|
1144
|
-
|
|
1178
|
+
_context16.next = 15;
|
|
1145
1179
|
return this.refreshItemRuleQuantityLimits();
|
|
1146
1180
|
case 15:
|
|
1147
|
-
|
|
1181
|
+
_context16.next = 17;
|
|
1148
1182
|
return this.refreshCartValidationPassed();
|
|
1149
1183
|
case 17:
|
|
1150
1184
|
this.logMethodSuccess('toggleSlot', {
|
|
@@ -1152,17 +1186,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1152
1186
|
resourceId: slot.resourceId,
|
|
1153
1187
|
slotCount: nextSlots.length
|
|
1154
1188
|
});
|
|
1155
|
-
return
|
|
1189
|
+
return _context16.abrupt("return", products);
|
|
1156
1190
|
case 21:
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
this.logMethodError('toggleSlot',
|
|
1160
|
-
throw
|
|
1191
|
+
_context16.prev = 21;
|
|
1192
|
+
_context16.t0 = _context16["catch"](1);
|
|
1193
|
+
this.logMethodError('toggleSlot', _context16.t0);
|
|
1194
|
+
throw _context16.t0;
|
|
1161
1195
|
case 25:
|
|
1162
1196
|
case "end":
|
|
1163
|
-
return
|
|
1197
|
+
return _context16.stop();
|
|
1164
1198
|
}
|
|
1165
|
-
},
|
|
1199
|
+
}, _callee16, this, [[1, 21]]);
|
|
1166
1200
|
}));
|
|
1167
1201
|
function toggleSlot(_x8) {
|
|
1168
1202
|
return _toggleSlot.apply(this, arguments);
|
|
@@ -1270,17 +1304,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1270
1304
|
}, {
|
|
1271
1305
|
key: "reconcileOrderForResource",
|
|
1272
1306
|
value: (function () {
|
|
1273
|
-
var _reconcileOrderForResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1307
|
+
var _reconcileOrderForResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(resourceId, slots) {
|
|
1274
1308
|
var mapping, tempOrder, merged, rawResource, venueProduct, i, _venueProduct$is_char, _rawResource$form_id, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, booking;
|
|
1275
|
-
return _regeneratorRuntime().wrap(function
|
|
1276
|
-
while (1) switch (
|
|
1309
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1310
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1277
1311
|
case 0:
|
|
1278
1312
|
mapping = this.resourceProductMap.get(resourceId);
|
|
1279
1313
|
if (!(!mapping || !this.store.order)) {
|
|
1280
|
-
|
|
1314
|
+
_context17.next = 3;
|
|
1281
1315
|
break;
|
|
1282
1316
|
}
|
|
1283
|
-
return
|
|
1317
|
+
return _context17.abrupt("return");
|
|
1284
1318
|
case 3:
|
|
1285
1319
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1286
1320
|
tempOrder.products = tempOrder.products.filter(function (p) {
|
|
@@ -1292,17 +1326,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1292
1326
|
return !((_b$metadata = b.metadata) !== null && _b$metadata !== void 0 && _b$metadata.venue_booking && String((_b$metadata2 = b.metadata) === null || _b$metadata2 === void 0 ? void 0 : _b$metadata2.resource_id) === String(resourceId));
|
|
1293
1327
|
});
|
|
1294
1328
|
if (slots.length) {
|
|
1295
|
-
|
|
1329
|
+
_context17.next = 12;
|
|
1296
1330
|
break;
|
|
1297
1331
|
}
|
|
1298
1332
|
this.store.order.applyDiscount();
|
|
1299
|
-
|
|
1333
|
+
_context17.next = 10;
|
|
1300
1334
|
return this.store.order.recalculateSummary({
|
|
1301
1335
|
createIfMissing: true
|
|
1302
1336
|
});
|
|
1303
1337
|
case 10:
|
|
1304
1338
|
this.store.order.persistTempOrder();
|
|
1305
|
-
return
|
|
1339
|
+
return _context17.abrupt("return");
|
|
1306
1340
|
case 12:
|
|
1307
1341
|
merged = mergeConsecutiveSlots(slots);
|
|
1308
1342
|
rawResource = this.store.rawResourceData.find(function (r) {
|
|
@@ -1400,7 +1434,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1400
1434
|
tempOrder.bookings.push(booking);
|
|
1401
1435
|
}
|
|
1402
1436
|
this.store.order.applyDiscount();
|
|
1403
|
-
|
|
1437
|
+
_context17.next = 20;
|
|
1404
1438
|
return this.store.order.recalculateSummary({
|
|
1405
1439
|
createIfMissing: true
|
|
1406
1440
|
});
|
|
@@ -1408,9 +1442,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1408
1442
|
this.store.order.persistTempOrder();
|
|
1409
1443
|
case 21:
|
|
1410
1444
|
case "end":
|
|
1411
|
-
return
|
|
1445
|
+
return _context17.stop();
|
|
1412
1446
|
}
|
|
1413
|
-
},
|
|
1447
|
+
}, _callee17, this);
|
|
1414
1448
|
}));
|
|
1415
1449
|
function reconcileOrderForResource(_x9, _x10) {
|
|
1416
1450
|
return _reconcileOrderForResource.apply(this, arguments);
|
|
@@ -1433,35 +1467,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1433
1467
|
}, {
|
|
1434
1468
|
key: "loadSchedules",
|
|
1435
1469
|
value: function () {
|
|
1436
|
-
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1437
|
-
return _regeneratorRuntime().wrap(function
|
|
1438
|
-
while (1) switch (
|
|
1470
|
+
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1471
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1472
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1439
1473
|
case 0:
|
|
1440
1474
|
this.logMethodStart('loadSchedules');
|
|
1441
|
-
|
|
1475
|
+
_context18.prev = 1;
|
|
1442
1476
|
if (this.store.schedule) {
|
|
1443
|
-
|
|
1477
|
+
_context18.next = 4;
|
|
1444
1478
|
break;
|
|
1445
1479
|
}
|
|
1446
1480
|
throw new Error('schedule 模块未初始化');
|
|
1447
1481
|
case 4:
|
|
1448
|
-
|
|
1482
|
+
_context18.next = 6;
|
|
1449
1483
|
return this.store.schedule.loadAllSchedule();
|
|
1450
1484
|
case 6:
|
|
1451
1485
|
this.injectScheduleResolverToQuotation();
|
|
1452
1486
|
this.logMethodSuccess('loadSchedules');
|
|
1453
|
-
|
|
1487
|
+
_context18.next = 14;
|
|
1454
1488
|
break;
|
|
1455
1489
|
case 10:
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
this.logMethodError('loadSchedules',
|
|
1459
|
-
throw
|
|
1490
|
+
_context18.prev = 10;
|
|
1491
|
+
_context18.t0 = _context18["catch"](1);
|
|
1492
|
+
this.logMethodError('loadSchedules', _context18.t0);
|
|
1493
|
+
throw _context18.t0;
|
|
1460
1494
|
case 14:
|
|
1461
1495
|
case "end":
|
|
1462
|
-
return
|
|
1496
|
+
return _context18.stop();
|
|
1463
1497
|
}
|
|
1464
|
-
},
|
|
1498
|
+
}, _callee18, this, [[1, 10]]);
|
|
1465
1499
|
}));
|
|
1466
1500
|
function loadSchedules() {
|
|
1467
1501
|
return _loadSchedules.apply(this, arguments);
|
|
@@ -1471,10 +1505,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1471
1505
|
}, {
|
|
1472
1506
|
key: "injectScheduleResolverToQuotation",
|
|
1473
1507
|
value: function injectScheduleResolverToQuotation() {
|
|
1474
|
-
var
|
|
1508
|
+
var _this6 = this;
|
|
1475
1509
|
if (this.store.quotation && this.store.schedule) {
|
|
1476
1510
|
this.store.quotation.setScheduleResolver(function (id) {
|
|
1477
|
-
return
|
|
1511
|
+
return _this6.store.schedule.getScheduleListByIds([id])[0];
|
|
1478
1512
|
});
|
|
1479
1513
|
}
|
|
1480
1514
|
}
|
|
@@ -1514,15 +1548,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1514
1548
|
}, {
|
|
1515
1549
|
key: "onCustomerLogin",
|
|
1516
1550
|
value: function () {
|
|
1517
|
-
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1518
|
-
return _regeneratorRuntime().wrap(function
|
|
1519
|
-
while (1) switch (
|
|
1551
|
+
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
|
|
1552
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1553
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1520
1554
|
case 0:
|
|
1521
1555
|
this.logMethodStart('onCustomerLogin', {
|
|
1522
1556
|
customerId: params.customerId
|
|
1523
1557
|
});
|
|
1524
|
-
|
|
1525
|
-
|
|
1558
|
+
_context19.prev = 1;
|
|
1559
|
+
_context19.next = 4;
|
|
1526
1560
|
return this.refreshOrderMarketingAfterLogin({
|
|
1527
1561
|
customerId: params.customerId
|
|
1528
1562
|
});
|
|
@@ -1530,18 +1564,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1530
1564
|
this.logMethodSuccess('onCustomerLogin', {
|
|
1531
1565
|
customerId: params.customerId
|
|
1532
1566
|
});
|
|
1533
|
-
|
|
1567
|
+
_context19.next = 11;
|
|
1534
1568
|
break;
|
|
1535
1569
|
case 7:
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
this.logMethodError('onCustomerLogin',
|
|
1539
|
-
throw
|
|
1570
|
+
_context19.prev = 7;
|
|
1571
|
+
_context19.t0 = _context19["catch"](1);
|
|
1572
|
+
this.logMethodError('onCustomerLogin', _context19.t0);
|
|
1573
|
+
throw _context19.t0;
|
|
1540
1574
|
case 11:
|
|
1541
1575
|
case "end":
|
|
1542
|
-
return
|
|
1576
|
+
return _context19.stop();
|
|
1543
1577
|
}
|
|
1544
|
-
},
|
|
1578
|
+
}, _callee19, this, [[1, 7]]);
|
|
1545
1579
|
}));
|
|
1546
1580
|
function onCustomerLogin(_x11) {
|
|
1547
1581
|
return _onCustomerLogin.apply(this, arguments);
|
|
@@ -1552,7 +1586,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1552
1586
|
key: "recalculateOrderPricesFromQuotation",
|
|
1553
1587
|
value: function recalculateOrderPricesFromQuotation() {
|
|
1554
1588
|
var _tempOrder$products,
|
|
1555
|
-
|
|
1589
|
+
_this7 = this;
|
|
1556
1590
|
if (!this.store.order || !this.store.quotation) return;
|
|
1557
1591
|
var tempOrder = this.store.order.getTempOrder();
|
|
1558
1592
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
@@ -1564,13 +1598,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1564
1598
|
var _product$metadata2;
|
|
1565
1599
|
var product = _step6.value;
|
|
1566
1600
|
if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
|
|
1567
|
-
var mapping =
|
|
1601
|
+
var mapping = _this7.resourceProductMap.get(product.metadata.resource_id);
|
|
1568
1602
|
if (!mapping) return 1; // continue
|
|
1569
|
-
var slots = expandMergedSlotToIndividual(product,
|
|
1603
|
+
var slots = expandMergedSlotToIndividual(product, _this7.store.slotConfig.slotDurationMinutes);
|
|
1570
1604
|
var updatedSlots = slots.map(function (slot) {
|
|
1571
1605
|
var _getPriceForProduct;
|
|
1572
1606
|
return _objectSpread(_objectSpread({}, slot), {}, {
|
|
1573
|
-
price: (_getPriceForProduct =
|
|
1607
|
+
price: (_getPriceForProduct = _this7.store.quotation.getPriceForProduct({
|
|
1574
1608
|
productId: mapping.productId,
|
|
1575
1609
|
datetime: slot.startTime
|
|
1576
1610
|
})) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
|
|
@@ -1583,12 +1617,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1583
1617
|
product.metadata.price_breakdown = buildPriceBreakdown({
|
|
1584
1618
|
group: merged[0],
|
|
1585
1619
|
productId: mapping.productId,
|
|
1586
|
-
quotation:
|
|
1620
|
+
quotation: _this7.store.quotation
|
|
1587
1621
|
});
|
|
1588
1622
|
}
|
|
1589
1623
|
} else if (product.product_id != null) {
|
|
1590
1624
|
var _product$product_vari;
|
|
1591
|
-
var quotationPrice =
|
|
1625
|
+
var quotationPrice = _this7.store.quotation.getPriceForProduct({
|
|
1592
1626
|
productId: product.product_id,
|
|
1593
1627
|
variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
|
|
1594
1628
|
datetime: now
|
|
@@ -1611,30 +1645,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1611
1645
|
}, {
|
|
1612
1646
|
key: "scanCode",
|
|
1613
1647
|
value: function () {
|
|
1614
|
-
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1648
|
+
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(code, customerId) {
|
|
1615
1649
|
var result;
|
|
1616
|
-
return _regeneratorRuntime().wrap(function
|
|
1617
|
-
while (1) switch (
|
|
1650
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1651
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1618
1652
|
case 0:
|
|
1619
1653
|
this.logMethodStart('scanCode', {
|
|
1620
1654
|
code: code
|
|
1621
1655
|
});
|
|
1622
|
-
|
|
1656
|
+
_context20.prev = 1;
|
|
1623
1657
|
if (this.store.order) {
|
|
1624
|
-
|
|
1658
|
+
_context20.next = 4;
|
|
1625
1659
|
break;
|
|
1626
1660
|
}
|
|
1627
1661
|
throw new Error('order 模块未初始化');
|
|
1628
1662
|
case 4:
|
|
1629
|
-
|
|
1663
|
+
_context20.next = 6;
|
|
1630
1664
|
return this.store.order.scanCode(code, customerId);
|
|
1631
1665
|
case 6:
|
|
1632
|
-
result =
|
|
1666
|
+
result = _context20.sent;
|
|
1633
1667
|
if (!result.isAvailable) {
|
|
1634
|
-
|
|
1668
|
+
_context20.next = 11;
|
|
1635
1669
|
break;
|
|
1636
1670
|
}
|
|
1637
|
-
|
|
1671
|
+
_context20.next = 10;
|
|
1638
1672
|
return this.store.order.recalculateSummary({
|
|
1639
1673
|
createIfMissing: true
|
|
1640
1674
|
});
|
|
@@ -1644,17 +1678,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1644
1678
|
this.logMethodSuccess('scanCode', {
|
|
1645
1679
|
isAvailable: result.isAvailable
|
|
1646
1680
|
});
|
|
1647
|
-
return
|
|
1681
|
+
return _context20.abrupt("return", result);
|
|
1648
1682
|
case 15:
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
this.logMethodError('scanCode',
|
|
1652
|
-
throw
|
|
1683
|
+
_context20.prev = 15;
|
|
1684
|
+
_context20.t0 = _context20["catch"](1);
|
|
1685
|
+
this.logMethodError('scanCode', _context20.t0);
|
|
1686
|
+
throw _context20.t0;
|
|
1653
1687
|
case 19:
|
|
1654
1688
|
case "end":
|
|
1655
|
-
return
|
|
1689
|
+
return _context20.stop();
|
|
1656
1690
|
}
|
|
1657
|
-
},
|
|
1691
|
+
}, _callee20, this, [[1, 15]]);
|
|
1658
1692
|
}));
|
|
1659
1693
|
function scanCode(_x12, _x13) {
|
|
1660
1694
|
return _scanCode.apply(this, arguments);
|
|
@@ -1672,15 +1706,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1672
1706
|
}, {
|
|
1673
1707
|
key: "setDiscountSelected",
|
|
1674
1708
|
value: (function () {
|
|
1675
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1709
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
1676
1710
|
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, _iterator7, _step7, d, selectedResourceIds, _iterator8, _step8, _product$discount_lis, product, before, totalDiscountAmount, newPaymentPrice, paymentStr, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
1677
|
-
return _regeneratorRuntime().wrap(function
|
|
1678
|
-
while (1) switch (
|
|
1711
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1712
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1679
1713
|
case 0:
|
|
1680
1714
|
this.logMethodStart('setDiscountSelected', params);
|
|
1681
|
-
|
|
1715
|
+
_context21.prev = 1;
|
|
1682
1716
|
if (this.store.order) {
|
|
1683
|
-
|
|
1717
|
+
_context21.next = 4;
|
|
1684
1718
|
break;
|
|
1685
1719
|
}
|
|
1686
1720
|
throw new Error('order 模块未初始化');
|
|
@@ -1706,7 +1740,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1706
1740
|
form_record_id: tempOrder.holder.form_record_id
|
|
1707
1741
|
}] : [];
|
|
1708
1742
|
nextDiscountList = updated;
|
|
1709
|
-
|
|
1743
|
+
_context21.next = 16;
|
|
1710
1744
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1711
1745
|
case 16:
|
|
1712
1746
|
if (rulesModule) {
|
|
@@ -1755,19 +1789,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1755
1789
|
return d.id;
|
|
1756
1790
|
}));
|
|
1757
1791
|
_iterator8 = _createForOfIteratorHelper(tempOrder.products);
|
|
1758
|
-
|
|
1792
|
+
_context21.prev = 19;
|
|
1759
1793
|
_iterator8.s();
|
|
1760
1794
|
case 21:
|
|
1761
1795
|
if ((_step8 = _iterator8.n()).done) {
|
|
1762
|
-
|
|
1796
|
+
_context21.next = 30;
|
|
1763
1797
|
break;
|
|
1764
1798
|
}
|
|
1765
1799
|
product = _step8.value;
|
|
1766
1800
|
if ((_product$discount_lis = product.discount_list) !== null && _product$discount_lis !== void 0 && _product$discount_lis.length) {
|
|
1767
|
-
|
|
1801
|
+
_context21.next = 25;
|
|
1768
1802
|
break;
|
|
1769
1803
|
}
|
|
1770
|
-
return
|
|
1804
|
+
return _context21.abrupt("continue", 28);
|
|
1771
1805
|
case 25:
|
|
1772
1806
|
before = product.discount_list.length;
|
|
1773
1807
|
product.discount_list = product.discount_list.filter(function (pd) {
|
|
@@ -1787,22 +1821,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1787
1821
|
}
|
|
1788
1822
|
}
|
|
1789
1823
|
case 28:
|
|
1790
|
-
|
|
1824
|
+
_context21.next = 21;
|
|
1791
1825
|
break;
|
|
1792
1826
|
case 30:
|
|
1793
|
-
|
|
1827
|
+
_context21.next = 35;
|
|
1794
1828
|
break;
|
|
1795
1829
|
case 32:
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
_iterator8.e(
|
|
1830
|
+
_context21.prev = 32;
|
|
1831
|
+
_context21.t0 = _context21["catch"](19);
|
|
1832
|
+
_iterator8.e(_context21.t0);
|
|
1799
1833
|
case 35:
|
|
1800
|
-
|
|
1834
|
+
_context21.prev = 35;
|
|
1801
1835
|
_iterator8.f();
|
|
1802
|
-
return
|
|
1836
|
+
return _context21.finish(35);
|
|
1803
1837
|
case 38:
|
|
1804
1838
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1805
|
-
|
|
1839
|
+
_context21.next = 41;
|
|
1806
1840
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1807
1841
|
case 41:
|
|
1808
1842
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
@@ -1811,7 +1845,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1811
1845
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
1812
1846
|
return d.id === params.discountId;
|
|
1813
1847
|
}) || null;
|
|
1814
|
-
|
|
1848
|
+
_context21.next = 45;
|
|
1815
1849
|
return this.store.order.recalculateSummary({
|
|
1816
1850
|
createIfMissing: true
|
|
1817
1851
|
});
|
|
@@ -1823,17 +1857,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1823
1857
|
finalTarget = this.store.order.getDiscountList().find(function (d) {
|
|
1824
1858
|
return d.id === params.discountId;
|
|
1825
1859
|
}) || null;
|
|
1826
|
-
return
|
|
1860
|
+
return _context21.abrupt("return", this.store.order.getDiscountList());
|
|
1827
1861
|
case 53:
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
this.logMethodError('setDiscountSelected',
|
|
1831
|
-
throw
|
|
1862
|
+
_context21.prev = 53;
|
|
1863
|
+
_context21.t1 = _context21["catch"](1);
|
|
1864
|
+
this.logMethodError('setDiscountSelected', _context21.t1);
|
|
1865
|
+
throw _context21.t1;
|
|
1832
1866
|
case 57:
|
|
1833
1867
|
case "end":
|
|
1834
|
-
return
|
|
1868
|
+
return _context21.stop();
|
|
1835
1869
|
}
|
|
1836
|
-
},
|
|
1870
|
+
}, _callee21, this, [[1, 53], [19, 32, 35, 38]]);
|
|
1837
1871
|
}));
|
|
1838
1872
|
function setDiscountSelected(_x14) {
|
|
1839
1873
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -1843,37 +1877,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1843
1877
|
}, {
|
|
1844
1878
|
key: "addNewOrder",
|
|
1845
1879
|
value: function () {
|
|
1846
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1880
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1847
1881
|
var tempOrder;
|
|
1848
|
-
return _regeneratorRuntime().wrap(function
|
|
1849
|
-
while (1) switch (
|
|
1882
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1883
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1850
1884
|
case 0:
|
|
1851
1885
|
this.logMethodStart('addNewOrder');
|
|
1852
|
-
|
|
1886
|
+
_context22.prev = 1;
|
|
1853
1887
|
if (this.store.order) {
|
|
1854
|
-
|
|
1888
|
+
_context22.next = 4;
|
|
1855
1889
|
break;
|
|
1856
1890
|
}
|
|
1857
1891
|
throw new Error('order 模块未初始化');
|
|
1858
1892
|
case 4:
|
|
1859
|
-
|
|
1893
|
+
_context22.next = 6;
|
|
1860
1894
|
return this.store.order.addNewOrder();
|
|
1861
1895
|
case 6:
|
|
1862
|
-
tempOrder =
|
|
1896
|
+
tempOrder = _context22.sent;
|
|
1863
1897
|
this.logMethodSuccess('addNewOrder', {
|
|
1864
1898
|
productCount: tempOrder.products.length
|
|
1865
1899
|
});
|
|
1866
|
-
return
|
|
1900
|
+
return _context22.abrupt("return", tempOrder);
|
|
1867
1901
|
case 11:
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
this.logMethodError('addNewOrder',
|
|
1871
|
-
throw
|
|
1902
|
+
_context22.prev = 11;
|
|
1903
|
+
_context22.t0 = _context22["catch"](1);
|
|
1904
|
+
this.logMethodError('addNewOrder', _context22.t0);
|
|
1905
|
+
throw _context22.t0;
|
|
1872
1906
|
case 15:
|
|
1873
1907
|
case "end":
|
|
1874
|
-
return
|
|
1908
|
+
return _context22.stop();
|
|
1875
1909
|
}
|
|
1876
|
-
},
|
|
1910
|
+
}, _callee22, this, [[1, 11]]);
|
|
1877
1911
|
}));
|
|
1878
1912
|
function addNewOrder() {
|
|
1879
1913
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -1889,37 +1923,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1889
1923
|
}, {
|
|
1890
1924
|
key: "getSummary",
|
|
1891
1925
|
value: function () {
|
|
1892
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1926
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1893
1927
|
var summary;
|
|
1894
|
-
return _regeneratorRuntime().wrap(function
|
|
1895
|
-
while (1) switch (
|
|
1928
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1929
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1896
1930
|
case 0:
|
|
1897
1931
|
this.logMethodStart('getSummary');
|
|
1898
|
-
|
|
1932
|
+
_context23.prev = 1;
|
|
1899
1933
|
if (this.store.order) {
|
|
1900
|
-
|
|
1934
|
+
_context23.next = 4;
|
|
1901
1935
|
break;
|
|
1902
1936
|
}
|
|
1903
1937
|
throw new Error('order 模块未初始化');
|
|
1904
1938
|
case 4:
|
|
1905
|
-
|
|
1939
|
+
_context23.next = 6;
|
|
1906
1940
|
return this.store.order.getScanOrderSummary();
|
|
1907
1941
|
case 6:
|
|
1908
|
-
summary =
|
|
1942
|
+
summary = _context23.sent;
|
|
1909
1943
|
this.logMethodSuccess('getSummary', {
|
|
1910
1944
|
totalAmount: summary.total_amount
|
|
1911
1945
|
});
|
|
1912
|
-
return
|
|
1946
|
+
return _context23.abrupt("return", summary);
|
|
1913
1947
|
case 11:
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
this.logMethodError('getSummary',
|
|
1917
|
-
throw
|
|
1948
|
+
_context23.prev = 11;
|
|
1949
|
+
_context23.t0 = _context23["catch"](1);
|
|
1950
|
+
this.logMethodError('getSummary', _context23.t0);
|
|
1951
|
+
throw _context23.t0;
|
|
1918
1952
|
case 15:
|
|
1919
1953
|
case "end":
|
|
1920
|
-
return
|
|
1954
|
+
return _context23.stop();
|
|
1921
1955
|
}
|
|
1922
|
-
},
|
|
1956
|
+
}, _callee23, this, [[1, 11]]);
|
|
1923
1957
|
}));
|
|
1924
1958
|
function getSummary() {
|
|
1925
1959
|
return _getSummary.apply(this, arguments);
|
|
@@ -1929,43 +1963,43 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1929
1963
|
}, {
|
|
1930
1964
|
key: "submitOrder",
|
|
1931
1965
|
value: function () {
|
|
1932
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1966
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1933
1967
|
var _tempOrder$products2, result, tempOrder;
|
|
1934
|
-
return _regeneratorRuntime().wrap(function
|
|
1935
|
-
while (1) switch (
|
|
1968
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1969
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1936
1970
|
case 0:
|
|
1937
1971
|
this.logMethodStart('submitOrder');
|
|
1938
|
-
|
|
1939
|
-
|
|
1972
|
+
_context24.prev = 1;
|
|
1973
|
+
_context24.next = 4;
|
|
1940
1974
|
return this.validateBeforeSubmitByItemRule();
|
|
1941
1975
|
case 4:
|
|
1942
1976
|
if (this.store.order) {
|
|
1943
|
-
|
|
1977
|
+
_context24.next = 6;
|
|
1944
1978
|
break;
|
|
1945
1979
|
}
|
|
1946
1980
|
throw new Error('venueBooking解决方案需要 order 模块支持');
|
|
1947
1981
|
case 6:
|
|
1948
|
-
|
|
1982
|
+
_context24.next = 8;
|
|
1949
1983
|
return this.store.order.submitTempOrder({
|
|
1950
1984
|
cacheId: this.cacheId
|
|
1951
1985
|
});
|
|
1952
1986
|
case 8:
|
|
1953
|
-
result =
|
|
1987
|
+
result = _context24.sent;
|
|
1954
1988
|
tempOrder = this.store.order.getTempOrder();
|
|
1955
1989
|
this.logMethodSuccess('submitOrder', {
|
|
1956
1990
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
|
|
1957
1991
|
});
|
|
1958
|
-
return
|
|
1992
|
+
return _context24.abrupt("return", result);
|
|
1959
1993
|
case 14:
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
this.logMethodError('submitOrder',
|
|
1963
|
-
throw
|
|
1994
|
+
_context24.prev = 14;
|
|
1995
|
+
_context24.t0 = _context24["catch"](1);
|
|
1996
|
+
this.logMethodError('submitOrder', _context24.t0);
|
|
1997
|
+
throw _context24.t0;
|
|
1964
1998
|
case 18:
|
|
1965
1999
|
case "end":
|
|
1966
|
-
return
|
|
2000
|
+
return _context24.stop();
|
|
1967
2001
|
}
|
|
1968
|
-
},
|
|
2002
|
+
}, _callee24, this, [[1, 14]]);
|
|
1969
2003
|
}));
|
|
1970
2004
|
function submitOrder() {
|
|
1971
2005
|
return _submitOrder.apply(this, arguments);
|
|
@@ -1975,18 +2009,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1975
2009
|
}, {
|
|
1976
2010
|
key: "addProductToOrder",
|
|
1977
2011
|
value: function () {
|
|
1978
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2012
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(product) {
|
|
1979
2013
|
var _product$metadata3, _product$product_vari2, quotationPrice, products;
|
|
1980
|
-
return _regeneratorRuntime().wrap(function
|
|
1981
|
-
while (1) switch (
|
|
2014
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2015
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1982
2016
|
case 0:
|
|
1983
2017
|
this.logMethodStart('addProductToOrder', {
|
|
1984
2018
|
product_id: product.product_id,
|
|
1985
2019
|
product_variant_id: product.product_variant_id
|
|
1986
2020
|
});
|
|
1987
|
-
|
|
2021
|
+
_context25.prev = 1;
|
|
1988
2022
|
if (this.store.order) {
|
|
1989
|
-
|
|
2023
|
+
_context25.next = 4;
|
|
1990
2024
|
break;
|
|
1991
2025
|
}
|
|
1992
2026
|
throw new Error('order 模块未初始化');
|
|
@@ -2005,30 +2039,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2005
2039
|
product.payment_price = quotationPrice;
|
|
2006
2040
|
}
|
|
2007
2041
|
}
|
|
2008
|
-
|
|
2042
|
+
_context25.next = 7;
|
|
2009
2043
|
return this.store.order.addProductToOrder(product);
|
|
2010
2044
|
case 7:
|
|
2011
|
-
products =
|
|
2012
|
-
|
|
2045
|
+
products = _context25.sent;
|
|
2046
|
+
_context25.next = 10;
|
|
2013
2047
|
return this.refreshItemRuleQuantityLimits();
|
|
2014
2048
|
case 10:
|
|
2015
|
-
|
|
2049
|
+
_context25.next = 12;
|
|
2016
2050
|
return this.refreshCartValidationPassed();
|
|
2017
2051
|
case 12:
|
|
2018
2052
|
this.logMethodSuccess('addProductToOrder', {
|
|
2019
2053
|
productCount: products.length
|
|
2020
2054
|
});
|
|
2021
|
-
return
|
|
2055
|
+
return _context25.abrupt("return", products);
|
|
2022
2056
|
case 16:
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
this.logMethodError('addProductToOrder',
|
|
2026
|
-
throw
|
|
2057
|
+
_context25.prev = 16;
|
|
2058
|
+
_context25.t0 = _context25["catch"](1);
|
|
2059
|
+
this.logMethodError('addProductToOrder', _context25.t0);
|
|
2060
|
+
throw _context25.t0;
|
|
2027
2061
|
case 20:
|
|
2028
2062
|
case "end":
|
|
2029
|
-
return
|
|
2063
|
+
return _context25.stop();
|
|
2030
2064
|
}
|
|
2031
|
-
},
|
|
2065
|
+
}, _callee25, this, [[1, 16]]);
|
|
2032
2066
|
}));
|
|
2033
2067
|
function addProductToOrder(_x15) {
|
|
2034
2068
|
return _addProductToOrder.apply(this, arguments);
|
|
@@ -2038,46 +2072,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2038
2072
|
}, {
|
|
2039
2073
|
key: "updateProductInOrder",
|
|
2040
2074
|
value: function () {
|
|
2041
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2075
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2042
2076
|
var products;
|
|
2043
|
-
return _regeneratorRuntime().wrap(function
|
|
2044
|
-
while (1) switch (
|
|
2077
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2078
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2045
2079
|
case 0:
|
|
2046
2080
|
this.logMethodStart('updateProductInOrder', {
|
|
2047
2081
|
product_id: params.product_id,
|
|
2048
2082
|
product_variant_id: params.product_variant_id
|
|
2049
2083
|
});
|
|
2050
|
-
|
|
2084
|
+
_context26.prev = 1;
|
|
2051
2085
|
if (this.store.order) {
|
|
2052
|
-
|
|
2086
|
+
_context26.next = 4;
|
|
2053
2087
|
break;
|
|
2054
2088
|
}
|
|
2055
2089
|
throw new Error('order 模块未初始化');
|
|
2056
2090
|
case 4:
|
|
2057
|
-
|
|
2091
|
+
_context26.next = 6;
|
|
2058
2092
|
return this.store.order.updateProductInOrder(params);
|
|
2059
2093
|
case 6:
|
|
2060
|
-
products =
|
|
2061
|
-
|
|
2094
|
+
products = _context26.sent;
|
|
2095
|
+
_context26.next = 9;
|
|
2062
2096
|
return this.refreshItemRuleQuantityLimits();
|
|
2063
2097
|
case 9:
|
|
2064
|
-
|
|
2098
|
+
_context26.next = 11;
|
|
2065
2099
|
return this.refreshCartValidationPassed();
|
|
2066
2100
|
case 11:
|
|
2067
2101
|
this.logMethodSuccess('updateProductInOrder', {
|
|
2068
2102
|
productCount: products.length
|
|
2069
2103
|
});
|
|
2070
|
-
return
|
|
2104
|
+
return _context26.abrupt("return", products);
|
|
2071
2105
|
case 15:
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
this.logMethodError('updateProductInOrder',
|
|
2075
|
-
throw
|
|
2106
|
+
_context26.prev = 15;
|
|
2107
|
+
_context26.t0 = _context26["catch"](1);
|
|
2108
|
+
this.logMethodError('updateProductInOrder', _context26.t0);
|
|
2109
|
+
throw _context26.t0;
|
|
2076
2110
|
case 19:
|
|
2077
2111
|
case "end":
|
|
2078
|
-
return
|
|
2112
|
+
return _context26.stop();
|
|
2079
2113
|
}
|
|
2080
|
-
},
|
|
2114
|
+
}, _callee26, this, [[1, 15]]);
|
|
2081
2115
|
}));
|
|
2082
2116
|
function updateProductInOrder(_x16) {
|
|
2083
2117
|
return _updateProductInOrder.apply(this, arguments);
|
|
@@ -2087,46 +2121,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2087
2121
|
}, {
|
|
2088
2122
|
key: "removeProductFromOrder",
|
|
2089
2123
|
value: function () {
|
|
2090
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2124
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity) {
|
|
2091
2125
|
var products;
|
|
2092
|
-
return _regeneratorRuntime().wrap(function
|
|
2093
|
-
while (1) switch (
|
|
2126
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2127
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2094
2128
|
case 0:
|
|
2095
2129
|
this.logMethodStart('removeProductFromOrder', {
|
|
2096
2130
|
product_id: identity.product_id,
|
|
2097
2131
|
product_variant_id: identity.product_variant_id
|
|
2098
2132
|
});
|
|
2099
|
-
|
|
2133
|
+
_context27.prev = 1;
|
|
2100
2134
|
if (this.store.order) {
|
|
2101
|
-
|
|
2135
|
+
_context27.next = 4;
|
|
2102
2136
|
break;
|
|
2103
2137
|
}
|
|
2104
2138
|
throw new Error('order 模块未初始化');
|
|
2105
2139
|
case 4:
|
|
2106
|
-
|
|
2140
|
+
_context27.next = 6;
|
|
2107
2141
|
return this.store.order.removeProductFromOrder(identity);
|
|
2108
2142
|
case 6:
|
|
2109
|
-
products =
|
|
2110
|
-
|
|
2143
|
+
products = _context27.sent;
|
|
2144
|
+
_context27.next = 9;
|
|
2111
2145
|
return this.refreshItemRuleQuantityLimits();
|
|
2112
2146
|
case 9:
|
|
2113
|
-
|
|
2147
|
+
_context27.next = 11;
|
|
2114
2148
|
return this.refreshCartValidationPassed();
|
|
2115
2149
|
case 11:
|
|
2116
2150
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2117
2151
|
productCount: products.length
|
|
2118
2152
|
});
|
|
2119
|
-
return
|
|
2153
|
+
return _context27.abrupt("return", products);
|
|
2120
2154
|
case 15:
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
this.logMethodError('removeProductFromOrder',
|
|
2124
|
-
throw
|
|
2155
|
+
_context27.prev = 15;
|
|
2156
|
+
_context27.t0 = _context27["catch"](1);
|
|
2157
|
+
this.logMethodError('removeProductFromOrder', _context27.t0);
|
|
2158
|
+
throw _context27.t0;
|
|
2125
2159
|
case 19:
|
|
2126
2160
|
case "end":
|
|
2127
|
-
return
|
|
2161
|
+
return _context27.stop();
|
|
2128
2162
|
}
|
|
2129
|
-
},
|
|
2163
|
+
}, _callee27, this, [[1, 15]]);
|
|
2130
2164
|
}));
|
|
2131
2165
|
function removeProductFromOrder(_x17) {
|
|
2132
2166
|
return _removeProductFromOrder.apply(this, arguments);
|
|
@@ -2136,21 +2170,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2136
2170
|
}, {
|
|
2137
2171
|
key: "getProductList",
|
|
2138
2172
|
value: function () {
|
|
2139
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2173
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2140
2174
|
var result;
|
|
2141
|
-
return _regeneratorRuntime().wrap(function
|
|
2142
|
-
while (1) switch (
|
|
2175
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2176
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2143
2177
|
case 0:
|
|
2144
|
-
|
|
2145
|
-
|
|
2178
|
+
if (!this.productsLoaded) {
|
|
2179
|
+
_context28.next = 2;
|
|
2180
|
+
break;
|
|
2181
|
+
}
|
|
2182
|
+
return _context28.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
2146
2183
|
case 2:
|
|
2147
|
-
|
|
2148
|
-
return
|
|
2184
|
+
_context28.next = 4;
|
|
2185
|
+
return this.loadAllProducts();
|
|
2149
2186
|
case 4:
|
|
2187
|
+
result = _context28.sent;
|
|
2188
|
+
return _context28.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2189
|
+
case 6:
|
|
2150
2190
|
case "end":
|
|
2151
|
-
return
|
|
2191
|
+
return _context28.stop();
|
|
2152
2192
|
}
|
|
2153
|
-
},
|
|
2193
|
+
}, _callee28, this);
|
|
2154
2194
|
}));
|
|
2155
2195
|
function getProductList() {
|
|
2156
2196
|
return _getProductList.apply(this, arguments);
|
|
@@ -2160,32 +2200,49 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2160
2200
|
}, {
|
|
2161
2201
|
key: "loadOpenDataConfig",
|
|
2162
2202
|
value: function () {
|
|
2163
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2164
|
-
var
|
|
2165
|
-
|
|
2166
|
-
|
|
2203
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2204
|
+
var _this8 = this;
|
|
2205
|
+
var lastFetchedAt, cachedData;
|
|
2206
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2207
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2167
2208
|
case 0:
|
|
2168
2209
|
if (this.store.openData) {
|
|
2169
|
-
|
|
2210
|
+
_context29.next = 2;
|
|
2170
2211
|
break;
|
|
2171
2212
|
}
|
|
2172
2213
|
throw new Error('openData 模块未初始化');
|
|
2173
2214
|
case 2:
|
|
2174
|
-
|
|
2175
|
-
|
|
2215
|
+
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
2216
|
+
cachedData = this.store.openData.getOpenData();
|
|
2217
|
+
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
2218
|
+
_context29.next = 7;
|
|
2219
|
+
break;
|
|
2220
|
+
}
|
|
2221
|
+
this.otherParams.openData = cachedData;
|
|
2222
|
+
return _context29.abrupt("return", cachedData);
|
|
2223
|
+
case 7:
|
|
2224
|
+
if (!this.loadOpenDataConfigInFlight) {
|
|
2225
|
+
_context29.next = 9;
|
|
2226
|
+
break;
|
|
2227
|
+
}
|
|
2228
|
+
return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
|
|
2229
|
+
case 9:
|
|
2230
|
+
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2176
2231
|
scope: 'board',
|
|
2177
2232
|
target: 'venue_booking+online_store',
|
|
2178
2233
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2234
|
+
}).then(function (openDataConfig) {
|
|
2235
|
+
_this8.otherParams.openData = openDataConfig;
|
|
2236
|
+
return openDataConfig;
|
|
2237
|
+
}).finally(function () {
|
|
2238
|
+
_this8.loadOpenDataConfigInFlight = null;
|
|
2179
2239
|
});
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
this.otherParams.openData = openDataConfig;
|
|
2183
|
-
return _context28.abrupt("return", openDataConfig);
|
|
2184
|
-
case 7:
|
|
2240
|
+
return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
|
|
2241
|
+
case 11:
|
|
2185
2242
|
case "end":
|
|
2186
|
-
return
|
|
2243
|
+
return _context29.stop();
|
|
2187
2244
|
}
|
|
2188
|
-
},
|
|
2245
|
+
}, _callee29, this);
|
|
2189
2246
|
}));
|
|
2190
2247
|
function loadOpenDataConfig() {
|
|
2191
2248
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2195,29 +2252,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2195
2252
|
}, {
|
|
2196
2253
|
key: "loadRuntimeConfigs",
|
|
2197
2254
|
value: function () {
|
|
2198
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2255
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2199
2256
|
var itemRuleConfigs;
|
|
2200
|
-
return _regeneratorRuntime().wrap(function
|
|
2201
|
-
while (1) switch (
|
|
2257
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2258
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2202
2259
|
case 0:
|
|
2203
|
-
|
|
2260
|
+
_context30.next = 2;
|
|
2204
2261
|
return this.loadOpenDataConfig();
|
|
2205
2262
|
case 2:
|
|
2206
|
-
|
|
2263
|
+
_context30.next = 4;
|
|
2207
2264
|
return this.ensureItemRuleConfigsLoaded();
|
|
2208
2265
|
case 4:
|
|
2209
|
-
itemRuleConfigs =
|
|
2266
|
+
itemRuleConfigs = _context30.sent;
|
|
2210
2267
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2211
2268
|
itemRuleCount: itemRuleConfigs.length
|
|
2212
2269
|
});
|
|
2213
|
-
return
|
|
2270
|
+
return _context30.abrupt("return", {
|
|
2214
2271
|
itemRuleConfigs: itemRuleConfigs
|
|
2215
2272
|
});
|
|
2216
2273
|
case 7:
|
|
2217
2274
|
case "end":
|
|
2218
|
-
return
|
|
2275
|
+
return _context30.stop();
|
|
2219
2276
|
}
|
|
2220
|
-
},
|
|
2277
|
+
}, _callee30, this);
|
|
2221
2278
|
}));
|
|
2222
2279
|
function loadRuntimeConfigs() {
|
|
2223
2280
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -2227,22 +2284,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2227
2284
|
}, {
|
|
2228
2285
|
key: "fetchItemRuleConfigsByModelIds",
|
|
2229
2286
|
value: function () {
|
|
2230
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2287
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(strategyModelIds) {
|
|
2231
2288
|
var result, configs;
|
|
2232
|
-
return _regeneratorRuntime().wrap(function
|
|
2233
|
-
while (1) switch (
|
|
2289
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2290
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2234
2291
|
case 0:
|
|
2235
2292
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
2236
2293
|
strategyModelIds: strategyModelIds
|
|
2237
2294
|
});
|
|
2238
2295
|
if (strategyModelIds.length) {
|
|
2239
|
-
|
|
2296
|
+
_context31.next = 3;
|
|
2240
2297
|
break;
|
|
2241
2298
|
}
|
|
2242
|
-
return
|
|
2299
|
+
return _context31.abrupt("return", []);
|
|
2243
2300
|
case 3:
|
|
2244
|
-
|
|
2245
|
-
|
|
2301
|
+
_context31.prev = 3;
|
|
2302
|
+
_context31.next = 6;
|
|
2246
2303
|
return this.request.get('/promotion', {
|
|
2247
2304
|
skip: 1,
|
|
2248
2305
|
num: 99,
|
|
@@ -2250,7 +2307,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2250
2307
|
ids: strategyModelIds
|
|
2251
2308
|
});
|
|
2252
2309
|
case 6:
|
|
2253
|
-
result =
|
|
2310
|
+
result = _context31.sent;
|
|
2254
2311
|
configs = [];
|
|
2255
2312
|
if (result.code === 200) {
|
|
2256
2313
|
configs = result.data.list.map(function (item) {
|
|
@@ -2261,19 +2318,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2261
2318
|
strategyModelIds: strategyModelIds,
|
|
2262
2319
|
strategyCount: configs.length
|
|
2263
2320
|
});
|
|
2264
|
-
return
|
|
2321
|
+
return _context31.abrupt("return", configs);
|
|
2265
2322
|
case 13:
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
2323
|
+
_context31.prev = 13;
|
|
2324
|
+
_context31.t0 = _context31["catch"](3);
|
|
2325
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context31.t0, {
|
|
2269
2326
|
strategyModelIds: strategyModelIds
|
|
2270
2327
|
});
|
|
2271
|
-
return
|
|
2328
|
+
return _context31.abrupt("return", []);
|
|
2272
2329
|
case 17:
|
|
2273
2330
|
case "end":
|
|
2274
|
-
return
|
|
2331
|
+
return _context31.stop();
|
|
2275
2332
|
}
|
|
2276
|
-
},
|
|
2333
|
+
}, _callee31, this, [[3, 13]]);
|
|
2277
2334
|
}));
|
|
2278
2335
|
function fetchItemRuleConfigsByModelIds(_x18) {
|
|
2279
2336
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
@@ -2283,22 +2340,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2283
2340
|
}, {
|
|
2284
2341
|
key: "buildPrefillProductSourceMap",
|
|
2285
2342
|
value: function () {
|
|
2286
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2343
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2287
2344
|
var sourceMap, productList, visited, collectFromValue;
|
|
2288
|
-
return _regeneratorRuntime().wrap(function
|
|
2289
|
-
while (1) switch (
|
|
2345
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2346
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2290
2347
|
case 0:
|
|
2291
2348
|
sourceMap = new Map();
|
|
2292
|
-
|
|
2293
|
-
|
|
2349
|
+
_context32.prev = 1;
|
|
2350
|
+
_context32.next = 4;
|
|
2294
2351
|
return this.getProductList();
|
|
2295
2352
|
case 4:
|
|
2296
|
-
productList =
|
|
2353
|
+
productList = _context32.sent;
|
|
2297
2354
|
if (Array.isArray(productList)) {
|
|
2298
|
-
|
|
2355
|
+
_context32.next = 7;
|
|
2299
2356
|
break;
|
|
2300
2357
|
}
|
|
2301
|
-
return
|
|
2358
|
+
return _context32.abrupt("return", sourceMap);
|
|
2302
2359
|
case 7:
|
|
2303
2360
|
visited = new Set();
|
|
2304
2361
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -2337,19 +2394,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2337
2394
|
}
|
|
2338
2395
|
};
|
|
2339
2396
|
collectFromValue(productList);
|
|
2340
|
-
|
|
2397
|
+
_context32.next = 15;
|
|
2341
2398
|
break;
|
|
2342
2399
|
case 12:
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
2400
|
+
_context32.prev = 12;
|
|
2401
|
+
_context32.t0 = _context32["catch"](1);
|
|
2402
|
+
this.logMethodError('buildPrefillProductSourceMap', _context32.t0);
|
|
2346
2403
|
case 15:
|
|
2347
|
-
return
|
|
2404
|
+
return _context32.abrupt("return", sourceMap);
|
|
2348
2405
|
case 16:
|
|
2349
2406
|
case "end":
|
|
2350
|
-
return
|
|
2407
|
+
return _context32.stop();
|
|
2351
2408
|
}
|
|
2352
|
-
},
|
|
2409
|
+
}, _callee32, this, [[1, 12]]);
|
|
2353
2410
|
}));
|
|
2354
2411
|
function buildPrefillProductSourceMap() {
|
|
2355
2412
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -2364,56 +2421,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2364
2421
|
}, {
|
|
2365
2422
|
key: "ensureItemRuleConfigsLoaded",
|
|
2366
2423
|
value: function () {
|
|
2367
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2368
|
-
var
|
|
2369
|
-
return _regeneratorRuntime().wrap(function
|
|
2370
|
-
while (1) switch (
|
|
2424
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2425
|
+
var _this9 = this;
|
|
2426
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2427
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2371
2428
|
case 0:
|
|
2372
2429
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
2373
|
-
|
|
2430
|
+
_context34.next = 2;
|
|
2374
2431
|
break;
|
|
2375
2432
|
}
|
|
2376
|
-
return
|
|
2433
|
+
return _context34.abrupt("return", this.itemRuleConfigs);
|
|
2377
2434
|
case 2:
|
|
2378
2435
|
if (!this.itemRuleConfigsPromise) {
|
|
2379
|
-
|
|
2436
|
+
_context34.next = 4;
|
|
2380
2437
|
break;
|
|
2381
2438
|
}
|
|
2382
|
-
return
|
|
2439
|
+
return _context34.abrupt("return", this.itemRuleConfigsPromise);
|
|
2383
2440
|
case 4:
|
|
2384
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2441
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2385
2442
|
var runtimeConfig, staticConfigs;
|
|
2386
|
-
return _regeneratorRuntime().wrap(function
|
|
2387
|
-
while (1) switch (
|
|
2443
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2444
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2388
2445
|
case 0:
|
|
2389
|
-
runtimeConfig =
|
|
2446
|
+
runtimeConfig = _this9.getItemRuleRuntimeConfig();
|
|
2390
2447
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
2391
2448
|
if (!(staticConfigs.length > 0)) {
|
|
2392
|
-
|
|
2449
|
+
_context33.next = 6;
|
|
2393
2450
|
break;
|
|
2394
2451
|
}
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
return
|
|
2452
|
+
_this9.itemRuleConfigs = staticConfigs;
|
|
2453
|
+
_this9.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2454
|
+
return _context33.abrupt("return", _this9.itemRuleConfigs);
|
|
2398
2455
|
case 6:
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
return
|
|
2456
|
+
_this9.itemRuleConfigs = [];
|
|
2457
|
+
_this9.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2458
|
+
return _context33.abrupt("return", _this9.itemRuleConfigs);
|
|
2402
2459
|
case 9:
|
|
2403
2460
|
case "end":
|
|
2404
|
-
return
|
|
2461
|
+
return _context33.stop();
|
|
2405
2462
|
}
|
|
2406
|
-
},
|
|
2463
|
+
}, _callee33);
|
|
2407
2464
|
}))();
|
|
2408
|
-
|
|
2465
|
+
_context34.next = 7;
|
|
2409
2466
|
return this.itemRuleConfigsPromise;
|
|
2410
2467
|
case 7:
|
|
2411
|
-
return
|
|
2468
|
+
return _context34.abrupt("return", _context34.sent);
|
|
2412
2469
|
case 8:
|
|
2413
2470
|
case "end":
|
|
2414
|
-
return
|
|
2471
|
+
return _context34.stop();
|
|
2415
2472
|
}
|
|
2416
|
-
},
|
|
2473
|
+
}, _callee34, this);
|
|
2417
2474
|
}));
|
|
2418
2475
|
function ensureItemRuleConfigsLoaded() {
|
|
2419
2476
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -2423,22 +2480,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2423
2480
|
}, {
|
|
2424
2481
|
key: "refreshItemRuleQuantityLimits",
|
|
2425
2482
|
value: function () {
|
|
2426
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2483
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2427
2484
|
var strategyConfigs, businessData, limits;
|
|
2428
|
-
return _regeneratorRuntime().wrap(function
|
|
2429
|
-
while (1) switch (
|
|
2485
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2486
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2430
2487
|
case 0:
|
|
2431
|
-
|
|
2432
|
-
|
|
2488
|
+
_context35.prev = 0;
|
|
2489
|
+
_context35.next = 3;
|
|
2433
2490
|
return this.ensureItemRuleConfigsLoaded();
|
|
2434
2491
|
case 3:
|
|
2435
|
-
strategyConfigs =
|
|
2492
|
+
strategyConfigs = _context35.sent;
|
|
2436
2493
|
if (strategyConfigs.length) {
|
|
2437
|
-
|
|
2494
|
+
_context35.next = 7;
|
|
2438
2495
|
break;
|
|
2439
2496
|
}
|
|
2440
2497
|
this.store.itemRuleQuantityLimits = [];
|
|
2441
|
-
return
|
|
2498
|
+
return _context35.abrupt("return", []);
|
|
2442
2499
|
case 7:
|
|
2443
2500
|
businessData = buildItemRuleBusinessData({
|
|
2444
2501
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -2450,18 +2507,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2450
2507
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
2451
2508
|
limitCount: limits.length
|
|
2452
2509
|
});
|
|
2453
|
-
return
|
|
2510
|
+
return _context35.abrupt("return", limits);
|
|
2454
2511
|
case 14:
|
|
2455
|
-
|
|
2456
|
-
|
|
2512
|
+
_context35.prev = 14;
|
|
2513
|
+
_context35.t0 = _context35["catch"](0);
|
|
2457
2514
|
this.store.itemRuleQuantityLimits = [];
|
|
2458
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
2459
|
-
return
|
|
2515
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context35.t0);
|
|
2516
|
+
return _context35.abrupt("return", []);
|
|
2460
2517
|
case 19:
|
|
2461
2518
|
case "end":
|
|
2462
|
-
return
|
|
2519
|
+
return _context35.stop();
|
|
2463
2520
|
}
|
|
2464
|
-
},
|
|
2521
|
+
}, _callee35, this, [[0, 14]]);
|
|
2465
2522
|
}));
|
|
2466
2523
|
function refreshItemRuleQuantityLimits() {
|
|
2467
2524
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -2471,32 +2528,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2471
2528
|
}, {
|
|
2472
2529
|
key: "applyPrefillByItemRule",
|
|
2473
2530
|
value: function () {
|
|
2474
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2531
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2475
2532
|
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator10, _step10, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _ref5, _sourceItem$original_, _ref6, _sourceItem$payment_p, sellingPrice, originalPrice, paymentPrice, targetProduct, existedQuantity, delta, nextProduct;
|
|
2476
|
-
return _regeneratorRuntime().wrap(function
|
|
2477
|
-
while (1) switch (
|
|
2533
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2534
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2478
2535
|
case 0:
|
|
2479
2536
|
if (!this.itemRulePrefillApplied) {
|
|
2480
|
-
|
|
2537
|
+
_context36.next = 2;
|
|
2481
2538
|
break;
|
|
2482
2539
|
}
|
|
2483
|
-
return
|
|
2540
|
+
return _context36.abrupt("return");
|
|
2484
2541
|
case 2:
|
|
2485
2542
|
if (this.store.order) {
|
|
2486
|
-
|
|
2543
|
+
_context36.next = 4;
|
|
2487
2544
|
break;
|
|
2488
2545
|
}
|
|
2489
|
-
return
|
|
2546
|
+
return _context36.abrupt("return");
|
|
2490
2547
|
case 4:
|
|
2491
|
-
|
|
2548
|
+
_context36.next = 6;
|
|
2492
2549
|
return this.ensureItemRuleConfigsLoaded();
|
|
2493
2550
|
case 6:
|
|
2494
|
-
strategyConfigs =
|
|
2551
|
+
strategyConfigs = _context36.sent;
|
|
2495
2552
|
if (strategyConfigs.length) {
|
|
2496
|
-
|
|
2553
|
+
_context36.next = 9;
|
|
2497
2554
|
break;
|
|
2498
2555
|
}
|
|
2499
|
-
return
|
|
2556
|
+
return _context36.abrupt("return");
|
|
2500
2557
|
case 9:
|
|
2501
2558
|
businessData = buildItemRuleBusinessData({
|
|
2502
2559
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -2505,24 +2562,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2505
2562
|
});
|
|
2506
2563
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
2507
2564
|
if (prefillItems.length) {
|
|
2508
|
-
|
|
2565
|
+
_context36.next = 14;
|
|
2509
2566
|
break;
|
|
2510
2567
|
}
|
|
2511
2568
|
this.itemRulePrefillApplied = true;
|
|
2512
|
-
return
|
|
2569
|
+
return _context36.abrupt("return");
|
|
2513
2570
|
case 14:
|
|
2514
|
-
|
|
2571
|
+
_context36.next = 16;
|
|
2515
2572
|
return this.buildPrefillProductSourceMap();
|
|
2516
2573
|
case 16:
|
|
2517
|
-
productSourceMap =
|
|
2574
|
+
productSourceMap = _context36.sent;
|
|
2518
2575
|
tempOrder = this.ensureTempOrder();
|
|
2519
2576
|
hasChanges = false;
|
|
2520
2577
|
_iterator10 = _createForOfIteratorHelper(prefillItems);
|
|
2521
|
-
|
|
2578
|
+
_context36.prev = 20;
|
|
2522
2579
|
_iterator10.s();
|
|
2523
2580
|
case 22:
|
|
2524
2581
|
if ((_step10 = _iterator10.n()).done) {
|
|
2525
|
-
|
|
2582
|
+
_context36.next = 47;
|
|
2526
2583
|
break;
|
|
2527
2584
|
}
|
|
2528
2585
|
prefillItem = _step10.value;
|
|
@@ -2530,16 +2587,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2530
2587
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
2531
2588
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
2532
2589
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
2533
|
-
|
|
2590
|
+
_context36.next = 29;
|
|
2534
2591
|
break;
|
|
2535
2592
|
}
|
|
2536
|
-
return
|
|
2593
|
+
return _context36.abrupt("continue", 45);
|
|
2537
2594
|
case 29:
|
|
2538
2595
|
if (!Number.isNaN(productVariantId)) {
|
|
2539
|
-
|
|
2596
|
+
_context36.next = 31;
|
|
2540
2597
|
break;
|
|
2541
2598
|
}
|
|
2542
|
-
return
|
|
2599
|
+
return _context36.abrupt("continue", 45);
|
|
2543
2600
|
case 31:
|
|
2544
2601
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
2545
2602
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -2547,7 +2604,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2547
2604
|
product_variant_id: productVariantId
|
|
2548
2605
|
});
|
|
2549
2606
|
if (!(productIndex === -1)) {
|
|
2550
|
-
|
|
2607
|
+
_context36.next = 40;
|
|
2551
2608
|
break;
|
|
2552
2609
|
}
|
|
2553
2610
|
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');
|
|
@@ -2570,7 +2627,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2570
2627
|
})
|
|
2571
2628
|
}));
|
|
2572
2629
|
hasChanges = true;
|
|
2573
|
-
return
|
|
2630
|
+
return _context36.abrupt("continue", 45);
|
|
2574
2631
|
case 40:
|
|
2575
2632
|
targetProduct = tempOrder.products[productIndex];
|
|
2576
2633
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
@@ -2589,32 +2646,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2589
2646
|
hasChanges = true;
|
|
2590
2647
|
}
|
|
2591
2648
|
case 45:
|
|
2592
|
-
|
|
2649
|
+
_context36.next = 22;
|
|
2593
2650
|
break;
|
|
2594
2651
|
case 47:
|
|
2595
|
-
|
|
2652
|
+
_context36.next = 52;
|
|
2596
2653
|
break;
|
|
2597
2654
|
case 49:
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
_iterator10.e(
|
|
2655
|
+
_context36.prev = 49;
|
|
2656
|
+
_context36.t0 = _context36["catch"](20);
|
|
2657
|
+
_iterator10.e(_context36.t0);
|
|
2601
2658
|
case 52:
|
|
2602
|
-
|
|
2659
|
+
_context36.prev = 52;
|
|
2603
2660
|
_iterator10.f();
|
|
2604
|
-
return
|
|
2661
|
+
return _context36.finish(52);
|
|
2605
2662
|
case 55:
|
|
2606
2663
|
if (!hasChanges) {
|
|
2607
|
-
|
|
2664
|
+
_context36.next = 59;
|
|
2608
2665
|
break;
|
|
2609
2666
|
}
|
|
2610
|
-
|
|
2667
|
+
_context36.next = 58;
|
|
2611
2668
|
return this.store.order.recalculateSummary({
|
|
2612
2669
|
createIfMissing: true
|
|
2613
2670
|
});
|
|
2614
2671
|
case 58:
|
|
2615
2672
|
this.store.order.persistTempOrder();
|
|
2616
2673
|
case 59:
|
|
2617
|
-
|
|
2674
|
+
_context36.next = 61;
|
|
2618
2675
|
return this.refreshItemRuleQuantityLimits();
|
|
2619
2676
|
case 61:
|
|
2620
2677
|
this.itemRulePrefillApplied = true;
|
|
@@ -2624,9 +2681,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2624
2681
|
});
|
|
2625
2682
|
case 63:
|
|
2626
2683
|
case "end":
|
|
2627
|
-
return
|
|
2684
|
+
return _context36.stop();
|
|
2628
2685
|
}
|
|
2629
|
-
},
|
|
2686
|
+
}, _callee36, this, [[20, 49, 52, 55]]);
|
|
2630
2687
|
}));
|
|
2631
2688
|
function applyPrefillByItemRule() {
|
|
2632
2689
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -2636,24 +2693,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2636
2693
|
}, {
|
|
2637
2694
|
key: "applyItemRulePrefill",
|
|
2638
2695
|
value: function () {
|
|
2639
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2640
|
-
return _regeneratorRuntime().wrap(function
|
|
2641
|
-
while (1) switch (
|
|
2696
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
2697
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2698
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2642
2699
|
case 0:
|
|
2643
2700
|
this.logMethodStart('applyItemRulePrefill');
|
|
2644
|
-
|
|
2701
|
+
_context37.next = 3;
|
|
2645
2702
|
return this.applyPrefillByItemRule();
|
|
2646
2703
|
case 3:
|
|
2647
|
-
|
|
2704
|
+
_context37.next = 5;
|
|
2648
2705
|
return this.refreshItemRuleQuantityLimits();
|
|
2649
2706
|
case 5:
|
|
2650
|
-
|
|
2707
|
+
_context37.next = 7;
|
|
2651
2708
|
return this.refreshCartValidationPassed();
|
|
2652
2709
|
case 7:
|
|
2653
2710
|
case "end":
|
|
2654
|
-
return
|
|
2711
|
+
return _context37.stop();
|
|
2655
2712
|
}
|
|
2656
|
-
},
|
|
2713
|
+
}, _callee37, this);
|
|
2657
2714
|
}));
|
|
2658
2715
|
function applyItemRulePrefill() {
|
|
2659
2716
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -2663,20 +2720,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2663
2720
|
}, {
|
|
2664
2721
|
key: "evaluateCartValidationByItemRule",
|
|
2665
2722
|
value: function () {
|
|
2666
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2723
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
2667
2724
|
var strategyConfigs, businessData;
|
|
2668
|
-
return _regeneratorRuntime().wrap(function
|
|
2669
|
-
while (1) switch (
|
|
2725
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2726
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2670
2727
|
case 0:
|
|
2671
|
-
|
|
2728
|
+
_context38.next = 2;
|
|
2672
2729
|
return this.ensureItemRuleConfigsLoaded();
|
|
2673
2730
|
case 2:
|
|
2674
|
-
strategyConfigs =
|
|
2731
|
+
strategyConfigs = _context38.sent;
|
|
2675
2732
|
if (strategyConfigs.length) {
|
|
2676
|
-
|
|
2733
|
+
_context38.next = 5;
|
|
2677
2734
|
break;
|
|
2678
2735
|
}
|
|
2679
|
-
return
|
|
2736
|
+
return _context38.abrupt("return", {
|
|
2680
2737
|
passed: true,
|
|
2681
2738
|
failures: []
|
|
2682
2739
|
});
|
|
@@ -2686,12 +2743,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2686
2743
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2687
2744
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2688
2745
|
});
|
|
2689
|
-
return
|
|
2746
|
+
return _context38.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
2690
2747
|
case 7:
|
|
2691
2748
|
case "end":
|
|
2692
|
-
return
|
|
2749
|
+
return _context38.stop();
|
|
2693
2750
|
}
|
|
2694
|
-
},
|
|
2751
|
+
}, _callee38, this);
|
|
2695
2752
|
}));
|
|
2696
2753
|
function evaluateCartValidationByItemRule() {
|
|
2697
2754
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -2701,20 +2758,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2701
2758
|
}, {
|
|
2702
2759
|
key: "validateBeforeSubmitByItemRule",
|
|
2703
2760
|
value: function () {
|
|
2704
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2761
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
2705
2762
|
var validationResult, firstFailure, errorMessage, error;
|
|
2706
|
-
return _regeneratorRuntime().wrap(function
|
|
2707
|
-
while (1) switch (
|
|
2763
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
2764
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2708
2765
|
case 0:
|
|
2709
|
-
|
|
2766
|
+
_context39.next = 2;
|
|
2710
2767
|
return this.evaluateCartValidationByItemRule();
|
|
2711
2768
|
case 2:
|
|
2712
|
-
validationResult =
|
|
2769
|
+
validationResult = _context39.sent;
|
|
2713
2770
|
if (!validationResult.passed) {
|
|
2714
|
-
|
|
2771
|
+
_context39.next = 5;
|
|
2715
2772
|
break;
|
|
2716
2773
|
}
|
|
2717
|
-
return
|
|
2774
|
+
return _context39.abrupt("return");
|
|
2718
2775
|
case 5:
|
|
2719
2776
|
firstFailure = validationResult.failures[0];
|
|
2720
2777
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -2723,9 +2780,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2723
2780
|
throw error;
|
|
2724
2781
|
case 10:
|
|
2725
2782
|
case "end":
|
|
2726
|
-
return
|
|
2783
|
+
return _context39.stop();
|
|
2727
2784
|
}
|
|
2728
|
-
},
|
|
2785
|
+
}, _callee39, this);
|
|
2729
2786
|
}));
|
|
2730
2787
|
function validateBeforeSubmitByItemRule() {
|
|
2731
2788
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -2735,10 +2792,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2735
2792
|
}, {
|
|
2736
2793
|
key: "refreshCartValidationPassed",
|
|
2737
2794
|
value: function () {
|
|
2738
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2795
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
2739
2796
|
var previous, nextState, validationResult, changed;
|
|
2740
|
-
return _regeneratorRuntime().wrap(function
|
|
2741
|
-
while (1) switch (
|
|
2797
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
2798
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2742
2799
|
case 0:
|
|
2743
2800
|
previous = this.store.cartValidation || {
|
|
2744
2801
|
passed: null,
|
|
@@ -2748,20 +2805,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2748
2805
|
passed: null,
|
|
2749
2806
|
failures: []
|
|
2750
2807
|
};
|
|
2751
|
-
|
|
2752
|
-
|
|
2808
|
+
_context40.prev = 2;
|
|
2809
|
+
_context40.next = 5;
|
|
2753
2810
|
return this.evaluateCartValidationByItemRule();
|
|
2754
2811
|
case 5:
|
|
2755
|
-
validationResult =
|
|
2812
|
+
validationResult = _context40.sent;
|
|
2756
2813
|
nextState = {
|
|
2757
2814
|
passed: validationResult.passed,
|
|
2758
2815
|
failures: validationResult.failures || []
|
|
2759
2816
|
};
|
|
2760
|
-
|
|
2817
|
+
_context40.next = 12;
|
|
2761
2818
|
break;
|
|
2762
2819
|
case 9:
|
|
2763
|
-
|
|
2764
|
-
|
|
2820
|
+
_context40.prev = 9;
|
|
2821
|
+
_context40.t0 = _context40["catch"](2);
|
|
2765
2822
|
nextState = {
|
|
2766
2823
|
passed: false,
|
|
2767
2824
|
failures: []
|
|
@@ -2770,21 +2827,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2770
2827
|
this.store.cartValidation = nextState;
|
|
2771
2828
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
2772
2829
|
if (!changed) {
|
|
2773
|
-
|
|
2830
|
+
_context40.next = 17;
|
|
2774
2831
|
break;
|
|
2775
2832
|
}
|
|
2776
|
-
|
|
2833
|
+
_context40.next = 17;
|
|
2777
2834
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
2778
2835
|
cartValidation: nextState,
|
|
2779
2836
|
cartValidationPassed: nextState.passed
|
|
2780
2837
|
});
|
|
2781
2838
|
case 17:
|
|
2782
|
-
return
|
|
2839
|
+
return _context40.abrupt("return", nextState.passed);
|
|
2783
2840
|
case 18:
|
|
2784
2841
|
case "end":
|
|
2785
|
-
return
|
|
2842
|
+
return _context40.stop();
|
|
2786
2843
|
}
|
|
2787
|
-
},
|
|
2844
|
+
}, _callee40, this, [[2, 9]]);
|
|
2788
2845
|
}));
|
|
2789
2846
|
function refreshCartValidationPassed() {
|
|
2790
2847
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -2794,14 +2851,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2794
2851
|
}, {
|
|
2795
2852
|
key: "setItemRuleRuntimeConfig",
|
|
2796
2853
|
value: function () {
|
|
2797
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2854
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
2798
2855
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
2799
2856
|
var config,
|
|
2800
|
-
|
|
2801
|
-
return _regeneratorRuntime().wrap(function
|
|
2802
|
-
while (1) switch (
|
|
2857
|
+
_args41 = arguments;
|
|
2858
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
2859
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2803
2860
|
case 0:
|
|
2804
|
-
config =
|
|
2861
|
+
config = _args41.length > 0 && _args41[0] !== undefined ? _args41[0] : {};
|
|
2805
2862
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
2806
2863
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
2807
2864
|
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) || {}),
|
|
@@ -2813,10 +2870,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2813
2870
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2814
2871
|
}
|
|
2815
2872
|
this.itemRulePrefillApplied = false;
|
|
2816
|
-
|
|
2873
|
+
_context41.next = 7;
|
|
2817
2874
|
return this.refreshItemRuleQuantityLimits();
|
|
2818
2875
|
case 7:
|
|
2819
|
-
|
|
2876
|
+
_context41.next = 9;
|
|
2820
2877
|
return this.refreshCartValidationPassed();
|
|
2821
2878
|
case 9:
|
|
2822
2879
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -2824,9 +2881,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2824
2881
|
});
|
|
2825
2882
|
case 10:
|
|
2826
2883
|
case "end":
|
|
2827
|
-
return
|
|
2884
|
+
return _context41.stop();
|
|
2828
2885
|
}
|
|
2829
|
-
},
|
|
2886
|
+
}, _callee41, this);
|
|
2830
2887
|
}));
|
|
2831
2888
|
function setItemRuleRuntimeConfig() {
|
|
2832
2889
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -2843,25 +2900,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2843
2900
|
}, {
|
|
2844
2901
|
key: "checkOpenDataAvailability",
|
|
2845
2902
|
value: function () {
|
|
2846
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2847
|
-
return _regeneratorRuntime().wrap(function
|
|
2848
|
-
while (1) switch (
|
|
2903
|
+
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
2904
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
2905
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
2849
2906
|
case 0:
|
|
2850
2907
|
if (this.store.openData) {
|
|
2851
|
-
|
|
2908
|
+
_context42.next = 2;
|
|
2852
2909
|
break;
|
|
2853
2910
|
}
|
|
2854
2911
|
throw new Error('openData 模块未初始化');
|
|
2855
2912
|
case 2:
|
|
2856
|
-
|
|
2913
|
+
_context42.next = 4;
|
|
2857
2914
|
return this.loadOpenDataConfig();
|
|
2858
2915
|
case 4:
|
|
2859
|
-
return
|
|
2916
|
+
return _context42.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
2860
2917
|
case 5:
|
|
2861
2918
|
case "end":
|
|
2862
|
-
return
|
|
2919
|
+
return _context42.stop();
|
|
2863
2920
|
}
|
|
2864
|
-
},
|
|
2921
|
+
}, _callee42, this);
|
|
2865
2922
|
}));
|
|
2866
2923
|
function checkOpenDataAvailability() {
|
|
2867
2924
|
return _checkOpenDataAvailability.apply(this, arguments);
|
|
@@ -2870,4 +2927,5 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2870
2927
|
}()
|
|
2871
2928
|
}]);
|
|
2872
2929
|
return VenueBookingImpl;
|
|
2873
|
-
}(BaseModule);
|
|
2930
|
+
}(BaseModule);
|
|
2931
|
+
_defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
|