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

51 行
1.6KB

  1. export class SovPrices {
  2. static getPrice(priceWithTax, taxRate,round) {
  3. let price = parseFloat(parseFloat(priceWithTax) / ((taxRate/100) + 1));
  4. if(round ==false){
  5. return price;
  6. }
  7. return price.toFixed(4);
  8. }
  9. static getPriceWithTax(priceWithoutTax, taxRate, round) {
  10. let priceWithTax = parseFloat(parseFloat(priceWithoutTax) * ((taxRate/100) + 1));
  11. if(round ==false){
  12. return priceWithTax;
  13. }
  14. return priceWithTax.toFixed(2);
  15. }
  16. static getMargin(price, buyingPrice){
  17. return parseFloat(price - buyingPrice).toFixed(2);
  18. }
  19. static getMarginPercent(price, buyingPrice){
  20. return parseFloat(((price - buyingPrice) / price) * 100).toFixed(2);
  21. }
  22. static applyReductionPercent(price, percentage, round)
  23. {
  24. return this.applyPercent(price, -percentage,round);
  25. }
  26. static applyReductionAmount(price, amount, round)
  27. {
  28. let priceWithReduction = parseFloat(price - amount);
  29. if(round ==false){
  30. return priceWithReduction;
  31. }
  32. return priceWithReduction.toFixed(2);
  33. }
  34. static applyPercent(price, percentage, round)
  35. {
  36. let priceWithReduction = parseFloat(price * (percentage / 100 + 1));
  37. if(round ==false){
  38. return priceWithReduction;
  39. }
  40. return priceWithReduction.toFixed(2);
  41. }
  42. }