From 34658047934cc83eb5885e4ebe7ea58716aea95a Mon Sep 17 00:00:00 2001 From: wangxiaowei <1121133807@qq.com> Date: Thu, 30 Oct 2025 14:00:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/tea.ts | 16 ++- src/api/types/tea.ts | 11 ++ src/bundle/collect/collect.vue | 181 +++++++++++++++------------------ src/hooks/useWeiXin.ts | 2 +- src/pages/my/my.vue | 6 +- src/pages/reserve/tea-room.vue | 60 ++++++----- 6 files changed, 143 insertions(+), 133 deletions(-) diff --git a/src/api/tea.ts b/src/api/tea.ts index f35fa8e..920960f 100644 --- a/src/api/tea.ts +++ b/src/api/tea.ts @@ -1,5 +1,5 @@ import { http } from '@/http/alova' -import type { ITeaSpecialistDetailsResult, ITeaSpecialistFuture7DaysResult, ITeaTypeListResult } from '@/api/types/tea' +import type { ITeaSpecialistDetailsResult, ITeaSpecialistFuture7DaysResult, ITeaTypeListResult, ICollectTeaSpecialistResult } from '@/api/types/tea' /** * 获取茶艺师详情 @@ -71,4 +71,16 @@ export function getNext7Days() { */ export function getTeaTypeList() { return http.Post('/api/Teamaster/teaType') -} \ No newline at end of file +} + +/** + * 获取收藏列表 + */ +export interface IGetCollectTeaSpecialistParams { + page: number + size: number +} + +export function getCollect(data: IGetCollectTeaSpecialistParams) { + return http.Post('/api/Teamaster/teamasterCollectList', data) +} diff --git a/src/api/types/tea.ts b/src/api/types/tea.ts index 4a86e43..e3532cc 100644 --- a/src/api/types/tea.ts +++ b/src/api/types/tea.ts @@ -67,4 +67,15 @@ export interface ITeaTypeListResult { status: number tea_price: number dtime: string +} + +/** + * 首页列表数据返回 + */ +export interface ICollectTeaSpecialistResult { + count: Number + list: Array + more: Number + page: string + size: string } \ No newline at end of file diff --git a/src/bundle/collect/collect.vue b/src/bundle/collect/collect.vue index 5f8f5ae..4af4863 100644 --- a/src/bundle/collect/collect.vue +++ b/src/bundle/collect/collect.vue @@ -11,102 +11,66 @@ diff --git a/src/hooks/useWeiXin.ts b/src/hooks/useWeiXin.ts index 6676e69..4792225 100644 --- a/src/hooks/useWeiXin.ts +++ b/src/hooks/useWeiXin.ts @@ -27,7 +27,7 @@ export const getUrlCode = (): { [key: string]: string | undefined } => { */ export async function snsapiBaseAuthorize() { // TODO 测试代码 - wxSnsapiBaseLogin({code: '001PFd1w3oKNQ53W681w3U6h8O0PFd13'}).then((res: IUserInfoVo) => { + wxSnsapiBaseLogin({code: '011haFFa1oJbzK04a8Ha1qQHey0haFFJ'}).then((res: IUserInfoVo) => { console.log("登录成功 ~ snsapiBaseAuthorize ~ res:", res) // 映射 IUserLogin 到 IUserInfoVo useUserStore().setUserInfo(res) diff --git a/src/pages/my/my.vue b/src/pages/my/my.vue index c356bd3..3afca29 100644 --- a/src/pages/my/my.vue +++ b/src/pages/my/my.vue @@ -182,7 +182,7 @@ import { toast } from '@/utils/toast' import { useUserStore } from '@/store' import { getUrlCode, snsapiBaseAuthorize } from '@/hooks/useWeiXin' - import { router, NAVIGATE_TO } from '@/utils/tools' + import { getUserInfo } from '@/api/user' const OSS = inject('OSS') const navbarHeight = inject('navbarHeight') @@ -219,6 +219,10 @@ if (userStore.userInfo.mobile) { userInfo.value = userStore.userInfo isLogin.value = true + + const user = getUserInfo() + console.log("🚀 ~ user:", user) + } else if (code && !userStore.userInfo.token) { // 这里是微信授权之后跳转回到本页面获取到code但是没有登录状态的话需要进行登录操作 snsapiBaseAuthorize() diff --git a/src/pages/reserve/tea-room.vue b/src/pages/reserve/tea-room.vue index 73c349d..0ead75e 100644 --- a/src/pages/reserve/tea-room.vue +++ b/src/pages/reserve/tea-room.vue @@ -45,28 +45,23 @@ 茶艺服务 - {{ bill.serviceFee }} + ¥{{ bill.teaService.total }} - 车马费(¥160元/小时) - x4 - - - - 车马费(¥160元/小时) - x4 + {{ selectedTeaTxt.join('/') }} + ¥{{ bill.teaService.total }} 优惠 - -¥640.00 + -¥{{ bill.coupon }} 优惠券 - -¥20 + -¥{{ bill.coupon }} @@ -76,7 +71,7 @@ 实付金额 - ¥640.00 + ¥{{ bill.total }} @@ -158,7 +153,7 @@ 茶具需求 - + {{item.name}} @@ -195,7 +190,7 @@ - + @@ -342,7 +337,7 @@ - + 合计: @@ -350,7 +345,7 @@ - + 费用明细 @@ -420,7 +415,7 @@ const selectedTea = ref>([]) // 选择的茶叶 const selectedTeaTxt = ref>([]) // 选择的茶叶文本 const selectedTeaPrice = ref>([]) // 选择的茶叶价格 - const totalSelectedTeaPrice = ref('') + const totalSelectedTeaPrice = ref('') // 选择的茶叶总价 // 茶具使用 const teaUsageList = ref>([ @@ -563,17 +558,7 @@ } totalSelectedTeaPrice.value = toPlus(selectedTeaPrice.value) - }, - - // 切换茶具需求 - handleChangeTeaUsage: () => { - // TODO 这边需要加上或减去茶具费用 - // if (teaUsageValue.value == 2) { - // totalSelectedTeaPrice.value += toTimes(160, servicePeople.value) - // } else { - // totalSelectedTeaPrice.value = toMinus(selectedTeaPrice.value) - // } - console.log("🚀 ~ teaUsageValue:", teaUsageValue.value) + bill.value.teaService.total = totalSelectedTeaPrice.value }, // 选择门店 @@ -610,6 +595,7 @@ uni.$off('chooseCoupon') console.log("🚀 ~ params:", params) selectedCoupon.value = {id: params.coupon.user_coupon_id, name: `${params.coupon.name}减${params.coupon.coupon_price}` } + bill.value.coupon = params.coupon.coupon_price }) if (reserveTime.value.length == 0) { @@ -634,10 +620,6 @@ toast.info('请选择预定茶叶') return } - console.log("🚀 ~ servicePeople:", servicePeople.value) - console.log("🚀 ~ servicePeople:", selectedTeaPrice.value) - console.log("🚀 ~ servicePeople:", teaUsageValue.value) - teaService.value = { id: 1, name: '茶艺服务' } showTeaServicePopup.value = false }, @@ -648,6 +630,22 @@ uni.navigateTo({ url: '/pages/notice/reserve?type=teaSpecialist' }) } } + + const billTotal = computed(() => { + const s = Number(bill.value.service.total) || 0 + const t = Number(bill.value.travel.total) || 0 + const ts = Number(bill.value.teaService.total) || 0 + + let total = Number(toPlus(s, t, ts)) + if (bill.value.coupon > 0 ) { + return total - bill.value.coupon + } + return total + }) + + watch(billTotal, (val) => { + bill.value.total = val + })