@pisell/pisellos 0.10.21 → 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 (67) 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/Order/index.d.ts +5 -0
  8. package/dist/modules/Order/index.js +148 -84
  9. package/dist/modules/ProductList/clientDataVariants.d.ts +50 -0
  10. package/dist/modules/ProductList/clientDataVariants.js +216 -0
  11. package/dist/modules/ProductList/index.d.ts +14 -13
  12. package/dist/modules/ProductList/index.js +105 -77
  13. package/dist/modules/Quotation/index.d.ts +16 -0
  14. package/dist/modules/Quotation/index.js +240 -27
  15. package/dist/modules/ResourcePlanner/planner.d.ts +2 -2
  16. package/dist/modules/ResourcePlanner/planner.js +88 -21
  17. package/dist/modules/ResourcePlanner/types.d.ts +12 -0
  18. package/dist/modules/Rules/index.d.ts +5 -0
  19. package/dist/modules/Rules/index.js +27 -12
  20. package/dist/solution/BaseSales/index.d.ts +16 -1
  21. package/dist/solution/BaseSales/index.js +667 -349
  22. package/dist/solution/BookingByStep/index.d.ts +1 -1
  23. package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
  24. package/dist/solution/UnifiedBookingSales/index.js +290 -81
  25. package/dist/solution/UnifiedBookingSales/types.d.ts +4 -0
  26. package/dist/solution/VenueBooking/index.d.ts +2 -0
  27. package/dist/solution/VenueBooking/index.js +542 -494
  28. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  29. package/dist/solution/VenueBooking/utils/dateSummary.js +3 -1
  30. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  31. package/dist/solution/VenueBooking/utils/slotMerge.js +3 -1
  32. package/dist/utils/platform.d.ts +8 -0
  33. package/dist/utils/platform.js +15 -0
  34. package/lib/model/strategy/adapter/promotion/index.js +46 -1
  35. package/lib/modules/BookingContext/index.d.ts +3 -0
  36. package/lib/modules/BookingContext/index.js +35 -8
  37. package/lib/modules/BookingContext/types.d.ts +4 -4
  38. package/lib/modules/BookingContext/types.js +3 -3
  39. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +4 -0
  40. package/lib/modules/Order/index.d.ts +5 -0
  41. package/lib/modules/Order/index.js +65 -8
  42. package/lib/modules/ProductList/clientDataVariants.d.ts +50 -0
  43. package/lib/modules/ProductList/clientDataVariants.js +204 -0
  44. package/lib/modules/ProductList/index.d.ts +14 -13
  45. package/lib/modules/ProductList/index.js +77 -58
  46. package/lib/modules/Quotation/index.d.ts +16 -0
  47. package/lib/modules/Quotation/index.js +112 -9
  48. package/lib/modules/ResourcePlanner/planner.d.ts +2 -2
  49. package/lib/modules/ResourcePlanner/planner.js +80 -20
  50. package/lib/modules/ResourcePlanner/types.d.ts +12 -0
  51. package/lib/modules/Rules/index.d.ts +5 -0
  52. package/lib/modules/Rules/index.js +20 -11
  53. package/lib/solution/BaseSales/index.d.ts +16 -1
  54. package/lib/solution/BaseSales/index.js +293 -66
  55. package/lib/solution/BookingByStep/index.d.ts +1 -1
  56. package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
  57. package/lib/solution/UnifiedBookingSales/index.js +225 -20
  58. package/lib/solution/UnifiedBookingSales/types.d.ts +4 -0
  59. package/lib/solution/VenueBooking/index.d.ts +2 -0
  60. package/lib/solution/VenueBooking/index.js +28 -8
  61. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  62. package/lib/solution/VenueBooking/utils/dateSummary.js +3 -1
  63. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  64. package/lib/solution/VenueBooking/utils/slotMerge.js +3 -1
  65. package/lib/utils/platform.d.ts +8 -0
  66. package/lib/utils/platform.js +22 -0
  67. 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";
@@ -886,7 +888,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
886
888
  key: "loadQuotationForPriceQuery",
887
889
  value: function () {
888
890
  var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
889
- var _this$otherParams;
891
+ var quotation, load;
890
892
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
891
893
  while (1) switch (_context6.prev = _context6.next) {
892
894
  case 0:
@@ -897,12 +899,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
897
899
  return _context6.abrupt("return");
898
900
  case 2:
899
901
  this.applyQuotationScheduleResolver(params.quotation);
900
- _context6.next = 5;
901
- return params.quotation.loadQuotations({
902
- 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),
903
907
  customer_id: params.customer_id
904
908
  });
905
- case 5:
909
+ case 7:
906
910
  case "end":
907
911
  return _context6.stop();
908
912
  }
@@ -929,9 +933,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
929
933
  }, {
930
934
  key: "getPriceQueryChannel",
931
935
  value: function getPriceQueryChannel(channel) {
932
- var _this$otherParams2, _ref12, _ref13, _this$otherParams3, _this$otherParams4;
933
- 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 : {};
934
- 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;
935
939
  if (value === undefined || value === null || String(value).trim() === '') {
936
940
  return undefined;
937
941
  }
@@ -944,11 +948,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
944
948
  }, {
945
949
  key: "getPriceQueryStrategyContext",
946
950
  value: function getPriceQueryStrategyContext(channel) {
947
- var _this$otherParams5, _ref14, _strategyContext$busi, _this$otherParams6, _this$otherParams7;
948
- 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 : {};
949
953
  var strategyContext = _objectSpread({}, inherited);
950
954
  var resolvedChannel = this.getPriceQueryChannel(channel);
951
- 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;
952
956
  if (resolvedChannel) strategyContext.channel = resolvedChannel;
953
957
  if (businessCode !== undefined && businessCode !== null && String(businessCode).trim() !== '') {
954
958
  strategyContext.business_code = String(businessCode).trim();
@@ -1018,11 +1022,167 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1018
1022
  schedule_datetime: now.format('YYYY-MM-DD HH:mm:ss')
1019
1023
  };
1020
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
+ }
1021
1181
  }, {
1022
1182
  key: "loadProductsForPriceQuery",
1023
1183
  value: function () {
1024
1184
  var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
1025
- var ids, productsById, channel, strategyContext, _response$data, response, list;
1185
+ var ids, productsById, handledByOsServer, _response$data, queryPayload, response, list, scheduleList, resolvedList;
1026
1186
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1027
1187
  while (1) switch (_context8.prev = _context8.next) {
1028
1188
  case 0:
@@ -1036,24 +1196,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1036
1196
  }
1037
1197
  return _context8.abrupt("return", productsById);
1038
1198
  case 4:
1039
- channel = this.getPriceQueryChannel(params.channel);
1040
- strategyContext = this.getPriceQueryStrategyContext(channel);
1041
- _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
+ }));
1042
1204
  _context8.next = 9;
1043
- return this.request.post('/product/query', _objectSpread({
1044
- ids: ids,
1045
- open_quotation: 1,
1046
- open_bundle: 1,
1047
- status: 'published',
1048
- num: 1,
1049
- skip: 1,
1050
- customer_id: params.customerId,
1051
- schedule_date: params.schedule.schedule_date,
1052
- schedule_datetime: params.schedule.schedule_datetime,
1053
- application_code: channel
1054
- }, Object.keys(strategyContext).length ? {
1055
- strategy_context: strategyContext
1056
- } : {}), {
1205
+ return this.request.post('/product/query', queryPayload, {
1057
1206
  osServer: true,
1058
1207
  customToast: function customToast() {}
1059
1208
  });
@@ -1066,6 +1215,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1066
1215
  }
1067
1216
  return _context8.abrupt("return", productsById);
1068
1217
  case 13:
1218
+ if (!(this.isCustomerUserPriceQuery() && !handledByOsServer)) {
1219
+ _context8.next = 17;
1220
+ break;
1221
+ }
1222
+ this.rememberRawProductPriceSources(list);
1069
1223
  list.forEach(function (item) {
1070
1224
  var _item$id;
1071
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);
@@ -1073,18 +1227,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1073
1227
  });
