Module: RailsTrade::PromoteCharge
- Extended by:
- ActiveSupport::Concern
- Included in:
- PromoteCharge
- Defined in:
- app/models/rails_trade/promote_charge.rb
Defined Under Namespace
Modules: CashPromoteCharge, DiscountPromoteCharge, FinalPromoteCharge, MinusPromoteCharge, PlusPromoteCharge
Constant Summary collapse
- COLUMN_NAMES =
[ 'id', 'promote_id', 'min', 'max', 'filter_min', 'filter_max', 'contain_min', 'contain_max', 'parameter', 'base_price', 'type', 'metering', 'unit', 'created_at', 'updated_at' ].freeze
Instance Method Summary collapse
- #compute_filter_value ⇒ Object
- #extra ⇒ Object
-
#final_price(amount = 1) ⇒ Object
amount: 商品价格 return 计算后的价格.
Instance Method Details
#compute_filter_value ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/models/rails_trade/promote_charge.rb', line 49 def compute_filter_value if contain_min self.filter_min = min else self.filter_min = min + self.class.min_step end if contain_max self.filter_max = max else self.filter_max = max - self.class.max_step end end |
#extra ⇒ Object
62 63 64 |
# File 'app/models/rails_trade/promote_charge.rb', line 62 def extra self.attributes.slice(*PromoteCharge.extra_columns) end |
#final_price(amount = 1) ⇒ Object
amount: 商品价格 return 计算后的价格
45 46 47 |
# File 'app/models/rails_trade/promote_charge.rb', line 45 def final_price(amount = 1) raise 'Should Implement in Subclass' end |