调试接口

This commit is contained in:
wangxiaowei
2025-12-22 04:48:05 +08:00
parent 24b7f61c98
commit ca0d16cf05
41 changed files with 750 additions and 345 deletions

View File

@ -6,6 +6,7 @@
"navigationStyle": "custom"
}
}</route>
<template>
<view class="pb-180rpx">
<!-- 费用明细 -->
@ -77,8 +78,8 @@
<template v-for="(label, labelIndex) in teaRoom.label" :key="labelIndex">
<view class="mr-20rpx flex items-start">
<wd-tag
:color="randomLabelColor(labelIndex)"
:bg-color="randomLabelColor(labelIndex)"
:color="randomLabelColor(Number(labelIndex))"
:bg-color="randomLabelColor(Number(labelIndex))"
plain
custom-class="!rounded-4rpx"
>{{ label.label_name }}</wd-tag>
@ -269,7 +270,7 @@
</view>
</view>
<view class="mr-30rpx">
<wd-button custom-class='!bg-[#4C9F44] !rounded-8rpx !h-70rpx' @click='Detail.handleSubmitOrder'>{{ isGroupBuying ? '立即购买' : '立即预定' }}</wd-button>
<wd-button custom-class='!bg-[#4C9F44] !rounded-8rpx !h-70rpx' :disabled="isSubmitting" @click='Detail.handleSubmitOrder'>{{ isGroupBuying ? '立即购买' : '立即预定' }}</wd-button>
</view>
</view>
</view>
@ -387,6 +388,9 @@
})
})
// 防止重复提交
const isSubmitting = ref(false)
const Detail = {
/**
* 初始包间详情
@ -414,7 +418,6 @@
Object.assign(sevenDay, {minimum_time: teaRoom.value.room.hours})
}
// 获取门店余额
const balance = await getTeaRoomBalance({ store_id: storeId.value })
storeMoney.value = balance.data.money || 0
@ -473,7 +476,7 @@
selectedCoupon.value = {id: params.coupon.user_coupon_id, name: `${params.coupon.name}${params.coupon.coupon_price}` }
bill.value.coupon = params.coupon.coupon_price
} else {
selectedGroupCoupon.value = {id: params.coupon.id, name: `团购券-${params.coupon.tea_store_group.title}` }
selectedGroupCoupon.value = {id: params.coupon.group_id, name: `团购券-${params.coupon?.title}` }
bill.value.groupCoupon = params.coupon.coupon_price
}
@ -489,13 +492,14 @@
* 提交订单
*/
handleSubmitOrder: async () => {
if (isSubmitting.value) return
// 只有预定茶室才会选择时间
if (!isGroupBuying.value && bill.value.service.num == 0) {
toast.info('请选择预定时间')
return
}
isSubmitting.value = true
uni.showLoading({
title: '提交中...'
})
@ -503,6 +507,7 @@
try {
let res: any = null
if (isGroupBuying.value) {
// 团购套餐ID
res = await createTeaRoomPackageOrder({
group_id: id.value,
room_id: 0
@ -528,6 +533,7 @@
uni.$on('payment', params => {
setTimeout(() => {
uni.$off("payment")
isSubmitting.value = false
if (params.result) {
uni.redirectTo({
url: `/pages/notice/reserve?type=${OrderType.TeaRoomOrder}&orderId=${params.orderId}&isGroupBuying=${isGroupBuying.value ? 1 : 0}`
@ -546,14 +552,16 @@
const name = isGroupBuying.value ? teaRoomPackage.value.title : teaRoom.value.name
router.navigateTo(
`/pages/cashier/cashier?from=${OrderType.TeaRoomOrder}&orderId=${res.id}&name=${name}&storeId=${storeId.value}&isGroupBuying=${isGroupBuying.value ? 1 : 0}`
`/pages/cashier/cashier?from=${OrderType.TeaRoomOrder}&orderId=${res.id}&name=${name}&storeId=${storeId.value}&isGroupBuying=${isGroupBuying.value ? 1 : 0}&cmoboId=${id.value || 0}`
)
}, 800)
}, 500)
} catch (error) {
uni.hideLoading()
isSubmitting.value = false
toast.info('订单提交失败,请稍后重试')
return
}
// 正常流程下isSubmitting.value 会在支付回调中重置
},
/**