diff --git a/src/api/pay.ts b/src/api/pay.ts index a510a95..b98cef4 100644 --- a/src/api/pay.ts +++ b/src/api/pay.ts @@ -24,4 +24,27 @@ export interface ITeaSpecialistPayParams { export function balancePay(data: ITeaSpecialistPayParams) { return http.Post('/api/pay/yuePay', data) +} + +/** + * 获取退款订单ID + */ +export interface IRefundOrderParams { + order_id: number + order_type: number +} + +export function submitRefund(data: IRefundOrderParams) { + return http.Post('/api/order/submitRefund', data) +} + +/** + * 退款 + */ +export interface IRefundParams { + id: number +} + +export function refund(data: IRefundParams) { + return http.Post('/api/pay/refund', data) } \ No newline at end of file diff --git a/src/api/tea-room.ts b/src/api/tea-room.ts index a0d2264..8cef408 100644 --- a/src/api/tea-room.ts +++ b/src/api/tea-room.ts @@ -306,6 +306,7 @@ export interface ITeaRoomPackageOrderListParams { use_status: string operation_type: number search: string + type: number // 1:本地套餐 2.抖音套餐 } export function getTeaRoomPackageOrderList(data: ITeaRoomPackageOrderListParams) { @@ -352,15 +353,16 @@ export function calculateTeaRoomPrice(data: ICalculateTeaRoomPriceParams) { */ export interface ITeaRoomGroupCouponListParams { store_id: number + room_id: number } export function getTeaRoomGroupCouponList(data: ITeaRoomGroupCouponListParams) { - return http.Post<{list: {}}>('/api/order/teaStoreGroupUseLists', data) + return http.Post('/api/order/teaStoreGroupUseLists', data) } /** * 充值接口 */ export function teaRoomRecharge(money: number) { - return http.Post<{id: number}>('/api/recharge/recharge', {money}) + return http.Post('/api/recharge/recharge', {money}) } \ No newline at end of file diff --git a/src/api/types/tea-room.ts b/src/api/types/tea-room.ts index 9884c54..c3d6315 100644 --- a/src/api/types/tea-room.ts +++ b/src/api/types/tea-room.ts @@ -92,6 +92,7 @@ export interface ITeaRoomPackageDetailsResult { img: string introduce: string introduce_details: string + discount_price: string price: string returd_details: string update_dtime: string @@ -101,18 +102,21 @@ export interface ITeaRoomPackageDetailsResult { sold: number status: number store_id: number + } /** * 茶室套餐-订单详情接口返回数据 */ export interface ITeaRoomPackageOrderDetailsResult { + id: number pay: number pay_way_title: string order_amount: string order_sn: string order_status: number dtime: string + update_dtime?: string pay_dtime: string coupon_code?: string, coupon_code_img?: string, @@ -133,5 +137,11 @@ export interface ITeaRoomPackageOrderDetailsResult { store_id: number distance: string, operation_type: number + }, + user_group: { + qr_url: string + qr_sn: string + status: number + id?: number } } \ No newline at end of file diff --git a/src/api/user.ts b/src/api/user.ts index 640d211..ba3fb3c 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -171,3 +171,10 @@ export function getUserMember() { export function getUserBillDetails(id: number) { return http.Post('/api/user/accountDetails', {id}) } + +/** + * 转让订单 + */ +export function transferOrder(order_id: number) { + return http.Post('/api/order/transferOrder', {order_id}) +} \ No newline at end of file diff --git a/src/bundle/collect/collect.vue b/src/bundle/collect/collect.vue index 25ca9c5..7c2e245 100644 --- a/src/bundle/collect/collect.vue +++ b/src/bundle/collect/collect.vue @@ -18,7 +18,8 @@ - + + diff --git a/src/bundle/coupon/coupon.vue b/src/bundle/coupon/coupon.vue index 2846c08..63a5dc7 100644 --- a/src/bundle/coupon/coupon.vue +++ b/src/bundle/coupon/coupon.vue @@ -33,6 +33,7 @@ showChecked :checked="item.id === checkedId" :onCheck="Coupons.handleCheck" + couponType="coupon" :class="index !== couponList.use.length - 1 ? 'mb-20rpx' : ''" > @@ -51,6 +52,7 @@ :coupon="item" :canUse="false" showChecked + couponType="coupon" :checked="item.id === checkedId" :onCheck="Coupons.handleCheck" :class="index !== couponList.no_use.length - 1 ? 'mb-20rpx' : ''" @@ -65,7 +67,7 @@ 可用团购券 - 2张 + {{ groupCouponList.length }}张 @@ -74,6 +76,7 @@ :key="item.id" :coupon="item" canUse + couponType="groupCoupon" :checked="item.id === checkedId" :onCheck="Coupons.handleCheck" :class="index !== groupCouponList.length - 1 ? 'mb-20rpx' : ''" @@ -128,7 +131,7 @@ no_use: [], use: [] }) - const groupCouponList = ref() + const groupCouponList = ref>([]) const checkedId = ref(0) const unCouponList = ref([ @@ -141,6 +144,7 @@ onLoad((args) => { teaRoomId.value = args.id + console.log("🚀 ~ teaRoomId.value:", teaRoomId.value) storeId.value = args.storeId || 0 couponType.value = args.type // 1:优惠券 2:团购券 @@ -168,7 +172,9 @@ * 初始化团购券列表 */ handleInitGroupCoupon: async (id: number, numbers: number) => { - const res = await getTeaRoomGroupCouponList({store_id: storeId.value}) + console.log("🚀 ~ teaRoomId.value2:", teaRoomId.value) + + const res = await getTeaRoomGroupCouponList({store_id: storeId.value, room_id: teaRoomId.value}) groupCouponList.value = res.list }, diff --git a/src/bundle/order/after-sales/after-sales.vue b/src/bundle/order/after-sales/after-sales.vue index f93408b..0c7734f 100644 --- a/src/bundle/order/after-sales/after-sales.vue +++ b/src/bundle/order/after-sales/after-sales.vue @@ -342,6 +342,7 @@ // 团购套餐 const comboOrder = ref({ + id: 0, pay: 0, pay_way_title: '', order_amount: '', @@ -366,6 +367,11 @@ store_id: 0, distance: '', operation_type: 1 + }, + user_group: { + qr_url: '', + qr_sn: '', + status: 0 } }) diff --git a/src/bundle/order/douyin/douyin-order-detail.vue b/src/bundle/order/douyin/douyin-order-detail.vue index 620c38f..a2a7d88 100644 --- a/src/bundle/order/douyin/douyin-order-detail.vue +++ b/src/bundle/order/douyin/douyin-order-detail.vue @@ -15,26 +15,27 @@ - 请在2025.12.31(含)前使用 - 品一口香茗,让生活慢下来,从一杯好茶开始 + + + 品一口香茗,让生活慢下来,从一杯好茶开始 - + - 这是团购套餐的名字 - ¥324 + {{ order.group.title }} + ¥{{ order.group.price }} - 3小时 + {{ order.group.hour }}小时 - 适用包间:青茶、红茶、绿茶 + 适用包间:{{ order.room_name }} @@ -45,24 +46,24 @@ 适用门店 - + - 这是商家的名称这是 - 距您9km + {{ order.store.name }} + 距您{{ order.store.distance }}km - 青浦区仓路478号青浦区仓路478号青浦区仓路478号青浦区仓路478号青浦区仓路478号青浦区仓路478号 + {{ order.store.address }} - + - + @@ -76,48 +77,64 @@ 订单编号 - 7327328627526903 + {{ order.order_sn }} - 复制 + 复制 创建时间 - 2019-05-16 12:20:26 + {{ order.dtime }} - - - - - 立即预定 - + + + + 立即预定 diff --git a/src/bundle/order/douyin/excharge.vue b/src/bundle/order/douyin/excharge.vue index 9a3a0ed..0584420 100644 --- a/src/bundle/order/douyin/excharge.vue +++ b/src/bundle/order/douyin/excharge.vue @@ -44,12 +44,12 @@ - + - + @@ -91,13 +91,13 @@ uni.scanCode({ success: async (res) => { console.log("🚀 ~ res:", res) - if(res.result) { - code.value = res.result + if(res.rawData) { + code.value = res.rawData uni.showLoading({ title: '兑换中...' }) try { const params = { store_id: storeId.value, - code: res.result.replace(/\s+/g, ''), + code: res.rawData.replace(/\s+/g, ''), type: 1 } diff --git a/src/bundle/order/douyin/order-list.vue b/src/bundle/order/douyin/order-list.vue index 648cf2b..1cd0fc2 100644 --- a/src/bundle/order/douyin/order-list.vue +++ b/src/bundle/order/douyin/order-list.vue @@ -84,7 +84,8 @@ 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, DouYinOrderStatusText } from '@/utils/order' + import { OrderSource, DouYinOrderStatusText, DouYinOrderStatusValue } from '@/utils/order' + import { getTeaRoomPackageOrderList } from '@/api/tea-room' /* mescroll */ @@ -107,47 +108,26 @@ const tab = ref('all') const OrderList = { - // 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10 - 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(); // 请求失败, 结束加载 - // }) + upCallback: (mescroll) => { + const filter = { + page: mescroll.num, + size: mescroll.size, + operation_type: currentType.value, + use_status: orderStatus.value, + search: keywords.value, + type: 2 // 1:本地套餐 2.抖音套餐 + } + 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() // 请求失败, 结束加载 + }) }, + // 去兑换 handleToExcharge: () => { uni.navigateTo({ @@ -164,10 +144,10 @@ // 切换tab handleChangeTabs: (e: {index: number, name: string}) => { tab.value = e.name - if (e.name === TeaRoomOrderStatusText.Pending) { + if (e.name === DouYinOrderStatusText.ToUse) { orderStatus.value = '0' } else { - orderStatus.value = TeaRoomOrderStatusValue[e.name] || '' + orderStatus.value = DouYinOrderStatusValue[e.name] || '' } // 切换tab时,重置当前的mescroll diff --git a/src/bundle/order/platform/order-detail.vue b/src/bundle/order/platform/order-detail.vue index 84bdba6..115a9ac 100644 --- a/src/bundle/order/platform/order-detail.vue +++ b/src/bundle/order/platform/order-detail.vue @@ -9,14 +9,18 @@ diff --git a/src/bundle/order/platform/order-list.vue b/src/bundle/order/platform/order-list.vue index bc342ac..ad18933 100644 --- a/src/bundle/order/platform/order-list.vue +++ b/src/bundle/order/platform/order-list.vue @@ -24,15 +24,13 @@ - - - + + + - - @@ -50,7 +48,7 @@ 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' + import { GroupComboOrderStatusValue, GroupComboOrderStatusText } from '@/utils/order' // mescroll const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook @@ -82,14 +80,14 @@ const tab = ref('all') onLoad(() => { - uni.$on('refreshPackageOrderList', () => { + uni.$on('refreshComboOrderList', () => { list.value = [] getMescroll().resetUpScroll() }) }) onUnload(() => { - uni.$off('refreshPackageOrderList') + uni.$off('refreshComboOrderList') }) const OrderList = { @@ -99,7 +97,8 @@ size: mescroll.size, operation_type: currentType.value, use_status: orderStatus.value, - search: keywords.value + search: keywords.value, + type: 1 // 1:本地套餐 2.抖音套餐 } getTeaRoomPackageOrderList(filter).then((res) => { const curPageData = res.list || [] // 当前页数据 @@ -125,10 +124,10 @@ */ handleChangeTabs: (e: {index: number, name: string}) => { tab.value = e.name - if (e.name === TeaRoomPackageOrderStatusText.ToUse) { + if (e.name === GroupComboOrderStatusText.ToUse) { orderStatus.value = '0' } else { - orderStatus.value = TeaRoomPackageOrderStatusValue[e.name] || '' + orderStatus.value = GroupComboOrderStatusValue[e.name] || '' } // 切换tab时,重置当前的mescroll diff --git a/src/bundle/order/tea-room/order-detail.vue b/src/bundle/order/tea-room/order-detail.vue index c5a12f8..13b837f 100644 --- a/src/bundle/order/tea-room/order-detail.vue +++ b/src/bundle/order/tea-room/order-detail.vue @@ -271,6 +271,8 @@ 再次预定 + + @@ -285,12 +287,19 @@ import { ReserveServiceCategory, OrderType } from '@/utils/order' import type { ITeaSpecialistFuture7DaysResult } from '@/api/types/tea' import { getNext7Days, renewTeaRoomOrder } from '@/api/tea-room' + import { transferOrder } from '@/api/user' import { toTimes, copy } from '@/utils/tools' + import { useUserStore } from '@/store' + const OSS = inject('OSS') const title = ref('') const orderStatus = ref(0) // 订单状态:待使用、退款等 + // 消息弹窗 + const message = useMessage('wd-message-box-slot') + + // 续订包间 const showRenewPopup = ref(false) const timeList = [ @@ -333,9 +342,6 @@ // 订单倒计时取消 const time = ref(30 * 60 * 60 * 1000) - // 取消订单弹窗 - const message = useMessage('wd-message-box-slot') - // 费用明细 const showCostPopup = ref(false) // 是否显示退款详情弹出框 @@ -392,11 +398,30 @@ const day = String(now.getDate()).padStart(2, '0'); const currentDate = `${year}-${month}-${day}`; - onLoad(async (args) => { - orderId.value = args.orderId - // 获取订单详情 - OrderDetail.handleInit() + // 页面分享来源 + const shareSource = ref('') + onLoad((args) => { + shareSource.value = args.shareSource || '' + if (args.orderId) { + orderId.value = args.orderId + // 获取订单详情 + OrderDetail.handleInit() + } + + const token = uni.getStorageSync('token') + + if (token && shareSource.value === 'TransferOrder') { + // 处理转让订单 + OrderDetail.handleTransferOrder() + } + + // 如果是从分享进入的未登录的情况下(TransferOrder),需要转让订单 + uni.$on('transferOrder', () => { + // 处理未登录的情况下 + uni.$off('transferOrder') + OrderDetail.handleTransferOrder() + }) }) onUnload(() => { @@ -407,7 +432,8 @@ if (e.from === 'button') { return { title: `我在${order.value.store_msg.name}预定了${order.value.room_msg.title},一起来吧!`, - path: `/pages/share/tea-room/share-order-detail?orderId=${orderId.value}`, + // path: `/pages/share/tea-room/share-order-detail?orderId=${orderId.value}&shareSource=TransferOrder`, + path: `/bundle/order/tea-room/order-detail?orderId=${orderId.value}&shareSource=TransferOrder`, } } }) @@ -564,8 +590,40 @@ handleChooseRenewTime: (item) => { console.log("🚀 ~ item:", item) - } + }, + /** + * 转让订单 + */ + handleTransferOrder: async () => { + console.log('开始转让订单2') + + 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((res) => { + if (res.action == 'confirm') { + console.log('开始转让订单3') + + transferOrder(orderId.value).then(res => { + console.log('开始转让订单4', res) + + toast.success('订单接收成功') + router.redirectTo('/bundle/order/tea-room/order-list', 500) + }) + } + }).catch(() => { + // 点击取消按钮回调事件 + }) + } } diff --git a/src/bundle/order/tea-specialist/order-detail.vue b/src/bundle/order/tea-specialist/order-detail.vue index f36f316..1262bfe 100644 --- a/src/bundle/order/tea-specialist/order-detail.vue +++ b/src/bundle/order/tea-specialist/order-detail.vue @@ -509,7 +509,7 @@ uni.$off('refreshOrderDetail') }) - handleRefundOrderHooks(orderId.value, 'order') + // handleRefundOrderHooks(orderId.value, 'order') }, diff --git a/src/bundle/profile/profile.vue b/src/bundle/profile/profile.vue index 7eac41b..1aac503 100644 --- a/src/bundle/profile/profile.vue +++ b/src/bundle/profile/profile.vue @@ -86,7 +86,7 @@ - + 昵称 @@ -100,8 +100,8 @@ - - + + diff --git a/src/bundle/store-recharge/store-recharge.vue b/src/bundle/store-recharge/store-recharge.vue index 96ef5ed..8f0f845 100644 --- a/src/bundle/store-recharge/store-recharge.vue +++ b/src/bundle/store-recharge/store-recharge.vue @@ -51,7 +51,7 @@ import { getNavBarHeight } from '@/utils/index' import { toast } from '@/utils/toast' import { router } from '@/utils/tools' - // import { wxpay } from '@/hooks/usePay' + // import { wechatPay } from '@/hooks/usePay' import { teaRoomRecharge } from '@/api/tea-room' let navbarHeight = ref(0) diff --git a/src/bundle/tea-room/choose-room.vue b/src/bundle/tea-room/choose-room.vue index aa72b0d..0921c28 100644 --- a/src/bundle/tea-room/choose-room.vue +++ b/src/bundle/tea-room/choose-room.vue @@ -92,6 +92,7 @@ const groupCouponOrderId = ref(0) const orderStatus = ref(0) // 订单状态:待使用、退款等 const order = ref({ + id: 0, pay: 0, pay_way_title: '', order_amount: '', @@ -116,6 +117,11 @@ store_id: 0, distance: '', operation_type: 1 + }, + user_group: { + qr_url: '', + qr_sn: '', + status: 0 } }) diff --git a/src/bundle/tea-room/detail.vue b/src/bundle/tea-room/detail.vue index 76ae9a3..5650f18 100644 --- a/src/bundle/tea-room/detail.vue +++ b/src/bundle/tea-room/detail.vue @@ -6,6 +6,7 @@ "navigationStyle": "custom" } } +