@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/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
  }
@@ -25,6 +25,7 @@ export interface UserSafe {
25
25
  readonly from: FromEnum;
26
26
  readonly visitCycle: number;
27
27
  readonly purchased: boolean;
28
+ readonly disabled: boolean;
28
29
  }
29
30
  export interface User extends UserSafe {
30
31
  readonly certificate: {