1074
1228
  return _context8.abrupt("return", productsById);
1075
1229
  case 17:
1076
- _context8.prev = 17;
1077
- _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);
1078
1249
  this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
1079
1250
  ids: ids,
1080
1251
  error: _context8.t0 instanceof Error ? _context8.t0.message : String(_context8.t0)
1081
1252
  });
1082
1253
  return _context8.abrupt("return", productsById);
1083
- case 21:
1254
+ case 27:
1084
1255
  case "end":
1085
1256
  return _context8.stop();
1086
1257
  }
1087
- }, _callee8, this, [[6, 17]]);
1258
+ }, _callee8, this, [[5, 23]]);
1088
1259
  }));
1089
1260
  function loadProductsForPriceQuery(_x7) {
1090
1261
  return _loadProductsForPriceQuery.apply(this, arguments);
@@ -1092,42 +1263,127 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1092
1263
  return loadProductsForPriceQuery;
1093
1264
  }()
1094
1265
  }, {
1095
- key: "loadProductForPriceQuery",
1266
+ key: "resolveProductsForPriceQuery",
1096
1267
  value: function () {
1097
- var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params, customerId) {
1098
- 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;
1099
1271
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1100
1272
  while (1) switch (_context9.prev = _context9.next) {
1101
1273
  case 0:
1102
- product = params.product || {};
1103
- productId = this.getPriceQueryProductId(product);
1104
- if (!(productId === null || !this.request)) {
1105
- _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;
1106
1285
  break;
1107
1286
  }
1108
- return _context9.abrupt("return", null);
1109
- case 4:
1110
- schedule = this.getPriceQuerySchedule(params);
1111
- _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;
1112
1306
  return this.loadProductsForPriceQuery({
1113
- ids: [productId],
1114
- schedule: schedule,
1115
- customerId: customerId,
1307
+ ids: ids,
1308
+ schedule: params.schedule,
1309
+ customerId: params.customerId,
1116
1310
  channel: params.channel
1117
1311
  });
1118
- case 7:
1312
+ case 12:
1119
1313
  productsById = _context9.sent;
1120
- return _context9.abrupt("return", productsById.get(productId) || null);
1121
- 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:
1122
1378
  case "end":
1123
1379
  return _context9.stop();
1124
1380
  }
1125
1381
  }, _callee9, this);
1126
1382
  }));
1127
- function loadProductForPriceQuery(_x8, _x9) {
1128
- return _loadProductForPriceQuery.apply(this, arguments);
1383
+ function resolveProductsForPriceQuery(_x8) {
1384
+ return _resolveProductsForPriceQuery.apply(this, arguments);
1129
1385
  }
1130
- return loadProductForPriceQuery;
1386
+ return resolveProductsForPriceQuery;
1131
1387
  }()
1132
1388
  }, {
1133
1389
  key: "getAuthoritativeBundleItems",
@@ -1137,10 +1393,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1137
1393
  return groups.flatMap(function (group) {
1138
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 : [];
1139
1395
  return items.map(function (item) {
1140
- var _item$group_id, _ref15, _item$bundle_group_id;
1396
+ var _item$group_id, _ref19, _item$bundle_group_id;
1141
1397
  return _objectSpread(_objectSpread({}, item), {}, {
1142
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,
1143
- 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
1144
1400
  });
1145
1401
  });
1146
1402
  });
@@ -1171,44 +1427,44 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1171
1427
  }, {
1172
1428
  key: "getAuthoritativeBundleUnitPrice",
1173
1429
  value: function getAuthoritativeBundleUnitPrice(bundle) {
1174
- var _ref16, _ref17, _ref18, _bundle$price;
1175
- 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;
1176
1432
  }
1177
1433
  }, {
1178
1434
  key: "mergeProductForPriceQuery",
1179
1435
  value: function mergeProductForPriceQuery(product, authoritativeProduct) {
1180
- var _this5 = this,
1436
+ var _this7 = this,
1181
1437
  _product$id,
1182
- _ref19,
1183
- _product$product_id2,
1184
- _ref20,
1185
- _product$product_vari,
1186
- _ref21,
1438
+ _ref23,
1439
+ _product$product_id3,
1440
+ _ref24,
1441
+ _product$product_vari2,
1442
+ _ref25,
1187
1443
  _product$num,
1188
- _ref22,
1444
+ _ref26,
1189
1445
  _product$quantity,
1190
1446
  _product$metadata4;
1191
1447
  if (!authoritativeProduct) return product;
1192
1448
  var selectedBundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
1193
1449
  var authoritativeBundles = this.getAuthoritativeBundleItems(authoritativeProduct);
1194
1450
  var productBundle = selectedBundles.map(function (bundle) {
1195
- var _authoritativeBundle$, _authoritativeBundle$2;
1196
- var authoritativeBundle = _this5.findAuthoritativeBundleItem(bundle, authoritativeBundles);
1197
- 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;
1198
1454
  if (unitPrice === undefined || unitPrice === null || unitPrice === '') return bundle;
1199
1455
  return _objectSpread(_objectSpread({}, bundle), {}, {
1200
1456
  price: unitPrice,
1201
1457
  bundle_selling_price: unitPrice,
1202
- base_price: (_authoritativeBundle$ = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.base_price) !== null && _authoritativeBundle$ !== void 0 ? _authoritativeBundle$ : bundle.base_price,
1203
- 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
1204
1460
  });
1205
1461
  });
1206
1462
  return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
1207
1463
  id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
1208
- 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,
1209
- 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,
1210
- num: (_ref21 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref21 !== void 0 ? _ref21 : authoritativeProduct.num,
1211
- 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,
1212
1468
  product_sku: function () {
1213
1469
  var authoritativeSku = ensureProductSku(authoritativeProduct);
1214
1470
  var productSku = ensureProductSku(product);
@@ -1375,24 +1631,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1375
1631
  key: "syncOtherParamsToSubModules",
1376
1632
  value: (function () {
1377
1633
  var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(changedParams) {
1378
- var _this6 = this;
1379
- var _ref26,
1380
- _ref26$cover,
1634
+ var _this8 = this;
1635
+ var _ref30,
1636
+ _ref30$cover,
1381
1637
  cover,
1382
1638
  _args11 = arguments;
1383
1639
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1384
1640
  while (1) switch (_context11.prev = _context11.next) {
1385
1641
  case 0:
1386
- _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;
1387
1643
  _context11.next = 3;
1388
1644
  return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
1389
- var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref27) {
1390
- var _ref29, moduleName, subModule, targetModule, nextSubModuleOtherParams;
1645
+ var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref31) {
1646
+ var _ref33, moduleName, subModule, targetModule, nextSubModuleOtherParams;
1391
1647
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1392
1648
  while (1) switch (_context10.prev = _context10.next) {
1393
1649
  case 0:
1394
- _ref29 = _slicedToArray(_ref27, 2), moduleName = _ref29[0], subModule = _ref29[1];
1395
- if (!_this6.reusedSharedSubModuleNames.has(moduleName)) {
1650
+ _ref33 = _slicedToArray(_ref31, 2), moduleName = _ref33[0], subModule = _ref33[1];
1651
+ if (!_this8.reusedSharedSubModuleNames.has(moduleName)) {
1396
1652
  _context10.next = 3;
1397
1653
  break;
1398
1654
  }
@@ -1405,7 +1661,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1405
1661
  }
1406
1662
  return _context10.abrupt("return");
1407
1663
  case 6:
1408
- nextSubModuleOtherParams = _this6.buildSubModuleOtherParams(moduleName);
1664
+ nextSubModuleOtherParams = _this8.buildSubModuleOtherParams(moduleName);
1409
1665
  _context10.next = 9;
1410
1666
  return targetModule.updateOtherParams(nextSubModuleOtherParams, {
1411
1667
  changedParams: changedParams,
@@ -1417,8 +1673,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1417
1673
  }
1418
1674
  }, _callee10);
1419
1675
  }));
1420
- return function (_x11) {
1421
- return _ref28.apply(this, arguments);
1676
+ return function (_x10) {
1677
+ return _ref32.apply(this, arguments);
1422
1678
  };
1423
1679
  }()));
1424
1680
  case 3:
@@ -1427,7 +1683,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1427
1683
  }
1428
1684
  }, _callee11, this);
