diff --git a/src/api/pay.ts b/src/api/pay.ts index b98cef4..ced767b 100644 --- a/src/api/pay.ts +++ b/src/api/pay.ts @@ -9,6 +9,7 @@ export interface IPrePayParams { pay_way: number order_source: number order_type: number + store_id: number } export function prePay(data: IPrePayParams) { @@ -19,7 +20,9 @@ export function prePay(data: IPrePayParams) { * 余额支付接口 */ export interface ITeaSpecialistPayParams { - id: number + id: number, + store_id: number, + pay_way: number } export function balancePay(data: ITeaSpecialistPayParams) { @@ -30,7 +33,7 @@ export function balancePay(data: ITeaSpecialistPayParams) { * 获取退款订单ID */ export interface IRefundOrderParams { - order_id: number + id: number order_type: number } diff --git a/src/api/types/tea.ts b/src/api/types/tea.ts index 9655d4b..1364f4c 100644 --- a/src/api/types/tea.ts +++ b/src/api/types/tea.ts @@ -94,6 +94,7 @@ export interface ICreateTeaSpecialistOrderResult { * 订单详情返回结果 */ export interface ITeaSpecialistOrderDetailsResult { + id?: number order_amount: string order_sn: string store_id: number @@ -127,6 +128,7 @@ export interface ITeaSpecialistOrderDetailsResult { dtime: string update_dtime: string renew_price: number, + renew_hour?: number, renew_dtime: { start_time: string end_time: string diff --git a/src/api/user.ts b/src/api/user.ts index ba3fb3c..4d369b8 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -177,4 +177,11 @@ export function getUserBillDetails(id: number) { */ export function transferOrder(order_id: number) { return http.Post('/api/order/transferOrder', {order_id}) +} + +/** + * 用户一件授权手机号 + */ +export function getMobileByMnp(code: string) { + return http.Post('/api/user/getMobileByMnp', {code}) } \ No newline at end of file diff --git a/src/bundle/order/platform/order-detail.vue b/src/bundle/order/platform/order-detail.vue index 71264be..7036b14 100644 --- a/src/bundle/order/platform/order-detail.vue +++ b/src/bundle/order/platform/order-detail.vue @@ -297,7 +297,8 @@ */ handleToRefund: () => { message.confirm({ - title: '是否申请退款?', + title: '提示', + msg: '是否申请退款?', confirmButtonText: '确定', cancelButtonText: '取消', cancelButtonProps: { @@ -308,7 +309,7 @@ } }).then((res) => { if (res.action == 'confirm') { - let res = handleRefundOrderHooks(order.value.user_group.id, PayOrderType.ComboRefund) + let res = handleRefundOrderHooks(order.value.id, PayOrderType.ComboRefund) if (res) { OrderDetail.handleInit() uni.$emit('refreshComboOrderList') diff --git a/src/bundle/order/tea-room/order-detail.vue b/src/bundle/order/tea-room/order-detail.vue index 95ba261..cacd691 100644 --- a/src/bundle/order/tea-room/order-detail.vue +++ b/src/bundle/order/tea-room/order-detail.vue @@ -100,7 +100,7 @@ 使用过程中有任何问题,请联系客服 - + 品一口香茗,让生活慢下来,从一杯好茶开始 + + + 退款成功¥{{ order.order_amount }} + + 谢谢您的信任,我们一定会做的更好 + {{ order.update_dtime }} + - + @@ -145,9 +152,11 @@ 预约信息 - 预约时间:{{ order.day_time }} {{ order?.renew_dtime?.start_time || order?.start_time }}-{{ order?.renew_dtime?.end_time || order?.end_time }} + 预约时间:{{ order.day_time }} {{ order?.start_time }}-{{ order?.end_time }} - 预约时长:{{ order.hours }}小时 + + 预约时长:{{ Number(order.hours) + Number(order.renew_hour || 0) }}小时 + + + + + 续订信息 + + 续订时长 + {{ order.renew_hour }} 小时 + + + 开门锁 @@ -193,7 +212,7 @@ 适用门店 - + @@ -244,9 +263,9 @@ - + - + 分享房间给朋友 @@ -257,21 +276,15 @@ 立即支付¥{{ order.order_amount }} - + - 取消 - - - - - - 费用明细 - - - + + 申请退款 - 立即预定 - --> + 分享房间给朋友 + 再次预定 - - @@ -289,7 +300,7 @@ import { useMessage } from 'wot-design-uni' import {toast} from '@/utils/toast' import { getTeaRoomOrderDetail } from '@/api/tea-room' - import { handleTRCancelOrderHooks, handleTRToPayHooks, handleToTRStoreHooks } from '@/hooks/useOrder' + import { handleTRCancelOrderHooks, handleTRToPayHooks, handleToTRStoreHooks, handleRefundOrderHooks } from '@/hooks/useOrder' import type { ITeaSpecialistOrderDetailsResult } from '@/api/types/tea' import { router } from '@/utils/tools' import { ReserveServiceCategory, OrderType } from '@/utils/order' @@ -298,6 +309,7 @@ import { transferOrder } from '@/api/user' import { toTimes, copy } from '@/utils/tools' import { useUserStore } from '@/store' + import { PayOrderType } from '@/utils/pay' const OSS = inject('OSS') @@ -356,6 +368,7 @@ // 订单 const orderId = ref(0) const order = ref({ + id: 0, order_amount: '', order_sn: '', store_id: 0, @@ -389,6 +402,7 @@ dtime: '', update_dtime: '', renew_price: 0, + renew_hour: 0, renew_dtime: { start_time: '', end_time: '', @@ -636,8 +650,6 @@ * 转让订单 */ handleTransferOrder: async () => { - console.log('开始转让订单2') - message.confirm({ title: '提示', msg: '是否接收该笔订单?', @@ -663,6 +675,34 @@ }).catch(() => { // 点击取消按钮回调事件 }) + }, + + /** + * 申请退款 + */ + handleRefundOrder: () => { + message.confirm({ + title: '提示', + msg: '是否申请退款?', + confirmButtonText: '确定', + cancelButtonText: '取消', + cancelButtonProps: { + customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx', + }, + confirmButtonProps: { + customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx', + } + }).then(async (res) => { + if (res.action == 'confirm') { + // 改为当前退款订单ID + let res = await handleRefundOrderHooks(order.value.id, PayOrderType.TeaRoom) + console.log("🚀 ~ res:", res) + if (res) { + OrderDetail.handleInit() + uni.$emit('refreshOrderList') + } + } + }).catch(() => {}) } } diff --git a/src/bundle/profile/profile.vue b/src/bundle/profile/profile.vue index 1aac503..445a7f5 100644 --- a/src/bundle/profile/profile.vue +++ b/src/bundle/profile/profile.vue @@ -86,7 +86,7 @@ - + 昵称 @@ -100,20 +100,19 @@ - - + @@ -129,6 +128,7 @@ import type { IUserResult } from '@/api/types/user' import { router } from '@/utils/tools' import { useUserStore } from '@/store' + import { getMobileByMnp } from '@/api/user' const OSS = inject('OSS') const showLogoutPopup = ref(false) // 是否显示退出登录弹出框 @@ -221,10 +221,8 @@ /** * 修改手机号 */ - handleToEditMobile: () => { - uni.navigateTo({ - url: '/pages/login/mobile?type=edit&userId=123' // userId仅做测试使用,实际请传真实用户ID - }) + handleToEditMobile: async (e: any) => { + const res = await getMobileByMnp(e.code) }, /** diff --git a/src/bundle/tea-room/detail.vue b/src/bundle/tea-room/detail.vue index bb007df..6796d74 100644 --- a/src/bundle/tea-room/detail.vue +++ b/src/bundle/tea-room/detail.vue @@ -499,11 +499,11 @@ uni.$off('chooseCoupon') if (type === CouponType.Discount) { - selectedCoupon.value = {id: params.coupon.user_coupon_id, name: `${params.coupon.name}减${params.coupon.coupon_price}` } + selectedCoupon.value = {id: params.coupon.id, name: `${params.coupon.name}减${params.coupon.coupon_price}` } bill.value.coupon = params.coupon.coupon_price selectCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID,保存下来是为了回显列表的,没有其他作用 } else { - selectedGroupCoupon.value = {id: params.coupon.group_id, name: `团购券-${params.coupon?.title}` } + selectedGroupCoupon.value = {id: params.coupon.id, name: `团购券-${params.coupon?.title}` } bill.value.groupCoupon = params.coupon.coupon_price selectGroupCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID,保存下来是为了回显列表的,没有其他作用 } @@ -513,6 +513,7 @@ // 获取预定了几个小时 const count = bill.value.service.num + console.log("🚀 ~ bill.value:", bill.value) console.log("🚀 ~ selectCouponId:", selectCouponId.value) router.navigateTo(`/bundle/coupon/coupon?id=${id.value}&numbers=${count}&type=${type}&storeId=${storeId.value}&couponId=${selectCouponId.value}&groupCouponId=${selectGroupCouponId.value}`) @@ -588,7 +589,6 @@ } catch (error) { uni.hideLoading() isSubmitting.value = false - toast.info('订单提交失败,请稍后重试') return } // 正常流程下,isSubmitting.value 会在支付回调中重置 diff --git a/src/bundle/wallet/recharge.vue b/src/bundle/wallet/recharge.vue index 25d7d91..685e8da 100644 --- a/src/bundle/wallet/recharge.vue +++ b/src/bundle/wallet/recharge.vue @@ -164,7 +164,8 @@ order_id: res.order_id, pay_way: 2, order_source: PayOrderSource.MINI, //订单来源:1-小程序; 2-h5; 3app - order_type: PayOrderType.Recharge + order_type: PayOrderType.Recharge, + store_id: 0 }) wechatPay(pay.pay.config).then((res) => { diff --git a/src/components/BookingTime.vue b/src/components/BookingTime.vue index 77eb63e..e12dc18 100644 --- a/src/components/BookingTime.vue +++ b/src/components/BookingTime.vue @@ -8,7 +8,7 @@ - + diff --git a/src/components/order/ComboCard.vue b/src/components/order/ComboCard.vue index 9bc84eb..dd5360d 100644 --- a/src/components/order/ComboCard.vue +++ b/src/components/order/ComboCard.vue @@ -21,7 +21,7 @@ - + @@ -39,16 +39,16 @@ + class="w-178rpx h-70rpx leading-70rpx rounded-8rpx border-[2rpx] border-[#9CA3AF] text-[#303133]"> + 申请退款 - 立即预定 - + --> @@ -75,7 +75,7 @@ - + @@ -85,9 +85,9 @@ - + @@ -110,13 +110,14 @@ 消费中 已预约 完成 - 订单取消 + 订单取消 + 已退款 - + @@ -154,7 +155,7 @@ - + @@ -273,7 +274,8 @@ */ handleOrderRefund: (order: any, source: string) => { message.confirm({ - title: '是否申请退款?', + title: '提示', + msg: '是否申请退款?', confirmButtonText: '确定', cancelButtonText: '取消', cancelButtonProps: { @@ -294,16 +296,6 @@ } // TODO 这里调用删除直营订单的接口 break; - case OrderSource.DouYin: - // TODO 这里调用删除抖音订单的接口 - break; - case OrderSource.TeaRoom: - // 这里调用删除茶室订单的接口 - handleTRDeleteOrderHooks(props.order.id) - break; - case OrderSource.TeaSpecialist: - // TODO 这里调用删除茶室订单的接口 - break; default: break; } diff --git a/src/hooks/useOrder.ts b/src/hooks/useOrder.ts index 846c20a..e069688 100644 --- a/src/hooks/useOrder.ts +++ b/src/hooks/useOrder.ts @@ -87,15 +87,15 @@ export async function handleTRConfirmOrderHooks(orderId: number) { /** * 订单退款 - * @param orderId 订单ID + * @param id 订单的主键 * @param orderType 订单类型 */ -export async function handleRefundOrderHooks(orderId: number, orderType: number) { +export async function handleRefundOrderHooks(id: number, orderType: number) { try { uni.showLoading({ title: '退款中...' }) - const res = await submitRefund({ order_id: orderId, order_type: orderType }) + const res = await submitRefund({ id, order_type: orderType }) await refund({ id: res.id }) - toast.info('退款成功,退款有延迟,请耐心等待,注意查收') + toast.info('退款成功,注意查收') // 退款延迟-1.5秒钟后再执行 setTimeout(() => { diff --git a/src/pages.json b/src/pages.json index a64b4ef..4517cf8 100644 --- a/src/pages.json +++ b/src/pages.json @@ -169,6 +169,15 @@ "navigationStyle": "custom" } }, + { + "path": "pages/webview/webview", + "type": "page", + "needLogin": true, + "layout": "tabbar", + "style": { + "navigationStyle": "custom" + } + }, { "path": "pages/share/tea-room/share-order-detail", "type": "page", diff --git a/src/pages/cashier/cashier.vue b/src/pages/cashier/cashier.vue index 4eaa9b0..e889213 100644 --- a/src/pages/cashier/cashier.vue +++ b/src/pages/cashier/cashier.vue @@ -248,20 +248,27 @@ if (isGroupBuying.value) { // 购买团购套餐 ordeType = PayOrderType.BuyCombo + } else if (renew.value) { + // 续订包间 + ordeType = PayOrderType.RenewRoom } + console.log("🚀 ~ PayValueMap[pay.value]:", PayValueMap[pay.value]) const res = await prePay({ from: PayValueMap[pay.value], order_id: orderId.value, pay_way: pay.value, order_source: PayOrderSource.MINI, //订单来源:1-小程序; 2-h5; 3app - order_type: ordeType // 0为茶艺师 1为茶室包间 2为茶室套餐 + order_type: ordeType, // 0为茶艺师 1为茶室包间 2为茶室套餐 + store_id: storeId.value || 0 }) // 余额支付(平台余额、门店余额) if (pay.value == PayValue.PlatformBalance || pay.value == PayValue.StoreBalance) { await balancePay({ - id: res.pay + id: res.pay, + store_id: storeId.value || 0, + pay_way: pay.value, }) uni.hideLoading() diff --git a/src/pages/my/my.vue b/src/pages/my/my.vue index 170b31c..2156fa5 100644 --- a/src/pages/my/my.vue +++ b/src/pages/my/my.vue @@ -57,10 +57,10 @@ {{ isLogin ? user.coupon_count : '- -' }} 优惠券 - + diff --git a/src/pages/search/search.vue b/src/pages/search/search.vue index 7599315..1028359 100644 --- a/src/pages/search/search.vue +++ b/src/pages/search/search.vue @@ -42,7 +42,7 @@ - + {{ item.content }} diff --git a/src/utils/order.ts b/src/utils/order.ts index 7631363..27d9559 100644 --- a/src/utils/order.ts +++ b/src/utils/order.ts @@ -218,6 +218,7 @@ export enum TeaRoomOrderStatus { Consumption = 2, // 消费中 Finished = 3, // 完成 Cancelled = 4, // 订单取消 + Refunded = 5, // 已退款 } // 包间订单状态文本 @@ -228,6 +229,7 @@ export enum TeaRoomOrderStatusText { Consumption = 'consumption', // 消费中 Finished = 'finished', // 已完成 Cancelled = 'cancelled', // 已取消 + Refunded = 'refunded', // 已取消 } // 状态内容映射 @@ -246,6 +248,9 @@ export const TeaRoomOrderStatusTextValue: Record = { }, [TeaRoomOrderStatus.Cancelled]: { title: '订单取消' + }, + [TeaRoomOrderStatus.Refunded]: { + title: '已退款' }, } @@ -257,9 +262,10 @@ export const TeaRoomOrderStatusValue: Record