@pisell/pisellos 2.2.302 → 2.2.303
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/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/dist/model/strategy/adapter/itemRule/type.js +19 -1
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -7
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +41 -5
- package/dist/modules/Discount/types.d.ts +21 -0
- package/dist/modules/OpenData/index.d.ts +15 -2
- package/dist/modules/OpenData/index.js +307 -19
- package/dist/modules/OpenData/types.d.ts +55 -0
- package/dist/modules/OpenData/types.js +7 -1
- package/dist/modules/OpenData/utils.d.ts +21 -1
- package/dist/modules/OpenData/utils.js +138 -0
- package/dist/modules/Order/index.d.ts +50 -7
- package/dist/modules/Order/index.js +1690 -815
- package/dist/modules/Order/salesNotes.d.ts +31 -0
- package/dist/modules/Order/salesNotes.js +492 -0
- package/dist/modules/Order/types.d.ts +117 -10
- package/dist/modules/Order/types.js +6 -1
- package/dist/modules/Order/utils/virtualSettlement.d.ts +63 -0
- package/dist/modules/Order/utils/virtualSettlement.js +284 -0
- package/dist/modules/Order/utils.d.ts +5 -1
- package/dist/modules/Order/utils.js +138 -33
- package/dist/modules/Payment/walletpass.js +20 -21
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +2 -1
- package/dist/modules/ProductList/index.js +100 -20
- package/dist/modules/ProductList/types.d.ts +10 -0
- package/dist/modules/Rules/index.d.ts +5 -0
- package/dist/modules/Rules/index.js +30 -14
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +21 -1
- package/dist/plugins/request.d.ts +2 -1
- package/dist/plugins/request.js +4 -2
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.js +1774 -1285
- package/dist/server/modules/order/types.d.ts +50 -0
- package/dist/server/modules/order/types.js +2 -0
- package/dist/server/utils/small-ticket.d.ts +4 -1
- package/dist/server/utils/small-ticket.js +461 -96
- package/dist/solution/BaseSales/index.d.ts +24 -3
- package/dist/solution/BaseSales/index.js +1484 -873
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +72 -9
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +22 -5
- package/dist/solution/BookingTicket/index.js +558 -443
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
- package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
- package/dist/solution/RegisterAndLogin/config.js +95 -40
- package/dist/solution/RegisterAndLogin/index.js +4 -1
- package/dist/solution/Sales/index.d.ts +16 -1
- package/dist/solution/Sales/index.js +338 -63
- package/dist/solution/Sales/types.d.ts +10 -0
- package/dist/solution/ScanOrder/index.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +31 -27
- package/dist/solution/ScanOrder/utils.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +2 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +20 -6
- package/dist/solution/UnifiedBookingSales/index.js +874 -527
- package/dist/solution/UnifiedBookingSales/types.d.ts +21 -2
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +8 -4
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +137 -6
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
- package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/lib/model/strategy/adapter/itemRule/type.js +19 -1
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +4 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +34 -2
- package/lib/modules/Discount/types.d.ts +21 -0
- package/lib/modules/OpenData/index.d.ts +15 -2
- package/lib/modules/OpenData/index.js +230 -3
- package/lib/modules/OpenData/types.d.ts +55 -0
- package/lib/modules/OpenData/types.js +9 -1
- package/lib/modules/OpenData/utils.d.ts +21 -1
- package/lib/modules/OpenData/utils.js +126 -0
- package/lib/modules/Order/index.d.ts +50 -7
- package/lib/modules/Order/index.js +704 -64
- package/lib/modules/Order/salesNotes.d.ts +31 -0
- package/lib/modules/Order/salesNotes.js +382 -0
- package/lib/modules/Order/types.d.ts +117 -10
- package/lib/modules/Order/types.js +5 -1
- package/lib/modules/Order/utils/virtualSettlement.d.ts +63 -0
- package/lib/modules/Order/utils/virtualSettlement.js +262 -0
- package/lib/modules/Order/utils.d.ts +5 -1
- package/lib/modules/Order/utils.js +127 -21
- package/lib/modules/Payment/walletpass.js +14 -11
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +2 -1
- package/lib/modules/ProductList/index.js +47 -2
- package/lib/modules/ProductList/types.d.ts +10 -0
- package/lib/modules/Rules/index.d.ts +5 -0
- package/lib/modules/Rules/index.js +22 -12
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +17 -1
- package/lib/plugins/request.d.ts +2 -1
- package/lib/plugins/request.js +3 -2
- package/lib/server/index.d.ts +21 -0
- package/lib/server/index.js +492 -108
- package/lib/server/modules/order/types.d.ts +50 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/server/utils/small-ticket.d.ts +4 -1
- package/lib/server/utils/small-ticket.js +427 -72
- package/lib/solution/BaseSales/index.d.ts +24 -3
- package/lib/solution/BaseSales/index.js +433 -30
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +38 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +22 -5
- package/lib/solution/BookingTicket/index.js +60 -15
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
- package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
- package/lib/solution/RegisterAndLogin/config.js +49 -8
- package/lib/solution/RegisterAndLogin/index.js +4 -1
- package/lib/solution/Sales/index.d.ts +16 -1
- package/lib/solution/Sales/index.js +168 -1
- package/lib/solution/Sales/types.d.ts +10 -0
- package/lib/solution/ScanOrder/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +5 -1
- package/lib/solution/ScanOrder/utils.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +1 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +20 -6
- package/lib/solution/UnifiedBookingSales/index.js +169 -16
- package/lib/solution/UnifiedBookingSales/types.d.ts +21 -2
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +5 -1
- package/package.json +1 -1
|
@@ -35,6 +35,10 @@ export interface DataVariantItem {
|
|
|
35
35
|
module_data_id?: number;
|
|
36
36
|
/** 关联策略模型 metadata.id / data_variant_rule.id */
|
|
37
37
|
data_variant_rule_id: number | string;
|
|
38
|
+
/** 业务类型;多货币结算候选不会走普通字段覆盖 */
|
|
39
|
+
business_type?: 'multi_currency_settlement' | string;
|
|
40
|
+
/** 数据状态;多货币结算仅处理 enable 记录 */
|
|
41
|
+
status?: 'enable' | 'disable' | string;
|
|
38
42
|
/** 命中策略后需要覆盖到商品上的字段 */
|
|
39
43
|
data: Record<string, any>;
|
|
40
44
|
created_at?: string | null;
|
|
@@ -53,11 +57,30 @@ export interface DataVariantProduct {
|
|
|
53
57
|
id?: number | string;
|
|
54
58
|
[key: string]: any;
|
|
55
59
|
}>;
|
|
60
|
+
/**
|
|
61
|
+
* 商品接口已经完成规则计算时返回的命中结果。
|
|
62
|
+
* 数组按 Data Variant 优先级从高到低排列;空数组表示已计算但无命中。
|
|
63
|
+
*/
|
|
64
|
+
metadata?: {
|
|
65
|
+
data_variant_ids?: Array<number | string>;
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
};
|
|
56
68
|
/** 后端 /product/query with dataVariants 返回的智能定价变体列表 */
|
|
57
69
|
data_variants?: DataVariantItem[];
|
|
70
|
+
/** 当前上下文解析后的可选结算货币,不覆盖商品原始多货币配置 */
|
|
71
|
+
available_settlement_options?: AvailableSettlementOption[];
|
|
58
72
|
_dataVariant?: DataVariantAppliedInfo;
|
|
59
73
|
[key: string]: any;
|
|
60
74
|
}
|
|
75
|
+
export interface AvailableSettlementOption extends Record<string, any> {
|
|
76
|
+
settlement_type: 'legal_currency' | 'virtual_currency' | string;
|
|
77
|
+
currency_product_id?: number;
|
|
78
|
+
price: string;
|
|
79
|
+
data_variant_id?: number;
|
|
80
|
+
data_variant_rule_id: number | string;
|
|
81
|
+
available: boolean;
|
|
82
|
+
disabled_reason?: string;
|
|
83
|
+
}
|
|
61
84
|
/**
|
|
62
85
|
* 餐牌商品配置项。
|
|
63
86
|
*/
|
|
@@ -131,6 +154,8 @@ export interface MatchedDataVariant {
|
|
|
131
154
|
*/
|
|
132
155
|
export interface DataVariantAppliedInfo {
|
|
133
156
|
appliedRuleIds: string[];
|
|
157
|
+
/** 本地策略实际应用的 Data Variant ID,按优先级从高到低排列。 */
|
|
158
|
+
appliedVariantIds?: Array<number | string>;
|
|
134
159
|
appliedFields: string[];
|
|
135
160
|
original: DataVariantProduct;
|
|
136
161
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EvaluationResult, RuntimeContext, ActionEffect } from '../../type';
|
|
2
2
|
import type { BusinessAdapter } from '../type';
|
|
3
|
-
import { type ItemRuleBusinessData, type QuantityCheckResult, type PrefillItemResult, type QuantityLimitResult } from './type';
|
|
3
|
+
import { type ItemRuleBusinessData, type QuantityCheckResult, type PrefillItemResult, type QuantityLimitResult, type AllergyRequirement } from './type';
|
|
4
4
|
/**
|
|
5
5
|
* ItemRule 适配器
|
|
6
6
|
*
|
|
@@ -14,7 +14,10 @@ export declare class ItemRuleAdapter implements BusinessAdapter {
|
|
|
14
14
|
transformResult(result: EvaluationResult, businessData?: ItemRuleBusinessData): {
|
|
15
15
|
quantityChecks: QuantityCheckResult[];
|
|
16
16
|
prefillItems: PrefillItemResult[];
|
|
17
|
+
allergyRequirements: AllergyRequirement[];
|
|
17
18
|
};
|
|
19
|
+
private processAllergyCheck;
|
|
20
|
+
private normalizeAllergyDataSourceItems;
|
|
18
21
|
formatConfig(result: EvaluationResult, businessData?: ItemRuleBusinessData): {
|
|
19
22
|
result: EvaluationResult;
|
|
20
23
|
businessData?: ItemRuleBusinessData;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
5
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
6
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
7
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
8
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -31,18 +35,22 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
31
35
|
_createClass(ItemRuleAdapter, [{
|
|
32
36
|
key: "prepareContext",
|
|
33
37
|
value: function prepareContext(businessData) {
|
|
38
|
+
var _ref;
|
|
34
39
|
var pax = businessData.pax,
|
|
35
40
|
cartItems = businessData.cartItems,
|
|
36
41
|
serviceType = businessData.serviceType,
|
|
42
|
+
channel = businessData.channel,
|
|
37
43
|
submissionIndex = businessData.submissionIndex,
|
|
38
44
|
custom = businessData.custom;
|
|
45
|
+
var resolvedChannel = String((_ref = channel !== null && channel !== void 0 ? channel : custom === null || custom === void 0 ? void 0 : custom.channel) !== null && _ref !== void 0 ? _ref : '').trim();
|
|
39
46
|
return {
|
|
40
47
|
entities: {
|
|
41
48
|
cartItems: cartItems,
|
|
42
49
|
historicalItems: businessData.historicalItems || [],
|
|
43
|
-
pax: pax
|
|
50
|
+
pax: pax,
|
|
51
|
+
currentProduct: businessData.currentProduct
|
|
44
52
|
},
|
|
45
|
-
attributes: _objectSpread({
|
|
53
|
+
attributes: _objectSpread(_objectSpread({
|
|
46
54
|
serviceType: serviceType || '',
|
|
47
55
|
totalPax: pax.total,
|
|
48
56
|
adultPax: pax.adult,
|
|
@@ -52,7 +60,9 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
52
60
|
cartTotalQuantity: cartItems.reduce(function (sum, item) {
|
|
53
61
|
return sum + item.quantity;
|
|
54
62
|
}, 0)
|
|
55
|
-
}, custom),
|
|
63
|
+
}, custom), {}, {
|
|
64
|
+
channel: resolvedChannel
|
|
65
|
+
}),
|
|
56
66
|
metadata: {
|
|
57
67
|
timestamp: Date.now()
|
|
58
68
|
}
|
|
@@ -63,10 +73,12 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
63
73
|
value: function transformResult(result, businessData) {
|
|
64
74
|
var quantityChecks = [];
|
|
65
75
|
var prefillItems = [];
|
|
76
|
+
var allergyRequirements = [];
|
|
66
77
|
if (!result.applicable || !businessData) {
|
|
67
78
|
return {
|
|
68
79
|
quantityChecks: quantityChecks,
|
|
69
|
-
prefillItems: prefillItems
|
|
80
|
+
prefillItems: prefillItems,
|
|
81
|
+
allergyRequirements: allergyRequirements
|
|
70
82
|
};
|
|
71
83
|
}
|
|
72
84
|
var _iterator = _createForOfIteratorHelper(result.matchedActions),
|
|
@@ -82,6 +94,9 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
82
94
|
} else if (action.type === ITEM_RULE_ACTION_TYPES.PREFILL_CART) {
|
|
83
95
|
var items = this.processPrefillCart(action, businessData);
|
|
84
96
|
prefillItems.push.apply(prefillItems, _toConsumableArray(items));
|
|
97
|
+
} else if (action.type === ITEM_RULE_ACTION_TYPES.ALLERGY_CHECK) {
|
|
98
|
+
var requirement = this.processAllergyCheck(action, result, businessData);
|
|
99
|
+
if (requirement) allergyRequirements.push(requirement);
|
|
85
100
|
}
|
|
86
101
|
}
|
|
87
102
|
} catch (err) {
|
|
@@ -91,9 +106,94 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
91
106
|
}
|
|
92
107
|
return {
|
|
93
108
|
quantityChecks: quantityChecks,
|
|
94
|
-
prefillItems: prefillItems
|
|
109
|
+
prefillItems: prefillItems,
|
|
110
|
+
allergyRequirements: allergyRequirements
|
|
95
111
|
};
|
|
96
112
|
}
|
|
113
|
+
|
|
114
|
+
// ============================================
|
|
115
|
+
// Allergy Check 处理
|
|
116
|
+
// ============================================
|
|
117
|
+
}, {
|
|
118
|
+
key: "processAllergyCheck",
|
|
119
|
+
value: function processAllergyCheck(action, result, businessData) {
|
|
120
|
+
var _currentProduct$produ, _productTargets$find, _target$dataSource, _action$priority, _target$product_varia;
|
|
121
|
+
var config = action.config;
|
|
122
|
+
var currentProduct = businessData.currentProduct;
|
|
123
|
+
if (!config || config.targetType !== 'product' || config.promptScope !== 'once_per_order_product' || !Array.isArray(config.targets) || !currentProduct) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
var currentProductId = Number(currentProduct.product_id);
|
|
127
|
+
var currentVariantId = Number((_currentProduct$produ = currentProduct.product_variant_id) !== null && _currentProduct$produ !== void 0 ? _currentProduct$produ : 0);
|
|
128
|
+
if (!Number.isFinite(currentProductId) || currentProductId <= 0) return null;
|
|
129
|
+
var productTargets = config.targets.filter(function (item) {
|
|
130
|
+
return Number(item.product_id) === currentProductId;
|
|
131
|
+
});
|
|
132
|
+
var target = (_productTargets$find = productTargets.find(function (item) {
|
|
133
|
+
var _item$product_variant;
|
|
134
|
+
return currentVariantId > 0 && Number((_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0) === currentVariantId;
|
|
135
|
+
})) !== null && _productTargets$find !== void 0 ? _productTargets$find : productTargets.find(function (item) {
|
|
136
|
+
var _item$product_variant2;
|
|
137
|
+
return Number((_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0) <= 0;
|
|
138
|
+
});
|
|
139
|
+
if (!target || ((_target$dataSource = target.dataSource) === null || _target$dataSource === void 0 ? void 0 : _target$dataSource.type) !== 'inline') return null;
|
|
140
|
+
var items = this.normalizeAllergyDataSourceItems(target.dataSource.items);
|
|
141
|
+
if (!items.length) return null;
|
|
142
|
+
return _objectSpread(_objectSpread({
|
|
143
|
+
strategyId: result.config.metadata.id,
|
|
144
|
+
ruleId: action.id,
|
|
145
|
+
priority: (_action$priority = action.priority) !== null && _action$priority !== void 0 ? _action$priority : 0,
|
|
146
|
+
targetType: 'product',
|
|
147
|
+
product_id: currentProductId
|
|
148
|
+
}, Number((_target$product_varia = target.product_variant_id) !== null && _target$product_varia !== void 0 ? _target$product_varia : 0) > 0 ? {
|
|
149
|
+
product_variant_id: Number(target.product_variant_id)
|
|
150
|
+
} : {}), {}, {
|
|
151
|
+
dataSource: {
|
|
152
|
+
type: 'inline',
|
|
153
|
+
items: items
|
|
154
|
+
},
|
|
155
|
+
promptScope: config.promptScope,
|
|
156
|
+
allowNote: config.allowNote === true
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}, {
|
|
160
|
+
key: "normalizeAllergyDataSourceItems",
|
|
161
|
+
value: function normalizeAllergyDataSourceItems(items) {
|
|
162
|
+
if (!Array.isArray(items)) return [];
|
|
163
|
+
var uniqueIds = new Set();
|
|
164
|
+
var normalized = [];
|
|
165
|
+
var _iterator2 = _createForOfIteratorHelper(items),
|
|
166
|
+
_step2;
|
|
167
|
+
try {
|
|
168
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
169
|
+
var _item$id;
|
|
170
|
+
var item = _step2.value;
|
|
171
|
+
var id = String((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : '').trim();
|
|
172
|
+
var rawLabel = item === null || item === void 0 ? void 0 : item.label;
|
|
173
|
+
var label = typeof rawLabel === 'string' ? rawLabel.trim() : Object.entries(rawLabel || {}).reduce(function (labels, _ref2) {
|
|
174
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
175
|
+
locale = _ref3[0],
|
|
176
|
+
value = _ref3[1];
|
|
177
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
178
|
+
labels[locale] = value.trim();
|
|
179
|
+
}
|
|
180
|
+
return labels;
|
|
181
|
+
}, {});
|
|
182
|
+
var hasLabel = typeof label === 'string' ? label.length > 0 : Object.keys(label).length > 0;
|
|
183
|
+
if (!id || !hasLabel || uniqueIds.has(id)) continue;
|
|
184
|
+
uniqueIds.add(id);
|
|
185
|
+
normalized.push({
|
|
186
|
+
id: id,
|
|
187
|
+
label: label
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
} catch (err) {
|
|
191
|
+
_iterator2.e(err);
|
|
192
|
+
} finally {
|
|
193
|
+
_iterator2.f();
|
|
194
|
+
}
|
|
195
|
+
return normalized;
|
|
196
|
+
}
|
|
97
197
|
}, {
|
|
98
198
|
key: "formatConfig",
|
|
99
199
|
value: function formatConfig(result, businessData) {
|
|
@@ -178,19 +278,19 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
178
278
|
}));
|
|
179
279
|
var quantity = 0;
|
|
180
280
|
var countFromItems = function countFromItems(items) {
|
|
181
|
-
var
|
|
182
|
-
|
|
281
|
+
var _iterator3 = _createForOfIteratorHelper(items),
|
|
282
|
+
_step3;
|
|
183
283
|
try {
|
|
184
|
-
for (
|
|
185
|
-
var item =
|
|
284
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
285
|
+
var item = _step3.value;
|
|
186
286
|
if (targetIds.has(item.product_id)) {
|
|
187
287
|
quantity += item.quantity;
|
|
188
288
|
}
|
|
189
289
|
}
|
|
190
290
|
} catch (err) {
|
|
191
|
-
|
|
291
|
+
_iterator3.e(err);
|
|
192
292
|
} finally {
|
|
193
|
-
|
|
293
|
+
_iterator3.f();
|
|
194
294
|
}
|
|
195
295
|
};
|
|
196
296
|
if (scope === 'cumulative') {
|
|
@@ -214,11 +314,11 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
214
314
|
var requiredMax;
|
|
215
315
|
var requiredExact;
|
|
216
316
|
var mustInclude;
|
|
217
|
-
var
|
|
218
|
-
|
|
317
|
+
var _iterator4 = _createForOfIteratorHelper(rules),
|
|
318
|
+
_step4;
|
|
219
319
|
try {
|
|
220
|
-
for (
|
|
221
|
-
var rule =
|
|
320
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
321
|
+
var rule = _step4.value;
|
|
222
322
|
var resolvedValue = this.resolveQuantityValue(rule, businessData);
|
|
223
323
|
switch (rule.comparison) {
|
|
224
324
|
case 'minimum':
|
|
@@ -260,9 +360,9 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
260
360
|
}
|
|
261
361
|
}
|
|
262
362
|
} catch (err) {
|
|
263
|
-
|
|
363
|
+
_iterator4.e(err);
|
|
264
364
|
} finally {
|
|
265
|
-
|
|
365
|
+
_iterator4.f();
|
|
266
366
|
}
|
|
267
367
|
return {
|
|
268
368
|
passed: failedRules.length === 0,
|
|
@@ -336,11 +436,11 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
336
436
|
var requiredMax;
|
|
337
437
|
var requiredExact;
|
|
338
438
|
var mustInclude;
|
|
339
|
-
var
|
|
340
|
-
|
|
439
|
+
var _iterator5 = _createForOfIteratorHelper(quantityRules),
|
|
440
|
+
_step5;
|
|
341
441
|
try {
|
|
342
|
-
for (
|
|
343
|
-
var rule =
|
|
442
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
443
|
+
var rule = _step5.value;
|
|
344
444
|
var resolvedValue = this.resolveQuantityValue(rule, businessData);
|
|
345
445
|
switch (rule.comparison) {
|
|
346
446
|
case 'minimum':
|
|
@@ -370,9 +470,9 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
370
470
|
}
|
|
371
471
|
}
|
|
372
472
|
} catch (err) {
|
|
373
|
-
|
|
473
|
+
_iterator5.e(err);
|
|
374
474
|
} finally {
|
|
375
|
-
|
|
475
|
+
_iterator5.f();
|
|
376
476
|
}
|
|
377
477
|
var remainingMax = this.calculateRemainingMax(scope, requiredMax, targets, businessData);
|
|
378
478
|
var formattedValidationMessage = this.formatValidationMessage(validationMessage, requiredMin, requiredMax, requiredExact);
|
|
@@ -412,19 +512,19 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
412
512
|
return t.product_id;
|
|
413
513
|
}));
|
|
414
514
|
var historicalQty = 0;
|
|
415
|
-
var
|
|
416
|
-
|
|
515
|
+
var _iterator6 = _createForOfIteratorHelper(historicalItems),
|
|
516
|
+
_step6;
|
|
417
517
|
try {
|
|
418
|
-
for (
|
|
419
|
-
var item =
|
|
518
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
519
|
+
var item = _step6.value;
|
|
420
520
|
if (targetIds.has(item.product_id)) {
|
|
421
521
|
historicalQty += item.quantity;
|
|
422
522
|
}
|
|
423
523
|
}
|
|
424
524
|
} catch (err) {
|
|
425
|
-
|
|
525
|
+
_iterator6.e(err);
|
|
426
526
|
} finally {
|
|
427
|
-
|
|
527
|
+
_iterator6.f();
|
|
428
528
|
}
|
|
429
529
|
return Math.max(0, requiredMax - historicalQty);
|
|
430
530
|
}
|
|
@@ -438,11 +538,11 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
438
538
|
var config = action.config;
|
|
439
539
|
if (!(config !== null && config !== void 0 && config.products)) return [];
|
|
440
540
|
var results = [];
|
|
441
|
-
var
|
|
442
|
-
|
|
541
|
+
var _iterator7 = _createForOfIteratorHelper(config.products),
|
|
542
|
+
_step7;
|
|
443
543
|
try {
|
|
444
|
-
for (
|
|
445
|
-
var prefillProduct =
|
|
544
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
545
|
+
var prefillProduct = _step7.value;
|
|
446
546
|
var quantity = this.resolvePrefillQuantity(prefillProduct.quantityFrom, prefillProduct.quantity, businessData);
|
|
447
547
|
if (quantity <= 0) continue;
|
|
448
548
|
results.push({
|
|
@@ -453,9 +553,9 @@ export var ItemRuleAdapter = /*#__PURE__*/function () {
|
|
|
453
553
|
});
|
|
454
554
|
}
|
|
455
555
|
} catch (err) {
|
|
456
|
-
|
|
556
|
+
_iterator7.e(err);
|
|
457
557
|
} finally {
|
|
458
|
-
|
|
558
|
+
_iterator7.f();
|
|
459
559
|
}
|
|
460
560
|
return results;
|
|
461
561
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StrategyConfig } from '../../type';
|
|
2
|
-
import { type ItemRuleBusinessData, type ItemRuleEvaluationResult, type QuantityCheckResult, type QuantityLimitResult, type PrefillItemResult } from './type';
|
|
2
|
+
import { type ItemRuleBusinessData, type ItemRuleEvaluationResult, type QuantityCheckResult, type QuantityLimitResult, type PrefillItemResult, type AllergyRequirement } from './type';
|
|
3
3
|
/**
|
|
4
4
|
* ItemRule 评估器
|
|
5
5
|
*
|
|
@@ -21,6 +21,13 @@ export declare class ItemRuleEvaluator {
|
|
|
21
21
|
* 完整评估:数量校验 + 预填购物车
|
|
22
22
|
*/
|
|
23
23
|
evaluate(businessData: ItemRuleBusinessData): ItemRuleEvaluationResult;
|
|
24
|
+
/**
|
|
25
|
+
* 获取当前商品优先级最高的过敏门禁要求。
|
|
26
|
+
*
|
|
27
|
+
* 不同商品或不同 Action 的数据源不会合并;相同优先级按
|
|
28
|
+
* strategyId + ruleId 稳定排序,保证多次评估结果一致。
|
|
29
|
+
*/
|
|
30
|
+
getAllergyRequirement(businessData: ItemRuleBusinessData): AllergyRequirement | null;
|
|
24
31
|
/**
|
|
25
32
|
* 获取当前配置中各商品的数量限制
|
|
26
33
|
*
|
|
@@ -63,6 +63,7 @@ export var ItemRuleEvaluator = /*#__PURE__*/function () {
|
|
|
63
63
|
}) : this.strategyConfigs;
|
|
64
64
|
var allQuantityChecks = [];
|
|
65
65
|
var allPrefillItems = [];
|
|
66
|
+
var allAllergyRequirements = [];
|
|
66
67
|
var rawResults = [];
|
|
67
68
|
var context = this.adapter.prepareContext(businessData);
|
|
68
69
|
var _iterator = _createForOfIteratorHelper(configs),
|
|
@@ -74,9 +75,11 @@ export var ItemRuleEvaluator = /*#__PURE__*/function () {
|
|
|
74
75
|
rawResults.push(evalResult);
|
|
75
76
|
var _this$adapter$transfo = this.adapter.transformResult(evalResult, businessData),
|
|
76
77
|
quantityChecks = _this$adapter$transfo.quantityChecks,
|
|
77
|
-
prefillItems = _this$adapter$transfo.prefillItems
|
|
78
|
+
prefillItems = _this$adapter$transfo.prefillItems,
|
|
79
|
+
allergyRequirements = _this$adapter$transfo.allergyRequirements;
|
|
78
80
|
allQuantityChecks.push.apply(allQuantityChecks, _toConsumableArray(quantityChecks));
|
|
79
81
|
allPrefillItems.push.apply(allPrefillItems, _toConsumableArray(prefillItems));
|
|
82
|
+
allAllergyRequirements.push.apply(allAllergyRequirements, _toConsumableArray(allergyRequirements));
|
|
80
83
|
}
|
|
81
84
|
} catch (err) {
|
|
82
85
|
_iterator.e(err);
|
|
@@ -89,12 +92,33 @@ export var ItemRuleEvaluator = /*#__PURE__*/function () {
|
|
|
89
92
|
return {
|
|
90
93
|
quantityChecks: allQuantityChecks,
|
|
91
94
|
prefillItems: allPrefillItems,
|
|
95
|
+
allergyRequirements: allAllergyRequirements,
|
|
92
96
|
allPassed: failedChecks.length === 0,
|
|
93
97
|
failedChecks: failedChecks,
|
|
94
98
|
rawResults: rawResults
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
|
|
102
|
+
/**
|
|
103
|
+
* 获取当前商品优先级最高的过敏门禁要求。
|
|
104
|
+
*
|
|
105
|
+
* 不同商品或不同 Action 的数据源不会合并;相同优先级按
|
|
106
|
+
* strategyId + ruleId 稳定排序,保证多次评估结果一致。
|
|
107
|
+
*/
|
|
108
|
+
}, {
|
|
109
|
+
key: "getAllergyRequirement",
|
|
110
|
+
value: function getAllergyRequirement(businessData) {
|
|
111
|
+
var requirements = this.evaluate(businessData).allergyRequirements;
|
|
112
|
+
if (!requirements.length) return null;
|
|
113
|
+
return _toConsumableArray(requirements).sort(function (left, right) {
|
|
114
|
+
var priorityDiff = right.priority - left.priority;
|
|
115
|
+
if (priorityDiff !== 0) return priorityDiff;
|
|
116
|
+
var strategyDiff = left.strategyId.localeCompare(right.strategyId);
|
|
117
|
+
if (strategyDiff !== 0) return strategyDiff;
|
|
118
|
+
return left.ruleId.localeCompare(right.ruleId);
|
|
119
|
+
})[0];
|
|
120
|
+
}
|
|
121
|
+
|
|
98
122
|
/**
|
|
99
123
|
* 获取当前配置中各商品的数量限制
|
|
100
124
|
*
|
|
@@ -4,6 +4,8 @@ export declare const ITEM_RULE_ACTION_TYPES: {
|
|
|
4
4
|
readonly QUANTITY_CHECK: "QUANTITY_CHECK";
|
|
5
5
|
/** 预填购物车 */
|
|
6
6
|
readonly PREFILL_CART: "PREFILL_CART";
|
|
7
|
+
/** 加购前过敏信息确认 */
|
|
8
|
+
readonly ALLERGY_CHECK: "ALLERGY_CHECK";
|
|
7
9
|
};
|
|
8
10
|
export type ItemRuleActionType = (typeof ITEM_RULE_ACTION_TYPES)[keyof typeof ITEM_RULE_ACTION_TYPES];
|
|
9
11
|
export declare const ITEM_RULE_TEMPLATES: {
|
|
@@ -63,6 +65,42 @@ export interface TargetItem {
|
|
|
63
65
|
/** 变体 ID */
|
|
64
66
|
product_variant_id?: number;
|
|
65
67
|
}
|
|
68
|
+
/** 策略展示文案,可由调用方按当前 locale 解析。 */
|
|
69
|
+
export type ItemRuleLocalizedText = string | Record<string, string>;
|
|
70
|
+
/** 内联过敏源选项。稳定 id 用于保存选择,label 只负责展示。 */
|
|
71
|
+
export interface AllergyDataSourceItem {
|
|
72
|
+
id: string;
|
|
73
|
+
label: ItemRuleLocalizedText;
|
|
74
|
+
}
|
|
75
|
+
/** 当前仅支持随策略下发的内联过敏源。 */
|
|
76
|
+
export interface AllergyDataSource {
|
|
77
|
+
type: 'inline';
|
|
78
|
+
items: AllergyDataSourceItem[];
|
|
79
|
+
}
|
|
80
|
+
/** 每个目标商品独立持有自己的过敏源,禁止跨商品合并。 */
|
|
81
|
+
export interface AllergyTargetItem extends TargetItem {
|
|
82
|
+
dataSource: AllergyDataSource;
|
|
83
|
+
}
|
|
84
|
+
export type AllergyPromptScope = 'once_per_order_product';
|
|
85
|
+
/** ALLERGY_CHECK Action 的商品级配置。 */
|
|
86
|
+
export interface AllergyCheckConfig {
|
|
87
|
+
targetType: 'product';
|
|
88
|
+
targets: AllergyTargetItem[];
|
|
89
|
+
promptScope: AllergyPromptScope;
|
|
90
|
+
allowNote?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** 当前商品命中的单条过敏门禁要求。 */
|
|
93
|
+
export interface AllergyRequirement {
|
|
94
|
+
strategyId: string;
|
|
95
|
+
ruleId: string;
|
|
96
|
+
priority: number;
|
|
97
|
+
targetType: 'product';
|
|
98
|
+
product_id: number;
|
|
99
|
+
product_variant_id?: number;
|
|
100
|
+
dataSource: AllergyDataSource;
|
|
101
|
+
promptScope: AllergyPromptScope;
|
|
102
|
+
allowNote: boolean;
|
|
103
|
+
}
|
|
66
104
|
/**
|
|
67
105
|
* 预填商品项
|
|
68
106
|
*/
|
|
@@ -119,6 +157,10 @@ export interface ItemRuleBusinessData {
|
|
|
119
157
|
historicalItems?: CartItemSummary[];
|
|
120
158
|
/** 服务类型(如 'dine-in', 'takeaway') */
|
|
121
159
|
serviceType?: string;
|
|
160
|
+
/** 当前业务渠道(如 'kiosk', 'pos', 'online_store') */
|
|
161
|
+
channel?: string;
|
|
162
|
+
/** 当前正在加入购物车的商品;ALLERGY_CHECK 只读取该商品的 Target。 */
|
|
163
|
+
currentProduct?: Pick<TargetItem, 'product_id' | 'product_variant_id'>;
|
|
122
164
|
/** 当前提交次数(0=首次提交, >0=追加提交) */
|
|
123
165
|
submissionIndex?: number;
|
|
124
166
|
/** 策略配置列表(可选,如果不传则使用 setStrategyConfigs 设置的) */
|
|
@@ -216,6 +258,8 @@ export interface ItemRuleEvaluationResult {
|
|
|
216
258
|
quantityChecks: QuantityCheckResult[];
|
|
217
259
|
/** 需要预填的商品列表 */
|
|
218
260
|
prefillItems: PrefillItemResult[];
|
|
261
|
+
/** 当前商品命中的过敏门禁要求;不同 Action/商品不会合并。 */
|
|
262
|
+
allergyRequirements: AllergyRequirement[];
|
|
219
263
|
/** 所有校验是否全部通过 */
|
|
220
264
|
allPassed: boolean;
|
|
221
265
|
/** 未通过的校验列表 */
|
|
@@ -6,7 +6,9 @@ export var ITEM_RULE_ACTION_TYPES = {
|
|
|
6
6
|
/** 数量校验 */
|
|
7
7
|
QUANTITY_CHECK: 'QUANTITY_CHECK',
|
|
8
8
|
/** 预填购物车 */
|
|
9
|
-
PREFILL_CART: 'PREFILL_CART'
|
|
9
|
+
PREFILL_CART: 'PREFILL_CART',
|
|
10
|
+
/** 加购前过敏信息确认 */
|
|
11
|
+
ALLERGY_CHECK: 'ALLERGY_CHECK'
|
|
10
12
|
};
|
|
11
13
|
// ============================================
|
|
12
14
|
// Rule Template 类型(创建规则时的起始模板)
|
|
@@ -50,6 +52,22 @@ export var ITEM_RULE_TEMPLATES = {
|
|
|
50
52
|
|
|
51
53
|
/** 目标项 */
|
|
52
54
|
|
|
55
|
+
// ============================================
|
|
56
|
+
// Allergy Check 相关类型
|
|
57
|
+
// ============================================
|
|
58
|
+
|
|
59
|
+
/** 策略展示文案,可由调用方按当前 locale 解析。 */
|
|
60
|
+
|
|
61
|
+
/** 内联过敏源选项。稳定 id 用于保存选择,label 只负责展示。 */
|
|
62
|
+
|
|
63
|
+
/** 当前仅支持随策略下发的内联过敏源。 */
|
|
64
|
+
|
|
65
|
+
/** 每个目标商品独立持有自己的过敏源,禁止跨商品合并。 */
|
|
66
|
+
|
|
67
|
+
/** ALLERGY_CHECK Action 的商品级配置。 */
|
|
68
|
+
|
|
69
|
+
/** 当前商品命中的单条过敏门禁要求。 */
|
|
70
|
+
|
|
53
71
|
// ============================================
|
|
54
72
|
// Prefill Cart 相关类型
|
|
55
73
|
// ============================================
|
|
@@ -1,9 +0,0 @@
|
|
|
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";
|
|
@@ -192,10 +192,11 @@ function synthesizeProductResourceFromBooking(booking) {
|
|
|
192
192
|
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
193
193
|
*/
|
|
194
194
|
export function buildCacheItemFromOrderLine(input) {
|
|
195
|
-
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$bundle_edit, _product$product_vari, _product$num,
|
|
195
|
+
var _ref11, _sourceProduct$holder, _sourceProduct$origin, _product$metadata, _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$bundle_edit, _product$product_vari, _product$num, _ref12, _product$note, _booking$detail2, _product$metadata2, _product$metadata3, _ref13, _extension_type, _booking$product2, _booking$product3, _price, _product$product_sku, _product$order_detail, _ref14, _booking$id;
|
|
196
196
|
var product = input.product,
|
|
197
197
|
booking = input.booking,
|
|
198
198
|
sourceProduct = input.sourceProduct;
|
|
199
|
+
var holderConfig = (_ref11 = (_sourceProduct$holder = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.holder_config) !== null && _sourceProduct$holder !== void 0 ? _sourceProduct$holder : sourceProduct === null || sourceProduct === void 0 || (_sourceProduct$origin = sourceProduct.origin) === null || _sourceProduct$origin === void 0 ? void 0 : _sourceProduct$origin.holder_config) !== null && _ref11 !== void 0 ? _ref11 : (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.holder_config;
|
|
199
200
|
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;
|
|
200
201
|
var selling = Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
|
|
201
202
|
var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
|
|
@@ -229,7 +230,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
229
230
|
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
|
|
230
231
|
product_name: productTitle,
|
|
231
232
|
product_cover: productCover,
|
|
232
|
-
note: (
|
|
233
|
+
note: (_ref12 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref12 !== void 0 ? _ref12 : '',
|
|
233
234
|
price: mainProductPrice,
|
|
234
235
|
total: selling,
|
|
235
236
|
origin_total: original,
|
|
@@ -238,7 +239,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
238
239
|
holder_id: holderId,
|
|
239
240
|
other: other,
|
|
240
241
|
like_status: booking.like_status || 'common',
|
|
241
|
-
discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$
|
|
242
|
+
discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.product_discount_reason) || undefined
|
|
242
243
|
}, bundleEdit !== undefined ? {
|
|
243
244
|
bundle_edit: bundleEdit
|
|
244
245
|
} : {}), productOptionString ? {
|
|
@@ -254,7 +255,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
254
255
|
extend.origin_total = selling + manualAmount;
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
|
-
if (((_product$
|
|
258
|
+
if (((_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.price_override) != null || manualDiscount) {
|
|
258
259
|
extend.priceOverride = selling;
|
|
259
260
|
}
|
|
260
261
|
if (booking.holder !== undefined) {
|
|
@@ -263,10 +264,12 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
263
264
|
if (Array.isArray(booking.relation_forms)) {
|
|
264
265
|
extend.relation_forms = booking.relation_forms;
|
|
265
266
|
}
|
|
266
|
-
var base = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}),
|
|
267
|
+
var base = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), holderConfig !== undefined && holderConfig !== null ? {
|
|
268
|
+
holder_config: holderConfig
|
|
269
|
+
} : {}), {}, {
|
|
267
270
|
id: resolvedId,
|
|
268
271
|
product_id: resolvedId,
|
|
269
|
-
extension_type: (
|
|
272
|
+
extension_type: (_ref13 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref13 !== void 0 ? _ref13 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
|
|
270
273
|
title: productTitle || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || (booking === null || booking === void 0 || (_booking$product3 = booking.product) === null || _booking$product3 === void 0 ? void 0 : _booking$product3.title),
|
|
271
274
|
price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
|
|
272
275
|
selling_price: product.selling_price,
|
|
@@ -280,7 +283,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
280
283
|
new: 0,
|
|
281
284
|
autoClose: false,
|
|
282
285
|
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
283
|
-
booking_id: (
|
|
286
|
+
booking_id: (_ref14 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref14 !== void 0 ? _ref14 : 0
|
|
284
287
|
});
|
|
285
288
|
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
|
|
286
289
|
base.capacity = sourceProduct.capacity;
|
|
@@ -25,9 +25,11 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
25
25
|
with_wallet_pass_holder: 0 | 1;
|
|
26
26
|
with_available_wallet_flag?: 0 | 1;
|
|
27
27
|
with_available_wallet_pass_flag?: 0 | 1;
|
|
28
|
+
with_virtual_currency?: 0 | 1;
|
|
28
29
|
request_timezone: string;
|
|
29
30
|
order_id?: number | string;
|
|
30
31
|
}): Promise<DiscountPrepareConfigResult>;
|
|
32
|
+
private normalizeVirtualCurrencyList;
|
|
31
33
|
batchSearch(code: string, options?: {
|
|
32
34
|
customerId?: number;
|
|
33
35
|
orderId?: number;
|