@pisell/pisellos 0.0.563 → 0.0.567
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.
|
@@ -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 } from "./examples";
|
|
@@ -271,7 +271,8 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
|
|
|
271
271
|
|
|
272
272
|
// --- 主商品折后税费 ---
|
|
273
273
|
var mainTotal = getMainProductPaymentTotal(product);
|
|
274
|
-
var
|
|
274
|
+
var surchargeRoundingRemainder = toDecimal(product.surcharge_rounding_remainder);
|
|
275
|
+
var surchargeFee = toDecimal(product.surcharge_fee).plus(quantity.gt(0) ? surchargeRoundingRemainder.div(quantity) : 0);
|
|
275
276
|
var mainTaxableBase = mainTotal.lte(0) ? surchargeFee : mainTotal.plus(surchargeFee);
|
|
276
277
|
var mainTaxPrecise = calculateSingleItemTax({
|
|
277
278
|
price: mainTaxableBase,
|
|
@@ -440,8 +441,9 @@ export function calculateSalesSummary(params) {
|
|
|
440
441
|
isEdit: false
|
|
441
442
|
}) || 0);
|
|
442
443
|
for (var i = 0; i < products.length; i++) {
|
|
443
|
-
var _surchargeServiceItem;
|
|
444
|
+
var _surchargeServiceItem, _surchargeServiceItem2;
|
|
444
445
|
products[i].surcharge_fee = ((_surchargeServiceItem = surchargeServiceItems[i]) === null || _surchargeServiceItem === void 0 ? void 0 : _surchargeServiceItem.surcharge_fee) || 0;
|
|
446
|
+
products[i].surcharge_rounding_remainder = ((_surchargeServiceItem2 = surchargeServiceItems[i]) === null || _surchargeServiceItem2 === void 0 ? void 0 : _surchargeServiceItem2.surcharge_rounding_remainder) || 0;
|
|
445
447
|
}
|
|
446
448
|
var hasTaxRate = taxRate !== undefined && taxRate !== null && taxRate > 0;
|
|
447
449
|
var productTaxFee;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
+
var promotion_exports = {};
|
|
31
|
+
__export(promotion_exports, {
|
|
32
|
+
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
+
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
+
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
+
default: () => import_adapter2.default
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
+
var import_evaluator = require("./evaluator");
|
|
40
|
+
var import_adapter = require("./adapter");
|
|
41
|
+
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
+
var import_examples = require("./examples");
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
+
PromotionAdapter,
|
|
47
|
+
PromotionEvaluator,
|
|
48
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
+
});
|
|
@@ -227,7 +227,8 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
|
|
|
227
227
|
for (const product of products) {
|
|
228
228
|
const quantity = new import_decimal.default(getSafeNum(product.num));
|
|
229
229
|
const mainTotal = getMainProductPaymentTotal(product);
|
|
230
|
-
const
|
|
230
|
+
const surchargeRoundingRemainder = toDecimal(product.surcharge_rounding_remainder);
|
|
231
|
+
const surchargeFee = toDecimal(product.surcharge_fee).plus(quantity.gt(0) ? surchargeRoundingRemainder.div(quantity) : 0);
|
|
231
232
|
const mainTaxableBase = mainTotal.lte(0) ? surchargeFee : mainTotal.plus(surchargeFee);
|
|
232
233
|
const mainTaxPrecise = calculateSingleItemTax({
|
|
233
234
|
price: mainTaxableBase,
|
|
@@ -329,7 +330,7 @@ function createEmptySalesSummary() {
|
|
|
329
330
|
};
|
|
330
331
|
}
|
|
331
332
|
function calculateSalesSummary(params) {
|
|
332
|
-
var _a;
|
|
333
|
+
var _a, _b;
|
|
333
334
|
const {
|
|
334
335
|
products,
|
|
335
336
|
isPriceIncludeTax,
|
|
@@ -376,6 +377,7 @@ function calculateSalesSummary(params) {
|
|
|
376
377
|
);
|
|
377
378
|
for (let i = 0; i < products.length; i++) {
|
|
378
379
|
products[i].surcharge_fee = ((_a = surchargeServiceItems[i]) == null ? void 0 : _a.surcharge_fee) || 0;
|
|
380
|
+
products[i].surcharge_rounding_remainder = ((_b = surchargeServiceItems[i]) == null ? void 0 : _b.surcharge_rounding_remainder) || 0;
|
|
379
381
|
}
|
|
380
382
|
const hasTaxRate = taxRate !== void 0 && taxRate !== null && taxRate > 0;
|
|
381
383
|
let productTaxFee;
|