From 67c8e8e0169bbcbe99c6cf70f9b762a0159eceb1 Mon Sep 17 00:00:00 2001 From: wangxiaowei <1121133807@qq.com> Date: Fri, 28 Nov 2025 19:19:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/pay.ts | 29 +- src/api/tea-room.ts | 123 ++++- src/api/types/tea-room.ts | 53 ++ src/api/types/tea.ts | 42 +- src/api/types/user.ts | 22 + src/api/user.ts | 3 +- src/bundle/coupon/coupon.vue | 35 +- src/bundle/order/after-sales/after-sales.vue | 5 +- .../order/platform/direct-order-detail.vue | 6 +- .../order/platform/franchise-order-detail.vue | 2 +- src/bundle/order/platform/order-detail.vue | 285 +++++++++++ src/bundle/order/platform/order-list.vue | 159 +++--- src/bundle/order/tea-room/order-detail.vue | 387 ++++++++++++--- src/bundle/order/tea-room/order-list.vue | 16 +- .../order/tea-specialist/order-detail.vue | 6 +- .../order/tea-specialist/order-list.vue | 2 +- src/bundle/profile/profile.vue | 195 +++++--- src/bundle/tea-room/choose-room-reserve.vue | 463 ++++++++++++------ src/bundle/tea-room/choose-room.vue | 194 +++++--- src/bundle/tea-room/detail.vue | 285 ++++++----- src/bundle/tea-room/room.vue | 46 +- src/components/BookingTime.vue | 39 +- src/components/Pay.vue | 4 +- src/components/UseStore.vue | 74 +++ src/components/coupon/GroupCoupon.vue | 19 +- src/components/navbar.vue | 4 +- src/components/order/ComboCard.vue | 156 +++--- src/components/reserve/RoomList.vue | 171 ++++--- src/hooks/useOrder.ts | 42 +- src/hooks/usePay.ts | 2 +- src/http/alova.ts | 1 + src/pages.json | 21 +- src/pages/cashier/cashier.vue | 123 +++-- src/pages/index/index.vue | 25 +- src/pages/my/my.vue | 55 ++- src/pages/notice/reserve.vue | 37 +- src/pages/reserve/reserve.vue | 177 +++---- .../share/tea-room/share-order-detail.vue | 330 +++++++++++++ src/store/user.ts | 11 +- src/utils/order.ts | 63 ++- src/utils/pay.ts | 4 +- src/utils/tea.ts | 5 + src/utils/tools.ts | 19 +- 43 files changed, 2722 insertions(+), 1018 deletions(-) create mode 100644 src/bundle/order/platform/order-detail.vue create mode 100644 src/components/UseStore.vue create mode 100644 src/pages/share/tea-room/share-order-detail.vue create mode 100644 src/utils/tea.ts diff --git a/src/api/pay.ts b/src/api/pay.ts index b92170b..734f16f 100644 --- a/src/api/pay.ts +++ b/src/api/pay.ts @@ -1,16 +1,27 @@ import { http } from '@/http/alova' /** - * 给茶艺师打赏 + * 预支付接口 */ -interface ITipTeaSpecialistParams { - id: number - tip_price: number - pay_type: number +export interface IPrePayParams { + from: string + order_id: number + pay_way: number + order_source: number + order_type: number } -export function payTipTeaSpecialist(data: ITipTeaSpecialistParams) { - return http.Post('/api/Teamaster/giveTeamasterTipAmount', - data - ) +export function prePay(data: IPrePayParams) { + return http.Post<{ pay_id: number }>('/api/pay/prepay', data) +} + +/** + * 余额支付接口 + */ +export interface ITeaSpecialistPayParams { + id: number +} + +export function balancePay(data: ITeaSpecialistPayParams) { + return http.Post('/api/pay/yuePay', data) } \ No newline at end of file diff --git a/src/api/tea-room.ts b/src/api/tea-room.ts index 58ba315..472c21f 100644 --- a/src/api/tea-room.ts +++ b/src/api/tea-room.ts @@ -1,5 +1,13 @@ import { http } from '@/http/alova' -import type { IHomeTeaRoomListResult, IOpenCityListResult, ITeaRoomDetailResult, ITeaRoomBalanceResult, IOrderListResult } from '@/api/types/tea-room' +import type { + IHomeTeaRoomListResult, + IOpenCityListResult, + ITeaRoomDetailResult, + ITeaRoomBalanceResult, + IOrderListResult, + ITeaRoomPackageDetailsResult, + ITeaRoomPackageOrderDetailsResult +} from '@/api/types/tea-room' import type { ITeaSpecialistFuture7DaysResult, ITeaSpecialistOrderDetailsResult } from '@/api/types/tea' /** @@ -138,6 +146,7 @@ export interface ICreateTeaRoomOrderParams { end_time: string hours: number user_coupon_id: number + group_coupon_id: number } export function createTeaRoomOrder(data: ICreateTeaRoomOrderParams) { @@ -154,7 +163,7 @@ export interface ITeaRoomOrderDetailParams { } export function getTeaRoomOrderDetail(data: ITeaRoomOrderDetailParams) { - return http.Post('/api/order/orderStoreDetails', data) + return http.Post<{details: ITeaSpecialistOrderDetailsResult}>('/api/order/orderStoreDetails', data) } /** @@ -202,4 +211,114 @@ export interface IConfirmTeaRoomOrderParams { export function confirmTeaRoomOrder(data: IConfirmTeaRoomOrderParams) { return http.Post('/api/order/userConfirmOrderStore', data) +} + +/** + * 一键续订 + */ +export interface IRenewTeaRoomOrderParams { + id: number + start_time: string + end_time: string + renew_hour: number +} + +export function renewTeaRoomOrder(data: IRenewTeaRoomOrderParams) { + return http.Post('/api/order/renewDtime', data) +} + +/** + * 获取茶室套餐 + */ +export interface ITeaRoomPackageParams { + page: number + size: number + id: number +} + +export function getTeaRoomPackage(data: ITeaRoomPackageParams) { + return http.Post('/api/teaStore/teaStoreGroupLists', data) +} + +/** + * 获取茶室套餐详情 + */ +export interface ITeaRoomPackageDetailParams { + id: number +} + +export function getTeaRoomPackageDetail(data: ITeaRoomPackageDetailParams) { + return http.Post<{details: ITeaRoomPackageDetailsResult}>('/api/teaStore/teaStoreGroupDetails', data) +} + +/** + * 提交茶室套餐订单 + */ +export interface ICreateTeaRoomPackageOrderParams { + group_id: number +} + +export function createTeaRoomPackageOrder(data: ICreateTeaRoomPackageOrderParams) { + return http.Post<{id: number}>('/api/order/submitGroupOrder', data) +} + +/** + * 茶室套餐订单列表 + */ +export interface ITeaRoomPackageOrderListParams { + page: number + size: number + use_status: string + operation_type: number + search: string +} + +export function getTeaRoomPackageOrderList(data: ITeaRoomPackageOrderListParams) { + return http.Post('/api/order/orderGroupList', data) +} + +/** + * 茶室套餐订单详情 + */ +export interface ITeaRoomPackageOrderDetailParams { + id: number + latitude: number + longitude: number +} + +export function getTeaRoomPackageOrderDetail(data: ITeaRoomPackageOrderDetailParams) { + return http.Post<{details: ITeaRoomPackageOrderDetailsResult}>('/api/order/orderGroupDetails', data) +} + +/** + * 计算费用明细 + */ +export interface ICalculateTeaRoomPriceParams { + room_id: number // 房间id + coupon_id: number // 优惠券id + group_id: number // 团购券id + nums: number // 提交的小时数 +} + +export function calculateTeaRoomPrice(data: ICalculateTeaRoomPriceParams) { + return http.Post<{details: { + coupon_price: number + discount_room_price: number + group_price: number + nums: number + order_amount: number + room_price: number + discount_all_price: number + }}>('/api/order/countPrice', data) +} + +/** + * 选择茶室团购券列表 + */ +export interface ITeaRoomGroupCouponListParams { + store_id: number +} + +export function getTeaRoomGroupCouponList(data: ITeaRoomGroupCouponListParams) { + return http.Post<{list: {}}>('/api/order/teaStoreGroupUseLists', data) } \ No newline at end of file diff --git a/src/api/types/tea-room.ts b/src/api/types/tea-room.ts index 4037f87..8e75b87 100644 --- a/src/api/types/tea-room.ts +++ b/src/api/types/tea-room.ts @@ -80,3 +80,56 @@ export interface IOrderListResult { page: string size: string } + +/** + * 茶室套餐-详情接口返回数据 + */ +export interface ITeaRoomPackageDetailsResult { + buy_details: string + discount: string + dtime: string + hour: string + img: string + introduce: string + introduce_details: string + price: string + returd_details: string + update_dtime: string + title: string + del: number + id: number + sold: number + status: number + store_id: number +} + +/** + * 茶室套餐-订单详情接口返回数据 + */ +export interface ITeaRoomPackageOrderDetailsResult { + pay: number + pay_way_title: string + order_amount: string + order_sn: string + order_status: number + dtime: string + pay_dtime: string + group: { + id: number + title: string + img: string + hour: string + } + store: { + id: number + address: string + latitude: string + longitude: string + name: string + image: string + contact_phone: string + store_id: number + distance: string, + operation_type: number + } +} \ No newline at end of file diff --git a/src/api/types/tea.ts b/src/api/types/tea.ts index ccc68a6..9655d4b 100644 --- a/src/api/types/tea.ts +++ b/src/api/types/tea.ts @@ -94,9 +94,43 @@ export interface ICreateTeaSpecialistOrderResult { * 订单详情返回结果 */ export interface ITeaSpecialistOrderDetailsResult { - details: { - amount_price: string - order_sn: string + order_amount: string + order_sn: string + store_id: number + room_msg: { + id: number + price: number + img: string + title: string + }, + store_msg: { + id: number + address: string + name: string + operation_type: number + image: string + latitude: string + longitude: string + contact_phone: string + }, + time1: number + order_status: number + room_all_price: number + room_price: number + day_time: string + start_time: string + end_time: string + hours: number + distance: number + pay_way: number + pay_way_title: string + dtime: string + update_dtime: string + renew_price: number, + renew_dtime: { + start_time: string + end_time: string + renew_price: number } } @@ -111,4 +145,4 @@ export interface ITeaSpecialistPrepayResult { * 支付返回结果 */ export interface ITeaSpecialistPayResult { -} \ No newline at end of file +} diff --git a/src/api/types/user.ts b/src/api/types/user.ts index 1080b4f..b26124c 100644 --- a/src/api/types/user.ts +++ b/src/api/types/user.ts @@ -47,4 +47,26 @@ export interface IUserAddressDetailsResult extends IUserAddressListResult { export interface IUserCouponListResult { no_use: Array use: Array +} + +/** + * 用户信息接口返回 + */ +export interface IUserResult { + id: number + sn: number + sex: "未知" | "男" | "女" + account: string + nickname: string + real_name: string + avatar: string + collect_count: number + coupon_count: number + create_time: string + has_auth: boolean + has_password: boolean + member: number + mobile: string + user_money: string + version: string } \ No newline at end of file diff --git a/src/api/user.ts b/src/api/user.ts index 7cc0b32..50de56e 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,13 +1,14 @@ import { http } from '@/http/alova' import type { IUserAddressListResult, IUserAddressDetailsResult, IUserCouponListResult } from '@/api/types/user' import type { IOrderListResult } from '@/api/types/teaSpecialist-order' +import type { IUserResult } from '@/api/types/user' /** * 获取用户个人信息 */ export function getUserInfo() { - return http.Post('/api/user/info') + return http.Post('/api/user/info') } /** diff --git a/src/bundle/coupon/coupon.vue b/src/bundle/coupon/coupon.vue index 79ca58a..2846c08 100644 --- a/src/bundle/coupon/coupon.vue +++ b/src/bundle/coupon/coupon.vue @@ -21,7 +21,7 @@ 可用优惠券 - {{ couponList.no_use.length }}张 + {{ couponList.use.length }}张 @@ -70,18 +70,18 @@ - + @@ -117,8 +117,10 @@ import Coupon from '@/components/coupon/Coupon.vue' import GroupCoupon from '@/components/coupon/GroupCoupon.vue' import { getCoupons } from '@/api/user' + import { getTeaRoomGroupCouponList } from '@/api/tea-room' import type { IUserCouponListResult } from '@/api/types/user' import { router } from '@/utils/tools' + import { CouponType } from '@/utils/coupon' const couponType = ref(2) // couponType 1:优惠券 2:团购券 @@ -126,6 +128,7 @@ no_use: [], use: [] }) + const groupCouponList = ref() const checkedId = ref(0) const unCouponList = ref([ @@ -133,17 +136,20 @@ { id: 2, amount: 10, limit: 50, expire: '2024.08.25' } ]) + const storeId = ref(0) // 门店ID const teaRoomId = ref(0) // 包间ID - + onLoad((args) => { teaRoomId.value = args.id - + storeId.value = args.storeId || 0 couponType.value = args.type // 1:优惠券 2:团购券 // 初始化优惠券数据 if (args.id && args.numbers && args.type == 1) { // 获取到包间ID和预定了几个小时 Coupons.handleInitCoupon(args.id, args.numbers) + } else if (args.id && args.type == 2) { + Coupons.handleInitGroupCoupon(args.id, args.numbers) } }) @@ -158,6 +164,14 @@ couponList.value = res }, + /** + * 初始化团购券列表 + */ + handleInitGroupCoupon: async (id: number, numbers: number) => { + const res = await getTeaRoomGroupCouponList({store_id: storeId.value}) + groupCouponList.value = res.list + }, + /** * 选择优惠券 * @param id 优惠券ID @@ -170,7 +184,12 @@ * 确认选择优惠券 */ handleConfirmCoupon: () => { - const coupon = couponList.value.use.find(item => item.user_coupon_id === checkedId.value) + let coupon = null + if (couponType.value == CouponType.Discount) { + coupon = couponList.value.use.find(item => item.user_coupon_id === checkedId.value) + } else { + coupon = groupCouponList.value.find(item => item.id === checkedId.value) + } uni.$emit('chooseCoupon', { coupon }) router.navigateBack() } diff --git a/src/bundle/order/after-sales/after-sales.vue b/src/bundle/order/after-sales/after-sales.vue index f189c74..c1eaa33 100644 --- a/src/bundle/order/after-sales/after-sales.vue +++ b/src/bundle/order/after-sales/after-sales.vue @@ -177,7 +177,6 @@ 请耐心等待,我们会尽快处理您的请求 - 退款成功¥128.00 @@ -333,8 +332,8 @@ const orderStatus = ref('') // 订单状态:待使用、退款等 onLoad((args) => { - // 这里暂时使用 OrderSource.Direct 这个,因为平台团购类型下面都是有共同的售后 - title.value = OrderStatusTitle[OrderSource.Direct][args.orderStatus] || '订单详情' + // 这里暂时使用 OrderSource.Combo 这个,因为平台团购类型下面都是有共同的售后 + title.value = OrderStatusTitle[OrderSource.Combo][args.orderStatus] || '订单详情' orderType.value = args.orderType orderStatus.value = args.orderStatus diff --git a/src/bundle/order/platform/direct-order-detail.vue b/src/bundle/order/platform/direct-order-detail.vue index 2bee4dc..0aa481c 100644 --- a/src/bundle/order/platform/direct-order-detail.vue +++ b/src/bundle/order/platform/direct-order-detail.vue @@ -15,7 +15,7 @@ - 请在2025.12.31(含)前使用 + 感谢购买,期待再次光临! @@ -162,7 +162,7 @@ + + + diff --git a/src/bundle/order/platform/order-list.vue b/src/bundle/order/platform/order-list.vue index f01a3e4..20f2f98 100644 --- a/src/bundle/order/platform/order-list.vue +++ b/src/bundle/order/platform/order-list.vue @@ -12,42 +12,32 @@ - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + @@ -56,9 +46,22 @@ import ComboCard from '@/components/order/ComboCard.vue' import { onPageScroll, onReachBottom } from '@dcloudio/uni-app' import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js" + import { OrderSource } from '@/utils/order' + import { getTeaRoomPackageOrderList } from '@/api/tea-room' + import { TeaRoomPackageOrderStatusText, TeaRoomPackageOrderStatusValue } from '@/utils/order' - /* mescroll */ - const { mescrollInit, downCallback } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook + // mescroll + const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook + const downOption = { + auto: true + } + const upOption = { + auto: true, + textNoMore: '~ 已经到底啦 ~', //无更多数据的提示 + } + const orderStatus = ref('') + const list = ref>([]) // 茶室列表 + const keywords = ref('') // 搜索关键词 // 菜单 const currentType = ref(1) @@ -73,65 +76,69 @@ } ]) - // 店铺类型 - - // 搜索 - const keywords = ref('') - // tab - const tab = ref(0) + const tab = ref('all') - const orderList = { - // 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10 + onLoad(() => { + uni.$on('refreshPackageOrderList', () => { + list.value = [] + getMescroll().resetUpScroll() + }) + }) + + onUnload(() => { + uni.$off('refreshPackageOrderList') + }) + + const OrderList = { upCallback: (mescroll) => { - // 需要留一下数据为空的时候显示的空数据图标内容 - // list({ - // page: mescroll.num, - // size: mescroll.size - // }).then((res: { list: Array, totalPages: Number }) => { - // const curPageData = res.list || [] // 当前页数据 - // if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表 - // goods.value = goods.value.concat(curPageData); //追加新数据 - - // console.log("🚀 ~ goods:", goods) - - // mescroll.endByPage(curPageData.length, res.totalPages); //必传参数(当前页的数据个数, 总页数) - - // }).catch(() => { - // mescroll.endErr(); // 请求失败, 结束加载 - // }) - // apiGoods(mescroll.num, mescroll.size).then(res=>{ - // const curPageData = res.list || [] // 当前页数据 - // if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表 - // goods.value = goods.value.concat(curPageData); //追加新数据 - // //联网成功的回调,隐藏下拉刷新和上拉加载的状态; - // //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据; - - // //方法一(推荐): 后台接口有返回列表的总页数 totalPage - // //mescroll.endByPage(curPageData.length, totalPage); //必传参数(当前页的数据个数, 总页数) - - // //方法二(推荐): 后台接口有返回列表的总数据量 totalSize - // //mescroll.endBySize(curPageData.length, totalSize); //必传参数(当前页的数据个数, 总数据量) - - // //方法三(推荐): 您有其他方式知道是否有下一页 hasNext - // //mescroll.endSuccess(curPageData.length, hasNext); //必传参数(当前页的数据个数, 是否有下一页true/false) - - // //方法四 (不推荐),会存在一个小问题:比如列表共有20条数据,每页加载10条,共2页.如果只根据当前页的数据个数判断,则需翻到第三页才会知道无更多数据. - // mescroll.endSuccess(curPageData.length); // 请求成功, 结束加载 - // }).catch(()=>{ - mescroll.endErr(); // 请求失败, 结束加载 - // }) + const filter = { + page: mescroll.num, + size: mescroll.size, + operation_type: currentType.value, + use_status: orderStatus.value, + search: keywords.value + } + getTeaRoomPackageOrderList(filter).then((res) => { + const curPageData = res.list || [] // 当前页数据 + if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表 + list.value = list.value.concat(curPageData) //追加新数据 + mescroll.endSuccess(curPageData.length, Boolean(res.more)) + }).catch(() => { + mescroll.endErr() // 请求失败, 结束加载 + }) }, - // 切换菜单 + /** + * 切换菜单 + */ handleChangeMenu: (type: number) => { currentType.value = type - console.log("🚀 ~ currentType.value:", currentType.value) + OrderList.handleResetSearch() }, - // 切换tab - handleChangeTab: (e: any) => { - tab.value = e.index + /** + * 切换订单状态 + * @param e + */ + handleChangeTabs: (e: {index: number, name: string}) => { + tab.value = e.name + if (e.name === TeaRoomPackageOrderStatusText.ToUse) { + orderStatus.value = '0' + } else { + orderStatus.value = TeaRoomPackageOrderStatusValue[e.name] || '' + } + + // 切换tab时,重置当前的mescroll + OrderList.handleResetSearch() + }, + + /** + * 内容搜索 + */ + handleResetSearch: () => { + list.value = [] + getMescroll().resetUpScroll(); } } diff --git a/src/bundle/order/tea-room/order-detail.vue b/src/bundle/order/tea-room/order-detail.vue index 4cfc41f..778772e 100644 --- a/src/bundle/order/tea-room/order-detail.vue +++ b/src/bundle/order/tea-room/order-detail.vue @@ -1,5 +1,6 @@ { + "needLogin": true, "layout": "default", "style": { "navigationStyle": "custom" @@ -10,7 +11,7 @@ diff --git a/src/bundle/order/tea-room/order-list.vue b/src/bundle/order/tea-room/order-list.vue index f762d3d..b99323d 100644 --- a/src/bundle/order/tea-room/order-list.vue +++ b/src/bundle/order/tea-room/order-list.vue @@ -9,14 +9,14 @@