您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

35 行
1.0KB

  1. export class SovPrices {
  2. static getPrice(priceWithTax, taxRate) {
  3. return parseFloat(parseFloat(priceWithTax) / ((taxRate/100) + 1)).toFixed(4);
  4. }
  5. static getPriceWithTax(priceWithoutTax, taxRate) {
  6. return parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1)).toFixed(2);
  7. }
  8. static getMargin(price, buyingPrice){
  9. return parseFloat(price - buyingPrice).toFixed(2);
  10. }
  11. static getMarginPercent(price, buyingPrice){
  12. return parseFloat(((price - buyingPrice) / price) * 100).toFixed(2);
  13. }
  14. static applyReductionPercent(price, percentage)
  15. {
  16. return this.applyPercent(price, -percentage);
  17. }
  18. static applyReductionAmount(price, amount)
  19. {
  20. return parseFloat(price - amount).toFixed(2);
  21. }
  22. static applyPercent(price, percentage)
  23. {
  24. return parseFloat(price * (percentage / 100 + 1)).toFixed(2);
  25. }
  26. }