Explorar o código

order base detail export edit

abiao %!s(int64=4) %!d(string=hai) anos
pai
achega
6a9acb2f4a
Modificáronse 1 ficheiros con 23 adicións e 1 borrados
  1. 23 1
      app/models/order_base_detail.rb

+ 23 - 1
app/models/order_base_detail.rb

@@ -26,7 +26,20 @@ class OrderBaseDetail < ActiveRecord::Base
       return "--"
     end
   end
-  DT_STATUS_ENUM = [["未支付","unpay"],["已关闭","closed"],["待确认","unconfirmed"],["处理中","processing"],["已完成","complete"],["待收货","dispatch"],["已退款","refunded"]]
+
+
+  def get_order_pay_way(x)
+    case x
+    when "weixinpay"
+      return "微信支付"
+    when "balance"
+      return "提货券支付"
+    when "cent"
+      return "积分支付"
+    else
+      return "--"
+    end
+  end
 
   rails_admin do
     navigation_label '订单基本明细'
@@ -59,6 +72,15 @@ class OrderBaseDetail < ActiveRecord::Base
             end
           end
       end
+
+      field :pay_way do
+        filterable true
+        formatted_value do
+          if !bindings[:object].order.blank?
+            bindings[:object].get_order_pay_way(bindings[:object].order.pay_way)
+          end
+        end
+      end
       field :send
     end
     show do