@pisell/pisellos 0.10.20 → 0.10.22

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.
Files changed (88) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BookingContext/index.d.ts +3 -0
  3. package/dist/modules/BookingContext/index.js +42 -13
  4. package/dist/modules/BookingContext/types.d.ts +4 -4
  5. package/dist/modules/BookingContext/types.js +3 -3
  6. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -7
  7. package/dist/modules/OpenData/index.d.ts +10 -1
  8. package/dist/modules/OpenData/index.js +268 -14
  9. package/dist/modules/OpenData/types.d.ts +14 -1
  10. package/dist/modules/OpenData/utils.d.ts +1 -0
  11. package/dist/modules/OpenData/utils.js +8 -5
  12. package/dist/modules/Order/index.d.ts +6 -1
  13. package/dist/modules/Order/index.js +148 -84
  14. package/dist/modules/ProductList/clientDataVariants.d.ts +50 -0
  15. package/dist/modules/ProductList/clientDataVariants.js +216 -0
  16. package/dist/modules/ProductList/index.d.ts +14 -13
  17. package/dist/modules/ProductList/index.js +105 -77
  18. package/dist/modules/Quotation/index.d.ts +16 -0
  19. package/dist/modules/Quotation/index.js +240 -27
  20. package/dist/modules/ResourcePlanner/planner.d.ts +2 -2
  21. package/dist/modules/ResourcePlanner/planner.js +88 -21
  22. package/dist/modules/ResourcePlanner/types.d.ts +12 -0
  23. package/dist/modules/Rules/index.d.ts +5 -0
  24. package/dist/modules/Rules/index.js +27 -12
  25. package/dist/plugins/request.d.ts +2 -1
  26. package/dist/plugins/request.js +4 -2
  27. package/dist/server/index.js +33 -16
  28. package/dist/solution/BaseSales/index.d.ts +16 -1
  29. package/dist/solution/BaseSales/index.js +690 -349
  30. package/dist/solution/BookingByStep/index.d.ts +1 -1
  31. package/dist/solution/BookingTicket/index.d.ts +14 -2
  32. package/dist/solution/BookingTicket/index.js +25 -18
  33. package/dist/solution/Sales/index.js +29 -22
  34. package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
  35. package/dist/solution/UnifiedBookingSales/index.js +315 -99
  36. package/dist/solution/UnifiedBookingSales/types.d.ts +4 -0
  37. package/dist/solution/VenueBooking/index.d.ts +2 -0
  38. package/dist/solution/VenueBooking/index.js +542 -494
  39. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  40. package/dist/solution/VenueBooking/utils/dateSummary.js +3 -1
  41. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  42. package/dist/solution/VenueBooking/utils/slotMerge.js +3 -1
  43. package/dist/utils/platform.d.ts +8 -0
  44. package/dist/utils/platform.js +15 -0
  45. package/lib/modules/BookingContext/index.d.ts +3 -0
  46. package/lib/modules/BookingContext/index.js +35 -8
  47. package/lib/modules/BookingContext/types.d.ts +4 -4
  48. package/lib/modules/BookingContext/types.js +3 -3
  49. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +4 -0
  50. package/lib/modules/OpenData/index.d.ts +10 -1
  51. package/lib/modules/OpenData/index.js +162 -2
  52. package/lib/modules/OpenData/types.d.ts +14 -1
  53. package/lib/modules/OpenData/utils.d.ts +1 -0
  54. package/lib/modules/OpenData/utils.js +9 -5
  55. package/lib/modules/Order/index.d.ts +6 -1
  56. package/lib/modules/Order/index.js +65 -8
  57. package/lib/modules/ProductList/clientDataVariants.d.ts +50 -0
  58. package/lib/modules/ProductList/clientDataVariants.js +204 -0
  59. package/lib/modules/ProductList/index.d.ts +14 -13
  60. package/lib/modules/ProductList/index.js +77 -58
  61. package/lib/modules/Quotation/index.d.ts +16 -0
  62. package/lib/modules/Quotation/index.js +112 -9
  63. package/lib/modules/ResourcePlanner/planner.d.ts +2 -2
  64. package/lib/modules/ResourcePlanner/planner.js +80 -20
  65. package/lib/modules/ResourcePlanner/types.d.ts +12 -0
  66. package/lib/modules/Rules/index.d.ts +5 -0
  67. package/lib/modules/Rules/index.js +20 -11
  68. package/lib/plugins/request.d.ts +2 -1
  69. package/lib/plugins/request.js +3 -2
  70. package/lib/server/index.js +16 -1
  71. package/lib/solution/BaseSales/index.d.ts +16 -1
  72. package/lib/solution/BaseSales/index.js +314 -66
  73. package/lib/solution/BookingByStep/index.d.ts +1 -1
  74. package/lib/solution/BookingTicket/index.d.ts +14 -2
  75. package/lib/solution/BookingTicket/index.js +3 -0
  76. package/lib/solution/Sales/index.js +3 -0
  77. package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
  78. package/lib/solution/UnifiedBookingSales/index.js +228 -20
  79. package/lib/solution/UnifiedBookingSales/types.d.ts +4 -0
  80. package/lib/solution/VenueBooking/index.d.ts +2 -0
  81. package/lib/solution/VenueBooking/index.js +28 -8
  82. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  83. package/lib/solution/VenueBooking/utils/dateSummary.js +3 -1
  84. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  85. package/lib/solution/VenueBooking/utils/slotMerge.js +3 -1
  86. package/lib/utils/platform.d.ts +8 -0
  87. package/lib/utils/platform.js +22 -0
  88. package/package.json +1 -1
@@ -43,6 +43,8 @@ import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromD
43
43
  import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
44
44
  import dayjs from 'dayjs';
45
45
  export * from "./types";
46
+ import { isProductQueryHandledByOsServer, PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants, tryResolveClientDataVariants } from "../../modules/ProductList/clientDataVariants";
47
+ import { isCustomerUserPlatform } from "../../utils/platform";
46
48
  import { QuotationModule } from "../../modules/Quotation";
47
49
  import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
48
50
  import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
@@ -293,6 +295,24 @@ function normalizeBaseSalesRecordCollections(sourceRecord, options) {
293
295
  }
294
296
  return normalizedRecord;
295
297
  }
298
+ function isValidBaseSalesSmallTicketDataSnapshot(value) {
299
+ if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return false;
300
+ var localeSnapshots = Object.values(value);
301
+ return localeSnapshots.length > 0 && localeSnapshots.some(function (localeSnapshot) {
302
+ return localeSnapshot !== null && _typeof(localeSnapshot) === 'object' && !Array.isArray(localeSnapshot);
303
+ });
304
+ }
305
+ function mergeBaseSalesSmallTicketDataSnapshot(currentValue, loadedValue) {
306
+ if (isValidBaseSalesSmallTicketDataSnapshot(loadedValue)) {
307
+ return cloneDeep(loadedValue);
308
+ }
309
+ if (isValidBaseSalesSmallTicketDataSnapshot(currentValue)) {
310
+ return cloneDeep(currentValue);
311
+ }
312
+ if (loadedValue !== undefined) return cloneDeep(loadedValue);
313
+ if (currentValue !== undefined) return cloneDeep(currentValue);
314
+ return undefined;
315
+ }
296
316
  function getBaseSalesMetadataUid(item, metadataKey) {
297
317
  var _item$metadata$metada, _item$metadata;
298
318
  var uid = (_item$metadata$metada = item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata[metadataKey]) !== null && _item$metadata$metada !== void 0 ? _item$metadata$metada : item === null || item === void 0 ? void 0 : item[metadataKey];
@@ -333,6 +353,11 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
333
353
  });
334
354
  var uidRemaps = [];
