From d38d4419d901f74a534e73eae3797ea91bbb16c9 Mon Sep 17 00:00:00 2001 From: wangxiaowei <1121133807@qq.com> Date: Sat, 29 Nov 2025 20:50:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 8 +- src/api/tea-room.ts | 33 +++++++- src/api/types/tea-room.ts | 2 + src/api/user.ts | 19 ++++- src/bundle/order/after-sales/after-sales.vue | 70 ++++++++++++++-- src/bundle/order/platform/order-detail.vue | 69 ++++++++++++---- src/bundle/order/tea-room/order-detail.vue | 6 +- src/bundle/profile/profile.vue | 35 ++++++-- src/bundle/tea-room/choose-room-reserve.vue | 20 +++-- src/bundle/tea-room/choose-room.vue | 5 +- src/bundle/tea-room/detail.vue | 7 +- src/components/UseStore.vue | 4 +- src/components/order/ComboCard.vue | 8 +- src/hooks/useLocation.ts | 56 ++++++++++--- src/hooks/useOrder.ts | 24 ++++-- src/pages.json | 1 + src/pages/cashier/cashier.vue | 2 +- src/pages/city/city.vue | 29 ++++++- src/pages/index/index.vue | 85 ++++++++++++++++---- src/utils/order.ts | 18 +++-- 20 files changed, 403 insertions(+), 98 deletions(-) diff --git a/src/App.vue b/src/App.vue index bef4050..ec2a9df 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,17 +2,21 @@ import { onHide, onLaunch, onShow } from '@dcloudio/uni-app' import { navigateToInterceptor } from '@/router/interceptor' import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only' - + import { LOCATION_DEFAULT_CITY, LOCATION_DEFAULT_LAT, LOCATION_DEFAULT_LNG, LOCATION_LAT_KEY, LOCATION_LNG_KEY, LOCATION_CITY_KEY } from '@/hooks/useLocation' + onLaunch((options) => { // 处理直接进入页面路由的情况:如h5直接输入路由、微信小程序分享后进入等 // https://github.com/unibest-tech/unibest/issues/192 - console.log('App Launch', options) if (options?.path) { navigateToInterceptor.invoke({ url: `/${options.path}` }) } else { navigateToInterceptor.invoke({ url: '/' }) } + + // uni.setStorageSync(LOCATION_LAT_KEY, LOCATION_DEFAULT_LAT) + // uni.setStorageSync(LOCATION_LNG_KEY, LOCATION_DEFAULT_LNG) + // uni.setStorageSync(LOCATION_CITY_KEY, LOCATION_DEFAULT_CITY) }) onShow((options) => { console.log('App Show', options) diff --git a/src/api/tea-room.ts b/src/api/tea-room.ts index 472c21f..9869b28 100644 --- a/src/api/tea-room.ts +++ b/src/api/tea-room.ts @@ -10,6 +10,37 @@ import type { } from '@/api/types/tea-room' import type { ITeaSpecialistFuture7DaysResult, ITeaSpecialistOrderDetailsResult } from '@/api/types/tea' +/** + * 经纬度转换为城市 + */ +export interface ILocationToCityParams { + latitude: number + longitude: number +} + +export function getLocationToCity(data: ILocationToCityParams) { + return http.Post<{ + message: string + result: { + ad_info: { + province: string + city: string + district: string + adcode: string + }, + location: { + lat: number + lng: number + } + } + }>('/api/common/cityAddress', + data, + { + meta: { ignoreAuth: true } + } + ) +} + /** * 获取门店列表 */ @@ -296,7 +327,7 @@ export function getTeaRoomPackageOrderDetail(data: ITeaRoomPackageOrderDetailPar export interface ICalculateTeaRoomPriceParams { room_id: number // 房间id coupon_id: number // 优惠券id - group_id: number // 团购券id + group_coupon_id: number // 团购券id nums: number // 提交的小时数 } diff --git a/src/api/types/tea-room.ts b/src/api/types/tea-room.ts index 8e75b87..9884c54 100644 --- a/src/api/types/tea-room.ts +++ b/src/api/types/tea-room.ts @@ -114,6 +114,8 @@ export interface ITeaRoomPackageOrderDetailsResult { order_status: number dtime: string pay_dtime: string + coupon_code?: string, + coupon_code_img?: string, group: { id: number title: string diff --git a/src/api/user.ts b/src/api/user.ts index 50de56e..b0759ab 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -131,4 +131,21 @@ export interface IGetUserMoneyLogParams { export function getUserMoneyLog(data: IGetUserMoneyLogParams) { return http.Post('/api/user/moneyLogList', data) -} \ No newline at end of file +} + +/** + * 修改用户信息 + */ +export interface IUpdateUserInfoParams { + field: string, + value: string | number +} + +export function updateUserInfo(data: IUpdateUserInfoParams) { + return http.Post('/api/user/setInfo', data) +} + +/** + * 上传头像 + */ + diff --git a/src/bundle/order/after-sales/after-sales.vue b/src/bundle/order/after-sales/after-sales.vue index c1eaa33..f93408b 100644 --- a/src/bundle/order/after-sales/after-sales.vue +++ b/src/bundle/order/after-sales/after-sales.vue @@ -195,12 +195,13 @@ - + + - - 这是团购套餐的可以点击进 + + {{ comboOrder.group.title }} @@ -209,8 +210,8 @@ ¥324.22 - 3小时 - x1 + {{ comboOrder.group.hour }}小时 + x1 @@ -219,7 +220,7 @@ 实付 - ¥29.32 + ¥{{ comboOrder.order_amount }} @@ -299,6 +300,9 @@ diff --git a/src/bundle/tea-room/detail.vue b/src/bundle/tea-room/detail.vue index a87f664..c95f68e 100644 --- a/src/bundle/tea-room/detail.vue +++ b/src/bundle/tea-room/detail.vue @@ -440,8 +440,7 @@ selectedCoupon.value = {id: params.coupon.user_coupon_id, name: `${params.coupon.name}减${params.coupon.coupon_price}` } bill.value.coupon = params.coupon.coupon_price } else { - selectedGroupCoupon.value = {id: params.coupon.group_id, name: `团购券-${params.coupon.tea_store_group.title}` } - console.log("🚀 ~ selectedGroupCoupon.value:", selectedGroupCoupon.value.name) + selectedGroupCoupon.value = {id: params.coupon.id, name: `团购券-${params.coupon.tea_store_group.title}` } bill.value.groupCoupon = params.coupon.coupon_price } @@ -532,14 +531,14 @@ const res = await calculateTeaRoomPrice({ room_id: id.value, coupon_id: selectedCoupon.value.id || 0, - group_id: selectedGroupCoupon.value.id, + group_coupon_id: selectedGroupCoupon.value.id, nums: bill.value.service.num, }) bill.value.service.total = res.details.room_price // 茶室价格 bill.value.discount = res.details.discount_room_price // 茶室总价 bill.value.totalDiscount = res.details.discount_all_price // 总优惠 - bill.value.groupCoupon = res.details.group_price // 总优惠 + bill.value.groupCoupon = res.details.group_price // 团购优惠 bill.value.total = res.details.order_amount // 订单金额 } } diff --git a/src/components/UseStore.vue b/src/components/UseStore.vue index a6508d0..01c92f7 100644 --- a/src/components/UseStore.vue +++ b/src/components/UseStore.vue @@ -8,7 +8,7 @@ - {{ store.name }} + {{ store.name }} 距您{{ store.distance }}km @@ -31,6 +31,8 @@ diff --git a/src/utils/order.ts b/src/utils/order.ts index 78346b0..9715a66 100644 --- a/src/utils/order.ts +++ b/src/utils/order.ts @@ -262,14 +262,16 @@ export const TeaRoomOrderStatusValue: Record = { [TeaRoomPackageOrderStatusText.All]: '', - [TeaRoomPackageOrderStatusText.ToUse]: 0, - [TeaRoomPackageOrderStatusText.Used]: 1, - [TeaRoomPackageOrderStatusText.Refunded]: 2, + [TeaRoomPackageOrderStatusText.Pending]: 0, + [TeaRoomPackageOrderStatusText.ToUse]: 1, + [TeaRoomPackageOrderStatusText.Used]: 2, + [TeaRoomPackageOrderStatusText.Refunded]: 3, } // 状态内容映射 export const TeaRoomPackageOrderStatusTextValue: Record = { + [TeaRoomPackageOrderStatus.Pending]: { + title: '待付款' + }, [TeaRoomPackageOrderStatus.ToUse]: { title: '待使用' },