217 lines
7.5 KiB
Plaintext
217 lines
7.5 KiB
Plaintext
import { HomeServiceCatalogType } from '@/types/home-service.uts'
|
|
import {
|
|
BookingDayOptionType,
|
|
BookingTimeSlotType
|
|
} from '@/utils/homeServiceBookingTime.uts'
|
|
|
|
// TODO: 接入真实服务分类、机构与可预约时段接口后替换这些 UI mock。
|
|
|
|
export type HomeServiceCategoryType = {
|
|
id: string
|
|
name: string
|
|
iconText: string
|
|
color: string
|
|
}
|
|
|
|
export type HomeServicePromoCardType = {
|
|
id: string
|
|
title: string
|
|
desc: string
|
|
tone: string
|
|
}
|
|
|
|
export type HomeServiceSceneCardType = {
|
|
id: string
|
|
title: string
|
|
subtitle: string
|
|
iconText: string
|
|
tone: string
|
|
categoryId: string
|
|
}
|
|
|
|
export type HomeServiceItemType = {
|
|
id: string
|
|
title: string
|
|
subtitle: string
|
|
category: string
|
|
price: number
|
|
unit: string
|
|
tags: Array<string>
|
|
imageText: string
|
|
suitableFor: string
|
|
}
|
|
|
|
export type HomeServiceAgencyType = {
|
|
id: string
|
|
name: string
|
|
distance: string
|
|
rating: string
|
|
summary: string
|
|
}
|
|
|
|
export type HomeServiceGuaranteeItemType = {
|
|
id: string
|
|
label: string
|
|
}
|
|
|
|
const HOME_SERVICE_CATEGORIES: Array<HomeServiceCategoryType> = [
|
|
{ id: 'basic-care', name: '基础照护', iconText: '护', color: '#EAFBF7' },
|
|
{ id: 'rehab-guide', name: '康复指导', iconText: '康', color: '#EFF6FF' },
|
|
{ id: 'medical-assist', name: '陪诊服务', iconText: '诊', color: '#FFF7ED' },
|
|
{ id: 'home-nursing', name: '上门护理', iconText: '护', color: '#EAF2FF' },
|
|
{ id: 'chronic-follow', name: '慢病随访', iconText: '访', color: '#ECFDF5' },
|
|
{ id: 'aging-friendly', name: '适老改造', iconText: '改', color: '#FFF1F2' },
|
|
{ id: 'home-cleaning', name: '居家保洁', iconText: '洁', color: '#F1F5F9' },
|
|
{ id: 'storage-plan', name: '收纳整理', iconText: '纳', color: '#FEF3C7' },
|
|
{ id: 'health-check', name: '健康评估', iconText: '评', color: '#E0F2FE' },
|
|
{ id: 'all-services', name: '全部服务', iconText: '全', color: '#E2E8F0' }
|
|
]
|
|
|
|
const HOME_SERVICE_PROMOS: Array<HomeServicePromoCardType> = [
|
|
{ id: 'consult', title: '人工客服', desc: '不确定服务怎么选?先问客服', tone: 'green' },
|
|
{ id: 'first-order', title: '新人首单', desc: '居家服务首单立减', tone: 'orange' },
|
|
{ id: 'senior-plan', title: '长者专享', desc: '适老照护套餐更安心', tone: 'blue' },
|
|
{ id: 'family-pack', title: '家庭护理包', desc: '康复 慢病 陪诊组合', tone: 'teal' }
|
|
]
|
|
|
|
const HOME_SERVICE_SCENES: Array<HomeServiceSceneCardType> = [
|
|
{ id: 'scene-1', title: '日常照护', subtitle: '全屋照护 协助起居', iconText: '日护', tone: 'green', categoryId: 'basic-care' },
|
|
{ id: 'scene-2', title: '术后康复', subtitle: '训练指导 上门陪练', iconText: '康复', tone: 'blue', categoryId: 'rehab-guide' },
|
|
{ id: 'scene-3', title: '慢病随访', subtitle: '血压血糖 健康记录', iconText: '随访', tone: 'teal', categoryId: 'chronic-follow' },
|
|
{ id: 'scene-4', title: '陪诊陪护', subtitle: '就医陪同 取药协助', iconText: '陪诊', tone: 'orange', categoryId: 'medical-assist' }
|
|
]
|
|
|
|
const FALLBACK_HOME_SERVICE_ITEMS: Array<HomeServiceItemType> = [
|
|
{ id: 'svc-ui-001', title: '基础照护到家', subtitle: '协助起居 用药提醒 生命体征监测', category: 'basic-care', price: 99, unit: '次', tags: ['平台认证', '服务保障', '可预约'], imageText: '照护', suitableFor: '老人 术后 家庭' },
|
|
{ id: 'svc-ui-002', title: '居家康复指导', subtitle: '术后恢复 动作训练 居家陪练', category: 'rehab-guide', price: 168, unit: '次', tags: ['康复指导', '方案清晰', '可连续预约'], imageText: '康复', suitableFor: '术后 康复 家庭' },
|
|
{ id: 'svc-ui-003', title: '陪诊协助服务', subtitle: '挂号陪同 检查陪同 取药协助', category: 'medical-assist', price: 128, unit: '次', tags: ['流程熟悉', '省心省时', '服务可追溯'], imageText: '陪诊', suitableFor: '老人 慢病 家庭' },
|
|
{ id: 'svc-ui-004', title: '慢病随访关怀', subtitle: '血压血糖记录 用药核对 健康宣教', category: 'chronic-follow', price: 118, unit: '次', tags: ['可预约', '记录留档', '明码标价'], imageText: '随访', suitableFor: '慢病 长者 家庭' }
|
|
]
|
|
|
|
const SERVICE_GUARANTEES: Array<HomeServiceGuaranteeItemType> = [
|
|
{ id: 'guarantee-1', label: '平台认证' },
|
|
{ id: 'guarantee-2', label: '明码标价' },
|
|
{ id: 'guarantee-3', label: '服务可追溯' },
|
|
{ id: 'guarantee-4', label: '异常可申诉' },
|
|
{ id: 'guarantee-5', label: '隐私保护' }
|
|
]
|
|
|
|
export function getHomeServiceCategories(): Array<HomeServiceCategoryType> {
|
|
return HOME_SERVICE_CATEGORIES.map((item) => ({ ...item }))
|
|
}
|
|
|
|
export function getHomeServicePromoCards(): Array<HomeServicePromoCardType> {
|
|
return HOME_SERVICE_PROMOS.map((item) => ({ ...item }))
|
|
}
|
|
|
|
export function getHomeServiceSceneCards(): Array<HomeServiceSceneCardType> {
|
|
return HOME_SERVICE_SCENES.map((item) => ({ ...item }))
|
|
}
|
|
|
|
function mapCatalogCategory(category: string): string {
|
|
if (category == '日常照护') {
|
|
return 'basic-care'
|
|
}
|
|
if (category == '康复支持') {
|
|
return 'rehab-guide'
|
|
}
|
|
if (category == '健康管理') {
|
|
return 'chronic-follow'
|
|
}
|
|
return 'all-services'
|
|
}
|
|
|
|
function getImageTextByCategory(categoryId: string): string {
|
|
if (categoryId == 'basic-care') {
|
|
return '照护'
|
|
}
|
|
if (categoryId == 'rehab-guide') {
|
|
return '康复'
|
|
}
|
|
if (categoryId == 'medical-assist') {
|
|
return '陪诊'
|
|
}
|
|
if (categoryId == 'home-nursing') {
|
|
return '护理'
|
|
}
|
|
if (categoryId == 'chronic-follow') {
|
|
return '随访'
|
|
}
|
|
return '服务'
|
|
}
|
|
|
|
export function getHomeServiceItems(catalog: Array<HomeServiceCatalogType>): Array<HomeServiceItemType> {
|
|
if (catalog.length == 0) {
|
|
return FALLBACK_HOME_SERVICE_ITEMS.map((item) => ({ ...item, tags: item.tags.slice(0) }))
|
|
}
|
|
|
|
const result: Array<HomeServiceItemType> = []
|
|
for (let i = 0; i < catalog.length; i++) {
|
|
const item = catalog[i]
|
|
const categoryId = mapCatalogCategory(item.category)
|
|
result.push({
|
|
id: item.id,
|
|
title: item.name,
|
|
subtitle: item.summary,
|
|
category: categoryId,
|
|
price: item.price,
|
|
unit: '次',
|
|
tags: item.tags.slice(0),
|
|
imageText: getImageTextByCategory(categoryId),
|
|
suitableFor: item.suitableFor
|
|
})
|
|
}
|
|
return result
|
|
}
|
|
|
|
export function getServiceGuarantees(): Array<HomeServiceGuaranteeItemType> {
|
|
return SERVICE_GUARANTEES.map((item) => ({ ...item }))
|
|
}
|
|
|
|
export function getRecommendedAgency(serviceId: string): HomeServiceAgencyType {
|
|
if (serviceId == 'svc-002') {
|
|
return {
|
|
id: 'agency-002',
|
|
name: '康宁居家康复中心',
|
|
distance: '距您 2.4km',
|
|
rating: '4.9',
|
|
summary: '擅长术后恢复、动作训练和连续上门指导。'
|
|
}
|
|
}
|
|
if (serviceId == 'svc-003') {
|
|
return {
|
|
id: 'agency-003',
|
|
name: '安护慢病管理服务站',
|
|
distance: '距您 1.8km',
|
|
rating: '4.8',
|
|
summary: '提供慢病随访、用药核对与健康宣教。'
|
|
}
|
|
}
|
|
return {
|
|
id: 'agency-001',
|
|
name: '梅江居家护理服务中心',
|
|
distance: '距您 1.2km',
|
|
rating: '4.9',
|
|
summary: '提供基础照护、上门护理和长者陪伴服务。'
|
|
}
|
|
}
|
|
|
|
export function getServiceIncludes(serviceId: string): Array<string> {
|
|
if (serviceId == 'svc-002') {
|
|
return ['康复动作指导', '居家练习建议', '阶段反馈记录']
|
|
}
|
|
if (serviceId == 'svc-003') {
|
|
return ['血压血糖监测', '用药核对', '健康宣教提醒']
|
|
}
|
|
return ['协助起居', '用药提醒', '基础生命体征监测']
|
|
}
|
|
|
|
export function getServiceExcludes(serviceId: string): Array<string> {
|
|
if (serviceId == 'svc-002') {
|
|
return ['高风险医疗操作', '院内康复器械治疗']
|
|
}
|
|
if (serviceId == 'svc-003') {
|
|
return ['静脉注射', '住院陪护']
|
|
}
|
|
return ['高风险处置', '住院陪护', '急诊陪诊']
|
|
} |