@pisell/pisellos 0.0.492 → 0.0.494
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -0
- package/dist/modules/Order/index.d.ts +5 -0
- package/dist/modules/Order/index.js +70 -5
- package/dist/modules/Order/utils.js +12 -2
- package/dist/modules/Quotation/index.d.ts +8 -0
- package/dist/modules/Quotation/index.js +46 -13
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/solution/BookingByStep/index.js +44 -42
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/ScanOrder/utils.js +22 -3
- package/dist/solution/VenueBooking/index.d.ts +8 -9
- package/dist/solution/VenueBooking/index.js +612 -565
- package/dist/solution/VenueBooking/types.d.ts +7 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +13 -2
- package/dist/solution/VenueBooking/utils/slotMerge.js +92 -15
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Cart/utils/cartProduct.js +1 -0
- package/lib/modules/Order/index.d.ts +5 -0
- package/lib/modules/Order/index.js +37 -1
- package/lib/modules/Order/utils.js +13 -0
- package/lib/modules/Quotation/index.d.ts +8 -0
- package/lib/modules/Quotation/index.js +27 -6
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/solution/BookingByStep/index.js +4 -2
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/ScanOrder/utils.js +20 -3
- package/lib/solution/VenueBooking/index.d.ts +8 -9
- package/lib/solution/VenueBooking/index.js +79 -69
- package/lib/solution/VenueBooking/types.d.ts +7 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +13 -2
- package/lib/solution/VenueBooking/utils/slotMerge.js +67 -13
- package/package.json +1 -1
|
@@ -43,8 +43,9 @@ import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
|
43
43
|
import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
|
|
44
44
|
import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
|
|
45
45
|
import { buildDateRangeSummary } from "./utils/dateSummary";
|
|
46
|
-
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry } from "./utils/slotMerge";
|
|
46
|
+
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildPriceBreakdown } from "./utils/slotMerge";
|
|
47
47
|
import { createUuidV4 } from "../../modules/Order/utils";
|
|
48
|
+
import { OrderModule } from "../../modules/Order";
|
|
48
49
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
49
50
|
export * from "./types";
|
|
50
51
|
var OPEN_DATA_SECTION_CODES = ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow'];
|
|
@@ -584,23 +585,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
584
585
|
_context6.next = 55;
|
|
585
586
|
return this.loadRuntimeConfigs();
|
|
586
587
|
case 55:
|
|
587
|
-
|
|
588
|
+
if (!this.store.schedule) {
|
|
589
|
+
_context6.next = 59;
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
_context6.next = 58;
|
|
593
|
+
return this.store.schedule.loadAllSchedule();
|
|
594
|
+
case 58:
|
|
595
|
+
this.injectScheduleResolverToQuotation();
|
|
596
|
+
case 59:
|
|
597
|
+
_context6.next = 61;
|
|
588
598
|
return this.refreshItemRuleQuantityLimits();
|
|
589
|
-
case
|
|
599
|
+
case 61:
|
|
590
600
|
this.store.status = 'ready';
|
|
591
601
|
console.log('[VenueBooking] 初始化完成');
|
|
592
|
-
_context6.next =
|
|
602
|
+
_context6.next = 65;
|
|
593
603
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
594
604
|
status: this.store.status
|
|
595
605
|
});
|
|
596
|
-
case
|
|
606
|
+
case 65:
|
|
597
607
|
this.logMethodSuccess('initialize', {
|
|
598
608
|
status: this.store.status
|
|
599
609
|
});
|
|
600
|
-
_context6.next =
|
|
610
|
+
_context6.next = 75;
|
|
601
611
|
break;
|
|
602
|
-
case
|
|
603
|
-
_context6.prev =
|
|
612
|
+
case 68:
|
|
613
|
+
_context6.prev = 68;
|
|
604
614
|
_context6.t0 = _context6["catch"](49);
|
|
605
615
|
this.store.status = 'error';
|
|
606
616
|
this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : '初始化失败';
|
|
@@ -609,11 +619,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
609
619
|
status: this.store.status
|
|
610
620
|
});
|
|
611
621
|
throw _context6.t0;
|
|
612
|
-
case
|
|
622
|
+
case 75:
|
|
613
623
|
case "end":
|
|
614
624
|
return _context6.stop();
|
|
615
625
|
}
|
|
616
|
-
}, _callee6, this, [[49,
|
|
626
|
+
}, _callee6, this, [[49, 68]]);
|
|
617
627
|
}));
|
|
618
628
|
function initialize(_x5) {
|
|
619
629
|
return _initialize.apply(this, arguments);
|
|
@@ -756,16 +766,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
756
766
|
|
|
757
767
|
// ─── 场地商品 & 附加商品 ───
|
|
758
768
|
}, {
|
|
759
|
-
key: "
|
|
769
|
+
key: "loadAllProducts",
|
|
760
770
|
value: function () {
|
|
761
|
-
var
|
|
762
|
-
var
|
|
771
|
+
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
772
|
+
var _this$otherParams6, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
|
|
763
773
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
764
774
|
while (1) switch (_context10.prev = _context10.next) {
|
|
765
775
|
case 0:
|
|
766
|
-
this.logMethodStart('
|
|
767
|
-
productIds: params.productIds
|
|
768
|
-
});
|
|
776
|
+
this.logMethodStart('loadAllProducts');
|
|
769
777
|
_context10.prev = 1;
|
|
770
778
|
if (this.store.venueProducts) {
|
|
771
779
|
_context10.next = 4;
|
|
@@ -773,82 +781,116 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
773
781
|
}
|
|
774
782
|
throw new Error('venueProducts 模块未初始化');
|
|
775
783
|
case 4:
|
|
776
|
-
|
|
784
|
+
if (this.store.addonProducts) {
|
|
785
|
+
_context10.next = 6;
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
throw new Error('addonProducts 模块未初始化');
|
|
789
|
+
case 6:
|
|
790
|
+
associatedMenus = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 || (_this$otherParams6 = _this$otherParams6.dineInConfig) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6['menu.associated_menus']) || [];
|
|
791
|
+
if (associatedMenus.length) {
|
|
792
|
+
_context10.next = 9;
|
|
793
|
+
break;
|
|
794
|
+
}
|
|
795
|
+
throw new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置');
|
|
796
|
+
case 9:
|
|
797
|
+
menuListIds = associatedMenus.map(function (n) {
|
|
798
|
+
return Number(n.value);
|
|
799
|
+
});
|
|
800
|
+
_context10.next = 12;
|
|
777
801
|
return this.store.venueProducts.loadProducts({
|
|
778
|
-
|
|
802
|
+
menu_list_ids: menuListIds,
|
|
779
803
|
cacheId: this.cacheId,
|
|
780
804
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
781
805
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
782
806
|
});
|
|
783
|
-
case
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
807
|
+
case 12:
|
|
808
|
+
allProducts = _context10.sent;
|
|
809
|
+
list = Array.isArray(allProducts) ? allProducts : [];
|
|
810
|
+
venueList = list.filter(function (p) {
|
|
811
|
+
return p.duration != null;
|
|
812
|
+
});
|
|
813
|
+
addonList = list.filter(function (p) {
|
|
814
|
+
return p.duration == null;
|
|
815
|
+
});
|
|
816
|
+
venueStore = (_this$store$venueProd = this.store.venueProducts) === null || _this$store$venueProd === void 0 ? void 0 : _this$store$venueProd.store;
|
|
817
|
+
if (venueStore) {
|
|
818
|
+
venueStore.list = venueList.slice().sort(function (a, b) {
|
|
819
|
+
return Number(b.sort) - Number(a.sort);
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
this.store.addonProducts.addProduct(addonList);
|
|
823
|
+
this.resourceProductMap = buildResourceProductMap(venueList);
|
|
824
|
+
this.logMethodSuccess('loadAllProducts', {
|
|
825
|
+
total: list.length,
|
|
826
|
+
venueCount: venueList.length,
|
|
827
|
+
addonCount: addonList.length,
|
|
789
828
|
resourceCount: this.resourceProductMap.size
|
|
790
829
|
});
|
|
791
|
-
return _context10.abrupt("return",
|
|
792
|
-
|
|
793
|
-
|
|
830
|
+
return _context10.abrupt("return", {
|
|
831
|
+
venueProducts: venueList,
|
|
832
|
+
addonProducts: addonList
|
|
833
|
+
});
|
|
834
|
+
case 24:
|
|
835
|
+
_context10.prev = 24;
|
|
794
836
|
_context10.t0 = _context10["catch"](1);
|
|
795
|
-
this.logMethodError('
|
|
837
|
+
this.logMethodError('loadAllProducts', _context10.t0);
|
|
796
838
|
throw _context10.t0;
|
|
797
|
-
case
|
|
839
|
+
case 28:
|
|
798
840
|
case "end":
|
|
799
841
|
return _context10.stop();
|
|
800
842
|
}
|
|
801
|
-
}, _callee10, this, [[1,
|
|
843
|
+
}, _callee10, this, [[1, 24]]);
|
|
802
844
|
}));
|
|
803
|
-
function
|
|
804
|
-
return
|
|
845
|
+
function loadAllProducts() {
|
|
846
|
+
return _loadAllProducts.apply(this, arguments);
|
|
805
847
|
}
|
|
806
|
-
return
|
|
848
|
+
return loadAllProducts;
|
|
807
849
|
}()
|
|
808
850
|
}, {
|
|
809
|
-
key: "
|
|
851
|
+
key: "loadVenueProducts",
|
|
810
852
|
value: function () {
|
|
811
|
-
var
|
|
812
|
-
var
|
|
853
|
+
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
854
|
+
var result;
|
|
813
855
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
814
856
|
while (1) switch (_context11.prev = _context11.next) {
|
|
815
857
|
case 0:
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
}
|
|
822
|
-
throw new Error('addonProducts 模块未初始化');
|
|
858
|
+
_context11.next = 2;
|
|
859
|
+
return this.loadAllProducts();
|
|
860
|
+
case 2:
|
|
861
|
+
result = _context11.sent;
|
|
862
|
+
return _context11.abrupt("return", result.venueProducts);
|
|
823
863
|
case 4:
|
|
824
|
-
_context11.next = 6;
|
|
825
|
-
return this.store.addonProducts.loadProducts({
|
|
826
|
-
category_ids: params.categoryIds || [],
|
|
827
|
-
product_ids: params.productIds || [],
|
|
828
|
-
collection: (params.collectionIds || []).map(String),
|
|
829
|
-
cacheId: this.cacheId,
|
|
830
|
-
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
831
|
-
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
832
|
-
});
|
|
833
|
-
case 6:
|
|
834
|
-
res = _context11.sent;
|
|
835
|
-
products = Array.isArray(res) ? res : [];
|
|
836
|
-
this.logMethodSuccess('loadAddonProducts', {
|
|
837
|
-
productCount: products.length
|
|
838
|
-
});
|
|
839
|
-
return _context11.abrupt("return", products);
|
|
840
|
-
case 12:
|
|
841
|
-
_context11.prev = 12;
|
|
842
|
-
_context11.t0 = _context11["catch"](1);
|
|
843
|
-
this.logMethodError('loadAddonProducts', _context11.t0);
|
|
844
|
-
throw _context11.t0;
|
|
845
|
-
case 16:
|
|
846
864
|
case "end":
|
|
847
865
|
return _context11.stop();
|
|
848
866
|
}
|
|
849
|
-
}, _callee11, this
|
|
867
|
+
}, _callee11, this);
|
|
868
|
+
}));
|
|
869
|
+
function loadVenueProducts() {
|
|
870
|
+
return _loadVenueProducts.apply(this, arguments);
|
|
871
|
+
}
|
|
872
|
+
return loadVenueProducts;
|
|
873
|
+
}()
|
|
874
|
+
}, {
|
|
875
|
+
key: "loadAddonProducts",
|
|
876
|
+
value: function () {
|
|
877
|
+
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
878
|
+
var result;
|
|
879
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
880
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
881
|
+
case 0:
|
|
882
|
+
_context12.next = 2;
|
|
883
|
+
return this.loadAllProducts();
|
|
884
|
+
case 2:
|
|
885
|
+
result = _context12.sent;
|
|
886
|
+
return _context12.abrupt("return", result.addonProducts);
|
|
887
|
+
case 4:
|
|
888
|
+
case "end":
|
|
889
|
+
return _context12.stop();
|
|
890
|
+
}
|
|
891
|
+
}, _callee12, this);
|
|
850
892
|
}));
|
|
851
|
-
function loadAddonProducts(
|
|
893
|
+
function loadAddonProducts() {
|
|
852
894
|
return _loadAddonProducts.apply(this, arguments);
|
|
853
895
|
}
|
|
854
896
|
return loadAddonProducts;
|
|
@@ -856,8 +898,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
856
898
|
}, {
|
|
857
899
|
key: "getVenueProducts",
|
|
858
900
|
value: function getVenueProducts() {
|
|
859
|
-
var _this$store$
|
|
860
|
-
return ((_this$store$
|
|
901
|
+
var _this$store$venueProd2;
|
|
902
|
+
return ((_this$store$venueProd2 = this.store.venueProducts) === null || _this$store$venueProd2 === void 0 || (_this$store$venueProd2 = _this$store$venueProd2.store) === null || _this$store$venueProd2 === void 0 ? void 0 : _this$store$venueProd2.list) || [];
|
|
861
903
|
}
|
|
862
904
|
}, {
|
|
863
905
|
key: "getAddonProductsList",
|
|
@@ -870,38 +912,38 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
870
912
|
}, {
|
|
871
913
|
key: "loadQuotations",
|
|
872
914
|
value: function () {
|
|
873
|
-
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
874
|
-
return _regeneratorRuntime().wrap(function
|
|
875
|
-
while (1) switch (
|
|
915
|
+
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
|
|
916
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
917
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
876
918
|
case 0:
|
|
877
919
|
this.logMethodStart('loadQuotations');
|
|
878
|
-
|
|
920
|
+
_context13.prev = 1;
|
|
879
921
|
if (this.store.quotation) {
|
|
880
|
-
|
|
922
|
+
_context13.next = 4;
|
|
881
923
|
break;
|
|
882
924
|
}
|
|
883
925
|
throw new Error('quotation 模块未初始化');
|
|
884
926
|
case 4:
|
|
885
|
-
|
|
927
|
+
_context13.next = 6;
|
|
886
928
|
return this.store.quotation.loadQuotations(params);
|
|
887
929
|
case 6:
|
|
888
930
|
this.logMethodSuccess('loadQuotations', {
|
|
889
931
|
count: this.store.quotation.getQuotationList().length
|
|
890
932
|
});
|
|
891
|
-
|
|
933
|
+
_context13.next = 13;
|
|
892
934
|
break;
|
|
893
935
|
case 9:
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
this.logMethodError('loadQuotations',
|
|
897
|
-
throw
|
|
936
|
+
_context13.prev = 9;
|
|
937
|
+
_context13.t0 = _context13["catch"](1);
|
|
938
|
+
this.logMethodError('loadQuotations', _context13.t0);
|
|
939
|
+
throw _context13.t0;
|
|
898
940
|
case 13:
|
|
899
941
|
case "end":
|
|
900
|
-
return
|
|
942
|
+
return _context13.stop();
|
|
901
943
|
}
|
|
902
|
-
},
|
|
944
|
+
}, _callee13, this, [[1, 9]]);
|
|
903
945
|
}));
|
|
904
|
-
function loadQuotations(
|
|
946
|
+
function loadQuotations(_x6) {
|
|
905
947
|
return _loadQuotations.apply(this, arguments);
|
|
906
948
|
}
|
|
907
949
|
return loadQuotations;
|
|
@@ -909,46 +951,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
909
951
|
}, {
|
|
910
952
|
key: "fetchResourceAvailability",
|
|
911
953
|
value: function () {
|
|
912
|
-
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
954
|
+
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
913
955
|
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i2, _rawData, _item, mapping;
|
|
914
|
-
return _regeneratorRuntime().wrap(function
|
|
915
|
-
while (1) switch (
|
|
956
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
957
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
916
958
|
case 0:
|
|
917
959
|
this.logMethodStart('fetchResourceAvailability', params);
|
|
918
|
-
|
|
960
|
+
_context14.prev = 1;
|
|
919
961
|
venueProducts = this.getVenueProducts();
|
|
920
962
|
if (venueProducts.length) {
|
|
921
|
-
|
|
963
|
+
_context14.next = 7;
|
|
922
964
|
break;
|
|
923
965
|
}
|
|
924
966
|
this.store.rawResourceData = [];
|
|
925
967
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
926
968
|
resourceCount: 0
|
|
927
969
|
});
|
|
928
|
-
return
|
|
970
|
+
return _context14.abrupt("return");
|
|
929
971
|
case 7:
|
|
930
972
|
resourceIds = extractResourceIds(venueProducts);
|
|
931
973
|
if (resourceIds.length) {
|
|
932
|
-
|
|
974
|
+
_context14.next = 12;
|
|
933
975
|
break;
|
|
934
976
|
}
|
|
935
977
|
this.store.rawResourceData = [];
|
|
936
978
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
937
979
|
resourceIds: []
|
|
938
980
|
});
|
|
939
|
-
return
|
|
981
|
+
return _context14.abrupt("return");
|
|
940
982
|
case 12:
|
|
941
983
|
// 跨天营业时,endDate 扩展一天以覆盖次日凌晨时段
|
|
942
984
|
config = this.store.slotConfig;
|
|
943
985
|
crossDay = isBusinessHoursCrossDay(config);
|
|
944
986
|
effectiveEndDate = crossDay ? dayjs(params.endDate).add(1, 'day').format('YYYY-MM-DD') : params.endDate;
|
|
945
987
|
if (this.store.date) {
|
|
946
|
-
|
|
988
|
+
_context14.next = 17;
|
|
947
989
|
break;
|
|
948
990
|
}
|
|
949
991
|
throw new Error('date 模块未初始化');
|
|
950
992
|
case 17:
|
|
951
|
-
|
|
993
|
+
_context14.next = 19;
|
|
952
994
|
return this.store.date.fetchResourceDates({
|
|
953
995
|
query: {
|
|
954
996
|
start_date: params.startDate,
|
|
@@ -958,7 +1000,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
958
1000
|
useCache: false
|
|
959
1001
|
});
|
|
960
1002
|
case 19:
|
|
961
|
-
res =
|
|
1003
|
+
res = _context14.sent;
|
|
962
1004
|
rawData = [];
|
|
963
1005
|
if (res !== null && res !== void 0 && res.data && Array.isArray(res.data)) {
|
|
964
1006
|
_iterator2 = _createForOfIteratorHelper(res.data);
|
|
@@ -994,21 +1036,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
994
1036
|
return sum + r.times.length;
|
|
995
1037
|
}, 0)
|
|
996
1038
|
});
|
|
997
|
-
|
|
1039
|
+
_context14.next = 32;
|
|
998
1040
|
break;
|
|
999
1041
|
case 27:
|
|
1000
|
-
|
|
1001
|
-
|
|
1042
|
+
_context14.prev = 27;
|
|
1043
|
+
_context14.t0 = _context14["catch"](1);
|
|
1002
1044
|
this.store.rawResourceData = [];
|
|
1003
|
-
this.logMethodError('fetchResourceAvailability',
|
|
1004
|
-
throw
|
|
1045
|
+
this.logMethodError('fetchResourceAvailability', _context14.t0);
|
|
1046
|
+
throw _context14.t0;
|
|
1005
1047
|
case 32:
|
|
1006
1048
|
case "end":
|
|
1007
|
-
return
|
|
1049
|
+
return _context14.stop();
|
|
1008
1050
|
}
|
|
1009
|
-
},
|
|
1051
|
+
}, _callee14, this, [[1, 27]]);
|
|
1010
1052
|
}));
|
|
1011
|
-
function fetchResourceAvailability(
|
|
1053
|
+
function fetchResourceAvailability(_x7) {
|
|
1012
1054
|
return _fetchResourceAvailability.apply(this, arguments);
|
|
1013
1055
|
}
|
|
1014
1056
|
return fetchResourceAvailability;
|
|
@@ -1060,25 +1102,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1060
1102
|
}, {
|
|
1061
1103
|
key: "toggleSlot",
|
|
1062
1104
|
value: function () {
|
|
1063
|
-
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1105
|
+
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(slot) {
|
|
1064
1106
|
var mapping, currentSlots, existIndex, nextSlots, products;
|
|
1065
|
-
return _regeneratorRuntime().wrap(function
|
|
1066
|
-
while (1) switch (
|
|
1107
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1108
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1067
1109
|
case 0:
|
|
1068
1110
|
this.logMethodStart('toggleSlot', {
|
|
1069
1111
|
resourceId: slot.resourceId,
|
|
1070
1112
|
startTime: slot.startTime
|
|
1071
1113
|
});
|
|
1072
|
-
|
|
1114
|
+
_context15.prev = 1;
|
|
1073
1115
|
mapping = this.resourceProductMap.get(slot.resourceId);
|
|
1074
1116
|
if (mapping) {
|
|
1075
|
-
|
|
1117
|
+
_context15.next = 5;
|
|
1076
1118
|
break;
|
|
1077
1119
|
}
|
|
1078
1120
|
throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
|
|
1079
1121
|
case 5:
|
|
1080
1122
|
if (this.store.order) {
|
|
1081
|
-
|
|
1123
|
+
_context15.next = 7;
|
|
1082
1124
|
break;
|
|
1083
1125
|
}
|
|
1084
1126
|
throw new Error('order 模块未初始化');
|
|
@@ -1094,14 +1136,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1094
1136
|
} else {
|
|
1095
1137
|
nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
|
|
1096
1138
|
}
|
|
1097
|
-
|
|
1139
|
+
_context15.next = 12;
|
|
1098
1140
|
return this.reconcileOrderForResource(slot.resourceId, nextSlots);
|
|
1099
1141
|
case 12:
|
|
1100
1142
|
products = this.store.order.getOrderProducts();
|
|
1101
|
-
|
|
1143
|
+
_context15.next = 15;
|
|
1102
1144
|
return this.refreshItemRuleQuantityLimits();
|
|
1103
1145
|
case 15:
|
|
1104
|
-
|
|
1146
|
+
_context15.next = 17;
|
|
1105
1147
|
return this.refreshCartValidationPassed();
|
|
1106
1148
|
case 17:
|
|
1107
1149
|
this.logMethodSuccess('toggleSlot', {
|
|
@@ -1109,19 +1151,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1109
1151
|
resourceId: slot.resourceId,
|
|
1110
1152
|
slotCount: nextSlots.length
|
|
1111
1153
|
});
|
|
1112
|
-
return
|
|
1154
|
+
return _context15.abrupt("return", products);
|
|
1113
1155
|
case 21:
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
this.logMethodError('toggleSlot',
|
|
1117
|
-
throw
|
|
1156
|
+
_context15.prev = 21;
|
|
1157
|
+
_context15.t0 = _context15["catch"](1);
|
|
1158
|
+
this.logMethodError('toggleSlot', _context15.t0);
|
|
1159
|
+
throw _context15.t0;
|
|
1118
1160
|
case 25:
|
|
1119
1161
|
case "end":
|
|
1120
|
-
return
|
|
1162
|
+
return _context15.stop();
|
|
1121
1163
|
}
|
|
1122
|
-
},
|
|
1164
|
+
}, _callee15, this, [[1, 21]]);
|
|
1123
1165
|
}));
|
|
1124
|
-
function toggleSlot(
|
|
1166
|
+
function toggleSlot(_x8) {
|
|
1125
1167
|
return _toggleSlot.apply(this, arguments);
|
|
1126
1168
|
}
|
|
1127
1169
|
return toggleSlot;
|
|
@@ -1227,17 +1269,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1227
1269
|
}, {
|
|
1228
1270
|
key: "reconcileOrderForResource",
|
|
1229
1271
|
value: (function () {
|
|
1230
|
-
var _reconcileOrderForResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1231
|
-
var mapping, tempOrder, merged, rawResource, venueProduct, i, _venueProduct$is_char, _rawResource$form_id,
|
|
1232
|
-
return _regeneratorRuntime().wrap(function
|
|
1233
|
-
while (1) switch (
|
|
1272
|
+
var _reconcileOrderForResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(resourceId, slots) {
|
|
1273
|
+
var mapping, tempOrder, merged, rawResource, venueProduct, i, _venueProduct$is_char, _rawResource$form_id, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, booking;
|
|
1274
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1275
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1234
1276
|
case 0:
|
|
1235
1277
|
mapping = this.resourceProductMap.get(resourceId);
|
|
1236
1278
|
if (!(!mapping || !this.store.order)) {
|
|
1237
|
-
|
|
1279
|
+
_context16.next = 3;
|
|
1238
1280
|
break;
|
|
1239
1281
|
}
|
|
1240
|
-
return
|
|
1282
|
+
return _context16.abrupt("return");
|
|
1241
1283
|
case 3:
|
|
1242
1284
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1243
1285
|
tempOrder.products = tempOrder.products.filter(function (p) {
|
|
@@ -1249,17 +1291,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1249
1291
|
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));
|
|
1250
1292
|
});
|
|
1251
1293
|
if (slots.length) {
|
|
1252
|
-
|
|
1294
|
+
_context16.next = 12;
|
|
1253
1295
|
break;
|
|
1254
1296
|
}
|
|
1255
1297
|
this.store.order.applyDiscount();
|
|
1256
|
-
|
|
1298
|
+
_context16.next = 10;
|
|
1257
1299
|
return this.store.order.recalculateSummary({
|
|
1258
1300
|
createIfMissing: true
|
|
1259
1301
|
});
|
|
1260
1302
|
case 10:
|
|
1261
1303
|
this.store.order.persistTempOrder();
|
|
1262
|
-
return
|
|
1304
|
+
return _context16.abrupt("return");
|
|
1263
1305
|
case 12:
|
|
1264
1306
|
merged = mergeConsecutiveSlots(slots);
|
|
1265
1307
|
rawResource = this.store.rawResourceData.find(function (r) {
|
|
@@ -1294,7 +1336,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1294
1336
|
start_time: group.startTime,
|
|
1295
1337
|
end_time: group.endTime,
|
|
1296
1338
|
slot_count: group.slotCount,
|
|
1297
|
-
booking_uid: bookingUuid
|
|
1339
|
+
booking_uid: bookingUuid,
|
|
1340
|
+
price_breakdown: buildPriceBreakdown({
|
|
1341
|
+
group: group,
|
|
1342
|
+
productId: mapping.productId,
|
|
1343
|
+
quotation: this.store.quotation
|
|
1344
|
+
})
|
|
1298
1345
|
},
|
|
1299
1346
|
_origin: {
|
|
1300
1347
|
name: mapping.productTitle,
|
|
@@ -1325,7 +1372,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1325
1372
|
main_field: mapping.resourceName,
|
|
1326
1373
|
form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
|
|
1327
1374
|
relation_id: resourceId,
|
|
1328
|
-
capacity:
|
|
1375
|
+
capacity: 1,
|
|
1329
1376
|
metadata: {}
|
|
1330
1377
|
}],
|
|
1331
1378
|
schedule_id: 0,
|
|
@@ -1352,7 +1399,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1352
1399
|
tempOrder.bookings.push(booking);
|
|
1353
1400
|
}
|
|
1354
1401
|
this.store.order.applyDiscount();
|
|
1355
|
-
|
|
1402
|
+
_context16.next = 20;
|
|
1356
1403
|
return this.store.order.recalculateSummary({
|
|
1357
1404
|
createIfMissing: true
|
|
1358
1405
|
});
|
|
@@ -1360,11 +1407,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1360
1407
|
this.store.order.persistTempOrder();
|
|
1361
1408
|
case 21:
|
|
1362
1409
|
case "end":
|
|
1363
|
-
return
|
|
1410
|
+
return _context16.stop();
|
|
1364
1411
|
}
|
|
1365
|
-
},
|
|
1412
|
+
}, _callee16, this);
|
|
1366
1413
|
}));
|
|
1367
|
-
function reconcileOrderForResource(
|
|
1414
|
+
function reconcileOrderForResource(_x9, _x10) {
|
|
1368
1415
|
return _reconcileOrderForResource.apply(this, arguments);
|
|
1369
1416
|
}
|
|
1370
1417
|
return reconcileOrderForResource;
|
|
@@ -1385,40 +1432,51 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1385
1432
|
}, {
|
|
1386
1433
|
key: "loadSchedules",
|
|
1387
1434
|
value: function () {
|
|
1388
|
-
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1389
|
-
return _regeneratorRuntime().wrap(function
|
|
1390
|
-
while (1) switch (
|
|
1435
|
+
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1436
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1437
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1391
1438
|
case 0:
|
|
1392
1439
|
this.logMethodStart('loadSchedules');
|
|
1393
|
-
|
|
1440
|
+
_context17.prev = 1;
|
|
1394
1441
|
if (this.store.schedule) {
|
|
1395
|
-
|
|
1442
|
+
_context17.next = 4;
|
|
1396
1443
|
break;
|
|
1397
1444
|
}
|
|
1398
1445
|
throw new Error('schedule 模块未初始化');
|
|
1399
1446
|
case 4:
|
|
1400
|
-
|
|
1447
|
+
_context17.next = 6;
|
|
1401
1448
|
return this.store.schedule.loadAllSchedule();
|
|
1402
1449
|
case 6:
|
|
1450
|
+
this.injectScheduleResolverToQuotation();
|
|
1403
1451
|
this.logMethodSuccess('loadSchedules');
|
|
1404
|
-
|
|
1452
|
+
_context17.next = 14;
|
|
1405
1453
|
break;
|
|
1406
|
-
case
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
this.logMethodError('loadSchedules',
|
|
1410
|
-
throw
|
|
1411
|
-
case
|
|
1454
|
+
case 10:
|
|
1455
|
+
_context17.prev = 10;
|
|
1456
|
+
_context17.t0 = _context17["catch"](1);
|
|
1457
|
+
this.logMethodError('loadSchedules', _context17.t0);
|
|
1458
|
+
throw _context17.t0;
|
|
1459
|
+
case 14:
|
|
1412
1460
|
case "end":
|
|
1413
|
-
return
|
|
1461
|
+
return _context17.stop();
|
|
1414
1462
|
}
|
|
1415
|
-
},
|
|
1463
|
+
}, _callee17, this, [[1, 10]]);
|
|
1416
1464
|
}));
|
|
1417
1465
|
function loadSchedules() {
|
|
1418
1466
|
return _loadSchedules.apply(this, arguments);
|
|
1419
1467
|
}
|
|
1420
1468
|
return loadSchedules;
|
|
1421
1469
|
}()
|
|
1470
|
+
}, {
|
|
1471
|
+
key: "injectScheduleResolverToQuotation",
|
|
1472
|
+
value: function injectScheduleResolverToQuotation() {
|
|
1473
|
+
var _this5 = this;
|
|
1474
|
+
if (this.store.quotation && this.store.schedule) {
|
|
1475
|
+
this.store.quotation.setScheduleResolver(function (id) {
|
|
1476
|
+
return _this5.store.schedule.getScheduleListByIds([id])[0];
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1422
1480
|
}, {
|
|
1423
1481
|
key: "getScheduleListByIds",
|
|
1424
1482
|
value: function getScheduleListByIds(ids) {
|
|
@@ -1455,15 +1513,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1455
1513
|
}, {
|
|
1456
1514
|
key: "onCustomerLogin",
|
|
1457
1515
|
value: function () {
|
|
1458
|
-
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1459
|
-
return _regeneratorRuntime().wrap(function
|
|
1460
|
-
while (1) switch (
|
|
1516
|
+
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1517
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1518
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1461
1519
|
case 0:
|
|
1462
1520
|
this.logMethodStart('onCustomerLogin', {
|
|
1463
1521
|
customerId: params.customerId
|
|
1464
1522
|
});
|
|
1465
|
-
|
|
1466
|
-
|
|
1523
|
+
_context18.prev = 1;
|
|
1524
|
+
_context18.next = 4;
|
|
1467
1525
|
return this.refreshOrderMarketingAfterLogin({
|
|
1468
1526
|
customerId: params.customerId
|
|
1469
1527
|
});
|
|
@@ -1471,20 +1529,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1471
1529
|
this.logMethodSuccess('onCustomerLogin', {
|
|
1472
1530
|
customerId: params.customerId
|
|
1473
1531
|
});
|
|
1474
|
-
|
|
1532
|
+
_context18.next = 11;
|
|
1475
1533
|
break;
|
|
1476
1534
|
case 7:
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
this.logMethodError('onCustomerLogin',
|
|
1480
|
-
throw
|
|
1535
|
+
_context18.prev = 7;
|
|
1536
|
+
_context18.t0 = _context18["catch"](1);
|
|
1537
|
+
this.logMethodError('onCustomerLogin', _context18.t0);
|
|
1538
|
+
throw _context18.t0;
|
|
1481
1539
|
case 11:
|
|
1482
1540
|
case "end":
|
|
1483
|
-
return
|
|
1541
|
+
return _context18.stop();
|
|
1484
1542
|
}
|
|
1485
|
-
},
|
|
1543
|
+
}, _callee18, this, [[1, 7]]);
|
|
1486
1544
|
}));
|
|
1487
|
-
function onCustomerLogin(
|
|
1545
|
+
function onCustomerLogin(_x11) {
|
|
1488
1546
|
return _onCustomerLogin.apply(this, arguments);
|
|
1489
1547
|
}
|
|
1490
1548
|
return onCustomerLogin;
|
|
@@ -1493,7 +1551,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1493
1551
|
key: "recalculateOrderPricesFromQuotation",
|
|
1494
1552
|
value: function recalculateOrderPricesFromQuotation() {
|
|
1495
1553
|
var _tempOrder$products,
|
|
1496
|
-
|
|
1554
|
+
_this6 = this;
|
|
1497
1555
|
if (!this.store.order || !this.store.quotation) return;
|
|
1498
1556
|
var tempOrder = this.store.order.getTempOrder();
|
|
1499
1557
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
@@ -1505,13 +1563,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1505
1563
|
var _product$metadata2;
|
|
1506
1564
|
var product = _step6.value;
|
|
1507
1565
|
if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
|
|
1508
|
-
var mapping =
|
|
1566
|
+
var mapping = _this6.resourceProductMap.get(product.metadata.resource_id);
|
|
1509
1567
|
if (!mapping) return 1; // continue
|
|
1510
|
-
var slots = expandMergedSlotToIndividual(product,
|
|
1568
|
+
var slots = expandMergedSlotToIndividual(product, _this6.store.slotConfig.slotDurationMinutes);
|
|
1511
1569
|
var updatedSlots = slots.map(function (slot) {
|
|
1512
1570
|
var _getPriceForProduct;
|
|
1513
1571
|
return _objectSpread(_objectSpread({}, slot), {}, {
|
|
1514
|
-
price: (_getPriceForProduct =
|
|
1572
|
+
price: (_getPriceForProduct = _this6.store.quotation.getPriceForProduct({
|
|
1515
1573
|
productId: mapping.productId,
|
|
1516
1574
|
datetime: slot.startTime
|
|
1517
1575
|
})) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
|
|
@@ -1520,19 +1578,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1520
1578
|
var merged = mergeConsecutiveSlots(updatedSlots);
|
|
1521
1579
|
if (merged.length === 1) {
|
|
1522
1580
|
product.selling_price = merged[0].totalPrice;
|
|
1523
|
-
product.original_price = merged[0].totalPrice;
|
|
1524
1581
|
product.payment_price = merged[0].totalPrice;
|
|
1582
|
+
product.metadata.price_breakdown = buildPriceBreakdown({
|
|
1583
|
+
group: merged[0],
|
|
1584
|
+
productId: mapping.productId,
|
|
1585
|
+
quotation: _this6.store.quotation
|
|
1586
|
+
});
|
|
1525
1587
|
}
|
|
1526
1588
|
} else if (product.product_id != null) {
|
|
1527
1589
|
var _product$product_vari;
|
|
1528
|
-
var quotationPrice =
|
|
1590
|
+
var quotationPrice = _this6.store.quotation.getPriceForProduct({
|
|
1529
1591
|
productId: product.product_id,
|
|
1530
1592
|
variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
|
|
1531
1593
|
datetime: now
|
|
1532
1594
|
});
|
|
1533
1595
|
if (quotationPrice !== null) {
|
|
1534
1596
|
product.selling_price = quotationPrice;
|
|
1535
|
-
product.original_price = quotationPrice;
|
|
1536
1597
|
product.payment_price = quotationPrice;
|
|
1537
1598
|
}
|
|
1538
1599
|
}
|
|
@@ -1549,30 +1610,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1549
1610
|
}, {
|
|
1550
1611
|
key: "scanCode",
|
|
1551
1612
|
value: function () {
|
|
1552
|
-
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1613
|
+
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(code, customerId) {
|
|
1553
1614
|
var result;
|
|
1554
|
-
return _regeneratorRuntime().wrap(function
|
|
1555
|
-
while (1) switch (
|
|
1615
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1616
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1556
1617
|
case 0:
|
|
1557
1618
|
this.logMethodStart('scanCode', {
|
|
1558
1619
|
code: code
|
|
1559
1620
|
});
|
|
1560
|
-
|
|
1621
|
+
_context19.prev = 1;
|
|
1561
1622
|
if (this.store.order) {
|
|
1562
|
-
|
|
1623
|
+
_context19.next = 4;
|
|
1563
1624
|
break;
|
|
1564
1625
|
}
|
|
1565
1626
|
throw new Error('order 模块未初始化');
|
|
1566
1627
|
case 4:
|
|
1567
|
-
|
|
1628
|
+
_context19.next = 6;
|
|
1568
1629
|
return this.store.order.scanCode(code, customerId);
|
|
1569
1630
|
case 6:
|
|
1570
|
-
result =
|
|
1631
|
+
result = _context19.sent;
|
|
1571
1632
|
if (!result.isAvailable) {
|
|
1572
|
-
|
|
1633
|
+
_context19.next = 11;
|
|
1573
1634
|
break;
|
|
1574
1635
|
}
|
|
1575
|
-
|
|
1636
|
+
_context19.next = 10;
|
|
1576
1637
|
return this.store.order.recalculateSummary({
|
|
1577
1638
|
createIfMissing: true
|
|
1578
1639
|
});
|
|
@@ -1582,19 +1643,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1582
1643
|
this.logMethodSuccess('scanCode', {
|
|
1583
1644
|
isAvailable: result.isAvailable
|
|
1584
1645
|
});
|
|
1585
|
-
return
|
|
1646
|
+
return _context19.abrupt("return", result);
|
|
1586
1647
|
case 15:
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
this.logMethodError('scanCode',
|
|
1590
|
-
throw
|
|
1648
|
+
_context19.prev = 15;
|
|
1649
|
+
_context19.t0 = _context19["catch"](1);
|
|
1650
|
+
this.logMethodError('scanCode', _context19.t0);
|
|
1651
|
+
throw _context19.t0;
|
|
1591
1652
|
case 19:
|
|
1592
1653
|
case "end":
|
|
1593
|
-
return
|
|
1654
|
+
return _context19.stop();
|
|
1594
1655
|
}
|
|
1595
|
-
},
|
|
1656
|
+
}, _callee19, this, [[1, 15]]);
|
|
1596
1657
|
}));
|
|
1597
|
-
function scanCode(
|
|
1658
|
+
function scanCode(_x12, _x13) {
|
|
1598
1659
|
return _scanCode.apply(this, arguments);
|
|
1599
1660
|
}
|
|
1600
1661
|
return scanCode;
|
|
@@ -1610,15 +1671,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1610
1671
|
}, {
|
|
1611
1672
|
key: "setDiscountSelected",
|
|
1612
1673
|
value: (function () {
|
|
1613
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1614
|
-
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
1615
|
-
return _regeneratorRuntime().wrap(function
|
|
1616
|
-
while (1) switch (
|
|
1674
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
1675
|
+
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, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
1676
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1677
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1617
1678
|
case 0:
|
|
1618
1679
|
this.logMethodStart('setDiscountSelected', params);
|
|
1619
|
-
|
|
1680
|
+
_context20.prev = 1;
|
|
1620
1681
|
if (this.store.order) {
|
|
1621
|
-
|
|
1682
|
+
_context20.next = 4;
|
|
1622
1683
|
break;
|
|
1623
1684
|
}
|
|
1624
1685
|
throw new Error('order 模块未初始化');
|
|
@@ -1644,47 +1705,64 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1644
1705
|
form_record_id: tempOrder.holder.form_record_id
|
|
1645
1706
|
}] : [];
|
|
1646
1707
|
nextDiscountList = updated;
|
|
1647
|
-
|
|
1708
|
+
_context20.next = 16;
|
|
1648
1709
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1649
1710
|
case 16:
|
|
1650
|
-
if (
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
productList
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1711
|
+
if (rulesModule) {
|
|
1712
|
+
result = rulesModule.calcDiscount({
|
|
1713
|
+
productList: tempOrder.products,
|
|
1714
|
+
discountList: updated,
|
|
1715
|
+
holders: holders,
|
|
1716
|
+
isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form'
|
|
1717
|
+
}, {
|
|
1718
|
+
discountId: params.discountId,
|
|
1719
|
+
isSelected: params.isSelected
|
|
1720
|
+
}) || {
|
|
1721
|
+
productList: tempOrder.products,
|
|
1722
|
+
discountList: updated
|
|
1723
|
+
};
|
|
1724
|
+
if (result !== null && result !== void 0 && result.productList) {
|
|
1725
|
+
tempOrder.products = result.productList;
|
|
1726
|
+
}
|
|
1727
|
+
if (result !== null && result !== void 0 && result.discountList) {
|
|
1728
|
+
nextDiscountList = result.discountList;
|
|
1729
|
+
if (!params.isSelected) {
|
|
1730
|
+
beforeSelectedIds = new Set(updated.filter(function (d) {
|
|
1731
|
+
return d.isSelected;
|
|
1732
|
+
}).map(function (d) {
|
|
1733
|
+
return d.id;
|
|
1734
|
+
}));
|
|
1735
|
+
_iterator7 = _createForOfIteratorHelper(nextDiscountList);
|
|
1736
|
+
try {
|
|
1737
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
1738
|
+
d = _step7.value;
|
|
1739
|
+
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
1740
|
+
d.isSelected = false;
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
} catch (err) {
|
|
1744
|
+
_iterator7.e(err);
|
|
1745
|
+
} finally {
|
|
1746
|
+
_iterator7.f();
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1672
1750
|
}
|
|
1673
|
-
nextDiscountList
|
|
1674
|
-
|
|
1675
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(
|
|
1676
|
-
case
|
|
1751
|
+
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1752
|
+
_context20.next = 20;
|
|
1753
|
+
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1754
|
+
case 20:
|
|
1677
1755
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1678
1756
|
return d.isSelected;
|
|
1679
1757
|
});
|
|
1680
1758
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
1681
1759
|
return d.id === params.discountId;
|
|
1682
1760
|
}) || null;
|
|
1683
|
-
|
|
1761
|
+
_context20.next = 24;
|
|
1684
1762
|
return this.store.order.recalculateSummary({
|
|
1685
1763
|
createIfMissing: true
|
|
1686
1764
|
});
|
|
1687
|
-
case
|
|
1765
|
+
case 24:
|
|
1688
1766
|
this.store.order.persistTempOrder();
|
|
1689
1767
|
finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
|
|
1690
1768
|
finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
|
|
@@ -1692,19 +1770,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1692
1770
|
finalTarget = this.store.order.getDiscountList().find(function (d) {
|
|
1693
1771
|
return d.id === params.discountId;
|
|
1694
1772
|
}) || null;
|
|
1695
|
-
return
|
|
1696
|
-
case
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
this.logMethodError('setDiscountSelected',
|
|
1700
|
-
throw
|
|
1701
|
-
case
|
|
1773
|
+
return _context20.abrupt("return", this.store.order.getDiscountList());
|
|
1774
|
+
case 32:
|
|
1775
|
+
_context20.prev = 32;
|
|
1776
|
+
_context20.t0 = _context20["catch"](1);
|
|
1777
|
+
this.logMethodError('setDiscountSelected', _context20.t0);
|
|
1778
|
+
throw _context20.t0;
|
|
1779
|
+
case 36:
|
|
1702
1780
|
case "end":
|
|
1703
|
-
return
|
|
1781
|
+
return _context20.stop();
|
|
1704
1782
|
}
|
|
1705
|
-
},
|
|
1783
|
+
}, _callee20, this, [[1, 32]]);
|
|
1706
1784
|
}));
|
|
1707
|
-
function setDiscountSelected(
|
|
1785
|
+
function setDiscountSelected(_x14) {
|
|
1708
1786
|
return _setDiscountSelected.apply(this, arguments);
|
|
1709
1787
|
}
|
|
1710
1788
|
return setDiscountSelected;
|
|
@@ -1712,37 +1790,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1712
1790
|
}, {
|
|
1713
1791
|
key: "addNewOrder",
|
|
1714
1792
|
value: function () {
|
|
1715
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1793
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
1716
1794
|
var tempOrder;
|
|
1717
|
-
return _regeneratorRuntime().wrap(function
|
|
1718
|
-
while (1) switch (
|
|
1795
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1796
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1719
1797
|
case 0:
|
|
1720
1798
|
this.logMethodStart('addNewOrder');
|
|
1721
|
-
|
|
1799
|
+
_context21.prev = 1;
|
|
1722
1800
|
if (this.store.order) {
|
|
1723
|
-
|
|
1801
|
+
_context21.next = 4;
|
|
1724
1802
|
break;
|
|
1725
1803
|
}
|
|
1726
1804
|
throw new Error('order 模块未初始化');
|
|
1727
1805
|
case 4:
|
|
1728
|
-
|
|
1806
|
+
_context21.next = 6;
|
|
1729
1807
|
return this.store.order.addNewOrder();
|
|
1730
1808
|
case 6:
|
|
1731
|
-
tempOrder =
|
|
1809
|
+
tempOrder = _context21.sent;
|
|
1732
1810
|
this.logMethodSuccess('addNewOrder', {
|
|
1733
1811
|
productCount: tempOrder.products.length
|
|
1734
1812
|
});
|
|
1735
|
-
return
|
|
1813
|
+
return _context21.abrupt("return", tempOrder);
|
|
1736
1814
|
case 11:
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
this.logMethodError('addNewOrder',
|
|
1740
|
-
throw
|
|
1815
|
+
_context21.prev = 11;
|
|
1816
|
+
_context21.t0 = _context21["catch"](1);
|
|
1817
|
+
this.logMethodError('addNewOrder', _context21.t0);
|
|
1818
|
+
throw _context21.t0;
|
|
1741
1819
|
case 15:
|
|
1742
1820
|
case "end":
|
|
1743
|
-
return
|
|
1821
|
+
return _context21.stop();
|
|
1744
1822
|
}
|
|
1745
|
-
},
|
|
1823
|
+
}, _callee21, this, [[1, 11]]);
|
|
1746
1824
|
}));
|
|
1747
1825
|
function addNewOrder() {
|
|
1748
1826
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -1758,37 +1836,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1758
1836
|
}, {
|
|
1759
1837
|
key: "getSummary",
|
|
1760
1838
|
value: function () {
|
|
1761
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1839
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1762
1840
|
var summary;
|
|
1763
|
-
return _regeneratorRuntime().wrap(function
|
|
1764
|
-
while (1) switch (
|
|
1841
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1842
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1765
1843
|
case 0:
|
|
1766
1844
|
this.logMethodStart('getSummary');
|
|
1767
|
-
|
|
1845
|
+
_context22.prev = 1;
|
|
1768
1846
|
if (this.store.order) {
|
|
1769
|
-
|
|
1847
|
+
_context22.next = 4;
|
|
1770
1848
|
break;
|
|
1771
1849
|
}
|
|
1772
1850
|
throw new Error('order 模块未初始化');
|
|
1773
1851
|
case 4:
|
|
1774
|
-
|
|
1852
|
+
_context22.next = 6;
|
|
1775
1853
|
return this.store.order.getScanOrderSummary();
|
|
1776
1854
|
case 6:
|
|
1777
|
-
summary =
|
|
1855
|
+
summary = _context22.sent;
|
|
1778
1856
|
this.logMethodSuccess('getSummary', {
|
|
1779
1857
|
totalAmount: summary.total_amount
|
|
1780
1858
|
});
|
|
1781
|
-
return
|
|
1859
|
+
return _context22.abrupt("return", summary);
|
|
1782
1860
|
case 11:
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
this.logMethodError('getSummary',
|
|
1786
|
-
throw
|
|
1861
|
+
_context22.prev = 11;
|
|
1862
|
+
_context22.t0 = _context22["catch"](1);
|
|
1863
|
+
this.logMethodError('getSummary', _context22.t0);
|
|
1864
|
+
throw _context22.t0;
|
|
1787
1865
|
case 15:
|
|
1788
1866
|
case "end":
|
|
1789
|
-
return
|
|
1867
|
+
return _context22.stop();
|
|
1790
1868
|
}
|
|
1791
|
-
},
|
|
1869
|
+
}, _callee22, this, [[1, 11]]);
|
|
1792
1870
|
}));
|
|
1793
1871
|
function getSummary() {
|
|
1794
1872
|
return _getSummary.apply(this, arguments);
|
|
@@ -1798,43 +1876,43 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1798
1876
|
}, {
|
|
1799
1877
|
key: "submitOrder",
|
|
1800
1878
|
value: function () {
|
|
1801
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1879
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1802
1880
|
var _tempOrder$products2, result, tempOrder;
|
|
1803
|
-
return _regeneratorRuntime().wrap(function
|
|
1804
|
-
while (1) switch (
|
|
1881
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1882
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1805
1883
|
case 0:
|
|
1806
1884
|
this.logMethodStart('submitOrder');
|
|
1807
|
-
|
|
1808
|
-
|
|
1885
|
+
_context23.prev = 1;
|
|
1886
|
+
_context23.next = 4;
|
|
1809
1887
|
return this.validateBeforeSubmitByItemRule();
|
|
1810
1888
|
case 4:
|
|
1811
1889
|
if (this.store.order) {
|
|
1812
|
-
|
|
1890
|
+
_context23.next = 6;
|
|
1813
1891
|
break;
|
|
1814
1892
|
}
|
|
1815
1893
|
throw new Error('venueBooking解决方案需要 order 模块支持');
|
|
1816
1894
|
case 6:
|
|
1817
|
-
|
|
1895
|
+
_context23.next = 8;
|
|
1818
1896
|
return this.store.order.submitTempOrder({
|
|
1819
1897
|
cacheId: this.cacheId
|
|
1820
1898
|
});
|
|
1821
1899
|
case 8:
|
|
1822
|
-
result =
|
|
1900
|
+
result = _context23.sent;
|
|
1823
1901
|
tempOrder = this.store.order.getTempOrder();
|
|
1824
1902
|
this.logMethodSuccess('submitOrder', {
|
|
1825
1903
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
|
|
1826
1904
|
});
|
|
1827
|
-
return
|
|
1905
|
+
return _context23.abrupt("return", result);
|
|
1828
1906
|
case 14:
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
this.logMethodError('submitOrder',
|
|
1832
|
-
throw
|
|
1907
|
+
_context23.prev = 14;
|
|
1908
|
+
_context23.t0 = _context23["catch"](1);
|
|
1909
|
+
this.logMethodError('submitOrder', _context23.t0);
|
|
1910
|
+
throw _context23.t0;
|
|
1833
1911
|
case 18:
|
|
1834
1912
|
case "end":
|
|
1835
|
-
return
|
|
1913
|
+
return _context23.stop();
|
|
1836
1914
|
}
|
|
1837
|
-
},
|
|
1915
|
+
}, _callee23, this, [[1, 14]]);
|
|
1838
1916
|
}));
|
|
1839
1917
|
function submitOrder() {
|
|
1840
1918
|
return _submitOrder.apply(this, arguments);
|
|
@@ -1844,18 +1922,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1844
1922
|
}, {
|
|
1845
1923
|
key: "addProductToOrder",
|
|
1846
1924
|
value: function () {
|
|
1847
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1925
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(product) {
|
|
1848
1926
|
var _product$metadata3, _product$product_vari2, quotationPrice, products;
|
|
1849
|
-
return _regeneratorRuntime().wrap(function
|
|
1850
|
-
while (1) switch (
|
|
1927
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1928
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1851
1929
|
case 0:
|
|
1852
1930
|
this.logMethodStart('addProductToOrder', {
|
|
1853
1931
|
product_id: product.product_id,
|
|
1854
1932
|
product_variant_id: product.product_variant_id
|
|
1855
1933
|
});
|
|
1856
|
-
|
|
1934
|
+
_context24.prev = 1;
|
|
1857
1935
|
if (this.store.order) {
|
|
1858
|
-
|
|
1936
|
+
_context24.next = 4;
|
|
1859
1937
|
break;
|
|
1860
1938
|
}
|
|
1861
1939
|
throw new Error('order 模块未初始化');
|
|
@@ -1868,36 +1946,38 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1868
1946
|
});
|
|
1869
1947
|
if (quotationPrice !== null) {
|
|
1870
1948
|
product.selling_price = quotationPrice;
|
|
1871
|
-
product.original_price
|
|
1949
|
+
if (product.original_price == null) {
|
|
1950
|
+
product.original_price = quotationPrice;
|
|
1951
|
+
}
|
|
1872
1952
|
product.payment_price = quotationPrice;
|
|
1873
1953
|
}
|
|
1874
1954
|
}
|
|
1875
|
-
|
|
1955
|
+
_context24.next = 7;
|
|
1876
1956
|
return this.store.order.addProductToOrder(product);
|
|
1877
1957
|
case 7:
|
|
1878
|
-
products =
|
|
1879
|
-
|
|
1958
|
+
products = _context24.sent;
|
|
1959
|
+
_context24.next = 10;
|
|
1880
1960
|
return this.refreshItemRuleQuantityLimits();
|
|
1881
1961
|
case 10:
|
|
1882
|
-
|
|
1962
|
+
_context24.next = 12;
|
|
1883
1963
|
return this.refreshCartValidationPassed();
|
|
1884
1964
|
case 12:
|
|
1885
1965
|
this.logMethodSuccess('addProductToOrder', {
|
|
1886
1966
|
productCount: products.length
|
|
1887
1967
|
});
|
|
1888
|
-
return
|
|
1968
|
+
return _context24.abrupt("return", products);
|
|
1889
1969
|
case 16:
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
this.logMethodError('addProductToOrder',
|
|
1893
|
-
throw
|
|
1970
|
+
_context24.prev = 16;
|
|
1971
|
+
_context24.t0 = _context24["catch"](1);
|
|
1972
|
+
this.logMethodError('addProductToOrder', _context24.t0);
|
|
1973
|
+
throw _context24.t0;
|
|
1894
1974
|
case 20:
|
|
1895
1975
|
case "end":
|
|
1896
|
-
return
|
|
1976
|
+
return _context24.stop();
|
|
1897
1977
|
}
|
|
1898
|
-
},
|
|
1978
|
+
}, _callee24, this, [[1, 16]]);
|
|
1899
1979
|
}));
|
|
1900
|
-
function addProductToOrder(
|
|
1980
|
+
function addProductToOrder(_x15) {
|
|
1901
1981
|
return _addProductToOrder.apply(this, arguments);
|
|
1902
1982
|
}
|
|
1903
1983
|
return addProductToOrder;
|
|
@@ -1905,48 +1985,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1905
1985
|
}, {
|
|
1906
1986
|
key: "updateProductInOrder",
|
|
1907
1987
|
value: function () {
|
|
1908
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1988
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
1909
1989
|
var products;
|
|
1910
|
-
return _regeneratorRuntime().wrap(function
|
|
1911
|
-
while (1) switch (
|
|
1990
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1991
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1912
1992
|
case 0:
|
|
1913
1993
|
this.logMethodStart('updateProductInOrder', {
|
|
1914
1994
|
product_id: params.product_id,
|
|
1915
1995
|
product_variant_id: params.product_variant_id
|
|
1916
1996
|
});
|
|
1917
|
-
|
|
1997
|
+
_context25.prev = 1;
|
|
1918
1998
|
if (this.store.order) {
|
|
1919
|
-
|
|
1999
|
+
_context25.next = 4;
|
|
1920
2000
|
break;
|
|
1921
2001
|
}
|
|
1922
2002
|
throw new Error('order 模块未初始化');
|
|
1923
2003
|
case 4:
|
|
1924
|
-
|
|
2004
|
+
_context25.next = 6;
|
|
1925
2005
|
return this.store.order.updateProductInOrder(params);
|
|
1926
2006
|
case 6:
|
|
1927
|
-
products =
|
|
1928
|
-
|
|
2007
|
+
products = _context25.sent;
|
|
2008
|
+
_context25.next = 9;
|
|
1929
2009
|
return this.refreshItemRuleQuantityLimits();
|
|
1930
2010
|
case 9:
|
|
1931
|
-
|
|
2011
|
+
_context25.next = 11;
|
|
1932
2012
|
return this.refreshCartValidationPassed();
|
|
1933
2013
|
case 11:
|
|
1934
2014
|
this.logMethodSuccess('updateProductInOrder', {
|
|
1935
2015
|
productCount: products.length
|
|
1936
2016
|
});
|
|
1937
|
-
return
|
|
2017
|
+
return _context25.abrupt("return", products);
|
|
1938
2018
|
case 15:
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
this.logMethodError('updateProductInOrder',
|
|
1942
|
-
throw
|
|
2019
|
+
_context25.prev = 15;
|
|
2020
|
+
_context25.t0 = _context25["catch"](1);
|
|
2021
|
+
this.logMethodError('updateProductInOrder', _context25.t0);
|
|
2022
|
+
throw _context25.t0;
|
|
1943
2023
|
case 19:
|
|
1944
2024
|
case "end":
|
|
1945
|
-
return
|
|
2025
|
+
return _context25.stop();
|
|
1946
2026
|
}
|
|
1947
|
-
},
|
|
2027
|
+
}, _callee25, this, [[1, 15]]);
|
|
1948
2028
|
}));
|
|
1949
|
-
function updateProductInOrder(
|
|
2029
|
+
function updateProductInOrder(_x16) {
|
|
1950
2030
|
return _updateProductInOrder.apply(this, arguments);
|
|
1951
2031
|
}
|
|
1952
2032
|
return updateProductInOrder;
|
|
@@ -1954,48 +2034,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1954
2034
|
}, {
|
|
1955
2035
|
key: "removeProductFromOrder",
|
|
1956
2036
|
value: function () {
|
|
1957
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2037
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(identity) {
|
|
1958
2038
|
var products;
|
|
1959
|
-
return _regeneratorRuntime().wrap(function
|
|
1960
|
-
while (1) switch (
|
|
2039
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2040
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1961
2041
|
case 0:
|
|
1962
2042
|
this.logMethodStart('removeProductFromOrder', {
|
|
1963
2043
|
product_id: identity.product_id,
|
|
1964
2044
|
product_variant_id: identity.product_variant_id
|
|
1965
2045
|
});
|
|
1966
|
-
|
|
2046
|
+
_context26.prev = 1;
|
|
1967
2047
|
if (this.store.order) {
|
|
1968
|
-
|
|
2048
|
+
_context26.next = 4;
|
|
1969
2049
|
break;
|
|
1970
2050
|
}
|
|
1971
2051
|
throw new Error('order 模块未初始化');
|
|
1972
2052
|
case 4:
|
|
1973
|
-
|
|
2053
|
+
_context26.next = 6;
|
|
1974
2054
|
return this.store.order.removeProductFromOrder(identity);
|
|
1975
2055
|
case 6:
|
|
1976
|
-
products =
|
|
1977
|
-
|
|
2056
|
+
products = _context26.sent;
|
|
2057
|
+
_context26.next = 9;
|
|
1978
2058
|
return this.refreshItemRuleQuantityLimits();
|
|
1979
2059
|
case 9:
|
|
1980
|
-
|
|
2060
|
+
_context26.next = 11;
|
|
1981
2061
|
return this.refreshCartValidationPassed();
|
|
1982
2062
|
case 11:
|
|
1983
2063
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
1984
2064
|
productCount: products.length
|
|
1985
2065
|
});
|
|
1986
|
-
return
|
|
2066
|
+
return _context26.abrupt("return", products);
|
|
1987
2067
|
case 15:
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
this.logMethodError('removeProductFromOrder',
|
|
1991
|
-
throw
|
|
2068
|
+
_context26.prev = 15;
|
|
2069
|
+
_context26.t0 = _context26["catch"](1);
|
|
2070
|
+
this.logMethodError('removeProductFromOrder', _context26.t0);
|
|
2071
|
+
throw _context26.t0;
|
|
1992
2072
|
case 19:
|
|
1993
2073
|
case "end":
|
|
1994
|
-
return
|
|
2074
|
+
return _context26.stop();
|
|
1995
2075
|
}
|
|
1996
|
-
},
|
|
2076
|
+
}, _callee26, this, [[1, 15]]);
|
|
1997
2077
|
}));
|
|
1998
|
-
function removeProductFromOrder(
|
|
2078
|
+
function removeProductFromOrder(_x17) {
|
|
1999
2079
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2000
2080
|
}
|
|
2001
2081
|
return removeProductFromOrder;
|
|
@@ -2003,54 +2083,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2003
2083
|
}, {
|
|
2004
2084
|
key: "getProductList",
|
|
2005
2085
|
value: function () {
|
|
2006
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2007
|
-
var
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
while (1) switch (_context26.prev = _context26.next) {
|
|
2086
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2087
|
+
var result;
|
|
2088
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2089
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2011
2090
|
case 0:
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
break;
|
|
2019
|
-
}
|
|
2020
|
-
formattedRes = attachItemRuleLimitsToTopLevelProducts(cachedList, this.store.itemRuleQuantityLimits || []);
|
|
2021
|
-
this.logMethodSuccess('getProductList', {
|
|
2022
|
-
fromCache: true
|
|
2023
|
-
});
|
|
2024
|
-
return _context26.abrupt("return", formattedRes);
|
|
2025
|
-
case 6:
|
|
2026
|
-
menuListIds = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.menuListIds) || ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.dineInConfig) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7['menu.associated_menus']) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.map(function (n) {
|
|
2027
|
-
return Number(n.value);
|
|
2028
|
-
})) || [];
|
|
2029
|
-
_context26.prev = 7;
|
|
2030
|
-
_context26.next = 10;
|
|
2031
|
-
return (_this$store$products2 = this.store.products) === null || _this$store$products2 === void 0 ? void 0 : _this$store$products2.loadProducts({
|
|
2032
|
-
menu_list_ids: menuListIds,
|
|
2033
|
-
cacheId: this.cacheId,
|
|
2034
|
-
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
2035
|
-
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2036
|
-
});
|
|
2037
|
-
case 10:
|
|
2038
|
-
res = _context26.sent;
|
|
2039
|
-
_formattedRes = attachItemRuleLimitsToTopLevelProducts(res, this.store.itemRuleQuantityLimits || []);
|
|
2040
|
-
this.logMethodSuccess('getProductList', {
|
|
2041
|
-
menuCount: menuListIds.length
|
|
2042
|
-
});
|
|
2043
|
-
return _context26.abrupt("return", _formattedRes);
|
|
2044
|
-
case 16:
|
|
2045
|
-
_context26.prev = 16;
|
|
2046
|
-
_context26.t0 = _context26["catch"](7);
|
|
2047
|
-
this.logMethodError('getProductList', _context26.t0);
|
|
2048
|
-
throw _context26.t0;
|
|
2049
|
-
case 20:
|
|
2091
|
+
_context27.next = 2;
|
|
2092
|
+
return this.loadAllProducts();
|
|
2093
|
+
case 2:
|
|
2094
|
+
result = _context27.sent;
|
|
2095
|
+
return _context27.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2096
|
+
case 4:
|
|
2050
2097
|
case "end":
|
|
2051
|
-
return
|
|
2098
|
+
return _context27.stop();
|
|
2052
2099
|
}
|
|
2053
|
-
},
|
|
2100
|
+
}, _callee27, this);
|
|
2054
2101
|
}));
|
|
2055
2102
|
function getProductList() {
|
|
2056
2103
|
return _getProductList.apply(this, arguments);
|
|
@@ -2060,32 +2107,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2060
2107
|
}, {
|
|
2061
2108
|
key: "loadOpenDataConfig",
|
|
2062
2109
|
value: function () {
|
|
2063
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2110
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2064
2111
|
var openDataConfig;
|
|
2065
|
-
return _regeneratorRuntime().wrap(function
|
|
2066
|
-
while (1) switch (
|
|
2112
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2113
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2067
2114
|
case 0:
|
|
2068
2115
|
if (this.store.openData) {
|
|
2069
|
-
|
|
2116
|
+
_context28.next = 2;
|
|
2070
2117
|
break;
|
|
2071
2118
|
}
|
|
2072
2119
|
throw new Error('openData 模块未初始化');
|
|
2073
2120
|
case 2:
|
|
2074
|
-
|
|
2121
|
+
_context28.next = 4;
|
|
2075
2122
|
return this.store.openData.fetchOpenData({
|
|
2076
2123
|
scope: 'board',
|
|
2077
2124
|
target: 'venue_booking+online_store',
|
|
2078
2125
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2079
2126
|
});
|
|
2080
2127
|
case 4:
|
|
2081
|
-
openDataConfig =
|
|
2128
|
+
openDataConfig = _context28.sent;
|
|
2082
2129
|
this.otherParams.dineInConfig = openDataConfig;
|
|
2083
|
-
return
|
|
2130
|
+
return _context28.abrupt("return", openDataConfig);
|
|
2084
2131
|
case 7:
|
|
2085
2132
|
case "end":
|
|
2086
|
-
return
|
|
2133
|
+
return _context28.stop();
|
|
2087
2134
|
}
|
|
2088
|
-
},
|
|
2135
|
+
}, _callee28, this);
|
|
2089
2136
|
}));
|
|
2090
2137
|
function loadOpenDataConfig() {
|
|
2091
2138
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2095,29 +2142,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2095
2142
|
}, {
|
|
2096
2143
|
key: "loadRuntimeConfigs",
|
|
2097
2144
|
value: function () {
|
|
2098
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2145
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2099
2146
|
var itemRuleConfigs;
|
|
2100
|
-
return _regeneratorRuntime().wrap(function
|
|
2101
|
-
while (1) switch (
|
|
2147
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2148
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2102
2149
|
case 0:
|
|
2103
|
-
|
|
2150
|
+
_context29.next = 2;
|
|
2104
2151
|
return this.loadOpenDataConfig();
|
|
2105
2152
|
case 2:
|
|
2106
|
-
|
|
2153
|
+
_context29.next = 4;
|
|
2107
2154
|
return this.ensureItemRuleConfigsLoaded();
|
|
2108
2155
|
case 4:
|
|
2109
|
-
itemRuleConfigs =
|
|
2156
|
+
itemRuleConfigs = _context29.sent;
|
|
2110
2157
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2111
2158
|
itemRuleCount: itemRuleConfigs.length
|
|
2112
2159
|
});
|
|
2113
|
-
return
|
|
2160
|
+
return _context29.abrupt("return", {
|
|
2114
2161
|
itemRuleConfigs: itemRuleConfigs
|
|
2115
2162
|
});
|
|
2116
2163
|
case 7:
|
|
2117
2164
|
case "end":
|
|
2118
|
-
return
|
|
2165
|
+
return _context29.stop();
|
|
2119
2166
|
}
|
|
2120
|
-
},
|
|
2167
|
+
}, _callee29, this);
|
|
2121
2168
|
}));
|
|
2122
2169
|
function loadRuntimeConfigs() {
|
|
2123
2170
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -2127,22 +2174,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2127
2174
|
}, {
|
|
2128
2175
|
key: "fetchItemRuleConfigsByModelIds",
|
|
2129
2176
|
value: function () {
|
|
2130
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2177
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(strategyModelIds) {
|
|
2131
2178
|
var result, configs;
|
|
2132
|
-
return _regeneratorRuntime().wrap(function
|
|
2133
|
-
while (1) switch (
|
|
2179
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2180
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2134
2181
|
case 0:
|
|
2135
2182
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
2136
2183
|
strategyModelIds: strategyModelIds
|
|
2137
2184
|
});
|
|
2138
2185
|
if (strategyModelIds.length) {
|
|
2139
|
-
|
|
2186
|
+
_context30.next = 3;
|
|
2140
2187
|
break;
|
|
2141
2188
|
}
|
|
2142
|
-
return
|
|
2189
|
+
return _context30.abrupt("return", []);
|
|
2143
2190
|
case 3:
|
|
2144
|
-
|
|
2145
|
-
|
|
2191
|
+
_context30.prev = 3;
|
|
2192
|
+
_context30.next = 6;
|
|
2146
2193
|
return this.request.get('/promotion', {
|
|
2147
2194
|
skip: 1,
|
|
2148
2195
|
num: 99,
|
|
@@ -2150,7 +2197,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2150
2197
|
ids: strategyModelIds
|
|
2151
2198
|
});
|
|
2152
2199
|
case 6:
|
|
2153
|
-
result =
|
|
2200
|
+
result = _context30.sent;
|
|
2154
2201
|
configs = [];
|
|
2155
2202
|
if (result.code === 200) {
|
|
2156
2203
|
configs = result.data.list.map(function (item) {
|
|
@@ -2161,21 +2208,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2161
2208
|
strategyModelIds: strategyModelIds,
|
|
2162
2209
|
strategyCount: configs.length
|
|
2163
2210
|
});
|
|
2164
|
-
return
|
|
2211
|
+
return _context30.abrupt("return", configs);
|
|
2165
2212
|
case 13:
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
2213
|
+
_context30.prev = 13;
|
|
2214
|
+
_context30.t0 = _context30["catch"](3);
|
|
2215
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context30.t0, {
|
|
2169
2216
|
strategyModelIds: strategyModelIds
|
|
2170
2217
|
});
|
|
2171
|
-
return
|
|
2218
|
+
return _context30.abrupt("return", []);
|
|
2172
2219
|
case 17:
|
|
2173
2220
|
case "end":
|
|
2174
|
-
return
|
|
2221
|
+
return _context30.stop();
|
|
2175
2222
|
}
|
|
2176
|
-
},
|
|
2223
|
+
}, _callee30, this, [[3, 13]]);
|
|
2177
2224
|
}));
|
|
2178
|
-
function fetchItemRuleConfigsByModelIds(
|
|
2225
|
+
function fetchItemRuleConfigsByModelIds(_x18) {
|
|
2179
2226
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
2180
2227
|
}
|
|
2181
2228
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -2183,22 +2230,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2183
2230
|
}, {
|
|
2184
2231
|
key: "buildPrefillProductSourceMap",
|
|
2185
2232
|
value: function () {
|
|
2186
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2233
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2187
2234
|
var sourceMap, productList, visited, collectFromValue;
|
|
2188
|
-
return _regeneratorRuntime().wrap(function
|
|
2189
|
-
while (1) switch (
|
|
2235
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2236
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2190
2237
|
case 0:
|
|
2191
2238
|
sourceMap = new Map();
|
|
2192
|
-
|
|
2193
|
-
|
|
2239
|
+
_context31.prev = 1;
|
|
2240
|
+
_context31.next = 4;
|
|
2194
2241
|
return this.getProductList();
|
|
2195
2242
|
case 4:
|
|
2196
|
-
productList =
|
|
2243
|
+
productList = _context31.sent;
|
|
2197
2244
|
if (Array.isArray(productList)) {
|
|
2198
|
-
|
|
2245
|
+
_context31.next = 7;
|
|
2199
2246
|
break;
|
|
2200
2247
|
}
|
|
2201
|
-
return
|
|
2248
|
+
return _context31.abrupt("return", sourceMap);
|
|
2202
2249
|
case 7:
|
|
2203
2250
|
visited = new Set();
|
|
2204
2251
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -2207,17 +2254,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2207
2254
|
if (visited.has(value)) return;
|
|
2208
2255
|
visited.add(value);
|
|
2209
2256
|
if (Array.isArray(value)) {
|
|
2210
|
-
var
|
|
2211
|
-
|
|
2257
|
+
var _iterator8 = _createForOfIteratorHelper(value),
|
|
2258
|
+
_step8;
|
|
2212
2259
|
try {
|
|
2213
|
-
for (
|
|
2214
|
-
var item =
|
|
2260
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
2261
|
+
var item = _step8.value;
|
|
2215
2262
|
collectFromValue(item);
|
|
2216
2263
|
}
|
|
2217
2264
|
} catch (err) {
|
|
2218
|
-
|
|
2265
|
+
_iterator8.e(err);
|
|
2219
2266
|
} finally {
|
|
2220
|
-
|
|
2267
|
+
_iterator8.f();
|
|
2221
2268
|
}
|
|
2222
2269
|
return;
|
|
2223
2270
|
}
|
|
@@ -2237,19 +2284,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2237
2284
|
}
|
|
2238
2285
|
};
|
|
2239
2286
|
collectFromValue(productList);
|
|
2240
|
-
|
|
2287
|
+
_context31.next = 15;
|
|
2241
2288
|
break;
|
|
2242
2289
|
case 12:
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
2290
|
+
_context31.prev = 12;
|
|
2291
|
+
_context31.t0 = _context31["catch"](1);
|
|
2292
|
+
this.logMethodError('buildPrefillProductSourceMap', _context31.t0);
|
|
2246
2293
|
case 15:
|
|
2247
|
-
return
|
|
2294
|
+
return _context31.abrupt("return", sourceMap);
|
|
2248
2295
|
case 16:
|
|
2249
2296
|
case "end":
|
|
2250
|
-
return
|
|
2297
|
+
return _context31.stop();
|
|
2251
2298
|
}
|
|
2252
|
-
},
|
|
2299
|
+
}, _callee31, this, [[1, 12]]);
|
|
2253
2300
|
}));
|
|
2254
2301
|
function buildPrefillProductSourceMap() {
|
|
2255
2302
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -2264,56 +2311,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2264
2311
|
}, {
|
|
2265
2312
|
key: "ensureItemRuleConfigsLoaded",
|
|
2266
2313
|
value: function () {
|
|
2267
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2268
|
-
var
|
|
2269
|
-
return _regeneratorRuntime().wrap(function
|
|
2270
|
-
while (1) switch (
|
|
2314
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2315
|
+
var _this7 = this;
|
|
2316
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2317
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2271
2318
|
case 0:
|
|
2272
2319
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
2273
|
-
|
|
2320
|
+
_context33.next = 2;
|
|
2274
2321
|
break;
|
|
2275
2322
|
}
|
|
2276
|
-
return
|
|
2323
|
+
return _context33.abrupt("return", this.itemRuleConfigs);
|
|
2277
2324
|
case 2:
|
|
2278
2325
|
if (!this.itemRuleConfigsPromise) {
|
|
2279
|
-
|
|
2326
|
+
_context33.next = 4;
|
|
2280
2327
|
break;
|
|
2281
2328
|
}
|
|
2282
|
-
return
|
|
2329
|
+
return _context33.abrupt("return", this.itemRuleConfigsPromise);
|
|
2283
2330
|
case 4:
|
|
2284
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2331
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2285
2332
|
var runtimeConfig, staticConfigs;
|
|
2286
|
-
return _regeneratorRuntime().wrap(function
|
|
2287
|
-
while (1) switch (
|
|
2333
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2334
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2288
2335
|
case 0:
|
|
2289
|
-
runtimeConfig =
|
|
2336
|
+
runtimeConfig = _this7.getItemRuleRuntimeConfig();
|
|
2290
2337
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
2291
2338
|
if (!(staticConfigs.length > 0)) {
|
|
2292
|
-
|
|
2339
|
+
_context32.next = 6;
|
|
2293
2340
|
break;
|
|
2294
2341
|
}
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
return
|
|
2342
|
+
_this7.itemRuleConfigs = staticConfigs;
|
|
2343
|
+
_this7.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2344
|
+
return _context32.abrupt("return", _this7.itemRuleConfigs);
|
|
2298
2345
|
case 6:
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
return
|
|
2346
|
+
_this7.itemRuleConfigs = [];
|
|
2347
|
+
_this7.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2348
|
+
return _context32.abrupt("return", _this7.itemRuleConfigs);
|
|
2302
2349
|
case 9:
|
|
2303
2350
|
case "end":
|
|
2304
|
-
return
|
|
2351
|
+
return _context32.stop();
|
|
2305
2352
|
}
|
|
2306
|
-
},
|
|
2353
|
+
}, _callee32);
|
|
2307
2354
|
}))();
|
|
2308
|
-
|
|
2355
|
+
_context33.next = 7;
|
|
2309
2356
|
return this.itemRuleConfigsPromise;
|
|
2310
2357
|
case 7:
|
|
2311
|
-
return
|
|
2358
|
+
return _context33.abrupt("return", _context33.sent);
|
|
2312
2359
|
case 8:
|
|
2313
2360
|
case "end":
|
|
2314
|
-
return
|
|
2361
|
+
return _context33.stop();
|
|
2315
2362
|
}
|
|
2316
|
-
},
|
|
2363
|
+
}, _callee33, this);
|
|
2317
2364
|
}));
|
|
2318
2365
|
function ensureItemRuleConfigsLoaded() {
|
|
2319
2366
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -2323,22 +2370,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2323
2370
|
}, {
|
|
2324
2371
|
key: "refreshItemRuleQuantityLimits",
|
|
2325
2372
|
value: function () {
|
|
2326
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2373
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2327
2374
|
var strategyConfigs, businessData, limits;
|
|
2328
|
-
return _regeneratorRuntime().wrap(function
|
|
2329
|
-
while (1) switch (
|
|
2375
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2376
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2330
2377
|
case 0:
|
|
2331
|
-
|
|
2332
|
-
|
|
2378
|
+
_context34.prev = 0;
|
|
2379
|
+
_context34.next = 3;
|
|
2333
2380
|
return this.ensureItemRuleConfigsLoaded();
|
|
2334
2381
|
case 3:
|
|
2335
|
-
strategyConfigs =
|
|
2382
|
+
strategyConfigs = _context34.sent;
|
|
2336
2383
|
if (strategyConfigs.length) {
|
|
2337
|
-
|
|
2384
|
+
_context34.next = 7;
|
|
2338
2385
|
break;
|
|
2339
2386
|
}
|
|
2340
2387
|
this.store.itemRuleQuantityLimits = [];
|
|
2341
|
-
return
|
|
2388
|
+
return _context34.abrupt("return", []);
|
|
2342
2389
|
case 7:
|
|
2343
2390
|
businessData = buildItemRuleBusinessData({
|
|
2344
2391
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -2350,18 +2397,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2350
2397
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
2351
2398
|
limitCount: limits.length
|
|
2352
2399
|
});
|
|
2353
|
-
return
|
|
2400
|
+
return _context34.abrupt("return", limits);
|
|
2354
2401
|
case 14:
|
|
2355
|
-
|
|
2356
|
-
|
|
2402
|
+
_context34.prev = 14;
|
|
2403
|
+
_context34.t0 = _context34["catch"](0);
|
|
2357
2404
|
this.store.itemRuleQuantityLimits = [];
|
|
2358
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
2359
|
-
return
|
|
2405
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context34.t0);
|
|
2406
|
+
return _context34.abrupt("return", []);
|
|
2360
2407
|
case 19:
|
|
2361
2408
|
case "end":
|
|
2362
|
-
return
|
|
2409
|
+
return _context34.stop();
|
|
2363
2410
|
}
|
|
2364
|
-
},
|
|
2411
|
+
}, _callee34, this, [[0, 14]]);
|
|
2365
2412
|
}));
|
|
2366
2413
|
function refreshItemRuleQuantityLimits() {
|
|
2367
2414
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -2371,32 +2418,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2371
2418
|
}, {
|
|
2372
2419
|
key: "applyPrefillByItemRule",
|
|
2373
2420
|
value: function () {
|
|
2374
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2375
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
2376
|
-
return _regeneratorRuntime().wrap(function
|
|
2377
|
-
while (1) switch (
|
|
2421
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2422
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator9, _step9, _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;
|
|
2423
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2424
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2378
2425
|
case 0:
|
|
2379
2426
|
if (!this.itemRulePrefillApplied) {
|
|
2380
|
-
|
|
2427
|
+
_context35.next = 2;
|
|
2381
2428
|
break;
|
|
2382
2429
|
}
|
|
2383
|
-
return
|
|
2430
|
+
return _context35.abrupt("return");
|
|
2384
2431
|
case 2:
|
|
2385
2432
|
if (this.store.order) {
|
|
2386
|
-
|
|
2433
|
+
_context35.next = 4;
|
|
2387
2434
|
break;
|
|
2388
2435
|
}
|
|
2389
|
-
return
|
|
2436
|
+
return _context35.abrupt("return");
|
|
2390
2437
|
case 4:
|
|
2391
|
-
|
|
2438
|
+
_context35.next = 6;
|
|
2392
2439
|
return this.ensureItemRuleConfigsLoaded();
|
|
2393
2440
|
case 6:
|
|
2394
|
-
strategyConfigs =
|
|
2441
|
+
strategyConfigs = _context35.sent;
|
|
2395
2442
|
if (strategyConfigs.length) {
|
|
2396
|
-
|
|
2443
|
+
_context35.next = 9;
|
|
2397
2444
|
break;
|
|
2398
2445
|
}
|
|
2399
|
-
return
|
|
2446
|
+
return _context35.abrupt("return");
|
|
2400
2447
|
case 9:
|
|
2401
2448
|
businessData = buildItemRuleBusinessData({
|
|
2402
2449
|
tempOrder: this.ensureTempOrder(),
|
|
@@ -2405,41 +2452,41 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2405
2452
|
});
|
|
2406
2453
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
2407
2454
|
if (prefillItems.length) {
|
|
2408
|
-
|
|
2455
|
+
_context35.next = 14;
|
|
2409
2456
|
break;
|
|
2410
2457
|
}
|
|
2411
2458
|
this.itemRulePrefillApplied = true;
|
|
2412
|
-
return
|
|
2459
|
+
return _context35.abrupt("return");
|
|
2413
2460
|
case 14:
|
|
2414
|
-
|
|
2461
|
+
_context35.next = 16;
|
|
2415
2462
|
return this.buildPrefillProductSourceMap();
|
|
2416
2463
|
case 16:
|
|
2417
|
-
productSourceMap =
|
|
2464
|
+
productSourceMap = _context35.sent;
|
|
2418
2465
|
tempOrder = this.ensureTempOrder();
|
|
2419
2466
|
hasChanges = false;
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2467
|
+
_iterator9 = _createForOfIteratorHelper(prefillItems);
|
|
2468
|
+
_context35.prev = 20;
|
|
2469
|
+
_iterator9.s();
|
|
2423
2470
|
case 22:
|
|
2424
|
-
if ((
|
|
2425
|
-
|
|
2471
|
+
if ((_step9 = _iterator9.n()).done) {
|
|
2472
|
+
_context35.next = 47;
|
|
2426
2473
|
break;
|
|
2427
2474
|
}
|
|
2428
|
-
prefillItem =
|
|
2475
|
+
prefillItem = _step9.value;
|
|
2429
2476
|
productId = Number(prefillItem.product_id);
|
|
2430
2477
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
2431
2478
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
2432
2479
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
2433
|
-
|
|
2480
|
+
_context35.next = 29;
|
|
2434
2481
|
break;
|
|
2435
2482
|
}
|
|
2436
|
-
return
|
|
2483
|
+
return _context35.abrupt("continue", 45);
|
|
2437
2484
|
case 29:
|
|
2438
2485
|
if (!Number.isNaN(productVariantId)) {
|
|
2439
|
-
|
|
2486
|
+
_context35.next = 31;
|
|
2440
2487
|
break;
|
|
2441
2488
|
}
|
|
2442
|
-
return
|
|
2489
|
+
return _context35.abrupt("continue", 45);
|
|
2443
2490
|
case 31:
|
|
2444
2491
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
2445
2492
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -2447,7 +2494,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2447
2494
|
product_variant_id: productVariantId
|
|
2448
2495
|
});
|
|
2449
2496
|
if (!(productIndex === -1)) {
|
|
2450
|
-
|
|
2497
|
+
_context35.next = 40;
|
|
2451
2498
|
break;
|
|
2452
2499
|
}
|
|
2453
2500
|
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');
|
|
@@ -2470,7 +2517,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2470
2517
|
})
|
|
2471
2518
|
}));
|
|
2472
2519
|
hasChanges = true;
|
|
2473
|
-
return
|
|
2520
|
+
return _context35.abrupt("continue", 45);
|
|
2474
2521
|
case 40:
|
|
2475
2522
|
targetProduct = tempOrder.products[productIndex];
|
|
2476
2523
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
@@ -2489,32 +2536,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2489
2536
|
hasChanges = true;
|
|
2490
2537
|
}
|
|
2491
2538
|
case 45:
|
|
2492
|
-
|
|
2539
|
+
_context35.next = 22;
|
|
2493
2540
|
break;
|
|
2494
2541
|
case 47:
|
|
2495
|
-
|
|
2542
|
+
_context35.next = 52;
|
|
2496
2543
|
break;
|
|
2497
2544
|
case 49:
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2545
|
+
_context35.prev = 49;
|
|
2546
|
+
_context35.t0 = _context35["catch"](20);
|
|
2547
|
+
_iterator9.e(_context35.t0);
|
|
2501
2548
|
case 52:
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
return
|
|
2549
|
+
_context35.prev = 52;
|
|
2550
|
+
_iterator9.f();
|
|
2551
|
+
return _context35.finish(52);
|
|
2505
2552
|
case 55:
|
|
2506
2553
|
if (!hasChanges) {
|
|
2507
|
-
|
|
2554
|
+
_context35.next = 59;
|
|
2508
2555
|
break;
|
|
2509
2556
|
}
|
|
2510
|
-
|
|
2557
|
+
_context35.next = 58;
|
|
2511
2558
|
return this.store.order.recalculateSummary({
|
|
2512
2559
|
createIfMissing: true
|
|
2513
2560
|
});
|
|
2514
2561
|
case 58:
|
|
2515
2562
|
this.store.order.persistTempOrder();
|
|
2516
2563
|
case 59:
|
|
2517
|
-
|
|
2564
|
+
_context35.next = 61;
|
|
2518
2565
|
return this.refreshItemRuleQuantityLimits();
|
|
2519
2566
|
case 61:
|
|
2520
2567
|
this.itemRulePrefillApplied = true;
|
|
@@ -2524,9 +2571,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2524
2571
|
});
|
|
2525
2572
|
case 63:
|
|
2526
2573
|
case "end":
|
|
2527
|
-
return
|
|
2574
|
+
return _context35.stop();
|
|
2528
2575
|
}
|
|
2529
|
-
},
|
|
2576
|
+
}, _callee35, this, [[20, 49, 52, 55]]);
|
|
2530
2577
|
}));
|
|
2531
2578
|
function applyPrefillByItemRule() {
|
|
2532
2579
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -2536,24 +2583,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2536
2583
|
}, {
|
|
2537
2584
|
key: "applyItemRulePrefill",
|
|
2538
2585
|
value: function () {
|
|
2539
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2540
|
-
return _regeneratorRuntime().wrap(function
|
|
2541
|
-
while (1) switch (
|
|
2586
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2587
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2588
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2542
2589
|
case 0:
|
|
2543
2590
|
this.logMethodStart('applyItemRulePrefill');
|
|
2544
|
-
|
|
2591
|
+
_context36.next = 3;
|
|
2545
2592
|
return this.applyPrefillByItemRule();
|
|
2546
2593
|
case 3:
|
|
2547
|
-
|
|
2594
|
+
_context36.next = 5;
|
|
2548
2595
|
return this.refreshItemRuleQuantityLimits();
|
|
2549
2596
|
case 5:
|
|
2550
|
-
|
|
2597
|
+
_context36.next = 7;
|
|
2551
2598
|
return this.refreshCartValidationPassed();
|
|
2552
2599
|
case 7:
|
|
2553
2600
|
case "end":
|
|
2554
|
-
return
|
|
2601
|
+
return _context36.stop();
|
|
2555
2602
|
}
|
|
2556
|
-
},
|
|
2603
|
+
}, _callee36, this);
|
|
2557
2604
|
}));
|
|
2558
2605
|
function applyItemRulePrefill() {
|
|
2559
2606
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -2563,20 +2610,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2563
2610
|
}, {
|
|
2564
2611
|
key: "evaluateCartValidationByItemRule",
|
|
2565
2612
|
value: function () {
|
|
2566
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2613
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
2567
2614
|
var strategyConfigs, businessData;
|
|
2568
|
-
return _regeneratorRuntime().wrap(function
|
|
2569
|
-
while (1) switch (
|
|
2615
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
2616
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2570
2617
|
case 0:
|
|
2571
|
-
|
|
2618
|
+
_context37.next = 2;
|
|
2572
2619
|
return this.ensureItemRuleConfigsLoaded();
|
|
2573
2620
|
case 2:
|
|
2574
|
-
strategyConfigs =
|
|
2621
|
+
strategyConfigs = _context37.sent;
|
|
2575
2622
|
if (strategyConfigs.length) {
|
|
2576
|
-
|
|
2623
|
+
_context37.next = 5;
|
|
2577
2624
|
break;
|
|
2578
2625
|
}
|
|
2579
|
-
return
|
|
2626
|
+
return _context37.abrupt("return", {
|
|
2580
2627
|
passed: true,
|
|
2581
2628
|
failures: []
|
|
2582
2629
|
});
|
|
@@ -2586,12 +2633,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2586
2633
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
2587
2634
|
itemRuleConfigs: this.itemRuleConfigs
|
|
2588
2635
|
});
|
|
2589
|
-
return
|
|
2636
|
+
return _context37.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
2590
2637
|
case 7:
|
|
2591
2638
|
case "end":
|
|
2592
|
-
return
|
|
2639
|
+
return _context37.stop();
|
|
2593
2640
|
}
|
|
2594
|
-
},
|
|
2641
|
+
}, _callee37, this);
|
|
2595
2642
|
}));
|
|
2596
2643
|
function evaluateCartValidationByItemRule() {
|
|
2597
2644
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -2601,20 +2648,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2601
2648
|
}, {
|
|
2602
2649
|
key: "validateBeforeSubmitByItemRule",
|
|
2603
2650
|
value: function () {
|
|
2604
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2651
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
2605
2652
|
var validationResult, firstFailure, errorMessage, error;
|
|
2606
|
-
return _regeneratorRuntime().wrap(function
|
|
2607
|
-
while (1) switch (
|
|
2653
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2654
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
2608
2655
|
case 0:
|
|
2609
|
-
|
|
2656
|
+
_context38.next = 2;
|
|
2610
2657
|
return this.evaluateCartValidationByItemRule();
|
|
2611
2658
|
case 2:
|
|
2612
|
-
validationResult =
|
|
2659
|
+
validationResult = _context38.sent;
|
|
2613
2660
|
if (!validationResult.passed) {
|
|
2614
|
-
|
|
2661
|
+
_context38.next = 5;
|
|
2615
2662
|
break;
|
|
2616
2663
|
}
|
|
2617
|
-
return
|
|
2664
|
+
return _context38.abrupt("return");
|
|
2618
2665
|
case 5:
|
|
2619
2666
|
firstFailure = validationResult.failures[0];
|
|
2620
2667
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -2623,9 +2670,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2623
2670
|
throw error;
|
|
2624
2671
|
case 10:
|
|
2625
2672
|
case "end":
|
|
2626
|
-
return
|
|
2673
|
+
return _context38.stop();
|
|
2627
2674
|
}
|
|
2628
|
-
},
|
|
2675
|
+
}, _callee38, this);
|
|
2629
2676
|
}));
|
|
2630
2677
|
function validateBeforeSubmitByItemRule() {
|
|
2631
2678
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -2635,10 +2682,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2635
2682
|
}, {
|
|
2636
2683
|
key: "refreshCartValidationPassed",
|
|
2637
2684
|
value: function () {
|
|
2638
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2685
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
2639
2686
|
var previous, nextState, validationResult, changed;
|
|
2640
|
-
return _regeneratorRuntime().wrap(function
|
|
2641
|
-
while (1) switch (
|
|
2687
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
2688
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
2642
2689
|
case 0:
|
|
2643
2690
|
previous = this.store.cartValidation || {
|
|
2644
2691
|
passed: null,
|
|
@@ -2648,20 +2695,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2648
2695
|
passed: null,
|
|
2649
2696
|
failures: []
|
|
2650
2697
|
};
|
|
2651
|
-
|
|
2652
|
-
|
|
2698
|
+
_context39.prev = 2;
|
|
2699
|
+
_context39.next = 5;
|
|
2653
2700
|
return this.evaluateCartValidationByItemRule();
|
|
2654
2701
|
case 5:
|
|
2655
|
-
validationResult =
|
|
2702
|
+
validationResult = _context39.sent;
|
|
2656
2703
|
nextState = {
|
|
2657
2704
|
passed: validationResult.passed,
|
|
2658
2705
|
failures: validationResult.failures || []
|
|
2659
2706
|
};
|
|
2660
|
-
|
|
2707
|
+
_context39.next = 12;
|
|
2661
2708
|
break;
|
|
2662
2709
|
case 9:
|
|
2663
|
-
|
|
2664
|
-
|
|
2710
|
+
_context39.prev = 9;
|
|
2711
|
+
_context39.t0 = _context39["catch"](2);
|
|
2665
2712
|
nextState = {
|
|
2666
2713
|
passed: false,
|
|
2667
2714
|
failures: []
|
|
@@ -2670,21 +2717,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2670
2717
|
this.store.cartValidation = nextState;
|
|
2671
2718
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
2672
2719
|
if (!changed) {
|
|
2673
|
-
|
|
2720
|
+
_context39.next = 17;
|
|
2674
2721
|
break;
|
|
2675
2722
|
}
|
|
2676
|
-
|
|
2723
|
+
_context39.next = 17;
|
|
2677
2724
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
2678
2725
|
cartValidation: nextState,
|
|
2679
2726
|
cartValidationPassed: nextState.passed
|
|
2680
2727
|
});
|
|
2681
2728
|
case 17:
|
|
2682
|
-
return
|
|
2729
|
+
return _context39.abrupt("return", nextState.passed);
|
|
2683
2730
|
case 18:
|
|
2684
2731
|
case "end":
|
|
2685
|
-
return
|
|
2732
|
+
return _context39.stop();
|
|
2686
2733
|
}
|
|
2687
|
-
},
|
|
2734
|
+
}, _callee39, this, [[2, 9]]);
|
|
2688
2735
|
}));
|
|
2689
2736
|
function refreshCartValidationPassed() {
|
|
2690
2737
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -2694,14 +2741,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2694
2741
|
}, {
|
|
2695
2742
|
key: "setItemRuleRuntimeConfig",
|
|
2696
2743
|
value: function () {
|
|
2697
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2744
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
2698
2745
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
2699
2746
|
var config,
|
|
2700
|
-
|
|
2701
|
-
return _regeneratorRuntime().wrap(function
|
|
2702
|
-
while (1) switch (
|
|
2747
|
+
_args40 = arguments;
|
|
2748
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
2749
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
2703
2750
|
case 0:
|
|
2704
|
-
config =
|
|
2751
|
+
config = _args40.length > 0 && _args40[0] !== undefined ? _args40[0] : {};
|
|
2705
2752
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
2706
2753
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
2707
2754
|
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) || {}),
|
|
@@ -2713,10 +2760,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2713
2760
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2714
2761
|
}
|
|
2715
2762
|
this.itemRulePrefillApplied = false;
|
|
2716
|
-
|
|
2763
|
+
_context40.next = 7;
|
|
2717
2764
|
return this.refreshItemRuleQuantityLimits();
|
|
2718
2765
|
case 7:
|
|
2719
|
-
|
|
2766
|
+
_context40.next = 9;
|
|
2720
2767
|
return this.refreshCartValidationPassed();
|
|
2721
2768
|
case 9:
|
|
2722
2769
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -2724,9 +2771,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2724
2771
|
});
|
|
2725
2772
|
case 10:
|
|
2726
2773
|
case "end":
|
|
2727
|
-
return
|
|
2774
|
+
return _context40.stop();
|
|
2728
2775
|
}
|
|
2729
|
-
},
|
|
2776
|
+
}, _callee40, this);
|
|
2730
2777
|
}));
|
|
2731
2778
|
function setItemRuleRuntimeConfig() {
|
|
2732
2779
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -2743,25 +2790,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2743
2790
|
}, {
|
|
2744
2791
|
key: "checkOpenDataAvailability",
|
|
2745
2792
|
value: function () {
|
|
2746
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2747
|
-
return _regeneratorRuntime().wrap(function
|
|
2748
|
-
while (1) switch (
|
|
2793
|
+
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
2794
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
2795
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
2749
2796
|
case 0:
|
|
2750
2797
|
if (this.store.openData) {
|
|
2751
|
-
|
|
2798
|
+
_context41.next = 2;
|
|
2752
2799
|
break;
|
|
2753
2800
|
}
|
|
2754
2801
|
throw new Error('openData 模块未初始化');
|
|
2755
2802
|
case 2:
|
|
2756
|
-
|
|
2803
|
+
_context41.next = 4;
|
|
2757
2804
|
return this.loadOpenDataConfig();
|
|
2758
2805
|
case 4:
|
|
2759
|
-
return
|
|
2806
|
+
return _context41.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
2760
2807
|
case 5:
|
|
2761
2808
|
case "end":
|
|
2762
|
-
return
|
|
2809
|
+
return _context41.stop();
|
|
2763
2810
|
}
|
|
2764
|
-
},
|
|
2811
|
+
}, _callee41, this);
|
|
2765
2812
|
}));
|
|
2766
2813
|
function checkOpenDataAvailability() {
|
|
2767
2814
|
return _checkOpenDataAvailability.apply(this, arguments);
|