@freedom_sky/feige-lib 4.51.4 → 4.51.6

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.
@@ -25,7 +25,7 @@ function dishShowPriceWithBuffet(_a) {
25
25
  exports.dishShowPriceWithBuffet = dishShowPriceWithBuffet;
26
26
  function getDishItemInBuffet(_a) {
27
27
  var dishId = _a.dishId, buffet = _a.buffet;
28
- return buffet === null || buffet === void 0 ? void 0 : buffet.dishes.find(function (item) { return item.dishId === dishId; });
28
+ return buffet === null || buffet === void 0 ? void 0 : buffet.dishes.find(function (item) { return String(item.dishId) === String(dishId); });
29
29
  }
30
30
  exports.getDishItemInBuffet = getDishItemInBuffet;
31
31
  function getMaxBuffetDishUpperLimit(_a) {
package/dist/index.js CHANGED
@@ -134,9 +134,9 @@ function calcContentPrice(_a) {
134
134
  exports.calcContentPrice = calcContentPrice;
135
135
  function getOrderedCountByDishId(dishId, contents, beforeKey) {
136
136
  var count = 0;
137
- for (var _i = 0, _a = contents.filter(function (content) { return content.dishSnapshot._id === dishId; }); _i < _a.length; _i++) {
137
+ for (var _i = 0, _a = contents.filter(function (content) { return String(content.dishSnapshot._id) === String(dishId); }); _i < _a.length; _i++) {
138
138
  var content = _a[_i];
139
- if (beforeKey && content._id === beforeKey)
139
+ if (beforeKey && String(content._id) === String(beforeKey))
140
140
  break;
141
141
  count += content.count;
142
142
  }
@@ -177,6 +177,11 @@ function calcReceivablePrice(order, processArr, noTax) {
177
177
  totalDiscountPrice += dishTotalPrice;
178
178
  volume_1 += dishTotalPrice * rate_1;
179
179
  });
180
+ if (order.type === order_enum_1.OrderTypeEnum.Buffet) {
181
+ var buffetTotalPrice = index_1.calcBuffetTotalPrice(order.buffet.snapshot, order.adultNum, order.childNum);
182
+ totalDiscountPrice += buffetTotalPrice;
183
+ volume_1 += buffetTotalPrice * rate_1;
184
+ }
180
185
  resultProcessArr.push({
181
186
  type: process.type,
182
187
  value: process.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freedom_sky/feige-lib",
3
- "version": "4.51.4",
3
+ "version": "4.51.6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -20,7 +20,7 @@ export function dishShowPriceWithBuffet({dishPrice, dishId, buffet, orderedCound
20
20
  }
21
21
 
22
22
  export function getDishItemInBuffet({dishId, buffet}:{dishId:string, buffet?: BuffetCombosItems}):BuffetDishItem|undefined {
23
- return buffet?.dishes.find((item)=>item.dishId===dishId)
23
+ return buffet?.dishes.find((item)=>String(item.dishId)===String(dishId))
24
24
  }
25
25
 
26
26
  export function getMaxBuffetDishUpperLimit({buffetDishItem, adultNum, childNum}:{buffetDishItem:BuffetDishItem, adultNum: number, childNum: number}):number {
package/src/index.ts CHANGED
@@ -147,8 +147,8 @@ export function calcContentPrice({orderContentItem,buffetItem, orderType, adultN
147
147
 
148
148
  export function getOrderedCountByDishId(dishId, contents:Content[], beforeKey?:string): number{
149
149
  let count = 0;
150
- for(let content of contents.filter(content=>content.dishSnapshot._id===dishId)) {
151
- if(beforeKey && content._id === beforeKey) break;
150
+ for(let content of contents.filter(content=>String(content.dishSnapshot._id)===String(dishId))) {
151
+ if(beforeKey && String(content._id) === String(beforeKey)) break;
152
152
  count += content.count
153
153
  }
154
154
  return count
@@ -202,6 +202,11 @@ export function calcReceivablePrice(
202
202
  totalDiscountPrice += dishTotalPrice;
203
203
  volume += dishTotalPrice * rate;
204
204
  });
205
+ if(order.type === OrderTypeEnum.Buffet) {
206
+ const buffetTotalPrice = calcBuffetTotalPrice(order.buffet.snapshot, order.adultNum, order.childNum)
207
+ totalDiscountPrice += buffetTotalPrice;
208
+ volume += buffetTotalPrice * rate;
209
+ }
205
210
  resultProcessArr.push({
206
211
  type: process.type,
207
212
  value: process.value,