完善下单逻辑及其ui展示,修复支付倒计时显示错误bug

This commit is contained in:
2026-05-25 15:35:41 +08:00
parent d25f80ccdd
commit cecb51a8e2
40 changed files with 13040 additions and 3217 deletions

View File

@@ -89,6 +89,8 @@ import ServicePanel from '@/components/homeService/ServicePanel.uvue'
import ServiceStatusTag from '@/components/homeService/ServiceStatusTag.uvue'
import { fetchConsumerHomeServiceCases, fetchHomeServiceCatalog } from '@/services/homeServiceService.uts'
import { HomeServiceCatalogType, HomeServiceCaseType } from '@/types/home-service.uts'
import { getCurrentUser, getCurrentUserId } from '@/utils/store.uts'
import { goToLogin } from '@/utils/utils.uts'
import {
HomeServiceCategoryType,
HomeServiceItemType,
@@ -125,9 +127,23 @@ async function loadData() {
categoryGrid.value = getHomeServiceCategories()
promoCards.value = getHomeServicePromoCards()
services.value = await fetchHomeServiceCatalog()
const user = await getCurrentUser()
if (user == null || getCurrentUserId() == '') {
cases.value = [] as Array<HomeServiceCaseType>
return
}
cases.value = await fetchConsumerHomeServiceCases()
}
async function ensureLogin(redirectUrl: string): Promise<boolean> {
const user = await getCurrentUser()
if (user == null || getCurrentUserId() == '') {
goToLogin(redirectUrl)
return false
}
return true
}
function switchCategory(categoryId: string) {
selectedCategory.value = categoryId
}
@@ -141,11 +157,21 @@ function goDetail(serviceId: string) {
}
function goBooking(serviceId: string) {
uni.navigateTo({ url: '/pages/mall/consumer/home-service/service-detail?id=' + serviceId + '&mode=booking' })
ensureLogin('/pages/mall/consumer/home-service/service-detail?id=' + serviceId + '&mode=booking').then((ok) => {
if (!ok) {
return
}
uni.navigateTo({ url: '/pages/mall/consumer/home-service/service-detail?id=' + serviceId + '&mode=booking' })
})
}
function goOrderDetail(caseId: string) {
uni.navigateTo({ url: '/pages/mall/consumer/home-service/order-detail?id=' + caseId })
ensureLogin('/pages/mall/consumer/home-service/order-detail?id=' + caseId).then((ok) => {
if (!ok) {
return
}
uni.navigateTo({ url: '/pages/mall/consumer/home-service/order-detail?id=' + caseId })
})
}
function goDetailByName(serviceName: string) {