对接订单相关接口

This commit is contained in:
wangxiaowei
2025-12-19 01:39:09 +08:00
parent 10aae8ea46
commit eee48dd9aa
13 changed files with 379 additions and 810 deletions

View File

@ -137,11 +137,12 @@
<view class="font-bold text-30rpx leading-42rpx text-[#303133] mr-10rpx line-1">{{ order.store_name }}</view>
</view>
</view>
<view class="font-400 text-28rpx leading-40rpx mt-12rpx text-[#4C9F44]">
<text v-if="order.order_status === AdminOrderStatus.ToUse" class="text-[#FF5951]" >待使用</text>
<text v-if="order.order_status === AdminOrderStatus.Consuming">使用中</text>
<text v-if="order.order_status === AdminOrderStatus.Finished" class="text-[#606266]">完成</text>
<text v-if="order.order_status === AdminOrderStatus.Cancelled" class="text-[#C9C9C9]">订单取消</text>
<text v-if="order.order_status === AdminOrderStatus.Cancelled" class="text-[#C9C9C9]">取消订单</text>
</view>
</view>
<view class="mt-22rpx">
@ -164,16 +165,16 @@
<template v-if="order.order_status === AdminOrderStatus.ToUse || order.order_status === AdminOrderStatus.Consuming">
<view class="text-center flex items-center text-28rpx mt-28rpx justify-end">
<view class="w-178rpx h-70rpx rounded-8rpx border-[2rpx] border-[#9CA3AF] text-[#303133] mr-28rpx flex items-center justify-center"
@click="ComboCard.handleCancelOrder(OrderSource.TeaRoom)">释放时间</view>
@click="ComboCard.handleReleaseOrder(order.id)">释放时间</view>
<view class="w-178rpx h-70rpx rounded-8rpx border-[2rpx] border-[#4C9F44] text-[#4C9F44] flex items-center justify-center"
@click="ComboCard.handleToPayOrder(OrderSource.TeaRoom)">取消订单</view>
@click="ComboCard.handleCancelOrder(order.id)">取消订单</view>
</view>
</template>
<template v-if="order.order_status === AdminOrderStatus.Finished || order.order_status === AdminOrderStatus.Cancelled">
<view class="text-center flex items-center text-28rpx mt-28rpx justify-end">
<view class="w-178rpx h-70rpx rounded-8rpx border-[2rpx] border-[#9CA3AF] text-[#303133] mr-28rpx flex items-center justify-center"
@click="ComboCard.handleCancelOrder(OrderSource.TeaRoom)">删除</view>
<view class="w-178rpx h-70rpx rounded-8rpx border-[2rpx] border-[#9CA3AF] text-[#303133] flex items-center justify-center"
@click="ComboCard.handleDeleteOrder(order.id)">删除</view>
</view>
</template>
</view>
@ -185,18 +186,19 @@
</template>
<script lang="ts" setup name="ComboCard">
import { OrderSource, OrderStatus, AdminOrderStatus, TeaRoomPackageOrderStatus } from '@/utils/order'
import { OrderSource, AdminOrderStatus } from '@/utils/order'
import { useMessage } from 'wot-design-uni'
import { toast } from '@/utils/toast'
import { handleTRCancelOrderHooks, handleTRDeleteOrderHooks, handleTRToPayHooks, handleToTRStoreHooks, handleTGOrderRefundHooks } from '@/hooks/useOrder'
import { StoreType } from '@/utils/tea'
import { handleReleaseTeaRoomOrderHookds, handleCancelOrderHooks, handleDeleteOrderHooks } from '@/hooks/useOrder'
import { router } from '@/utils/tools'
import { toTimes, copy } from '@/utils/tools'
// 改价弹窗
const showChangePricePopup = ref<boolean>(false)
const changePrice = ref<string>('')
// 取消订单弹窗
const message = useMessage('wd-message-box-slot')
/**
* ComboCard 套餐卡片组件
* @description 展示订单列表套餐卡片信息
@ -219,8 +221,8 @@
}
})
// 取消订单弹窗
const message = useMessage('wd-message-box-slot')
const emit = defineEmits(['refresh'])
const ComboCard = {
/**
@ -300,7 +302,7 @@
/**
* 删除订单
*/
handleDeleteOrder: (source: string) => {
handleDeleteOrder: (orderId: number) => {
message.confirm({
title: '确定删除订单?',
msg: '删除订单后无法恢复,是否确认删除订单?',
@ -313,22 +315,12 @@
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
}
}).then((res) => {
switch (source) {
case OrderSource.Combo:
// TODO 这里调用删除直营订单的接口
break;
case OrderSource.DouYin:
// TODO 这里调用删除抖音订单的接口
break;
case OrderSource.TeaRoom:
// 这里调用删除茶室订单的接口
handleTRDeleteOrderHooks(props.order.id)
break;
case OrderSource.TeaSpecialist:
// TODO 这里调用删除茶室订单的接口
break;
default:
break;
if (res.action == 'confirm') {
uni.$on('refreshOrderList', () => {
emit('refresh')
uni.$off('refreshOrderList')
})
handleDeleteOrderHooks(orderId)
}
}).catch(() => {
// 点击取消按钮回调事件
@ -338,7 +330,7 @@
/**
* 取消订单
*/
handleCancelOrder: (source: string) => {
handleCancelOrder: (orderId: number) => {
message.confirm({
title: '确定取消订单?',
msg: '取消订单后无法恢复,优惠券可退回',
@ -352,23 +344,11 @@
}
}).then((res) => {
if (res.action == 'confirm') {
switch (source) {
case OrderSource.Combo:
// TODO 这里调用删除直营订单的接口
break;
case OrderSource.DouYin:
// TODO 这里调用删除抖音订单的接口
break;
case OrderSource.TeaRoom:
// 这里调用删除茶室订单的接口
handleTRCancelOrderHooks(props.order.id)
break;
case OrderSource.TeaSpecialist:
// TODO 这里调用删除茶室订单的接口
break;
default:
break;
}
uni.$on('refreshOrderList', () => {
emit('refresh')
uni.$off('refreshOrderList')
})
handleCancelOrderHooks(orderId)
}
}).catch(() => {
// 点击取消按钮回调事件
@ -376,26 +356,30 @@
},
/**
* 支付
* 释放时间
*/
handleToPayOrder: (source: string) => {
switch (source) {
case OrderSource.Combo:
router.navigateTo(`/bundle/order/platform/order-detail?orderStatus=${props.orderStatus}&toPay=true`)
break;
case OrderSource.DouYin:
router.navigateTo(`/bundle/order/douyin/douyin-order-detail?orderStatus=${props.orderStatus}&toPay=true`)
break;
case OrderSource.TeaRoom:
handleTRToPayHooks(props.order.id, props.order.room_name, props.order.store_id)
break;
case OrderSource.TeaSpecialist:
router.navigateTo( `/bundle/order/tea-specialist/order-detail?orderStatus=${props.orderStatus}&toPay=true`)
break;
default:
break;
}
}
handleReleaseOrder: (orderId: number) => {
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') {
uni.$on('refreshOrderList', () => {
emit('refresh')
uni.$off('refreshOrderList')
})
handleReleaseTeaRoomOrderHookds(orderId)
}
}).catch(() => { })
},
}
</script>