feat:"完成页面接口的对接"
This commit is contained in:
@@ -101,14 +101,16 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { getServiceProcess } from '@/api/index.uts'
|
||||
import { getServiceProcess, getActiveServices } from '@/api/index.uts'
|
||||
|
||||
// 服务类型
|
||||
type ServiceType = {
|
||||
id : string
|
||||
id : number
|
||||
name : string
|
||||
desc : string
|
||||
emoji : string
|
||||
type : string
|
||||
basePrice : number
|
||||
}
|
||||
|
||||
// 流程类型
|
||||
@@ -134,15 +136,16 @@
|
||||
}
|
||||
|
||||
// 服务类型数据
|
||||
const serviceTypes = ref<ServiceType[]>([
|
||||
{ id: 'repair', name: '局部修复', desc: '破损、划痕修复', emoji: '🔧' },
|
||||
{ id: 'recolor', name: '改色翻新', desc: '皮面改色换新', emoji: '🎨' },
|
||||
{ id: 'refurbish', name: '整体翻新', desc: '全面翻新升级', emoji: '✨' },
|
||||
{ id: 'custom', name: '定制换皮', desc: '个性化定制', emoji: '💎' }
|
||||
])
|
||||
const serviceTypes = ref<ServiceType[]>([])
|
||||
|
||||
// 服务流程
|
||||
const processList = ref<ProcessItem[]>([])
|
||||
const processList = ref<ProcessItem[]>([
|
||||
{ step: 1, title: '在线预约', description: '填写信息,预约上门时间' },
|
||||
{ step: 2, title: '上门评估', description: '专业师傅免费上门勘察' },
|
||||
{ step: 3, title: '确认方案', description: '沟通翻新方案和价格' },
|
||||
{ step: 4, title: '取件翻新', description: '取回沙发进行专业翻新' },
|
||||
{ step: 5, title: '送货验收', description: '送货上门,满意付款' }
|
||||
])
|
||||
|
||||
// 材质说明
|
||||
const materials = ref<MaterialItem[]>([
|
||||
@@ -201,23 +204,45 @@
|
||||
}
|
||||
])
|
||||
|
||||
// 获取服务流程
|
||||
const fetchServiceProcess = async () => {
|
||||
// 获取服务列表
|
||||
const fetchServices = async () => {
|
||||
try {
|
||||
const res = await getServiceProcess()
|
||||
const data = res.data as UTSJSONObject[]
|
||||
processList.value = data.map((item) : ProcessItem => {
|
||||
return {
|
||||
step: item['step'] as number,
|
||||
title: item['title'] as string,
|
||||
description: item['description'] as string
|
||||
} as ProcessItem
|
||||
})
|
||||
const res = await getActiveServices()
|
||||
if (res.code == 0 && res.data != null) {
|
||||
const data = res.data as UTSJSONObject
|
||||
const list = data['list'] as UTSJSONObject[] || []
|
||||
|
||||
// 服务类型emoji映射
|
||||
const emojiMap = {
|
||||
fabric: '🛋️',
|
||||
leather: '💺',
|
||||
cleaning: '✨',
|
||||
repair: '🔧',
|
||||
custom: '💎'
|
||||
} as UTSJSONObject
|
||||
|
||||
serviceTypes.value = list.map((item) : ServiceType => {
|
||||
const type = item['type'] as string
|
||||
return {
|
||||
id: item['id'] as number,
|
||||
name: item['name'] as string,
|
||||
desc: item['description'] as string,
|
||||
emoji: emojiMap[type] as string || '🛋️',
|
||||
type: type,
|
||||
basePrice: item['basePrice'] as number
|
||||
} as ServiceType
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('获取服务流程失败', e)
|
||||
console.error('获取服务列表失败', e)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取服务流程(暂时使用固定数据)
|
||||
const fetchServiceProcess = async () => {
|
||||
// 流程数据已在初始化时设置
|
||||
}
|
||||
|
||||
// 切换FAQ展开
|
||||
const toggleFaq = (index : number) => {
|
||||
faqList.value[index].expanded = !faqList.value[index].expanded
|
||||
@@ -238,6 +263,7 @@
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
fetchServices()
|
||||
fetchServiceProcess()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user