@pisell/private-materials 6.6.50 → 6.6.52
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/booking/components/footer/amount.d.ts +1 -0
- package/es/components/booking/components/footer/amount.js +9 -0
- package/es/components/booking/components/footer/utils.js +4 -0
- package/es/components/ticketBooking/utils/index.js +3 -1
- package/lib/components/booking/components/footer/amount.d.ts +1 -0
- package/lib/components/booking/components/footer/amount.js +11 -0
- package/lib/components/booking/components/footer/utils.js +4 -0
- package/lib/components/ticketBooking/utils/index.js +3 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const getRelationDetailsTotal: (relation_details: any) => number;
|
|
2
2
|
export declare const getProductDiscountProductDiscountDifference: (product: any) => any;
|
|
3
|
+
export declare const getOptionDiscountAmount: (discounts: any[]) => number;
|
|
3
4
|
export declare const getIsPriceIncludeTax: (state: any) => any;
|
|
4
5
|
/**
|
|
5
6
|
* 总金额
|
|
@@ -807,6 +807,12 @@ var getDiscountAmount = function getDiscountAmount(discounts) {
|
|
|
807
807
|
return total.add(new Decimal(discount.amount || 0));
|
|
808
808
|
}, new Decimal(0)).toNumber();
|
|
809
809
|
};
|
|
810
|
+
export var getOptionDiscountAmount = function getOptionDiscountAmount(discounts) {
|
|
811
|
+
return (discounts || []).reduce(function (total, discount) {
|
|
812
|
+
var _discount$metadata;
|
|
813
|
+
return total.add(new Decimal((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.optionDiscountAmount) || 0));
|
|
814
|
+
}, new Decimal(0)).toNumber();
|
|
815
|
+
};
|
|
810
816
|
|
|
811
817
|
/**
|
|
812
818
|
* 获取主商品加价减价后的总价 (主商品价格 + 子商品加价减价)
|
|
@@ -821,6 +827,9 @@ var getMainProductTotal = function getMainProductTotal(item) {
|
|
|
821
827
|
total = total.add((_item$_extend$other5 = item._extend.other) === null || _item$_extend$other5 === void 0 ? void 0 : _item$_extend$other5.option.reduce(function (t, option) {
|
|
822
828
|
return t.add(new Decimal(option.price || 0).mul(option.num || 1));
|
|
823
829
|
}, new Decimal(0)));
|
|
830
|
+
if (item.booking_id) {
|
|
831
|
+
total = total.sub(getOptionDiscountAmount((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
832
|
+
}
|
|
824
833
|
}
|
|
825
834
|
var _iterator13 = _createForOfIteratorHelper(((_item$_extend$other6 = item._extend.other) === null || _item$_extend$other6 === void 0 ? void 0 : _item$_extend$other6.bundle) || []),
|
|
826
835
|
_step13;
|
|
@@ -22,6 +22,7 @@ import { PisellToast } from '@pisell/materials';
|
|
|
22
22
|
import { getClientName } from "../../../../plus/clientName/utils";
|
|
23
23
|
import { cloneDeep } from 'lodash';
|
|
24
24
|
import Decimal from 'decimal.js';
|
|
25
|
+
import { getOptionDiscountAmount } from "./amount";
|
|
25
26
|
var formatNote = function formatNote(data) {
|
|
26
27
|
var _data$notes;
|
|
27
28
|
return ((_data$notes = data.notes) === null || _data$notes === void 0 ? void 0 : _data$notes.orderNote) || '';
|
|
@@ -462,6 +463,9 @@ export var getMainProductSellingPrice = function getMainProductSellingPrice(item
|
|
|
462
463
|
var currentNum = new Decimal(currentValue.num || 0);
|
|
463
464
|
return accumulator.add(currentPrice.mul(currentNum));
|
|
464
465
|
}, optionPrice);
|
|
466
|
+
if (item !== null && item !== void 0 && item.booking_id) {
|
|
467
|
+
optionPrice = optionPrice.sub(getOptionDiscountAmount((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
468
|
+
}
|
|
465
469
|
}
|
|
466
470
|
return new Decimal((_item$_extend35 = item._extend) === null || _item$_extend35 === void 0 ? void 0 : _item$_extend35.main_product_selling_price).add(optionPrice).toNumber();
|
|
467
471
|
};
|
|
@@ -413,8 +413,10 @@ export var rulesHooks = {
|
|
|
413
413
|
_id: values._id || product._id,
|
|
414
414
|
discount_list: values.discount_list,
|
|
415
415
|
_extend: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, product._extend), {}, {
|
|
416
|
-
other: _objectSpread(_objectSpread({}, product._extend.other), 'bundle' in values ? {
|
|
416
|
+
other: _objectSpread(_objectSpread(_objectSpread({}, product._extend.other), 'bundle' in values ? {
|
|
417
417
|
bundle: values.bundle
|
|
418
|
+
} : {}), Array.isArray(values.options) ? {
|
|
419
|
+
option: values.options
|
|
418
420
|
} : {})
|
|
419
421
|
}, 'total' in values ? {
|
|
420
422
|
total: values.total
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const getRelationDetailsTotal: (relation_details: any) => number;
|
|
2
2
|
export declare const getProductDiscountProductDiscountDifference: (product: any) => any;
|
|
3
|
+
export declare const getOptionDiscountAmount: (discounts: any[]) => number;
|
|
3
4
|
export declare const getIsPriceIncludeTax: (state: any) => any;
|
|
4
5
|
/**
|
|
5
6
|
* 总金额
|
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var amount_exports = {};
|
|
31
31
|
__export(amount_exports, {
|
|
32
32
|
getIsPriceIncludeTax: () => getIsPriceIncludeTax,
|
|
33
|
+
getOptionDiscountAmount: () => getOptionDiscountAmount,
|
|
33
34
|
getProductDiscountProductDiscountDifference: () => getProductDiscountProductDiscountDifference,
|
|
34
35
|
getRelationDetailsTotal: () => getRelationDetailsTotal,
|
|
35
36
|
getSumTotal: () => getSumTotal
|
|
@@ -486,6 +487,12 @@ var getDiscountAmount = (discounts) => {
|
|
|
486
487
|
return total.add(new import_decimal.default(discount.amount || 0));
|
|
487
488
|
}, new import_decimal.default(0)).toNumber();
|
|
488
489
|
};
|
|
490
|
+
var getOptionDiscountAmount = (discounts) => {
|
|
491
|
+
return (discounts || []).reduce((total, discount) => {
|
|
492
|
+
var _a;
|
|
493
|
+
return total.add(new import_decimal.default(((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.optionDiscountAmount) || 0));
|
|
494
|
+
}, new import_decimal.default(0)).toNumber();
|
|
495
|
+
};
|
|
489
496
|
var getMainProductTotal = (item) => {
|
|
490
497
|
var _a, _b, _c, _d, _e, _f;
|
|
491
498
|
let total = new import_decimal.default(((_a = item._extend) == null ? void 0 : _a.main_product_selling_price) ?? ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.main_product_selling_price) ?? item._extend.price ?? 0);
|
|
@@ -493,6 +500,9 @@ var getMainProductTotal = (item) => {
|
|
|
493
500
|
total = total.add((_e = item._extend.other) == null ? void 0 : _e.option.reduce((t, option) => {
|
|
494
501
|
return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
|
|
495
502
|
}, new import_decimal.default(0)));
|
|
503
|
+
if (item.booking_id) {
|
|
504
|
+
total = total.sub(getOptionDiscountAmount((item == null ? void 0 : item.discount_list) || []));
|
|
505
|
+
}
|
|
496
506
|
}
|
|
497
507
|
for (let bundleItem of ((_f = item._extend.other) == null ? void 0 : _f.bundle) || []) {
|
|
498
508
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
@@ -922,6 +932,7 @@ var getSumTotal = (state, options) => {
|
|
|
922
932
|
// Annotate the CommonJS export names for ESM import in node:
|
|
923
933
|
0 && (module.exports = {
|
|
924
934
|
getIsPriceIncludeTax,
|
|
935
|
+
getOptionDiscountAmount,
|
|
925
936
|
getProductDiscountProductDiscountDifference,
|
|
926
937
|
getRelationDetailsTotal,
|
|
927
938
|
getSumTotal
|
|
@@ -56,6 +56,7 @@ var import_materials = require("@pisell/materials");
|
|
|
56
56
|
var import_utils6 = require("../../../../plus/clientName/utils");
|
|
57
57
|
var import_lodash = require("lodash");
|
|
58
58
|
var import_decimal = __toESM(require("decimal.js"));
|
|
59
|
+
var import_amount = require("./amount");
|
|
59
60
|
var formatNote = (data) => {
|
|
60
61
|
var _a;
|
|
61
62
|
return ((_a = data.notes) == null ? void 0 : _a.orderNote) || "";
|
|
@@ -364,6 +365,9 @@ var getMainProductSellingPrice = (item) => {
|
|
|
364
365
|
const currentNum = new import_decimal.default(currentValue.num || 0);
|
|
365
366
|
return accumulator.add(currentPrice.mul(currentNum));
|
|
366
367
|
}, optionPrice);
|
|
368
|
+
if (item == null ? void 0 : item.booking_id) {
|
|
369
|
+
optionPrice = optionPrice.sub((0, import_amount.getOptionDiscountAmount)((item == null ? void 0 : item.discount_list) || []));
|
|
370
|
+
}
|
|
367
371
|
}
|
|
368
372
|
return new import_decimal.default((_f = item._extend) == null ? void 0 : _f.main_product_selling_price).add(optionPrice).toNumber();
|
|
369
373
|
};
|
|
@@ -382,7 +382,9 @@ var rulesHooks = {
|
|
|
382
382
|
...product._extend,
|
|
383
383
|
other: {
|
|
384
384
|
...product._extend.other,
|
|
385
|
-
..."bundle" in values ? { bundle: values.bundle } : {}
|
|
385
|
+
..."bundle" in values ? { bundle: values.bundle } : {},
|
|
386
|
+
// 仅在有有效数组时写入,避免 `options: undefined` 清空 other.option
|
|
387
|
+
...Array.isArray(values.options) ? { option: values.options } : {}
|
|
386
388
|
},
|
|
387
389
|
..."total" in values ? { total: values.total } : {},
|
|
388
390
|
..."main_product_selling_price" in values ? { main_product_selling_price: values.main_product_selling_price } : {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.52",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"styled-components": "^6.0.0-rc.3",
|
|
62
62
|
"@react-spring/web": "^9.6.1",
|
|
63
63
|
"@use-gesture/react": "^10.3.1",
|
|
64
|
+
"@pisell/icon": "0.0.11",
|
|
64
65
|
"@pisell/utils": "3.0.2",
|
|
65
66
|
"@pisell/materials": "6.6.14",
|
|
66
|
-
"@pisell/icon": "0.0.11",
|
|
67
67
|
"@pisell/date-picker": "3.0.7"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|