From 39c64a2504c75592bce3ce2afb40589e83773d02 Mon Sep 17 00:00:00 2001 From: wangxiaowei <1121133807@qq.com> Date: Mon, 5 Jan 2026 00:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=8C=B6=E8=89=BA=E5=B8=88?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 2 +- env/.env | 4 +- manifest.config.ts | 2 +- src/App.vue | 10 +- src/api/home.ts | 7 + src/api/pay.ts | 10 +- src/api/tea-specialist.ts | 55 +- src/api/tea.ts | 3 +- src/api/teaSpecialist-order.ts | 4 +- src/api/user.ts | 9 +- .../order/tea-specialist/order-detail.vue | 643 ++++++++++++------ .../order/tea-specialist/order-list.vue | 50 +- .../pages/tea-specialist/address/add.vue | 123 ++-- src/bundle_b/pages/tea-specialist/detail.vue | 20 +- src/bundle_b/pages/tea-specialist/list.vue | 23 +- src/bundle_b/pages/tea-specialist/reserve.vue | 370 ++++++---- src/bundle_b/pages/tea-specialist/store.vue | 4 +- src/components/order/ComboCard.vue | 147 +++- src/hooks/useOrder.ts | 1 - src/hooks/useTeaSpecialistOrder.ts | 85 +-- src/main.ts | 6 +- src/manifest.json | 3 +- src/pages/cashier/cashier.vue | 102 ++- src/pages/index/index.vue | 92 ++- src/pages/my/my.vue | 47 +- src/pages/notice/reserve.vue | 17 + src/pages/reserve/reserve.vue | 5 +- src/utils/pay.ts | 3 +- src/utils/teaSpecialist.ts | 8 +- 29 files changed, 1204 insertions(+), 651 deletions(-) diff --git a/.editorconfig b/.editorconfig index 7f09864..25f1cca 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,7 +3,7 @@ root = true [*] # 表示所有文件适用 charset = utf-8 # 设置文件字符集为 utf-8 indent_style = space # 缩进风格(tab | space) -indent_size = 2 # 缩进大小 +indent_size = 4 # 缩进大小 end_of_line = lf # 控制换行类型(lf | cr | crlf) trim_trailing_whitespace = true # 去除行首的任意空白字符 insert_final_newline = true # 始终在文件末尾插入一个新行 diff --git a/env/.env b/env/.env index 0a8a268..970be20 100644 --- a/env/.env +++ b/env/.env @@ -10,8 +10,8 @@ VITE_APP_PUBLIC_BASE=/ # 登录页面 VITE_LOGIN_URL = '/pages/login/login' # 第一个请求地址 -# VITE_SERVER_BASEURL = 'https://76458.com' -VITE_SERVER_BASEURL = 'https://cz.stnav.com' +VITE_SERVER_BASEURL = 'https://76458.com' +# VITE_SERVER_BASEURL = 'https://cz.stnav.com' VITE_UPLOAD_BASEURL = 'https://76458.com/upload' diff --git a/manifest.config.ts b/manifest.config.ts index a04cef1..6860238 100644 --- a/manifest.config.ts +++ b/manifest.config.ts @@ -124,7 +124,7 @@ export default defineManifestConfig({ es6: true, minified: true, }, - requiredPrivateInfos: ["getLocation" ], + requiredPrivateInfos: ["getLocation", "chooseLocation" ], optimization: { subPackages: true, }, diff --git a/src/App.vue b/src/App.vue index 86c0f57..48c0834 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,11 +27,11 @@ // uni.setStorageSync(LOCATION_CITY_KEY, LOCATION_DEFAULT_CITY) }) onShow((options) => { - uni.showModal({ - title: '提示', - content: `当前请求域名是:${import.meta.env.VITE_SERVER_BASEURL}`, - showCancel: false - }) + // uni.showModal({ + // title: '提示', + // content: `当前请求域名是:${import.meta.env.VITE_SERVER_BASEURL}`, + // showCancel: false + // }) if (options?.path === 'bundle/order/tea-room/order-detail') { uni.setStorageSync('transferOrderParams', { orderId: options?.query?.orderId || '', diff --git a/src/api/home.ts b/src/api/home.ts index 6396bab..94125ce 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -9,4 +9,11 @@ export function getHomeBannerList() { meta: { ignoreAuth: true } } ) +} + +/** + * 首页优惠券弹窗 + */ +export function getHomeCouponPopup() { + return http.Post('api/UserCoupon/isCoupin') } \ No newline at end of file diff --git a/src/api/pay.ts b/src/api/pay.ts index 0a6ca97..b4ba380 100644 --- a/src/api/pay.ts +++ b/src/api/pay.ts @@ -1,7 +1,7 @@ import { http } from '@/http/alova' /** - * 预支付接口 + * 预支付接口1.0 */ export interface IPrePayParams { from: string @@ -16,6 +16,14 @@ export function prePay(data: IPrePayParams) { return http.Post('/api/pay/prepay', data) } + +/** + * 预支付接口2.0(茶艺师预定) + */ +export function newPrePay(data: IPrePayParams) { + return http.Post('/api/pay/newprepay', data) +} + /** * 余额支付接口 */ diff --git a/src/api/tea-specialist.ts b/src/api/tea-specialist.ts index bb464b0..39c4f72 100644 --- a/src/api/tea-specialist.ts +++ b/src/api/tea-specialist.ts @@ -1,5 +1,12 @@ import { http } from '@/http/alova' +/** + * 获取已开通城市列表 + */ +export function getOpenCityList() { + return http.Post('/teamapi/user/teaStoreCity') +} + /** * 获取茶艺师列表 */ @@ -32,6 +39,13 @@ export function getTeaSpecialistDetail(data: ITeaSpecialistDetailParams) { return http.Post('/api/Teamaster/TeamasterDetails', data) } +/** + * 费用明细 + */ +export function getTeaSpecialistFeeDetails(data) { + return http.Post('/api/Teamaster/countTeamPrice', data) +} + /** * 茶叶商品列表 */ @@ -44,4 +58,43 @@ export function getTeaProducts() { */ export function getTeaSpecialistCoupons() { return http.Post('/api/Teamaster/userCoupon') -} \ No newline at end of file +} + +/** + * 取消订单 + * @param id 订单ID + */ +export function cancelTeaSpecialistOrder(id: number) { + return http.Post('/api/Teamaster/cancelOrder', {id}) +} + +/** + * 删除订单 + * @param 订单ID + */ +export function deleteTeaSpecialistOrder(id: number) { + return http.Post('/api/Teamaster/delOrder', {id}) +} + +/** + * 创建续单订单 + */ +export interface ITeaSpecialistRenewOrder { + id: Number + type: Number + hours: Number + tea_id: string +} + +export function createTeaSpecialistRenewOrder(data: ITeaSpecialistRenewOrder) { + return http.Post('/api/Teamaster/addTeamRenwOrder', data) +} + +/** + * 申请退款 + * @param id 订单ID + * @param order_type 固定传10 + */ +export function applyTeaSpecialistRefund(id: number, order_type: number = 10) { + return http.Post('/api/Teamaster/TeamRefund', {id, order_type}) +} diff --git a/src/api/tea.ts b/src/api/tea.ts index 6453953..b0f44ff 100644 --- a/src/api/tea.ts +++ b/src/api/tea.ts @@ -103,10 +103,11 @@ export interface ICreateTeaSpecialistOrderParams { is_teacup: number tea_id: string user_coupon_id: number + server_number: number } export function createTeaSpecialistOrder(data: ICreateTeaSpecialistOrderParams) { - return http.Post('/api/Teamaster/addTeamOrder', data) + return http.Post('/api/Teamaster/addTeamOrder', data) } /*** diff --git a/src/api/teaSpecialist-order.ts b/src/api/teaSpecialist-order.ts index 3fb8c98..d99bc94 100644 --- a/src/api/teaSpecialist-order.ts +++ b/src/api/teaSpecialist-order.ts @@ -12,7 +12,7 @@ export interface ITeaSpecialistOrderListParams { } export function getTeaSpecialistOrderList(data: ITeaSpecialistOrderListParams) { - return http.Post('/api/order/orderList', + return http.Post('/api/Teamaster/teamOrderList', data ) } @@ -25,7 +25,7 @@ export interface ITeaSpecialistOrderDetailsParams { } export function getTeaSpecialistOrderDetails(data: ITeaSpecialistOrderDetailsParams) { - return http.Post('/api/order/orderDetails', + return http.Post('/api/Teamaster/teamOrderDetails', data ) } diff --git a/src/api/user.ts b/src/api/user.ts index 64623e1..6c98f7b 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -32,16 +32,11 @@ export interface IAddUserAddressParams { id: number contact: string telephone: string - // province: string - // province_id?: number - // city: string - // city_id?: number - // district: string - // district_id?: number + // city_id: number longitude: number, latitude: number, address: string - is_default: number + // is_default: number } export function addUserAddress(data: IAddUserAddressParams) { diff --git a/src/bundle/order/tea-specialist/order-detail.vue b/src/bundle/order/tea-specialist/order-detail.vue index 1262bfe..66b1e54 100644 --- a/src/bundle/order/tea-specialist/order-detail.vue +++ b/src/bundle/order/tea-specialist/order-detail.vue @@ -9,15 +9,14 @@ diff --git a/src/hooks/useOrder.ts b/src/hooks/useOrder.ts index 5e8ab32..99ca6d0 100644 --- a/src/hooks/useOrder.ts +++ b/src/hooks/useOrder.ts @@ -99,7 +99,6 @@ export async function handleRefundOrderHooks(id: number, orderType: number) { // 退款延迟-1.5秒钟后再执行(同步等待) await new Promise(resolve => setTimeout(resolve, 1500)); - console.log("🚀 ~ handleRefundOrderHooks ~ 退款延迟:") uni.hideLoading(); return true; } catch (error) { diff --git a/src/hooks/useTeaSpecialistOrder.ts b/src/hooks/useTeaSpecialistOrder.ts index 0809857..b94670e 100644 --- a/src/hooks/useTeaSpecialistOrder.ts +++ b/src/hooks/useTeaSpecialistOrder.ts @@ -1,6 +1,6 @@ import { router } from '@/utils/tools' import { toast } from '@/utils/toast' -import { cancelTeaSpecialistOrder, deleteTeaSpecialistOrder, confirmTeaSpecialistOrder, refundTeaSpecialistOrder } from '@/api/teaSpecialist-order' +import { cancelTeaSpecialistOrder, deleteTeaSpecialistOrder, applyTeaSpecialistRefund } from '@/api/tea-specialist' /** * 取消订单 @@ -8,47 +8,10 @@ import { cancelTeaSpecialistOrder, deleteTeaSpecialistOrder, confirmTeaSpecialis */ export async function handleCancelOrderHooks(orderId: number) { try { - const response = await cancelTeaSpecialistOrder({ id: orderId }) - uni.$emit('refreshOrderList') - uni.$emit('refreshOrderDetail') + await cancelTeaSpecialistOrder(orderId) + return true } catch (error) { - router.navigateBack() - throw error - } -} - -/** - * 重新支付 - * @param orderId 订单ID - * @param teaSpecialistId 茶艺师ID - * @returns - */ -export function handleToPayHooks(orderId: number, teaSpecialistId: number) { - try { - uni.$on('payment', params => { - console.log("🚀 ~ params:", params) - setTimeout(() => { - uni.$off("payment") - uni.$emit('refreshOrderList') - uni.$emit('refreshOrderDetail') - if (params.result) { - uni.redirectTo({ - url: `/pages/notice/reserve?type=teaSpecialist&orderId=${params.orderId}` - }) - } else { - uni.redirectTo({ - url: '/bundle/order/tea-specialist/order-list' - }) - } - }, 1000) - }) - - setTimeout(() => { - router.navigateTo(`/pages/cashier/cashier?from=order&orderId=${orderId}&teaSpecialistId=${teaSpecialistId}`) - }, 800) - } catch (error) { - toast.info('订单提交失败,请稍后重试') - return + return false } } @@ -57,41 +20,23 @@ export function handleToPayHooks(orderId: number, teaSpecialistId: number) { */ export async function handleDeleteOrderHooks(orderId: number) { try { - const response = await deleteTeaSpecialistOrder({ id: orderId }) - uni.$emit('refreshOrderList') - uni.$emit('refreshOrderDetail') + await deleteTeaSpecialistOrder(orderId) + return true } catch (error) { - router.navigateBack() - throw error + return false } } -/** - * 确认(完成)订单 - */ -export async function handleConfirmOrderHooks(orderId: number) { - try { - const response = await confirmTeaSpecialistOrder({ id: orderId }) - uni.$emit('refreshOrderList') - uni.$emit('refreshOrderDetail') - } catch (error) { - router.navigateBack() - throw error - } -} - /** * 订单退款 * @param orderId 订单ID * @param orderType 订单类型 */ -// export async function handleRefundOrderHooks(orderId: number, orderType: string) { -// try { -// const response = await refundTeaSpecialistOrder({ id: orderId, order_type: orderType }) -// uni.$emit('refreshOrderList') -// uni.$emit('refreshOrderDetail') -// } catch (error) { -// router.navigateBack() -// throw error -// } -// } \ No newline at end of file +export async function handleRefundTeaSpecialistOrderHooks(orderId: number, orderType: number) { + try { + await applyTeaSpecialistRefund(orderId, orderType) + return true + } catch (error) { + return false + } +} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 41e7a8d..bfc94ae 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,7 @@ import App from './App.vue' import { requestInterceptor } from './http/interceptor' import { routeInterceptor } from './router/interceptor' import NavBar from '@/components/Navbar.vue' +import useShare from '@/hooks/useShare' import store from './store' import '@/style/index.scss' @@ -11,7 +12,6 @@ import 'virtual:uno.css' import { getNavBarHeight, getCapsuleOffset } from '@/utils/index' - export function createApp() { const app = createSSRApp(App) /* 注册全局组件 */ @@ -20,11 +20,15 @@ export function createApp() { app.use(store) app.use(routeInterceptor) app.use(requestInterceptor) + app.use(VueQueryPlugin) app.provide('OSS', 'https://shchazhi.oss-cn-hangzhou.aliyuncs.com/fronted/') app.provide('navbarHeight', getNavBarHeight()) app.provide('capsuleOffset', getCapsuleOffset()) + + app.mixin(useShare()) + return { app, } diff --git a/src/manifest.json b/src/manifest.json index f8510d6..b747558 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -91,7 +91,8 @@ }, "usingComponents": true, "requiredPrivateInfos": [ - "getLocation" + "getLocation", + "chooseLocation" ], "optimization": { "subPackages": true diff --git a/src/pages/cashier/cashier.vue b/src/pages/cashier/cashier.vue index 7365e37..ecd948b 100644 --- a/src/pages/cashier/cashier.vue +++ b/src/pages/cashier/cashier.vue @@ -41,7 +41,7 @@ - + {{ isGroupBuying ? '立即购买' : '立即预定' }} @@ -50,7 +50,7 @@ diff --git a/src/pages/my/my.vue b/src/pages/my/my.vue index 2805bde..089e0b0 100644 --- a/src/pages/my/my.vue +++ b/src/pages/my/my.vue @@ -103,7 +103,7 @@ - + @@ -133,6 +133,24 @@ + + + + + {{ item.type_id == 1 ? '茶艺师券' : '茶室券' }} + + + {{ item.coupon_price }} + + {{ item.name }} + + {{ item.use == 1 ? '已领取' : '立即领取' }} + + + + + @@ -174,7 +192,7 @@ - + @@ -237,7 +255,8 @@