@freedom_sky/feige-lib 4.55.0 → 4.55.1
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/index.js +7 -2
- package/package.json +1 -1
- package/src/index.ts +8 -1
package/dist/index.js
CHANGED
|
@@ -169,7 +169,7 @@ exports.getOrderedCountByDishId = getOrderedCountByDishId;
|
|
|
169
169
|
*/
|
|
170
170
|
function calcReceivablePrice(order, processArr, noTax) {
|
|
171
171
|
if (noTax === void 0) { noTax = false; }
|
|
172
|
-
var _a;
|
|
172
|
+
var _a, _b;
|
|
173
173
|
var totalDiscountPrice = 0;
|
|
174
174
|
var resultProcessArr = [];
|
|
175
175
|
var totalPrice = calcTotalPrice(order);
|
|
@@ -265,7 +265,12 @@ function calcReceivablePrice(order, processArr, noTax) {
|
|
|
265
265
|
});
|
|
266
266
|
// buffet price
|
|
267
267
|
if (order.type === order_enum_1.OrderTypeEnum.Buffet) {
|
|
268
|
-
var
|
|
268
|
+
var discountValue = (_a = sortedProcessArr.find(function (process) { return process.type === const_1.CONST.RECEIVABLE_PROCESSING_TYPE.DISCOUNT.TYPE; })) === null || _a === void 0 ? void 0 : _a.value;
|
|
269
|
+
var buffetTotalPrice_1 = index_1.calcBuffetTotalPrice((_b = order.buffet) === null || _b === void 0 ? void 0 : _b.snapshot, order.adultNum, order.childNum);
|
|
270
|
+
if (discountValue) {
|
|
271
|
+
var rate = -(10 - discountValue) / 10;
|
|
272
|
+
buffetTotalPrice_1 += buffetTotalPrice_1 * rate;
|
|
273
|
+
}
|
|
269
274
|
var sharedMarkDown_1 = (totalMarkDown * buffetTotalPrice_1) / receivablePriceAfterDiscount;
|
|
270
275
|
order.buffet.taxes.forEach(function (tax) {
|
|
271
276
|
var taxFare = (buffetTotalPrice_1 - sharedMarkDown_1) * tax.rate;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -306,7 +306,14 @@ export function calcReceivablePrice(
|
|
|
306
306
|
});
|
|
307
307
|
// buffet price
|
|
308
308
|
if (order.type === OrderTypeEnum.Buffet) {
|
|
309
|
-
const
|
|
309
|
+
const discountValue = sortedProcessArr.find(
|
|
310
|
+
(process) => process.type === CONST.RECEIVABLE_PROCESSING_TYPE.DISCOUNT.TYPE,
|
|
311
|
+
)?.value;
|
|
312
|
+
let buffetTotalPrice = calcBuffetTotalPrice(order.buffet?.snapshot, order.adultNum, order.childNum);
|
|
313
|
+
if (discountValue) {
|
|
314
|
+
const rate = -(10 - discountValue) / 10;
|
|
315
|
+
buffetTotalPrice += buffetTotalPrice * rate;
|
|
316
|
+
}
|
|
310
317
|
const sharedMarkDown = (totalMarkDown * buffetTotalPrice) / receivablePriceAfterDiscount;
|
|
311
318
|
order.buffet.taxes.forEach((tax) => {
|
|
312
319
|
const taxFare = (buffetTotalPrice - sharedMarkDown) * tax.rate;
|