完善服务模块缺少付款页的bug
This commit is contained in:
@@ -272,6 +272,7 @@ import { supabaseService } from '@/utils/supabaseService.uts'
|
||||
import { goToLogin } from '@/utils/utils.uts'
|
||||
import GuessYouLike from '@/components/mall/GuessYouLike/GuessYouLike.uvue'
|
||||
import { formatCountdownHMS, getUnifiedDisplayState, ORDER_PAY_TIMEOUT_SECONDS, ORDER_STATUS_CANCELLED, ORDER_STATUS_PAID_OR_SHIPPING, ORDER_STATUS_PENDING, ORDER_STATUS_TIMEOUT_LEGACY, ORDER_TIMEOUT_CANCEL_REASON, PAYMENT_STATUS_PAID, PAYMENT_STATUS_TIMEOUT, PAYMENT_STATUS_UNPAID, type OrderStatusSource } from '@/utils/orderStatus.uts'
|
||||
import { dispatchPaidHomecareOrder, showHomecareDispatchFailureModal } from '@/services/serviceOrderService.uts'
|
||||
|
||||
type PaymentMethodType = {
|
||||
id: string
|
||||
@@ -430,6 +431,7 @@ const paymentMethods = ref<Array<PaymentMethodType>>([])
|
||||
const selectedMethod = ref<string>('wechat')
|
||||
const userBalance = ref<number>(0)
|
||||
const isPaying = ref<boolean>(false)
|
||||
const isDispatchSubmitting = ref<boolean>(false)
|
||||
const showPassword = ref<boolean>(false)
|
||||
const password = ref<string>('')
|
||||
const addressInfo = ref<AddressInfo>(createEmptyAddress())
|
||||
@@ -1469,6 +1471,42 @@ const confirmPayment = async () => {
|
||||
|
||||
uni.$emit('orderUpdated', { orderId: orderId.value, status: ORDER_STATUS_PAID_OR_SHIPPING, paymentStatus: PAYMENT_STATUS_PAID })
|
||||
|
||||
if (source.value == 'service' || bizType.value == 'service') {
|
||||
isDispatchSubmitting.value = true
|
||||
uni.showLoading({ title: '正在安排服务', mask: true })
|
||||
try {
|
||||
const dispatchResult = await dispatchPaidHomecareOrder(orderId.value)
|
||||
uni.hideLoading()
|
||||
if (dispatchResult.success) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/mall/consumer/home-service/order-detail?id=' + orderId.value
|
||||
})
|
||||
return
|
||||
}
|
||||
showHomecareDispatchFailureModal(orderId.value, dispatchResult, (id: string) => {
|
||||
retryHomecareDispatch(id)
|
||||
})
|
||||
} catch (e) {
|
||||
uni.hideLoading()
|
||||
console.error('[confirmPayment] 派单异常:', e)
|
||||
uni.showModal({
|
||||
title: '派单服务异常',
|
||||
content: '派单服务暂时异常,请稍后重试',
|
||||
showCancel: true,
|
||||
cancelText: '稍后再试',
|
||||
confirmText: '重新派单',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
retryHomecareDispatch(orderId.value)
|
||||
}
|
||||
}
|
||||
})
|
||||
} finally {
|
||||
isDispatchSubmitting.value = false
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/mall/consumer/payment-success?orderId=' + orderId.value
|
||||
@@ -1545,6 +1583,44 @@ const forgotPassword = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const retryHomecareDispatch = async (targetOrderId: string) => {
|
||||
if (isDispatchSubmitting.value) {
|
||||
return
|
||||
}
|
||||
isDispatchSubmitting.value = true
|
||||
uni.showLoading({ title: '正在重新派单', mask: true })
|
||||
try {
|
||||
const result = await dispatchPaidHomecareOrder(targetOrderId)
|
||||
uni.hideLoading()
|
||||
if (result.success) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/mall/consumer/home-service/order-detail?id=' + targetOrderId
|
||||
})
|
||||
return
|
||||
}
|
||||
showHomecareDispatchFailureModal(targetOrderId, result, (id: string) => {
|
||||
retryHomecareDispatch(id)
|
||||
})
|
||||
} catch (e) {
|
||||
uni.hideLoading()
|
||||
console.error('[retryHomecareDispatch] 重新派单异常:', e)
|
||||
uni.showModal({
|
||||
title: '派单服务异常',
|
||||
content: '派单服务暂时异常,请稍后重试',
|
||||
showCancel: true,
|
||||
cancelText: '稍后再试',
|
||||
confirmText: '重新派单',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
retryHomecareDispatch(targetOrderId)
|
||||
}
|
||||
}
|
||||
})
|
||||
} finally {
|
||||
isDispatchSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const goToOrderList = () => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/mall/consumer/orders'
|
||||
|
||||
Reference in New Issue
Block a user