Kaynağa Gözat

order base detail export edit

abiao 4 yıl önce
ebeveyn
işleme
ac811d2197
1 değiştirilmiş dosya ile 8 ekleme ve 1 silme
  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