json.data do json.array! @sales_details do |d| json.id d.id json.business_id d.business_id json.number d.business.number json.name d.business.name json.department d.business.department&.name json.school d.business.department&.school&.name json.school_id d.business.department&.school_id json.actual_amount d.business.last_follow_up&.actual_amount.to_f.round(2) json.created_at d.created_at.to_s json.staff_manages d.business.last_follow_up&.assign_follow_ups.present? ? (d.business.last_follow_up.assign_follow_ups.map{ |d| d.staff.user.real_name}.join("、")) : d.business.staff&.user&.real_name json.area d.business.department&.school&.province json.majors d.business.department&.department_majors&.pluck(:name).present? ? d.business.department&.department_majors&.pluck(:name).join(",") : "" json.signed_department d.business.last_follow_up&.signed_department&.school&.name || '' json.item_clazz d.product_catalog.item_clazz json.brand d.product_catalog.brand json.specification d.product_catalog.specification json.unit d.product_catalog.unit json.amount d.amount json.total_price d.total_price json.source_method d.product_catalog.source_method json.custom_clazz d.custom_clazz json.supplier d.product_catalog.supplier json.delivery_date d.delivery_date end end json.code 0 json.count @sales_details.total_count json.msg 'succcess'