335
355
  var mergedRecord = mergeWith(normalizedCurrentTempOrder, normalizedLoadedRecord, function (currentValue, loadedValue, key) {
356
+ // small_ticket_data 是由 Server 一次性生成的完整展示快照,不能递归进入
357
+ // locale 内部继续套用订单集合或普通数组的合并规则。
358
+ if (key === 'small_ticket_data') {
359
+ return mergeBaseSalesSmallTicketDataSnapshot(currentValue, loadedValue);
360
+ }
336
361
  var collectionKind = getBaseSalesOrderCollectionKind(key);
337
362
  if (collectionKind && Array.isArray(loadedValue)) {
338
363
  return mergeBaseSalesOrderCollection(collectionKind, Array.isArray(currentValue) ? currentValue : [], loadedValue, strategy, uidRemaps);
@@ -863,7 +888,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
863
888
  key: "loadQuotationForPriceQuery",
864
889
  value: function () {
865
890
  var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
866
- var _this$otherParams;
891
+ var quotation, load;
867
892
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
868
893
  while (1) switch (_context6.prev = _context6.next) {
869
894
  case 0:
@@ -874,12 +899,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
874
899
  return _context6.abrupt("return");
875
900
  case 2:
876
901
  this.applyQuotationScheduleResolver(params.quotation);
877
- _context6.next = 5;
878
- return params.quotation.loadQuotations({
879
- channel: params.channel || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel),
902
+ quotation = params.quotation;
903
+ load = typeof quotation.ensureQuotations === 'function' ? quotation.ensureQuotations.bind(quotation) : quotation.loadQuotations.bind(quotation);
904
+ _context6.next = 7;
905
+ return load({
906
+ channel: this.getPriceQueryChannel(params.channel),
880
907
  customer_id: params.customer_id
881
908
  });
882
- case 5:
909
+ case 7:
883
910
  case "end":
884
911
  return _context6.stop();
885
912
  }
@@ -906,9 +933,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
906
933
  }, {
907
934
  key: "getPriceQueryChannel",
908
935
  value: function getPriceQueryChannel(channel) {
909
- var _this$otherParams2, _ref12, _ref13, _this$otherParams3, _this$otherParams4;
910
- var strategyContext = (_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.strategy_context && _typeof(this.otherParams.strategy_context) === 'object' ? this.otherParams.strategy_context : {};
911
- var value = (_ref12 = (_ref13 = channel !== null && channel !== void 0 ? channel : strategyContext.channel) !== null && _ref13 !== void 0 ? _ref13 : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel) !== null && _ref12 !== void 0 ? _ref12 : (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform;
936
+ var _this$otherParams, _ref12, _ref13, _this$otherParams2, _this$otherParams3;
937
+ var strategyContext = (_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.strategy_context && _typeof(this.otherParams.strategy_context) === 'object' ? this.otherParams.strategy_context : {};
938
+ var value = (_ref12 = (_ref13 = channel !== null && channel !== void 0 ? channel : strategyContext.channel) !== null && _ref13 !== void 0 ? _ref13 : (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel) !== null && _ref12 !== void 0 ? _ref12 : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.platform;
912
939
  if (value === undefined || value === null || String(value).trim() === '') {
913
940
  return undefined;
914
941
  }
@@ -921,11 +948,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
921
948
  }, {
922
949
  key: "getPriceQueryStrategyContext",
923
950
  value: function getPriceQueryStrategyContext(channel) {
924
- var _this$otherParams5, _ref14, _strategyContext$busi, _this$otherParams6, _this$otherParams7;
925
- var inherited = (_this$otherParams5 = this.otherParams) !== null && _this$otherParams5 !== void 0 && _this$otherParams5.strategy_context && _typeof(this.otherParams.strategy_context) === 'object' ? this.otherParams.strategy_context : {};
951
+ var _this$otherParams4, _ref14, _strategyContext$busi, _this$otherParams5, _this$otherParams6;
952
+ var inherited = (_this$otherParams4 = this.otherParams) !== null && _this$otherParams4 !== void 0 && _this$otherParams4.strategy_context && _typeof(this.otherParams.strategy_context) === 'object' ? this.otherParams.strategy_context : {};
926
953
  var strategyContext = _objectSpread({}, inherited);
927
954
  var resolvedChannel = this.getPriceQueryChannel(channel);
928
- var businessCode = (_ref14 = (_strategyContext$busi = strategyContext.business_code) !== null && _strategyContext$busi !== void 0 ? _strategyContext$busi : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) !== null && _ref14 !== void 0 ? _ref14 : (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.business_code;
955
+ var businessCode = (_ref14 = (_strategyContext$busi = strategyContext.business_code) !== null && _strategyContext$busi !== void 0 ? _strategyContext$busi : (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode) !== null && _ref14 !== void 0 ? _ref14 : (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.business_code;
929
956
  if (resolvedChannel) strategyContext.channel = resolvedChannel;
930
957
  if (businessCode !== undefined && businessCode !== null && String(businessCode).trim() !== '') {
931
958
  strategyContext.business_code = String(businessCode).trim();
@@ -995,11 +1022,167 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
995
1022
  schedule_datetime: now.format('YYYY-MM-DD HH:mm:ss')
996
1023
  };
997
1024
  }
1025
+ }, {
1026
+ key: "isCustomerUserPriceQuery",
1027
+ value: function isCustomerUserPriceQuery() {
1028
+ var _this$otherParams7;
1029
+ return isCustomerUserPlatform((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.platform);
1030
+ }
1031
+ }, {
1032
+ key: "getPriceQueryScheduleList",
1033
+ value: function getPriceQueryScheduleList() {
1034
+ var _this$store$schedule, _this$store$schedule$, _this$core3;
1035
+ var storeScheduleList = (_this$store$schedule = this.store.schedule) === null || _this$store$schedule === void 0 || (_this$store$schedule$ = _this$store$schedule.getScheduleList) === null || _this$store$schedule$ === void 0 ? void 0 : _this$store$schedule$.call(_this$store$schedule);
1036
+ if (Array.isArray(storeScheduleList) && storeScheduleList.length > 0) {
1037
+ return storeScheduleList;
1038
+ }
1039
+ var contextScheduleList = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.scheduleList;
1040
+ return Array.isArray(contextScheduleList) && contextScheduleList.length > 0 ? contextScheduleList : undefined;
1041
+ }
1042
+ }, {
1043
+ key: "buildPriceQueryPayload",
1044
+ value: function buildPriceQueryPayload(params) {
1045
+ var channel = this.getPriceQueryChannel(params.channel);
1046
+ var strategyContext = this.getPriceQueryStrategyContext(channel);
1047
+ return _objectSpread(_objectSpread({
1048
+ ids: params.ids
1049
+ }, this.isCustomerUserPriceQuery() ? {} : {
1050
+ open_quotation: 1
1051
+ }), {}, {
1052
+ open_bundle: 1,
1053
+ with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
1054
+ status: 'published',
1055
+ num: Math.max(params.ids.length, 1),
1056
+ skip: 1,
1057
+ customer_id: params.customerId,
1058
+ schedule_date: params.schedule.schedule_date,
1059
+ schedule_datetime: params.schedule.schedule_datetime,
1060
+ application_code: channel
1061
+ }, Object.keys(strategyContext).length ? {
1062
+ strategy_context: strategyContext
1063
+ } : {});
1064
+ }
1065
+ }, {
1066
+ key: "getRawProductPriceSources",
1067
+ value: function getRawProductPriceSources(ids) {
1068
+ var products = this.store.products;
1069
+ if (typeof (products === null || products === void 0 ? void 0 : products.getRawProductPriceSources) !== 'function') {
1070
+ return new Map();
1071
+ }
1072
+ try {
1073
+ var result = products.getRawProductPriceSources(ids);
1074
+ return result instanceof Map ? result : new Map();
1075
+ } catch (error) {
1076
+ this.logWarning('getRawProductPriceSources: 读取商品原始报价源失败', {
1077
+ ids: ids,
1078
+ error: error instanceof Error ? error.message : String(error)
1079
+ });
1080
+ return new Map();
1081
+ }
1082
+ }
1083
+ }, {
1084
+ key: "rememberRawProductPriceSources",
1085
+ value: function rememberRawProductPriceSources(products) {
1086
+ var productList = this.store.products;
1087
+ if (typeof (productList === null || productList === void 0 ? void 0 : productList.rememberRawProductQueryResult) !== 'function') return;
1088
+ try {
1089
+ productList.rememberRawProductQueryResult(products);
1090
+ } catch (error) {
1091
+ this.logWarning('rememberRawProductPriceSources: 保存商品原始报价源失败', {
1092
+ error: error instanceof Error ? error.message : String(error)
1093
+ });
1094
+ }
1095
+ }
1096
+ }, {
1097
+ key: "getSelectedProductVariantId",
1098
+ value: function getSelectedProductVariantId(product) {
1099
+ var _ref15, _product$product_vari;
1100
+ var variantId = Number((_ref15 = (_product$product_vari = product === null || product === void 0 ? void 0 : product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product === null || product === void 0 ? void 0 : product.variant_id) !== null && _ref15 !== void 0 ? _ref15 : 0);
1101
+ return Number.isFinite(variantId) && variantId > 0 ? variantId : 0;
1102
+ }
1103
+
1104
+ /**
1105
+ * 将目录原始商品还原为本次选择的 SKU 基线。
1106
+ *
1107
+ * 这里绝不能复用已评估后的目录商品,否则从命中智能价切回不命中的
1108
+ * 日期时会残留旧价格。套餐仅验证所选关系存在,最终仍由 merge 方法把
1109
+ * 评估后的套餐价格映射回用户的选择数据。
1110
+ */
1111
+ }, {
1112
+ key: "prepareRawProductForPriceQuery",
1113
+ value: function prepareRawProductForPriceQuery(rawProduct, selectedProduct) {
1114
+ var _product$product_id2,
1115
+ _this5 = this;
1116
+ var product = cloneDeep(rawProduct);
1117
+ var rawProductId = this.getPriceQueryProductId(product);
1118
+ var selectedProductId = this.getPriceQueryProductId(selectedProduct);
1119
+ if (rawProductId === null || selectedProductId === null || rawProductId !== selectedProductId) {
1120
+ return null;
1121
+ }
1122
+ var selectedVariantId = this.getSelectedProductVariantId(selectedProduct);
1123
+ product.product_id = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : product.id;
1124
+ product.product_variant_id = selectedVariantId;
1125
+ product.variant_id = selectedVariantId;
1126
+ if (selectedVariantId > 0) {
1127
+ var _ref16, _selectedVariant$pric, _selectedVariant$sell, _selectedVariant$base;
1128
+ var variants = Array.isArray(product.variant) ? product.variant : [];
1129
+ var selectedVariant = variants.find(function (variant) {
1130
+ return Number(variant === null || variant === void 0 ? void 0 : variant.id) === selectedVariantId;
1131
+ });
1132
+ if (!selectedVariant) return null;
1133
+ var variantPrice = (_ref16 = (_selectedVariant$pric = selectedVariant.price) !== null && _selectedVariant$pric !== void 0 ? _selectedVariant$pric : selectedVariant.selling_price) !== null && _ref16 !== void 0 ? _ref16 : selectedVariant.base_price;
1134
+ if (variantPrice === undefined || variantPrice === null || variantPrice === '') {
1135
+ return null;
1136
+ }
1137
+ product.price = variantPrice;
1138
+ product.selling_price = (_selectedVariant$sell = selectedVariant.selling_price) !== null && _selectedVariant$sell !== void 0 ? _selectedVariant$sell : variantPrice;
1139
+ product.base_price = (_selectedVariant$base = selectedVariant.base_price) !== null && _selectedVariant$base !== void 0 ? _selectedVariant$base : variantPrice;
1140
+ }
1141
+ var selectedBundles = Array.isArray(selectedProduct.product_bundle) ? selectedProduct.product_bundle : [];
1142
+ if (selectedBundles.length > 0) {
1143
+ var rawBundleItems = this.getAuthoritativeBundleItems(product);
1144
+ var allSelectedBundlesExist = selectedBundles.every(function (bundle) {
1145
+ var _ref17, _bundle$bundle_varian, _ref18, _authoritativeBundle$;
1146
+ var authoritativeBundle = _this5.findAuthoritativeBundleItem(bundle, rawBundleItems);
1147
+ if (!authoritativeBundle) return false;
1148
+ var selectedBundleVariantId = Number((_ref17 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.variant_id) !== null && _ref17 !== void 0 ? _ref17 : 0);
1149
+ var authoritativeBundleVariantId = Number((_ref18 = (_authoritativeBundle$ = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.bundle_variant_id) !== null && _authoritativeBundle$ !== void 0 ? _authoritativeBundle$ : authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.variant_id) !== null && _ref18 !== void 0 ? _ref18 : 0);
1150
+ if ((Number.isFinite(selectedBundleVariantId) ? selectedBundleVariantId : 0) !== (Number.isFinite(authoritativeBundleVariantId) ? authoritativeBundleVariantId : 0)) {
1151
+ return false;
1152
+ }
1153
+
1154
+ // 省略字段表示该套餐子商品关系没有被价格查询完整水合,不能把它
1155
+ // 当作“没有规则”而静默使用基础价。
1156
+ return Array.isArray(authoritativeBundle.data_variants);
1157
+ });
1158
+ if (!allSelectedBundlesExist) return null;
1159
+ }
1160
+ return product;
1161
+ }
1162
+ }, {
1163
+ key: "resolveLocalProductForPriceQuery",
1164
+ value: function resolveLocalProductForPriceQuery(params) {
1165
+ if (!params.rawProduct) return null;
1166
+ var preparedProduct = this.prepareRawProductForPriceQuery(params.rawProduct, params.selectedProduct);
1167
+ if (!preparedProduct) return null;
1168
+ var scheduleList = this.getPriceQueryScheduleList();
1169
+ var result = tryResolveClientDataVariants(_objectSpread({
1170
+ core: this.core,
1171
+ otherParams: this.otherParams,
1172
+ products: [preparedProduct],
1173
+ queryPayload: params.queryPayload,
1174
+ handledByOsServer: false
1175
+ }, scheduleList ? {
1176
+ scheduleList: scheduleList
1177
+ } : {}));
1178
+ if (result.status !== 'resolved') return null;
1179
+ return result.products[0] || null;
1180
+ }
998
1181
  }, {
999
1182
  key: "loadProductsForPriceQuery",
1000
1183
  value: function () {
1001
1184
  var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
1002
- var ids, productsById, channel, strategyContext, _response$data, response, list;
1185
+ var ids, productsById, handledByOsServer, _response$data, queryPayload, response, list, scheduleList, resolvedList;
1003
1186
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1004
1187
  while (1) switch (_context8.prev = _context8.next) {
1005
1188
  case 0:
@@ -1013,24 +1196,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1013
1196
  }
1014
1197
  return _context8.abrupt("return", productsById);
1015
1198
  case 4:
1016
- channel = this.getPriceQueryChannel(params.channel);
1017
- strategyContext = this.getPriceQueryStrategyContext(channel);
1018
- _context8.prev = 6;
1199
+ handledByOsServer = isProductQueryHandledByOsServer(this.core, this.request);
1200
+ _context8.prev = 5;
1201
+ queryPayload = this.buildPriceQueryPayload(_objectSpread(_objectSpread({}, params), {}, {
1202
+ ids: ids
1203
+ }));
1019
1204
  _context8.next = 9;
1020
- return this.request.post('/product/query', _objectSpread({
1021
- ids: ids,
1022
- open_quotation: 1,
1023
- open_bundle: 1,
1024
- status: 'published',
1025
- num: 1,
1026
- skip: 1,
1027
- customer_id: params.customerId,
1028
- schedule_date: params.schedule.schedule_date,
1029
- schedule_datetime: params.schedule.schedule_datetime,
1030
- application_code: channel
1031
- }, Object.keys(strategyContext).length ? {
1032
- strategy_context: strategyContext
1033
- } : {}), {
1205
+ return this.request.post('/product/query', queryPayload, {
1034
1206
  osServer: true,
1035
1207
  customToast: function customToast() {}
1036
1208
  });
@@ -1043,6 +1215,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1043
1215
  }
1044
1216
  return _context8.abrupt("return", productsById);
1045
1217
  case 13:
1218
+ if (!(this.isCustomerUserPriceQuery() && !handledByOsServer)) {
1219
+ _context8.next = 17;
1220
+ break;
1221
+ }
1222
+ this.rememberRawProductPriceSources(list);
1046
1223
  list.forEach(function (item) {
1047
1224
  var _item$id;
1048
1225
  var productId = Number((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id);
@@ -1050,18 +1227,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1050
1227
  });
1051
1228
  return _context8.abrupt("return", productsById);
1052
1229
  case 17:
1053
- _context8.prev = 17;
1054
- _context8.t0 = _context8["catch"](6);
1230
+ scheduleList = this.getPriceQueryScheduleList();
1231
+ resolvedList = resolveClientDataVariants(_objectSpread({
1232
+ core: this.core,
1233
+ otherParams: this.otherParams,
1234
+ products: list,
1235
+ queryPayload: queryPayload,
1236
+ handledByOsServer: handledByOsServer
1237
+ }, scheduleList ? {
1238
+ scheduleList: scheduleList
1239
+ } : {}));
1240
+ resolvedList.forEach(function (item) {
1241
+ var _item$id2;
1242
+ var productId = Number((_item$id2 = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id2 !== void 0 ? _item$id2 : item === null || item === void 0 ? void 0 : item.product_id);
1243
+ if (Number.isFinite(productId)) productsById.set(productId, item);
1244
+ });
1245
+ return _context8.abrupt("return", productsById);
1246
+ case 23:
1247
+ _context8.prev = 23;
1248
+ _context8.t0 = _context8["catch"](5);
1055
1249
  this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
1056
1250
  ids: ids,
1057
1251
  error: _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0)
1058
1252
  });
1059
1253
  return _context8.abrupt("return", productsById);
1060
- case 21:
1254
+ case 27:
1061
1255
  case "end":
1062
1256
  return _context8.stop();
1063
1257
  }
1064
- }, _callee8, this, [[6, 17]]);
1258
+ }, _callee8, this, [[5, 23]]);
1065
1259
  }));
1066
1260
  function loadProductsForPriceQuery(_x7) {
1067
1261
  return _loadProductsForPriceQuery.apply(this, arguments);
@@ -1069,42 +1263,127 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1069
1263
  return loadProductsForPriceQuery;
1070
1264
  }()
1071
1265
  }, {
1072
- key: "loadProductForPriceQuery",
1266
+ key: "resolveProductsForPriceQuery",
1073
1267
  value: function () {
1074
- var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params, customerId) {
1075
- var product, productId, schedule, productsById;
1268
+ var _resolveProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
1269
+ var _this6 = this;
1270
+ var selectedProducts, productIds, ids, handledByOsServer, canUseLocalFastPath, productsById, queryPayload, cachedRawProducts, authoritativeProducts, missingIds, remoteRawProducts;
1076
1271
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1077
1272
  while (1) switch (_context9.prev = _context9.next) {
1078
1273
  case 0:
1079
- product = params.product || {};
1080
- productId = this.getPriceQueryProductId(product);
1081
- if (!(productId === null || !this.request)) {
1082
- _context9.next = 4;
1274
+ selectedProducts = params.priceQueries.map(function (item) {
1275
+ return item.product || {};
1276
+ });
1277
+ productIds = selectedProducts.map(function (product) {
1278
+ return _this6.getPriceQueryProductId(product);
1279
+ });
1280
+ ids = Array.from(new Set(productIds.filter(function (id) {
1281
+ return id !== null;
1282
+ })));
1283
+ if (ids.length) {
1284
+ _context9.next = 5;
1083
1285
  break;
1084
1286
  }
1085
- return _context9.abrupt("return", null);
1086
- case 4:
1087
- schedule = this.getPriceQuerySchedule(params);
1088
- _context9.next = 7;
1287
+ return _context9.abrupt("return", selectedProducts.map(function () {
1288
+ return null;
1289
+ }));
1290
+ case 5:
1291
+ handledByOsServer = this.request ? isProductQueryHandledByOsServer(this.core, this.request) : false;
1292
+ canUseLocalFastPath = this.isCustomerUserPriceQuery() && !handledByOsServer;
1293
+ if (canUseLocalFastPath) {
1294
+ _context9.next = 14;
1295
+ break;
1296
+ }
1297
+ if (this.request) {
1298
+ _context9.next = 10;
1299
+ break;
1300
+ }
1301
+ return _context9.abrupt("return", selectedProducts.map(function () {
1302
+ return null;
1303
+ }));
1304
+ case 10:
1305
+ _context9.next = 12;
1089
1306
  return this.loadProductsForPriceQuery({
1090
- ids: [productId],
1091
- schedule: schedule,
1092
- customerId: customerId,
1307
+ ids: ids,
1308
+ schedule: params.schedule,
1309
+ customerId: params.customerId,
1093
1310
  channel: params.channel
1094
1311
  });
1095
- case 7:
1312
+ case 12:
1096
1313
  productsById = _context9.sent;
1097
- return _context9.abrupt("return", productsById.get(productId) || null);
1098
- case 9:
1314
+ return _context9.abrupt("return", productIds.map(function (productId) {
1315
+ return productId === null ? null : productsById.get(productId) || null;
1316
+ }));
1317
+ case 14:
1318
+ queryPayload = this.buildPriceQueryPayload({
1319
+ ids: ids,
1320
+ schedule: params.schedule,
1321
+ customerId: params.customerId,
1322
+ channel: params.channel
1323
+ });
1324
+ cachedRawProducts = this.getRawProductPriceSources(ids);
1325
+ authoritativeProducts = selectedProducts.map(function (selectedProduct, index) {
1326
+ var productId = productIds[index];
1327
+ return productId === null ? null : _this6.resolveLocalProductForPriceQuery({
1328
+ selectedProduct: selectedProduct,
1329
+ rawProduct: cachedRawProducts.get(productId),
1330
+ queryPayload: queryPayload
1331
+ });
1332
+ });
1333
+ missingIds = Array.from(new Set(productIds.filter(function (productId, index) {
1334
+ return productId !== null && !authoritativeProducts[index];
1335
+ })));
1336
+ if (missingIds.length) {
1337
+ _context9.next = 20;
1338
+ break;
1339
+ }
1340
+ return _context9.abrupt("return", authoritativeProducts);
1341
+ case 20:
1342
+ if (this.request) {
1343
+ _context9.next = 22;
1344
+ break;
1345
+ }
1346
+ return _context9.abrupt("return", authoritativeProducts);
1347
+ case 22:
1348
+ _context9.next = 24;
1349
+ return this.loadProductsForPriceQuery({
1350
+ ids: missingIds,
1351
+ schedule: params.schedule,
1352
+ customerId: params.customerId,
1353
+ channel: params.channel
1354
+ });
1355
+ case 24:
1356
+ remoteRawProducts = _context9.sent;
1357
+ authoritativeProducts.forEach(function (authoritativeProduct, index) {
1358
+ if (authoritativeProduct) return;
1359
+ var productId = productIds[index];
1360
+ if (productId === null) return;
1361
+ var rawProduct = remoteRawProducts.get(productId);
1362
+ var locallyResolved = _this6.resolveLocalProductForPriceQuery({
1363
+ selectedProduct: selectedProducts[index],
1364
+ rawProduct: rawProduct,
1365
+ queryPayload: queryPayload
1366
+ });
1367
+ if (locallyResolved) {
1368
+ authoritativeProducts[index] = locallyResolved;
1369
+ return;
1370
+ }
1371
+
1372
+ // 严格客户端能力仍不可用时,真实请求已经是最后的权威降级。
1373
+ // 尽量应用所选 SKU 基线;关系不完整时保持旧的远端商品语义。
1374
+ authoritativeProducts[index] = rawProduct ? _this6.prepareRawProductForPriceQuery(rawProduct, selectedProducts[index]) || rawProduct : null;
1375
+ });
1376
+ return _context9.abrupt("return", authoritativeProducts);
1377
+ case 27:
1099
1378
  case "end":
1100
1379
  return _context9.stop();
1101
1380
  }
1102
1381
  }, _callee9, this);
1103
1382
  }));
1104
- function loadProductForPriceQuery(_x8, _x9) {
1105
- return _loadProductForPriceQuery.apply(this, arguments);
1383
+ function resolveProductsForPriceQuery(_x8) {
1384
+ return _resolveProductsForPriceQuery.apply(this, arguments);
1106
1385
  }
1107
- return loadProductForPriceQuery;
1386
+ return resolveProductsForPriceQuery;
1108
1387
  }()
1109
1388
  }, {
1110
1389
  key: "getAuthoritativeBundleItems",
@@ -1114,10 +1393,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1114
1393
  return groups.flatMap(function (group) {
1115
1394
  var items = Array.isArray(group === null || group === void 0 ? void 0 : group.bundle_item) ? group.bundle_item : Array.isArray(group === null || group === void 0 ? void 0 : group.bundleItem) ? group.bundleItem : [];
1116
1395
  return items.map(function (item) {
1117
- var _item$group_id, _ref15, _item$bundle_group_id;
1396
+ var _item$group_id, _ref19, _item$bundle_group_id;
1118
1397
  return _objectSpread(_objectSpread({}, item), {}, {
1119
1398
  group_id: (_item$group_id = item === null || item === void 0 ? void 0 : item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : group === null || group === void 0 ? void 0 : group.id,
1120
- bundle_group_id: (_ref15 = (_item$bundle_group_id = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item === null || item === void 0 ? void 0 : item.group_id) !== null && _ref15 !== void 0 ? _ref15 : group === null || group === void 0 ? void 0 : group.id
1399
+ bundle_group_id: (_ref19 = (_item$bundle_group_id = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item === null || item === void 0 ? void 0 : item.group_id) !== null && _ref19 !== void 0 ? _ref19 : group === null || group === void 0 ? void 0 : group.id
1121
1400
  });
1122
1401
  });
1123
1402
  });
@@ -1148,44 +1427,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1148
1427
  }, {
1149
1428
  key: "getAuthoritativeBundleUnitPrice",
1150
1429
  value: function getAuthoritativeBundleUnitPrice(bundle) {
1151
- var _ref16, _ref17, _ref18, _bundle$price;
1152
- return (_ref16 = (_ref17 = (_ref18 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref18 !== void 0 ? _ref18 : bundle.custom_price) !== null && _ref17 !== void 0 ? _ref17 : bundle.product_price) !== null && _ref16 !== void 0 ? _ref16 : bundle.base_price;
1430
+ var _ref20, _ref21, _ref22, _bundle$price;
1431
+ return (_ref20 = (_ref21 = (_ref22 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref22 !== void 0 ? _ref22 : bundle.custom_price) !== null && _ref21 !== void 0 ? _ref21 : bundle.product_price) !== null && _ref20 !== void 0 ? _ref20 : bundle.base_price;
1153
1432
  }
1154
1433
  }, {
1155
1434
  key: "mergeProductForPriceQuery",
1156
1435
  value: function mergeProductForPriceQuery(product, authoritativeProduct) {
1157
- var _this5 = this,
1436
+ var _this7 = this,
1158
1437
  _product$id,
1159
- _ref19,
1160
- _product$product_id2,
1161
- _ref20,
1162
- _product$product_vari,
1163
- _ref21,
1438
+ _ref23,
1439
+ _product$product_id3,
1440
+ _ref24,
1441
+ _product$product_vari2,
1442
+ _ref25,
1164
1443
  _product$num,
1165
- _ref22,
1444
+ _ref26,
1166
1445
  _product$quantity,
1167
1446
  _product$metadata4;
1168
1447
  if (!authoritativeProduct) return product;
1169
1448
  var selectedBundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
1170
1449
  var authoritativeBundles = this.getAuthoritativeBundleItems(authoritativeProduct);
1171
1450
  var productBundle = selectedBundles.map(function (bundle) {
1172
- var _authoritativeBundle$, _authoritativeBundle$2;
1173
- var authoritativeBundle = _this5.findAuthoritativeBundleItem(bundle, authoritativeBundles);
1174
- var unitPrice = authoritativeBundle ? _this5.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
1451
+ var _authoritativeBundle$2, _authoritativeBundle$3;
1452
+ var authoritativeBundle = _this7.findAuthoritativeBundleItem(bundle, authoritativeBundles);
1453
+ var unitPrice = authoritativeBundle ? _this7.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
1175
1454
  if (unitPrice === undefined || unitPrice === null || unitPrice === '') return bundle;
1176
1455
  return _objectSpread(_objectSpread({}, bundle), {}, {
1177
1456
  price: unitPrice,
1178
1457
  bundle_selling_price: unitPrice,
1179
- base_price: (_authoritativeBundle$ = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.base_price) !== null && _authoritativeBundle$ !== void 0 ? _authoritativeBundle$ : bundle.base_price,
1180
- product_price: (_authoritativeBundle$2 = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.product_price) !== null && _authoritativeBundle$2 !== void 0 ? _authoritativeBundle$2 : bundle.product_price
1458
+ base_price: (_authoritativeBundle$2 = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.base_price) !== null && _authoritativeBundle$2 !== void 0 ? _authoritativeBundle$2 : bundle.base_price,
1459
+ product_price: (_authoritativeBundle$3 = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.product_price) !== null && _authoritativeBundle$3 !== void 0 ? _authoritativeBundle$3 : bundle.product_price
1181
1460
  });
1182
1461
  });
1183
1462
  return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
1184
1463
  id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
1185
- product_id: (_ref19 = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : authoritativeProduct.product_id) !== null && _ref19 !== void 0 ? _ref19 : authoritativeProduct.id,
1186
- product_variant_id: (_ref20 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : authoritativeProduct.product_variant_id) !== null && _ref20 !== void 0 ? _ref20 : 0,
1187
- num: (_ref21 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref21 !== void 0 ? _ref21 : authoritativeProduct.num,
1188
- quantity: (_ref22 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref22 !== void 0 ? _ref22 : authoritativeProduct.quantity,
1464
+ product_id: (_ref23 = (_product$product_id3 = product.product_id) !== null && _product$product_id3 !== void 0 ? _product$product_id3 : authoritativeProduct.product_id) !== null && _ref23 !== void 0 ? _ref23 : authoritativeProduct.id,
1465
+ product_variant_id: (_ref24 = (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : authoritativeProduct.product_variant_id) !== null && _ref24 !== void 0 ? _ref24 : 0,
1466
+ num: (_ref25 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref25 !== void 0 ? _ref25 : authoritativeProduct.num,
1467
+ quantity: (_ref26 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref26 !== void 0 ? _ref26 : authoritativeProduct.quantity,
1189
1468
  product_sku: function () {
1190
1469
  var authoritativeSku = ensureProductSku(authoritativeProduct);
1191
1470
  var productSku = ensureProductSku(product);
@@ -1352,24 +1631,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1352
1631
  key: "syncOtherParamsToSubModules",
1353
1632
  value: (function () {
1354
1633
  var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(changedParams) {
1355
- var _this6 = this;
1356
- var _ref26,
1357
- _ref26$cover,
1634
+ var _this8 = this;
1635
+ var _ref30,
1636
+ _ref30$cover,
1358
1637
  cover,
1359
1638
  _args11 = arguments;
1360
1639
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1361
1640
  while (1) switch (_context11.prev = _context11.next) {
1362
1641
  case 0:
1363
- _ref26 = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {}, _ref26$cover = _ref26.cover, cover = _ref26$cover === void 0 ? false : _ref26$cover;
1642
+ _ref30 = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {}, _ref30$cover = _ref30.cover, cover = _ref30$cover === void 0 ? false : _ref30$cover;
1364
1643
  _context11.next = 3;
1365
1644
  return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
1366
- var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref27) {
1367
- var _ref29, moduleName, subModule, targetModule, nextSubModuleOtherParams;
1645
+ var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref31) {
1646
+ var _ref33, moduleName, subModule, targetModule, nextSubModuleOtherParams;
1368
1647
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1369
1648
  while (1) switch (_context10.prev = _context10.next) {
1370
1649
  case 0:
1371
- _ref29 = _slicedToArray(_ref27, 2), moduleName = _ref29[0], subModule = _ref29[1];
1372
- if (!_this6.reusedSharedSubModuleNames.has(moduleName)) {
1650
+ _ref33 = _slicedToArray(_ref31, 2), moduleName = _ref33[0], subModule = _ref33[1];
1651
+ if (!_this8.reusedSharedSubModuleNames.has(moduleName)) {
1373
1652
  _context10.next = 3;
1374
1653
  break;
1375
1654
  }
@@ -1382,7 +1661,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1382
1661
  }
1383
1662
  return _context10.abrupt("return");
1384
1663
  case 6:
1385
- nextSubModuleOtherParams = _this6.buildSubModuleOtherParams(moduleName);
1664
+ nextSubModuleOtherParams = _this8.buildSubModuleOtherParams(moduleName);
1386
1665
  _context10.next = 9;
1387
1666
  return targetModule.updateOtherParams(nextSubModuleOtherParams, {
1388
1667
  changedParams: changedParams,
@@ -1394,8 +1673,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1394
1673
  }
1395
1674
  }, _callee10);
1396
1675
  }));
1397
- return function (_x11) {
1398
- return _ref28.apply(this, arguments);
1676
+ return function (_x10) {
1677
+ return _ref32.apply(this, arguments);
1399
1678
  };
1400
1679
  }()));
1401
1680
  case 3:
@@ -1404,7 +1683,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1404
1683
  }
1405
1684
  }, _callee11, this);
1406
1685
  }));
1407
- function syncOtherParamsToSubModules(_x10) {
1686
+ function syncOtherParamsToSubModules(_x9) {
1408
1687
  return _syncOtherParamsToSubModules.apply(this, arguments);
1409
1688
  }
1410
1689
  return syncOtherParamsToSubModules;
@@ -1454,22 +1733,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1454
1733
  }, {
1455
1734
  key: "getPaymentNumberDevicePrefixSync",
1456
1735
  value: function getPaymentNumberDevicePrefixSync() {
1457
- var _this7 = this;
1736
+ var _this9 = this;
1458
1737
  if (!this.appPlugin) return 'LOCAL';
1459
1738
  return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
1460
- return _this7.getAppData(key);
1739
+ return _this9.getAppData(key);
1461
1740
  });
1462
1741
  }
1463
1742
  }, {
1464
1743
  key: "getPaymentNumberDevicePrefixAsync",
1465
1744
  value: function getPaymentNumberDevicePrefixAsync() {
1466
- var _this8 = this;
1745
+ var _this10 = this;
1467
1746
  if (!this.appPlugin) return Promise.resolve('LOCAL');
1468
1747
  if (this.paymentNumberDevicePrefix) {
1469
1748
  return Promise.resolve(this.paymentNumberDevicePrefix);
1470
1749
  }
1471
1750
  return resolvePaymentNumberDevicePrefix(function (key) {
1472
- return _this8.getAppData(key);
1751
+ return _this10.getAppData(key);
1473
1752
  });
1474
1753
  }
1475
1754
  }, {
@@ -1517,10 +1796,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1517
1796
  }
1518
1797
  tempOrder.metadata = tempOrder.metadata || {};
1519
1798
  if (shouldManageLegalCurrencySnapshot) {
1520
- var _ref30, _ref31, _tempOrder$metadata$l, _ref32, _ref33, _tempOrder$metadata$l2, _tempOrder$metadata$l3;
1799
+ var _ref34, _ref35, _tempOrder$metadata$l, _ref36, _ref37, _tempOrder$metadata$l2, _tempOrder$metadata$l3;
1521
1800
  var legalCurrencySnapshot = {
1522
- currency_code: String((_ref30 = (_ref31 = currencyCode !== null && currencyCode !== void 0 ? currencyCode : (_tempOrder$metadata$l = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l === void 0 ? void 0 : _tempOrder$metadata$l.currency_code) !== null && _ref31 !== void 0 ? _ref31 : tempOrder.currency_code) !== null && _ref30 !== void 0 ? _ref30 : ''),
1523
- currency_symbol: String((_ref32 = (_ref33 = currencySymbol !== null && currencySymbol !== void 0 ? currencySymbol : (_tempOrder$metadata$l2 = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l2 === void 0 ? void 0 : _tempOrder$metadata$l2.currency_symbol) !== null && _ref33 !== void 0 ? _ref33 : tempOrder.currency_symbol) !== null && _ref32 !== void 0 ? _ref32 : ''),
1801
+ currency_code: String((_ref34 = (_ref35 = currencyCode !== null && currencyCode !== void 0 ? currencyCode : (_tempOrder$metadata$l = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l === void 0 ? void 0 : _tempOrder$metadata$l.currency_code) !== null && _ref35 !== void 0 ? _ref35 : tempOrder.currency_code) !== null && _ref34 !== void 0 ? _ref34 : ''),
1802
+ currency_symbol: String((_ref36 = (_ref37 = currencySymbol !== null && currencySymbol !== void 0 ? currencySymbol : (_tempOrder$metadata$l2 = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l2 === void 0 ? void 0 : _tempOrder$metadata$l2.currency_symbol) !== null && _ref37 !== void 0 ? _ref37 : tempOrder.currency_symbol) !== null && _ref36 !== void 0 ? _ref36 : ''),
1524
1803
  currency_format: String(((_tempOrder$metadata$l3 = tempOrder.metadata.legal_currency_snapshot) === null || _tempOrder$metadata$l3 === void 0 ? void 0 : _tempOrder$metadata$l3.currency_format) || (isVirtualSettlement ? 'symbol_first' : tempOrder.currency_format) || 'symbol_first')
1525
1804
  };
1526
1805
  if (JSON.stringify(tempOrder.metadata.legal_currency_snapshot || {}) !== JSON.stringify(legalCurrencySnapshot)) {
@@ -1551,7 +1830,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1551
1830
  var _this$otherParams12,
1552
1831
  _this$appPlugin2,
1553
1832
  _this$appPlugin2$getA,
1554
- _this9 = this,
1833
+ _this11 = this,
1555
1834
  _this$otherParams13;
1556
1835
  var options,
1557
1836
  app,
@@ -1582,24 +1861,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1582
1861
  targetCacheData = this.readSessionCacheData();
1583
1862
  moduleNames = this.getRegisteredModuleNames();
1584
1863
  moduleNames.forEach(function (step) {
1585
- var reusedModule = _this9.getReusableSharedSubModule(step);
1864
+ var reusedModule = _this11.getReusableSharedSubModule(step);
1586
1865
  if (reusedModule) {
1587
- _this9.store[step] = reusedModule;
1588
- _this9.reusedSharedSubModuleNames.add(step);
1866
+ _this11.store[step] = reusedModule;
1867
+ _this11.reusedSharedSubModuleNames.add(step);
1589
1868
  return;
1590
1869
  }
1591
- var targetModule = _this9.createSubModule(step);
1870
+ var targetModule = _this11.createSubModule(step);
1592
1871
  if (!targetModule) {
1593
1872
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
1594
1873
  }
1595
- var hooks = _this9.getSubModuleHooks(step);
1596
- _this9.store[step] = targetModule;
1597
- _this9.core.registerModule(targetModule, _objectSpread(_objectSpread({
1598
- initialState: _this9.shouldUseSessionStorageForSubModule(step) ? (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {} : {}
1874
+ var hooks = _this11.getSubModuleHooks(step);
1875
+ _this11.store[step] = targetModule;
1876
+ _this11.core.registerModule(targetModule, _objectSpread(_objectSpread({
1877
+ initialState: _this11.shouldUseSessionStorageForSubModule(step) ? (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {} : {}
1599
1878
  }, hooks ? {
1600
1879
  hooks: hooks
1601
1880
  } : {}), {}, {
1602
- otherParams: _this9.buildSubModuleOtherParams(step)
1881
+ otherParams: _this11.buildSubModuleOtherParams(step)
1603
1882
  }));
1604
1883
  });
1605
1884
  if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
@@ -1623,7 +1902,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1623
1902
  }
1624
1903
  }, _callee12, this);
1625
1904
  }));
1626
- function initialize(_x12) {
1905
+ function initialize(_x11) {
1627
1906
  return _initialize.apply(this, arguments);
1628
1907
  }
1629
1908
  return initialize;
@@ -1633,15 +1912,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1633
1912
  value: function () {
1634
1913
  var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1635
1914
  var _this$serverOrderChan2,
1636
- _this10 = this;
1915
+ _this12 = this;
1637
1916
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1638
1917
  while (1) switch (_context13.prev = _context13.next) {
1639
1918
  case 0:
1640
1919
  (_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
1641
1920
  this.serverOrderChangeUnsubscribe = null;
1642
1921
  Object.keys(this.store).forEach(function (key) {
1643
- if (_this10.reusedSharedSubModuleNames.has(key)) return;
1644
- var sub = _this10.store[key];
1922
+ if (_this12.reusedSharedSubModuleNames.has(key)) return;
1923
+ var sub = _this12.store[key];
1645
1924
  if (sub && typeof sub.destroy === 'function') {
1646
1925
  try {
1647
1926
  sub.destroy();
@@ -1681,7 +1960,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1681
1960
  key: "loadSalesDetail",
1682
1961
  value: (function () {
1683
1962
  var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
1684
- var loadSequence, _ref34, _ref35, _ref36, _ref37, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
1963
+ var loadSequence, _ref38, _ref39, _ref40, _ref41, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, loadedSalesDetail, shouldFilterPendingPayments, remoteRecord, mergeSourceRecord, currentTempOrder, mergedRecord, record;
1685
1964
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1686
1965
  while (1) switch (_context14.prev = _context14.next) {
1687
1966
  case 0:
@@ -1699,7 +1978,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1699
1978
  };
1700
1979
  externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
1701
1980
  preloadedSalesDetail = params.preloadedSalesDetail;
1702
- lookup = (_ref34 = (_ref35 = (_ref36 = (_ref37 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref37 !== void 0 ? _ref37 : params.orderNumber) !== null && _ref36 !== void 0 ? _ref36 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref35 !== void 0 ? _ref35 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref34 !== void 0 ? _ref34 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
1981
+ lookup = (_ref38 = (_ref39 = (_ref40 = (_ref41 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref41 !== void 0 ? _ref41 : params.orderNumber) !== null && _ref40 !== void 0 ? _ref40 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref39 !== void 0 ? _ref39 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref38 !== void 0 ? _ref38 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
1703
1982
  if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
1704
1983
  _context14.next = 11;
1705
1984
  break;
@@ -1771,7 +2050,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1771
2050
  }
1772
2051
  }, _callee14, this, [[4,, 32, 44], [35, 40]]);
1773
2052
  }));
1774
- function loadSalesDetail(_x13) {
2053
+ function loadSalesDetail(_x12) {
1775
2054
  return _loadSalesDetail.apply(this, arguments);
1776
2055
  }
1777
2056
  return loadSalesDetail;
@@ -1878,7 +2157,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1878
2157
  }
1879
2158
  }, _callee15, this);
1880
2159
  }));
1881
- function replaceTempOrder(_x14, _x15) {
2160
+ function replaceTempOrder(_x13, _x14) {
1882
2161
  return _replaceTempOrder.apply(this, arguments);
1883
2162
  }
1884
2163
  return replaceTempOrder;
@@ -2247,10 +2526,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2247
2526
  }, {
2248
2527
  key: "getHistoricalProductDiscountList",
2249
2528
  value: function getHistoricalProductDiscountList(products) {
2250
- var _this11 = this;
2529
+ var _this13 = this;
2251
2530
  var historyDiscountList = [];
2252
2531
  products.forEach(function (item) {
2253
- if (!_this11.isPersistedOrderProduct(item)) return;
2532
+ if (!_this13.isPersistedOrderProduct(item)) return;
2254
2533
  (item.discount_list || []).forEach(function (discount) {
2255
2534
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
2256
2535
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
@@ -2310,11 +2589,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2310
2589
  }, {
2311
2590
  key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
2312
2591
  value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
2313
- var _this12 = this;
2592
+ var _this14 = this;
2314
2593
  if (params.discountAction !== 'edit') return false;
2315
2594
  if (!params.products.length) return false;
2316
2595
  var hasDraftProduct = params.products.some(function (product) {
2317
- return !_this12.isPersistedOrderProduct(product);
2596
+ return !_this14.isPersistedOrderProduct(product);
2318
2597
  });
2319
2598
  if (hasDraftProduct) return false;
2320
2599
 
@@ -2590,7 +2869,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2590
2869
  }
2591
2870
  }, _callee22, this, [[53, 72, 75, 78]]);
2592
2871
  }));
2593
- function loadDiscountConfig(_x16) {
2872
+ function loadDiscountConfig(_x15) {
2594
2873
  return _loadDiscountConfig.apply(this, arguments);
2595
2874
  }
2596
2875
  return loadDiscountConfig;
@@ -2705,7 +2984,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2705
2984
  }
2706
2985
  }, _callee23, this);
2707
2986
  }));
2708
- function bestDiscount(_x17) {
2987
+ function bestDiscount(_x16) {
2709
2988
  return _bestDiscount.apply(this, arguments);
2710
2989
  }
2711
2990
  return bestDiscount;
@@ -2768,7 +3047,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2768
3047
  }
2769
3048
  }, _callee24, this);
2770
3049
  }));
2771
- function replaceDiscountStoreLists(_x18) {
3050
+ function replaceDiscountStoreLists(_x17) {
2772
3051
  return _replaceDiscountStoreLists.apply(this, arguments);
2773
3052
  }
2774
3053
  return replaceDiscountStoreLists;
@@ -2830,7 +3109,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2830
3109
  }
2831
3110
  }, _callee25, this, [[0, 16]]);
2832
3111
  }));
2833
- function scanPromotionCode(_x19, _x20) {
3112
+ function scanPromotionCode(_x18, _x19) {
2834
3113
  return _scanPromotionCode.apply(this, arguments);
2835
3114
  }
2836
3115
  return scanPromotionCode;
@@ -2962,10 +3241,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2962
3241
  product.discount_list = filterSelectedDiscountDetails(product.discount_list);
2963
3242
  if (Array.isArray(product.product_bundle)) {
2964
3243
  product.product_bundle = product.product_bundle.map(function (bundle) {
2965
- var _ref38, _bundle$original_pric;
3244
+ var _ref42, _bundle$original_pric;
2966
3245
  var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
2967
3246
  var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
2968
- var restoredBundlePrice = (_ref38 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref38 !== void 0 ? _ref38 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
3247
+ var restoredBundlePrice = (_ref42 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref42 !== void 0 ? _ref42 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
2969
3248
  return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
2970
3249
  price: restoredBundlePrice,
2971
3250
  bundle_selling_price: restoredBundlePrice
@@ -3038,7 +3317,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3038
3317
  }
3039
3318
  }, _callee26, this, [[0, 64], [27, 48, 51, 54]]);
3040
3319
  }));
3041
- function setDiscountSelected(_x21) {
3320
+ function setDiscountSelected(_x20) {
3042
3321
  return _setDiscountSelected.apply(this, arguments);
3043
3322
  }
3044
3323
  return setDiscountSelected;
@@ -3108,7 +3387,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3108
3387
  }
3109
3388
  }, _callee27, this, [[0, 21]]);
3110
3389
  }));
