BalanceGoodsDeductionSetting.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Name: 芸众商城系统
  5. * Author: 广州市芸众信息科技有限公司
  6. * Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.yunzmall.com www.yunzshop.com
  7. * Date: 2021/6/15
  8. * Time: 11:02
  9. */
  10. namespace app\frontend\modules\finance\deduction\deductionSettings;
  11. use app\frontend\modules\deduction\DeductionSettingInterface;
  12. class BalanceGoodsDeductionSetting implements DeductionSettingInterface
  13. {
  14. //这个开关是获取商品设置的值是回去统一设置的
  15. public function getWeight()
  16. {
  17. return 10;
  18. }
  19. /**
  20. * @var \app\frontend\models\goods\Sale
  21. */
  22. private $setting;
  23. function __construct($goods)
  24. {
  25. $this->setting = $goods->hasOneSale;
  26. }
  27. // todo 将运费抵扣分离出去
  28. public function isEnableDeductDispatchPrice()
  29. {
  30. return false;
  31. }
  32. public function isMaxDisable()
  33. {
  34. return !\Setting::get('finance.balance.balance_deduct') || empty($this->setting->balance_deduct);
  35. }
  36. public function isMinDisable()
  37. {
  38. return !\Setting::get('finance.balance.balance_deduct') || empty($this->setting->balance_deduct);
  39. }
  40. /**
  41. * 不抵扣运费
  42. * @return bool
  43. */
  44. public function isDispatchDisable()
  45. {
  46. return true;
  47. }
  48. public function getMaxFixedAmount()
  49. {
  50. return $this->setting->max_balance_deduct?:false;
  51. }
  52. public function getMaxPriceProportion()
  53. {
  54. return false;
  55. }
  56. public function getMaxDeductionType()
  57. {
  58. if (empty($this->setting->max_balance_deduct)) {
  59. return false;
  60. }
  61. return 'FixedAmount';
  62. }
  63. public function getMinDeductionType()
  64. {
  65. if (empty($this->setting->min_balance_deduct)) {
  66. return false;
  67. }
  68. return 'FixedAmount';
  69. }
  70. public function getMinFixedAmount()
  71. {
  72. return $this->setting->min_balance_deduct?:false;
  73. }
  74. public function getMinPriceProportion()
  75. {
  76. return false;
  77. }
  78. public function getDeductionAmountType()
  79. {
  80. return false;
  81. }
  82. public function getAffectDeductionAmount()
  83. {
  84. return false;
  85. }
  86. }