1429
1685
  }));
1430
- function syncOtherParamsToSubModules(_x10) {
1686
+ function syncOtherParamsToSubModules(_x9) {
1431
1687
  return _syncOtherParamsToSubModules.apply(this, arguments);
1432
1688
  }
1433
1689
  return syncOtherParamsToSubModules;
@@ -1477,22 +1733,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1477
1733
  }, {
1478
1734
  key: "getPaymentNumberDevicePrefixSync",
1479
1735
  value: function getPaymentNumberDevicePrefixSync() {
1480
- var _this7 = this;
1736
+ var _this9 = this;
1481
1737
  if (!this.appPlugin) return 'LOCAL';
1482
1738
  return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
1483
- return _this7.getAppData(key);
1739
+ return _this9.getAppData(key);
1484
1740
  });
1485
1741
  }
1486
1742
  }, {
1487
1743
  key: "getPaymentNumberDevicePrefixAsync",
1488
1744
  value: function getPaymentNumberDevicePrefixAsync() {
1489
- var _this8 = this;
1745
+ var _this10 = this;
1490
1746
  if (!this.appPlugin) return Promise.resolve('LOCAL');
1491
1747
  if (this.paymentNumberDevicePrefix) {
1492
1748
  return Promise.resolve(this.paymentNumberDevicePrefix);
1493
1749
  }
1494
1750
  return resolvePaymentNumberDevicePrefix(function (key) {
1495
- return _this8.getAppData(key);
1751
+ return _this10.getAppData(key);
1496
1752
  });
1497
1753
  }
1498
1754
  }, {
@@ -1540,10 +1796,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1540
1796
  }
1541
1797
  tempOrder.metadata = tempOrder.metadata || {};
1542
1798
  if (shouldManageLegalCurrencySnapshot) {
1543
- 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;
1544
1800
  var legalCurrencySnapshot = {
1545
- 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 : ''),
1546
- 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 : ''),
1547
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')
1548
1804
  };
1549
1805
  if (JSON.stringify(tempOrder.metadata.legal_currency_snapshot || {}) !== JSON.stringify(legalCurrencySnapshot)) {
@@ -1574,7 +1830,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1574
1830
  var _this$otherParams12,
1575
1831
  _this$appPlugin2,
1576
1832
  _this$appPlugin2$getA,
1577
- _this9 = this,
1833
+ _this11 = this,
1578
1834
  _this$otherParams13;
1579
1835
  var options,
1580
1836
  app,
@@ -1605,24 +1861,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1605
1861
  targetCacheData = this.readSessionCacheData();
1606
1862
  moduleNames = this.getRegisteredModuleNames();
1607
1863
  moduleNames.forEach(function (step) {
1608
- var reusedModule = _this9.getReusableSharedSubModule(step);
1864
+ var reusedModule = _this11.getReusableSharedSubModule(step);
1609
1865
  if (reusedModule) {
1610
- _this9.store[step] = reusedModule;
1611
- _this9.reusedSharedSubModuleNames.add(step);
1866
+ _this11.store[step] = reusedModule;
1867
+ _this11.reusedSharedSubModuleNames.add(step);
1612
1868
  return;
1613
1869
  }
1614
- var targetModule = _this9.createSubModule(step);
1870
+ var targetModule = _this11.createSubModule(step);
1615
1871
  if (!targetModule) {
1616
1872
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
1617
1873
  }
1618
- var hooks = _this9.getSubModuleHooks(step);
1619
- _this9.store[step] = targetModule;
1620
- _this9.core.registerModule(targetModule, _objectSpread(_objectSpread({
1621
- 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]) || {} : {}
1622
1878
  }, hooks ? {
1623
1879
  hooks: hooks
1624
1880
  } : {}), {}, {
1625
- otherParams: _this9.buildSubModuleOtherParams(step)
1881
+ otherParams: _this11.buildSubModuleOtherParams(step)
1626
1882
  }));
1627
1883
  });
1628
1884
  if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
@@ -1646,7 +1902,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1646
1902
  }
1647
1903
  }, _callee12, this);
1648
1904
  }));
1649
- function initialize(_x12) {
1905
+ function initialize(_x11) {
1650
1906
  return _initialize.apply(this, arguments);
1651
1907
  }
1652
1908
  return initialize;
@@ -1656,15 +1912,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1656
1912
  value: function () {
1657
1913
  var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1658
1914
  var _this$serverOrderChan2,
1659
- _this10 = this;
1915
+ _this12 = this;
1660
1916
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1661
1917
  while (1) switch (_context13.prev = _context13.next) {
1662
1918
  case 0:
1663
1919
  (_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
1664
1920
  this.serverOrderChangeUnsubscribe = null;
1665
1921
  Object.keys(this.store).forEach(function (key) {
1666
- if (_this10.reusedSharedSubModuleNames.has(key)) return;
1667
- var sub = _this10.store[key];
1922
+ if (_this12.reusedSharedSubModuleNames.has(key)) return;
1923
+ var sub = _this12.store[key];
1668
1924
  if (sub && typeof sub.destroy === 'function') {
1669
1925
  try {
1670
1926
  sub.destroy();
@@ -1704,7 +1960,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1704
1960
  key: "loadSalesDetail",
1705
1961
  value: (function () {
1706
1962
  var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(orderIdOrParams) {
1707
- 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;
1708
1964
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1709
1965
  while (1) switch (_context14.prev = _context14.next) {
1710
1966
  case 0:
@@ -1722,7 +1978,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1722
1978
  };
1723
1979
  externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
1724
1980
  preloadedSalesDetail = params.preloadedSalesDetail;
1725
- 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;
1726
1982
  if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
1727
1983
  _context14.next = 11;
1728
1984
  break;
@@ -1794,7 +2050,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1794
2050
  }
1795
2051
  }, _callee14, this, [[4,, 32, 44], [35, 40]]);
1796
2052
  }));
1797
- function loadSalesDetail(_x13) {
2053
+ function loadSalesDetail(_x12) {
1798
2054
  return _loadSalesDetail.apply(this, arguments);
1799
2055
  }
1800
2056
  return loadSalesDetail;
@@ -1901,7 +2157,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1901
2157
  }
1902
2158
  }, _callee15, this);
1903
2159
  }));
1904
- function replaceTempOrder(_x14, _x15) {
2160
+ function replaceTempOrder(_x13, _x14) {
1905
2161
  return _replaceTempOrder.apply(this, arguments);
1906
2162
  }
1907
2163
  return replaceTempOrder;
@@ -2270,10 +2526,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2270
2526
  }, {
2271
2527
  key: "getHistoricalProductDiscountList",
2272
2528
  value: function getHistoricalProductDiscountList(products) {
2273
- var _this11 = this;
2529
+ var _this13 = this;
2274
2530
  var historyDiscountList = [];
2275
2531
  products.forEach(function (item) {
2276
- if (!_this11.isPersistedOrderProduct(item)) return;
2532
+ if (!_this13.isPersistedOrderProduct(item)) return;
2277
2533
  (item.discount_list || []).forEach(function (discount) {
2278
2534
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
2279
2535
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
@@ -2333,11 +2589,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2333
2589
  }, {
2334
2590
  key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
2335
2591
  value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
2336
- var _this12 = this;
2592
+ var _this14 = this;
2337
2593
  if (params.discountAction !== 'edit') return false;
2338
2594
  if (!params.products.length) return false;
2339
2595
  var hasDraftProduct = params.products.some(function (product) {
2340
- return !_this12.isPersistedOrderProduct(product);
2596
+ return !_this14.isPersistedOrderProduct(product);
2341
2597
  });
2342
2598
  if (hasDraftProduct) return false;
2343
2599
 
@@ -2613,7 +2869,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2613
2869
  }
2614
2870
  }, _callee22, this, [[53, 72, 75, 78]]);
2615
2871
  }));
