Explorar o código

order base detail export edit

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

+ 8 - 1
app/models/order.rb

@@ -14,6 +14,12 @@ class Order < ActiveRecord::Base
 
     before_save :before_save
     #after_update :after_update
+    scope :所有订单, -> {}
+    scope :未支付, -> { where("status=?","unpay") }
+    scope :已关闭, -> { where("status=?","closed") }
+    scope :处理中, -> { where("status=?","processing") }
+    scope :待收货, -> { where("status=?","dispatch") }
+    scope :已完成, -> { where("status=?","complete") }
 
     def before_save
         if self.express_company.length>0
@@ -221,7 +227,8 @@ class Order < ActiveRecord::Base
             end
         end
 
-        show do 
+        show do
+            scopes [nil,:未支付,:已关闭,:处理中,:待收货,:已完成]
             field :id 
             field :order_id
             field :wx_user