fix: 替换支付失败提示为模态框并防止重复显示
将支付失败时的toast提示改为模态框提示,并添加防止模态框重复显示的标志位
Showing
1 changed file
with
19 additions
and
3 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-15 16:25:51 | 2 | * @Date: 2024-01-15 16:25:51 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2026-01-16 18:01:23 | 4 | + * @LastEditTime: 2026-01-16 18:05:18 |
| 5 | * @FilePath: /xyxBooking-weapp/src/pages/submit/index.vue | 5 | * @FilePath: /xyxBooking-weapp/src/pages/submit/index.vue |
| 6 | * @Description: 预约人员信息 | 6 | * @Description: 预约人员信息 |
| 7 | --> | 7 | --> |
| ... | @@ -149,6 +149,22 @@ const refreshVisitorList = async (options) => { | ... | @@ -149,6 +149,22 @@ const refreshVisitorList = async (options) => { |
| 149 | } | 149 | } |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | +let is_showing_pay_modal = false; | ||
| 153 | +const showPayErrorModal = async (content) => { | ||
| 154 | + if (is_showing_pay_modal) return; | ||
| 155 | + is_showing_pay_modal = true; | ||
| 156 | + try { | ||
| 157 | + await Taro.showModal({ | ||
| 158 | + title: '提示', | ||
| 159 | + content: content || '支付失败,请稍后再试', | ||
| 160 | + showCancel: false, | ||
| 161 | + confirmText: '我知道了', | ||
| 162 | + }); | ||
| 163 | + } finally { | ||
| 164 | + is_showing_pay_modal = false; | ||
| 165 | + } | ||
| 166 | +} | ||
| 167 | + | ||
| 152 | const submitBtn = async () => { | 168 | const submitBtn = async () => { |
| 153 | if (is_submitting.value) return; | 169 | if (is_submitting.value) return; |
| 154 | if (!checked_visitors.value.length) { | 170 | if (!checked_visitors.value.length) { |
| ... | @@ -211,12 +227,12 @@ const submitBtn = async () => { | ... | @@ -211,12 +227,12 @@ const submitBtn = async () => { |
| 211 | }, | 227 | }, |
| 212 | fail(res) { | 228 | fail(res) { |
| 213 | refreshVisitorList({ reset_checked: true }).catch(() => {}); | 229 | refreshVisitorList({ reset_checked: true }).catch(() => {}); |
| 214 | - Taro.showToast({ title: '支付未完成,可再次点击提交订单继续支付', icon: 'none' }); | 230 | + showPayErrorModal('支付未完成,可再次点击提交订单继续支付').catch(() => {}); |
| 215 | } | 231 | } |
| 216 | }) | 232 | }) |
| 217 | } else { | 233 | } else { |
| 218 | refreshVisitorList({ reset_checked: true }).catch(() => {}); | 234 | refreshVisitorList({ reset_checked: true }).catch(() => {}); |
| 219 | - Taro.showToast({ title: payParams?.msg || '获取支付信息失败', icon: 'none' }); | 235 | + showPayErrorModal(payParams?.msg || '获取支付信息失败,请稍后再试').catch(() => {}); |
| 220 | } | 236 | } |
| 221 | } else { | 237 | } else { |
| 222 | pending_pay_id.value = null; | 238 | pending_pay_id.value = null; | ... | ... |
-
Please register or login to post a comment