2616
- function loadDiscountConfig(_x16) {
2872
+ function loadDiscountConfig(_x15) {
2617
2873
  return _loadDiscountConfig.apply(this, arguments);
2618
2874
  }
2619
2875
  return loadDiscountConfig;
@@ -2728,7 +2984,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2728
2984
  }
2729
2985
  }, _callee23, this);
2730
2986
  }));
2731
- function bestDiscount(_x17) {
2987
+ function bestDiscount(_x16) {
2732
2988
  return _bestDiscount.apply(this, arguments);
2733
2989
  }
2734
2990
  return bestDiscount;
@@ -2791,7 +3047,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2791
3047
  }
2792
3048
  }, _callee24, this);
2793
3049
  }));
2794
- function replaceDiscountStoreLists(_x18) {
3050
+ function replaceDiscountStoreLists(_x17) {
2795
3051
  return _replaceDiscountStoreLists.apply(this, arguments);
2796
3052
  }
2797
3053
  return replaceDiscountStoreLists;
@@ -2853,7 +3109,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2853
3109
  }
2854
3110
  }, _callee25, this, [[0, 16]]);
2855
3111
  }));
2856
- function scanPromotionCode(_x19, _x20) {
3112
+ function scanPromotionCode(_x18, _x19) {
2857
3113
  return _scanPromotionCode.apply(this, arguments);
2858
3114
  }
2859
3115
  return scanPromotionCode;
@@ -2985,10 +3241,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2985
3241
  product.discount_list = filterSelectedDiscountDetails(product.discount_list);
2986
3242
  if (Array.isArray(product.product_bundle)) {
2987
3243
  product.product_bundle = product.product_bundle.map(function (bundle) {
2988
- var _ref38, _bundle$original_pric;
3244
+ var _ref42, _bundle$original_pric;
2989
3245
  var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
2990
3246
  var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
2991
- 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;
2992
3248
  return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
2993
3249
  price: restoredBundlePrice,
2994
3250
  bundle_selling_price: restoredBundlePrice
@@ -3061,7 +3317,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3061
3317
  }
3062
3318
  }, _callee26, this, [[0, 64], [27, 48, 51, 54]]);
3063
3319
  }));
3064
- function setDiscountSelected(_x21) {
3320
+ function setDiscountSelected(_x20) {
3065
3321
  return _setDiscountSelected.apply(this, arguments);
3066
3322
  }
3067
3323
  return setDiscountSelected;
@@ -3131,7 +3387,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3131
3387
  }
3132
3388
  }, _callee27, this, [[0, 21]]);
3133
3389
  }));
3134
- function applyDiscountCalculationResult(_x22) {
3390
+ function applyDiscountCalculationResult(_x21) {
3135
3391
  return _applyDiscountCalculationResult.apply(this, arguments);
3136
3392
  }
3137
3393
  return applyDiscountCalculationResult;
@@ -3150,7 +3406,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3150
3406
  }
3151
3407
  }, _callee28, this);
3152
3408
  }));
3153
- function submitScanOrder(_x23) {
3409
+ function submitScanOrder(_x22) {
3154
3410
  return _submitScanOrder.apply(this, arguments);
3155
3411
  }
3156
3412
  return submitScanOrder;
@@ -3386,7 +3642,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3386
3642
  }
3387
3643
  }, _callee30, this);
3388
3644
  }));
3389
- function submitSalesOrder(_x24) {
3645
+ function submitSalesOrder(_x23) {
3390
3646
  return _submitSalesOrder.apply(this, arguments);
3391
3647
  }
3392
3648
  return submitSalesOrder;
@@ -3420,7 +3676,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3420
3676
  }
3421
3677
  }, _callee31, this);
3422
3678
  }));
3423
- function saveSalesOrderDraft(_x25) {
3679
+ function saveSalesOrderDraft(_x24) {
3424
3680
  return _saveSalesOrderDraft.apply(this, arguments);
3425
3681
  }
3426
3682
  return saveSalesOrderDraft;
@@ -3468,7 +3724,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3468
3724
  }
3469
3725
  }, _callee32, this);
3470
3726
  }));
3471
- function submitTempOrderAsync(_x26) {
3727
+ function submitTempOrderAsync(_x25) {
3472
3728
  return _submitTempOrderAsync.apply(this, arguments);
3473
3729
  }
3474
3730
  return submitTempOrderAsync;
@@ -3560,7 +3816,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3560
3816
  }
3561
3817
  }, _callee33, this);
3562
3818
  }));
3563
- function printLocalOrderReceipt(_x27) {
3819
+ function printLocalOrderReceipt(_x26) {
3564
3820
  return _printLocalOrderReceipt.apply(this, arguments);
3565
3821
  }
3566
3822
  return printLocalOrderReceipt;
@@ -3582,7 +3838,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3582
3838
  key: "syncPaymentsToOrder",
3583
3839
  value: function () {
3584
3840
  var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
3585
- var _ref39, _params$businessCode, _this$otherParams31, _this$otherParams32, _params$channel2;
3841
+ var _ref43, _params$businessCode, _this$otherParams31, _this$otherParams32, _params$channel2;
3586
3842
  var businessCode, channel, enhancePayload, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
3587
3843
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3588
3844
  while (1) switch (_context34.prev = _context34.next) {
@@ -3593,7 +3849,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3593
3849
  }
3594
3850
  throw new Error('order 模块未初始化');
3595
3851
  case 2:
3596
- 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;
3597
3853
  channel = (_params$channel2 = params.channel) !== null && _params$channel2 !== void 0 ? _params$channel2 : this.getSubmitOrderSalesChannel();
3598
3854
  enhancePayload = this.buildSubmitPayloadEnhancerWithOpenDataConfig(params.enhancePayload);
3599
3855
  syncParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params), {}, {
@@ -3677,7 +3933,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3677
3933
  }
3678
3934
  }, _callee34, this, [[13, 30]]);
3679
3935
  }));
3680
- function syncPaymentsToOrder(_x28) {
3936
+ function syncPaymentsToOrder(_x27) {
3681
3937
  return _syncPaymentsToOrder.apply(this, arguments);
3682
3938
  }
3683
3939
  return syncPaymentsToOrder;
@@ -3714,13 +3970,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3714
3970
  }, {
3715
3971
  key: "scheduleQueuedAutoPaymentSyncFlush",
3716
3972
  value: function scheduleQueuedAutoPaymentSyncFlush() {
3717
- var _this13 = this;
3973
+ var _this15 = this;
3718
3974
  var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
3719
3975
  if (!this.queuedAutoPaymentSync) return;
3720
3976
  if (this.autoPaymentSyncTimer) return;
3721
3977
  this.autoPaymentSyncTimer = setTimeout(function () {
3722
- _this13.autoPaymentSyncTimer = null;
3723
- void _this13.flushQueuedAutoPaymentSync();
3978
+ _this15.autoPaymentSyncTimer = null;
3979
+ void _this15.flushQueuedAutoPaymentSync();
3724
3980
  }, delay);
3725
3981
  }
3726
3982
  }, {
@@ -3847,7 +4103,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3847
4103
  }
3848
4104
  }, _callee36, this);
3849
4105
  }));
