优化功能

This commit is contained in:
wangxiaowei
2026-05-06 11:00:14 +08:00
parent 97759cdbad
commit bd10660fcd
7 changed files with 86 additions and 18 deletions

View File

@ -4,7 +4,7 @@ import { http } from '@/http/alova'
* 获取首页轮播图 * 获取首页轮播图
*/ */
export function getHomeBannerList() { export function getHomeBannerList() {
return http.Post<{ list: Array<{ address: string;}> }>('/api/index/carouselLists', null, return http.Post<{ list: Array<{ address: string;}> }>('/api/index/carouselLists', {},
{ {
meta: { ignoreAuth: true } meta: { ignoreAuth: true }
} }
@ -28,3 +28,15 @@ export function claimIndexCoupon(id: number) {
export function getWxacode() { export function getWxacode() {
return http.Post('/api/wxCode/getWxacode', {}) return http.Post('/api/wxCode/getWxacode', {})
} }
/**
* 获取茶艺师入口图
*/
export function getTeaArtistEntrance() {
return http.Post<any>('/api/index/homeImage', {},
{
meta: { ignoreAuth: true }
}
)
}

View File

@ -15,7 +15,7 @@
<wd-popup v-model="showReservePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" <wd-popup v-model="showReservePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;"
position="bottom"> position="bottom">
<view class="relative"> <view class="relative">
<view class="absolute top-18rpx right-30rpx" @click="showReservePopup = false"> <view class="absolute top-18rpx right-30rpx" @tap.stop.prevent="Door.handleCloseReservePopup">
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img> <wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
</view> </view>
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">选择时间</view> <view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">选择时间</view>
@ -49,9 +49,9 @@
<view class="pb-22rpx mt-40rpx mx-30rpx flex justify-between items-center text-[32rpx] text-center"> <view class="pb-22rpx mt-40rpx mx-30rpx flex justify-between items-center text-[32rpx] text-center">
<view class='bg-[#F6F7F8] text-[#303133] rounded-8rpx h-90rpx leading-90rpx w-[50%] mr-28rpx' <view class='bg-[#F6F7F8] text-[#303133] rounded-8rpx h-90rpx leading-90rpx w-[50%] mr-28rpx'
@click="Door.handleResetTime">重置</view> @tap.stop.prevent="Door.handleResetTime">重置</view>
<view class='bg-[#4C9F44] text-[#fff] rounded-8rpx h-90rpx leading-90rpx w-[50%]' <view class='bg-[#4C9F44] text-[#fff] rounded-8rpx h-90rpx leading-90rpx w-[50%]'
@click="Door.handleConfirmHour">确定({{ totalHour }}小时)</view> @tap.stop.prevent="Door.handleConfirmHour">确定({{ totalHour }}小时)</view>
</view> </view>
</view> </view>
</wd-popup> </wd-popup>
@ -372,10 +372,11 @@
<view class="bg-white py-26rpx px-30rpx mt-20rpx" @click="Reserve.handleToCoupon(CouponType.Discount)"> <view class="bg-white py-26rpx px-30rpx mt-20rpx" @click="Reserve.handleToCoupon(CouponType.Discount)">
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">优惠券</view> <view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">优惠券</view>
<view class="flex items-center justify-between"> <view class="flex items-center justify-between">
<view class="text-[26rpx] text-[#606266] leading-36rpx">优惠券</view> <view class="text-[26rpx] text-[#606266] leading-36rpx">茶址优惠券</view>
<view class="flex items-center"> <view class="flex items-center">
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right"> <view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
<template v-if="selectedCoupon?.id > 0"> <template v-if="selectedCoupon?.id > 0">
<text class="bg-#FEF1F0 text-#FF5951 rounded-6rpx text-center text-22rpx leading-40rpx px-10rpx py-2rpx">待使用</text>
{{ selectedCoupon.name }} {{ selectedCoupon.name }}
</template> </template>
<template v-else> <template v-else>
@ -1083,6 +1084,13 @@ const Door = {
return `${year}-${month}-${day} ${hour}:${minute}` return `${year}-${month}-${day} ${hour}:${minute}`
}, },
handleCloseReservePopup: () => {
uni.hideKeyboard()
setTimeout(() => {
showReservePopup.value = false
}, 50)
},
/** /**
* 重置预定时间 * 重置预定时间
*/ */
@ -1124,7 +1132,7 @@ const Door = {
// }, // },
// }) // })
// } // }
showReservePopup.value = false Door.handleCloseReservePopup()
// 计算费用明细 // 计算费用明细
costParams.value.hours = totalHour.value costParams.value.hours = totalHour.value

View File

@ -163,10 +163,11 @@
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="Detail.handleToCoupon(CouponType.Discount)"> <view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="Detail.handleToCoupon(CouponType.Discount)">
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">优惠券</view> <view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">优惠券</view>
<view class="flex items-center justify-between"> <view class="flex items-center justify-between">
<view class="text-[26rpx] text-[#606266] leading-36rpx">优惠券</view> <view class="text-[26rpx] text-[#606266] leading-36rpx">茶址优惠券</view>
<view class="flex items-center"> <view class="flex items-center">
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right"> <view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
<template v-if="selectedCoupon?.id > 0"> <template v-if="selectedCoupon?.id > 0">
<text class="bg-#FEF1F0 text-#FF5951 rounded-6rpx text-center text-22rpx leading-40rpx px-10rpx py-2rpx">待使用</text>
{{ selectedCoupon.name }} {{ selectedCoupon.name }}
</template> </template>
<template v-else> <template v-else>

View File

@ -160,6 +160,9 @@
<view class="font-bold text-[#303133] text-30rpx leading-42rpx mr-12rpx"> <view class="font-bold text-[#303133] text-30rpx leading-42rpx mr-12rpx">
{{ item.name }} {{ item.name }}
</view> </view>
<view class="tea-specialist-level-badge flex items-center shrink-0 mr-12rpx">
<text class="tea-specialist-level-badge__text ml-6rpx">{{ GetTeaSpecialistLevelLabel(item.level) }}</text>
</view>
<view class="flex items-center"> <view class="flex items-center">
<wd-icon name="star-on" size="22rpx" color="#FF5951"></wd-icon> <wd-icon name="star-on" size="22rpx" color="#FF5951"></wd-icon>
<view class="font-400 text-24rpx text-[#FF5951] leading-34rpx ml-6rpx">{{ item.star }} <view class="font-400 text-24rpx text-[#FF5951] leading-34rpx ml-6rpx">{{ item.star }}
@ -239,7 +242,7 @@ import { router, previewImage } from '@/utils/tools'
import { getTeaSpecialist } from '@/api/tea-specialist' import { getTeaSpecialist } from '@/api/tea-specialist'
import TeaSpecialistLevel from '@/components/TeaSpecialistLevel.vue' import TeaSpecialistLevel from '@/components/TeaSpecialistLevel.vue'
import type { ITeaSpecialistResult } from '@/api/types/tea-specialist' import type { ITeaSpecialistResult } from '@/api/types/tea-specialist'
import { TeaSpecialistLevelValue, TeaSpecialistLevels } from '@/utils/teaSpecialist' import { TeaSpecialistLevelValue, TeaSpecialistLevels, GetTeaSpecialistLevelLabel } from '@/utils/teaSpecialist'
const OSS = inject('OSS') const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight') const navbarHeight = inject('navbarHeight')
@ -497,6 +500,23 @@ page {
height: 38rpx; height: 38rpx;
} }
.tea-specialist-level-badge {
height: 40rpx;
padding: 0 14rpx 0 8rpx;
border-radius: 999rpx;
background: linear-gradient(135deg, #f7fbf4 0%, #e5f5de 100%);
border: 1rpx solid rgba(76, 159, 68, 0.18);
box-shadow: 0 6rpx 16rpx rgba(76, 159, 68, 0.08);
}
.tea-specialist-level-badge__text {
color: #2f7d32;
font-size: 22rpx;
line-height: 22rpx;
font-weight: 600;
letter-spacing: 2rpx;
}
.level-bg { .level-bg {
background: linear-gradient(180deg, #E9FFF1 0%, #F6F7F8 100%) no-repeat; background: linear-gradient(180deg, #E9FFF1 0%, #F6F7F8 100%) no-repeat;
background-size: 100% 220rpx; background-size: 100% 220rpx;

View File

@ -14,7 +14,7 @@
<!-- 上门服务-预定时间 --> <!-- 上门服务-预定时间 -->
<wd-popup v-model="showReservePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom"> <wd-popup v-model="showReservePopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" position="bottom">
<view class="relative"> <view class="relative">
<view class="absolute top-18rpx right-30rpx" @click="showReservePopup = false"> <view class="absolute top-18rpx right-30rpx" @tap.stop.prevent="Door.handleCloseReservePopup">
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img> <wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
</view> </view>
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">选择时间</view> <view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">选择时间</view>
@ -59,8 +59,8 @@
</view> </view>
<view class="pb-22rpx mt-40rpx mx-30rpx flex justify-between items-center text-[32rpx] text-center"> <view class="pb-22rpx mt-40rpx mx-30rpx flex justify-between items-center text-[32rpx] text-center">
<view class='bg-[#F6F7F8] text-[#303133] rounded-8rpx h-90rpx leading-90rpx w-[50%] mr-28rpx' @click="Door.handleResetTime">重置</view> <view class='bg-[#F6F7F8] text-[#303133] rounded-8rpx h-90rpx leading-90rpx w-[50%] mr-28rpx' @tap.stop.prevent="Door.handleResetTime">重置</view>
<view class='bg-[#4C9F44] text-[#fff] rounded-8rpx h-90rpx leading-90rpx w-[50%]' @click="Door.handleConfirmHour">确定({{ totalHour }}小时)</view> <view class='bg-[#4C9F44] text-[#fff] rounded-8rpx h-90rpx leading-90rpx w-[50%]' @tap.stop.prevent="Door.handleConfirmHour">确定({{ totalHour }}小时)</view>
</view> </view>
</view> </view>
</wd-popup> </wd-popup>
@ -359,10 +359,11 @@
<view class="bg-white py-26rpx px-30rpx mt-20rpx" @click="Reserve.handleToCoupon(CouponType.Discount)"> <view class="bg-white py-26rpx px-30rpx mt-20rpx" @click="Reserve.handleToCoupon(CouponType.Discount)">
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">优惠券</view> <view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">优惠券</view>
<view class="flex items-center justify-between"> <view class="flex items-center justify-between">
<view class="text-[26rpx] text-[#606266] leading-36rpx">优惠券</view> <view class="text-[26rpx] text-[#606266] leading-36rpx">茶址优惠券</view>
<view class="flex items-center"> <view class="flex items-center">
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right"> <view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
<template v-if="selectedCoupon?.id > 0"> <template v-if="selectedCoupon?.id > 0">
<text class="bg-#FEF1F0 text-#FF5951 rounded-6rpx text-center text-22rpx leading-40rpx px-10rpx py-2rpx">待使用</text>
{{ selectedCoupon.name }} {{ selectedCoupon.name }}
</template> </template>
<template v-else> <template v-else>
@ -1049,6 +1050,13 @@
return `${year}-${month}-${day} ${hour}:${minute}` return `${year}-${month}-${day} ${hour}:${minute}`
}, },
handleCloseReservePopup: () => {
uni.hideKeyboard()
setTimeout(() => {
showReservePopup.value = false
}, 50)
},
/** /**
* 重置预定时间 * 重置预定时间
*/ */
@ -1085,7 +1093,7 @@
// }, // },
// }) // })
// } // }
showReservePopup.value = false Door.handleCloseReservePopup()
// 计算费用明细 // 计算费用明细
costParams.value.hours = totalHour.value costParams.value.hours = totalHour.value

View File

@ -121,7 +121,7 @@
<!-- 专属定制 --> <!-- 专属定制 -->
<view class="flex justify-center mt-24rpx" @click="router.navigateTo(`/bundle_b/pages/tea-specialist/list`)" v-if="setting.status == 1"> <view class="flex justify-center mt-24rpx" @click="router.navigateTo(`/bundle_b/pages/tea-specialist/list`)" v-if="setting.status == 1">
<wd-img :src="`${OSS}images/home/home_image_19.png`" width="690rpx" height="200rpx" mode="scaleToFill" /> <wd-img :src="teaArtistEntrance" width="690rpx" height="200rpx" mode="scaleToFill" />
</view> </view>
</view> </view>
@ -203,7 +203,7 @@
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app' import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js" import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
import { LOCATION_DENY_TIME_KEY, handleEnsureLocationAuthHooks, LOCATION_DEFAULT_CITY, handleGetLocationCity, LOCATION_CITY_KEY, handleForceGetLocation } from '@/hooks/useLocation' import { LOCATION_DENY_TIME_KEY, handleEnsureLocationAuthHooks, LOCATION_DEFAULT_CITY, handleGetLocationCity, LOCATION_CITY_KEY, handleForceGetLocation } from '@/hooks/useLocation'
import { getHomeBannerList, getHomeCouponPopup, claimIndexCoupon } from '@/api/home' import { getHomeBannerList, getHomeCouponPopup, claimIndexCoupon, getTeaArtistEntrance } from '@/api/home'
import { getTeaPackageList } from '@/api/tea-package' import { getTeaPackageList } from '@/api/tea-package'
import { getHomeTeaStoreList } from '@/api/tea-room' import { getHomeTeaStoreList } from '@/api/tea-room'
import { useUserStore } from '@/store' import { useUserStore } from '@/store'
@ -257,6 +257,9 @@
// 获取设置 // 获取设置
const setting = ref<any>({}) const setting = ref<any>({})
// 茶艺师入口图
const teaArtistEntrance = ref<string>('')
onShow(async () => { onShow(async () => {
// if (canLocation) { // if (canLocation) {
// const location = await handleGetLocationCity(latitude.value, longitude.value) // const location = await handleGetLocationCity(latitude.value, longitude.value)
@ -386,19 +389,28 @@
* 初始化首页数据 * 初始化首页数据
*/ */
handleInit: () => { handleInit: () => {
// 获取设置
getSetting().then(res => {
setting.value = res
})
// 获取轮播图
getHomeBannerList().then(res => { getHomeBannerList().then(res => {
swiperList.value = res.list.map(item => item.address) swiperList.value = res.list.map(item => item.address)
}) })
// 获取茶艺师入口图
getTeaArtistEntrance().then(res => {
console.log("🚀 ~ res:", res)
// 如果接口返回的状态是1才显示茶艺师入口图
teaArtistEntrance.value = res.url
})
// 获取套餐列表 // 获取套餐列表
getTeaPackageList().then(res => { getTeaPackageList().then(res => {
teaPackageList.value = res teaPackageList.value = res
}) })
getSetting().then(res => {
setting.value = res
})
}, },
/** /**

View File

@ -24,3 +24,10 @@ export const TeaSpecialistLevels = [
{ id: 1, value: 'gold', label: TeaSpecialistLevel.Gold, level: 4 }, { id: 1, value: 'gold', label: TeaSpecialistLevel.Gold, level: 4 },
// { id: 5, value: 'enthusiast', label: TeaSpecialistLevel.Enthusiast, level: 1 } // { id: 5, value: 'enthusiast', label: TeaSpecialistLevel.Enthusiast, level: 1 }
]; ];
// 获取茶艺师等级标签
export function GetTeaSpecialistLevelLabel(level: number) {
const found = TeaSpecialistLevels.find(item => item.level == level)
return found ? found.label.slice(0, 2) : '未知';
}