对接接口

This commit is contained in:
wangxiaowei
2025-12-17 00:45:31 +08:00
parent 977f7d4038
commit 018a784a8c
20 changed files with 455 additions and 816 deletions

View File

@ -1,5 +1,6 @@
<!-- 使用 type="home" 属性设置首页其他页面不需要设置默认为page -->
<route lang="jsonc" type="home">{
"needLogin": true,
"layout": "tabbar",
"style": {
// 'custom' 表示开启自定义导航栏,默认 'default'
@ -14,7 +15,7 @@
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent !important;">
<template #left>
<view class="flex items-center line-1 w-450rpx" @click="router.navigateTo('/bundle/account/switch')">
<view class="mr-10rpx font-400 leading-44rpx text-32rpx pl-10rpx line-1">茶址24小时智能茶室(中新店)</view>
<view class="mr-10rpx font-400 leading-44rpx text-32rpx pl-10rpx line-1">{{ useStore.defaultStore.name || '暂无门店信息' }}</view>
<wd-img width="14rpx" height="9rpx" :src="`${OSS}icon/icon_arrow_down.png`" />
</view>
</template>
@ -124,20 +125,12 @@
<script lang="ts" setup>
import { router } from '@/utils/tools'
import { getStoreList, getStoreDetails } from '@/api/store'
import { useStoreStore } from '@/store'
const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight')
// 分页
const downOption = {
auto: true
}
const upOption = {
auto: true,
textNoMore: '~ 已经到底啦 ~', //无更多数据的提示
}
const keywords = ref<string>('')
const list = ref<Array<any>>([])
const useStore = useStoreStore()
// 扫码验券弹出框
const showScanMenu = ref<boolean>(false)
@ -153,16 +146,65 @@
}
])
// 门店列表
const storeList = ref<Array<any>>([])
const defaultStore = ref<{ id: number; name: string; index: number }>({
id: 0,
name: '',
index: 0
})
const store = ref<any>({})
onLoad(async() => {
onShow(() => {
// 初始化页面数据
Index.handleInit()
})
onLoad(async() => {
})
const Index = {
handleInit: async() => {
await Index.handleGetStoreList()
await Index.handleGetStoreDetails()
},
/**
* 获取门店列表
*/
handleGetStoreList: async() => {
console.log("🚀 ~ Index.handleGetStoreList:", 'Index.handleGetStoreLis123')
const storeLists = await getStoreList()
// 保证 storeList.value 一定为数组
storeList.value = Array.isArray(storeLists.list) ? storeLists.list : Object.values(storeLists.list || {})
console.log("🚀 ~ storeList.value:", storeList.value)
console.log("🚀 ~ storeList.value:", storeList.value.length)
if (storeList.value.length > 0) {
useStore.setStoreList(storeList.value)
// 如果没有设置默认门店的话则设置第一个门店为默认门店
console.log("🚀 ~ useStore.defaultStore:", useStore.defaultStore)
if (useStore.defaultStore.id == 0) {
useStore.setDefaultStore({
id: storeList.value[0].id,
name: storeList.value[0].name,
index: 0
})
}
}
},
/**
* 获取门店详情
*/
handleGetStoreDetails: async() => {
if (!defaultStore.value) return
const storeDetails = await getStoreDetails(useStore.defaultStore.id)
store.value = storeDetails.details
console.log("🚀 ~ storeDetails:", storeDetails)
},
/**
@ -193,6 +235,13 @@
}
})
},
/**
* 一键续订时间
*/
handleChooseRenewTime: (item) => {
console.log("🚀 ~ item:", item)
}
}
</script>