@freedom_sky/feige-lib 4.53.1 → 4.54.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/index.d.ts
CHANGED
|
@@ -181,3 +181,10 @@ export declare function getOrderByLanguage(order: Order, currentLang: string, de
|
|
|
181
181
|
* @returns {string} 语言代码的小写格式
|
|
182
182
|
*/
|
|
183
183
|
export declare function getLanguageFromCountryCode(countryCode: any): string;
|
|
184
|
+
/**
|
|
185
|
+
* 根据dishID返回已经下单的数量
|
|
186
|
+
*
|
|
187
|
+
* @param {Order} order 店铺
|
|
188
|
+
* @returns {Number} 返回当前数量
|
|
189
|
+
*/
|
|
190
|
+
export declare function getDishCountById(order: Order, dishId: string): Number;
|
package/dist/index.js
CHANGED
|
@@ -515,3 +515,19 @@ function getLanguageFromCountryCode(countryCode) {
|
|
|
515
515
|
return languageCode;
|
|
516
516
|
}
|
|
517
517
|
exports.getLanguageFromCountryCode = getLanguageFromCountryCode;
|
|
518
|
+
/**
|
|
519
|
+
* 根据dishID返回已经下单的数量
|
|
520
|
+
*
|
|
521
|
+
* @param {Order} order 店铺
|
|
522
|
+
* @returns {Number} 返回当前数量
|
|
523
|
+
*/
|
|
524
|
+
function getDishCountById(order, dishId) {
|
|
525
|
+
var count = 0;
|
|
526
|
+
if (order.tasks) {
|
|
527
|
+
count = order.tasks.filter(function (task) { return task.status !== const_1.CONST.STATUS.CANCELLED; }).reduce(function (count, task) {
|
|
528
|
+
return count + task.content.filter(function (item) { return String(item.dishSnapshot._id) === String(dishId); }).reduce(function (value, item) { return value + item.count; }, 0);
|
|
529
|
+
}, 0);
|
|
530
|
+
}
|
|
531
|
+
return count;
|
|
532
|
+
}
|
|
533
|
+
exports.getDishCountById = getDishCountById;
|
|
@@ -12,7 +12,7 @@ export interface LangList {
|
|
|
12
12
|
[key: string]: string;
|
|
13
13
|
}
|
|
14
14
|
export interface BuffetDishItem {
|
|
15
|
-
dishId: string;
|
|
15
|
+
readonly dishId: string;
|
|
16
16
|
upperLimit: {
|
|
17
17
|
enable: boolean;
|
|
18
18
|
adult: number;
|
|
@@ -20,7 +20,7 @@ export interface BuffetDishItem {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
export interface BuffetCombosItems {
|
|
23
|
-
_id: string;
|
|
23
|
+
readonly _id: string;
|
|
24
24
|
names: object;
|
|
25
25
|
price: {
|
|
26
26
|
adult: number;
|
|
@@ -29,12 +29,13 @@ export interface BuffetCombosItems {
|
|
|
29
29
|
dishes: BuffetDishItem[];
|
|
30
30
|
}
|
|
31
31
|
export interface AllergenItem {
|
|
32
|
-
_id: string;
|
|
32
|
+
readonly _id: string;
|
|
33
33
|
names: object;
|
|
34
34
|
img: string;
|
|
35
35
|
dishIds: string[];
|
|
36
36
|
}
|
|
37
37
|
export interface AnnouncementItem {
|
|
38
|
+
readonly _id: string;
|
|
38
39
|
enable: boolean;
|
|
39
40
|
titles: LangList;
|
|
40
41
|
type: AnnouncementTypeEnum;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -560,3 +560,19 @@ export function getLanguageFromCountryCode(countryCode): string {
|
|
|
560
560
|
const languageCode = data[String(countryCode)] || 'en';
|
|
561
561
|
return languageCode;
|
|
562
562
|
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* 根据dishID返回已经下单的数量
|
|
566
|
+
*
|
|
567
|
+
* @param {Order} order 店铺
|
|
568
|
+
* @returns {Number} 返回当前数量
|
|
569
|
+
*/
|
|
570
|
+
export function getDishCountById(order: Order, dishId: string): Number {
|
|
571
|
+
let count = 0;
|
|
572
|
+
if (order.tasks) {
|
|
573
|
+
count = order.tasks.filter(task=>task.status!==CONST.STATUS.CANCELLED).reduce((count, task) => {
|
|
574
|
+
return count + task.content.filter(item=>String(item.dishSnapshot._id)===String(dishId)).reduce((value, item) => value+item.count,0);
|
|
575
|
+
},0);
|
|
576
|
+
}
|
|
577
|
+
return count;
|
|
578
|
+
}
|
|
@@ -15,9 +15,11 @@ import { TimeMenuLoopMode } from '../../enum/time-menu.enum';
|
|
|
15
15
|
import { WeekEnum } from '../../enum/common.enum';
|
|
16
16
|
import { AnnouncementTargetEnum, AnnouncementTypeEnum } from '../../index';
|
|
17
17
|
|
|
18
|
-
export interface LangList {
|
|
18
|
+
export interface LangList {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
}
|
|
19
21
|
export interface BuffetDishItem {
|
|
20
|
-
dishId: string;
|
|
22
|
+
readonly dishId: string;
|
|
21
23
|
upperLimit: {
|
|
22
24
|
enable: boolean;
|
|
23
25
|
adult: number;
|
|
@@ -26,7 +28,7 @@ export interface BuffetDishItem {
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export interface BuffetCombosItems {
|
|
29
|
-
_id: string;
|
|
31
|
+
readonly _id: string;
|
|
30
32
|
names: object;
|
|
31
33
|
price: {
|
|
32
34
|
adult: number;
|
|
@@ -36,19 +38,20 @@ export interface BuffetCombosItems {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export interface AllergenItem {
|
|
39
|
-
_id: string;
|
|
41
|
+
readonly _id: string;
|
|
40
42
|
names: object;
|
|
41
43
|
img: string;
|
|
42
44
|
dishIds: string[];
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export interface AnnouncementItem {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
readonly _id: string;
|
|
49
|
+
enable: boolean;
|
|
50
|
+
titles: LangList;
|
|
51
|
+
type: AnnouncementTypeEnum;
|
|
52
|
+
targets: AnnouncementTargetEnum[];
|
|
53
|
+
textContents: LangList;
|
|
54
|
+
imageContents: LangList;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
export interface Store {
|
|
@@ -120,9 +123,9 @@ export interface Store {
|
|
|
120
123
|
enable: boolean;
|
|
121
124
|
allergens: AllergenItem[];
|
|
122
125
|
};
|
|
123
|
-
readonly announcementSetting:{
|
|
124
|
-
announcements:AnnouncementItem[]
|
|
125
|
-
}
|
|
126
|
+
readonly announcementSetting: {
|
|
127
|
+
announcements: AnnouncementItem[];
|
|
128
|
+
};
|
|
126
129
|
readonly memberSetting: {
|
|
127
130
|
savingRules: MemberSavingRule[];
|
|
128
131
|
security: {
|