3111
- function applyDiscountCalculationResult(_x22) {
3390
+ function applyDiscountCalculationResult(_x21) {
3112
3391
  return _applyDiscountCalculationResult.apply(this, arguments);
3113
3392
  }
3114
3393
  return applyDiscountCalculationResult;
@@ -3127,7 +3406,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3127
3406
  }
3128
3407
  }, _callee28, this);
3129
3408
  }));
3130
- function submitScanOrder(_x23) {
3409
+ function submitScanOrder(_x22) {
3131
3410
  return _submitScanOrder.apply(this, arguments);
3132
3411
  }
3133
3412
  return submitScanOrder;
@@ -3363,7 +3642,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3363
3642
  }
3364
3643
  }, _callee30, this);
3365
3644
  }));
3366
- function submitSalesOrder(_x24) {
3645
+ function submitSalesOrder(_x23) {
3367
3646
  return _submitSalesOrder.apply(this, arguments);
3368
3647
  }
3369
3648
  return submitSalesOrder;
@@ -3397,7 +3676,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3397
3676
  }
3398
3677
  }, _callee31, this);
3399
3678
  }));
3400
- function saveSalesOrderDraft(_x25) {
3679
+ function saveSalesOrderDraft(_x24) {
3401
3680
  return _saveSalesOrderDraft.apply(this, arguments);
3402
3681
  }
3403
3682
  return saveSalesOrderDraft;
@@ -3445,7 +3724,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3445
3724
  }
