@freedom_sky/feige-lib 4.59.0 → 4.59.2

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 CHANGED
@@ -115,8 +115,6 @@ exports.calcTotalPrice = calcTotalPrice;
115
115
  */
116
116
  function calcContentPrice(_a) {
117
117
  var orderContentItem = _a.orderContentItem, buffetItem = _a.buffetItem, orderType = _a.orderType, adultNum = _a.adultNum, childNum = _a.childNum, contents = _a.contents;
118
- if (orderContentItem.retreated)
119
- return 0;
120
118
  if (orderType === order_enum_1.OrderTypeEnum.Buffet) {
121
119
  var buffetDishItem = index_1.getDishItemInBuffet({ dishId: orderContentItem.dishSnapshot._id, buffet: buffetItem });
122
120
  if (buffetDishItem) {
@@ -150,7 +148,7 @@ exports.calcContentPrice = calcContentPrice;
150
148
  */
151
149
  function getOrderedCountByDishId(dishId, contents, beforeKey) {
152
150
  var count = 0;
153
- for (var _i = 0, _a = contents.filter(function (content) { return !content.retreated && String(content.dishSnapshot._id) === String(dishId); }); _i < _a.length; _i++) {
151
+ for (var _i = 0, _a = contents.filter(function (content) { return String(content.dishSnapshot._id) === String(dishId); }); _i < _a.length; _i++) {
154
152
  var content = _a[_i];
155
153
  if (beforeKey && String(content._id) === String(beforeKey))
156
154
  break;
@@ -35,6 +35,7 @@ export interface Activation {
35
35
  readonly tableCountLimit: number;
36
36
  readonly memberFunction: boolean;
37
37
  readonly deliveryFunction: boolean;
38
+ readonly buffetFunction: boolean;
38
39
  readonly waiterCountLimit: number;
39
40
  readonly kdsCountLimit: number;
40
41
  readonly multiLanguageCountLimit: number;
@@ -0,0 +1,665 @@
1
+ // 总价应该是23.2
2
+ export const order: any = {
3
+ _id: '658e8a1c9efc2d00139e95e8',
4
+ checkoutFirst: false,
5
+ printed: [],
6
+ printerPrinted: [],
7
+ kdsPrinted: [],
8
+ printStatus: 'NotPrinted',
9
+ operatorId: null,
10
+ salesmanId: '5fdf7107f973ec00135fa625',
11
+ status: 'processing',
12
+ payed: false,
13
+ noTax: false,
14
+ reserveTime: null,
15
+ selfPickUp: false,
16
+ pack: false,
17
+ storeId: '5fdf7149f973ec00135fa626',
18
+ tableNum: '高',
19
+ content: [
20
+ {
21
+ delivering: 0,
22
+ finished: 0,
23
+ retreated: 0,
24
+ _id: '658e8a1c9efc2d00139e95ec',
25
+ dishSnapshot: {
26
+ names: {
27
+ zh: '柠檬可乐(示例)',
28
+ en: 'Cola',
29
+ ug: 'لىمون كولا',
30
+ },
31
+ descriptions: {
32
+ zh: '冰爽可乐添加新鲜柠檬片,提神醒脑,让您胃口大开~',
33
+ en: '冰爽可乐添加新鲜柠檬片,提神醒脑,让您胃口大开~',
34
+ ug: '冰爽可乐添加新鲜柠檬片,提神醒脑,让您胃口大开~',
35
+ },
36
+ units: {
37
+ zh: null,
38
+ en: null,
39
+ ug: null,
40
+ },
41
+ type: 'Normal',
42
+ description: '冰爽可乐添加新鲜柠檬片,提神醒脑,让您胃口大开~',
43
+ soldOut: false,
44
+ required: true,
45
+ specifications: ['5fdf7149f973ec00135fa628', '607ac8f75a29480013c29e98'],
46
+ salesType: ['dine', 'takeout'],
47
+ takeoutPrice: null,
48
+ __v: 7,
49
+ date: '2020-12-20T15:44:09.981Z',
50
+ _id: '5fdf7149f973ec00135fa627',
51
+ name: '柠檬可乐(示例)',
52
+ price: 4,
53
+ img: 'https://feige-img-hub.oss-cn-hangzhou.aliyuncs.com/1574590762349-BpEiDmAWpf.jpg',
54
+ chef: '6210c65af938d3001ae9ca7e',
55
+ selectedSpecifications: [
56
+ {
57
+ names: {
58
+ zh: '辣死了',
59
+ en: 'spicy',
60
+ ug: 'ئاچچىق',
61
+ },
62
+ description: '示例辣度',
63
+ multi: false,
64
+ limit: -1,
65
+ __v: 10,
66
+ content: [
67
+ {
68
+ names: {
69
+ zh: '微辣',
70
+ en: 'A little',
71
+ ug: 'ئازراق ئاچچىق',
72
+ },
73
+ disable: false,
74
+ fare: 0,
75
+ fareType: 'fixed',
76
+ _id: '5fdf7149f973ec00135fa62b',
77
+ name: '微辣',
78
+ },
79
+ ],
80
+ date: '2020-12-20T15:44:09.987Z',
81
+ _id: '5fdf7149f973ec00135fa628',
82
+ name: '辣死了',
83
+ },
84
+ ],
85
+ noFullOrderDiscount: false,
86
+ taxes: [
87
+ {
88
+ name: 't',
89
+ rate: 0.01,
90
+ },
91
+ {
92
+ name: '2',
93
+ rate: 0.05,
94
+ },
95
+ ],
96
+ },
97
+ count: 4,
98
+ date: '2023-12-29T08:58:04.522Z',
99
+ },
100
+ {
101
+ delivering: 0,
102
+ finished: 0,
103
+ retreated: 0,
104
+ _id: '658e8a1c9efc2d00139e95eb',
105
+ dishSnapshot: {
106
+ names: {
107
+ zh: '辣🌶️🌶️🌶️',
108
+ },
109
+ descriptions: {
110
+ zh: '',
111
+ },
112
+ units: {
113
+ zh: null,
114
+ },
115
+ type: 'Normal',
116
+ description: '',
117
+ soldOut: false,
118
+ required: false,
119
+ specifications: ['607ac8f75a29480013c29e98'],
120
+ salesType: ['dine', 'takeout'],
121
+ takeoutPrice: null,
122
+ __v: 7,
123
+ date: '2021-04-16T01:21:29.215Z',
124
+ _id: '6078e6992a20800013f0d858',
125
+ name: '辣🌶️🌶️🌶️',
126
+ price: 0,
127
+ img: 'https://feige-img-hub.oss-cn-hangzhou.aliyuncs.com/13666666666/1630298600668-e53xFFx46A.jpg',
128
+ chef: '6210c65af938d3001ae9ca7e',
129
+ selectedSpecifications: [
130
+ {
131
+ names: {
132
+ zh: '大小',
133
+ en: 'Size',
134
+ ug: 'چوڭلۇقى',
135
+ },
136
+ description: '',
137
+ multi: true,
138
+ limit: -1,
139
+ __v: 7,
140
+ content: [
141
+ {
142
+ names: {
143
+ zh: '五十',
144
+ en: 'Fifty',
145
+ ug: 'خىيالىڭىز يوق',
146
+ },
147
+ disable: false,
148
+ fare: 50,
149
+ fareType: 'fixed',
150
+ _id: '607ac8f75a29480013c29e99',
151
+ name: 'خىيالىڭىز يوق',
152
+ },
153
+ ],
154
+ date: '2021-04-17T11:39:35.523Z',
155
+ _id: '607ac8f75a29480013c29e98',
156
+ name: 'چوڭلۇقى',
157
+ },
158
+ ],
159
+ noFullOrderDiscount: false,
160
+ taxes: [
161
+ {
162
+ name: 't',
163
+ rate: 0.01,
164
+ },
165
+ {
166
+ name: '2',
167
+ rate: 0.05,
168
+ },
169
+ ],
170
+ },
171
+ count: 2,
172
+ date: '2023-12-29T08:58:04.522Z',
173
+ },
174
+ {
175
+ delivering: 0,
176
+ finished: 0,
177
+ retreated: 0,
178
+ _id: '658e8a1c9efc2d00139e95ea',
179
+ dishSnapshot: {
180
+ names: {
181
+ zh: '必点',
182
+ en: 'Must have very lang lang lang lang lang lang lang',
183
+ ug: 'زاكاز قىلىش كېرەك',
184
+ },
185
+ descriptions: {
186
+ zh: '',
187
+ en: '',
188
+ ug: '',
189
+ },
190
+ units: {
191
+ zh: null,
192
+ en: null,
193
+ ug: null,
194
+ },
195
+ type: 'Normal',
196
+ description: '',
197
+ soldOut: false,
198
+ required: false,
199
+ specifications: ['5fdf7149f973ec00135fa628', '607ac8f75a29480013c29e98'],
200
+ salesType: ['dine', 'takeout'],
201
+ takeoutPrice: null,
202
+ __v: 7,
203
+ date: '2021-07-21T05:55:09.530Z',
204
+ _id: '60f7b6bd772a88001381cea5',
205
+ name: '必点',
206
+ price: 2,
207
+ img: 'https://feige-img-hub.oss-cn-hangzhou.aliyuncs.com/13666666666/1667015162752-e65Gwz8JhF.jpg',
208
+ chef: '6210c65af938d3001ae9ca7e',
209
+ selectedSpecifications: [
210
+ {
211
+ names: {
212
+ zh: '辣死了',
213
+ en: 'spicy',
214
+ ug: 'ئاچچىق',
215
+ },
216
+ description: '示例辣度',
217
+ multi: false,
218
+ limit: -1,
219
+ __v: 10,
220
+ content: [
221
+ {
222
+ names: {
223
+ zh: '微辣',
224
+ en: 'A little',
225
+ ug: 'ئازراق ئاچچىق',
226
+ },
227
+ disable: false,
228
+ fare: 0,
229
+ fareType: 'fixed',
230
+ _id: '5fdf7149f973ec00135fa62b',
231
+ name: '微辣',
232
+ },
233
+ ],
234
+ date: '2020-12-20T15:44:09.987Z',
235
+ _id: '5fdf7149f973ec00135fa628',
236
+ name: '辣死了',
237
+ },
238
+ ],
239
+ noFullOrderDiscount: false,
240
+ taxes: [
241
+ {
242
+ name: 't',
243
+ rate: 0.01,
244
+ },
245
+ {
246
+ name: '2',
247
+ rate: 0.05,
248
+ },
249
+ ],
250
+ },
251
+ count: 2,
252
+ date: '2023-12-29T08:58:04.522Z',
253
+ },
254
+ {
255
+ delivering: 0,
256
+ finished: 0,
257
+ retreated: 0,
258
+ _id: '658e8a1c9efc2d00139e95e9',
259
+ dishSnapshot: {
260
+ names: {
261
+ zh: '1',
262
+ },
263
+ descriptions: {
264
+ zh: '',
265
+ },
266
+ type: 'Normal',
267
+ description: '',
268
+ soldOut: false,
269
+ required: false,
270
+ specifications: [],
271
+ salesType: ['dine', 'takeout'],
272
+ takeoutPrice: null,
273
+ __v: 0,
274
+ date: '2021-09-20T12:51:21.885Z',
275
+ _id: '614883c94abbba00136ccb15',
276
+ name: '1',
277
+ price: 1,
278
+ img: 'https://feige-img-hub.oss-cn-hangzhou.aliyuncs.com/1592144190779-QRTrDtCm2n.jpg',
279
+ chef: '6210c65af938d3001ae9ca7e',
280
+ selectedSpecifications: [],
281
+ noFullOrderDiscount: false,
282
+ taxes: [
283
+ {
284
+ name: 't',
285
+ rate: 0.01,
286
+ },
287
+ {
288
+ name: '2',
289
+ rate: 0.05,
290
+ },
291
+ ],
292
+ },
293
+ count: 10,
294
+ date: '2023-12-29T08:58:04.521Z',
295
+ },
296
+ ],
297
+ clientId: '5fdf7107f973ec00135fa625',
298
+ adultNum: 1,
299
+ childNum: 1,
300
+ type: 'buffet',
301
+ tasks: [
302
+ {
303
+ status: 'finished',
304
+ printed: [],
305
+ printerPrinted: [],
306
+ kdsPrinted: [],
307
+ printStatus: 'Completed',
308
+ _id: '658e8a1c9efc2d00139e95ed',
309
+ type: 'check',
310
+ content: [
311
+ {
312
+ delivering: 0,
313
+ retreated: 0,
314
+ _id: '658e8a1c9efc2d00139e95f1',
315
+ dishSnapshot: {
316
+ names: {
317
+ zh: '柠檬可乐(示例)',
318
+ en: 'Cola',
319
+ ug: 'لىمون كولا',
320
+ },
321
+ descriptions: {
322
+ zh: '冰爽可乐添加新鲜柠檬片,提神醒脑,让您胃口大开~',
323
+ en: '冰爽可乐添加新鲜柠檬片,提神醒脑,让您胃口大开~',
324
+ ug: '冰爽可乐添加新鲜柠檬片,提神醒脑,让您胃口大开~',
325
+ },
326
+ units: {
327
+ zh: null,
328
+ en: null,
329
+ ug: null,
330
+ },
331
+ type: 'Normal',
332
+ description: '冰爽可乐添加新鲜柠檬片,提神醒脑,让您胃口大开~',
333
+ soldOut: false,
334
+ required: true,
335
+ specifications: ['5fdf7149f973ec00135fa628', '607ac8f75a29480013c29e98'],
336
+ salesType: ['dine', 'takeout'],
337
+ takeoutPrice: null,
338
+ __v: 7,
339
+ date: '2020-12-20T15:44:09.981Z',
340
+ _id: '5fdf7149f973ec00135fa627',
341
+ name: '柠檬可乐(示例)',
342
+ price: 4,
343
+ img: 'https://feige-img-hub.oss-cn-hangzhou.aliyuncs.com/1574590762349-BpEiDmAWpf.jpg',
344
+ chef: '6210c65af938d3001ae9ca7e',
345
+ selectedSpecifications: [
346
+ {
347
+ names: {
348
+ zh: '辣死了',
349
+ en: 'spicy',
350
+ ug: 'ئاچچىق',
351
+ },
352
+ description: '示例辣度',
353
+ multi: false,
354
+ limit: -1,
355
+ __v: 10,
356
+ content: [
357
+ {
358
+ names: {
359
+ zh: '微辣',
360
+ en: 'A little',
361
+ ug: 'ئازراق ئاچچىق',
362
+ },
363
+ disable: false,
364
+ fare: 0,
365
+ fareType: 'fixed',
366
+ _id: '5fdf7149f973ec00135fa62b',
367
+ name: '微辣',
368
+ },
369
+ ],
370
+ date: '2020-12-20T15:44:09.987Z',
371
+ _id: '5fdf7149f973ec00135fa628',
372
+ name: '辣死了',
373
+ },
374
+ ],
375
+ noFullOrderDiscount: false,
376
+ taxes: [
377
+ {
378
+ name: 't',
379
+ rate: 0.01,
380
+ },
381
+ {
382
+ name: '2',
383
+ rate: 0.05,
384
+ },
385
+ ],
386
+ },
387
+ count: 4,
388
+ date: '2023-12-29T08:58:04.523Z',
389
+ },
390
+ {
391
+ delivering: 0,
392
+ retreated: 0,
393
+ _id: '658e8a1c9efc2d00139e95f0',
394
+ dishSnapshot: {
395
+ names: {
396
+ zh: '辣🌶️🌶️🌶️',
397
+ },
398
+ descriptions: {
399
+ zh: '',
400
+ },
401
+ units: {
402
+ zh: null,
403
+ },
404
+ type: 'Normal',
405
+ description: '',
406
+ soldOut: false,
407
+ required: false,
408
+ specifications: ['607ac8f75a29480013c29e98'],
409
+ salesType: ['dine', 'takeout'],
410
+ takeoutPrice: null,
411
+ __v: 7,
412
+ date: '2021-04-16T01:21:29.215Z',
413
+ _id: '6078e6992a20800013f0d858',
414
+ name: '辣🌶️🌶️🌶️',
415
+ price: 0,
416
+ img:
417
+ 'https://feige-img-hub.oss-cn-hangzhou.aliyuncs.com/13666666666/1630298600668-e53xFFx46A.jpg',
418
+ chef: '6210c65af938d3001ae9ca7e',
419
+ selectedSpecifications: [
420
+ {
421
+ names: {
422
+ zh: '大小',
423
+ en: 'Size',
424
+ ug: 'چوڭلۇقى',
425
+ },
426
+ description: '',
427
+ multi: true,
428
+ limit: -1,
429
+ __v: 7,
430
+ content: [
431
+ {
432
+ names: {
433
+ zh: '五十',
434
+ en: 'Fifty',
435
+ ug: 'خىيالىڭىز يوق',
436
+ },
437
+ disable: false,
438
+ fare: 50,
439
+ fareType: 'fixed',
440
+ _id: '607ac8f75a29480013c29e99',
441
+ name: 'خىيالىڭىز يوق',
442
+ },
443
+ ],
444
+ date: '2021-04-17T11:39:35.523Z',
445
+ _id: '607ac8f75a29480013c29e98',
446
+ name: 'چوڭلۇقى',
447
+ },
448
+ ],
449
+ noFullOrderDiscount: false,
450
+ taxes: [
451
+ {
452
+ name: 't',
453
+ rate: 0.01,
454
+ },
455
+ {
456
+ name: '2',
457
+ rate: 0.05,
458
+ },
459
+ ],
460
+ },
461
+ count: 2,
462
+ date: '2023-12-29T08:58:04.523Z',
463
+ },
464
+ {
465
+ delivering: 0,
466
+ retreated: 0,
467
+ _id: '658e8a1c9efc2d00139e95ef',
468
+ dishSnapshot: {
469
+ names: {
470
+ zh: '必点',
471
+ en: 'Must have very lang lang lang lang lang lang lang',
472
+ ug: 'زاكاز قىلىش كېرەك',
473
+ },
474
+ descriptions: {
475
+ zh: '',
476
+ en: '',
477
+ ug: '',
478
+ },
479
+ units: {
480
+ zh: null,
481
+ en: null,
482
+ ug: null,
483
+ },
484
+ type: 'Normal',
485
+ description: '',
486
+ soldOut: false,
487
+ required: false,
488
+ specifications: ['5fdf7149f973ec00135fa628', '607ac8f75a29480013c29e98'],
489
+ salesType: ['dine', 'takeout'],
490
+ takeoutPrice: null,
491
+ __v: 7,
492
+ date: '2021-07-21T05:55:09.530Z',
493
+ _id: '60f7b6bd772a88001381cea5',
494
+ name: '必点',
495
+ price: 2,
496
+ img:
497
+ 'https://feige-img-hub.oss-cn-hangzhou.aliyuncs.com/13666666666/1667015162752-e65Gwz8JhF.jpg',
498
+ chef: '6210c65af938d3001ae9ca7e',
499
+ selectedSpecifications: [
500
+ {
501
+ names: {
502
+ zh: '辣死了',
503
+ en: 'spicy',
504
+ ug: 'ئاچچىق',
505
+ },
506
+ description: '示例辣度',
507
+ multi: false,
508
+ limit: -1,
509
+ __v: 10,
510
+ content: [
511
+ {
512
+ names: {
513
+ zh: '微辣',
514
+ en: 'A little',
515
+ ug: 'ئازراق ئاچچىق',
516
+ },
517
+ disable: false,
518
+ fare: 0,
519
+ fareType: 'fixed',
520
+ _id: '5fdf7149f973ec00135fa62b',
521
+ name: '微辣',
522
+ },
523
+ ],
524
+ date: '2020-12-20T15:44:09.987Z',
525
+ _id: '5fdf7149f973ec00135fa628',
526
+ name: '辣死了',
527
+ },
528
+ ],
529
+ noFullOrderDiscount: false,
530
+ taxes: [
531
+ {
532
+ name: 't',
533
+ rate: 0.01,
534
+ },
535
+ {
536
+ name: '2',
537
+ rate: 0.05,
538
+ },
539
+ ],
540
+ },
541
+ count: 2,
542
+ date: '2023-12-29T08:58:04.523Z',
543
+ },
544
+ {
545
+ delivering: 0,
546
+ retreated: 0,
547
+ _id: '658e8a1c9efc2d00139e95ee',
548
+ dishSnapshot: {
549
+ names: {
550
+ zh: '1',
551
+ },
552
+ descriptions: {
553
+ zh: '',
554
+ },
555
+ type: 'Normal',
556
+ description: '',
557
+ soldOut: false,
558
+ required: false,
559
+ specifications: [],
560
+ salesType: ['dine', 'takeout'],
561
+ takeoutPrice: null,
562
+ __v: 0,
563
+ date: '2021-09-20T12:51:21.885Z',
564
+ _id: '614883c94abbba00136ccb15',
565
+ name: '1',
566
+ price: 1,
567
+ img: 'https://feige-img-hub.oss-cn-hangzhou.aliyuncs.com/1592144190779-QRTrDtCm2n.jpg',
568
+ chef: '6210c65af938d3001ae9ca7e',
569
+ selectedSpecifications: [],
570
+ noFullOrderDiscount: false,
571
+ taxes: [
572
+ {
573
+ name: 't',
574
+ rate: 0.01,
575
+ },
576
+ {
577
+ name: '2',
578
+ rate: 0.05,
579
+ },
580
+ ],
581
+ },
582
+ count: 10,
583
+ date: '2023-12-29T08:58:04.523Z',
584
+ },
585
+ ],
586
+ valet: true,
587
+ date: '2023-12-29T08:58:04.524Z',
588
+ operatorId: '5fdf7107f973ec00135fa625',
589
+ },
590
+ {
591
+ status: 'processing',
592
+ printed: [],
593
+ printerPrinted: [],
594
+ kdsPrinted: [],
595
+ printStatus: 'NotPrinted',
596
+ _id: '658e8a1c9efc2d00139e95f4',
597
+ type: 'clean',
598
+ date: '2023-12-29T08:58:04.555Z',
599
+ content: [],
600
+ },
601
+ ],
602
+ taxType: 'priceNoTaxBindDish',
603
+ priceHaveTaxBindOrderTaxes: [],
604
+ autoCleanTime: '2023-12-29T09:03:04.512Z',
605
+ serialOrderId: '20231229-1',
606
+ buffet: {
607
+ snapshot: {
608
+ names: {
609
+ zh: '1',
610
+ },
611
+ price: {
612
+ adult: 10,
613
+ child: 5,
614
+ },
615
+ dishes: [
616
+ {
617
+ upperLimit: {
618
+ enable: true,
619
+ adult: 1,
620
+ child: 1,
621
+ },
622
+ _id: '658e89db9efc2d00139e95e5',
623
+ dishId: '5fdf7149f973ec00135fa627',
624
+ },
625
+ {
626
+ upperLimit: {
627
+ enable: true,
628
+ adult: 1,
629
+ child: 1,
630
+ },
631
+ _id: '658e89db9efc2d00139e95e4',
632
+ dishId: '60f7b6bd772a88001381cea5',
633
+ },
634
+ {
635
+ upperLimit: {
636
+ enable: false,
637
+ adult: 1,
638
+ child: 1,
639
+ },
640
+ _id: '658e89db9efc2d00139e95e3',
641
+ dishId: '614883c94abbba00136ccb15',
642
+ },
643
+ ],
644
+ _id: '658e89209efc2d00139e95d8',
645
+ },
646
+ taxes: [
647
+ {
648
+ _id: '658e8a1c9efc2d00139e95f3',
649
+ name: 't',
650
+ rate: 0.01,
651
+ },
652
+ {
653
+ _id: '658e8a1c9efc2d00139e95f2',
654
+ name: '2',
655
+ rate: 0.05,
656
+ },
657
+ ],
658
+ },
659
+ checkout: [],
660
+ process: [],
661
+ taxes: [],
662
+ date: '2023-12-29T08:58:04.525Z',
663
+ __v: 0,
664
+ };
665
+ export const expectPrice = 123;
@@ -0,0 +1,73 @@
1
+ // 总价应该是23.2
2
+ export const order: any = {
3
+ _id: '658e5ff5fca6bd001ad1f284',
4
+ buffet: {
5
+ taxes: [],
6
+ },
7
+ checkoutFirst: false,
8
+ printed: [],
9
+ printerPrinted: [],
10
+ kdsPrinted: [],
11
+ printStatus: 'NotPrinted',
12
+ operatorId: null,
13
+ salesmanId: null,
14
+ status: 'processing',
15
+ payed: false,
16
+ noTax: false,
17
+ reserveTime: null,
18
+ selfPickUp: false,
19
+ pack: false,
20
+ storeId: '5fdf7149f973ec00135fa626',
21
+ tableNum: '20AAA',
22
+ content: [
23
+ {
24
+ delivering: 3,
25
+ finished: 0,
26
+ retreated: 1,
27
+ _id: '658e5ff5fca6bd001ad1f285',
28
+ dishSnapshot: {
29
+ names: {
30
+ vi: '可乐Coca',
31
+ },
32
+ descriptions: {
33
+ vi: '',
34
+ },
35
+ units: {
36
+ vi: null,
37
+ },
38
+ type: 'Normal',
39
+ description: '',
40
+ soldOut: false,
41
+ required: false,
42
+ specifications: [],
43
+ salesType: ['dine', 'takeout'],
44
+ takeoutPrice: null,
45
+ __v: 1,
46
+ date: '2022-04-22T00:02:00.894Z',
47
+ _id: '6261f078a108d8001a088f36',
48
+ name: '可乐Coca',
49
+ price: 20000,
50
+ img: 'https://feige-img-hub.oss-cn-hangzhou.aliyuncs.com/898393196/1650585714021-eabHK2a3aA.jpg',
51
+ chef: null,
52
+ selectedSpecifications: [],
53
+ noFullOrderDiscount: false,
54
+ taxes: [],
55
+ },
56
+ count: 3,
57
+ date: '2023-12-29T05:58:13.238Z',
58
+ retreatReason: null,
59
+ },
60
+ ],
61
+ clientId: '432427e0-a60e-11ee-b732-cf7d64356d46',
62
+ type: 'table',
63
+ tasks: [],
64
+ priceHaveTaxBindOrderTaxes: [],
65
+ serialOrderId: '20231229-12',
66
+ checkout: [],
67
+ process: [],
68
+ taxes: [],
69
+ date: '2023-12-29T05:58:13.240Z',
70
+ __v: 9,
71
+ autoCleanTime: '2023-12-29T05:58:13.264Z',
72
+ };
73
+ export const expectPrice = 60000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freedom_sky/feige-lib",
3
- "version": "4.59.0",
3
+ "version": "4.59.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
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
  }
@@ -35,6 +35,7 @@ export interface Activation {
35
35
  readonly tableCountLimit: number;
36
36
  readonly memberFunction: boolean;
37
37
  readonly deliveryFunction: boolean;
38
+ readonly buffetFunction: boolean;
38
39
  readonly waiterCountLimit: number;
39
40
  readonly kdsCountLimit: number;
40
41
  readonly multiLanguageCountLimit: number;