MarketDealPrice.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\common\modules\goodsOption\dealPrice;
  3. use app\common\facades\Setting as SettingFacades;
  4. use app\frontend\modules\orderGoods\price\adapter\GoodsAdapterManager;
  5. class MarketDealPrice extends BaseDealPrice
  6. {
  7. public function getDealPrice()
  8. {
  9. return $this->goodsOption->market_price;
  10. }
  11. /**
  12. * @return bool
  13. * @throws \app\common\exceptions\MemberNotLoginException
  14. */
  15. public function enable()
  16. {
  17. $level_discount_set = SettingFacades::get('discount.all_set');
  18. if (!isset($level_discount_set['type'])) {
  19. return false;
  20. }
  21. if ($level_discount_set['type'] != 1) {
  22. return false;
  23. }
  24. $priceAdapter = $this->goodsOption->getGoodsOptionPriceAdapter();
  25. $priceAdapter->setAppointPrice($this->goodsOption->market_price);
  26. if (!$this->goodsOption->memberLevelDiscount()->getAmount($priceAdapter)) {
  27. return false;
  28. }
  29. return true;
  30. }
  31. public function getWeight()
  32. {
  33. return 100;
  34. }
  35. }