3446
3725
  }, _callee32, this);
3447
3726
  }));
3448
- function submitTempOrderAsync(_x26) {
3727
+ function submitTempOrderAsync(_x25) {
3449
3728
  return _submitTempOrderAsync.apply(this, arguments);
3450
3729
  }
3451
3730
  return submitTempOrderAsync;
@@ -3537,7 +3816,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3537
3816
  }
3538
3817
  }, _callee33, this);
3539
3818
  }));
3540
- function printLocalOrderReceipt(_x27) {
3819
+ function printLocalOrderReceipt(_x26) {
3541
3820
  return _printLocalOrderReceipt.apply(this, arguments);
3542
3821
  }
3543
3822
  return printLocalOrderReceipt;
@@ -3559,7 +3838,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3559
3838
  key: "syncPaymentsToOrder",
3560
3839
  value: function () {
3561
3840
  var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3562
- var _ref39, _params$businessCode, _this$otherParams31, _this$otherParams32, _params$channel2;
3841
+ var _ref43, _params$businessCode, _this$otherParams31, _this$otherParams32, _params$channel2;
3563
3842
  var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
3564
3843
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3565
3844
  while (1) switch (_context34.prev = _context34.next) {
@@ -3570,7 +3849,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3570
3849
  }
3571
3850
  throw new Error('order 模块未初始化');
3572
3851
  case 2:
3573
- businessCode = (_ref39 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.businessCode) !== null && _ref39 !== void 0 ? _ref39 : (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.business_code;
3852
+ businessCode = (_ref43 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams31 = this.otherParams) === null || _this$otherParams31 === void 0 ? void 0 : _this$otherParams31.businessCode) !== null && _ref43 !== void 0 ? _ref43 : (_this$otherParams32 = this.otherParams) === null || _this$otherParams32 === void 0 ? void 0 : _this$otherParams32.business_code;
3574
3853
  channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
3575
3854
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
3576
3855
  syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
@@ -3654,7 +3933,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3654
3933
  }
3655
3934
  }, _callee34, this, [[13, 30]]);
