Commit abc08581 by ivan Lan

Add status_zh to Product & Snapshot & Order

parent db2d7671
json.extract! order, :id, :seq, :address,
json.extract! order, :id, :seq, :status_zh, :address,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost,
:merchant_remark, :mark, :customer_remark,
:status, :meta
:status, :status_zh, :meta
json.snapshots, partial: 'shotengai/share/snapshot_simple', as: :series
\ No newline at end of file
......@@ -2,4 +2,4 @@ json.extract! order, :id, :seq, :address,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost,
:merchant_remark, :mark, :customer_remark,
:status, :meta
\ No newline at end of file
:status, :status_zh, :meta
\ No newline at end of file
json.extract! product, :id, :title, :status, :need_express, :need_time_attr,
json.extract! product, :id, :title, :status, :status_zh,
:need_express, :need_time_attr,
:cover_image, :banners, :spec, :detail, :meta
# TODO: NOTE: catalog_list is only vaild in the template example
json.catalog_list product.catalog_list
......
json.extract! product, :id, :title, :status, :need_express, :cover_image
\ No newline at end of file
json.extract! product, :id, :title, :status, :status_zh,
:need_express, :cover_image
\ No newline at end of file
json.extract! snapshot, :id, :original_price, :price, :count,
:product_status_zh, :order_status_zh,
:spec, :banners, :cover_image, :detail, :meta
\ No newline at end of file
json.extract! snapshot, :id, :original_price, :price, :count,
:product_status_zh, :order_status_zh,
:total_price, :total_original_price, :revised_amount
:spec, :cover_image, :meta
\ No newline at end of file
......@@ -47,7 +47,16 @@ module Shotengai
}.each { |name, options|
event(name) { transitions options }
}
end
def status_zh
{
unpaid: '未支付',
paid: '已支付',
delivering: '运送中',
received: '已收货',
evaluated: '已评价',
}[ status ]
end
def fill_snapshot
......
......@@ -38,6 +38,14 @@ module Shotengai
event :soft_delete { transitions from: [:on_sale, :no_on], to: :deleted }
end
def status_zh
{
on_on: '未上架',
on_sale: '已上架',
deleted: '已删除'
}[ status ]
end
def default_series
Shotengai::Series.find_by_id(default_series_id) || series.first
end
......
......@@ -31,6 +31,9 @@ module Shotengai
validate :check_spec, if: :spec
validates :count, numericality: { only_integer: true, greater_than: 0 }
delegate :product_status_zh, to: :product
delegate :order_status_zh, to: :order
class << self
def inherited subclass
product_name = /^(.+)Snapshot/.match(subclass.name)[1]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment