浏览代码

add balance promotion shop promotion

abiao 4 年之前
父节点
当前提交
8b3df76d96
共有 3 个文件被更改,包括 22 次插入4 次删除
  1. 2 0
      app/models/balance.rb
  2. 18 4
      app/models/present.rb
  3. 2 0
      app/models/shop_promotion.rb

+ 2 - 0
app/models/balance.rb

@@ -16,6 +16,8 @@ class Balance < ActiveRecord::Base
                  ["部分退款", "part_refunded"],
                  ["部分退款", "part_refunded"],
                  ["佣金转提货券","cash_to_balance"],
+                 ["店长促销赠送","shop_promotion"],
+                 ["充值促销赠送","balance_promotion"],
                  ["促销赠送","promotion"]]
 
   def remain_sum

+ 18 - 4
app/models/present.rb

@@ -4,7 +4,9 @@ class Present < ActiveRecord::Base
   self.table_name = "presents"
   validates :code,:name,:remark,presence: true
   belongs_to :wx_user
-
+  SOURCE_ENUM = [["店长促销发放", "shop"],
+                 ["充值促销发放", "balance"],
+                 ]
   def send_product
     prd1 = Product.where("id = ?", self.send_prod1).first
     if !prd1.blank?
@@ -41,7 +43,11 @@ class Present < ActiveRecord::Base
       field :send_product
       field :order_id
       field :status
-      field :source
+      field :source, :enum do
+        enum do
+          SOURCE_ENUM
+        end
+      end
       field :remark
       field :created_at
       # field :updated_at
@@ -66,7 +72,11 @@ class Present < ActiveRecord::Base
       field :send_nums1
       field :order_id
       field :status
-      field :source
+      field :source, :enum do
+        enum do
+          SOURCE_ENUM
+        end
+      end
       field :remark
       field :created_at
       # field :updated_at
@@ -80,7 +90,11 @@ class Present < ActiveRecord::Base
       field :send_nums1
       field :order_id
       field :status
-      field :source
+      field :source, :enum do
+        enum do
+          SOURCE_ENUM
+        end
+      end
       field :remark
       field :remark    
     end

+ 2 - 0
app/models/shop_promotion.rb

@@ -113,6 +113,8 @@ class ShopPromotion < ActiveRecord::Base
           field :send_prodcut1
           field :send_prodcut2
           field :send_prodcut3
+          field :send_prodcut4
+          field :send_prodcut5
           field :cash do
             label "代办金(元)"
             formatted_value do # used in form views