3850
- function addOrderPaymentAsync(_x29) {
4106
+ function addOrderPaymentAsync(_x28) {
3851
4107
  return _addOrderPaymentAsync.apply(this, arguments);
3852
4108
  }
3853
4109
  return addOrderPaymentAsync;
@@ -3858,9 +4114,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3858
4114
  var _this$otherParams33,
3859
4115
  _paymentRecord$paymen,
3860
4116
  _paymentRecord$create,
3861
- _ref40,
4117
+ _ref44,
3862
4118
  _paymentRecord$origin,
3863
- _this14 = this;
4119
+ _this16 = this;
3864
4120
  if (!this.store.order) throw new Error('order 模块未初始化');
3865
4121
  var paymentRecord = payment;
3866
4122
  var paymentAmount = new Decimal(paymentRecord.amount || 0);
@@ -3880,7 +4136,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3880
4136
  var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
3881
4137
  var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
3882
4138
  var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
3883
- 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;
3884
4140
  var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, normalizedPaymentRecord), calculatedServiceFee !== undefined ? {
3885
4141
  service_fee: calculatedServiceFee
3886
4142
  } : {}), {}, {
@@ -3904,7 +4160,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3904
4160
  submitWhenPaid: true,
3905
4161
  smallTicketDataFlag: 1
3906
4162
  }).catch(function (error) {
3907
- _this14.logError('auto sync payments failed', {
4163
+ _this16.logError('auto sync payments failed', {
3908
4164
  error: error instanceof Error ? error.message : String(error)
3909
4165
  });
3910
4166
  });
@@ -4035,7 +4291,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4035
4291
  }
4036
4292
  }, _callee37, this, [[17, 23]]);
4037
4293
  }));
4038
- function updateOrderPayment(_x30, _x31) {
4294
+ function updateOrderPayment(_x29, _x30) {
4039
4295
  return _updateOrderPayment.apply(this, arguments);
4040
4296
  }
4041
4297
  return updateOrderPayment;
@@ -4074,7 +4330,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4074
4330
  }
4075
4331
  }, _callee38, this);
4076
4332
  }));
4077
- function updateVoucherOrderPaymentsAsync(_x32, _x33) {
4333
+ function updateVoucherOrderPaymentsAsync(_x31, _x32) {
4078
4334
  return _updateVoucherOrderPaymentsAsync.apply(this, arguments);
4079
4335
  }
4080
4336
  return updateVoucherOrderPaymentsAsync;
@@ -4108,14 +4364,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4108
4364
  // const products = tempOrder?.products?.filter(n => n.product_id)
4109
4365
 
4110
4366
  var walletProducts = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products.map(function (product) {
4111
- 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;
4112
4368
  var metadata = product.metadata || {};
4113
4369
  var rawHolderId = (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id;
4114
4370
  var holderIdValue = Array.isArray(rawHolderId) ? rawHolderId[0] : rawHolderId;
4115
4371
  var holder_id = Number.isInteger(Number(holderIdValue)) ? Number(holderIdValue) : undefined;
4116
4372
  return {
4117
4373
  product_id: product.product_id || 0,
4118
- 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 : ''),
4119
4375
  quantity: product.num || 1,
4120
4376
  is_price_include_tax: tempOrder.is_price_include_tax,
4121
4377
  is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
@@ -4161,7 +4417,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4161
4417
  }, {
4162
4418
  key: "buildWalletInitBusinessData",
4163
4419
  value: function buildWalletInitBusinessData(params) {
4164
- 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;
4165
4421
  var snapshot = (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 ? void 0 : _this$store$order9.getOrderSnapshot();
4166
4422
  var tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
4167
4423
  var amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
@@ -4177,7 +4433,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4177
4433
  },
4178
4434
  products: this.getWalletProductList(),
4179
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),
4180
- 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
4181
4437
  }, snapshot.identity.orderId ? {
4182
4438
  payment_order_id: String(snapshot.identity.orderId)
4183
4439
  } : {});
@@ -4240,7 +4496,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4240
4496
  }
4241
4497
  }, _callee39, this);
4242
4498
  }));
4243
- function initWalletData(_x34) {
4499
+ function initWalletData(_x33) {
4244
4500
  return _initWalletData.apply(this, arguments);
4245
4501
  }
4246
4502
  return initWalletData;
@@ -4267,9 +4523,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4267
4523
  var walletPassName = fundRecord.wallet_pass_name;
4268
4524
  var title = walletPassName && _typeof(walletPassName) === 'object' ? walletPassName.default || Object.values(walletPassName)[0] : walletPassName;
4269
4525
  var code = String((payment === null || payment === void 0 ? void 0 : payment.code) || '').toUpperCase();
4270
- var tag = ((_Object$entries$find = Object.entries(WALLET_PAYMENT_CODE_BY_TAG).find(function (_ref42) {
4271
- var _ref43 = _slicedToArray(_ref42, 2),
4272
- 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];
4273
4529
  return paymentCode === code;
4274
4530
  })) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[0]) || fundRecord.tag;
4275
4531
  return {
@@ -4307,7 +4563,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4307
4563
  }
4308
4564
  }, _callee40, this);
4309
4565
  }));
4310
- function publishWalletAssetsState(_x35) {
4566
+ function publishWalletAssetsState(_x34) {
4311
4567
  return _publishWalletAssetsState.apply(this, arguments);
4312
4568
  }
4313
4569
  return publishWalletAssetsState;
@@ -4388,7 +4644,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4388
4644
  }
4389
4645
  }, _callee41, this);
4390
4646
  }));
4391
- function syncSelectedWalletAssets(_x36) {
4647
+ function syncSelectedWalletAssets(_x35) {
4392
4648
  return _syncSelectedWalletAssets.apply(this, arguments);
4393
4649
  }
4394
4650
  return syncSelectedWalletAssets;
@@ -4444,7 +4700,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4444
4700
  }
4445
4701
  }, _callee42, this);
4446
4702
  }));
4447
- function importWalletAssetsSnapshot(_x37) {
4703
+ function importWalletAssetsSnapshot(_x36) {
4448
4704
  return _importWalletAssetsSnapshot.apply(this, arguments);
4449
4705
  }
4450
4706
  return importWalletAssetsSnapshot;
@@ -4532,7 +4788,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4532
4788
  }
4533
4789
  }, _callee43, this);
4534
4790
  }));
4535
- function refreshWalletAssets(_x38) {
4791
+ function refreshWalletAssets(_x37) {
4536
4792
  return _refreshWalletAssets.apply(this, arguments);
4537
4793
  }
4538
4794
  return refreshWalletAssets;
@@ -4565,7 +4821,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4565
4821
  }
4566
4822
  }, _callee44, this);
4567
4823
  }));
4568
- function selectWalletAsset(_x39) {
4824
+ function selectWalletAsset(_x38) {
4569
4825
  return _selectWalletAsset.apply(this, arguments);
4570
4826
  }
4571
4827
  return selectWalletAsset;
@@ -4595,7 +4851,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4595
4851
  }
4596
4852
  }, _callee45, this);
4597
4853
  }));
4598
- function updateWalletAssetAmount(_x40) {
4854
+ function updateWalletAssetAmount(_x39) {
4599
4855
  return _updateWalletAssetAmount.apply(this, arguments);
4600
4856
  }
4601
4857
  return updateWalletAssetAmount;
@@ -4640,7 +4896,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4640
4896
  }
4641
4897
  }, _callee46, this);
4642
4898
  }));
4643
- function scanWalletAsset(_x41) {
4899
+ function scanWalletAsset(_x40) {
4644
4900
  return _scanWalletAsset.apply(this, arguments);
4645
4901
  }
4646
4902
  return scanWalletAsset;
@@ -5069,7 +5325,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5069
5325
  }
5070
5326
  }, _callee51, this, [[29, 43]]);
5071
5327
  }));
5072
- function payCash(_x42) {
5328
+ function payCash(_x41) {
5073
5329
  return _payCash.apply(this, arguments);
5074
5330
  }
5075
5331
  return payCash;
@@ -5231,7 +5487,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5231
5487
  }
5232
5488
  }, _callee52, this, [[30, 44]]);
5233
5489
  }));
5234
- function commitPaymentMethodPayment(_x43) {
5490
+ function commitPaymentMethodPayment(_x42) {
5235
5491
  return _commitPaymentMethodPayment.apply(this, arguments);
5236
5492
  }
5237
5493
  return commitPaymentMethodPayment;
@@ -5279,7 +5535,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5279
5535
  }
