// utils/city.js // 服务城市白名单:与 api/health/resource/services.js 的 SERVICE_AREAS 保持一致。 // value 带「市」,用于入库与订单 hospital.province 匹配;label 仅用于展示。 const CITY_OPTIONS = [ { value: '北京市', label: '北京' }, { value: '上海市', label: '上海' }, { value: '天津市', label: '天津' }, { value: '西安市', label: '西安' } ] const CITY_LABELS = CITY_OPTIONS.map((item) => item.label) function cityIndex(value) { const index = CITY_OPTIONS.findIndex((item) => item.value === value) return index > -1 ? index : 0 } function cityLabel(value) { const item = CITY_OPTIONS.find((option) => option.value === value) return item ? item.label : (value || '') } module.exports = { CITY_OPTIONS, CITY_LABELS, cityIndex, cityLabel }