3656
3935
  }));
3657
- function syncPaymentsToOrder(_x28) {
3936
+ function syncPaymentsToOrder(_x27) {
3658
3937
  return _syncPaymentsToOrder.apply(this, arguments);
3659
3938
  }
3660
3939
  return syncPaymentsToOrder;
@@ -3691,13 +3970,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3691
3970
  }, {
3692
3971
  key: "scheduleQueuedAutoPaymentSyncFlush",
3693
3972
  value: function scheduleQueuedAutoPaymentSyncFlush() {
3694
- var _this13 = this;
3973
+ var _this15 = this;
3695
3974
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
3696
3975
  if (!this.queuedAutoPaymentSync) return;
3697
3976
  if (this.autoPaymentSyncTimer) return;
3698
3977
  this.autoPaymentSyncTimer = setTimeout(function () {
3699
- _this13.autoPaymentSyncTimer = null;
3700
- void _this13.flushQueuedAutoPaymentSync();
3978
+ _this15.autoPaymentSyncTimer = null;
3979
+ void _this15.flushQueuedAutoPaymentSync();
3701
3980
  }, delay);
3702
3981
  }
3703
3982
  }, {
@@ -3824,7 +4103,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3824
4103
  }
3825
4104
  }, _callee36, this);
3826
4105
  }));
3827
- function addOrderPaymentAsync(_x29) {
4106
+ function addOrderPaymentAsync(_x28) {
3828
4107
  return _addOrderPaymentAsync.apply(this, arguments);
3829
4108
  }
3830
4109
  return addOrderPaymentAsync;
@@ -3835,9 +4114,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3835
4114
  var _this$otherParams33,
3836
4115
  _paymentRecord$paymen,
3837
4116
  _paymentRecord$create,
3838
- _ref40,
4117
+ _ref44,
3839
4118
  _paymentRecord$origin,
3840
- _this14 = this;
4119
+ _this16 = this;
3841
4120
  if (!this.store.order) throw new Error('order 模块未初始化');
3842
4121
  var paymentRecord = payment;
3843
4122
  var paymentAmount = new Decimal(paymentRecord.amount || 0);
@@ -3857,7 +4136,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3857
4136
  var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
3858
4137
  var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
3859
4138
  var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
3860
- var calculatedServiceFee = serviceCharge ? new Decimal((_ref40 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref40 !== void 0 ? _ref40 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
4139
+ var calculatedServiceFee = serviceCharge ? new Decimal((_ref44 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref44 !== void 0 ? _ref44 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
3861
4140
  var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, normalizedPaymentRecord), calculatedServiceFee !== undefined ? {
3862
4141
  service_fee: calculatedServiceFee
3863
4142
  } : {}), {}, {
@@ -3881,7 +4160,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3881
4160
  submitWhenPaid: true,
3882
4161
  smallTicketDataFlag: 1
3883
4162
  }).catch(function (error) {
3884
- _this14.logError('auto sync payments failed', {
4163
+ _this16.logError('auto sync payments failed', {
3885
4164
  error: error instanceof Error ? error.message : String(error)
3886
4165
  });
3887
4166
  });
@@ -4012,7 +4291,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4012
4291
  }
4013
4292
  }, _callee37, this, [[17, 23]]);
4014
4293
  }));
4015
- function updateOrderPayment(_x30, _x31) {
4294
+ function updateOrderPayment(_x29, _x30) {
4016
4295
  return _updateOrderPayment.apply(this, arguments);
4017
4296
  }
4018
4297
  return updateOrderPayment;
@@ -4051,7 +4330,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4051
4330
  }
4052
4331
  }, _callee38, this);
4053
4332
  }));
