@pisell/pisellos 2.2.272 → 2.2.274
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/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -12
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +0 -8
- package/dist/modules/Order/index.d.ts +12 -31
- package/dist/modules/Order/index.js +562 -778
- package/dist/modules/Order/types.d.ts +22 -36
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.js +6 -10
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +27 -29
- package/dist/modules/Payment/types.js +3 -5
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +39 -55
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +0 -16
- package/dist/server/index.js +1036 -1933
- package/dist/server/modules/order/index.d.ts +4 -49
- package/dist/server/modules/order/index.js +695 -1574
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +25 -59
- package/dist/solution/BaseSales/index.js +490 -767
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +36 -93
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +5 -21
- package/dist/solution/BookingTicket/index.js +49 -126
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.js +20 -31
- package/dist/solution/VenueBooking/index.js +19 -30
- package/dist/types/index.d.ts +0 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +0 -5
- package/lib/modules/Order/index.d.ts +12 -31
- package/lib/modules/Order/index.js +142 -201
- package/lib/modules/Order/types.d.ts +22 -36
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.js +4 -11
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +27 -29
- package/lib/modules/Payment/types.js +3 -3
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +22 -41
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +0 -16
- package/lib/server/index.js +18 -670
- package/lib/server/modules/order/index.d.ts +4 -49
- package/lib/server/modules/order/index.js +66 -657
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +25 -59
- package/lib/solution/BaseSales/index.js +79 -246
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +17 -65
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +5 -21
- package/lib/solution/BookingTicket/index.js +8 -59
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.js +0 -8
- package/lib/solution/VenueBooking/index.js +0 -8
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -78,7 +78,6 @@ export interface CartPromotionEvaluator {
|
|
|
78
78
|
}>;
|
|
79
79
|
hasApplicableStrategy: boolean;
|
|
80
80
|
}>;
|
|
81
|
-
getStrategyConfigs?: () => unknown[];
|
|
82
81
|
}
|
|
83
82
|
/** 单个赠品减量项 */
|
|
84
83
|
export interface GiftReduceItem {
|
|
@@ -268,8 +267,7 @@ export declare function appendPromotionTags<T extends Record<string, any>>(produ
|
|
|
268
267
|
* 处理购物车的促销计算与赠品差异化。
|
|
269
268
|
*
|
|
270
269
|
* 流程:
|
|
271
|
-
* 1. 分离 main / gift / edit-product
|
|
272
|
-
* 配置 ITEM_REWARD 时,编辑态商品也参与商品奖励重算)
|
|
270
|
+
* 1. 分离 main / gift / edit-product 三类(带 `booking_id` 的编辑态商品不参与促销)
|
|
273
271
|
* 2. 转 PromotionProduct 喂评估器 → 拿到 `evaluateCartWithPricing` 与 `getProductsApplicableStrategies`
|
|
274
272
|
* 3. 把 PricedProduct 映射回 OrderProduct 形态:
|
|
275
273
|
* - 参与促销的,写 `metadata._promotion` + 调整 `selling_price` / `main_product_selling_price`
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var _excluded = ["_promotionTags"];
|
|
2
2
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
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); }
|
|
4
9
|
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); }
|
|
5
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
11
|
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."); }
|
|
7
12
|
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; } }
|
|
8
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
14
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
-
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); }
|
|
15
15
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
16
|
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."); }
|
|
17
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -116,50 +116,24 @@ export function getOrderProductOriginalPriceForPromotion(product) {
|
|
|
116
116
|
}
|
|
117
117
|
return getOrderProductBasePrice(product);
|
|
118
118
|
}
|
|
119
|
-
var X_ITEMS_FOR_Y_PRICE = 'X_ITEMS_FOR_Y_PRICE';
|
|
120
|
-
var BUY_X_GET_Y_FREE = 'BUY_X_GET_Y_FREE';
|
|
121
|
-
var ITEM_REWARD = 'ITEM_REWARD';
|
|
122
|
-
function isItemRewardPromotionDiscountItem(item) {
|
|
123
|
-
var _item$metadata, _item$metadata2;
|
|
124
|
-
return (item === null || item === void 0 ? void 0 : item.type) === 'product' && (item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.source) === 'promotion' && (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.actionType) === ITEM_REWARD;
|
|
125
|
-
}
|
|
126
|
-
function isManagedPromotionDiscountItem(item) {
|
|
127
|
-
if ((item === null || item === void 0 ? void 0 : item.type) === 'promotion') return true;
|
|
128
|
-
return isItemRewardPromotionDiscountItem(item);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* 判断商品行在本轮评估前是否已享受促销。
|
|
133
|
-
*
|
|
134
|
-
* `_promotion` 仅存在于当前运行时;订单保存后会被裁剪,因此编辑态需通过
|
|
135
|
-
* ITEM_REWARD 写入的受管商品折扣恢复上一轮状态。
|
|
136
|
-
*/
|
|
137
|
-
function wasInPromotionBeforeEvaluation(item) {
|
|
138
|
-
var _item$metadata3;
|
|
139
|
-
if ((item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 || (_item$metadata3 = _item$metadata3._promotion) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.inPromotion) === true) return true;
|
|
140
|
-
return Array.isArray(item === null || item === void 0 ? void 0 : item.discount_list) && item.discount_list.some(isItemRewardPromotionDiscountItem);
|
|
141
|
-
}
|
|
142
119
|
|
|
143
120
|
/**
|
|
144
|
-
* 写入/清除促销 discount_list
|
|
121
|
+
* 写入/清除促销 discount_list(type=promotion)。
|
|
145
122
|
*
|
|
146
123
|
* applyDiscount → applyProductDiscountPrices 会从 source_product_price 减去 discount_list 合计
|
|
147
124
|
* 重算 main_product_selling_price;保留券前 source 时必须同步写入促销差额,否则会还原成原价。
|
|
148
125
|
*
|
|
149
|
-
* ITEM_REWARD 使用 type=product,复用商品级折扣排他规则,避免客户折扣继续叠加到奖励商品行。
|
|
150
|
-
*
|
|
151
126
|
* @example
|
|
152
127
|
* updatePromotionDiscountList(line, { title: '2 items for $10', amount: '17.00', original_amount: '22.00', fixed_amount: '17.00' });
|
|
153
128
|
*/
|
|
154
|
-
function updatePromotionDiscountList(item, promotionDiscount
|
|
129
|
+
function updatePromotionDiscountList(item, promotionDiscount) {
|
|
155
130
|
var discountList = Array.isArray(item.discount_list) ? _toConsumableArray(item.discount_list) : [];
|
|
156
131
|
discountList = discountList.filter(function (d) {
|
|
157
|
-
return
|
|
132
|
+
return (d === null || d === void 0 ? void 0 : d.type) !== 'promotion';
|
|
158
133
|
});
|
|
159
134
|
if (promotionDiscount) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
type: discountType,
|
|
135
|
+
discountList.push({
|
|
136
|
+
type: 'promotion',
|
|
163
137
|
amount: promotionDiscount.amount,
|
|
164
138
|
discount: {
|
|
165
139
|
original_amount: promotionDiscount.original_amount,
|
|
@@ -167,12 +141,7 @@ function updatePromotionDiscountList(item, promotionDiscount, options) {
|
|
|
167
141
|
title: promotionDiscount.title,
|
|
168
142
|
resource_id: ''
|
|
169
143
|
}
|
|
170
|
-
}
|
|
171
|
-
metadata: {
|
|
172
|
-
source: 'promotion',
|
|
173
|
-
actionType: (options === null || options === void 0 ? void 0 : options.actionType) || ITEM_REWARD
|
|
174
|
-
}
|
|
175
|
-
} : {}));
|
|
144
|
+
});
|
|
176
145
|
}
|
|
177
146
|
if (discountList.length > 0) {
|
|
178
147
|
item.discount_list = discountList;
|
|
@@ -180,19 +149,11 @@ function updatePromotionDiscountList(item, promotionDiscount, options) {
|
|
|
180
149
|
delete item.discount_list;
|
|
181
150
|
}
|
|
182
151
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
var configs = evaluator === null || evaluator === void 0 || (_evaluator$getStrateg = evaluator.getStrategyConfigs) === null || _evaluator$getStrateg === void 0 ? void 0 : _evaluator$getStrateg.call(evaluator);
|
|
186
|
-
if (!Array.isArray(configs)) return false;
|
|
187
|
-
return configs.some(function (config) {
|
|
188
|
-
return ((config === null || config === void 0 ? void 0 : config.actions) || []).some(function (action) {
|
|
189
|
-
return (action === null || action === void 0 ? void 0 : action.type) === actionType;
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
}
|
|
152
|
+
var X_ITEMS_FOR_Y_PRICE = 'X_ITEMS_FOR_Y_PRICE';
|
|
153
|
+
var BUY_X_GET_Y_FREE = 'BUY_X_GET_Y_FREE';
|
|
193
154
|
|
|
194
155
|
/**
|
|
195
|
-
* 将促销单价写入 OrderProduct(含 metadata 三字段 +
|
|
156
|
+
* 将促销单价写入 OrderProduct(含 metadata 三字段 + promotion discount_list)。
|
|
196
157
|
*
|
|
197
158
|
* @example
|
|
198
159
|
* applyPromoUnitPriceToLine(newItem, { promoUnitPrice: '5.00', originalBasePrice: 1, strategyTitle: '2 for 10' });
|
|
@@ -223,9 +184,6 @@ function applyPromoUnitPriceToLine(item, input) {
|
|
|
223
184
|
amount: discountAmount,
|
|
224
185
|
original_amount: catalogSource,
|
|
225
186
|
fixed_amount: discountAmount
|
|
226
|
-
}, {
|
|
227
|
-
actionType: input.actionType,
|
|
228
|
-
discountType: input.actionType === ITEM_REWARD ? 'product' : 'promotion'
|
|
229
187
|
});
|
|
230
188
|
} else {
|
|
231
189
|
updatePromotionDiscountList(item, null);
|
|
@@ -468,11 +426,13 @@ function getProductLineNoteSignature(product) {
|
|
|
468
426
|
}
|
|
469
427
|
|
|
470
428
|
/**
|
|
471
|
-
*
|
|
472
|
-
* 以历史行 uid 作为促销前后的行边界;新增行返回空边界,仍保留原有合并语义。
|
|
429
|
+
* 称重行以及编辑订单历史行都有各自的促销合并边界。
|
|
473
430
|
*/
|
|
474
431
|
function getPromotionLineMergeBoundary(product) {
|
|
475
|
-
var _product$metadata3;
|
|
432
|
+
var _product$product_sku, _product$metadata3;
|
|
433
|
+
if (Number((product === null || product === void 0 || (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1) {
|
|
434
|
+
return "weighing:".concat(getOrderProductUid(product));
|
|
435
|
+
}
|
|
476
436
|
if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.is_edit_for_runtime) !== true) return '';
|
|
477
437
|
return "edit:".concat(getOrderProductUid(product));
|
|
478
438
|
}
|
|
@@ -513,11 +473,11 @@ function getProductBundleForEvaluator(product) {
|
|
|
513
473
|
* // => 单行 num=4,清除 _promotion 后重新评估
|
|
514
474
|
*/
|
|
515
475
|
export function buildConsolidateKeyForPromotion(item) {
|
|
516
|
-
var _item$booking_uid, _item$
|
|
476
|
+
var _item$booking_uid, _item$metadata, _item$order_detail_id, _item$product_variant3;
|
|
517
477
|
var fingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
|
|
518
478
|
var noteSignature = getProductLineNoteSignature(item);
|
|
519
479
|
var lineMergeBoundary = getPromotionLineMergeBoundary(item);
|
|
520
|
-
var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$
|
|
480
|
+
var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.booking_uid;
|
|
521
481
|
var orderDetailId = (_item$order_detail_id = item === null || item === void 0 ? void 0 : item.order_detail_id) !== null && _item$order_detail_id !== void 0 ? _item$order_detail_id : item === null || item === void 0 ? void 0 : item.orderDetailId;
|
|
522
482
|
if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
|
|
523
483
|
var _item$product_variant;
|
|
@@ -538,11 +498,12 @@ function consolidateMainProductsForPromotion(entries) {
|
|
|
538
498
|
_step5;
|
|
539
499
|
try {
|
|
540
500
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
501
|
+
var _item$metadata2;
|
|
541
502
|
var _step5$value = _step5.value,
|
|
542
503
|
item = _step5$value.item,
|
|
543
504
|
originalListIndex = _step5$value.originalListIndex;
|
|
544
505
|
var key = buildConsolidateKeyForPromotion(item);
|
|
545
|
-
var wasInPromotion =
|
|
506
|
+
var wasInPromotion = (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 || (_item$metadata2 = _item$metadata2._promotion) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.inPromotion) === true;
|
|
546
507
|
var existing = groups.get(key);
|
|
547
508
|
if (!existing) {
|
|
548
509
|
var mergedItem = cloneDeep(item);
|
|
@@ -639,9 +600,6 @@ function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
|
|
|
639
600
|
function generateNumericId() {
|
|
640
601
|
return Math.floor(Math.random() * 1000000000) + Date.now();
|
|
641
602
|
}
|
|
642
|
-
function isBookingEditProductLine(product) {
|
|
643
|
-
return (product === null || product === void 0 ? void 0 : product.booking_id) !== undefined && (product === null || product === void 0 ? void 0 : product.booking_id) !== null && product.booking_id !== 0 && product.booking_id !== '0';
|
|
644
|
-
}
|
|
645
603
|
|
|
646
604
|
/**
|
|
647
605
|
* 把 OrderProduct 转成 evaluator 的 PromotionProduct(仅评估期使用)。
|
|
@@ -662,7 +620,6 @@ function convertToPromotionProduct(product, index) {
|
|
|
662
620
|
price: getOrderProductOriginalPriceForPromotion(product),
|
|
663
621
|
quantity: Number((_product$num = product === null || product === void 0 ? void 0 : product.num) !== null && _product$num !== void 0 ? _product$num : 1) || 1,
|
|
664
622
|
bundle: getProductBundleForEvaluator(product),
|
|
665
|
-
_promotionOnlyForItemReward: isBookingEditProductLine(product),
|
|
666
623
|
_originalItem: originalItem,
|
|
667
624
|
_originalId: getOrderProductUid(product),
|
|
668
625
|
_originalIndex: index
|
|
@@ -870,9 +827,6 @@ export function resolveStrategyRequiredQuantity(matched) {
|
|
|
870
827
|
if (matched.actionType === 'BUY_X_GET_Y_FREE') {
|
|
871
828
|
return Number(detail.buyQuantity) || 1;
|
|
872
829
|
}
|
|
873
|
-
if (matched.actionType === 'ITEM_REWARD') {
|
|
874
|
-
return Number(detail.triggerQuantity) || 1;
|
|
875
|
-
}
|
|
876
830
|
return 1;
|
|
877
831
|
}
|
|
878
832
|
|
|
@@ -1032,8 +986,7 @@ export function appendPromotionTags(products, evaluator) {
|
|
|
1032
986
|
* 处理购物车的促销计算与赠品差异化。
|
|
1033
987
|
*
|
|
1034
988
|
* 流程:
|
|
1035
|
-
* 1. 分离 main / gift / edit-product
|
|
1036
|
-
* 配置 ITEM_REWARD 时,编辑态商品也参与商品奖励重算)
|
|
989
|
+
* 1. 分离 main / gift / edit-product 三类(带 `booking_id` 的编辑态商品不参与促销)
|
|
1037
990
|
* 2. 转 PromotionProduct 喂评估器 → 拿到 `evaluateCartWithPricing` 与 `getProductsApplicableStrategies`
|
|
1038
991
|
* 3. 把 PricedProduct 映射回 OrderProduct 形态:
|
|
1039
992
|
* - 参与促销的,写 `metadata._promotion` + 调整 `selling_price` / `main_product_selling_price`
|
|
@@ -1063,7 +1016,6 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1063
1016
|
if (!list || list.length === 0 || !evaluator) return empty;
|
|
1064
1017
|
|
|
1065
1018
|
// 0. 分类
|
|
1066
|
-
var shouldIncludeEditProductsForItemReward = evaluatorHasActionType(evaluator, ITEM_REWARD);
|
|
1067
1019
|
var mainProductsWithIndex = [];
|
|
1068
1020
|
var existingGiftsWithIndex = [];
|
|
1069
1021
|
var editProductsWithIndex = [];
|
|
@@ -1080,18 +1032,11 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1080
1032
|
item: item,
|
|
1081
1033
|
originalListIndex: i
|
|
1082
1034
|
});
|
|
1083
|
-
} else if (
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
});
|
|
1089
|
-
} else {
|
|
1090
|
-
editProductsWithIndex.push({
|
|
1091
|
-
item: item,
|
|
1092
|
-
originalListIndex: i
|
|
1093
|
-
});
|
|
1094
|
-
}
|
|
1035
|
+
} else if ((item === null || item === void 0 ? void 0 : item.booking_id) !== undefined && (item === null || item === void 0 ? void 0 : item.booking_id) !== null && item.booking_id !== 0 && item.booking_id !== '0') {
|
|
1036
|
+
editProductsWithIndex.push({
|
|
1037
|
+
item: item,
|
|
1038
|
+
originalListIndex: i
|
|
1039
|
+
});
|
|
1095
1040
|
} else {
|
|
1096
1041
|
mainProductsWithIndex.push({
|
|
1097
1042
|
item: item,
|
|
@@ -1146,17 +1091,16 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1146
1091
|
var promotionProducts = [];
|
|
1147
1092
|
var originalItemMap = new Map();
|
|
1148
1093
|
var productsForStrategies = consolidatedMainProductsWithIndex.map(function (_ref16, i) {
|
|
1149
|
-
var _item$product_id, _item$product_variant5, _item$
|
|
1094
|
+
var _item$product_id, _item$product_variant5, _item$metadata3, _item$num;
|
|
1150
1095
|
var item = _ref16.item;
|
|
1151
1096
|
return {
|
|
1152
1097
|
id: i,
|
|
1153
1098
|
product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : 0) || 0,
|
|
1154
1099
|
product_variant_id: Number((_item$product_variant5 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant5 !== void 0 ? _item$product_variant5 : 0) || 0,
|
|
1155
|
-
name: (item === null || item === void 0 || (_item$
|
|
1100
|
+
name: (item === null || item === void 0 || (_item$metadata3 = item.metadata) === null || _item$metadata3 === void 0 ? void 0 : _item$metadata3.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
|
|
1156
1101
|
price: getOrderProductBasePrice(item),
|
|
1157
1102
|
quantity: Number((_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : 1) || 1,
|
|
1158
|
-
bundle: getProductBundleForEvaluator(item)
|
|
1159
|
-
_promotionOnlyForItemReward: isBookingEditProductLine(item)
|
|
1103
|
+
bundle: getProductBundleForEvaluator(item)
|
|
1160
1104
|
};
|
|
1161
1105
|
});
|
|
1162
1106
|
for (var _i = 0; _i < consolidatedMainProductsWithIndex.length; _i++) {
|
|
@@ -1264,7 +1208,7 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1264
1208
|
_step20;
|
|
1265
1209
|
try {
|
|
1266
1210
|
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
|
|
1267
|
-
var _priced$originalId2, _priced$product_id, _originalItem$product;
|
|
1211
|
+
var _priced$originalId2, _priced$product_id, _originalItem$product, _metadata$_promotion2;
|
|
1268
1212
|
var _priced = _step20.value;
|
|
1269
1213
|
var rawSourceId = (_priced$originalId2 = _priced.originalId) !== null && _priced$originalId2 !== void 0 ? _priced$originalId2 : _priced.id;
|
|
1270
1214
|
var _sourceId = Number(rawSourceId);
|
|
@@ -1283,7 +1227,7 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1283
1227
|
newItem._sourceCartNum = sourceCartNum;
|
|
1284
1228
|
|
|
1285
1229
|
// 清掉历史促销字段
|
|
1286
|
-
var wasInPromotion =
|
|
1230
|
+
var wasInPromotion = ((_metadata$_promotion2 = metadata._promotion) === null || _metadata$_promotion2 === void 0 ? void 0 : _metadata$_promotion2.inPromotion) === true || originalItem._wasInPromotionBeforeConsolidate === true;
|
|
1287
1231
|
delete metadata._promotion;
|
|
1288
1232
|
if (Array.isArray(newItem.product_bundle)) {
|
|
1289
1233
|
var _iterator23 = _createForOfIteratorHelper(newItem.product_bundle),
|
|
@@ -1304,13 +1248,12 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1304
1248
|
var priceUnchangedPromo = _priced.inPromotion && Number(_priced.finalPrice) === Number(originalBasePrice);
|
|
1305
1249
|
if (shouldModifyPrice) {
|
|
1306
1250
|
if (_priced.inPromotion && !priceUnchangedPromo) {
|
|
1307
|
-
var _priced$strategyMetad
|
|
1251
|
+
var _priced$strategyMetad;
|
|
1308
1252
|
var promoUnitPrice = new Decimal(_priced.finalPrice).toDecimalPlaces(2).toFixed(2);
|
|
1309
1253
|
applyPromoUnitPriceToLine(newItem, {
|
|
1310
1254
|
promoUnitPrice: promoUnitPrice,
|
|
1311
1255
|
originalBasePrice: originalBasePrice,
|
|
1312
|
-
strategyTitle: (_priced$strategyMetad = _priced.strategyMetadata) === null || _priced$strategyMetad === void 0 ? void 0 : _priced$strategyMetad.name
|
|
1313
|
-
actionType: _priced.strategyId ? (_strategyActionMap$ge = strategyActionMap.get(_priced.strategyId)) === null || _strategyActionMap$ge === void 0 ? void 0 : _strategyActionMap$ge.actionType : undefined
|
|
1256
|
+
strategyTitle: (_priced$strategyMetad = _priced.strategyMetadata) === null || _priced$strategyMetad === void 0 ? void 0 : _priced$strategyMetad.name
|
|
1314
1257
|
});
|
|
1315
1258
|
} else {
|
|
1316
1259
|
// 撤销上一轮促销:还原 selling_price 到 main_product_original_price 派生值
|
|
@@ -82,13 +82,8 @@ export interface ISalesBooking {
|
|
|
82
82
|
metadata?: Record<string, any> | null;
|
|
83
83
|
[key: string]: any;
|
|
84
84
|
}
|
|
85
|
-
export interface ISalesPaymentMetadata extends Record<string, any> {
|
|
86
|
-
/** 刷卡机设备快照;OS 不解析内部字段 */
|
|
87
|
-
card_reader_snapshot?: Record<string, unknown>;
|
|
88
|
-
}
|
|
89
85
|
export interface ISalesPayment {
|
|
90
86
|
order_payment_id?: number | null;
|
|
91
|
-
payment_number?: string;
|
|
92
87
|
custom_payment_id?: number;
|
|
93
88
|
code?: string;
|
|
94
89
|
name?: string;
|
|
@@ -100,7 +95,7 @@ export interface ISalesPayment {
|
|
|
100
95
|
status?: string;
|
|
101
96
|
payment_time?: string | null;
|
|
102
97
|
service_charge?: Record<string, any> | null;
|
|
103
|
-
metadata?:
|
|
98
|
+
metadata?: Record<string, any> | null;
|
|
104
99
|
[key: string]: any;
|
|
105
100
|
}
|
|
106
101
|
export interface ISalesSurcharge {
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
314
|
+
weekNum: 0 | 1 | 2 | 6 | 4 | 3 | 5;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -46,8 +46,6 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
46
46
|
private getIdGeneratorPlugin;
|
|
47
47
|
private loadOpenDataConfig;
|
|
48
48
|
getOpenData(): Promise<OpenDataConfig | null>;
|
|
49
|
-
/** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
50
|
-
clearOpenDataCache(): void;
|
|
51
49
|
private getShortNumberOrDeviceId;
|
|
52
50
|
private configureIdGeneratorFromOpenData;
|
|
53
51
|
private normalizePositiveInteger;
|
|
@@ -191,12 +189,10 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
191
189
|
*/
|
|
192
190
|
getCustomer(): ICustomer | null;
|
|
193
191
|
/**
|
|
194
|
-
* 通过 ids
|
|
195
|
-
*
|
|
192
|
+
* 通过 ids 获取商品列表(不加载到模块中)
|
|
193
|
+
* @returns 商品列表
|
|
196
194
|
*/
|
|
197
|
-
getProductByIds(ids: number[]
|
|
198
|
-
loadMissing?: boolean;
|
|
199
|
-
}): Promise<ProductData[]>;
|
|
195
|
+
getProductByIds(ids: number[]): Promise<ProductData[] | undefined>;
|
|
200
196
|
/**
|
|
201
197
|
* 获取日程时间段点
|
|
202
198
|
* @param params 参数
|
|
@@ -326,7 +322,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
326
322
|
* 获取当前的客户搜索条件
|
|
327
323
|
* @returns 当前搜索条件
|
|
328
324
|
*/
|
|
329
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
325
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
330
326
|
/**
|
|
331
327
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
332
328
|
* @returns 客户状态
|
|
@@ -445,19 +441,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
445
441
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
446
442
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
447
443
|
*/
|
|
448
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
449
|
-
action: "reloadCatalog";
|
|
450
|
-
} | {
|
|
451
|
-
action: "add";
|
|
452
|
-
cacheItem: any;
|
|
453
|
-
} | {
|
|
454
|
-
action: "requiresDetail";
|
|
455
|
-
payload: AddProductRequiresDetailPayload;
|
|
456
|
-
} | {
|
|
457
|
-
action: "requiresBookingEdit";
|
|
458
|
-
cacheItem: any;
|
|
459
|
-
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
460
|
-
};
|
|
444
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
461
445
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
462
446
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
463
447
|
/**
|