@pisell/pisellos 2.3.81 → 2.3.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/ProductList/clientDataVariants.d.ts +23 -0
- package/dist/modules/ProductList/clientDataVariants.js +165 -11
- package/dist/modules/ProductList/index.d.ts +14 -0
- package/dist/modules/ProductList/index.js +78 -11
- package/dist/solution/BaseSales/index.d.ts +16 -1
- package/dist/solution/BaseSales/index.js +531 -273
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +2 -2
- package/dist/utils/platform.d.ts +8 -0
- package/dist/utils/platform.js +15 -0
- package/lib/modules/ProductList/clientDataVariants.d.ts +23 -0
- package/lib/modules/ProductList/clientDataVariants.js +147 -11
- package/lib/modules/ProductList/index.d.ts +14 -0
- package/lib/modules/ProductList/index.js +59 -1
- package/lib/solution/BaseSales/index.d.ts +16 -1
- package/lib/solution/BaseSales/index.js +258 -66
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +2 -2
- package/lib/utils/platform.d.ts +8 -0
- package/lib/utils/platform.js +22 -0
- package/package.json +1 -1
|
@@ -30,6 +30,7 @@ var _paymentNumber = require("../../utils/payment-number");
|
|
|
30
30
|
var _orderCollectionIdentity = require("../../modules/Order/utils/orderCollectionIdentity");
|
|
31
31
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
32
32
|
var _clientDataVariants = require("../../modules/ProductList/clientDataVariants");
|
|
33
|
+
var _platform = require("../../utils/platform");
|
|
33
34
|
var _Quotation = require("../../modules/Quotation");
|
|
34
35
|
var _transformBaseProductToOrderProduct = require("./utils/transformBaseProductToOrderProduct");
|
|
35
36
|
var _quotationPrice = require("./utils/quotationPrice");
|
|
@@ -721,43 +722,173 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
721
722
|
schedule_datetime: now.format('YYYY-MM-DD HH:mm:ss')
|
|
722
723
|
};
|
|
723
724
|
}
|
|
725
|
+
isCustomerUserPriceQuery() {
|
|
726
|
+
return (0, _platform.isCustomerUserPlatform)(this.otherParams?.platform);
|
|
727
|
+
}
|
|
728
|
+
getPriceQueryScheduleList() {
|
|
729
|
+
const storeScheduleList = this.store.schedule?.getScheduleList?.();
|
|
730
|
+
if (Array.isArray(storeScheduleList) && storeScheduleList.length > 0) {
|
|
731
|
+
return storeScheduleList;
|
|
732
|
+
}
|
|
733
|
+
const contextScheduleList = this.core?.context?.scheduleList;
|
|
734
|
+
return Array.isArray(contextScheduleList) && contextScheduleList.length > 0 ? contextScheduleList : undefined;
|
|
735
|
+
}
|
|
736
|
+
buildPriceQueryPayload(params) {
|
|
737
|
+
const channel = this.getPriceQueryChannel(params.channel);
|
|
738
|
+
const strategyContext = this.getPriceQueryStrategyContext(channel);
|
|
739
|
+
return {
|
|
740
|
+
ids: params.ids,
|
|
741
|
+
...(this.isCustomerUserPriceQuery() ? {} : {
|
|
742
|
+
open_quotation: 1
|
|
743
|
+
}),
|
|
744
|
+
open_bundle: 1,
|
|
745
|
+
with: [..._clientDataVariants.PRODUCT_QUERY_DATA_VARIANT_RELATIONS],
|
|
746
|
+
status: 'published',
|
|
747
|
+
num: Math.max(params.ids.length, 1),
|
|
748
|
+
skip: 1,
|
|
749
|
+
customer_id: params.customerId,
|
|
750
|
+
schedule_date: params.schedule.schedule_date,
|
|
751
|
+
schedule_datetime: params.schedule.schedule_datetime,
|
|
752
|
+
application_code: channel,
|
|
753
|
+
...(Object.keys(strategyContext).length ? {
|
|
754
|
+
strategy_context: strategyContext
|
|
755
|
+
} : {})
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
getRawProductPriceSources(ids) {
|
|
759
|
+
const products = this.store.products;
|
|
760
|
+
if (typeof products?.getRawProductPriceSources !== 'function') {
|
|
761
|
+
return new Map();
|
|
762
|
+
}
|
|
763
|
+
try {
|
|
764
|
+
const result = products.getRawProductPriceSources(ids);
|
|
765
|
+
return result instanceof Map ? result : new Map();
|
|
766
|
+
} catch (error) {
|
|
767
|
+
this.logWarning('getRawProductPriceSources: 读取商品原始报价源失败', {
|
|
768
|
+
ids,
|
|
769
|
+
error: error instanceof Error ? error.message : String(error)
|
|
770
|
+
});
|
|
771
|
+
return new Map();
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
rememberRawProductPriceSources(products) {
|
|
775
|
+
const productList = this.store.products;
|
|
776
|
+
if (typeof productList?.rememberRawProductQueryResult !== 'function') return;
|
|
777
|
+
try {
|
|
778
|
+
productList.rememberRawProductQueryResult(products);
|
|
779
|
+
} catch (error) {
|
|
780
|
+
this.logWarning('rememberRawProductPriceSources: 保存商品原始报价源失败', {
|
|
781
|
+
error: error instanceof Error ? error.message : String(error)
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
getSelectedProductVariantId(product) {
|
|
786
|
+
const variantId = Number(product?.product_variant_id ?? product?.variant_id ?? 0);
|
|
787
|
+
return Number.isFinite(variantId) && variantId > 0 ? variantId : 0;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* 将目录原始商品还原为本次选择的 SKU 基线。
|
|
792
|
+
*
|
|
793
|
+
* 这里绝不能复用已评估后的目录商品,否则从命中智能价切回不命中的
|
|
794
|
+
* 日期时会残留旧价格。套餐仅验证所选关系存在,最终仍由 merge 方法把
|
|
795
|
+
* 评估后的套餐价格映射回用户的选择数据。
|
|
796
|
+
*/
|
|
797
|
+
prepareRawProductForPriceQuery(rawProduct, selectedProduct) {
|
|
798
|
+
const product = (0, _lodashEs.cloneDeep)(rawProduct);
|
|
799
|
+
const rawProductId = this.getPriceQueryProductId(product);
|
|
800
|
+
const selectedProductId = this.getPriceQueryProductId(selectedProduct);
|
|
801
|
+
if (rawProductId === null || selectedProductId === null || rawProductId !== selectedProductId) {
|
|
802
|
+
return null;
|
|
803
|
+
}
|
|
804
|
+
const selectedVariantId = this.getSelectedProductVariantId(selectedProduct);
|
|
805
|
+
product.product_id = product.product_id ?? product.id;
|
|
806
|
+
product.product_variant_id = selectedVariantId;
|
|
807
|
+
product.variant_id = selectedVariantId;
|
|
808
|
+
if (selectedVariantId > 0) {
|
|
809
|
+
const variants = Array.isArray(product.variant) ? product.variant : [];
|
|
810
|
+
const selectedVariant = variants.find(variant => Number(variant?.id) === selectedVariantId);
|
|
811
|
+
if (!selectedVariant) return null;
|
|
812
|
+
const variantPrice = selectedVariant.price ?? selectedVariant.selling_price ?? selectedVariant.base_price;
|
|
813
|
+
if (variantPrice === undefined || variantPrice === null || variantPrice === '') {
|
|
814
|
+
return null;
|
|
815
|
+
}
|
|
816
|
+
product.price = variantPrice;
|
|
817
|
+
product.selling_price = selectedVariant.selling_price ?? variantPrice;
|
|
818
|
+
product.base_price = selectedVariant.base_price ?? variantPrice;
|
|
819
|
+
}
|
|
820
|
+
const selectedBundles = Array.isArray(selectedProduct.product_bundle) ? selectedProduct.product_bundle : [];
|
|
821
|
+
if (selectedBundles.length > 0) {
|
|
822
|
+
const rawBundleItems = this.getAuthoritativeBundleItems(product);
|
|
823
|
+
const allSelectedBundlesExist = selectedBundles.every(bundle => {
|
|
824
|
+
const authoritativeBundle = this.findAuthoritativeBundleItem(bundle, rawBundleItems);
|
|
825
|
+
if (!authoritativeBundle) return false;
|
|
826
|
+
const selectedBundleVariantId = Number(bundle?.bundle_variant_id ?? bundle?.variant_id ?? 0);
|
|
827
|
+
const authoritativeBundleVariantId = Number(authoritativeBundle?.bundle_variant_id ?? authoritativeBundle?.variant_id ?? 0);
|
|
828
|
+
if ((Number.isFinite(selectedBundleVariantId) ? selectedBundleVariantId : 0) !== (Number.isFinite(authoritativeBundleVariantId) ? authoritativeBundleVariantId : 0)) {
|
|
829
|
+
return false;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// 省略字段表示该套餐子商品关系没有被价格查询完整水合,不能把它
|
|
833
|
+
// 当作“没有规则”而静默使用基础价。
|
|
834
|
+
return Array.isArray(authoritativeBundle.data_variants);
|
|
835
|
+
});
|
|
836
|
+
if (!allSelectedBundlesExist) return null;
|
|
837
|
+
}
|
|
838
|
+
return product;
|
|
839
|
+
}
|
|
840
|
+
resolveLocalProductForPriceQuery(params) {
|
|
841
|
+
if (!params.rawProduct) return null;
|
|
842
|
+
const preparedProduct = this.prepareRawProductForPriceQuery(params.rawProduct, params.selectedProduct);
|
|
843
|
+
if (!preparedProduct) return null;
|
|
844
|
+
const scheduleList = this.getPriceQueryScheduleList();
|
|
845
|
+
const result = (0, _clientDataVariants.tryResolveClientDataVariants)({
|
|
846
|
+
core: this.core,
|
|
847
|
+
otherParams: this.otherParams,
|
|
848
|
+
products: [preparedProduct],
|
|
849
|
+
queryPayload: params.queryPayload,
|
|
850
|
+
handledByOsServer: false,
|
|
851
|
+
...(scheduleList ? {
|
|
852
|
+
scheduleList
|
|
853
|
+
} : {})
|
|
854
|
+
});
|
|
855
|
+
if (result.status !== 'resolved') return null;
|
|
856
|
+
return result.products[0] || null;
|
|
857
|
+
}
|
|
724
858
|
async loadProductsForPriceQuery(params) {
|
|
725
859
|
const ids = Array.from(new Set(params.ids.filter(id => Number.isFinite(id))));
|
|
726
860
|
const productsById = new Map();
|
|
727
861
|
if (!ids.length || !this.request) return productsById;
|
|
728
|
-
const channel = this.getPriceQueryChannel(params.channel);
|
|
729
|
-
const strategyContext = this.getPriceQueryStrategyContext(channel);
|
|
730
862
|
const handledByOsServer = (0, _clientDataVariants.isProductQueryHandledByOsServer)(this.core, this.request);
|
|
731
863
|
try {
|
|
732
|
-
const queryPayload = {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
with: [..._clientDataVariants.PRODUCT_QUERY_DATA_VARIANT_RELATIONS],
|
|
737
|
-
status: 'published',
|
|
738
|
-
num: Math.max(ids.length, 1),
|
|
739
|
-
skip: 1,
|
|
740
|
-
customer_id: params.customerId,
|
|
741
|
-
schedule_date: params.schedule.schedule_date,
|
|
742
|
-
schedule_datetime: params.schedule.schedule_datetime,
|
|
743
|
-
application_code: channel,
|
|
744
|
-
...(Object.keys(strategyContext).length ? {
|
|
745
|
-
strategy_context: strategyContext
|
|
746
|
-
} : {})
|
|
747
|
-
};
|
|
864
|
+
const queryPayload = this.buildPriceQueryPayload({
|
|
865
|
+
...params,
|
|
866
|
+
ids
|
|
867
|
+
});
|
|
748
868
|
const response = await this.request.post('/product/query', queryPayload, {
|
|
749
869
|
osServer: true,
|
|
750
870
|
customToast: () => {}
|
|
751
871
|
});
|
|
752
872
|
const list = response?.data?.list || response?.list || [];
|
|
753
873
|
if (!Array.isArray(list)) return productsById;
|
|
874
|
+
if (this.isCustomerUserPriceQuery() && !handledByOsServer) {
|
|
875
|
+
this.rememberRawProductPriceSources(list);
|
|
876
|
+
list.forEach(item => {
|
|
877
|
+
const productId = Number(item?.id ?? item?.product_id);
|
|
878
|
+
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
879
|
+
});
|
|
880
|
+
return productsById;
|
|
881
|
+
}
|
|
882
|
+
const scheduleList = this.getPriceQueryScheduleList();
|
|
754
883
|
const resolvedList = (0, _clientDataVariants.resolveClientDataVariants)({
|
|
755
884
|
core: this.core,
|
|
756
885
|
otherParams: this.otherParams,
|
|
757
886
|
products: list,
|
|
758
887
|
queryPayload,
|
|
759
888
|
handledByOsServer,
|
|
760
|
-
scheduleList
|
|
889
|
+
...(scheduleList ? {
|
|
890
|
+
scheduleList
|
|
891
|
+
} : {})
|
|
761
892
|
});
|
|
762
893
|
resolvedList.forEach(item => {
|
|
763
894
|
const productId = Number(item?.id ?? item?.product_id);
|
|
@@ -772,18 +903,69 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
772
903
|
return productsById;
|
|
773
904
|
}
|
|
774
905
|
}
|
|
775
|
-
async
|
|
776
|
-
const
|
|
777
|
-
const
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
906
|
+
async resolveProductsForPriceQuery(params) {
|
|
907
|
+
const selectedProducts = params.priceQueries.map(item => item.product || {});
|
|
908
|
+
const productIds = selectedProducts.map(product => this.getPriceQueryProductId(product));
|
|
909
|
+
const ids = Array.from(new Set(productIds.filter(id => id !== null)));
|
|
910
|
+
if (!ids.length) {
|
|
911
|
+
return selectedProducts.map(() => null);
|
|
912
|
+
}
|
|
913
|
+
const handledByOsServer = this.request ? (0, _clientDataVariants.isProductQueryHandledByOsServer)(this.core, this.request) : false;
|
|
914
|
+
const canUseLocalFastPath = this.isCustomerUserPriceQuery() && !handledByOsServer;
|
|
915
|
+
if (!canUseLocalFastPath) {
|
|
916
|
+
if (!this.request) return selectedProducts.map(() => null);
|
|
917
|
+
const productsById = await this.loadProductsForPriceQuery({
|
|
918
|
+
ids,
|
|
919
|
+
schedule: params.schedule,
|
|
920
|
+
customerId: params.customerId,
|
|
921
|
+
channel: params.channel
|
|
922
|
+
});
|
|
923
|
+
return productIds.map(productId => productId === null ? null : productsById.get(productId) || null);
|
|
924
|
+
}
|
|
925
|
+
const queryPayload = this.buildPriceQueryPayload({
|
|
926
|
+
ids,
|
|
927
|
+
schedule: params.schedule,
|
|
928
|
+
customerId: params.customerId,
|
|
784
929
|
channel: params.channel
|
|
785
930
|
});
|
|
786
|
-
|
|
931
|
+
const cachedRawProducts = this.getRawProductPriceSources(ids);
|
|
932
|
+
const authoritativeProducts = selectedProducts.map((selectedProduct, index) => {
|
|
933
|
+
const productId = productIds[index];
|
|
934
|
+
return productId === null ? null : this.resolveLocalProductForPriceQuery({
|
|
935
|
+
selectedProduct,
|
|
936
|
+
rawProduct: cachedRawProducts.get(productId),
|
|
937
|
+
queryPayload
|
|
938
|
+
});
|
|
939
|
+
});
|
|
940
|
+
const missingIds = Array.from(new Set(productIds.filter((productId, index) => productId !== null && !authoritativeProducts[index])));
|
|
941
|
+
if (!missingIds.length) return authoritativeProducts;
|
|
942
|
+
if (!this.request) return authoritativeProducts;
|
|
943
|
+
const remoteRawProducts = await this.loadProductsForPriceQuery({
|
|
944
|
+
ids: missingIds,
|
|
945
|
+
schedule: params.schedule,
|
|
946
|
+
customerId: params.customerId,
|
|
947
|
+
channel: params.channel
|
|
948
|
+
});
|
|
949
|
+
authoritativeProducts.forEach((authoritativeProduct, index) => {
|
|
950
|
+
if (authoritativeProduct) return;
|
|
951
|
+
const productId = productIds[index];
|
|
952
|
+
if (productId === null) return;
|
|
953
|
+
const rawProduct = remoteRawProducts.get(productId);
|
|
954
|
+
const locallyResolved = this.resolveLocalProductForPriceQuery({
|
|
955
|
+
selectedProduct: selectedProducts[index],
|
|
956
|
+
rawProduct,
|
|
957
|
+
queryPayload
|
|
958
|
+
});
|
|
959
|
+
if (locallyResolved) {
|
|
960
|
+
authoritativeProducts[index] = locallyResolved;
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
// 严格客户端能力仍不可用时,真实请求已经是最后的权威降级。
|
|
965
|
+
// 尽量应用所选 SKU 基线;关系不完整时保持旧的远端商品语义。
|
|
966
|
+
authoritativeProducts[index] = rawProduct ? this.prepareRawProductForPriceQuery(rawProduct, selectedProducts[index]) || rawProduct : null;
|
|
967
|
+
});
|
|
968
|
+
return authoritativeProducts;
|
|
787
969
|
}
|
|
788
970
|
getAuthoritativeBundleItems(product) {
|
|
789
971
|
if (Array.isArray(product?.product_bundle)) return product.product_bundle;
|
|
@@ -2967,16 +3149,24 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2967
3149
|
return (0, _transformBaseProductToOrderProduct.transformBaseProductToOrderProduct)(params);
|
|
2968
3150
|
}
|
|
2969
3151
|
async calculateProductBookingPrice(params) {
|
|
2970
|
-
const
|
|
3152
|
+
const useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
3153
|
+
const quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
2971
3154
|
const customerId = params.customer_id ?? this.getCurrentOrderCustomerId();
|
|
2972
3155
|
await this.prepareProductPriceQueryContext(customerId);
|
|
2973
|
-
const authoritativeProduct = await this.
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
customer_id: customerId,
|
|
3156
|
+
const [authoritativeProduct] = await this.resolveProductsForPriceQuery({
|
|
3157
|
+
priceQueries: [params],
|
|
3158
|
+
schedule: this.getPriceQuerySchedule(params),
|
|
3159
|
+
customerId,
|
|
2978
3160
|
channel: params.channel
|
|
2979
3161
|
});
|
|
3162
|
+
const product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
3163
|
+
if (!useCustomerUserPricing) {
|
|
3164
|
+
await this.loadQuotationForPriceQuery({
|
|
3165
|
+
quotation,
|
|
3166
|
+
customer_id: customerId,
|
|
3167
|
+
channel: params.channel
|
|
3168
|
+
});
|
|
3169
|
+
}
|
|
2980
3170
|
return (0, _quotationPrice.calculateBaseSalesProductBookingPrice)({
|
|
2981
3171
|
...params,
|
|
2982
3172
|
product,
|
|
@@ -3026,13 +3216,13 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
3026
3216
|
return Array.isArray(configs) && configs.length > 0;
|
|
3027
3217
|
}
|
|
3028
3218
|
shouldRecalculateProductBookingPricesForContextChange(params) {
|
|
3029
|
-
const scopeInfo = this.getQuotationCustomerScopeInfo();
|
|
3030
|
-
const scopedCustomerIds = new Set(scopeInfo.customerIds.map(id => String(id)));
|
|
3031
3219
|
const previousCustomerId = this.normalizePriceContextCustomerId(params.previousCustomerId);
|
|
3032
3220
|
const nextCustomerId = this.normalizePriceContextCustomerId(params.nextCustomerId);
|
|
3033
|
-
if (this.hasSmartPricingStrategies()) {
|
|
3221
|
+
if (this.isCustomerUserPriceQuery() || this.hasSmartPricingStrategies()) {
|
|
3034
3222
|
return previousCustomerId !== nextCustomerId;
|
|
3035
3223
|
}
|
|
3224
|
+
const scopeInfo = this.getQuotationCustomerScopeInfo();
|
|
3225
|
+
const scopedCustomerIds = new Set(scopeInfo.customerIds.map(id => String(id)));
|
|
3036
3226
|
const previousInScope = previousCustomerId ? scopedCustomerIds.has(previousCustomerId) : false;
|
|
3037
3227
|
const nextInScope = nextCustomerId ? scopedCustomerIds.has(nextCustomerId) : false;
|
|
3038
3228
|
let shouldRecalculate = false;
|
|
@@ -3049,48 +3239,50 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
3049
3239
|
}
|
|
3050
3240
|
async calculateProductBookingPrices(paramsList) {
|
|
3051
3241
|
if (!paramsList.length) return [];
|
|
3052
|
-
const
|
|
3053
|
-
const
|
|
3054
|
-
|
|
3055
|
-
const
|
|
3242
|
+
const useCustomerUserPricing = this.isCustomerUserPriceQuery();
|
|
3243
|
+
const quotation = useCustomerUserPricing ? undefined : this.store.quotation;
|
|
3244
|
+
const currentOrderCustomerId = this.getCurrentOrderCustomerId();
|
|
3245
|
+
const authoritativeProducts = paramsList.map(() => null);
|
|
3056
3246
|
const groups = new Map();
|
|
3057
|
-
paramsList.forEach(params => {
|
|
3058
|
-
const product = params.product || {};
|
|
3059
|
-
const productId = this.getPriceQueryProductId(product);
|
|
3060
|
-
if (productId === null) return;
|
|
3247
|
+
paramsList.forEach((params, index) => {
|
|
3061
3248
|
const schedule = this.getPriceQuerySchedule(params);
|
|
3062
|
-
const channel = params.channel
|
|
3063
|
-
const
|
|
3249
|
+
const channel = this.getPriceQueryChannel(params.channel);
|
|
3250
|
+
const customerId = params.customer_id ?? currentOrderCustomerId;
|
|
3251
|
+
const groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || '', this.normalizePriceContextCustomerId(customerId) || ''].join('|');
|
|
3064
3252
|
const group = groups.get(groupKey) || {
|
|
3065
|
-
|
|
3253
|
+
indices: [],
|
|
3066
3254
|
schedule,
|
|
3255
|
+
customerId,
|
|
3067
3256
|
channel
|
|
3068
3257
|
};
|
|
3069
|
-
group.
|
|
3258
|
+
group.indices.push(index);
|
|
3070
3259
|
groups.set(groupKey, group);
|
|
3071
3260
|
});
|
|
3072
|
-
await Promise.all(Array.from(groups.
|
|
3073
|
-
|
|
3074
|
-
|
|
3261
|
+
await Promise.all(Array.from(groups.values()).map(async group => {
|
|
3262
|
+
await this.prepareProductPriceQueryContext(group.customerId);
|
|
3263
|
+
const priceQueries = group.indices.map(index => paramsList[index]);
|
|
3264
|
+
const resolvedProducts = await this.resolveProductsForPriceQuery({
|
|
3265
|
+
priceQueries,
|
|
3075
3266
|
schedule: group.schedule,
|
|
3076
|
-
customerId,
|
|
3267
|
+
customerId: group.customerId,
|
|
3077
3268
|
channel: group.channel
|
|
3078
3269
|
});
|
|
3079
|
-
|
|
3270
|
+
group.indices.forEach((originalIndex, groupIndex) => {
|
|
3271
|
+
authoritativeProducts[originalIndex] = resolvedProducts[groupIndex] || null;
|
|
3272
|
+
});
|
|
3080
3273
|
}));
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3274
|
+
if (!useCustomerUserPricing) {
|
|
3275
|
+
await this.loadQuotationForPriceQuery({
|
|
3276
|
+
quotation,
|
|
3277
|
+
customer_id: paramsList[0]?.customer_id ?? currentOrderCustomerId,
|
|
3278
|
+
channel: paramsList[0]?.channel
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3281
|
+
return paramsList.map((params, index) => {
|
|
3087
3282
|
const productInput = params.product || {};
|
|
3088
|
-
const
|
|
3089
|
-
const schedule = this.getPriceQuerySchedule(params);
|
|
3090
|
-
const channel = params.channel || this.otherParams?.channel;
|
|
3091
|
-
const groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
3092
|
-
const authoritativeProduct = productId === null ? null : productMapsByGroup.get(groupKey)?.get(productId) || null;
|
|
3283
|
+
const authoritativeProduct = authoritativeProducts[index];
|
|
3093
3284
|
const product = this.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
3285
|
+
const customerId = params.customer_id ?? currentOrderCustomerId;
|
|
3094
3286
|
return (0, _quotationPrice.calculateBaseSalesProductBookingPrice)({
|
|
3095
3287
|
...params,
|
|
3096
3288
|
product,
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -334,7 +334,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
334
334
|
* 获取当前的客户搜索条件
|
|
335
335
|
* @returns 当前搜索条件
|
|
336
336
|
*/
|
|
337
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
337
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
338
338
|
/**
|
|
339
339
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
340
340
|
* @returns 客户状态
|
|
@@ -49,6 +49,7 @@ Object.keys(_types).forEach(function (key) {
|
|
|
49
49
|
var _remoteOccupancyCache = require("./remoteOccupancyCache");
|
|
50
50
|
var _BookingTicket = require("../BookingTicket");
|
|
51
51
|
var _localClock = require("../../modules/ResourcePlanner/localClock");
|
|
52
|
+
var _platform = require("../../utils/platform");
|
|
52
53
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
53
54
|
const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'basic', 'checkout', 'availability'];
|
|
54
55
|
const OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
@@ -1546,8 +1547,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1546
1547
|
return true;
|
|
1547
1548
|
}
|
|
1548
1549
|
isAuthenticatedCustomerUserPlatform() {
|
|
1549
|
-
|
|
1550
|
-
return platform === 'pc' || platform === 'h5';
|
|
1550
|
+
return (0, _platform.isCustomerUserPlatform)(this.otherParams?.platform);
|
|
1551
1551
|
}
|
|
1552
1552
|
resolveDiscountOrderIdentity(tempOrder) {
|
|
1553
1553
|
return tempOrder?.order_id || this.store.order?.getOrderIdentity?.()?.orderId || null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize the runtime platform passed through solution/module otherParams.
|
|
3
|
+
*/
|
|
4
|
+
export declare function normalizeRuntimePlatform(platform: unknown): string;
|
|
5
|
+
/**
|
|
6
|
+
* PC and H5 are authenticated-customer clients rather than staff terminals.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isCustomerUserPlatform(platform: unknown): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isCustomerUserPlatform = isCustomerUserPlatform;
|
|
7
|
+
exports.normalizeRuntimePlatform = normalizeRuntimePlatform;
|
|
8
|
+
const CUSTOMER_USER_PLATFORMS = new Set(['pc', 'h5']);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Normalize the runtime platform passed through solution/module otherParams.
|
|
12
|
+
*/
|
|
13
|
+
function normalizeRuntimePlatform(platform) {
|
|
14
|
+
return String(platform ?? '').trim().toLowerCase();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* PC and H5 are authenticated-customer clients rather than staff terminals.
|
|
19
|
+
*/
|
|
20
|
+
function isCustomerUserPlatform(platform) {
|
|
21
|
+
return CUSTOMER_USER_PLATFORMS.has(normalizeRuntimePlatform(platform));
|
|
22
|
+
}
|