modify project package

dev_aliyun
p31729568 5 years ago
parent 044e6ebb74
commit 93274f78f2

@ -101,7 +101,7 @@ module Mobile
requires :content, type: String, desc: '描述'
optional :attachment_ids, type: Array[Integer], desc: '附件ID数组'
requires :deadline_at, type: DateTime, desc: '截止日期'
requires :min_price, type: Float, desc: '最小费用'
optional :min_price, type: Float, desc: '最小费用'
optional :max_price, type: Float, desc: '最大费用'
requires :contact_name, type: String, desc: '联系人姓名'
requires :contact_phone, type: String, desc: '联系人手机号'
@ -129,7 +129,7 @@ module Mobile
requires :content, type: String, desc: '描述'
optional :attachment_ids, type: Array[Integer], desc: '附件ID数组'
requires :deadline_at, type: DateTime, desc: '截止日期'
requires :min_price, type: Float, desc: '最小费用'
optional :min_price, type: Float, desc: '最小费用'
optional :max_price, type: Float, desc: '最大费用'
requires :contact_name, type: String, desc: '联系人姓名'
requires :contact_phone, type: String, desc: '联系人手机号'

@ -22,8 +22,8 @@ class ProjectPackage < ActiveRecord::Base
validates :deadline_at, presence: true
validates :contact_name, presence: true, length: { maximum: 20 }
validates :contact_phone, presence: true, format: { with: /1\d{10}/ }
validates :min_price, numericality: { greater_than: 0 }
validates :max_price, numericality: { greater_than: ->(obj){ obj.min_price } }, allow_blank: true
validates :min_price, numericality: { greater_than: 0 }, allow_blank: true
validates :max_price, numericality: { greater_than: ->(obj){ obj.min_price.to_f } }, allow_blank: true
aasm(:status) do
state :pending, initiali: true

@ -46,7 +46,9 @@
</div>
<div class="item-head-blank"></div>
<div class="item-head-price">
<% if object.max_price && object.max_price != object.min_price %>
<% if object.min_price.blank? && object.max_price.blank? %>
可议价
<% elsif object.max_price && object.max_price != object.min_price %>
<span>¥</span><%= object.min_price %>~<span>¥</span><%= object.max_price %>
<% else %>
<span>¥</span><%= object.min_price %>

Loading…
Cancel
Save