@pisell/pisellos 0.10.67 → 0.10.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +5 -4
- package/dist/modules/Holder/utils.d.ts +2 -0
- package/dist/modules/Holder/utils.js +32 -2
- package/dist/modules/Rules/index.js +59 -58
- package/dist/server/modules/products/index.js +3 -2
- package/dist/solution/BaseSales/index.js +14 -8
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +2 -14
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Holder/utils.d.ts +2 -0
- package/lib/modules/Holder/utils.js +27 -1
- package/lib/modules/Rules/index.js +2 -1
- package/lib/server/modules/products/index.js +2 -1
- package/lib/solution/BaseSales/index.js +3 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +9 -8
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +2 -14
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -11,6 +11,7 @@ import { cloneDeep } from 'lodash-es';
|
|
|
11
11
|
import { getProductHolderRelations } from "../../Order/holderRelations";
|
|
12
12
|
import { getProductSkuOptions } from "../../Order/utils";
|
|
13
13
|
import { isEntitlementPass } from "../../Discount/entitlementPass";
|
|
14
|
+
import { resolveProductHolderConfig } from "../../Holder/utils";
|
|
14
15
|
import { buildProductOptionStringFromOrderLine } from "./orderLineDisplay";
|
|
15
16
|
/**
|
|
16
17
|
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
@@ -87,7 +88,7 @@ function mapOrderBundleToOtherBundle(bundle) {
|
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
90
|
export function buildNormalProductCacheItemFromOrderLine(input) {
|
|
90
|
-
var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$metadata3, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata4, _originExtend$priceOv, _product$metadata5,
|
|
91
|
+
var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$metadata3, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata4, _originExtend$priceOv, _product$metadata5, _ref7, _resolveProductHolder, _ref8, _title2, _ref9, _cover, _price3, _product$order_detail, _product$product_sku;
|
|
91
92
|
var product = input.product,
|
|
92
93
|
sourceProduct = input.sourceProduct;
|
|
93
94
|
var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
|
|
@@ -162,12 +163,12 @@ export function buildNormalProductCacheItemFromOrderLine(input) {
|
|
|
162
163
|
extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
|
|
163
164
|
}
|
|
164
165
|
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
165
|
-
holder_config: (
|
|
166
|
+
holder_config: (_ref7 = (_resolveProductHolder = resolveProductHolderConfig(sourceProduct)) !== null && _resolveProductHolder !== void 0 ? _resolveProductHolder : resolveProductHolderConfig(product)) !== null && _ref7 !== void 0 ? _ref7 : undefined,
|
|
166
167
|
id: resolvedId,
|
|
167
168
|
product_id: resolvedId,
|
|
168
169
|
_id: uid,
|
|
169
|
-
title: (
|
|
170
|
-
cover: (
|
|
170
|
+
title: (_ref8 = (_title2 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title2 !== void 0 ? _title2 : product.product_title) !== null && _ref8 !== void 0 ? _ref8 : '',
|
|
171
|
+
cover: (_ref9 = (_cover = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.cover) !== null && _cover !== void 0 ? _cover : product.product_cover) !== null && _ref9 !== void 0 ? _ref9 : '',
|
|
171
172
|
price: (_price3 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price3 !== void 0 ? _price3 : sourcePrice,
|
|
172
173
|
selling_price: product.selling_price,
|
|
173
174
|
original_price: product.original_price
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ProductData } from '../Product/types';
|
|
2
2
|
import { IFormItemData, IHolderConfig } from './types';
|
|
3
|
+
/** 保留显式禁用配置;仅在新配置缺失时兼容商品旧 holder 定义。 */
|
|
4
|
+
export declare function resolveProductHolderConfig(product?: ProductData | Record<string, any> | null): Record<string, any> | null;
|
|
3
5
|
export declare function getProductHolderConfig(product?: ProductData | Record<string, any> | null): IHolderConfig | null;
|
|
4
6
|
export declare function getFormIdFromHolderConfig(config: IHolderConfig): number;
|
|
5
7
|
export declare function normalizeFormId(formId: number | string): number;
|
|
@@ -1,7 +1,37 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
/** 保留显式禁用配置;仅在新配置缺失时兼容商品旧 holder 定义。 */
|
|
3
|
+
export function resolveProductHolderConfig(product) {
|
|
4
|
+
var _source$metadata, _source$origin, _source$metadata2, _source$_origin, _source$_extend, _source$_extend2, _source$_extend3, _source$_extend4, _source$_extend5, _source$_extend6, _source$_extend7, _source$origin2, _source$metadata3, _source$_origin2, _source$_extend8, _source$_extend9, _source$_extend10, _source$_extend11, _legacy$custom, _legacy$custom2;
|
|
5
|
+
if (!product || _typeof(product) !== 'object') return null;
|
|
6
|
+
var source = product;
|
|
7
|
+
var configSources = [source.holder_config, (_source$metadata = source.metadata) === null || _source$metadata === void 0 ? void 0 : _source$metadata.holder_config, (_source$origin = source.origin) === null || _source$origin === void 0 ? void 0 : _source$origin.holder_config, (_source$metadata2 = source.metadata) === null || _source$metadata2 === void 0 || (_source$metadata2 = _source$metadata2.origin) === null || _source$metadata2 === void 0 ? void 0 : _source$metadata2.holder_config, (_source$_origin = source._origin) === null || _source$_origin === void 0 ? void 0 : _source$_origin.holder_config, (_source$_extend = source._extend) === null || _source$_extend === void 0 ? void 0 : _source$_extend.holder_config, (_source$_extend2 = source._extend) === null || _source$_extend2 === void 0 || (_source$_extend2 = _source$_extend2.product) === null || _source$_extend2 === void 0 ? void 0 : _source$_extend2.holder_config, (_source$_extend3 = source._extend) === null || _source$_extend3 === void 0 || (_source$_extend3 = _source$_extend3.product) === null || _source$_extend3 === void 0 || (_source$_extend3 = _source$_extend3.origin) === null || _source$_extend3 === void 0 ? void 0 : _source$_extend3.holder_config, (_source$_extend4 = source._extend) === null || _source$_extend4 === void 0 || (_source$_extend4 = _source$_extend4.product) === null || _source$_extend4 === void 0 || (_source$_extend4 = _source$_extend4.metadata) === null || _source$_extend4 === void 0 ? void 0 : _source$_extend4.holder_config, (_source$_extend5 = source._extend) === null || _source$_extend5 === void 0 || (_source$_extend5 = _source$_extend5.product) === null || _source$_extend5 === void 0 || (_source$_extend5 = _source$_extend5.metadata) === null || _source$_extend5 === void 0 || (_source$_extend5 = _source$_extend5.origin) === null || _source$_extend5 === void 0 ? void 0 : _source$_extend5.holder_config, (_source$_extend6 = source._extend) === null || _source$_extend6 === void 0 || (_source$_extend6 = _source$_extend6.product) === null || _source$_extend6 === void 0 || (_source$_extend6 = _source$_extend6._origin) === null || _source$_extend6 === void 0 ? void 0 : _source$_extend6.holder_config, (_source$_extend7 = source._extend) === null || _source$_extend7 === void 0 || (_source$_extend7 = _source$_extend7.product) === null || _source$_extend7 === void 0 || (_source$_extend7 = _source$_extend7._extend) === null || _source$_extend7 === void 0 ? void 0 : _source$_extend7.holder_config];
|
|
8
|
+
var config = configSources.find(function (value) {
|
|
9
|
+
return value !== null && _typeof(value) === 'object';
|
|
10
|
+
});
|
|
11
|
+
if (config) return config;
|
|
12
|
+
|
|
13
|
+
// metadata.holder / _extend.holder 是选择结果,不能作为商品配置读取。
|
|
14
|
+
var legacySources = [source.holder, (_source$origin2 = source.origin) === null || _source$origin2 === void 0 ? void 0 : _source$origin2.holder, (_source$metadata3 = source.metadata) === null || _source$metadata3 === void 0 || (_source$metadata3 = _source$metadata3.origin) === null || _source$metadata3 === void 0 ? void 0 : _source$metadata3.holder, (_source$_origin2 = source._origin) === null || _source$_origin2 === void 0 ? void 0 : _source$_origin2.holder, (_source$_extend8 = source._extend) === null || _source$_extend8 === void 0 || (_source$_extend8 = _source$_extend8.product) === null || _source$_extend8 === void 0 ? void 0 : _source$_extend8.holder, (_source$_extend9 = source._extend) === null || _source$_extend9 === void 0 || (_source$_extend9 = _source$_extend9.product) === null || _source$_extend9 === void 0 || (_source$_extend9 = _source$_extend9.origin) === null || _source$_extend9 === void 0 ? void 0 : _source$_extend9.holder, (_source$_extend10 = source._extend) === null || _source$_extend10 === void 0 || (_source$_extend10 = _source$_extend10.product) === null || _source$_extend10 === void 0 || (_source$_extend10 = _source$_extend10.metadata) === null || _source$_extend10 === void 0 || (_source$_extend10 = _source$_extend10.origin) === null || _source$_extend10 === void 0 ? void 0 : _source$_extend10.holder, (_source$_extend11 = source._extend) === null || _source$_extend11 === void 0 || (_source$_extend11 = _source$_extend11.product) === null || _source$_extend11 === void 0 || (_source$_extend11 = _source$_extend11._origin) === null || _source$_extend11 === void 0 ? void 0 : _source$_extend11.holder];
|
|
15
|
+
var legacy = legacySources.find(function (value) {
|
|
16
|
+
return value && _typeof(value) === 'object' && !Array.isArray(value) && typeof value.type === 'string';
|
|
17
|
+
});
|
|
18
|
+
if (!legacy) return null;
|
|
19
|
+
var formId = (_legacy$custom = legacy.custom) === null || _legacy$custom === void 0 ? void 0 : _legacy$custom.custom_id;
|
|
20
|
+
if (legacy.type === 'custom' && ((_legacy$custom2 = legacy.custom) === null || _legacy$custom2 === void 0 ? void 0 : _legacy$custom2.type) === 'form' && (typeof formId === 'number' || typeof formId === 'string') && Number.isInteger(Number(formId)) && Number(formId) > 0) {
|
|
21
|
+
return {
|
|
22
|
+
status: 'enable',
|
|
23
|
+
required: 0,
|
|
24
|
+
resource_id: formId
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
status: 'disable',
|
|
29
|
+
required: 0
|
|
30
|
+
};
|
|
31
|
+
}
|
|
1
32
|
export function getProductHolderConfig(product) {
|
|
2
|
-
var _product$holder_confi, _product$origin;
|
|
3
33
|
if (!product) return null;
|
|
4
|
-
var config = (
|
|
34
|
+
var config = resolveProductHolderConfig(product);
|
|
5
35
|
if (config !== null && config !== void 0 && config.status && (config === null || config === void 0 ? void 0 : config.status) !== 'enable') return null;
|
|
6
36
|
if (!(config !== null && config !== void 0 && config.resource_id)) return null;
|
|
7
37
|
return config;
|
|
@@ -38,6 +38,7 @@ import { BaseModule } from "../BaseModule";
|
|
|
38
38
|
import { UnavailableReason } from "./types";
|
|
39
39
|
import { uniqueById, getDiscountAmount, getDiscountListAmountTotal, getDiscountListAmount, filterDiscountListByBookingTime, getDiscountTimeUnavailableReason } from "../../solution/ShopDiscount/utils";
|
|
40
40
|
import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
|
|
41
|
+
import { resolveProductHolderConfig } from "../Holder/utils";
|
|
41
42
|
import Decimal from 'decimal.js';
|
|
42
43
|
import { cloneDeep, isBoolean } from 'lodash-es';
|
|
43
44
|
import dayjs from 'dayjs';
|
|
@@ -142,12 +143,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
142
143
|
}, {
|
|
143
144
|
key: "checkHolderMatch",
|
|
144
145
|
value: function checkHolderMatch(discount, product, holderSource, holders) {
|
|
145
|
-
var _discount$holder
|
|
146
|
+
var _discount$holder;
|
|
146
147
|
// 非表单类型 holder 视为匹配
|
|
147
148
|
if (((_discount$holder = discount.holder) === null || _discount$holder === void 0 ? void 0 : _discount$holder.holder_type) !== 'form') return true;
|
|
148
149
|
|
|
149
150
|
// getProduct 会裁剪商品字段,从原始商品读取配置,套餐子项沿用父商品。
|
|
150
|
-
var holderConfig = (
|
|
151
|
+
var holderConfig = resolveProductHolderConfig(holderSource);
|
|
151
152
|
var holderStatus = holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.status;
|
|
152
153
|
var holderEnabled = holderStatus === true || ['enable', '1'].includes(String(holderStatus).trim().toLowerCase());
|
|
153
154
|
if (!holderEnabled || (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id) === undefined || (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id) === null || (holderConfig === null || holderConfig === void 0 ? void 0 : holderConfig.resource_id) === '') {
|
|
@@ -167,14 +168,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
167
168
|
// 判断discountList 是否可以对当前productList生效
|
|
168
169
|
}, {
|
|
169
170
|
key: "isDiscountListAvailable",
|
|
170
|
-
value: function isDiscountListAvailable(
|
|
171
|
+
value: function isDiscountListAvailable(_ref) {
|
|
171
172
|
var _this2 = this;
|
|
172
|
-
var oldDiscountList =
|
|
173
|
-
newDiscountList =
|
|
174
|
-
productList =
|
|
175
|
-
orderTotalAmount =
|
|
176
|
-
holders =
|
|
177
|
-
isFormSubject =
|
|
173
|
+
var oldDiscountList = _ref.oldDiscountList,
|
|
174
|
+
newDiscountList = _ref.newDiscountList,
|
|
175
|
+
productList = _ref.productList,
|
|
176
|
+
orderTotalAmount = _ref.orderTotalAmount,
|
|
177
|
+
holders = _ref.holders,
|
|
178
|
+
isFormSubject = _ref.isFormSubject;
|
|
178
179
|
// 首先检查是否有新的优惠券可应用
|
|
179
180
|
if (!newDiscountList || newDiscountList.length === 0) {
|
|
180
181
|
return {
|
|
@@ -373,14 +374,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
373
374
|
}
|
|
374
375
|
}, {
|
|
375
376
|
key: "calcDiscount",
|
|
376
|
-
value: function calcDiscount(
|
|
377
|
+
value: function calcDiscount(_ref2, options) {
|
|
377
378
|
var _options$selectedList,
|
|
378
379
|
_this4 = this;
|
|
379
|
-
var discountList =
|
|
380
|
-
productList =
|
|
381
|
-
holders =
|
|
382
|
-
isFormSubject =
|
|
383
|
-
orderTotalAmount =
|
|
380
|
+
var discountList = _ref2.discountList,
|
|
381
|
+
productList = _ref2.productList,
|
|
382
|
+
holders = _ref2.holders,
|
|
383
|
+
isFormSubject = _ref2.isFormSubject,
|
|
384
|
+
orderTotalAmount = _ref2.orderTotalAmount;
|
|
384
385
|
var preferredEntitlementPassIds = new Set(((options === null || options === void 0 ? void 0 : options.preferredEntitlementPassIds) || []).map(String));
|
|
385
386
|
var resolveIsFormSubject = function resolveIsFormSubject(product) {
|
|
386
387
|
return typeof isFormSubject === 'function' ? Boolean(isFormSubject(product)) : Boolean(isFormSubject);
|
|
@@ -494,7 +495,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
494
495
|
// 2. 展开 bundle 子商品
|
|
495
496
|
if (product.bundle && Array.isArray(product.bundle) && product.bundle.length > 0) {
|
|
496
497
|
product.bundle.forEach(function (bundleItem, bundleIndex) {
|
|
497
|
-
var
|
|
498
|
+
var _ref3, _bundleItem$bundle_pr;
|
|
498
499
|
flattened.push({
|
|
499
500
|
type: 'bundle',
|
|
500
501
|
originProduct: originProduct,
|
|
@@ -506,7 +507,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
506
507
|
// 新增商品运行态通常带 _bundle_product_id;订单 hydrate 后只有
|
|
507
508
|
// bundle_product_id。Change time 必须兼容两种结构,否则 bundle
|
|
508
509
|
// 子项无法命中折扣卡的 limited_relation_product_data.product_ids。
|
|
509
|
-
id: (
|
|
510
|
+
id: (_ref3 = (_bundleItem$bundle_pr = bundleItem.bundle_product_id) !== null && _bundleItem$bundle_pr !== void 0 ? _bundleItem$bundle_pr : bundleItem._bundle_product_id) !== null && _ref3 !== void 0 ? _ref3 : bundleItem.product_id,
|
|
510
511
|
_id: "".concat(product._id, "_bundle_").concat(bundleIndex),
|
|
511
512
|
parentId: product._id,
|
|
512
513
|
num: bundleItem.num || 1,
|
|
@@ -666,10 +667,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
666
667
|
|
|
667
668
|
// 对扁平化后的列表按价格降序排序(用于应用优惠券时优先选择高价商品)
|
|
668
669
|
var sortedFlattenedList = flattenedList.sort(function (a, b) {
|
|
669
|
-
var
|
|
670
|
+
var _ref4, _a$original_price, _ref5, _b$original_price;
|
|
670
671
|
// 子商品优先使用 original_price,主商品使用 price
|
|
671
|
-
var priceA = new Decimal(a.type === 'bundle' ? (
|
|
672
|
-
var priceB = new Decimal(b.type === 'bundle' ? (
|
|
672
|
+
var priceA = new Decimal(a.type === 'bundle' ? (_ref4 = (_a$original_price = a.original_price) !== null && _a$original_price !== void 0 ? _a$original_price : a.price) !== null && _ref4 !== void 0 ? _ref4 : '0' : a.price || '0');
|
|
673
|
+
var priceB = new Decimal(b.type === 'bundle' ? (_ref5 = (_b$original_price = b.original_price) !== null && _b$original_price !== void 0 ? _b$original_price : b.price) !== null && _ref5 !== void 0 ? _ref5 : '0' : b.price || '0');
|
|
673
674
|
if (priceA.equals(priceB)) {
|
|
674
675
|
// 价格相同时,主商品优先
|
|
675
676
|
if (a.type !== b.type) {
|
|
@@ -803,13 +804,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
803
804
|
var buildFullCoveragePassUsageGroups = function buildFullCoveragePassUsageGroups(discounts, requestedCount) {
|
|
804
805
|
var _firstGoodPass$config;
|
|
805
806
|
var groups = [];
|
|
806
|
-
var pendingUsedDiscounts = new Set(Array.from(usedDiscounts.entries()).filter(function (
|
|
807
|
-
var
|
|
808
|
-
used =
|
|
807
|
+
var pendingUsedDiscounts = new Set(Array.from(usedDiscounts.entries()).filter(function (_ref6) {
|
|
808
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
809
|
+
used = _ref7[1];
|
|
809
810
|
return used;
|
|
810
|
-
}).map(function (
|
|
811
|
-
var
|
|
812
|
-
discountId =
|
|
811
|
+
}).map(function (_ref8) {
|
|
812
|
+
var _ref9 = _slicedToArray(_ref8, 1),
|
|
813
|
+
discountId = _ref9[0];
|
|
813
814
|
return discountId;
|
|
814
815
|
}));
|
|
815
816
|
var pendingEntitlementCounts = new Map(entitlementUsageCounts);
|
|
@@ -884,7 +885,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
884
885
|
_step6;
|
|
885
886
|
try {
|
|
886
887
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
887
|
-
var _detail$discount$reso, _detail$discount, _detail$discount$prod, _detail$discount2, _detail$metadata$cust, _detail$metadata, _detail$discount3,
|
|
888
|
+
var _detail$discount$reso, _detail$discount, _detail$discount$prod, _detail$discount2, _detail$metadata$cust, _detail$metadata, _detail$discount3, _ref10, _detail$metadata$num, _detail$metadata2, _ref11, _existed$metadata$num, _existed$metadata;
|
|
888
889
|
var detail = _step6.value;
|
|
889
890
|
if (!isEntitlementPass(detail)) {
|
|
890
891
|
mergedDetails.push(detail);
|
|
@@ -896,7 +897,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
896
897
|
continue;
|
|
897
898
|
}
|
|
898
899
|
var key = [resourceId, (_detail$discount$prod = detail === null || detail === void 0 || (_detail$discount2 = detail.discount) === null || _detail$discount2 === void 0 ? void 0 : _detail$discount2.product_id) !== null && _detail$discount$prod !== void 0 ? _detail$discount$prod : '', (_detail$metadata$cust = detail === null || detail === void 0 || (_detail$metadata = detail.metadata) === null || _detail$metadata === void 0 ? void 0 : _detail$metadata.custom_product_bundle_map_id) !== null && _detail$metadata$cust !== void 0 ? _detail$metadata$cust : '', toComparableNumber(detail === null || detail === void 0 ? void 0 : detail.amount), toComparableNumber(detail === null || detail === void 0 || (_detail$discount3 = detail.discount) === null || _detail$discount3 === void 0 ? void 0 : _detail$discount3.fixed_amount)].join('|');
|
|
899
|
-
var rawUsageCount = Number((
|
|
900
|
+
var rawUsageCount = Number((_ref10 = (_detail$metadata$num = detail === null || detail === void 0 || (_detail$metadata2 = detail.metadata) === null || _detail$metadata2 === void 0 ? void 0 : _detail$metadata2.num) !== null && _detail$metadata$num !== void 0 ? _detail$metadata$num : detail === null || detail === void 0 ? void 0 : detail._num) !== null && _ref10 !== void 0 ? _ref10 : 1);
|
|
900
901
|
var usageCount = Number.isFinite(rawUsageCount) && rawUsageCount > 0 ? rawUsageCount : 1;
|
|
901
902
|
var mergedIndex = mergedIndexByKey.get(key);
|
|
902
903
|
if (mergedIndex === undefined) {
|
|
@@ -910,7 +911,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
910
911
|
continue;
|
|
911
912
|
}
|
|
912
913
|
var existed = mergedDetails[mergedIndex];
|
|
913
|
-
var existedUsageCount = Number((
|
|
914
|
+
var existedUsageCount = Number((_ref11 = (_existed$metadata$num = existed === null || existed === void 0 || (_existed$metadata = existed.metadata) === null || _existed$metadata === void 0 ? void 0 : _existed$metadata.num) !== null && _existed$metadata$num !== void 0 ? _existed$metadata$num : existed === null || existed === void 0 ? void 0 : existed._num) !== null && _ref11 !== void 0 ? _ref11 : 1);
|
|
914
915
|
var totalUsageCount = existedUsageCount + usageCount;
|
|
915
916
|
mergedDetails[mergedIndex] = _objectSpread(_objectSpread({}, existed), {}, {
|
|
916
917
|
metadata: _objectSpread(_objectSpread({}, (existed === null || existed === void 0 ? void 0 : existed.metadata) || {}), {}, {
|
|
@@ -1078,7 +1079,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1078
1079
|
// 收集该折扣卡适用的商品(排除被其他专属折扣卡占用的商品)
|
|
1079
1080
|
var applicableProducts = [];
|
|
1080
1081
|
sortedFlattenedList.forEach(function (flatItem) {
|
|
1081
|
-
var _flatItem$parentProdu2, _flatItem$parentProdu3, _product$price,
|
|
1082
|
+
var _flatItem$parentProdu2, _flatItem$parentProdu3, _product$price, _ref12, _flatItem$original_pr;
|
|
1082
1083
|
// 🔥 检查该商品是否被其他专属折扣卡占用
|
|
1083
1084
|
var occupyingDiscountId = occupiedItems.get(flatItem._id);
|
|
1084
1085
|
if (occupyingDiscountId !== undefined && occupyingDiscountId !== discount.id) {
|
|
@@ -1106,7 +1107,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1106
1107
|
|
|
1107
1108
|
// 对于主商品:使用 price
|
|
1108
1109
|
// 对于子商品:优先使用 flatItem.original_price,否则使用 flatItem.price
|
|
1109
|
-
var originalAmount = flatItem.type === 'main' ? Number((_product$price = product.price) !== null && _product$price !== void 0 ? _product$price : 0) : Number((
|
|
1110
|
+
var originalAmount = flatItem.type === 'main' ? Number((_product$price = product.price) !== null && _product$price !== void 0 ? _product$price : 0) : Number((_ref12 = (_flatItem$original_pr = flatItem.original_price) !== null && _flatItem$original_pr !== void 0 ? _flatItem$original_pr : flatItem.price) !== null && _ref12 !== void 0 ? _ref12 : 0);
|
|
1110
1111
|
|
|
1111
1112
|
// 传递 parentQuantity 用于差值处理时判断是否是真正的"数量为1"
|
|
1112
1113
|
var productData = {
|
|
@@ -1244,13 +1245,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1244
1245
|
};
|
|
1245
1246
|
var optionDiscountAmount = 0;
|
|
1246
1247
|
var discountedOptions = options.map(function (option) {
|
|
1247
|
-
var
|
|
1248
|
+
var _ref13, _ref14, _option$_original_pri, _ref15, _option$num, _rest$price, _option$_original_pri2;
|
|
1248
1249
|
// 折前单价:优先 price,缺失再 add_price;已写回折后价时用 _original_price(或旧字段 _original_add_price)
|
|
1249
|
-
var rawUnit = (
|
|
1250
|
+
var rawUnit = (_ref13 = (_ref14 = (_option$_original_pri = option._original_price) !== null && _option$_original_pri !== void 0 ? _option$_original_pri : option._original_add_price) !== null && _ref14 !== void 0 ? _ref14 : option.price) !== null && _ref13 !== void 0 ? _ref13 : option.add_price;
|
|
1250
1251
|
var baseUnitNum = Number(rawUnit !== null && rawUnit !== void 0 ? rawUnit : 0);
|
|
1251
1252
|
if (baseUnitNum <= 0) return option;
|
|
1252
1253
|
var discountedPrice = getDiscountAmount(discount, baseUnitNum, baseUnitNum);
|
|
1253
|
-
var optQty = Number((
|
|
1254
|
+
var optQty = Number((_ref15 = (_option$num = option.num) !== null && _option$num !== void 0 ? _option$num : option.quantity) !== null && _ref15 !== void 0 ? _ref15 : 1);
|
|
1254
1255
|
optionDiscountAmount = new Decimal(optionDiscountAmount).plus(new Decimal(baseUnitNum).minus(discountedPrice).mul(optQty)).toNumber();
|
|
1255
1256
|
var _original_add_price = option._original_add_price,
|
|
1256
1257
|
rest = _objectWithoutProperties(option, _excluded);
|
|
@@ -1284,9 +1285,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1284
1285
|
var getOptionTotal = function getOptionTotal(options) {
|
|
1285
1286
|
if (!(options !== null && options !== void 0 && options.length)) return 0;
|
|
1286
1287
|
return options.reduce(function (sum, opt) {
|
|
1287
|
-
var
|
|
1288
|
-
var unit = Number((
|
|
1289
|
-
var n = Number((
|
|
1288
|
+
var _ref16, _opt$price, _ref17, _opt$num;
|
|
1289
|
+
var unit = Number((_ref16 = (_opt$price = opt.price) !== null && _opt$price !== void 0 ? _opt$price : opt.add_price) !== null && _ref16 !== void 0 ? _ref16 : 0);
|
|
1290
|
+
var n = Number((_ref17 = (_opt$num = opt.num) !== null && _opt$num !== void 0 ? _opt$num : opt.quantity) !== null && _ref17 !== void 0 ? _ref17 : 1);
|
|
1290
1291
|
return new Decimal(sum).plus(new Decimal(unit).mul(n)).toNumber();
|
|
1291
1292
|
}, 0);
|
|
1292
1293
|
};
|
|
@@ -1439,8 +1440,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1439
1440
|
var appliedWalletDiscountIds = new Set((product.discount_list || []).filter(function (item) {
|
|
1440
1441
|
return ['entitlement_pass', 'discount_card', 'product_discount_card'].includes((item === null || item === void 0 ? void 0 : item.tag) || (item === null || item === void 0 ? void 0 : item.type));
|
|
1441
1442
|
}).map(function (item) {
|
|
1442
|
-
var
|
|
1443
|
-
return (
|
|
1443
|
+
var _ref18, _item$discount$resour, _item$discount;
|
|
1444
|
+
return (_ref18 = (_item$discount$resour = item === null || item === void 0 || (_item$discount = item.discount) === null || _item$discount === void 0 ? void 0 : _item$discount.resource_id) !== null && _item$discount$resour !== void 0 ? _item$discount$resour : item === null || item === void 0 ? void 0 : item.resource_id) !== null && _ref18 !== void 0 ? _ref18 : item === null || item === void 0 ? void 0 : item.id;
|
|
1444
1445
|
}).filter(function (id) {
|
|
1445
1446
|
return id !== undefined && id !== null;
|
|
1446
1447
|
}).map(String));
|
|
@@ -1480,8 +1481,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1480
1481
|
isManualDiscount = typeof product.isManualDiscount === 'boolean' ? product.isManualDiscount : ((_product$discount_lis5 = product.discount_list) === null || _product$discount_lis5 === void 0 ? void 0 : _product$discount_lis5.some(function (item) {
|
|
1481
1482
|
return item.type === 'product';
|
|
1482
1483
|
})) || product.total != product.origin_total && (product.bundle || []).every(function (item) {
|
|
1483
|
-
var
|
|
1484
|
-
return !((
|
|
1484
|
+
var _ref19;
|
|
1485
|
+
return !((_ref19 = item.discount_list || []) !== null && _ref19 !== void 0 && _ref19.length);
|
|
1485
1486
|
}) && (!((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.length) || ((_product12 = product) === null || _product12 === void 0 || (_product12 = _product12.discount_list) === null || _product12 === void 0 || (_product12$every = _product12.every) === null || _product12$every === void 0 ? void 0 : _product12$every.call(_product12, function (item) {
|
|
1486
1487
|
return item.type === 'product';
|
|
1487
1488
|
})));
|
|
@@ -1497,8 +1498,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1497
1498
|
isManualDiscount = typeof parentProduct.isManualDiscount === 'boolean' ? parentProduct.isManualDiscount : ((_parentProduct$discou = parentProduct.discount_list) === null || _parentProduct$discou === void 0 ? void 0 : _parentProduct$discou.some(function (item) {
|
|
1498
1499
|
return item.type === 'product';
|
|
1499
1500
|
})) || parentProduct.total != parentProduct.origin_total && (parentProduct.bundle || []).every(function (item) {
|
|
1500
|
-
var
|
|
1501
|
-
return !((
|
|
1501
|
+
var _ref20;
|
|
1502
|
+
return !((_ref20 = item.discount_list || []) !== null && _ref20 !== void 0 && _ref20.length);
|
|
1502
1503
|
}) && (!((_parentProduct$discou2 = parentProduct.discount_list) !== null && _parentProduct$discou2 !== void 0 && _parentProduct$discou2.length) || (parentProduct === null || parentProduct === void 0 || (_parentProduct$discou3 = parentProduct.discount_list) === null || _parentProduct$discou3 === void 0 || (_parentProduct$discou4 = _parentProduct$discou3.every) === null || _parentProduct$discou4 === void 0 ? void 0 : _parentProduct$discou4.call(_parentProduct$discou3, function (item) {
|
|
1503
1504
|
return item.type === 'product';
|
|
1504
1505
|
})));
|
|
@@ -1591,8 +1592,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1591
1592
|
discount_list: isManualDiscount ? _this4.resolveDiscountListForManualOverride(product.discount_list) : _this4.filterDiscountListByType(product.discount_list, 'promotion')
|
|
1592
1593
|
}))]);
|
|
1593
1594
|
} else {
|
|
1594
|
-
var
|
|
1595
|
-
var total = product.inPromotion ? (
|
|
1595
|
+
var _ref21, _product$_promotion$f, _product13, _product$origin_total;
|
|
1596
|
+
var total = product.inPromotion ? (_ref21 = (_product$_promotion$f = (_product13 = product) === null || _product13 === void 0 || (_product13 = _product13._promotion) === null || _product13 === void 0 ? void 0 : _product13.finalPrice) !== null && _product$_promotion$f !== void 0 ? _product$_promotion$f : product.origin_total) !== null && _ref21 !== void 0 ? _ref21 : product.total : (_product$origin_total = product.origin_total) !== null && _product$origin_total !== void 0 ? _product$origin_total : product.total;
|
|
1596
1597
|
var main_product_selling_price = product.price;
|
|
1597
1598
|
if ((product.discount_list || []).some(function (item) {
|
|
1598
1599
|
return item.type === 'promotion';
|
|
@@ -2295,7 +2296,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2295
2296
|
} else {
|
|
2296
2297
|
// 🔥 没有子商品被拆分,使用原有逻辑
|
|
2297
2298
|
mainProductArr.forEach(function (mainProduct) {
|
|
2298
|
-
var
|
|
2299
|
+
var _ref23, _mainProductData$main, _mainProductData$disc, _mainProductData$disc2, _mainProductData$disc3;
|
|
2299
2300
|
var mainProductData = _this4.hooks.getProduct(mainProduct);
|
|
2300
2301
|
|
|
2301
2302
|
// 重组bundle
|
|
@@ -2310,9 +2311,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2310
2311
|
} else {
|
|
2311
2312
|
// 🔥 关键:拆分后的bundle item
|
|
2312
2313
|
processedBundleItems.forEach(function (item) {
|
|
2313
|
-
var _item$price,
|
|
2314
|
+
var _item$price, _ref22, _item$bundle_selling_;
|
|
2314
2315
|
var nextBundlePrice = (_item$price = item.price) !== null && _item$price !== void 0 ? _item$price : bundleItem.price;
|
|
2315
|
-
var nextBundleSellingPrice = (
|
|
2316
|
+
var nextBundleSellingPrice = (_ref22 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref22 !== void 0 ? _ref22 : bundleItem.bundle_selling_price;
|
|
2316
2317
|
// 🔥 更新 discount_list 中的 num,使其与拆分后的 item.num 一致
|
|
2317
2318
|
var updatedDiscountList = (item.discount_list || []).map(function (discount) {
|
|
2318
2319
|
var _discount$metadata11;
|
|
@@ -2339,7 +2340,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2339
2340
|
|
|
2340
2341
|
// 主商品已经在前面的 setProduct 中应用过折扣;这里只替换 bundle,
|
|
2341
2342
|
// 避免把主商品 discount_list 再扣一次。
|
|
2342
|
-
var mainSellingPrice = (
|
|
2343
|
+
var mainSellingPrice = (_ref23 = (_mainProductData$main = mainProductData.main_product_selling_price) !== null && _mainProductData$main !== void 0 ? _mainProductData$main : mainProductData.price) !== null && _ref23 !== void 0 ? _ref23 : 0;
|
|
2343
2344
|
var newTotal = Number(mainSellingPrice || 0);
|
|
2344
2345
|
var newOriginTotal = Number(mainProductData.original_price || mainProductData.price || 0);
|
|
2345
2346
|
|
|
@@ -2555,15 +2556,15 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2555
2556
|
var ruleType = usageRules.type;
|
|
2556
2557
|
// 套餐适用范围配置
|
|
2557
2558
|
var packageScope = usageRules === null || usageRules === void 0 ? void 0 : usageRules.package_scope;
|
|
2558
|
-
var
|
|
2559
|
-
|
|
2560
|
-
scopeType =
|
|
2561
|
-
|
|
2562
|
-
exclude_bundle_product_ids =
|
|
2563
|
-
|
|
2564
|
-
include_bundle_product_ids =
|
|
2565
|
-
|
|
2566
|
-
filter =
|
|
2559
|
+
var _ref24 = packageScope || {},
|
|
2560
|
+
_ref24$type = _ref24.type,
|
|
2561
|
+
scopeType = _ref24$type === void 0 ? 'product_all' : _ref24$type,
|
|
2562
|
+
_ref24$exclude_bundle = _ref24.exclude_bundle_product_ids,
|
|
2563
|
+
exclude_bundle_product_ids = _ref24$exclude_bundle === void 0 ? [] : _ref24$exclude_bundle,
|
|
2564
|
+
_ref24$include_bundle = _ref24.include_bundle_product_ids,
|
|
2565
|
+
include_bundle_product_ids = _ref24$include_bundle === void 0 ? [] : _ref24$include_bundle,
|
|
2566
|
+
_ref24$filter = _ref24.filter,
|
|
2567
|
+
filter = _ref24$filter === void 0 ? 0 : _ref24$filter;
|
|
2567
2568
|
var isMainProduct = flatItem.type === 'main'; // 单独购买
|
|
2568
2569
|
var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
|
|
2569
2570
|
var bundleMainProductId = (_flatItem$product = flatItem.product) === null || _flatItem$product === void 0 ? void 0 : _flatItem$product.product_id;
|
|
@@ -29,6 +29,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
29
29
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
30
30
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
31
31
|
import { BaseModule } from "../../../modules/BaseModule";
|
|
32
|
+
import { resolveProductHolderConfig } from "../../../modules/Holder/utils";
|
|
32
33
|
import { QuotationModule as ClientQuotationModule } from "../../../modules/Quotation";
|
|
33
34
|
import { ProductsHooks } from "./types";
|
|
34
35
|
import { applyDetailValueToProducts, applyPriceDataToProducts, applyI18nToProducts, perfMark } from "../../utils/product";
|
|
@@ -1444,7 +1445,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1444
1445
|
key: "getProductSnapshotsByIds",
|
|
1445
1446
|
value: (function () {
|
|
1446
1447
|
var _getProductSnapshotsByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(ids) {
|
|
1447
|
-
var snapshots, seen, _iterator6, _step6, id, product;
|
|
1448
|
+
var snapshots, seen, _iterator6, _step6, _resolveProductHolder, id, product;
|
|
1448
1449
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1449
1450
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1450
1451
|
case 0:
|
|
@@ -1475,7 +1476,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1475
1476
|
case 13:
|
|
1476
1477
|
snapshots[String(id)] = {
|
|
1477
1478
|
cover: product.cover,
|
|
1478
|
-
holder_config: product
|
|
1479
|
+
holder_config: (_resolveProductHolder = resolveProductHolderConfig(product)) !== null && _resolveProductHolder !== void 0 ? _resolveProductHolder : undefined
|
|
1479
1480
|
};
|
|
1480
1481
|
case 14:
|
|
1481
1482
|
_context13.next = 5;
|
|
@@ -2954,31 +2954,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2954
2954
|
value: function () {
|
|
2955
2955
|
var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
2956
2956
|
var _order$_extend, _current$_extend;
|
|
2957
|
-
var order,
|
|
2957
|
+
var order, customerId, identity, config, current, missing;
|
|
2958
2958
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2959
2959
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2960
2960
|
case 0:
|
|
2961
2961
|
order = this.getTempOrder();
|
|
2962
|
+
customerId = order === null || order === void 0 ? void 0 : order.customer_id; // Missing customer IDs and the reserved Walk-In IDs do not require contact info.
|
|
2963
|
+
if (!(!Number.isFinite(Number(customerId)) || Number(customerId) <= 1)) {
|
|
2964
|
+
_context26.next = 4;
|
|
2965
|
+
break;
|
|
2966
|
+
}
|
|
2967
|
+
return _context26.abrupt("return");
|
|
2968
|
+
case 4:
|
|
2962
2969
|
identity = (order === null || order === void 0 || (_order$_extend = order._extend) === null || _order$_extend === void 0 ? void 0 : _order$_extend.localId) || (order === null || order === void 0 ? void 0 : order.external_sale_number) || (order === null || order === void 0 ? void 0 : order.order_id) || order;
|
|
2963
|
-
|
|
2964
|
-
_context26.next = 5;
|
|
2970
|
+
_context26.next = 7;
|
|
2965
2971
|
return this.getContactInfoConfig();
|
|
2966
|
-
case
|
|
2972
|
+
case 7:
|
|
2967
2973
|
config = _context26.sent;
|
|
2968
2974
|
current = this.getTempOrder();
|
|
2969
2975
|
if (!(identity !== ((current === null || current === void 0 || (_current$_extend = current._extend) === null || _current$_extend === void 0 ? void 0 : _current$_extend.localId) || (current === null || current === void 0 ? void 0 : current.external_sale_number) || (current === null || current === void 0 ? void 0 : current.order_id) || current) || customerId !== (current === null || current === void 0 ? void 0 : current.customer_id))) {
|
|
2970
|
-
_context26.next =
|
|
2976
|
+
_context26.next = 11;
|
|
2971
2977
|
break;
|
|
2972
2978
|
}
|
|
2973
2979
|
throw new Error('The order changed. Please try again.');
|
|
2974
|
-
case
|
|
2980
|
+
case 11:
|
|
2975
2981
|
missing = getMissingContactInfoFields(config, current === null || current === void 0 ? void 0 : current.contacts_info);
|
|
2976
2982
|
if (!missing.length) {
|
|
2977
|
-
_context26.next =
|
|
2983
|
+
_context26.next = 14;
|
|
2978
2984
|
break;
|
|
2979
2985
|
}
|
|
2980
2986
|
throw new ContactInfoRequiredError(missing);
|
|
2981
|
-
case
|
|
2987
|
+
case 14:
|
|
2982
2988
|
case "end":
|
|
2983
2989
|
return _context26.stop();
|
|
2984
2990
|
}
|
|
@@ -12,6 +12,7 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
12
12
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
14
|
import { resolveWeighedSourcePrice, withOriginalBundleOptionPrices } from "../../../modules/Order/utils/weighedProduct";
|
|
15
|
+
import { resolveProductHolderConfig } from "../../../modules/Holder/utils";
|
|
15
16
|
import { isBookingProduct } from "../../../modules/BookingContext/utils/serviceTimes";
|
|
16
17
|
import { composeLinePrice, getBundleSellingMagnitude, normalizeProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
|
|
17
18
|
import { buildManualProductDiscountItem, mergeManualProductDiscountIntoList, resolveManualDiscountOriginTotal, resolveManualDiscountReasonFromSources, shouldBuildManualProductDiscount } from "../../../modules/Order/utils/manualProductDiscount";
|
|
@@ -169,7 +170,7 @@ function findVariantById(origin, variantId) {
|
|
|
169
170
|
* 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
|
|
170
171
|
*/
|
|
171
172
|
export function transformBaseProductToOrderProduct(params) {
|
|
172
|
-
var _ref12, _ref13, _ref14, _payload$product_id, _ref15, _ref16, _payload$product_vari, _payload$_origin, _payload$_origin2, _payload$metadata, _sourceProduct$metada, _callbackOrigin$metad, _origin$metadata, _payload$metadata2, _payload$_extend, _sourceProduct$metada2, _sourceProduct$_exten, _callbackOrigin$metad2, _callbackOrigin$_exte, _payload$_dataVariant, _sourceProduct$_dataV, _callbackOrigin$_data, _origin$_dataVariant, _ref17, _findVariantById, _origin$production_co, _ref18, _ref19, _ref20, _ref21, _ref22, _matchedVariant$price, _payload$product_sku, _payload$_extend$weig, _payload$_extend2, _origin$_extend, _ref23, _ref24, _payload$price, _ref25, _payload$line_total, _payload$_extend3, _ref26, _ref27, _payload$product_sku$, _payload$product_sku2, _payload$bundle, _payload$quantity, _payload$_extend4, _extend, _extend2, _ref28, _ref29, _origin$base_price, _ref30, _ref31, _payload$line_total2, _payload$_extend5, _payload$_extend6, _extend3, _payload$_extend7, _payload$_extend8, _find, _ref32, _ref33, _payload$tax_fee, _ref34, _ref35, _payload$is_charge_ta;
|
|
173
|
+
var _ref12, _ref13, _ref14, _payload$product_id, _ref15, _ref16, _payload$product_vari, _payload$_origin, _payload$_origin2, _payload$metadata, _sourceProduct$metada, _callbackOrigin$metad, _origin$metadata, _payload$metadata2, _payload$_extend, _sourceProduct$metada2, _sourceProduct$_exten, _callbackOrigin$metad2, _callbackOrigin$_exte, _payload$_dataVariant, _sourceProduct$_dataV, _callbackOrigin$_data, _origin$_dataVariant, _ref17, _findVariantById, _origin$production_co, _ref18, _ref19, _ref20, _ref21, _ref22, _matchedVariant$price, _payload$product_sku, _payload$_extend$weig, _payload$_extend2, _origin$_extend, _ref23, _ref24, _payload$price, _ref25, _payload$line_total, _payload$_extend3, _ref26, _ref27, _payload$product_sku$, _payload$product_sku2, _payload$bundle, _payload$quantity, _payload$_extend4, _extend, _extend2, _ref28, _ref29, _origin$base_price, _ref30, _ref31, _payload$line_total2, _payload$_extend5, _payload$_extend6, _extend3, _payload$_extend7, _payload$_extend8, _find, _resolveProductHolder, _ref32, _ref33, _payload$tax_fee, _ref34, _ref35, _payload$is_charge_ta;
|
|
173
174
|
var payload = params.payload,
|
|
174
175
|
_params$fallbackProdu = params.fallbackProductId,
|
|
175
176
|
fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
|
|
@@ -260,7 +261,7 @@ export function transformBaseProductToOrderProduct(params) {
|
|
|
260
261
|
main_product_selling_price: mainProductSellingPrice,
|
|
261
262
|
main_product_original_price: mainProductOriginalPrice,
|
|
262
263
|
price_schema_version: 2,
|
|
263
|
-
holder_config: sourceProduct
|
|
264
|
+
holder_config: (_resolveProductHolder = resolveProductHolderConfig(sourceProduct)) !== null && _resolveProductHolder !== void 0 ? _resolveProductHolder : undefined
|
|
264
265
|
}, dataVariantIds !== undefined ? {
|
|
265
266
|
data_variant_ids: dataVariantIds
|
|
266
267
|
} : {}), selectedSettlementSnapshot ? {
|
|
@@ -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 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -360,7 +360,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
360
360
|
* 获取当前的客户搜索条件
|
|
361
361
|
* @returns 当前搜索条件
|
|
362
362
|
*/
|
|
363
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
363
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
364
364
|
/**
|
|
365
365
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
366
366
|
* @returns 客户状态
|
|
@@ -479,19 +479,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
479
479
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
480
480
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
481
481
|
*/
|
|
482
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
483
|
-
action: "reloadCatalog";
|
|
484
|
-
} | {
|
|
485
|
-
action: "add";
|
|
486
|
-
cacheItem: any;
|
|
487
|
-
} | {
|
|
488
|
-
action: "requiresDetail";
|
|
489
|
-
payload: AddProductRequiresDetailPayload;
|
|
490
|
-
} | {
|
|
491
|
-
action: "requiresBookingEdit";
|
|
492
|
-
cacheItem: any;
|
|
493
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
494
|
-
};
|
|
482
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
495
483
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
496
484
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
497
485
|
/**
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _examples.BUY_X_GET_Y_FREE_STRATEGY;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _examples.ITEM_REWARD_STRATEGY;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "PromotionAdapter", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _adapter.PromotionAdapter;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "PromotionEvaluator", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _evaluator.PromotionEvaluator;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "default", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _adapter.default;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var _evaluator = require("./evaluator");
|
|
43
|
-
var _adapter = _interopRequireWildcard(require("./adapter"));
|
|
44
|
-
var _examples = require("./examples");
|
|
45
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
46
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
1
|
+
"use strict";
|
|
@@ -8,6 +8,7 @@ var _lodashEs = require("lodash-es");
|
|
|
8
8
|
var _holderRelations = require("../../Order/holderRelations");
|
|
9
9
|
var _utils = require("../../Order/utils");
|
|
10
10
|
var _entitlementPass = require("../../Discount/entitlementPass");
|
|
11
|
+
var _utils2 = require("../../Holder/utils");
|
|
11
12
|
var _orderLineDisplay = require("./orderLineDisplay");
|
|
12
13
|
/**
|
|
13
14
|
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
@@ -148,7 +149,7 @@ function buildNormalProductCacheItemFromOrderLine(input) {
|
|
|
148
149
|
}
|
|
149
150
|
return {
|
|
150
151
|
...(sourceProduct || {}),
|
|
151
|
-
holder_config: sourceProduct
|
|
152
|
+
holder_config: (0, _utils2.resolveProductHolderConfig)(sourceProduct) ?? (0, _utils2.resolveProductHolderConfig)(product) ?? undefined,
|
|
152
153
|
id: resolvedId,
|
|
153
154
|
product_id: resolvedId,
|
|
154
155
|
_id: uid,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ProductData } from '../Product/types';
|
|
2
2
|
import { IFormItemData, IHolderConfig } from './types';
|
|
3
|
+
/** 保留显式禁用配置;仅在新配置缺失时兼容商品旧 holder 定义。 */
|
|
4
|
+
export declare function resolveProductHolderConfig(product?: ProductData | Record<string, any> | null): Record<string, any> | null;
|
|
3
5
|
export declare function getProductHolderConfig(product?: ProductData | Record<string, any> | null): IHolderConfig | null;
|
|
4
6
|
export declare function getFormIdFromHolderConfig(config: IHolderConfig): number;
|
|
5
7
|
export declare function normalizeFormId(formId: number | string): number;
|
|
@@ -8,9 +8,35 @@ exports.getFormIdFromHolderConfig = getFormIdFromHolderConfig;
|
|
|
8
8
|
exports.getProductHolderConfig = getProductHolderConfig;
|
|
9
9
|
exports.normalizeFormId = normalizeFormId;
|
|
10
10
|
exports.resolveFormMetaFromHolderItem = resolveFormMetaFromHolderItem;
|
|
11
|
+
exports.resolveProductHolderConfig = resolveProductHolderConfig;
|
|
12
|
+
/** 保留显式禁用配置;仅在新配置缺失时兼容商品旧 holder 定义。 */
|
|
13
|
+
function resolveProductHolderConfig(product) {
|
|
14
|
+
if (!product || typeof product !== 'object') return null;
|
|
15
|
+
const source = product;
|
|
16
|
+
const configSources = [source.holder_config, source.metadata?.holder_config, source.origin?.holder_config, source.metadata?.origin?.holder_config, source._origin?.holder_config, source._extend?.holder_config, source._extend?.product?.holder_config, source._extend?.product?.origin?.holder_config, source._extend?.product?.metadata?.holder_config, source._extend?.product?.metadata?.origin?.holder_config, source._extend?.product?._origin?.holder_config, source._extend?.product?._extend?.holder_config];
|
|
17
|
+
const config = configSources.find(value => value !== null && typeof value === 'object');
|
|
18
|
+
if (config) return config;
|
|
19
|
+
|
|
20
|
+
// metadata.holder / _extend.holder 是选择结果,不能作为商品配置读取。
|
|
21
|
+
const legacySources = [source.holder, source.origin?.holder, source.metadata?.origin?.holder, source._origin?.holder, source._extend?.product?.holder, source._extend?.product?.origin?.holder, source._extend?.product?.metadata?.origin?.holder, source._extend?.product?._origin?.holder];
|
|
22
|
+
const legacy = legacySources.find(value => value && typeof value === 'object' && !Array.isArray(value) && typeof value.type === 'string');
|
|
23
|
+
if (!legacy) return null;
|
|
24
|
+
const formId = legacy.custom?.custom_id;
|
|
25
|
+
if (legacy.type === 'custom' && legacy.custom?.type === 'form' && (typeof formId === 'number' || typeof formId === 'string') && Number.isInteger(Number(formId)) && Number(formId) > 0) {
|
|
26
|
+
return {
|
|
27
|
+
status: 'enable',
|
|
28
|
+
required: 0,
|
|
29
|
+
resource_id: formId
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
status: 'disable',
|
|
34
|
+
required: 0
|
|
35
|
+
};
|
|
36
|
+
}
|
|
11
37
|
function getProductHolderConfig(product) {
|
|
12
38
|
if (!product) return null;
|
|
13
|
-
const config = product
|
|
39
|
+
const config = resolveProductHolderConfig(product);
|
|
14
40
|
if (config?.status && config?.status !== 'enable') return null;
|
|
15
41
|
if (!config?.resource_id) return null;
|
|
16
42
|
return config;
|
|
@@ -8,6 +8,7 @@ var _BaseModule = require("../BaseModule");
|
|
|
8
8
|
var _types = require("./types");
|
|
9
9
|
var _utils = require("../../solution/ShopDiscount/utils");
|
|
10
10
|
var _utils2 = require("../Cart/utils");
|
|
11
|
+
var _utils3 = require("../Holder/utils");
|
|
11
12
|
var _decimal = _interopRequireDefault(require("decimal.js"));
|
|
12
13
|
var _lodashEs = require("lodash-es");
|
|
13
14
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
@@ -63,7 +64,7 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
63
64
|
if (discount.holder?.holder_type !== 'form') return true;
|
|
64
65
|
|
|
65
66
|
// getProduct 会裁剪商品字段,从原始商品读取配置,套餐子项沿用父商品。
|
|
66
|
-
const holderConfig =
|
|
67
|
+
const holderConfig = (0, _utils3.resolveProductHolderConfig)(holderSource);
|
|
67
68
|
const holderStatus = holderConfig?.status;
|
|
68
69
|
const holderEnabled = holderStatus === true || ['enable', '1'].includes(String(holderStatus).trim().toLowerCase());
|
|
69
70
|
if (!holderEnabled || holderConfig?.resource_id === undefined || holderConfig?.resource_id === null || holderConfig?.resource_id === '') {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ProductsModule = void 0;
|
|
7
7
|
var _BaseModule = require("../../../modules/BaseModule");
|
|
8
|
+
var _utils = require("../../../modules/Holder/utils");
|
|
8
9
|
var _Quotation = require("../../../modules/Quotation");
|
|
9
10
|
var _types = require("./types");
|
|
10
11
|
var _product = require("../../utils/product");
|
|
@@ -983,7 +984,7 @@ class ProductsModule extends _BaseModule.BaseModule {
|
|
|
983
984
|
if (!product) continue;
|
|
984
985
|
snapshots[String(id)] = {
|
|
985
986
|
cover: product.cover,
|
|
986
|
-
holder_config: product
|
|
987
|
+
holder_config: (0, _utils.resolveProductHolderConfig)(product) ?? undefined
|
|
987
988
|
};
|
|
988
989
|
}
|
|
989
990
|
return snapshots;
|
|
@@ -1918,8 +1918,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
async validateContactInfo() {
|
|
1920
1920
|
const order = this.getTempOrder();
|
|
1921
|
-
const identity = order?._extend?.localId || order?.external_sale_number || order?.order_id || order;
|
|
1922
1921
|
const customerId = order?.customer_id;
|
|
1922
|
+
// Missing customer IDs and the reserved Walk-In IDs do not require contact info.
|
|
1923
|
+
if (!Number.isFinite(Number(customerId)) || Number(customerId) <= 1) return;
|
|
1924
|
+
const identity = order?._extend?.localId || order?.external_sale_number || order?.order_id || order;
|
|
1923
1925
|
const config = await this.getContactInfoConfig();
|
|
1924
1926
|
const current = this.getTempOrder();
|
|
1925
1927
|
if (identity !== (current?._extend?.localId || current?.external_sale_number || current?.order_id || current) || customerId !== current?.customer_id) {
|
|
@@ -5,8 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.transformBaseProductToOrderProduct = transformBaseProductToOrderProduct;
|
|
7
7
|
var _weighedProduct = require("../../../modules/Order/utils/weighedProduct");
|
|
8
|
+
var _utils = require("../../../modules/Holder/utils");
|
|
8
9
|
var _serviceTimes = require("../../../modules/BookingContext/utils/serviceTimes");
|
|
9
|
-
var
|
|
10
|
+
var _utils2 = require("../../../modules/Order/utils");
|
|
10
11
|
var _manualProductDiscount = require("../../../modules/Order/utils/manualProductDiscount");
|
|
11
12
|
function toNumber(value, fallback = 0) {
|
|
12
13
|
const parsedValue = Number(value);
|
|
@@ -109,7 +110,7 @@ function normalizeBundleItems(bundleItems, preferPriceField = false, preferBundl
|
|
|
109
110
|
discount_list: preferPriceField ? [] : bundleItem.discount_list
|
|
110
111
|
};
|
|
111
112
|
// bundle_selling_price 落「正净额」:markdown = |price| − Σoptions;markup/原价维持原值。
|
|
112
|
-
normalizedItem.bundle_selling_price = (0,
|
|
113
|
+
normalizedItem.bundle_selling_price = (0, _utils2.getBundleSellingMagnitude)(magnitudeSource).toFixed(2);
|
|
113
114
|
if ((normalizedItem.price_type ?? normalizedItem.custom_price_type) === 'markdown' && (normalizedItem.price_type_ext === '' || normalizedItem.price_type_ext === undefined || normalizedItem.price_type_ext === null)) {
|
|
114
115
|
normalizedItem.custom_price = normalizedItem.custom_price ?? normalizedItem.price;
|
|
115
116
|
normalizedItem.price = normalizedItem.bundle_selling_price;
|
|
@@ -159,14 +160,14 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
159
160
|
const explicitLineTotal = payload.line_total ?? payload.total ?? payload._extend?.total;
|
|
160
161
|
const hasExplicitLineTotal = Number.isFinite(Number(explicitLineTotal));
|
|
161
162
|
const lineCompositeTotal = toPriceString(explicitLineTotal, sourceProductPrice);
|
|
162
|
-
const productOptionItem = (0,
|
|
163
|
+
const productOptionItem = (0, _utils2.normalizeProductSkuOptions)(normalizeOptionItems(payload.product_sku?.option ?? payload.option ?? payload.options ?? payload.product_option_item, hasPriceOverride || weighedSourcePrice !== undefined));
|
|
163
164
|
const productBundle = normalizeBundleItems(payload.bundle ?? payload.product_bundle, hasPriceOverride, hasPriceOverride && weighedSourcePrice !== undefined);
|
|
164
165
|
// `payload.unique` 是业务侧商品/票务标识,可能在连续加同一商品时重复;
|
|
165
166
|
// 行级唯一值只接受显式协议字段,缺省交给 OrderModule 生成。
|
|
166
167
|
const uniqueIdentificationNumber = payload.unique_identification_number;
|
|
167
168
|
const resolvedQuantity = toSafePositiveInt(payload.quantity ?? payload.num, 1);
|
|
168
|
-
const originTotal = weighedSourcePrice !== undefined ? Number((0,
|
|
169
|
-
mainPrice: Number(weighedSourcePrice) + (0,
|
|
169
|
+
const originTotal = weighedSourcePrice !== undefined ? Number((0, _utils2.composeLinePrice)({
|
|
170
|
+
mainPrice: Number(weighedSourcePrice) + (0, _utils2.sumOptionUnitPrice)(productOptionItem).toNumber(),
|
|
170
171
|
bundle: hasPriceOverride ? (0, _weighedProduct.withOriginalBundleOptionPrices)(productBundle) : productBundle,
|
|
171
172
|
useOriginalBundle: true
|
|
172
173
|
})) : (0, _manualProductDiscount.resolveManualDiscountOriginTotal)({
|
|
@@ -198,9 +199,9 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
198
199
|
})) : payload.discount_list || [];
|
|
199
200
|
|
|
200
201
|
// v2:source 不含 option;main_product_* 含 option(与 normalizeOrderProduct 一致)
|
|
201
|
-
const optionSum = (0,
|
|
202
|
+
const optionSum = (0, _utils2.sumOptionUnitPrice)(productOptionItem).toNumber();
|
|
202
203
|
const mainProductOriginalPrice = toPriceString(Number(sourceProductPrice) + optionSum);
|
|
203
|
-
const bundleOnlyComposite = (0,
|
|
204
|
+
const bundleOnlyComposite = (0, _utils2.composeLinePrice)({
|
|
204
205
|
mainPrice: 0,
|
|
205
206
|
bundle: productBundle
|
|
206
207
|
});
|
|
@@ -221,7 +222,7 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
221
222
|
main_product_selling_price: mainProductSellingPrice,
|
|
222
223
|
main_product_original_price: mainProductOriginalPrice,
|
|
223
224
|
price_schema_version: 2,
|
|
224
|
-
holder_config: sourceProduct
|
|
225
|
+
holder_config: (0, _utils.resolveProductHolderConfig)(sourceProduct) ?? undefined,
|
|
225
226
|
...(dataVariantIds !== undefined ? {
|
|
226
227
|
data_variant_ids: dataVariantIds
|
|
227
228
|
} : {}),
|
|
@@ -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 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -360,7 +360,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
360
360
|
* 获取当前的客户搜索条件
|
|
361
361
|
* @returns 当前搜索条件
|
|
362
362
|
*/
|
|
363
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
363
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
364
364
|
/**
|
|
365
365
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
366
366
|
* @returns 客户状态
|
|
@@ -479,19 +479,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
479
479
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
480
480
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
481
481
|
*/
|
|
482
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
483
|
-
action: "reloadCatalog";
|
|
484
|
-
} | {
|
|
485
|
-
action: "add";
|
|
486
|
-
cacheItem: any;
|
|
487
|
-
} | {
|
|
488
|
-
action: "requiresDetail";
|
|
489
|
-
payload: AddProductRequiresDetailPayload;
|
|
490
|
-
} | {
|
|
491
|
-
action: "requiresBookingEdit";
|
|
492
|
-
cacheItem: any;
|
|
493
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
494
|
-
};
|
|
482
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
495
483
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
496
484
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
497
485
|
/**
|