GoodsOptionPriceAdapter.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/9/3
  6. * Time: 15:28
  7. */
  8. namespace app\frontend\modules\orderGoods\price\adapter;
  9. class GoodsOptionPriceAdapter extends BaseGoodsPriceAdapter
  10. {
  11. public function getPrice()
  12. {
  13. return $this->goods()->product_price;
  14. }
  15. public function getCostPrice()
  16. {
  17. return $this->goods()->cost_price;
  18. }
  19. public function getMarketPrice()
  20. {
  21. return $this->goods()->market_price;
  22. }
  23. protected function getDefaultDealPrice()
  24. {
  25. $level_discount_set = \Setting::get('discount.all_set');
  26. switch ($level_discount_set['type']) {
  27. case 1:
  28. $deal_price = $this->getMarketPrice();
  29. break;
  30. default:
  31. $deal_price = $this->getPrice();
  32. }
  33. return $deal_price;
  34. }
  35. protected function _getDealPrice()
  36. {
  37. return $this->goods()->deal_price;
  38. }
  39. protected function goods()
  40. {
  41. return $this->goods;
  42. }
  43. }