4054
- function updateVoucherOrderPaymentsAsync(_x32, _x33) {
4333
+ function updateVoucherOrderPaymentsAsync(_x31, _x32) {
4055
4334
  return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
4056
4335
  }
4057
4336
  return updateVoucherOrderPaymentsAsync;
@@ -4085,14 +4364,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4085
4364
  // const products = tempOrder?.products?.filter(n => n.product_id)
4086
4365
 
4087
4366
  var walletProducts = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products.map(function (product) {
4088
- var _product$holder_id, _product$product_vari2, _product$is_charge_ta, _metadata$main_produc, _metadata$main_produc2;
4367
+ var _product$holder_id, _product$product_vari3, _product$is_charge_ta, _metadata$main_produc, _metadata$main_produc2;
4089
4368
  var metadata = product.metadata || {};
4090
4369
  var rawHolderId = (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id;
4091
4370
  var holderIdValue = Array.isArray(rawHolderId) ? rawHolderId[0] : rawHolderId;
4092
4371
  var holder_id = Number.isInteger(Number(holderIdValue)) ? Number(holderIdValue) : undefined;
4093
4372
  return {
4094
4373
  product_id: product.product_id || 0,
4095
- product_variant_id: String((_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : ''),
4374
+ product_variant_id: String((_product$product_vari3 = product.product_variant_id) !== null && _product$product_vari3 !== void 0 ? _product$product_vari3 : ''),
4096
4375
  quantity: product.num || 1,
4097
4376
  is_price_include_tax: tempOrder.is_price_include_tax,
4098
4377
  is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
@@ -4138,7 +4417,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4138
4417
  }, {
4139
4418
  key: "buildWalletInitBusinessData",
4140
4419
  value: function buildWalletInitBusinessData(params) {
4141
- var _this$store$order9, _params$order_wait_pa, _ref41, _tempOrder$is_price_i;
4420
+ var _this$store$order9, _params$order_wait_pa, _ref45, _tempOrder$is_price_i;
4142
4421
  var snapshot = (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 ? void 0 : _this$store$order9.getOrderSnapshot();
4143
4422
  var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
4144
4423
  var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
@@ -4154,7 +4433,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4154
4433
  },
4155
4434
  products: this.getWalletProductList(),
4156
4435
  order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
4157
- is_price_include_tax: (_ref41 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref41 !== void 0 ? _ref41 : 1
4436
+ is_price_include_tax: (_ref45 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref45 !== void 0 ? _ref45 : 1
4158
4437
  }, snapshot.identity.orderId ? {
4159
4438
  payment_order_id: String(snapshot.identity.orderId)
4160
4439
  } : {});
@@ -4217,7 +4496,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4217
4496
  }
4218
4497
  }, _callee39, this);
4219
4498
  }));
4220
- function initWalletData(_x34) {
4499
+ function initWalletData(_x33) {
4221
4500
  return _initWalletData.apply(this, arguments);
4222
4501
  }
4223
4502
  return initWalletData;
@@ -4244,9 +4523,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4244
4523
  var walletPassName = fundRecord.wallet_pass_name;
4245
4524
  var title = walletPassName && _typeof(walletPassName) === 'object' ? walletPassName.default || Object.values(walletPassName)[0] : walletPassName;
4246
4525
  var code = String((payment === null || payment === void 0 ? void 0 : payment.code) || '').toUpperCase();
4247
- var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (_ref42) {
4248
- var _ref43 = _slicedToArray(_ref42, 2),
4249
- paymentCode = _ref43[1];
4526
+ var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (_ref46) {
4527
+ var _ref47 = _slicedToArray(_ref46, 2),
4528
+ paymentCode = _ref47[1];
4250
4529
  return paymentCode === code;
4251
4530
  })) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0]) || fundRecord.tag;
4252
4531
  return {
@@ -4284,7 +4563,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4284
4563
  }
4285
4564
  }, _callee40, this);
4286
4565
  }));
4287
- function publishWalletAssetsState(_x35) {
4566
+ function publishWalletAssetsState(_x34) {
4288
4567
  return _publishWalletAssetsState.apply(this, arguments);
4289
4568
  }
4290
4569
  return publishWalletAssetsState;
@@ -4365,7 +4644,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4365
4644
  }
4366
4645
  }, _callee41, this);
4367
4646
  }));
4368
- function syncSelectedWalletAssets(_x36) {
4647
+ function syncSelectedWalletAssets(_x35) {
4369
4648
  return _syncSelectedWalletAssets.apply(this, arguments);
4370
4649
  }
4371
4650
  return syncSelectedWalletAssets;
@@ -4421,7 +4700,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4421
4700
  }
4422
4701
  }, _callee42, this);
4423
4702
  }));
4424
- function importWalletAssetsSnapshot(_x37) {
4703
+ function importWalletAssetsSnapshot(_x36) {
4425
4704
  return _importWalletAssetsSnapshot.apply(this, arguments);
4426
4705
  }
4427
4706
  return importWalletAssetsSnapshot;
@@ -4509,7 +4788,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4509
4788
  }
4510
4789
  }, _callee43, this);
4511
4790
  }));
4512
- function refreshWalletAssets(_x38) {
4791
+ function refreshWalletAssets(_x37) {
4513
4792
  return _refreshWalletAssets.apply(this, arguments);
4514
4793
  }
4515
4794
  return refreshWalletAssets;
@@ -4542,7 +4821,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4542
4821
  }
4543
4822
  }, _callee44, this);
4544
4823
  }));
4545
- function selectWalletAsset(_x39) {
4824
+ function selectWalletAsset(_x38) {
4546
4825
  return _selectWalletAsset.apply(this, arguments);
4547
4826
  }
4548
4827
  return selectWalletAsset;
@@ -4572,7 +4851,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4572
4851
  }
4573
4852
  }, _callee45, this);
4574
4853
  }));
4575
- function updateWalletAssetAmount(_x40) {
4854
+ function updateWalletAssetAmount(_x39) {
4576
4855
  return _updateWalletAssetAmount.apply(this, arguments);
4577
4856
  }
4578
4857
  return updateWalletAssetAmount;
@@ -4617,7 +4896,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4617
4896
  }
4618
4897
  }, _callee46, this);
4619
4898
  }));
4620
- function scanWalletAsset(_x41) {
4899
+ function scanWalletAsset(_x40) {
4621
4900
  return _scanWalletAsset.apply(this, arguments);
4622
4901
  }
4623
4902
  return scanWalletAsset;
@@ -5046,7 +5325,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5046
5325
  }
5047
5326
  }, _callee51, this, [[29, 43]]);
5048
5327
  }));
5049
- function payCash(_x42) {
5328
+ function payCash(_x41) {
5050
5329
  return _payCash.apply(this, arguments);
5051
5330
  }
5052
5331
  return payCash;
@@ -5208,7 +5487,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5208
5487
  }
5209
5488
  }, _callee52, this, [[30, 44]]);
5210
5489
  }));
5211
- function commitPaymentMethodPayment(_x43) {
5490
+ function commitPaymentMethodPayment(_x42) {
5212
5491
  return _commitPaymentMethodPayment.apply(this, arguments);
5213
5492
  }
5214
5493
  return commitPaymentMethodPayment;
@@ -5256,7 +5535,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5256
5535
  }
5257
5536
  }, _callee53, this);
5258
5537
  }));
5259
- function roundAmount(_x44) {
5538
+ function roundAmount(_x43) {
5260
5539
  return _roundAmount.apply(this, arguments);
5261
5540
  }
5262
5541
  return roundAmount;
@@ -5272,7 +5551,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5272
5551
  key: "sendCustomerPayLink",
5273
5552
  value: (function () {
5274
5553
  var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
5275
- var orderIds, _ref44, _ref45, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
5554
+ var orderIds, _ref48, _ref49, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
5276
5555
  return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5277
5556
  while (1) switch (_context54.prev = _context54.next) {
5278
5557
  case 0:
@@ -5293,7 +5572,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5293
5572
  });
5294
5573
  case 6:
5295
5574
  submitResult = _context54.sent;
5296
- orderId = (_ref44 = (_ref45 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref45 !== void 0 ? _ref45 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref44 !== void 0 ? _ref44 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
5575
+ orderId = (_ref48 = (_ref49 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref49 !== void 0 ? _ref49 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref48 !== void 0 ? _ref48 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
5297
5576
  if (orderId) {
5298
5577
  _context54.next = 10;
5299
5578
  break;
@@ -5313,7 +5592,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5313
5592
  }
5314
5593
  }, _callee54, this);
5315
5594
  }));
5316
- function sendCustomerPayLink(_x45) {
5595
+ function sendCustomerPayLink(_x44) {
5317
5596
  return _sendCustomerPayLink.apply(this, arguments);
5318
5597
  }
5319
5598
  return sendCustomerPayLink;
@@ -5328,40 +5607,54 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5328
5607
  value: function () {
5329
5608
  var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5330
5609
  var _params$customer_id;
5331
- var quotation, customerId, authoritativeProduct, product;
5610
+ var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
5332
5611
  return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5333
5612
  while (1) switch (_context55.prev = _context55.next) {
5334
5613
  case 0:
5335
- quotation = this.store.quotation;
5614
+ useCustomerUserPricing = this.isCustomerUserPriceQuery();
5615
+ quotation = useCustomerUserPricing ? undefined : this.store.quotation;
5336
5616
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
5337
- _context55.next = 4;
5617
+ _context55.next = 5;
5338
5618
  return this.prepareProductPriceQueryContext(customerId);
5339
- case 4:
5340
- _context55.next = 6;
5341
- return this.loadProductForPriceQuery(params, customerId);
5342
- case 6:
5343
- authoritativeProduct = _context55.sent;
5619
+ case 5:
5620
+ channel = this.getPriceQueryChannel(params.channel);
5621
+ _context55.next = 8;
5622
+ return this.resolveProductsForPriceQuery({
5623
+ priceQueries: [params],
5624
+ schedule: this.getPriceQuerySchedule(params),
5625
+ customerId: customerId,
5626
+ channel: channel
5627
+ });
5628
+ case 8:
5629
+ _yield$this$resolvePr = _context55.sent;
5630
+ _yield$this$resolvePr2 = _slicedToArray(_yield$this$resolvePr, 1);
5631
+ authoritativeProduct = _yield$this$resolvePr2[0];
5344
5632
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
5345
- _context55.next = 10;
5633
+ if (useCustomerUserPricing) {
5634
+ _context55.next = 15;
5635
+ break;
5636
+ }
5637
+ _context55.next = 15;
5346
5638
  return this.loadQuotationForPriceQuery({
5347
5639
  quotation: quotation,
5348
5640
  customer_id: customerId,
5349
- channel: params.channel
5641
+ channel: channel
5350
5642
  });
5351
- case 10:
5643
+ case 15:
5352
5644
  return _context55.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
5645
+ channel: channel,
5353
5646
  product: product,
5354
5647
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
5355
5648
  customer_id: customerId,
5356
5649
  quotation: authoritativeProduct && this.preferAuthoritativeProductQueryPrice() ? undefined : quotation
5357
5650
  })));
5358
- case 11:
5651
+ case 16:
5359
5652
  case "end":
5360
5653
  return _context55.stop();
5361
5654
  }
5362
5655
  }, _callee55, this);
5363
5656
  }));