5280
5536
  }, _callee53, this);
5281
5537
  }));
5282
- function roundAmount(_x44) {
5538
+ function roundAmount(_x43) {
5283
5539
  return _roundAmount.apply(this, arguments);
5284
5540
  }
5285
5541
  return roundAmount;
@@ -5295,7 +5551,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5295
5551
  key: "sendCustomerPayLink",
5296
5552
  value: (function () {
5297
5553
  var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(params) {
5298
- 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;
5299
5555
  return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5300
5556
  while (1) switch (_context54.prev = _context54.next) {
5301
5557
  case 0:
@@ -5316,7 +5572,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5316
5572
  });
5317
5573
  case 6:
5318
5574
  submitResult = _context54.sent;
5319
- 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;
5320
5576
  if (orderId) {
5321
5577
  _context54.next = 10;
5322
5578
  break;
@@ -5336,7 +5592,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5336
5592
  }
5337
5593
  }, _callee54, this);
5338
5594
  }));
5339
- function sendCustomerPayLink(_x45) {
5595
+ function sendCustomerPayLink(_x44) {
5340
5596
  return _sendCustomerPayLink.apply(this, arguments);
5341
5597
  }
5342
5598
  return sendCustomerPayLink;
@@ -5351,40 +5607,54 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5351
5607
  value: function () {
5352
5608
  var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(params) {
5353
5609
  var _params$customer_id;
5354
- var quotation, customerId, authoritativeProduct, product;
5610
+ var useCustomerUserPricing, quotation, customerId, channel, _yield$this$resolvePr, _yield$this$resolvePr2, authoritativeProduct, product;
5355
5611
  return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5356
5612
  while (1) switch (_context55.prev = _context55.next) {
5357
5613
  case 0:
5358
- quotation = this.store.quotation;
5614
+ useCustomerUserPricing = this.isCustomerUserPriceQuery();
5615
+ quotation = useCustomerUserPricing ? undefined : this.store.quotation;
5359
5616
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
5360
- _context55.next = 4;
5617
+ _context55.next = 5;
5361
5618
  return this.prepareProductPriceQueryContext(customerId);
5362
- case 4:
5363
- _context55.next = 6;
5364
- return this.loadProductForPriceQuery(params, customerId);
5365
- case 6:
5366
- 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];
5367
5632
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
5368
- _context55.next = 10;
5633
+ if (useCustomerUserPricing) {
5634
+ _context55.next = 15;
5635
+ break;
5636
+ }
5637
+ _context55.next = 15;
5369
5638
  return this.loadQuotationForPriceQuery({
5370
5639
  quotation: quotation,
5371
5640
  customer_id: customerId,
5372
- channel: params.channel
5641
+ channel: channel
5373
5642
  });
5374
- case 10:
5643
+ case 15:
5375
5644
  return _context55.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
5645
+ channel: channel,
5376
5646
  product: product,
5377
5647
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
5378
5648
  customer_id: customerId,
5379
5649
  quotation: authoritativeProduct && this.preferAuthoritativeProductQueryPrice() ? undefined : quotation
5380
5650
  })));
5381
- case 11:
5651
+ case 16:
5382
5652
  case "end":
5383
5653
  return _context55.stop();
5384
5654
  }
5385
5655
  }, _callee55, this);
5386
5656
  }));
5387
- function calculateProductBookingPrice(_x46) {
5657
+ function calculateProductBookingPrice(_x45) {
5388
5658
  return _calculateProductBookingPrice.apply(this, arguments);
5389
5659
  }
5390
5660
  return calculateProductBookingPrice;
@@ -5392,7 +5662,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5392
5662
  }, {
5393
5663
  key: "getQuotationCustomerScopeInfo",
5394
5664
  value: function getQuotationCustomerScopeInfo() {
5395
- var _this15 = this;
5665
+ var _this17 = this;
5396
5666
  var quotation = this.store.quotation;
5397
5667
  if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
5398
5668
  return quotation.getQuotationCustomerScopeInfo();
@@ -5404,7 +5674,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5404
5674
  }).map(function (item) {
5405
5675
  var localSeen = new Set();
5406
5676
  var customers = item.customer.filter(function (customer) {
5407
- 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);
5408
5678
  if (!customerId || localSeen.has(customerId)) return false;
5409
5679
  localSeen.add(customerId);
5410
5680
  if (!customerById.has(customerId)) customerById.set(customerId, customer);
@@ -5431,8 +5701,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5431
5701
  }, {
5432
5702
  key: "hasSmartPricingStrategies",
5433
5703
  value: function hasSmartPricingStrategies() {
5434
- var _this$core3;
5435
- 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;
5436
5706
  if (!evaluator || typeof evaluator.getStrategyConfigs !== 'function') {
5437
5707
  return false;
5438
5708
  }
@@ -5448,7 +5718,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5448
5718
  }));
5449
5719
  var previousCustomerId = this.normalizePriceContextCustomerId(params.previousCustomerId);
5450
5720
  var nextCustomerId = this.normalizePriceContextCustomerId(params.nextCustomerId);
5451
- if (this.hasSmartPricingStrategies()) {
5721
+ if (this.isCustomerUserPriceQuery() || this.hasSmartPricingStrategies()) {
5452
5722
  return previousCustomerId !== nextCustomerId;
5453
5723
  }
5454
5724
  var previousInScope = previousCustomerId ? scopedCustomerIds.has(previousCustomerId) : false;
@@ -5468,103 +5738,151 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5468
5738
  }, {
5469
5739
  key: "calculateProductBookingPrices",
5470
5740
  value: function () {
5471
- var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(paramsList) {
5472
- var _paramsList$0$custome,
5473
- _paramsList$,
5474
- _this16 = this,
5475
- _paramsList$2;
5476
- var quotation, customerId, productMapsByGroup, groups;
5477
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5478
- 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) {
5479
5746
  case 0:
5480
5747
  if (paramsList.length) {
5481
- _context57.next = 2;
5748
+ _context58.next = 2;
5482
5749
  break;
5483
5750
  }
5484
- return _context57.abrupt("return", []);
5751
+ return _context58.abrupt("return", []);
5485
5752
  case 2:
5486
- quotation = this.store.quotation;
5487
- 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();
5488
- _context57.next = 6;
5489
- return this.prepareProductPriceQueryContext(customerId);
5490
- case 6:
5491
- 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:
5492
5793
  groups = new Map();
5493
- paramsList.forEach(function (params) {
5494
- var _this16$otherParams;
5495
- var product = params.product || {};
5496
- var productId = _this16.getPriceQueryProductId(product);
5497
- if (productId === null) return;
5498
- var schedule = _this16.getPriceQuerySchedule(params);
5499
- var channel = params.channel || ((_this16$otherParams = _this16.otherParams) === null || _this16$otherParams === void 0 ? void 0 : _this16$otherParams.channel);
5500
- 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('|');
5501
5800
  var group = groups.get(groupKey) || {
5502
- ids: new Set(),
5801
+ indices: [],
5503
5802
  schedule: schedule,
5803
+ customerId: customerId,
5504
5804
  channel: channel
5505
5805
  };
5506
- group.ids.add(productId);
5806
+ group.indices.push(index);
5507
5807
  groups.set(groupKey, group);
5508
5808
  });
5509
- _context57.next = 11;
5510
- return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
5511
- var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(_ref46) {
5512
- var _ref48, groupKey, group, productsById;
5513
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5514
- 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) {
5515
5815
  case 0:
5516
- _ref48 = _slicedToArray(_ref46, 2), groupKey = _ref48[0], group = _ref48[1];
5517
- _context56.next = 3;
5518
- return _this16.loadProductsForPriceQuery({
5519
- 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,
5520
5822
  schedule: group.schedule,
5521
- customerId: customerId,
5823
+ customerId: group.customerId,
5522
5824
  channel: group.channel
5523
5825
  });
5524
5826
  case 3:
5525
- productsById = _context56.sent;
5526
- productMapsByGroup.set(groupKey, productsById);
5827
+ resolvedProducts = _context57.sent;
5828
+ group.indices.forEach(function (originalIndex, groupIndex) {
5829
+ authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
5830
+ });
5527
5831
  case 5:
5528
5832
  case "end":
5529
- return _context56.stop();
5833
+ return _context57.stop();
5530
5834
  }
5531
- }, _callee56);
5835
+ }, _callee57);
5532
5836
  }));
