@freedom_sky/feige-lib 4.22.0 → 4.23.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.
@@ -98,7 +98,7 @@ var Const = /** @class */ (function () {
98
98
  this.UPPER_LIMIT = {
99
99
  WAITER_NUM: 10,
100
100
  CHEF_NUM: 5,
101
- DISH_PRICE: 5000000,
101
+ DISH_PRICE: 9999999,
102
102
  DISH_NAME_MAX_LENGTH: 60,
103
103
  SPECIFICATION_NAME_MAX_LENGTH: 60,
104
104
  SPECIFICATION_DESCRIPTION_MAX_LENGTH: 60,
package/dist/index.d.ts CHANGED
@@ -26,7 +26,8 @@ export * from './interfaces/member/member-transaction.interface';
26
26
  export * from './interfaces/store/store.interface';
27
27
  export { PayCompanyEnum } from './enum/pay-company.enum';
28
28
  import * as moment from 'moment';
29
- export { Order, Process, Content, Checkout, CONST, DishSnapshot, User, UserSafe, CertificatePath, Task, VisitTask, moment, PrintStatusEnum, PrinterDeviceTypeEnum, PrinterWidthEnum, };
29
+ import Big from 'big.js';
30
+ export { Order, Process, Content, Checkout, CONST, DishSnapshot, User, UserSafe, CertificatePath, Task, VisitTask, moment, PrintStatusEnum, PrinterDeviceTypeEnum, PrinterWidthEnum, Big, };
30
31
  /**
31
32
  * 小数转化为金额,去除分位之后的尾数
32
33
  *
package/dist/index.js CHANGED
@@ -30,6 +30,8 @@ var pay_company_enum_1 = require("./enum/pay-company.enum");
30
30
  exports.PayCompanyEnum = pay_company_enum_1.PayCompanyEnum;
31
31
  var moment = require("moment");
32
32
  exports.moment = moment;
33
+ var big_js_1 = require("big.js");
34
+ exports.Big = big_js_1.default;
33
35
  var tax_enum_1 = require("./enum/tax.enum");
34
36
  /**
35
37
  * 小数转化为金额,去除分位之后的尾数
@@ -172,7 +174,7 @@ function calcReceivablePrice(order, processArr, noTax) {
172
174
  var sharedMarkDown = (totalMarkDown * dishTotalPrice) / receivablePriceAfterDiscount;
173
175
  orderContentItem.dishSnapshot.taxes.forEach(function (tax) {
174
176
  var taxFare = (dishTotalPrice - sharedMarkDown) * tax.rate;
175
- var taxKey = tax.name + "(" + tax.rate * 100 + "%)";
177
+ var taxKey = tax.name + "(" + big_js_1.default(tax.rate).times(100) + "%)";
176
178
  taxObj[taxKey] = (taxObj[taxKey] || 0) + parseMoney(taxFare);
177
179
  });
178
180
  });
@@ -185,7 +187,7 @@ function calcReceivablePrice(order, processArr, noTax) {
185
187
  var totalTaxFare_1 = receivablePrice - receivablePrice / (totalTaxRate_1 + 1);
186
188
  order.priceHaveTaxBindOrderTaxes.forEach(function (item) {
187
189
  var taxFare = (item.rate / totalTaxRate_1) * totalTaxFare_1;
188
- var taxKey = item.name + "(" + item.rate * 100 + "%)";
190
+ var taxKey = item.name + "(" + big_js_1.default(item.rate).times(100) + "%)";
189
191
  taxObj[taxKey] = (taxObj[taxKey] || 0) + parseMoney(taxFare);
190
192
  });
191
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freedom_sky/feige-lib",
3
- "version": "4.22.0",
3
+ "version": "4.23.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "homepage": "https://github.com/freedom-git/feige-lib#readme",
33
33
  "devDependencies": {
34
+ "@types/big.js": "^6.1.2",
34
35
  "@types/jest": "^25.2.1",
35
36
  "@types/node": "^13.13.2",
36
37
  "@typescript-eslint/eslint-plugin": "^2.29.0",
@@ -48,6 +49,7 @@
48
49
  "typescript": "^3.8.3"
49
50
  },
50
51
  "dependencies": {
52
+ "big.js": "^6.1.1",
51
53
  "moment": "^2.29.1"
52
54
  }
53
55
  }
@@ -95,7 +95,7 @@ class Const {
95
95
  UPPER_LIMIT = {
96
96
  WAITER_NUM: 10,
97
97
  CHEF_NUM: 5,
98
- DISH_PRICE: 5000000,
98
+ DISH_PRICE: 9999999,
99
99
  DISH_NAME_MAX_LENGTH: 60,
100
100
  SPECIFICATION_NAME_MAX_LENGTH: 60,
101
101
  SPECIFICATION_DESCRIPTION_MAX_LENGTH: 60,
package/src/index.ts CHANGED
@@ -27,6 +27,7 @@ export * from './interfaces/member/member-transaction.interface';
27
27
  export * from './interfaces/store/store.interface';
28
28
  export { PayCompanyEnum } from './enum/pay-company.enum';
29
29
  import * as moment from 'moment';
30
+ import Big from 'big.js';
30
31
  import { TaxTypeEnum } from './enum/tax.enum';
31
32
  export {
32
33
  Order,
@@ -44,6 +45,7 @@ export {
44
45
  PrintStatusEnum,
45
46
  PrinterDeviceTypeEnum,
46
47
  PrinterWidthEnum,
48
+ Big,
47
49
  };
48
50
 
49
51
  /**
@@ -200,7 +202,7 @@ export function calcReceivablePrice(
200
202
  const sharedMarkDown = (totalMarkDown * dishTotalPrice) / receivablePriceAfterDiscount;
201
203
  orderContentItem.dishSnapshot.taxes.forEach((tax) => {
202
204
  const taxFare = (dishTotalPrice - sharedMarkDown) * tax.rate;
203
- const taxKey = `${tax.name}(${tax.rate * 100}%)`;
205
+ const taxKey = `${tax.name}(${Big(tax.rate).times(100)}%)`;
204
206
  taxObj[taxKey] = (taxObj[taxKey] || 0) + parseMoney(taxFare);
205
207
  });
206
208
  });
@@ -212,7 +214,7 @@ export function calcReceivablePrice(
212
214
  const totalTaxFare = receivablePrice - receivablePrice / (totalTaxRate + 1);
213
215
  order.priceHaveTaxBindOrderTaxes.forEach((item) => {
214
216
  const taxFare = (item.rate / totalTaxRate) * totalTaxFare;
215
- const taxKey = `${item.name}(${item.rate * 100}%)`;
217
+ const taxKey = `${item.name}(${Big(item.rate).times(100)}%)`;
216
218
  taxObj[taxKey] = (taxObj[taxKey] || 0) + parseMoney(taxFare);
217
219
  });
218
220
  }