5364
- function calculateProductBookingPrice(_x46) {
5657
+ function calculateProductBookingPrice(_x45) {
5365
5658
  return _calculateProductBookingPrice.apply(this, arguments);
5366
5659
  }
5367
5660
  return calculateProductBookingPrice;
@@ -5369,7 +5662,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5369
5662
  }, {
5370
5663
  key: "getQuotationCustomerScopeInfo",
5371
5664
  value: function getQuotationCustomerScopeInfo() {
5372
- var _this15 = this;
5665
+ var _this17 = this;
5373
5666
  var quotation = this.store.quotation;
5374
5667
  if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
5375
5668
  return quotation.getQuotationCustomerScopeInfo();
@@ -5381,7 +5674,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5381
5674
  }).map(function (item) {
5382
5675
  var localSeen = new Set();
5383
5676
  var customers = item.customer.filter(function (customer) {
5384
- var customerId = _this15.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
5677
+ var customerId = _this17.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
5385
5678
  if (!customerId || localSeen.has(customerId)) return false;
5386
5679
  localSeen.add(customerId);
5387
5680
  if (!customerById.has(customerId)) customerById.set(customerId, customer);
@@ -5408,8 +5701,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5408
5701
  }, {
5409
5702
  key: "hasSmartPricingStrategies",
5410
5703
  value: function hasSmartPricingStrategies() {
5411
- var _this$core3;
5412
- var evaluator = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.dataVariantEvaluator;
5704
+ var _this$core4;
5705
+ var evaluator = (_this$core4 = this.core) === null || _this$core4 === void 0 || (_this$core4 = _this$core4.context) === null || _this$core4 === void 0 ? void 0 : _this$core4.dataVariantEvaluator;
5413
5706
  if (!evaluator || typeof evaluator.getStrategyConfigs !== 'function') {
5414
5707
  return false;
5415
5708
  }
@@ -5425,7 +5718,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5425
5718
  }));
5426
5719
  var previousCustomerId = this.normalizePriceContextCustomerId(params.previousCustomerId);
5427
5720
  var nextCustomerId = this.normalizePriceContextCustomerId(params.nextCustomerId);
5428
- if (this.hasSmartPricingStrategies()) {
5721
+ if (this.isCustomerUserPriceQuery() || this.hasSmartPricingStrategies()) {
5429
5722
  return previousCustomerId !== nextCustomerId;
5430
5723
  }
5431
5724
  var previousInScope = previousCustomerId ? scopedCustomerIds.has(previousCustomerId) : false;
@@ -5445,103 +5738,151 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5445
5738
  }, {
5446
5739
  key: "calculateProductBookingPrices",
5447
5740
  value: function () {
5448
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(paramsList) {
5449
- var _paramsList$0$custome,
5450
- _paramsList$,
5451
- _this16 = this,
5452
- _paramsList$2;
5453
- var quotation, customerId, productMapsByGroup, groups;
5454
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5455
- while (1) switch (_context57.prev = _context57.next) {
5741
+ var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(paramsList) {
5742
+ var _this18 = this;
5743
+ var useCustomerUserPricing, quotation, currentOrderCustomerId, resolvedChannels, authoritativeProducts, preparedCustomerKeys, groups, quotationContexts;
5744
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5745
+ while (1) switch (_context58.prev = _context58.next) {
5456
5746
  case 0:
5457
5747
  if (paramsList.length) {
5458
- _context57.next = 2;
5748
+ _context58.next = 2;
5459
5749
  break;
5460
5750
  }
5461
- return _context57.abrupt("return", []);
5751
+ return _context58.abrupt("return", []);
5462
5752
  case 2:
5463
- quotation = this.store.quotation;
5464
- customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
5465
- _context57.next = 6;
5466
- return this.prepareProductPriceQueryContext(customerId);
5467
- case 6:
5468
- productMapsByGroup = new Map();
5753
+ useCustomerUserPricing = this.isCustomerUserPriceQuery();
5754
+ quotation = useCustomerUserPricing ? undefined : this.store.quotation;
5755
+ currentOrderCustomerId = this.getCurrentOrderCustomerId();
5756
+ resolvedChannels = paramsList.map(function (params) {
5757
+ return _this18.getPriceQueryChannel(params.channel);
5758
+ });
5759
+ authoritativeProducts = paramsList.map(function () {
5760
+ return null;
5761
+ });
5762
+ preparedCustomerKeys = new Set();
5763
+ _context58.next = 10;
5764
+ return Promise.all(paramsList.map( /*#__PURE__*/function () {
5765
+ var _ref50 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(params) {
5766
+ var _params$customer_id2;
5767
+ var customerId, customerKey;
5768
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5769
+ while (1) switch (_context56.prev = _context56.next) {
5770
+ case 0:
5771
+ customerId = (_params$customer_id2 = params.customer_id) !== null && _params$customer_id2 !== void 0 ? _params$customer_id2 : currentOrderCustomerId;
5772
+ customerKey = _this18.normalizePriceContextCustomerId(customerId) || '';
5773
+ if (!preparedCustomerKeys.has(customerKey)) {
5774
+ _context56.next = 4;
5775
+ break;
5776
+ }
5777
+ return _context56.abrupt("return");
5778
+ case 4:
5779
+ preparedCustomerKeys.add(customerKey);
5780
+ _context56.next = 7;
5781
+ return _this18.prepareProductPriceQueryContext(customerId);
5782
+ case 7:
5783
+ case "end":
5784
+ return _context56.stop();
5785
+ }
5786
+ }, _callee56);
5787
+ }));
5788
+ return function (_x47) {
5789
+ return _ref50.apply(this, arguments);
5790
+ };
5791
+ }()));
5792
+ case 10:
5469
5793
  groups = new Map();
5470
- paramsList.forEach(function (params) {
5471
- var _this16$otherParams;
5472
- var product = params.product || {};
5473
- var productId = _this16.getPriceQueryProductId(product);
5474
- if (productId === null) return;
5475
- var schedule = _this16.getPriceQuerySchedule(params);
5476
- var channel = params.channel || ((_this16$otherParams = _this16.otherParams) === null || _this16$otherParams === void 0 ? void 0 : _this16$otherParams.channel);
5477
- var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
5794
+ paramsList.forEach(function (params, index) {
5795
+ var _params$customer_id3;
5796
+ var schedule = _this18.getPriceQuerySchedule(params);
5797
+ var channel = resolvedChannels[index];
5798
+ var customerId = (_params$customer_id3 = params.customer_id) !== null && _params$customer_id3 !== void 0 ? _params$customer_id3 : currentOrderCustomerId;
5799
+ var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', _this18.normalizePriceContextCustomerId(customerId) || ''].join('|');
5478
5800
  var group = groups.get(groupKey) || {
5479
- ids: new Set(),
5801
+ indices: [],
5480
5802
  schedule: schedule,
5803
+ customerId: customerId,
5481
5804
  channel: channel
5482
5805
  };
5483
- group.ids.add(productId);
5806
+ group.indices.push(index);
5484
5807
  groups.set(groupKey, group);
5485
5808
  });
5486
- _context57.next = 11;
5487
- return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
5488
- var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(_ref46) {
5489
- var _ref48, groupKey, group, productsById;
5490
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5491
- while (1) switch (_context56.prev = _context56.next) {
5809
+ _context58.next = 14;
5810
+ return Promise.all(Array.from(groups.values()).map( /*#__PURE__*/function () {
5811
+ var _ref51 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(group) {
5812
+ var priceQueries, resolvedProducts;
5813
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5814
+ while (1) switch (_context57.prev = _context57.next) {
5492
5815
  case 0:
5493
- _ref48 = _slicedToArray(_ref46, 2), groupKey = _ref48[0], group = _ref48[1];
5494
- _context56.next = 3;
5495
- return _this16.loadProductsForPriceQuery({
5496
- ids: Array.from(group.ids),
5816
+ priceQueries = group.indices.map(function (index) {
5817
+ return paramsList[index];
5818
+ });
5819
+ _context57.next = 3;
5820
+ return _this18.resolveProductsForPriceQuery({
5821
+ priceQueries: priceQueries,
5497
5822
  schedule: group.schedule,
5498
- customerId: customerId,
5823
+ customerId: group.customerId,
5499
5824
  channel: group.channel
5500
5825
  });
5501
5826
  case 3:
5502
- productsById = _context56.sent;
5503
- productMapsByGroup.set(groupKey, productsById);
5827
+ resolvedProducts = _context57.sent;
5828
+ group.indices.forEach(function (originalIndex, groupIndex) {
5829
+ authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
5830
+ });
5504
5831
  case 5:
5505
5832
  case "end":
5506
- return _context56.stop();
5833
+ return _context57.stop();
5507
5834
  }
5508
- }, _callee56);
5835
+ }, _callee57);
5509
5836
  }));
5510
5837
  return function (_x48) {
5511
- return _ref47.apply(this, arguments);
5838
+ return _ref51.apply(this, arguments);
5512
5839
  };
5513
5840
  }()));
5514
- case 11:
5515
- _context57.next = 13;
5516
- return this.loadQuotationForPriceQuery({
5517
- quotation: quotation,
5518
- customer_id: customerId,
5519
- channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
5841
+ case 14:
5842
+ if (useCustomerUserPricing) {
5843
+ _context58.next = 19;
5844
+ break;
5845
+ }
5846
+ quotationContexts = new Map();
5847
+ paramsList.forEach(function (params, index) {
5848
+ var _params$customer_id4;
5849
+ var channel = resolvedChannels[index];
5850
+ var key = channel || '';
5851
+ if (quotationContexts.has(key)) return;
5852
+ quotationContexts.set(key, {
5853
+ channel: channel,
5854
+ customer_id: (_params$customer_id4 = params.customer_id) !== null && _params$customer_id4 !== void 0 ? _params$customer_id4 : currentOrderCustomerId
5855
+ });
5520
5856
  });
5521
- case 13:
5522
- return _context57.abrupt("return", paramsList.map(function (params) {
5523
- var _this16$otherParams2, _productMapsByGroup$g;
5857
+ _context58.next = 19;
5858
+ return Promise.all(Array.from(quotationContexts.values()).map(function (context) {
5859
+ return _this18.loadQuotationForPriceQuery(_objectSpread({
5860
+ quotation: quotation
5861
+ }, context));
5862
+ }));
5863
+ case 19:
5864
+ return _context58.abrupt("return", paramsList.map(function (params, index) {
5865
+ var _params$customer_id5;
5524
5866
  var productInput = params.product || {};
5525
- var productId = _this16.getPriceQueryProductId(productInput);
5526
- var schedule = _this16.getPriceQuerySchedule(params);
5527
- var channel = params.channel || ((_this16$otherParams2 = _this16.otherParams) === null || _this16$otherParams2 === void 0 ? void 0 : _this16$otherParams2.channel);
5528
- var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
5529
- var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
5530
- var product = _this16.mergeProductForPriceQuery(productInput, authoritativeProduct);
5867
+ var authoritativeProduct = authoritativeProducts[index];
5868
+ var product = _this18.mergeProductForPriceQuery(productInput, authoritativeProduct);
5869
+ var customerId = (_params$customer_id5 = params.customer_id) !== null && _params$customer_id5 !== void 0 ? _params$customer_id5 : currentOrderCustomerId;
5870
+ var channel = resolvedChannels[index];
5531
5871
  return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
5872
+ channel: channel,
5532
5873
  product: product,
5533
5874
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
5534
5875
  customer_id: customerId,
5535
- quotation: authoritativeProduct && _this16.preferAuthoritativeProductQueryPrice() ? undefined : quotation
5876
+ quotation: authoritativeProduct && _this18.preferAuthoritativeProductQueryPrice() ? undefined : quotation
5536
5877
  }));
5537
5878
  }));
5538
- case 14:
5879
+ case 20:
5539
5880
  case "end":
5540
- return _context57.stop();
5881
+ return _context58.stop();
5541
5882
  }
5542
- }, _callee57, this);
5883
+ }, _callee58, this);
5543
5884
  }));
5544
- function calculateProductBookingPrices(_x47) {
5885
+ function calculateProductBookingPrices(_x46) {
5545
5886
  return _calculateProductBookingPrices.apply(this, arguments);
5546
5887
  }
5547
5888
  return calculateProductBookingPrices;
@@ -5549,42 +5890,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5549
5890
  }, {
5550
5891
  key: "addProductToOrder",
5551
5892
  value: function () {
5552
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(product, booking, options) {
5553
- var products;
5554
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5555
- while (1) switch (_context58.prev = _context58.next) {
5556
- case 0:
5557
- _context58.prev = 0;
5558
- if (this.store.order) {
5559
- _context58.next = 3;
5560
- break;
5561
- }
5562
- throw new Error('order 模块未初始化');
5563
- case 3:
5564
- _context58.next = 5;
5565
- return this.store.order.addProductToOrder(product, booking, options);
5566
- case 5:
5567
- products = _context58.sent;
5568
- return _context58.abrupt("return", products);
5569
- case 9:
5570
- _context58.prev = 9;
5571
- _context58.t0 = _context58["catch"](0);
5572
- throw _context58.t0;
5573
- case 12:
5574
- case "end":
5575
- return _context58.stop();
5576
- }
5577
- }, _callee58, this, [[0, 9]]);
5578
- }));
5579
- function addProductToOrder(_x49, _x50, _x51) {
5580
- return _addProductToOrder.apply(this, arguments);
5581
- }
5582
- return addProductToOrder;
5583
- }()
5584
- }, {
5585
- key: "updateOrderProduct",
5586
- value: function () {
5587
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
5893
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(product, booking, options) {
5588
5894
  var products;
5589
5895
  return _regeneratorRuntime().wrap(function _callee59$(_context59) {
5590
5896
  while (1) switch (_context59.prev = _context59.next) {
@@ -5597,7 +5903,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5597
5903
  throw new Error('order 模块未初始化');
5598
5904
  case 3:
5599
5905
  _context59.next = 5;
5600
- return this.store.order.updateOrderProduct(params);
5906
+ return this.store.order.addProductToOrder(product, booking, options);
5601
5907
  case 5:
5602
5908
  products = _context59.sent;
5603
5909
  return _context59.abrupt("return", products);
@@ -5611,15 +5917,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5611
5917
  }
5612
5918
  }, _callee59, this, [[0, 9]]);
5613
5919
  }));
5614
- function updateOrderProduct(_x52) {
5615
- return _updateOrderProduct.apply(this, arguments);
5920
+ function addProductToOrder(_x49, _x50, _x51) {
5921
+ return _addProductToOrder.apply(this, arguments);
5616
5922
  }
5617
- return updateOrderProduct;
5923
+ return addProductToOrder;
5618
5924
  }()