5533
5837
  return function (_x48) {
5534
- return _ref47.apply(this, arguments);
5838
+ return _ref51.apply(this, arguments);
5535
5839
  };
5536
5840
  }()));
5537
- case 11:
5538
- _context57.next = 13;
5539
- return this.loadQuotationForPriceQuery({
5540
- quotation: quotation,
5541
- customer_id: customerId,
5542
- 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
+ });
5543
5856
  });
5544
- case 13:
5545
- return _context57.abrupt("return", paramsList.map(function (params) {
5546
- 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;
5547
5866
  var productInput = params.product || {};
5548
- var productId = _this16.getPriceQueryProductId(productInput);
5549
- var schedule = _this16.getPriceQuerySchedule(params);
5550
- var channel = params.channel || ((_this16$otherParams2 = _this16.otherParams) === null || _this16$otherParams2 === void 0 ? void 0 : _this16$otherParams2.channel);
5551
- var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
5552
- var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
5553
- 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];
5554
5871
  return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
5872
+ channel: channel,
5555
5873
  product: product,
5556
5874
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
5557
5875
  customer_id: customerId,
5558
- quotation: authoritativeProduct && _this16.preferAuthoritativeProductQueryPrice() ? undefined : quotation
5876
+ quotation: authoritativeProduct && _this18.preferAuthoritativeProductQueryPrice() ? undefined : quotation
5559
5877
  }));
5560
5878
  }));
5561
- case 14:
5879
+ case 20:
5562
5880
  case "end":
5563
- return _context57.stop();
5881
+ return _context58.stop();
5564
5882
  }
5565
- }, _callee57, this);
5883
+ }, _callee58, this);
5566
5884
  }));
5567
- function calculateProductBookingPrices(_x47) {
5885
+ function calculateProductBookingPrices(_x46) {
5568
5886
  return _calculateProductBookingPrices.apply(this, arguments);
5569
5887
  }
5570
5888
  return calculateProductBookingPrices;
@@ -5572,42 +5890,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5572
5890
  }, {
5573
5891
  key: "addProductToOrder",
5574
5892
  value: function () {
5575
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(product, booking, options) {
5576
- var products;
5577
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5578
- while (1) switch (_context58.prev = _context58.next) {
5579
- case 0:
5580
- _context58.prev = 0;
5581
- if (this.store.order) {
5582
- _context58.next = 3;
5583
- break;
5584
- }
5585
- throw new Error('order 模块未初始化');
5586
- case 3:
5587
- _context58.next = 5;
5588
- return this.store.order.addProductToOrder(product, booking, options);
5589
- case 5:
5590
- products = _context58.sent;
5591
- return _context58.abrupt("return", products);
5592
- case 9:
5593
- _context58.prev = 9;
5594
- _context58.t0 = _context58["catch"](0);
5595
- throw _context58.t0;
5596
- case 12:
5597
- case "end":
5598
- return _context58.stop();
5599
- }
5600
- }, _callee58, this, [[0, 9]]);
5601
- }));
5602
- function addProductToOrder(_x49, _x50, _x51) {
5603
- return _addProductToOrder.apply(this, arguments);
5604
- }
5605
- return addProductToOrder;
5606
- }()
5607
- }, {
5608
- key: "updateOrderProduct",
5609
- value: function () {
5610
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
5893
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(product, booking, options) {
5611
5894
  var products;
5612
5895
  return _regeneratorRuntime().wrap(function _callee59$(_context59) {
5613
5896
  while (1) switch (_context59.prev = _context59.next) {
@@ -5620,7 +5903,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5620
5903
  throw new Error('order 模块未初始化');
5621
5904
  case 3:
5622
5905
  _context59.next = 5;
5623
- return this.store.order.updateOrderProduct(params);
5906
+ return this.store.order.addProductToOrder(product, booking, options);
5624
5907
  case 5:
5625
5908
  products = _context59.sent;
5626
5909
  return _context59.abrupt("return", products);
@@ -5634,15 +5917,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5634
5917
  }
5635
5918
  }, _callee59, this, [[0, 9]]);
5636
5919
  }));
5637
- function updateOrderProduct(_x52) {
5638
- return _updateOrderProduct.apply(this, arguments);
5920
+ function addProductToOrder(_x49, _x50, _x51) {
5921
+ return _addProductToOrder.apply(this, arguments);
5639
5922
  }
5640
- return updateOrderProduct;
5923
+ return addProductToOrder;
5641
5924
  }()
5642
5925
  }, {
5643
- key: "updateOrderProducts",
5926
+ key: "updateOrderProduct",
5644
5927
  value: function () {
5645
- var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(paramsList) {
5928
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
5646
5929
  var products;
5647
5930
  return _regeneratorRuntime().wrap(function _callee60$(_context60) {
5648
5931
  while (1) switch (_context60.prev = _context60.next) {
@@ -5655,7 +5938,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5655
5938
  throw new Error('order 模块未初始化');
5656
5939
  case 3:
5657
5940
  _context60.next = 5;
5658
- return this.store.order.updateOrderProducts(paramsList);
5941
+ return this.store.order.updateOrderProduct(params);
5659
5942
  case 5:
5660
5943
  products = _context60.sent;
5661
5944
  return _context60.abrupt("return", products);
@@ -5669,15 +5952,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5669
5952
  }
5670
5953
  }, _callee60, this, [[0, 9]]);
5671
5954
  }));
5672
- function updateOrderProducts(_x53) {
5673
- return _updateOrderProducts.apply(this, arguments);
5955
+ function updateOrderProduct(_x52) {
5956
+ return _updateOrderProduct.apply(this, arguments);
5674
5957
  }
5675
- return updateOrderProducts;
5958
+ return updateOrderProduct;
5676
5959
  }()
5677
5960
  }, {
5678
- key: "updateOrderProductQuantity",
5961
+ key: "updateOrderProducts",
5679
5962
  value: function () {
5680
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(params) {
5963
+ var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(paramsList) {
5681
5964
  var products;
5682
5965
  return _regeneratorRuntime().wrap(function _callee61$(_context61) {
5683
5966
  while (1) switch (_context61.prev = _context61.next) {
@@ -5690,7 +5973,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5690
5973
  throw new Error('order 模块未初始化');
5691
5974
  case 3:
5692
5975
  _context61.next = 5;
5693
- return this.store.order.updateOrderProductQuantity(params);
5976
+ return this.store.order.updateOrderProducts(paramsList);
5694
5977
  case 5:
5695
5978
  products = _context61.sent;
5696
5979
  return _context61.abrupt("return", products);
@@ -5704,6 +5987,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5704
5987
  }
5705
5988
  }, _callee61, this, [[0, 9]]);
5706
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
+ }));
5707
6025
  function updateOrderProductQuantity(_x54) {
5708
6026
  return _updateOrderProductQuantity.apply(this, arguments);
5709
6027
  }
@@ -5727,12 +6045,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5727
6045
  }, {
5728
6046
  key: "setOrderProductLineNote",
5729
6047
  value: (function () {
5730
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(identity, note) {
6048
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(identity, note) {
5731
6049
  var params, products;
5732
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
5733
- while (1) switch (_context62.prev = _context62.next) {
6050
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6051
+ while (1) switch (_context63.prev = _context63.next) {
5734
6052
  case 0:
5735
- _context62.prev = 0;
6053
+ _context63.prev = 0;
5736
6054
  params = {
5737
6055
  product_id: identity.product_id,
5738
6056
  product_variant_id: identity.product_variant_id,
@@ -5747,20 +6065,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5747
6065
  params.product_sku = identity.product_sku;
5748
6066
  }
5749
6067
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
5750
- _context62.next = 7;
6068
+ _context63.next = 7;
5751
6069
  return this.updateOrderProduct(params);
5752
6070
  case 7:
5753
- products = _context62.sent;
5754
- return _context62.abrupt("return", products);
6071
+ products = _context63.sent;
6072
+ return _context63.abrupt("return", products);
5755
6073
  case 11:
5756
- _context62.prev = 11;
5757
- _context62.t0 = _context62["catch"](0);
5758
- throw _context62.t0;
6074
+ _context63.prev = 11;
6075
+ _context63.t0 = _context63["catch"](0);
6076
+ throw _context63.t0;
5759
6077
  case 14:
5760
6078
  case "end":
5761
- return _context62.stop();
6079
+ return _context63.stop();
5762
6080
  }
5763
- }, _callee62, this, [[0, 11]]);
6081
+ }, _callee63, this, [[0, 11]]);
5764
6082
  }));
