@freedom_sky/feige-lib 4.51.3 → 4.51.5
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 +9 -3
- package/package.json +1 -1
- package/src/index.ts +7 -2
package/dist/index.js
CHANGED
|
@@ -169,13 +169,19 @@ function calcReceivablePrice(order, processArr, noTax) {
|
|
|
169
169
|
var rate_1 = -(10 - process.value) / 10;
|
|
170
170
|
var volume_1 = 0;
|
|
171
171
|
order.content.forEach(function (orderContentItem) {
|
|
172
|
+
var _a;
|
|
172
173
|
if (orderContentItem.dishSnapshot.noFullOrderDiscount) {
|
|
173
174
|
return;
|
|
174
175
|
}
|
|
175
|
-
var dishTotalPrice = orderContentItem
|
|
176
|
+
var dishTotalPrice = calcContentPrice({ orderContentItem: orderContentItem, buffetItem: (_a = order.buffet) === null || _a === void 0 ? void 0 : _a.snapshot, orderType: order.type, adultNum: order.adultNum, childNum: order.childNum, contents: order.content });
|
|
176
177
|
totalDiscountPrice += dishTotalPrice;
|
|
177
178
|
volume_1 += dishTotalPrice * rate_1;
|
|
178
179
|
});
|
|
180
|
+
if (order.type === order_enum_1.OrderTypeEnum.Buffet) {
|
|
181
|
+
var buffetTotalPrice = index_1.calcBuffetTotalPrice(order.buffet.snapshot, order.adultNum, order.childNum);
|
|
182
|
+
totalDiscountPrice += buffetTotalPrice;
|
|
183
|
+
volume_1 += buffetTotalPrice * rate_1;
|
|
184
|
+
}
|
|
179
185
|
resultProcessArr.push({
|
|
180
186
|
type: process.type,
|
|
181
187
|
value: process.value,
|
|
@@ -210,12 +216,12 @@ function calcReceivablePrice(order, processArr, noTax) {
|
|
|
210
216
|
var taxObj = {};
|
|
211
217
|
if (order.taxType === tax_enum_1.TaxTypeEnum.PriceNoTaxBindDish && !noTax) {
|
|
212
218
|
order.content.forEach(function (orderContentItem) {
|
|
213
|
-
var _a;
|
|
219
|
+
var _a, _b;
|
|
214
220
|
if (!orderContentItem.dishSnapshot.taxes || orderContentItem.dishSnapshot.taxes.length === 0) {
|
|
215
221
|
return;
|
|
216
222
|
}
|
|
217
223
|
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;
|
|
218
|
-
var dishTotalPrice = orderContentItem
|
|
224
|
+
var dishTotalPrice = calcContentPrice({ orderContentItem: orderContentItem, buffetItem: (_b = order.buffet) === null || _b === void 0 ? void 0 : _b.snapshot, orderType: order.type, adultNum: order.adultNum, childNum: order.childNum, contents: order.content });
|
|
219
225
|
if (discountValue && !orderContentItem.dishSnapshot.noFullOrderDiscount) {
|
|
220
226
|
var rate = -(10 - discountValue) / 10;
|
|
221
227
|
dishTotalPrice += dishTotalPrice * rate;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -198,10 +198,15 @@ export function calcReceivablePrice(
|
|
|
198
198
|
if (orderContentItem.dishSnapshot.noFullOrderDiscount) {
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
const dishTotalPrice = orderContentItem.
|
|
201
|
+
const dishTotalPrice = calcContentPrice({orderContentItem, buffetItem:order.buffet?.snapshot, orderType: order.type, adultNum:order.adultNum,childNum:order.childNum, contents: order.content})
|
|
202
202
|
totalDiscountPrice += dishTotalPrice;
|
|
203
203
|
volume += dishTotalPrice * rate;
|
|
204
204
|
});
|
|
205
|
+
if(order.type === OrderTypeEnum.Buffet) {
|
|
206
|
+
const buffetTotalPrice = calcBuffetTotalPrice(order.buffet.snapshot, order.adultNum, order.childNum)
|
|
207
|
+
totalDiscountPrice += buffetTotalPrice;
|
|
208
|
+
volume += buffetTotalPrice * rate;
|
|
209
|
+
}
|
|
205
210
|
resultProcessArr.push({
|
|
206
211
|
type: process.type,
|
|
207
212
|
value: process.value,
|
|
@@ -240,7 +245,7 @@ export function calcReceivablePrice(
|
|
|
240
245
|
const discountValue = sortedProcessArr.find(
|
|
241
246
|
(process) => process.type === CONST.RECEIVABLE_PROCESSING_TYPE.DISCOUNT.TYPE,
|
|
242
247
|
)?.value;
|
|
243
|
-
let dishTotalPrice = orderContentItem.
|
|
248
|
+
let dishTotalPrice = calcContentPrice({orderContentItem, buffetItem:order.buffet?.snapshot, orderType: order.type, adultNum:order.adultNum,childNum:order.childNum, contents: order.content});
|
|
244
249
|
if (discountValue && !orderContentItem.dishSnapshot.noFullOrderDiscount) {
|
|
245
250
|
const rate = -(10 - discountValue) / 10;
|
|
246
251
|
dishTotalPrice += dishTotalPrice * rate;
|