5619
5925
  }, {
5620
- key: "updateOrderProducts",
5926
+ key: "updateOrderProduct",
5621
5927
  value: function () {
5622
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(paramsList) {
5928
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
5623
5929
  var products;
5624
5930
  return _regeneratorRuntime().wrap(function _callee60$(_context60) {
5625
5931
  while (1) switch (_context60.prev = _context60.next) {
@@ -5632,7 +5938,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5632
5938
  throw new Error('order 模块未初始化');
5633
5939
  case 3:
5634
5940
  _context60.next = 5;
5635
- return this.store.order.updateOrderProducts(paramsList);
5941
+ return this.store.order.updateOrderProduct(params);
5636
5942
  case 5:
5637
5943
  products = _context60.sent;
5638
5944
  return _context60.abrupt("return", products);
@@ -5646,15 +5952,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5646
5952
  }
5647
5953
  }, _callee60, this, [[0, 9]]);
5648
5954
  }));
5649
- function updateOrderProducts(_x53) {
5650
- return _updateOrderProducts.apply(this, arguments);
5955
+ function updateOrderProduct(_x52) {
5956
+ return _updateOrderProduct.apply(this, arguments);
5651
5957
  }
5652
- return updateOrderProducts;
5958
+ return updateOrderProduct;
5653
5959
  }()
5654
5960
  }, {
5655
- key: "updateOrderProductQuantity",
5961
+ key: "updateOrderProducts",
5656
5962
  value: function () {
5657
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(params) {
5963
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(paramsList) {
5658
5964
  var products;
5659
5965
  return _regeneratorRuntime().wrap(function _callee61$(_context61) {
5660
5966
  while (1) switch (_context61.prev = _context61.next) {
@@ -5667,7 +5973,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5667
5973
  throw new Error('order 模块未初始化');
5668
5974
  case 3:
5669
5975
  _context61.next = 5;
5670
- return this.store.order.updateOrderProductQuantity(params);
5976
+ return this.store.order.updateOrderProducts(paramsList);
5671
5977
  case 5:
5672
5978
  products = _context61.sent;
5673
5979
  return _context61.abrupt("return", products);
@@ -5681,6 +5987,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5681
5987
  }
5682
5988
  }, _callee61, this, [[0, 9]]);
5683
5989
  }));
5990
+ function updateOrderProducts(_x53) {
5991
+ return _updateOrderProducts.apply(this, arguments);
5992
+ }
5993
+ return updateOrderProducts;
5994
+ }()
5995
+ }, {
5996
+ key: "updateOrderProductQuantity",
5997
+ value: function () {
5998
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
5999
+ var products;
6000
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6001
+ while (1) switch (_context62.prev = _context62.next) {
6002
+ case 0:
6003
+ _context62.prev = 0;
6004
+ if (this.store.order) {
6005
+ _context62.next = 3;
6006
+ break;
6007
+ }
6008
+ throw new Error('order 模块未初始化');
6009
+ case 3:
6010
+ _context62.next = 5;
6011
+ return this.store.order.updateOrderProductQuantity(params);
6012
+ case 5:
6013
+ products = _context62.sent;
6014
+ return _context62.abrupt("return", products);
6015
+ case 9:
6016
+ _context62.prev = 9;
6017
+ _context62.t0 = _context62["catch"](0);
6018
+ throw _context62.t0;
6019
+ case 12:
6020
+ case "end":
6021
+ return _context62.stop();
6022
+ }
6023
+ }, _callee62, this, [[0, 9]]);
6024
+ }));
5684
6025
  function updateOrderProductQuantity(_x54) {
5685
6026
  return _updateOrderProductQuantity.apply(this, arguments);
5686
6027
  }
@@ -5704,12 +6045,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5704
6045
  }, {
5705
6046
  key: "setOrderProductLineNote",
5706
6047
  value: (function () {
5707
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(identity, note) {
6048
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(identity, note) {
5708
6049
  var params, products;
5709
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
5710
- while (1) switch (_context62.prev = _context62.next) {
6050
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6051
+ while (1) switch (_context63.prev = _context63.next) {
5711
6052
  case 0:
5712
- _context62.prev = 0;
6053
+ _context63.prev = 0;
5713
6054
  params = {
5714
6055
  product_id: identity.product_id,
5715
6056
  product_variant_id: identity.product_variant_id,
@@ -5724,20 +6065,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5724
6065
  params.product_sku = identity.product_sku;
5725
6066
  }
5726
6067
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
5727
- _context62.next = 7;
6068
+ _context63.next = 7;
5728
6069
  return this.updateOrderProduct(params);
5729
6070
  case 7:
5730
- products = _context62.sent;
5731
- return _context62.abrupt("return", products);
6071
+ products = _context63.sent;
6072
+ return _context63.abrupt("return", products);
5732
6073
  case 11:
5733
- _context62.prev = 11;
5734
- _context62.t0 = _context62["catch"](0);
5735
- throw _context62.t0;
6074
+ _context63.prev = 11;
6075
+ _context63.t0 = _context63["catch"](0);
6076
+ throw _context63.t0;
5736
6077
  case 14:
5737
6078
  case "end":
5738
- return _context62.stop();
6079
+ return _context63.stop();
5739
6080
  }
5740
- }, _callee62, this, [[0, 11]]);
6081
+ }, _callee63, this, [[0, 11]]);
5741
6082
  }));
5742
6083
  function setOrderProductLineNote(_x55, _x56) {
5743
6084
  return _setOrderProductLineNote.apply(this, arguments);
@@ -5754,30 +6095,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5754
6095
  }, {
5755
6096
  key: "removeProductsFromOrder",
5756
6097
  value: (function () {
5757
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(identities, options) {
5758
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
5759
- while (1) switch (_context63.prev = _context63.next) {
6098
+ var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(identities, options) {
6099
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6100
+ while (1) switch (_context64.prev = _context64.next) {
5760
6101
  case 0:
5761
- _context63.prev = 0;
6102
+ _context64.prev = 0;
5762
6103
  if (this.store.order) {
5763
- _context63.next = 3;
6104
+ _context64.next = 3;
5764
6105
  break;
5765
6106
  }
5766
6107
  throw new Error('order 模块未初始化');
5767
6108
  case 3:
5768
- _context63.next = 5;
6109
+ _context64.next = 5;
5769
6110
  return this.store.order.removeProductsFromOrder(identities, options);
5770
6111
  case 5:
5771
- return _context63.abrupt("return", _context63.sent);
6112
+ return _context64.abrupt("return", _context64.sent);
5772
6113
  case 8:
5773
- _context63.prev = 8;
5774
- _context63.t0 = _context63["catch"](0);
5775
- throw _context63.t0;
6114
+ _context64.prev = 8;
6115
+ _context64.t0 = _context64["catch"](0);
6116
+ throw _context64.t0;
5776
6117
  case 11:
5777
6118
  case "end":
5778
- return _context63.stop();
6119
+ return _context64.stop();
5779
6120
  }
5780
- }, _callee63, this, [[0, 8]]);
6121
+ }, _callee64, this, [[0, 8]]);
5781
6122
  }));
5782
6123
  function removeProductsFromOrder(_x57, _x58) {
5783
6124
  return _removeProductsFromOrder.apply(this, arguments);
@@ -5787,16 +6128,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5787
6128
  }, {
5788
6129
  key: "removeProductFromOrder",
5789
6130
  value: function () {
5790
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(identity, options) {
5791
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
5792
- while (1) switch (_context64.prev = _context64.next) {
6131
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(identity, options) {
6132
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6133
+ while (1) switch (_context65.prev = _context65.next) {
5793
6134
  case 0:
5794
- return _context64.abrupt("return", this.removeProductsFromOrder([identity], options));
6135
+ return _context65.abrupt("return", this.removeProductsFromOrder([identity], options));
5795
6136
  case 1:
5796
6137
  case "end":
5797
- return _context64.stop();
6138
+ return _context65.stop();
5798
6139
  }
5799
- }, _callee64, this);
6140
+ }, _callee65, this);
5800
6141
  }));
5801
6142
  function removeProductFromOrder(_x59, _x60) {
5802
6143
  return _removeProductFromOrder.apply(this, arguments);
@@ -5848,23 +6189,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5848
6189
  }, {
5849
6190
  key: "applyPromotion",
5850
6191
  value: (function () {
5851
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
5852
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
5853
- while (1) switch (_context65.prev = _context65.next) {
6192
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
6193
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6194
+ while (1) switch (_context66.prev = _context66.next) {
5854
6195
  case 0:
5855
6196
  if (this.store.order) {
5856
- _context65.next = 2;
6197
+ _context66.next = 2;
5857
6198
  break;
5858
6199
  }
5859
6200
  throw new Error('order 模块未初始化');
5860
6201
  case 2:
5861
- _context65.next = 4;
6202
+ _context66.next = 4;
5862
6203
  return this.store.order.applyPromotion();
5863
6204
  case 4:
5864
6205
  case "end":
5865
- return _context65.stop();
6206
+ return _context66.stop();
5866
6207
  }
5867
- }, _callee65, this);
6208
+ }, _callee66, this);
5868
6209
  }));
5869
6210
  function applyPromotion() {
5870
6211
  return _applyPromotion.apply(this, arguments);
@@ -5891,18 +6232,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5891
6232
  }, {
5892
6233
  key: "getProductList",
5893
6234
  value: function () {
5894
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
6235
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
5895
6236
  var _this$otherParams36;
5896
6237
  var menu_list_ids, _this$store$products, res;
5897
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
5898
- while (1) switch (_context66.prev = _context66.next) {
6238
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6239
+ while (1) switch (_context67.prev = _context67.next) {
5899
6240
  case 0:
5900
6241
  // 可以直接通过配置里的 menu 读取
5901
6242
  menu_list_ids = ((_this$otherParams36 = this.otherParams) === null || _this$otherParams36 === void 0 || (_this$otherParams36 = _this$otherParams36.dineInConfig) === null || _this$otherParams36 === void 0 ? void 0 : _this$otherParams36['menu.associated_menus'].map(function (n) {
5902
6243
  return Number(n.value);
5903
6244
  })) || [];
5904
- _context66.prev = 1;
5905
- _context66.next = 4;
6245
+ _context67.prev = 1;
6246
+ _context67.next = 4;
5906
6247
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
5907
6248
  menu_list_ids: menu_list_ids,
5908
6249
  cacheId: this.cacheId,
@@ -5910,17 +6251,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5910
6251
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
5911
6252
  });
5912
6253
  case 4:
5913
- res = _context66.sent;
5914
- return _context66.abrupt("return", res);
6254
+ res = _context67.sent;
6255
+ return _context67.abrupt("return", res);
5915
6256
  case 8:
5916
- _context66.prev = 8;
5917
- _context66.t0 = _context66["catch"](1);
5918
- throw _context66.t0;
6257
+ _context67.prev = 8;
6258
+ _context67.t0 = _context67["catch"](1);
6259
+ throw _context67.t0;
5919
6260
  case 11:
5920
6261
  case "end":
5921
- return _context66.stop();
6262
+ return _context67.stop();
5922
6263
  }
5923
- }, _callee66, this, [[1, 8]]);
6264
+ }, _callee67, this, [[1, 8]]);
5924
6265
  }));
5925
6266
  function getProductList() {
5926
6267
  return _getProductList.apply(this, arguments);
@@ -5935,31 +6276,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5935
6276
  }, {
5936
6277
  key: "setOtherParams",
5937
6278
  value: function () {
5938
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
6279
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
5939
6280
  var _this$otherParams37;
5940
- var _ref49,
5941
- _ref49$cover,
6281
+ var _ref52,
6282
+ _ref52$cover,
5942
6283
  cover,
5943
- _args67 = arguments;
5944
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
5945
- while (1) switch (_context67.prev = _context67.next) {
6284
+ _args68 = arguments;
6285
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6286
+ while (1) switch (_context68.prev = _context68.next) {
5946
6287
  case 0:
5947
- _ref49 = _args67.length > 1 && _args67[1] !== undefined ? _args67[1] : {}, _ref49$cover = _ref49.cover, cover = _ref49$cover === void 0 ? false : _ref49$cover;
6288
+ _ref52 = _args68.length > 1 && _args68[1] !== undefined ? _args68[1] : {}, _ref52$cover = _ref52.cover, cover = _ref52$cover === void 0 ? false : _ref52$cover;
5948
6289
  if (cover) {
5949
6290
  this.otherParams = _objectSpread({}, params);
5950
6291
  } else {
5951
6292
  this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
5952
6293
  }
5953
6294
  this.cacheId = (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.cacheId;
5954
- _context67.next = 5;
6295
+ _context68.next = 5;
5955
6296
  return this.syncOtherParamsToSubModules(params, {
5956
6297
  cover: cover
5957
6298
  });
5958
6299
  case 5:
5959
6300
  case "end":
5960
- return _context67.stop();
6301
+ return _context68.stop();
5961
6302
  }
5962
- }, _callee67, this);
6303
+ }, _callee68, this);
5963
6304
  }));
5964
6305
  function setOtherParams(_x61) {
5965
6306
  return _setOtherParams.apply(this, arguments);