5765
6083
  function setOrderProductLineNote(_x55, _x56) {
5766
6084
  return _setOrderProductLineNote.apply(this, arguments);
@@ -5777,30 +6095,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5777
6095
  }, {
5778
6096
  key: "removeProductsFromOrder",
5779
6097
  value: (function () {
5780
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(identities, options) {
5781
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
5782
- 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) {
5783
6101
  case 0:
5784
- _context63.prev = 0;
6102
+ _context64.prev = 0;
5785
6103
  if (this.store.order) {
5786
- _context63.next = 3;
6104
+ _context64.next = 3;
5787
6105
  break;
5788
6106
  }
5789
6107
  throw new Error('order 模块未初始化');
5790
6108
  case 3:
5791
- _context63.next = 5;
6109
+ _context64.next = 5;
5792
6110
  return this.store.order.removeProductsFromOrder(identities, options);
5793
6111
  case 5:
5794
- return _context63.abrupt("return", _context63.sent);
6112
+ return _context64.abrupt("return", _context64.sent);
5795
6113
  case 8:
5796
- _context63.prev = 8;
5797
- _context63.t0 = _context63["catch"](0);
5798
- throw _context63.t0;
6114
+ _context64.prev = 8;
6115
+ _context64.t0 = _context64["catch"](0);
6116
+ throw _context64.t0;
5799
6117
  case 11:
5800
6118
  case "end":
5801
- return _context63.stop();
6119
+ return _context64.stop();
5802
6120
  }
5803
- }, _callee63, this, [[0, 8]]);
6121
+ }, _callee64, this, [[0, 8]]);
5804
6122
  }));
5805
6123
  function removeProductsFromOrder(_x57, _x58) {
5806
6124
  return _removeProductsFromOrder.apply(this, arguments);
@@ -5810,16 +6128,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5810
6128
  }, {
5811
6129
  key: "removeProductFromOrder",
5812
6130
  value: function () {
5813
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(identity, options) {
5814
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
5815
- 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) {
5816
6134
  case 0:
5817
- return _context64.abrupt("return", this.removeProductsFromOrder([identity], options));
6135
+ return _context65.abrupt("return", this.removeProductsFromOrder([identity], options));
5818
6136
  case 1:
5819
6137
  case "end":
5820
- return _context64.stop();
6138
+ return _context65.stop();
5821
6139
  }
5822
- }, _callee64, this);
6140
+ }, _callee65, this);
5823
6141
  }));
5824
6142
  function removeProductFromOrder(_x59, _x60) {
5825
6143
  return _removeProductFromOrder.apply(this, arguments);
@@ -5871,23 +6189,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5871
6189
  }, {
5872
6190
  key: "applyPromotion",
5873
6191
  value: (function () {
5874
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
5875
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
5876
- 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) {
5877
6195
  case 0:
5878
6196
  if (this.store.order) {
5879
- _context65.next = 2;
6197
+ _context66.next = 2;
5880
6198
  break;
5881
6199
  }
5882
6200
  throw new Error('order 模块未初始化');
5883
6201
  case 2:
5884
- _context65.next = 4;
6202
+ _context66.next = 4;
5885
6203
  return this.store.order.applyPromotion();
5886
6204
  case 4:
5887
6205
  case "end":
5888
- return _context65.stop();
6206
+ return _context66.stop();
5889
6207
  }
5890
- }, _callee65, this);
6208
+ }, _callee66, this);
5891
6209
  }));
5892
6210
  function applyPromotion() {
5893
6211
  return _applyPromotion.apply(this, arguments);
@@ -5914,18 +6232,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5914
6232
  }, {
5915
6233
  key: "getProductList",
5916
6234
  value: function () {
5917
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
6235
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
5918
6236
  var _this$otherParams36;
5919
6237
  var menu_list_ids, _this$store$products, res;
5920
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
5921
- while (1) switch (_context66.prev = _context66.next) {
6238
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6239
+ while (1) switch (_context67.prev = _context67.next) {
5922
6240
  case 0:
5923
6241
  // 可以直接通过配置里的 menu 读取
5924
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) {
5925
6243
  return Number(n.value);
5926
6244
  })) || [];
5927
- _context66.prev = 1;
5928
- _context66.next = 4;
6245
+ _context67.prev = 1;
6246
+ _context67.next = 4;
5929
6247
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
5930
6248
  menu_list_ids: menu_list_ids,
5931
6249
  cacheId: this.cacheId,
@@ -5933,17 +6251,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5933
6251
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
5934
6252
  });
5935
6253
  case 4:
5936
- res = _context66.sent;
5937
- return _context66.abrupt("return", res);
6254
+ res = _context67.sent;
6255
+ return _context67.abrupt("return", res);
5938
6256
  case 8:
5939
- _context66.prev = 8;
5940
- _context66.t0 = _context66["catch"](1);
5941
- throw _context66.t0;
6257
+ _context67.prev = 8;
6258
+ _context67.t0 = _context67["catch"](1);
6259
+ throw _context67.t0;
5942
6260
  case 11:
5943
6261
  case "end":
5944
- return _context66.stop();
6262
+ return _context67.stop();
5945
6263
  }
5946
- }, _callee66, this, [[1, 8]]);
6264
+ }, _callee67, this, [[1, 8]]);
5947
6265
  }));
5948
6266
  function getProductList() {
5949
6267
  return _getProductList.apply(this, arguments);
@@ -5958,31 +6276,31 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5958
6276
  }, {
5959
6277
  key: "setOtherParams",
5960
6278
  value: function () {
5961
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
6279
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
5962
6280
  var _this$otherParams37;
5963
- var _ref49,
5964
- _ref49$cover,
6281
+ var _ref52,
6282
+ _ref52$cover,
5965
6283
  cover,
5966
- _args67 = arguments;
5967
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
5968
- 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) {
5969
6287
  case 0:
5970
- _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;
5971
6289
  if (cover) {
5972
6290
  this.otherParams = _objectSpread({}, params);
5973
6291
  } else {
5974
6292
  this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
5975
6293
  }
5976
6294
  this.cacheId = (_this$otherParams37 = this.otherParams) === null || _this$otherParams37 === void 0 ? void 0 : _this$otherParams37.cacheId;
5977
- _context67.next = 5;
6295
+ _context68.next = 5;
5978
6296
  return this.syncOtherParamsToSubModules(params, {
5979
6297
  cover: cover
5980
6298
  });
5981
6299
  case 5:
5982
6300
  case "end":
5983
- return _context67.stop();
6301
+ return _context68.stop();
5984
6302
  }
5985
- }, _callee67, this);
6303
+ }, _callee68, this);
5986
6304
  }));
5987
6305
  function setOtherParams(_x61) {
5988
6306
  return _setOtherParams.apply(this, arguments);