@pisell/pisellos 2.2.261 → 2.2.263
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/adapter.d.ts +50 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +167 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +780 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +5 -1
- 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 +1 -1
- 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 -10
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +32 -1
- package/dist/modules/Discount/index.d.ts +5 -2
- package/dist/modules/Discount/index.js +30 -7
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +14 -2
- package/dist/modules/Order/index.js +1035 -736
- package/dist/modules/Order/types.d.ts +16 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +4 -3
- package/dist/modules/Order/utils.js +54 -61
- package/dist/modules/Product/types.d.ts +22 -0
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -2
- package/dist/modules/ProductList/types.d.ts +2 -0
- package/dist/modules/Rules/index.d.ts +2 -9
- package/dist/modules/Rules/index.js +69 -43
- package/dist/modules/Rules/types.d.ts +10 -1
- package/dist/server/index.d.ts +55 -0
- package/dist/server/index.js +1173 -753
- package/dist/server/modules/order/index.d.ts +10 -4
- package/dist/server/modules/order/index.js +404 -399
- package/dist/server/modules/order/types.d.ts +4 -0
- package/dist/server/modules/products/index.d.ts +31 -8
- package/dist/server/modules/products/index.js +549 -390
- package/dist/server/modules/products/types.d.ts +18 -0
- package/dist/solution/BaseSales/index.d.ts +21 -1
- package/dist/solution/BaseSales/index.js +1136 -789
- package/dist/solution/BaseSales/types.d.ts +6 -1
- package/dist/solution/BaseSales/types.js +1 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +48 -81
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +6 -8
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +59 -25
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +20 -31
- package/dist/solution/ShopDiscount/index.js +15 -14
- package/dist/solution/VenueBooking/index.js +19 -30
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +149 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +583 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +13 -2
- 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 +0 -51
- 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 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +23 -2
- package/lib/modules/Discount/index.d.ts +5 -2
- package/lib/modules/Discount/index.js +23 -3
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +14 -2
- package/lib/modules/Order/index.js +326 -60
- package/lib/modules/Order/types.d.ts +16 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
- package/lib/modules/Order/utils.d.ts +4 -3
- package/lib/modules/Order/utils.js +22 -23
- package/lib/modules/Product/types.d.ts +22 -0
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +4 -2
- package/lib/modules/ProductList/types.d.ts +2 -0
- package/lib/modules/Rules/index.d.ts +2 -9
- package/lib/modules/Rules/index.js +61 -29
- package/lib/modules/Rules/types.d.ts +10 -1
- package/lib/server/index.d.ts +55 -0
- package/lib/server/index.js +332 -34
- package/lib/server/modules/order/index.d.ts +10 -4
- package/lib/server/modules/order/index.js +198 -139
- package/lib/server/modules/order/types.d.ts +4 -0
- package/lib/server/modules/products/index.d.ts +31 -8
- package/lib/server/modules/products/index.js +134 -35
- package/lib/server/modules/products/types.d.ts +18 -0
- package/lib/solution/BaseSales/index.d.ts +21 -1
- package/lib/solution/BaseSales/index.js +313 -72
- package/lib/solution/BaseSales/types.d.ts +6 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +29 -60
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -5
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +33 -8
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +0 -8
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/lib/solution/VenueBooking/index.js +0 -8
- package/package.json +1 -1
|
@@ -178,10 +178,6 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
178
178
|
try {
|
|
179
179
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
180
180
|
var config = _step2.value;
|
|
181
|
-
if (this.shouldSkipStrategyForProduct(product, config)) {
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
181
|
// 1. 先用 getProductMatchInfo 检查商品是否在策略的适用范围内(包含 bundle 子商品检查)
|
|
186
182
|
var matchInfo = this.getProductMatchInfo(product, config);
|
|
187
183
|
if (!matchInfo.isMatch) {
|
|
@@ -404,12 +400,6 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
404
400
|
if (_result.giftInfo) {
|
|
405
401
|
gifts.push(_result.giftInfo);
|
|
406
402
|
}
|
|
407
|
-
} else if (actionType === PROMOTION_ACTION_TYPES.ITEM_REWARD) {
|
|
408
|
-
// 商品奖励处理:条件商品触发,目标商品行享优惠,不自动新增商品
|
|
409
|
-
var _result2 = this.processItemReward(group, processedQuantityMap, products, matchedBundleIndexMap);
|
|
410
|
-
pricedProducts.push.apply(pricedProducts, _toConsumableArray(_result2.products));
|
|
411
|
-
totalOriginalAmount = totalOriginalAmount.plus(_result2.originalAmount);
|
|
412
|
-
totalFinalAmount = totalFinalAmount.plus(_result2.finalAmount);
|
|
413
403
|
}
|
|
414
404
|
}
|
|
415
405
|
|
|
@@ -540,9 +530,6 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
540
530
|
try {
|
|
541
531
|
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
542
532
|
var config = _step8.value;
|
|
543
|
-
if (_this3.shouldSkipStrategyForProduct(product, config)) {
|
|
544
|
-
continue;
|
|
545
|
-
}
|
|
546
533
|
var contextProduct = product;
|
|
547
534
|
if (!matchVariant) {
|
|
548
535
|
// 只匹配 product_id,忽略 product_variant_id
|
|
@@ -640,9 +627,6 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
640
627
|
} else if (actionType === 'X_ITEMS_FOR_Y_PRICE') {
|
|
641
628
|
var _detail = actionDetail;
|
|
642
629
|
requiredQuantity = _detail.x || 0;
|
|
643
|
-
} else if (actionType === 'ITEM_REWARD') {
|
|
644
|
-
var _detail2 = actionDetail;
|
|
645
|
-
requiredQuantity = _detail2.triggerQuantity || 1;
|
|
646
630
|
}
|
|
647
631
|
|
|
648
632
|
// 获取可参与商品列表
|
|
@@ -1120,248 +1104,6 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
1120
1104
|
};
|
|
1121
1105
|
}
|
|
1122
1106
|
|
|
1123
|
-
/**
|
|
1124
|
-
* 处理 商品奖励 促销
|
|
1125
|
-
*
|
|
1126
|
-
* 1. 使用 group.products 统计触发条件商品数量
|
|
1127
|
-
* 2. 按 quantityRule 计算最多奖励的目标商品数量
|
|
1128
|
-
* 3. 在全购物车商品中筛选 rewardTargets
|
|
1129
|
-
* 4. 按消费者最优(可节省金额从高到低)选择目标单位
|
|
1130
|
-
* 5. 对目标商品拆分并写入 finalPrice,触发商品本身不改价
|
|
1131
|
-
*/
|
|
1132
|
-
}, {
|
|
1133
|
-
key: "processItemReward",
|
|
1134
|
-
value: function processItemReward(group, processedQuantityMap, allProducts, matchedBundleIndexMap) {
|
|
1135
|
-
var _this4 = this;
|
|
1136
|
-
var strategyId = group.strategyId,
|
|
1137
|
-
strategyMetadata = group.strategyMetadata,
|
|
1138
|
-
actionDetail = group.actionDetail,
|
|
1139
|
-
triggerProducts = group.products;
|
|
1140
|
-
var detail = actionDetail;
|
|
1141
|
-
var triggerQuantity = this.normalizePositiveInteger(detail.triggerQuantity, 1);
|
|
1142
|
-
var rewardQuantity = this.normalizePositiveInteger(detail.rewardQuantity, 1);
|
|
1143
|
-
var conditionQuantity = this.getAvailablePromotionQuantity(triggerProducts, processedQuantityMap, matchedBundleIndexMap);
|
|
1144
|
-
if (conditionQuantity < triggerQuantity) {
|
|
1145
|
-
return {
|
|
1146
|
-
products: [],
|
|
1147
|
-
originalAmount: 0,
|
|
1148
|
-
finalAmount: 0
|
|
1149
|
-
};
|
|
1150
|
-
}
|
|
1151
|
-
var targetProducts = allProducts.filter(function (product) {
|
|
1152
|
-
return _this4.isProductMatch(product, detail.rewardTargets || []);
|
|
1153
|
-
});
|
|
1154
|
-
var targetUnitCandidates = this.buildItemRewardTargetUnits(targetProducts, processedQuantityMap, detail);
|
|
1155
|
-
if (targetUnitCandidates.length === 0) {
|
|
1156
|
-
return {
|
|
1157
|
-
products: [],
|
|
1158
|
-
originalAmount: 0,
|
|
1159
|
-
finalAmount: 0
|
|
1160
|
-
};
|
|
1161
|
-
}
|
|
1162
|
-
var rewardLimit = this.resolveItemRewardLimit(detail, conditionQuantity, triggerQuantity, rewardQuantity, targetUnitCandidates.length);
|
|
1163
|
-
if (rewardLimit <= 0) {
|
|
1164
|
-
return {
|
|
1165
|
-
products: [],
|
|
1166
|
-
originalAmount: 0,
|
|
1167
|
-
finalAmount: 0
|
|
1168
|
-
};
|
|
1169
|
-
}
|
|
1170
|
-
var selectedUnits = _toConsumableArray(targetUnitCandidates).sort(function (a, b) {
|
|
1171
|
-
var discountDiff = b.discountAmount.minus(a.discountAmount).toNumber();
|
|
1172
|
-
if (discountDiff !== 0) return discountDiff;
|
|
1173
|
-
return b.originalPrice.minus(a.originalPrice).toNumber();
|
|
1174
|
-
}).slice(0, rewardLimit);
|
|
1175
|
-
var selectedByProductId = new Map();
|
|
1176
|
-
var _iterator18 = _createForOfIteratorHelper(selectedUnits),
|
|
1177
|
-
_step18;
|
|
1178
|
-
try {
|
|
1179
|
-
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
1180
|
-
var unit = _step18.value;
|
|
1181
|
-
var existing = selectedByProductId.get(unit.product.id);
|
|
1182
|
-
if (existing) {
|
|
1183
|
-
existing.quantity += 1;
|
|
1184
|
-
} else {
|
|
1185
|
-
selectedByProductId.set(unit.product.id, {
|
|
1186
|
-
quantity: 1,
|
|
1187
|
-
finalPrice: unit.finalPrice,
|
|
1188
|
-
originalPrice: unit.originalPrice
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
} catch (err) {
|
|
1193
|
-
_iterator18.e(err);
|
|
1194
|
-
} finally {
|
|
1195
|
-
_iterator18.f();
|
|
1196
|
-
}
|
|
1197
|
-
var result = [];
|
|
1198
|
-
var originalAmount = new Decimal(0);
|
|
1199
|
-
var finalAmount = new Decimal(0);
|
|
1200
|
-
var _iterator19 = _createForOfIteratorHelper(targetProducts),
|
|
1201
|
-
_step19;
|
|
1202
|
-
try {
|
|
1203
|
-
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
1204
|
-
var product = _step19.value;
|
|
1205
|
-
var key = this.getProductKey(product);
|
|
1206
|
-
var processedQty = processedQuantityMap.get(key) || 0;
|
|
1207
|
-
var availableQty = product.quantity - processedQty;
|
|
1208
|
-
if (availableQty <= 0) continue;
|
|
1209
|
-
var selected = selectedByProductId.get(product.id);
|
|
1210
|
-
var selectedQty = (selected === null || selected === void 0 ? void 0 : selected.quantity) || 0;
|
|
1211
|
-
var remainingQty = availableQty - selectedQty;
|
|
1212
|
-
if (selectedQty <= 0) continue;
|
|
1213
|
-
if (selectedQty > 0) {
|
|
1214
|
-
result.push(_objectSpread(_objectSpread({}, product), {}, {
|
|
1215
|
-
id: selectedQty === availableQty ? product.id : this.generateRandomId(),
|
|
1216
|
-
originalId: product.id,
|
|
1217
|
-
quantity: selectedQty,
|
|
1218
|
-
finalPrice: this.formatPrice(selected.finalPrice),
|
|
1219
|
-
strategyId: strategyId,
|
|
1220
|
-
strategyMetadata: strategyMetadata,
|
|
1221
|
-
inPromotion: true,
|
|
1222
|
-
isSplit: selectedQty !== product.quantity
|
|
1223
|
-
}));
|
|
1224
|
-
originalAmount = originalAmount.plus(selected.originalPrice.mul(selectedQty));
|
|
1225
|
-
finalAmount = finalAmount.plus(selected.finalPrice.mul(selectedQty));
|
|
1226
|
-
}
|
|
1227
|
-
if (remainingQty > 0) {
|
|
1228
|
-
result.push(_objectSpread(_objectSpread({}, product), {}, {
|
|
1229
|
-
quantity: remainingQty,
|
|
1230
|
-
finalPrice: this.formatPrice(product.price),
|
|
1231
|
-
strategyId: undefined,
|
|
1232
|
-
strategyMetadata: undefined,
|
|
1233
|
-
inPromotion: false,
|
|
1234
|
-
isSplit: selectedQty > 0
|
|
1235
|
-
}));
|
|
1236
|
-
var remainingAmount = new Decimal(product.price).mul(remainingQty);
|
|
1237
|
-
originalAmount = originalAmount.plus(remainingAmount);
|
|
1238
|
-
finalAmount = finalAmount.plus(remainingAmount);
|
|
1239
|
-
}
|
|
1240
|
-
processedQuantityMap.set(key, processedQty + availableQty);
|
|
1241
|
-
}
|
|
1242
|
-
} catch (err) {
|
|
1243
|
-
_iterator19.e(err);
|
|
1244
|
-
} finally {
|
|
1245
|
-
_iterator19.f();
|
|
1246
|
-
}
|
|
1247
|
-
return {
|
|
1248
|
-
products: result,
|
|
1249
|
-
originalAmount: originalAmount.toNumber(),
|
|
1250
|
-
finalAmount: finalAmount.toNumber()
|
|
1251
|
-
};
|
|
1252
|
-
}
|
|
1253
|
-
}, {
|
|
1254
|
-
key: "normalizePositiveInteger",
|
|
1255
|
-
value: function normalizePositiveInteger(value, fallback) {
|
|
1256
|
-
var n = Math.floor(Number(value));
|
|
1257
|
-
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
1258
|
-
}
|
|
1259
|
-
}, {
|
|
1260
|
-
key: "getAvailablePromotionQuantity",
|
|
1261
|
-
value: function getAvailablePromotionQuantity(products, processedQuantityMap, matchedBundleIndexMap) {
|
|
1262
|
-
var total = 0;
|
|
1263
|
-
var _iterator20 = _createForOfIteratorHelper(products),
|
|
1264
|
-
_step20;
|
|
1265
|
-
try {
|
|
1266
|
-
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
|
|
1267
|
-
var product = _step20.value;
|
|
1268
|
-
var key = this.getProductKey(product);
|
|
1269
|
-
var processedQty = processedQuantityMap.get(key) || 0;
|
|
1270
|
-
var availableQty = product.quantity - processedQty;
|
|
1271
|
-
if (availableQty <= 0) continue;
|
|
1272
|
-
var matchedBundleIndex = matchedBundleIndexMap === null || matchedBundleIndexMap === void 0 ? void 0 : matchedBundleIndexMap.get(product.id);
|
|
1273
|
-
if (matchedBundleIndex !== undefined && product.bundle) {
|
|
1274
|
-
var bundleItem = product.bundle[matchedBundleIndex];
|
|
1275
|
-
total += availableQty * ((bundleItem === null || bundleItem === void 0 ? void 0 : bundleItem.quantity) || 1);
|
|
1276
|
-
} else {
|
|
1277
|
-
total += availableQty;
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
} catch (err) {
|
|
1281
|
-
_iterator20.e(err);
|
|
1282
|
-
} finally {
|
|
1283
|
-
_iterator20.f();
|
|
1284
|
-
}
|
|
1285
|
-
return total;
|
|
1286
|
-
}
|
|
1287
|
-
}, {
|
|
1288
|
-
key: "buildItemRewardTargetUnits",
|
|
1289
|
-
value: function buildItemRewardTargetUnits(products, processedQuantityMap, detail) {
|
|
1290
|
-
var units = [];
|
|
1291
|
-
var _iterator21 = _createForOfIteratorHelper(products),
|
|
1292
|
-
_step21;
|
|
1293
|
-
try {
|
|
1294
|
-
for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
|
|
1295
|
-
var product = _step21.value;
|
|
1296
|
-
var key = this.getProductKey(product);
|
|
1297
|
-
var processedQty = processedQuantityMap.get(key) || 0;
|
|
1298
|
-
var availableQty = product.quantity - processedQty;
|
|
1299
|
-
if (availableQty <= 0) continue;
|
|
1300
|
-
var originalPrice = new Decimal(product.price || 0);
|
|
1301
|
-
var finalPrice = this.resolveItemRewardFinalPrice(originalPrice, detail);
|
|
1302
|
-
var discountAmount = originalPrice.minus(finalPrice);
|
|
1303
|
-
if (discountAmount.lte(0)) continue;
|
|
1304
|
-
for (var i = 0; i < availableQty; i++) {
|
|
1305
|
-
units.push({
|
|
1306
|
-
product: product,
|
|
1307
|
-
originalPrice: originalPrice,
|
|
1308
|
-
finalPrice: finalPrice,
|
|
1309
|
-
discountAmount: discountAmount
|
|
1310
|
-
});
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
} catch (err) {
|
|
1314
|
-
_iterator21.e(err);
|
|
1315
|
-
} finally {
|
|
1316
|
-
_iterator21.f();
|
|
1317
|
-
}
|
|
1318
|
-
return units;
|
|
1319
|
-
}
|
|
1320
|
-
}, {
|
|
1321
|
-
key: "resolveItemRewardFinalPrice",
|
|
1322
|
-
value: function resolveItemRewardFinalPrice(originalPrice, detail) {
|
|
1323
|
-
var rewardValue = new Decimal(Number(detail.rewardValue) || 0);
|
|
1324
|
-
var finalPrice;
|
|
1325
|
-
switch (detail.rewardMethod) {
|
|
1326
|
-
case 'percent_off':
|
|
1327
|
-
{
|
|
1328
|
-
var percent = Decimal.min(100, Decimal.max(0, rewardValue));
|
|
1329
|
-
finalPrice = originalPrice.mul(new Decimal(100).minus(percent)).div(100);
|
|
1330
|
-
break;
|
|
1331
|
-
}
|
|
1332
|
-
case 'amount_off':
|
|
1333
|
-
finalPrice = originalPrice.minus(Decimal.max(0, rewardValue));
|
|
1334
|
-
break;
|
|
1335
|
-
case 'fixed_price':
|
|
1336
|
-
finalPrice = Decimal.max(0, rewardValue);
|
|
1337
|
-
break;
|
|
1338
|
-
case 'free':
|
|
1339
|
-
default:
|
|
1340
|
-
finalPrice = new Decimal(0);
|
|
1341
|
-
break;
|
|
1342
|
-
}
|
|
1343
|
-
return Decimal.max(0, Decimal.min(originalPrice, finalPrice)).toDecimalPlaces(2, Decimal.ROUND_HALF_UP);
|
|
1344
|
-
}
|
|
1345
|
-
}, {
|
|
1346
|
-
key: "resolveItemRewardLimit",
|
|
1347
|
-
value: function resolveItemRewardLimit(detail, conditionQuantity, triggerQuantity, rewardQuantity, targetUnitCount) {
|
|
1348
|
-
var _detail$maxRewardQuan;
|
|
1349
|
-
var limit = 0;
|
|
1350
|
-
switch (detail.quantityRule) {
|
|
1351
|
-
case 'all_targets':
|
|
1352
|
-
limit = targetUnitCount;
|
|
1353
|
-
break;
|
|
1354
|
-
case 'max_per_order':
|
|
1355
|
-
limit = this.normalizePositiveInteger((_detail$maxRewardQuan = detail.maxRewardQuantity) !== null && _detail$maxRewardQuan !== void 0 ? _detail$maxRewardQuan : detail.rewardQuantity, rewardQuantity);
|
|
1356
|
-
break;
|
|
1357
|
-
case 'per_condition_quantity':
|
|
1358
|
-
default:
|
|
1359
|
-
limit = Math.floor(conditionQuantity / triggerQuantity) * rewardQuantity;
|
|
1360
|
-
break;
|
|
1361
|
-
}
|
|
1362
|
-
return Math.min(Math.max(0, limit), targetUnitCount);
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
1107
|
/**
|
|
1366
1108
|
* 获取未参与任何促销的商品
|
|
1367
1109
|
*/
|
|
@@ -1369,11 +1111,11 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
1369
1111
|
key: "getRemainingProducts",
|
|
1370
1112
|
value: function getRemainingProducts(allProducts, processedQuantityMap) {
|
|
1371
1113
|
var result = [];
|
|
1372
|
-
var
|
|
1373
|
-
|
|
1114
|
+
var _iterator18 = _createForOfIteratorHelper(allProducts),
|
|
1115
|
+
_step18;
|
|
1374
1116
|
try {
|
|
1375
|
-
for (
|
|
1376
|
-
var product =
|
|
1117
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
1118
|
+
var product = _step18.value;
|
|
1377
1119
|
var key = this.getProductKey(product);
|
|
1378
1120
|
var processedQty = processedQuantityMap.get(key) || 0;
|
|
1379
1121
|
var remainingQty = product.quantity - processedQty;
|
|
@@ -1388,9 +1130,9 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
1388
1130
|
}
|
|
1389
1131
|
}
|
|
1390
1132
|
} catch (err) {
|
|
1391
|
-
|
|
1133
|
+
_iterator18.e(err);
|
|
1392
1134
|
} finally {
|
|
1393
|
-
|
|
1135
|
+
_iterator18.f();
|
|
1394
1136
|
}
|
|
1395
1137
|
return result;
|
|
1396
1138
|
}
|
|
@@ -1468,23 +1210,8 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
1468
1210
|
}, {
|
|
1469
1211
|
key: "isProductInStrategy",
|
|
1470
1212
|
value: function isProductInStrategy(product, config) {
|
|
1471
|
-
if (this.shouldSkipStrategyForProduct(product, config)) {
|
|
1472
|
-
return false;
|
|
1473
|
-
}
|
|
1474
1213
|
return this.getProductMatchInfo(product, config).isMatch;
|
|
1475
1214
|
}
|
|
1476
|
-
}, {
|
|
1477
|
-
key: "shouldSkipStrategyForProduct",
|
|
1478
|
-
value: function shouldSkipStrategyForProduct(product, config) {
|
|
1479
|
-
return Boolean(product._promotionOnlyForItemReward) && !this.hasActionType(config, PROMOTION_ACTION_TYPES.ITEM_REWARD);
|
|
1480
|
-
}
|
|
1481
|
-
}, {
|
|
1482
|
-
key: "hasActionType",
|
|
1483
|
-
value: function hasActionType(config, actionType) {
|
|
1484
|
-
return (config.actions || []).some(function (action) {
|
|
1485
|
-
return (action === null || action === void 0 ? void 0 : action.type) === actionType;
|
|
1486
|
-
});
|
|
1487
|
-
}
|
|
1488
1215
|
|
|
1489
1216
|
/**
|
|
1490
1217
|
* 查找商品匹配规则
|
|
@@ -136,89 +136,3 @@ export declare const BUY_X_GET_Y_FREE_STRATEGY: {
|
|
|
136
136
|
};
|
|
137
137
|
}[];
|
|
138
138
|
};
|
|
139
|
-
/**
|
|
140
|
-
* ITEM_REWARD 策略配置示例:儿童票触发婴儿票免费
|
|
141
|
-
*
|
|
142
|
-
* 业务规则:
|
|
143
|
-
* - 条件商品:儿童票(conditions.rules.productIdAndVariantId)
|
|
144
|
-
* - 奖励商品:购物车/订单内已经存在的婴儿票(actions[0].config.rewardTargets)
|
|
145
|
-
* - 本 action 不自动新增婴儿票;每次购物车变更后由统一促销链路重算
|
|
146
|
-
*
|
|
147
|
-
* 字段说明:
|
|
148
|
-
* - type: "ITEM_REWARD" 表示商品奖励 action
|
|
149
|
-
* - target: "product" 表示本期只奖励商品行
|
|
150
|
-
* - config.rewardTargets: 奖励对象数组,支持 { product_id, product_variant_id }
|
|
151
|
-
* - config.targetSelection: "consumer_best" 表示目标商品超额时选择节省金额最高的商品
|
|
152
|
-
* - value.rewardMethod:
|
|
153
|
-
* - "free": 目标商品最终价为 0
|
|
154
|
-
* - "percent_off": 百分比折扣,rewardValue 为 0-100
|
|
155
|
-
* - "amount_off": 每个目标商品固定减免 rewardValue
|
|
156
|
-
* - "fixed_price": 目标商品最终单价为 rewardValue
|
|
157
|
-
* - value.quantityRule:
|
|
158
|
-
* - "per_condition_quantity": 每满足 triggerQuantity 个条件商品,奖励 rewardQuantity 个目标商品
|
|
159
|
-
* - "all_targets": 满足条件后奖励全部目标商品
|
|
160
|
-
* - "max_per_order": 满足条件后每单最多奖励 maxRewardQuantity 个目标商品
|
|
161
|
-
*/
|
|
162
|
-
export declare const ITEM_REWARD_STRATEGY: {
|
|
163
|
-
metadata: {
|
|
164
|
-
id: string;
|
|
165
|
-
name: {
|
|
166
|
-
en: string;
|
|
167
|
-
'zh-CN': string;
|
|
168
|
-
'zh-HK': string;
|
|
169
|
-
};
|
|
170
|
-
type: string;
|
|
171
|
-
custom: {
|
|
172
|
-
display: {
|
|
173
|
-
product_card: {
|
|
174
|
-
text: {
|
|
175
|
-
en: string;
|
|
176
|
-
'zh-CN': string;
|
|
177
|
-
'zh-HK': string;
|
|
178
|
-
};
|
|
179
|
-
type: string;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
conditions: {
|
|
185
|
-
operator: string;
|
|
186
|
-
rules: ({
|
|
187
|
-
type: string;
|
|
188
|
-
field: string;
|
|
189
|
-
value: string;
|
|
190
|
-
operator: string;
|
|
191
|
-
} | {
|
|
192
|
-
type: string;
|
|
193
|
-
field: string;
|
|
194
|
-
value: {
|
|
195
|
-
product_id: number;
|
|
196
|
-
product_variant_id: number;
|
|
197
|
-
}[];
|
|
198
|
-
operator: string;
|
|
199
|
-
})[];
|
|
200
|
-
actionIds: string[];
|
|
201
|
-
};
|
|
202
|
-
actions: {
|
|
203
|
-
id: string;
|
|
204
|
-
type: string;
|
|
205
|
-
value: {
|
|
206
|
-
rewardMethod: string;
|
|
207
|
-
rewardValue: number;
|
|
208
|
-
quantityRule: string;
|
|
209
|
-
triggerQuantity: number;
|
|
210
|
-
rewardQuantity: number;
|
|
211
|
-
maxRewardQuantity: number;
|
|
212
|
-
};
|
|
213
|
-
valueType: string;
|
|
214
|
-
target: string;
|
|
215
|
-
priority: number;
|
|
216
|
-
config: {
|
|
217
|
-
rewardTargets: {
|
|
218
|
-
product_id: number;
|
|
219
|
-
product_variant_id: number;
|
|
220
|
-
}[];
|
|
221
|
-
targetSelection: string;
|
|
222
|
-
};
|
|
223
|
-
}[];
|
|
224
|
-
};
|
|
@@ -163,103 +163,4 @@ export var BUY_X_GET_Y_FREE_STRATEGY = {
|
|
|
163
163
|
}]
|
|
164
164
|
}
|
|
165
165
|
}]
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* ITEM_REWARD 策略配置示例:儿童票触发婴儿票免费
|
|
170
|
-
*
|
|
171
|
-
* 业务规则:
|
|
172
|
-
* - 条件商品:儿童票(conditions.rules.productIdAndVariantId)
|
|
173
|
-
* - 奖励商品:购物车/订单内已经存在的婴儿票(actions[0].config.rewardTargets)
|
|
174
|
-
* - 本 action 不自动新增婴儿票;每次购物车变更后由统一促销链路重算
|
|
175
|
-
*
|
|
176
|
-
* 字段说明:
|
|
177
|
-
* - type: "ITEM_REWARD" 表示商品奖励 action
|
|
178
|
-
* - target: "product" 表示本期只奖励商品行
|
|
179
|
-
* - config.rewardTargets: 奖励对象数组,支持 { product_id, product_variant_id }
|
|
180
|
-
* - config.targetSelection: "consumer_best" 表示目标商品超额时选择节省金额最高的商品
|
|
181
|
-
* - value.rewardMethod:
|
|
182
|
-
* - "free": 目标商品最终价为 0
|
|
183
|
-
* - "percent_off": 百分比折扣,rewardValue 为 0-100
|
|
184
|
-
* - "amount_off": 每个目标商品固定减免 rewardValue
|
|
185
|
-
* - "fixed_price": 目标商品最终单价为 rewardValue
|
|
186
|
-
* - value.quantityRule:
|
|
187
|
-
* - "per_condition_quantity": 每满足 triggerQuantity 个条件商品,奖励 rewardQuantity 个目标商品
|
|
188
|
-
* - "all_targets": 满足条件后奖励全部目标商品
|
|
189
|
-
* - "max_per_order": 满足条件后每单最多奖励 maxRewardQuantity 个目标商品
|
|
190
|
-
*/
|
|
191
|
-
export var ITEM_REWARD_STRATEGY = {
|
|
192
|
-
metadata: {
|
|
193
|
-
id: 'STRATEGY_003',
|
|
194
|
-
name: {
|
|
195
|
-
en: 'Infant ticket free with child ticket',
|
|
196
|
-
'zh-CN': '儿童票触发婴儿票免费',
|
|
197
|
-
'zh-HK': '兒童票觸發嬰兒票免費'
|
|
198
|
-
},
|
|
199
|
-
type: 'promotion',
|
|
200
|
-
custom: {
|
|
201
|
-
display: {
|
|
202
|
-
product_card: {
|
|
203
|
-
text: {
|
|
204
|
-
en: 'Infant ticket free',
|
|
205
|
-
'zh-CN': '婴儿票免费',
|
|
206
|
-
'zh-HK': '嬰兒票免費'
|
|
207
|
-
},
|
|
208
|
-
type: 'tag'
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
conditions: {
|
|
214
|
-
operator: 'and',
|
|
215
|
-
rules: [{
|
|
216
|
-
type: 'operator',
|
|
217
|
-
field: 'currentDateTime',
|
|
218
|
-
value: '2023-01-01 00:00:00',
|
|
219
|
-
operator: '>='
|
|
220
|
-
}, {
|
|
221
|
-
type: 'operator',
|
|
222
|
-
field: 'currentDateTime',
|
|
223
|
-
value: '2030-01-01 00:00:00',
|
|
224
|
-
operator: '<='
|
|
225
|
-
}, {
|
|
226
|
-
type: 'operator',
|
|
227
|
-
field: 'productIdAndVariantId',
|
|
228
|
-
value: [{
|
|
229
|
-
product_id: 1001,
|
|
230
|
-
// 条件商品:儿童票
|
|
231
|
-
product_variant_id: 0 // 0 = 匹配任意变体
|
|
232
|
-
}],
|
|
233
|
-
operator: 'product_match'
|
|
234
|
-
}],
|
|
235
|
-
actionIds: ['1']
|
|
236
|
-
},
|
|
237
|
-
actions: [{
|
|
238
|
-
id: '1',
|
|
239
|
-
type: 'ITEM_REWARD',
|
|
240
|
-
value: {
|
|
241
|
-
rewardMethod: 'free',
|
|
242
|
-
// free | percent_off | amount_off | fixed_price
|
|
243
|
-
rewardValue: 0,
|
|
244
|
-
// free 可省略;其他 rewardMethod 使用
|
|
245
|
-
quantityRule: 'per_condition_quantity',
|
|
246
|
-
// per_condition_quantity | all_targets | max_per_order
|
|
247
|
-
triggerQuantity: 1,
|
|
248
|
-
// N:每满足 N 个条件商品
|
|
249
|
-
rewardQuantity: 1,
|
|
250
|
-
// Y:奖励 Y 个目标商品
|
|
251
|
-
maxRewardQuantity: 1 // max_per_order 使用;本例保留为配置示意
|
|
252
|
-
},
|
|
253
|
-
valueType: 'object',
|
|
254
|
-
target: 'product',
|
|
255
|
-
priority: 1,
|
|
256
|
-
config: {
|
|
257
|
-
rewardTargets: [{
|
|
258
|
-
product_id: 2001,
|
|
259
|
-
// 奖励对象:婴儿票
|
|
260
|
-
product_variant_id: 0 // 0 = 匹配任意变体
|
|
261
|
-
}],
|
|
262
|
-
targetSelection: 'consumer_best' // consumer_best = 按可节省金额从高到低选择
|
|
263
|
-
}
|
|
264
|
-
}]
|
|
265
166
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { PromotionEvaluator } from './evaluator';
|
|
2
2
|
export { PromotionAdapter } from './adapter';
|
|
3
3
|
export { default } from './adapter';
|
|
4
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY,
|
|
4
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, } from './examples';
|
|
@@ -6,4 +6,4 @@ export { PromotionAdapter } from "./adapter";
|
|
|
6
6
|
export { default } from "./adapter";
|
|
7
7
|
|
|
8
8
|
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -12,8 +12,6 @@ export declare const PROMOTION_ACTION_TYPES: {
|
|
|
12
12
|
readonly X_ITEMS_FOR_Y_PRICE: "X_ITEMS_FOR_Y_PRICE";
|
|
13
13
|
/** 买X送Y(买X件送Y件,可累计) */
|
|
14
14
|
readonly BUY_X_GET_Y_FREE: "BUY_X_GET_Y_FREE";
|
|
15
|
-
/** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
|
|
16
|
-
readonly ITEM_REWARD: "ITEM_REWARD";
|
|
17
15
|
/** 固定折扣 */
|
|
18
16
|
readonly DISCOUNT_RATE: "DISCOUNT_RATE";
|
|
19
17
|
/** 固定减价 */
|
|
@@ -68,59 +66,6 @@ export interface BuyXGetYFreeConfig {
|
|
|
68
66
|
/** 可选的赠品列表 */
|
|
69
67
|
giftProducts?: ProductIdentifier[];
|
|
70
68
|
}
|
|
71
|
-
/**
|
|
72
|
-
* 商品奖励优惠方式
|
|
73
|
-
*
|
|
74
|
-
* - free: 目标商品最终价为 0
|
|
75
|
-
* - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
|
|
76
|
-
* - amount_off: 每个目标商品固定减免 rewardValue
|
|
77
|
-
* - fixed_price: 目标商品改为固定价 rewardValue
|
|
78
|
-
*/
|
|
79
|
-
export type ItemRewardMethod = 'free' | 'percent_off' | 'amount_off' | 'fixed_price';
|
|
80
|
-
/**
|
|
81
|
-
* 商品奖励数量规则
|
|
82
|
-
*
|
|
83
|
-
* - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
|
|
84
|
-
* - all_targets: 满足条件后奖励全部目标商品
|
|
85
|
-
* - max_per_order: 满足条件后每单最多奖励固定数量目标商品
|
|
86
|
-
*/
|
|
87
|
-
export type ItemRewardQuantityRule = 'per_condition_quantity' | 'all_targets' | 'max_per_order';
|
|
88
|
-
/** 商品奖励目标选择规则 */
|
|
89
|
-
export type ItemRewardTargetSelection = 'consumer_best';
|
|
90
|
-
/**
|
|
91
|
-
* 商品奖励 - Action Value
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* value: {
|
|
95
|
-
* rewardMethod: 'free',
|
|
96
|
-
* quantityRule: 'per_condition_quantity',
|
|
97
|
-
* triggerQuantity: 1,
|
|
98
|
-
* rewardQuantity: 1,
|
|
99
|
-
* }
|
|
100
|
-
*/
|
|
101
|
-
export interface ItemRewardValue {
|
|
102
|
-
/** 奖励方式 */
|
|
103
|
-
rewardMethod: ItemRewardMethod;
|
|
104
|
-
/** 奖励值:percent_off/amount_off/fixed_price 使用,free 可省略 */
|
|
105
|
-
rewardValue?: number;
|
|
106
|
-
/** 奖励数量规则 */
|
|
107
|
-
quantityRule: ItemRewardQuantityRule;
|
|
108
|
-
/** 每满足 N 个条件商品;默认 1 */
|
|
109
|
-
triggerQuantity?: number;
|
|
110
|
-
/** 奖励 Y 个目标商品;默认 1 */
|
|
111
|
-
rewardQuantity?: number;
|
|
112
|
-
/** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
|
|
113
|
-
maxRewardQuantity?: number;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* 商品奖励 - Action Config
|
|
117
|
-
*/
|
|
118
|
-
export interface ItemRewardConfig {
|
|
119
|
-
/** 奖励对象,本期支持指定商品/变体;product_variant_id=0 表示任意变体 */
|
|
120
|
-
rewardTargets?: ProductIdentifier[];
|
|
121
|
-
/** 目标商品超额时的选择规则;本期支持 consumer_best */
|
|
122
|
-
targetSelection?: ItemRewardTargetSelection;
|
|
123
|
-
}
|
|
124
69
|
/**
|
|
125
70
|
* 商品标识
|
|
126
71
|
*
|
|
@@ -157,19 +102,10 @@ export interface BuyXGetYFreeAction extends Omit<ActionEffect, 'type' | 'value'
|
|
|
157
102
|
valueType: 'object';
|
|
158
103
|
config?: BuyXGetYFreeConfig;
|
|
159
104
|
}
|
|
160
|
-
/**
|
|
161
|
-
* 商品奖励 Action
|
|
162
|
-
*/
|
|
163
|
-
export interface ItemRewardAction extends Omit<ActionEffect, 'type' | 'value' | 'config'> {
|
|
164
|
-
type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
|
|
165
|
-
value: ItemRewardValue;
|
|
166
|
-
valueType: 'object';
|
|
167
|
-
config?: ItemRewardConfig;
|
|
168
|
-
}
|
|
169
105
|
/**
|
|
170
106
|
* 促销活动 Action 联合类型
|
|
171
107
|
*/
|
|
172
|
-
export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction
|
|
108
|
+
export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction;
|
|
173
109
|
/**
|
|
174
110
|
* 促销相关运算符
|
|
175
111
|
*/
|
|
@@ -234,8 +170,6 @@ export interface PromotionProduct {
|
|
|
234
170
|
quantity: number;
|
|
235
171
|
/** 原价 */
|
|
236
172
|
original_price?: number;
|
|
237
|
-
/** 内部字段:编辑态订单行只允许参与 ITEM_REWARD,避免旧促销误算历史行 */
|
|
238
|
-
_promotionOnlyForItemReward?: boolean;
|
|
239
173
|
}
|
|
240
174
|
/**
|
|
241
175
|
* 促销活动适配器转换结果
|
|
@@ -261,7 +195,7 @@ export interface PromotionTransformResult {
|
|
|
261
195
|
/**
|
|
262
196
|
* Action 详情联合类型
|
|
263
197
|
*/
|
|
264
|
-
export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail
|
|
198
|
+
export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail;
|
|
265
199
|
/**
|
|
266
200
|
* X件Y元 Action 详情
|
|
267
201
|
*/
|
|
@@ -292,28 +226,6 @@ export interface BuyXGetYFreeActionDetail {
|
|
|
292
226
|
/** 可选的赠品列表 */
|
|
293
227
|
giftProducts: ProductIdentifier[];
|
|
294
228
|
}
|
|
295
|
-
/**
|
|
296
|
-
* 商品奖励 Action 详情
|
|
297
|
-
*/
|
|
298
|
-
export interface ItemRewardActionDetail {
|
|
299
|
-
type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
|
|
300
|
-
/** 奖励方式 */
|
|
301
|
-
rewardMethod: ItemRewardMethod;
|
|
302
|
-
/** 奖励值:percent_off/amount_off/fixed_price 使用,free 为 0 */
|
|
303
|
-
rewardValue: number;
|
|
304
|
-
/** 奖励数量规则 */
|
|
305
|
-
quantityRule: ItemRewardQuantityRule;
|
|
306
|
-
/** 每满足 N 个条件商品;默认 1 */
|
|
307
|
-
triggerQuantity: number;
|
|
308
|
-
/** 奖励 Y 个目标商品;默认 1 */
|
|
309
|
-
rewardQuantity: number;
|
|
310
|
-
/** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
|
|
311
|
-
maxRewardQuantity?: number;
|
|
312
|
-
/** 奖励对象,本期支持指定商品/变体 */
|
|
313
|
-
rewardTargets: ProductIdentifier[];
|
|
314
|
-
/** 目标商品超额时的选择规则 */
|
|
315
|
-
targetSelection: ItemRewardTargetSelection;
|
|
316
|
-
}
|
|
317
229
|
/**
|
|
318
230
|
* X件Y元 - 业务层计算结果
|
|
319
231
|
*
|