fix(ticket): 修复编辑模式下无可用票据提示问题
- 在useEffect中添加isEditMode判断,避免编辑订单时弹出无票据提示 - 更新useEffect依赖数组,添加isEditMode依赖 - 修改按钮点击事件,确保编辑模式下不会触发无票据购买引导
This commit is contained in:
@@ -913,6 +913,8 @@ const OrderConfirm = () => {
|
|||||||
// If user has no usable tickets, proactively guide them to purchase (only once per page lifecycle).
|
// If user has no usable tickets, proactively guide them to purchase (only once per page lifecycle).
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!noUsableTickets) return
|
if (!noUsableTickets) return
|
||||||
|
// Editing an existing order: don't interrupt with "no tickets" prompt.
|
||||||
|
if (isEditMode) return
|
||||||
if (noTicketPromptedRef.current) return
|
if (noTicketPromptedRef.current) return
|
||||||
noTicketPromptedRef.current = true
|
noTicketPromptedRef.current = true
|
||||||
|
|
||||||
@@ -928,7 +930,7 @@ const OrderConfirm = () => {
|
|||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [noUsableTickets])
|
}, [noUsableTickets, isEditMode])
|
||||||
|
|
||||||
// 重新加载数据
|
// 重新加载数据
|
||||||
const handleRetry = () => {
|
const handleRetry = () => {
|
||||||
@@ -1087,14 +1089,14 @@ const OrderConfirm = () => {
|
|||||||
<ArrowRight className={'text-gray-400'} size={14}/>
|
<ArrowRight className={'text-gray-400'} size={14}/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
if (ticketLoading) return
|
if (ticketLoading) return
|
||||||
if (!ticketLoaded) {
|
if (!ticketLoaded) {
|
||||||
setTicketPopupVisible(true)
|
setTicketPopupVisible(true)
|
||||||
await loadUserTickets()
|
await loadUserTickets()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (noUsableTickets) {
|
if (noUsableTickets && !isEditMode) {
|
||||||
const r = await Taro.showModal({
|
const r = await Taro.showModal({
|
||||||
title: '暂无可用水票',
|
title: '暂无可用水票',
|
||||||
content: '您还没有可用水票,是否前往购买?',
|
content: '您还没有可用水票,是否前往购买?',
|
||||||
|
|||||||
Reference in New Issue
Block a user