Browse Source

order add cent price

abiao 5 years ago
parent
commit
210f77032d
3 changed files with 21 additions and 7 deletions
  1. 8 3
      app/models/cent_balance.rb
  2. 11 4
      app/models/order.rb
  3. 2 0
      config/locales/models/order.yml

+ 8 - 3
app/models/cent_balance.rb

@@ -7,10 +7,15 @@ class CentBalance < ActiveRecord::Base
   attr_accessor :remain_sum
 
   SOURCE_ENUM = [["首次登录", "first_login"],
-                 ["新人注册", "new_man"],
-                 ["签到打卡", "check_in"],
+                 ["新人注册",  "new_man"],
+                 ["签到第一天", "one_day"],
+                 ["签到第二天", "two_day"],
+                 ["签到第三天", "four_day"],
+                 ["签到第四天", "five_day"],
+                 ["签到第五天", "six_day"],
+                 ["签到第六天", "seven_day"],
+                 ["购物扣除", "exchange_product"],
                ]
-
   def remain_sum
     b = CentBalance.where("wx_uid = ? and id < ?", self.wx_uid, self.id).last
     if !b.blank?

+ 11 - 4
app/models/order.rb

@@ -30,7 +30,7 @@ class Order < ActiveRecord::Base
 
     end
     STATUS_ENUM = [["未支付","unpay"],["已关闭","closed"],["待确认","unconfirmed"],["处理中","processing"],["已完成","complete"],["待收货","dispatch"],["已退款","refunded"]]
-    TYPE_ENUM = [["普通",0],["秒杀",1],["店长",2]]
+    TYPE_ENUM = [["普通",0],["秒杀",1],["店长",2],["积分",3]]
     EXP_ENUM =  []
 
     expressCompanys = ExpressCompany.order("id asc")
@@ -40,9 +40,9 @@ class Order < ActiveRecord::Base
     end
 
     PAY_WAY_ENUM = [
-
-    ["微信支付","weixinpay"],
-    ["代金券支付","balance"],
+     ["微信支付","weixinpay"],
+     ["代金券支付","balance"],
+     ["积分支付","cent"],
     ]
 
     SOURCE_ENUM = [["小程序","xcx"],["公众号","gzh"],["第五创系统","d5c_sys"]]
@@ -103,6 +103,11 @@ class Order < ActiveRecord::Base
         end
     end
 
+    def cent_price_format
+        paied_price_f = self.cent_price!=0 ? ((self.cent_price)/100.0) :0
+        return paied_price_f.to_s #+ "代金券"
+    end
+
     def coupon_price_format
         coupon_price_f = self.coupon_price!=0 ? ((self.coupon_price)/100.0) :0
         return coupon_price_f.to_s
@@ -154,6 +159,7 @@ class Order < ActiveRecord::Base
                 visible true
             end
             field :coupon_price_format
+            field :cent_price_format
             field :paied_price_format do
                 visible true
             end
@@ -217,6 +223,7 @@ class Order < ActiveRecord::Base
                 end
             end
             field :coupon_price_format
+            field :cent_price_format
             field :paied_price_format
             field :buy_price
             field :trade_no

+ 2 - 0
config/locales/models/order.yml

@@ -20,6 +20,8 @@ zh-CN:
        total_price_format: 订单总价
        paied_price_format: 微信支付(元)
        paied_price: 实付金额(分)
+       cent_price: 积分金额(分)
+       cent_price_format: 积分支付(元)
        coupon_price_format: 用券金额(元)
        coupon_price: 用券金额(分)
        buy_price: 进货现金总价(分)