OrderGoodsDeductionAmount.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: shenyang
  5. * Date: 2017/10/13
  6. * Time: 下午5:10
  7. */
  8. namespace app\frontend\modules\deduction\orderGoods\amount;
  9. use app\frontend\modules\deduction\GoodsDeduction;
  10. use app\common\modules\orderGoods\models\PreOrderGoods;
  11. /**
  12. * 订单商品抵扣金额基类
  13. * Class OrderGoodsDeductionAmount
  14. * @package app\frontend\modules\deduction\orderGoods\amount
  15. */
  16. abstract class OrderGoodsDeductionAmount
  17. {
  18. /**
  19. * 订单商品
  20. * @var PreOrderGoods
  21. */
  22. protected $orderGoods;
  23. /**
  24. * 商品抵扣设置
  25. * @var GoodsDeduction
  26. */
  27. protected $goodsDeduction;
  28. function __construct(PreOrderGoods $orderGoods, GoodsDeduction $goodsDeduction)
  29. {
  30. $this->orderGoods = $orderGoods;
  31. $this->goodsDeduction = $goodsDeduction;
  32. }
  33. /**
  34. * @return GoodsDeduction
  35. */
  36. protected function getGoodsDeduction()
  37. {
  38. return $this->goodsDeduction;
  39. }
  40. /**
  41. * @return PreOrderGoods
  42. */
  43. protected function getOrderGoods()
  44. {
  45. return $this->orderGoods;
  46. }
  47. /**
  48. * 最大抵扣金额
  49. * @return float
  50. */
  51. abstract public function getMaxAmount();
  52. /**
  53. * 最少抵扣金额
  54. * @return mixed
  55. */
  56. abstract public function getMinAmount();
  57. abstract function hasMinAmount();
  58. }