@freedom_sky/feige-lib 4.54.0 → 4.54.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.d.ts +1 -1
- package/dist/index.js +5 -3
- package/package.json +1 -1
- package/src/index.ts +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -187,4 +187,4 @@ export declare function getLanguageFromCountryCode(countryCode: any): string;
|
|
|
187
187
|
* @param {Order} order 店铺
|
|
188
188
|
* @returns {Number} 返回当前数量
|
|
189
189
|
*/
|
|
190
|
-
export declare function
|
|
190
|
+
export declare function getDishCountByIdInAllUncanceledTasks(order: Order, dishId: string): Number;
|
package/dist/index.js
CHANGED
|
@@ -114,6 +114,8 @@ exports.calcTotalPrice = calcTotalPrice;
|
|
|
114
114
|
*/
|
|
115
115
|
function calcContentPrice(_a) {
|
|
116
116
|
var orderContentItem = _a.orderContentItem, buffetItem = _a.buffetItem, orderType = _a.orderType, adultNum = _a.adultNum, childNum = _a.childNum, contents = _a.contents;
|
|
117
|
+
if (orderContentItem.retreated)
|
|
118
|
+
return 0;
|
|
117
119
|
if (orderType === order_enum_1.OrderTypeEnum.Buffet) {
|
|
118
120
|
var buffetDishItem = index_1.getDishItemInBuffet({ dishId: orderContentItem.dishSnapshot._id, buffet: buffetItem });
|
|
119
121
|
if (buffetDishItem) {
|
|
@@ -147,7 +149,7 @@ exports.calcContentPrice = calcContentPrice;
|
|
|
147
149
|
*/
|
|
148
150
|
function getOrderedCountByDishId(dishId, contents, beforeKey) {
|
|
149
151
|
var count = 0;
|
|
150
|
-
for (var _i = 0, _a = contents.filter(function (content) { return String(content.dishSnapshot._id) === String(dishId); }); _i < _a.length; _i++) {
|
|
152
|
+
for (var _i = 0, _a = contents.filter(function (content) { return !content.retreated && String(content.dishSnapshot._id) === String(dishId); }); _i < _a.length; _i++) {
|
|
151
153
|
var content = _a[_i];
|
|
152
154
|
if (beforeKey && String(content._id) === String(beforeKey))
|
|
153
155
|
break;
|
|
@@ -521,7 +523,7 @@ exports.getLanguageFromCountryCode = getLanguageFromCountryCode;
|
|
|
521
523
|
* @param {Order} order 店铺
|
|
522
524
|
* @returns {Number} 返回当前数量
|
|
523
525
|
*/
|
|
524
|
-
function
|
|
526
|
+
function getDishCountByIdInAllUncanceledTasks(order, dishId) {
|
|
525
527
|
var count = 0;
|
|
526
528
|
if (order.tasks) {
|
|
527
529
|
count = order.tasks.filter(function (task) { return task.status !== const_1.CONST.STATUS.CANCELLED; }).reduce(function (count, task) {
|
|
@@ -530,4 +532,4 @@ function getDishCountById(order, dishId) {
|
|
|
530
532
|
}
|
|
531
533
|
return count;
|
|
532
534
|
}
|
|
533
|
-
exports.
|
|
535
|
+
exports.getDishCountByIdInAllUncanceledTasks = getDishCountByIdInAllUncanceledTasks;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -144,6 +144,7 @@ export function calcContentPrice({
|
|
|
144
144
|
childNum: number;
|
|
145
145
|
contents: Content[];
|
|
146
146
|
}): number {
|
|
147
|
+
if(orderContentItem.retreated) return 0;
|
|
147
148
|
if (orderType === OrderTypeEnum.Buffet) {
|
|
148
149
|
const buffetDishItem = getDishItemInBuffet({ dishId: orderContentItem.dishSnapshot._id, buffet: buffetItem });
|
|
149
150
|
if (buffetDishItem) {
|
|
@@ -178,10 +179,10 @@ export function calcContentPrice({
|
|
|
178
179
|
*/
|
|
179
180
|
export function getOrderedCountByDishId(dishId, contents: Content[], beforeKey?: string): number {
|
|
180
181
|
let count = 0;
|
|
181
|
-
for (const content of contents.filter((content) => String(content.dishSnapshot._id) === String(dishId))) {
|
|
182
|
+
for (const content of contents.filter((content) => !content.retreated && String(content.dishSnapshot._id) === String(dishId))) {
|
|
182
183
|
if (beforeKey && String(content._id) === String(beforeKey)) break;
|
|
183
184
|
count += content.count;
|
|
184
|
-
}
|
|
185
|
+
}
|
|
185
186
|
return count;
|
|
186
187
|
}
|
|
187
188
|
|
|
@@ -567,7 +568,7 @@ export function getLanguageFromCountryCode(countryCode): string {
|
|
|
567
568
|
* @param {Order} order 店铺
|
|
568
569
|
* @returns {Number} 返回当前数量
|
|
569
570
|
*/
|
|
570
|
-
export function
|
|
571
|
+
export function getDishCountByIdInAllUncanceledTasks(order: Order, dishId: string): Number {
|
|
571
572
|
let count = 0;
|
|
572
573
|
if (order.tasks) {
|
|
573
574
|
count = order.tasks.filter(task=>task.status!==CONST.STATUS.CANCELLED).reduce((count, task) => {
|