完善茶艺师接口对接
This commit is contained in:
@ -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) {
|
||||
|
||||
@ -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
|
||||
// }
|
||||
// }
|
||||
export async function handleRefundTeaSpecialistOrderHooks(orderId: number, orderType: number) {
|
||||
try {
|
||||
await applyTeaSpecialistRefund(orderId, orderType)
|
||||
return true
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user