@freedom_sky/feige-lib 4.59.1 → 4.60.0
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/const/const.d.ts +6 -0
- package/dist/const/const.js +1005 -813
- package/dist/index.js +1 -3
- package/dist/interfaces/user/user.interface.d.ts +1 -0
- package/josn-hub/orders//350/207/252/345/212/251/351/244/220/347/232/204/346/203/205/345/206/265.ts +665 -0
- package/josn-hub/orders//351/203/250/345/210/206/351/200/200/350/217/234/347/232/204/346/203/205/345/206/265.ts +73 -0
- package/package.json +1 -1
- package/src/const/const.ts +1008 -814
- package/src/index.spec.ts +8 -0
- package/src/index.ts +1 -4
- package/src/interfaces/user/user.interface.ts +1 -0
package/src/index.spec.ts
CHANGED
|
@@ -21,6 +21,8 @@ import * as order3 from '../josn-hub/orders/点了固定加价-百分比加价
|
|
|
21
21
|
import * as order4 from '../josn-hub/orders/有一个菜的价格是负数的情况';
|
|
22
22
|
import * as order5 from '../josn-hub/orders/整单价格都是负数的情况';
|
|
23
23
|
import * as order6 from '../josn-hub/orders/点了未加价规格的订单并有配送费';
|
|
24
|
+
import * as halfRetreatOrder from '../josn-hub/orders/部分退菜的情况';
|
|
25
|
+
import * as buffetOrder from '../josn-hub/orders/自助餐的情况';
|
|
24
26
|
import * as taxOrder from '../josn-hub/orders/tax-order';
|
|
25
27
|
import * as taxHavePriceBindOrder from '../josn-hub/orders/tax-have-price-bind-order';
|
|
26
28
|
|
|
@@ -37,6 +39,12 @@ describe('开始运行单元测试', () => {
|
|
|
37
39
|
// });
|
|
38
40
|
|
|
39
41
|
describe('测试计算订单总价:calcTotalPrice', () => {
|
|
42
|
+
it('自助餐情况下总价检查', () => {
|
|
43
|
+
expect(calcTotalPrice(buffetOrder.order)).toBe(buffetOrder.expectPrice);
|
|
44
|
+
});
|
|
45
|
+
it('部分退菜情况下总价检查', () => {
|
|
46
|
+
expect(calcTotalPrice(halfRetreatOrder.order)).toBe(halfRetreatOrder.expectPrice);
|
|
47
|
+
});
|
|
40
48
|
it('不加价规格订单总价检查', () => {
|
|
41
49
|
expect(calcTotalPrice(order1.order)).toBe(order1.expectPrice);
|
|
42
50
|
});
|
package/src/index.ts
CHANGED
|
@@ -145,7 +145,6 @@ export function calcContentPrice({
|
|
|
145
145
|
childNum: number;
|
|
146
146
|
contents: Content[];
|
|
147
147
|
}): number {
|
|
148
|
-
if (orderContentItem.retreated) return 0;
|
|
149
148
|
if (orderType === OrderTypeEnum.Buffet) {
|
|
150
149
|
const buffetDishItem = getDishItemInBuffet({ dishId: orderContentItem.dishSnapshot._id, buffet: buffetItem });
|
|
151
150
|
if (buffetDishItem) {
|
|
@@ -180,9 +179,7 @@ export function calcContentPrice({
|
|
|
180
179
|
*/
|
|
181
180
|
export function getOrderedCountByDishId(dishId, contents: Content[], beforeKey?: string): number {
|
|
182
181
|
let count = 0;
|
|
183
|
-
for (const content of contents.filter(
|
|
184
|
-
(content) => !content.retreated && String(content.dishSnapshot._id) === String(dishId),
|
|
185
|
-
)) {
|
|
182
|
+
for (const content of contents.filter((content) => String(content.dishSnapshot._id) === String(dishId))) {
|
|
186
183
|
if (beforeKey && String(content._id) === String(beforeKey)) break;
|
|
187
184
|
count += content.count;
|
|
188
185
|
}
|