price.py 869 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/python3.6
  2. # -*- coding: utf-8 -*-
  3. # @Author : lijunliang
  4. # @Email : lijunliang@topnet.net.cn
  5. # @File : price.py
  6. # @Software: PyCharm
  7. """
  8. 单价计算
  9. """
  10. import re
  11. com1 = re.compile("^01")
  12. com2 = re.compile("^02")
  13. com3 = re.compile("^03")
  14. com4 = re.compile("^04")
  15. com5 = re.compile("^05")
  16. com6 = re.compile("^06")
  17. def get_pricing(classify: str, pages: int) -> int:
  18. '''
  19. 获取价格
  20. :param classify:
  21. :param pages:
  22. :return:
  23. '''
  24. price = 0
  25. if com1.match(classify):
  26. price = 0 + 40 * pages
  27. if com2.match(classify):
  28. price = 100 + 30 * pages
  29. if com3.match(classify):
  30. price = 300 + 30 * pages
  31. if com4.match(classify):
  32. price = 300 + 30 * pages
  33. if com5.match(classify):
  34. price = 300 + 30 * pages
  35. if com6.match(classify):
  36. price = 0 + 40 * pages
  37. return price