| | |
| | | : !!res?.data; |
| | | if (!unlockSucceeded) { |
| | | // Taro.hideLoading(); |
| | | stopLoading(doorType); |
| | | showToast({ title: res?.msg || '解锁失败,请重试或联系客服', icon: 'fail' }); |
| | | const failMsg = res?.msg || '解锁失败,请重试或联系客服'; |
| | | stopLoading(doorType, () => { |
| | | showToast({ title: failMsg, icon: 'fail' }); |
| | | }); |
| | | return; |
| | | } |
| | | |
| | |
| | | trunkPollTimerRef.current = setTimeout(doPoll, pollInterval); |
| | | } else { |
| | | stopPolling(); |
| | | stopLoading(doorType); |
| | | // Taro.hideLoading(); |
| | | showToast({ |
| | | title: failToastText, |
| | | icon: 'none' |
| | | stopLoading(doorType, () => { |
| | | showToast({ |
| | | title: failToastText, |
| | | icon: 'none' |
| | | }); |
| | | }); |
| | | } |
| | | }; |
| | |
| | | stopPolling(); |
| | | const isOpen = !isCloseAction; |
| | | setTrunkStatus(isOpen); |
| | | stopLoading(doorType); |
| | | // Taro.hideLoading(); |
| | | showToast({ |
| | | title: successToastText, |
| | | icon: 'none' |
| | | }); |
| | | onSuccess?.(); |
| | | // Taro.hideLoading(); |
| | | stopLoading(doorType, () => { |
| | | showToast({ |
| | | title: successToastText, |
| | | icon: 'none' |
| | | }); |
| | | }); |
| | | } else { |
| | | handlePollFail('state_mismatch', value); |
| | | } |
| | |
| | | if (doorType === 'door') { |
| | | // Taro.hideLoading(); |
| | | syncDoorUnlockButtonUI(); |
| | | stopLoading(doorType); |
| | | showToast({ title: '车门已解锁', icon: 'success' }); |
| | | onSuccess?.(); |
| | | stopLoading(doorType, () => { |
| | | showToast({ title: '车门已解锁', icon: 'success' }); |
| | | }); |
| | | } |
| | | }).catch(() => { |
| | | // Taro.hideLoading(); |
| | | stopLoading(doorType); |
| | | showToast({ title: '解锁失败,请重试或联系客服', icon: 'fail' }); |
| | | stopLoading(doorType, () => { |
| | | showToast({ title: '解锁失败,请重试或联系客服', icon: 'fail' }); |
| | | }); |
| | | }); |
| | | }; |
| | | |