feat: 优化 toast 展示,使用自定义 toast
| | |
| | | import './index.less'; |
| | | import { privicyShowManager } from './utils' |
| | | import { submitAgreement } from '../../../../../robotaxi/api/home' |
| | | import { showToast } from '../../../../../robotaxi/components/toast' |
| | | import { getNormalizedLoginAgreementList, type LoginAgreementItem } from '../../../../../robotaxi/utils/login-agreement' |
| | | import { reportEvent } from '../../../../../utils/Robotaxi-public-method' |
| | | import { PROTOCOL_CLICK_EVENT_ID } from '../../../../../robotaxi/constants/report-events' |
| | |
| | | }, {}); |
| | | setIsAgree(initState); |
| | | }).catch(() => { |
| | | Taro.showToast({ title: '协议获取失败,请重试', icon: 'none' }); |
| | | showToast({ title: '协议获取失败,请重试', icon: 'none' }); |
| | | }); |
| | | }; |
| | | |
| | |
| | | |
| | | const handleAgree = () => { |
| | | if (!isAllAgree) { |
| | | Taro.showToast({ title: '请先同意全部协议', icon: 'none' }); |
| | | showToast({ title: '请先同意全部协议', icon: 'none' }); |
| | | return |
| | | }; |
| | | const selectedType = Object.keys(isAgree) |
| | |
| | | privicyShowManager.setHasShow(true) |
| | | onAgree?.(); |
| | | }).catch(() => { |
| | | Taro.showToast({ title: '提交失败,请重试', icon: 'none' }); |
| | | showToast({ title: '提交失败,请重试', icon: 'none' }); |
| | | }); |
| | | }; |
| | | |
| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { useState } from 'react'; |
| | | import { showToast } from '../../../../robotaxi/components/toast'; |
| | | import { FLOAT_ACTIVITY_DEFAULT_IMAGE } from '../constants'; |
| | | |
| | | type MarketingData = Record<string, any>; |
| | |
| | | */ |
| | | const handleFloatActivityClick = () => { |
| | | if (!floatActivityUrl) { |
| | | Taro.showToast({ title: '活动页面建设中', icon: 'none' }); |
| | | showToast({ title: '活动页面建设中', icon: 'none' }); |
| | | return; |
| | | } |
| | | deps.toH5(floatActivityUrl, true); |
| | |
| | | writeConfirmRideSiteSourceType |
| | | } from '../../../../robotaxi/constants/confirm-ride-report'; |
| | | import { resolveHomeStartSiteDisplaySite } from '../../../../robotaxi/hooks/use-home-start-site-display'; |
| | | import { showToast } from '../../../../robotaxi/components/toast'; |
| | | |
| | | type Deps = { |
| | | /** 是否未登录 */ |
| | |
| | | try { |
| | | const res = await Taro.getNetworkType(); |
| | | if (res?.networkType === 'none') { |
| | | Taro.showToast({ title: '网络未连接', icon: 'none' }); |
| | | showToast({ title: '网络未连接', icon: 'none' }); |
| | | return false; |
| | | } |
| | | return true; |
| | | } catch (e) { |
| | | Taro.showToast({ title: '网络未连接', icon: 'none' }); |
| | | showToast({ title: '网络未连接', icon: 'none' }); |
| | | return false; |
| | | } |
| | | }; |
| | |
| | | const ok = await ensureNetwork(); |
| | | if (!ok) return; |
| | | if (deps.isLocationAuthDenied) { |
| | | Taro.showToast({ title: '请先开启定位权限', icon: 'none' }); |
| | | showToast({ title: '请先开启定位权限', icon: 'none' }); |
| | | return; |
| | | } |
| | | if (!deps.electronicAreaId) { |
| | | Taro.showToast({ title: '请先移动到运营区内', icon: 'none' }); |
| | | showToast({ title: '请先移动到运营区内', icon: 'none' }); |
| | | return; |
| | | } |
| | | if (isToMapStart) { |
| | |
| | | const preferredStartSite = resolveHomeStartSiteDisplaySite(); |
| | | const effectiveStartSite = preferredStartSite || deps.currentSite; |
| | | if (!effectiveStartSite || !effectiveStartSite.id) { |
| | | Taro.showToast({ title: '请先选择起点站点', icon: 'none' }); |
| | | showToast({ title: '请先选择起点站点', icon: 'none' }); |
| | | return; |
| | | } |
| | | Taro.setStorageSync('startSite', effectiveStartSite); |
| | |
| | | const startLongitude = hasValidSiteCoord ? siteLongitude : (hasValidMapCoord ? mapLongitude : null); |
| | | const startLatitude = hasValidSiteCoord ? siteLatitude : (hasValidMapCoord ? mapLatitude : null); |
| | | if (startLongitude === null || startLatitude === null) { |
| | | Taro.showToast({ title: '请先移动到运营区内', icon: 'none' }); |
| | | showToast({ title: '请先移动到运营区内', icon: 'none' }); |
| | | return; |
| | | } |
| | | Taro.navigateTo({ |
| | |
| | | if (!ok) return; |
| | | if (deps.isLocationAuthDenied) return; |
| | | if (!deps.selectedCity?.code) { |
| | | Taro.showToast({ title: '此城市暂未开通运营区域', icon: 'none' }); |
| | | showToast({ title: '此城市暂未开通运营区域', icon: 'none' }); |
| | | return; |
| | | } |
| | | let nextPolygons = deps.polygons; |
| | |
| | | deps.setPolygons([]); |
| | | } |
| | | if (!nextPolygons || nextPolygons.length === 0) { |
| | | Taro.showToast({ title: '此城市暂未开通运营区域', icon: 'none' }); |
| | | showToast({ title: '此城市暂未开通运营区域', icon: 'none' }); |
| | | return; |
| | | } |
| | | const points = extractPointsFromPolygons(nextPolygons); |
| | |
| | | }); |
| | | }, 600); |
| | | } else { |
| | | Taro.showToast({ title: '此城市暂未开通运营区域', icon: 'none' }); |
| | | showToast({ title: '此城市暂未开通运营区域', icon: 'none' }); |
| | | } |
| | | }; |
| | | |
| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { showToast } from '../../../../robotaxi/components/toast'; |
| | | |
| | | type Deps = { |
| | | /** 是否拒绝定位 */ |
| | |
| | | const toOrigin = async () => { |
| | | const systemSetting = await Promise.resolve((Taro as any).getSystemSetting?.()); |
| | | if (systemSetting?.locationEnabled === false) { |
| | | Taro.showToast({ title: '需开启设备定位服务开关', icon: 'none' }); |
| | | showToast({ title: '需开启设备定位服务开关', icon: 'none' }); |
| | | return; |
| | | } |
| | | if (deps.isLocationAuthDenied) return; |
| | |
| | | OrderDistanceConfig |
| | | } from '../../../../robotaxi/utils/order-distance'; |
| | | import { hasActiveTripOrderInStorage } from '../../../../robotaxi/utils/order'; |
| | | import { showToast } from '../../../../robotaxi/components/toast'; |
| | | |
| | | type CapsuleSite = { |
| | | id: string | number; |
| | |
| | | */ |
| | | const handleQuickCapsuleClick = async () => { |
| | | if (hasActiveTripOrderInStorage()) { |
| | | Taro.showToast({ title: '您已有进行中的订单', icon: 'none' }); |
| | | showToast({ title: '您已有进行中的订单', icon: 'none' }); |
| | | return; |
| | | } |
| | | const targetStartSite = resolveValidStartSite(); |
| | | if (!targetStartSite) { |
| | | Taro.showToast({ title: '请先选择起点站点', icon: 'none' }); |
| | | showToast({ title: '请先选择起点站点', icon: 'none' }); |
| | | return; |
| | | } |
| | | if (!capsuleSite) { |
| | | Taro.showToast({ title: '暂无快捷目的地', icon: 'none' }); |
| | | showToast({ title: '暂无快捷目的地', icon: 'none' }); |
| | | return; |
| | | } |
| | | const distanceConfig = await ensureDistanceConfigReady(); |
| | |
| | | endSite: capsuleSite, |
| | | minDistance: distanceConfig?.minDistance |
| | | })) { |
| | | Taro.showToast({ title: ORDER_DISTANCE_MIN_DISTANCE_TOAST, icon: 'none' }); |
| | | showToast({ title: ORDER_DISTANCE_MIN_DISTANCE_TOAST, icon: 'none' }); |
| | | return; |
| | | } |
| | | Taro.setStorageSync('endSite', capsuleSite); |
| | |
| | | import { checkOtp, toH5 } from '../../../utils/tools'; |
| | | import { getCityLocation, reportEvent } from '../../../utils/Robotaxi-public-method'; |
| | | import { withRobotaxiWhitelist } from '../../../utils/whitelist'; |
| | | import { withToast } from '../../../robotaxi/components/toast/with-toast'; |
| | | import { |
| | | HOME_MAP_ID, |
| | | HOME_ORDER_STATUS, |
| | |
| | | ); |
| | | } |
| | | |
| | | export default withRobotaxiWhitelist(Home); |
| | | export default withRobotaxiWhitelist(withToast(Home)); |
| | |
| | | import Taro from '@tarojs/taro' |
| | | import { PureComponent } from 'react' |
| | | import { View, Text } from '@tarojs/components' |
| | | import './index.less' |
| | |
| | | fareEstimate={DEMO_MODIFY_FARE_ESTIMATE} |
| | | routeOptions={DEMO_MODIFY_ROUTE_OPTIONS} |
| | | selectedRouteIndex={0} |
| | | onEditDestination={() => Taro.showToast({ title: '编辑目的地(Demo)', icon: 'none' })} |
| | | onConfirm={() => Taro.showToast({ title: '确认修改(Demo)', icon: 'none' })} |
| | | onEditDestination={() => showToast({ title: '编辑目的地(Demo)', icon: 'none' })} |
| | | onConfirm={() => showToast({ title: '确认修改(Demo)', icon: 'none' })} |
| | | /> |
| | | </View> |
| | | </View> |
| | |
| | | import { unlockVehicle, queryVehicleTrunkOpenStatus } from '../../../../api/begin-route'; |
| | | import { getOrderId } from '../../../../utils/order'; |
| | | import { TripStatus } from '../../../../constants/trip-status'; |
| | | import { showToast } from '../../../../components/toast'; |
| | | import { showToast, hideToast } from '../../../../components/toast'; |
| | | import useMinimumSpinLoading from './use-minimum-spin-loading'; |
| | | import TrunkConfirmPopup from './trunk-confirm-popup'; |
| | | |
| | |
| | | |
| | | // 获取解锁请求所需定位参数,优先高精定位,失败后降级普通定位 |
| | | const getUnlockLocationPayload = async () => { |
| | | Taro.showLoading({ title: '正在获取位置...', mask: true }); |
| | | showToast({ title: '正在获取位置...', icon: 'loading', mask: true }); |
| | | try { |
| | | const location = await Taro.getLocation({ type: 'gcj02', isHighAccuracy: true }); |
| | | const longitude = Number(location?.longitude); |
| | | const latitude = Number(location?.latitude); |
| | | if (!Number.isNaN(longitude) && !Number.isNaN(latitude)) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | return { longitude, latitude }; |
| | | } |
| | | } catch (error) { |
| | |
| | | const longitude = Number(location?.longitude); |
| | | const latitude = Number(location?.latitude); |
| | | if (!Number.isNaN(longitude) && !Number.isNaN(latitude)) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | return { longitude, latitude }; |
| | | } |
| | | } catch (error) { |
| | | console.error('普通定位获取失败:', error); |
| | | } |
| | | |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | return null; |
| | | }; |
| | | |
| | |
| | | const actionLoadingText = doorType === 'trunk' |
| | | ? (isCloseAction ? '正在关闭后备箱' : '正在开启后备箱') |
| | | : '正在解锁车门'; |
| | | // Taro.showLoading({ title: actionLoadingText, mask: true }); |
| | | // showToast({ title: actionLoadingText, icon: 'loading', mask: true }); |
| | | unlockVehicle({ |
| | | orderId: targetOrderId, |
| | | doorType, |
| | |
| | | ? Number(res?.data) == 1 |
| | | : !!res?.data; |
| | | if (!unlockSucceeded) { |
| | | // Taro.hideLoading(); |
| | | // hideToast(); |
| | | const failMsg = res?.msg || '解锁失败,请重试或联系客服'; |
| | | stopLoading(doorType, () => { |
| | | showToast({ title: failMsg, icon: 'fail' }); |
| | |
| | | trunkPollTimerRef.current = setTimeout(doPoll, pollInterval); |
| | | } else { |
| | | stopPolling(); |
| | | // Taro.hideLoading(); |
| | | // hideToast(); |
| | | stopLoading(doorType, () => { |
| | | showToast({ |
| | | title: failToastText, |
| | |
| | | const isOpen = !isCloseAction; |
| | | setTrunkStatus(isOpen); |
| | | onSuccess?.(); |
| | | // Taro.hideLoading(); |
| | | // hideToast(); |
| | | stopLoading(doorType, () => { |
| | | showToast({ |
| | | title: successToastText, |
| | |
| | | } |
| | | |
| | | if (doorType === 'door') { |
| | | // Taro.hideLoading(); |
| | | // hideToast(); |
| | | syncDoorUnlockButtonUI(); |
| | | onSuccess?.(); |
| | | stopLoading(doorType, () => { |
| | |
| | | }); |
| | | } |
| | | }).catch(() => { |
| | | // Taro.hideLoading(); |
| | | // hideToast(); |
| | | stopLoading(doorType, () => { |
| | | showToast({ title: '解锁失败,请重试或联系客服', icon: 'fail' }); |
| | | }); |
| | |
| | | import { useCallback, useEffect, useRef } from 'react'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { showToast } from '../../../components/toast'; |
| | | import { showToast, hideToast } from '../../../components/toast'; |
| | | import { queryLedgerCreditOrderResult } from '../../../api/begin-route'; |
| | | |
| | | type Deps = { |
| | |
| | | pollingOrderIdRef.current = ''; |
| | | clearPollingTimer(); |
| | | if (hideLoading) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | } |
| | | }, [clearPollingTimer]); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | Taro.showLoading({ title: '授权结果查询中', mask: true }); |
| | | showToast({ title: '授权结果查询中', icon: 'loading', mask: true }); |
| | | |
| | | const maxPollingCount = 120; |
| | | let currentPollingCount = 0; |
| | |
| | | |
| | | if (status === 'DOING' || result?.code === 20710) { |
| | | stopPollingSession(true); |
| | | Taro.showToast({ title: '授权成功', icon: 'none' }); |
| | | showToast({ title: '授权成功', icon: 'none' }); |
| | | void deps.onAuthorizedReturn(queryId); |
| | | return; |
| | | } |
| | |
| | | if (errorCode === '20710') { |
| | | console.log(`[信用分授权查询遇到20710] 第${currentPollingCount + 1}次,当作授权成功处理`); |
| | | stopPollingSession(true); |
| | | Taro.showToast({ title: '授权成功', icon: 'none' }); |
| | | showToast({ title: '授权成功', icon: 'none' }); |
| | | void deps.onAuthorizedReturn(queryId); |
| | | return; |
| | | } |
| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { showToast } from '../../../components/toast'; |
| | | import { showToast, hideToast } from '../../../components/toast'; |
| | | import { useEffect, useMemo, useState } from 'react'; |
| | | import { orderChange } from '../../../api/begin-route'; |
| | | import { TripStatus } from '../../../constants/trip-status'; |
| | |
| | | try { |
| | | setIsConfirmingModifyDestination(true); |
| | | setFlowState(FLOW_STATES.CONFIRMING); |
| | | Taro.showLoading({ title: '正在修改目的地', mask: true }); // 修改目的地请求进行中全局 loading |
| | | showToast({ title: '正在修改目的地', icon: 'loading', mask: true }); // 修改目的地请求进行中全局 loading |
| | | |
| | | // 如果后端需要字符串格式可以显式转String,如果后端支持number直接传值,保留原始格式防止隐式转换截断 |
| | | // 如果原本因为 Number() 导致大整数丢失精度,去掉 Number() 即可 |
| | |
| | | |
| | | exitModifyDestinationReview({ shouldRestorePreviousEndSite: false }); |
| | | |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | showToast({ |
| | | title: '行程已更新', |
| | | icon: 'none' |
| | |
| | | deps.onModifySuccess(oldRoutePoints); |
| | | } |
| | | } catch (e: any) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | throw e; |
| | | } finally { |
| | | setIsConfirmingModifyDestination(false); |
| | |
| | | import { useCallback } from 'react'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { showToast } from '../../../components/toast'; |
| | | import { showToast, hideToast } from '../../../components/toast'; |
| | | import { queryOrderPaymentResultFromOrderId } from '../../../api/begin-route'; |
| | | import { RobotaxiOrderStatus } from '../../../api/types/begin-route'; |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | Taro.showLoading({ title: '支付结果查询中' }); |
| | | showToast({ title: '支付结果查询中', icon: 'loading' }); |
| | | try { |
| | | const result = await queryOrderPaymentResultFromOrderId(deps.orderId); |
| | | const nextStatus = Number(result?.status); |
| | |
| | | } catch (error) { |
| | | showToast({ title: '支付结果查询失败,请稍后重试', icon: 'none' }); |
| | | } finally { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | } |
| | | }, [deps.onPaySuccess, deps.orderId]); |
| | | |
| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { showToast } from '../../../components/toast'; |
| | | import { showToast, hideToast } from '../../../components/toast'; |
| | | import { useRef } from 'react'; |
| | | import { reportEvent } from '../../../../utils/Robotaxi-public-method'; |
| | | import { |
| | |
| | | * 根据订单详情状态决定结束行程后的页面态。 |
| | | */ |
| | | const resolvePostEndOrderTripStatus = async (targetOrderId: string) => { |
| | | Taro.showLoading({ |
| | | showToast({ |
| | | title: '订单明细查询中', |
| | | icon: 'loading', |
| | | mask: true |
| | | }); |
| | | try { |
| | |
| | | nextTripStatus: TripStatus.TripFinished |
| | | }; |
| | | } finally { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | } |
| | | }; |
| | | |
| | |
| | | return; |
| | | } |
| | | paySubmittingRef.current = true; |
| | | Taro.showLoading({ |
| | | showToast({ |
| | | title: '支付中', |
| | | icon: 'loading', |
| | | mask: false |
| | | }); |
| | | try { |
| | |
| | | if (paymentStatus === RobotaxiPaymentEntryStatus.Unsigned) { |
| | | const cashierToken = paymentResult?.value?.token; |
| | | if (!cashierToken) { |
| | | Taro.showToast({ title: '支付凭证缺失,请稍后重试', icon: 'none' }); |
| | | showToast({ title: '支付凭证缺失,请稍后重试', icon: 'none' }); |
| | | return; |
| | | } |
| | | await deps.handleUnsignedPayment(cashierToken); |
| | |
| | | if (paymentStatus === RobotaxiPaymentEntryStatus.Signed) { |
| | | const signedPaymentValue = paymentResult?.value as SignedOrderPaymentValue; |
| | | if (!signedPaymentValue?.packageValue) { |
| | | Taro.showToast({ title: '支付参数缺失,请稍后重试', icon: 'none' }); |
| | | showToast({ title: '支付参数缺失,请稍后重试', icon: 'none' }); |
| | | return; |
| | | } |
| | | await deps.handleSignedCreditPayment(signedPaymentValue); |
| | | return; |
| | | } |
| | | |
| | | Taro.showToast({ title: '暂不支持当前支付方式', icon: 'none' }); |
| | | showToast({ title: '暂不支持当前支付方式', icon: 'none' }); |
| | | } catch (error) { |
| | | showToast({ title: '支付失败,请重试', icon: 'none' }); |
| | | } finally { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | paySubmittingRef.current = false; |
| | | } |
| | | }; |
| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { showToast } from '../../../components/toast'; |
| | | import { showToast, hideToast } from '../../../components/toast'; |
| | | import { useCallback, useRef } from 'react'; |
| | | import { formatDateTime, debounce, reportEvent } from '../../../../utils/Robotaxi-public-method'; |
| | | import { createCreditPayOrder, saveOrder, routeStaleCheck, queryCreditPaySign } from '../../../api/begin-route'; |
| | |
| | | * 查询长期签约回跳后的最新支付分状态,并决定是否继续信用下单。 |
| | | */ |
| | | const resolveCreditPayModeAfterSignReturn = useCallback(async () => { |
| | | Taro.showLoading({ title: '授权结果查询中', mask: true }); |
| | | showToast({ title: '授权结果查询中', icon: 'loading', mask: true }); |
| | | let shouldHideLoading = true; |
| | | try { |
| | | const signResult = await queryCreditPaySign(); |
| | | const latestStatus = signResult?.data?.status ?? signResult?.status; |
| | | const resolvedCreditPaySubmitMode = resolveCreditPaySubmitMode(latestStatus); |
| | | if (resolvedCreditPaySubmitMode) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | shouldHideLoading = false; |
| | | Taro.showToast({ title: '授权成功', icon: 'none' }); |
| | | showToast({ title: '授权成功', icon: 'none' }); |
| | | return resolvedCreditPaySubmitMode; |
| | | } |
| | | return resolvedCreditPaySubmitMode; |
| | |
| | | return null; |
| | | } finally { |
| | | if (shouldHideLoading) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | } |
| | | } |
| | | }, []); |
| | |
| | | const nextCreditPaySubmitMode = await resolveCreditPayModeAfterSignReturn(); |
| | | if (!nextCreditPaySubmitMode) { |
| | | stopCallSubmitting(); |
| | | Taro.showToast({ title: '支付分授权未完成,请重试', icon: 'none' }); |
| | | showToast({ title: '支付分授权未完成,请重试', icon: 'none' }); |
| | | return; |
| | | } |
| | | |
| | |
| | | onLaunchFail: () => { |
| | | waitingCreditPayReturnRef.current = false; |
| | | stopCallSubmitting(); |
| | | Taro.showToast({ title: '拉起签约失败', icon: 'none' }); |
| | | showToast({ title: '拉起签约失败', icon: 'none' }); |
| | | } |
| | | }); |
| | | |
| | |
| | | || submitMode === 'credit_pay_skip_auth_submit'; |
| | | |
| | | if (isCreditPaySubmit) { |
| | | Taro.showLoading({ title: '加载中', mask: true }); |
| | | showToast({ title: '加载中', icon: 'loading', mask: true }); |
| | | } |
| | | |
| | | const submitResult = isCreditPaySubmit |
| | |
| | | : await submitOrder(startSite, openCityId); |
| | | |
| | | if (!submitResult?.orderId) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | stopCallSubmitting(); |
| | | return; |
| | | } |
| | |
| | | if (isCreditPaySubmit) { |
| | | Taro.setStorageSync('creditPayOrderId', submitResult.orderId); |
| | | if (submitMode === 'credit_pay_skip_auth_submit') { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | // status=2 代表当前已是免确认模式,信用下单成功后直接进入发单态。 |
| | | deps.setTripStatus(TripStatus.Publishing); |
| | | return; |
| | |
| | | |
| | | const creditPayPackageValue = String(submitResult.creditPayPackageValue || '').trim(); |
| | | if (!creditPayPackageValue) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | showToast({ title: '支付参数缺失,请稍后重试', icon: 'none' }); |
| | | return; |
| | | } |
| | |
| | | packageValue: creditPayPackageValue |
| | | }, submitResult.orderId); |
| | | |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | |
| | | // 只有拉起失败才立刻进入发单状态(或者依靠 abort 逻辑终止) |
| | | if (!launched) { |
| | |
| | | } |
| | | deps.setTripStatus(TripStatus.Publishing); |
| | | } catch (error) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | const errorMessage = String((error as any)?.msg || (error as any)?.message || '下单失败,请重试'); |
| | | if (submitMode === 'credit_pay_submit' || submitMode === 'credit_pay_skip_auth_submit') { |
| | | Taro.showToast({ title: errorMessage, icon: 'none' }); |
| | | showToast({ title: errorMessage, icon: 'none' }); |
| | | } |
| | | reportPayResultEvent(resolvePayResultStatus(errorMessage)); |
| | | stopCallSubmitting(); |
| | |
| | | resetConfirmRideSelectionContext |
| | | } from '../../constants/confirm-ride-report'; |
| | | import { withRobotaxiWhitelist } from '../../../utils/whitelist'; |
| | | import { showToast } from '../../components/toast'; |
| | | import { showToast, hideToast } from '../../components/toast'; |
| | | import type { PickupExceptionInfo } from './pickup-exception'; |
| | | |
| | | const MODIFY_DESTINATION_PICKUP_STATUS_GUARD_MS = 5000; |
| | |
| | | |
| | | try { |
| | | setIsConfirmingPickupRouteChange(true); |
| | | Taro.showLoading({ |
| | | showToast({ |
| | | title: '正在修改路线', |
| | | icon: 'loading', |
| | | mask: true |
| | | }); |
| | | await selectNavigationRoute({ |
| | |
| | | setIsPickupRouteChangeVisible(false); |
| | | pickupRouteChangeSnapshotRef.current = null; |
| | | routeRequestOrderRoute(orderId, tripStatus); |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | setTimeout(() => { |
| | | showToast({ |
| | | title: '切换成功,将按新路线行驶', |
| | |
| | | }); |
| | | }, 0); |
| | | } catch (error) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | } finally { |
| | | setIsConfirmingPickupRouteChange(false); |
| | | } |
| | |
| | | } |
| | | creditPayFallbackActiveOrderIdRef.current = ''; |
| | | if (hideLoading) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | } |
| | | }, []); |
| | | |
| | |
| | | |
| | | clearCreditPayFallbackRuntime(false); |
| | | creditPayFallbackActiveOrderIdRef.current = resolvedOrderId; |
| | | Taro.showLoading({ title: '扣款结果查询中,请勿重复支付', mask: true }); |
| | | showToast({ title: '扣款结果查询中,请勿重复支付', icon: 'loading', mask: true }); |
| | | |
| | | const checkCreditPayFallback = async () => { |
| | | try { |
| | |
| | | Taro.removeStorageSync('creditPayOrderId'); |
| | | clearCreditPayFallbackRuntime(); |
| | | setCreditPayFallbackRefreshVersion((prev) => prev + 1); |
| | | Taro.showToast({ title: '免密扣款失败,请手动支付', icon: 'none' }); |
| | | showToast({ title: '免密扣款失败,请手动支付', icon: 'none' }); |
| | | } |
| | | } catch (error) { |
| | | } |
| | |
| | | |
| | | try { |
| | | await cancelOrder(targetOrderId); |
| | | // Taro.showToast({ |
| | | // showToast({ |
| | | // title: reason === 'launch_failed' ? '拉起信用分失败,已取消发单' : '未完成信用分授权,已取消发单', |
| | | // icon: 'none' |
| | | // }); |
| | |
| | | reason, |
| | | error |
| | | }); |
| | | Taro.showToast({ title: '取消订单失败,请重试', icon: 'none' }); |
| | | showToast({ title: '取消订单失败,请重试', icon: 'none' }); |
| | | } |
| | | }, [orderId, syncWaitingSignedCreditPayResult]); |
| | | |
| | |
| | | CouponDetail |
| | | } from "../../../robotaxi/api/coupon"; |
| | | import { withRobotaxiWhitelist } from "../../../utils/whitelist"; |
| | | import { showToast } from "../../components/toast"; |
| | | import { showToast, hideToast } from "../../components/toast"; |
| | | import { withToast } from "../../components/toast/with-toast"; |
| | | |
| | | function CouponPage() { |
| | |
| | | |
| | | const openPopup = async (item: CouponItem) => { |
| | | try { |
| | | Taro.showLoading({ title: "加载中..." }); |
| | | showToast({ title: "加载中...", icon: 'loading' }); |
| | | const detail = await getCouponDetail(item.couponId); |
| | | detail.couponDesc = decodeURIComponent(detail.couponDesc || ""); |
| | | |
| | |
| | | ); |
| | | } |
| | | setCurrentCoupon(detail); |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | |
| | | const animation = Taro.createAnimation({ |
| | | duration: 300, |
| | |
| | | setAnimationData(animation.export()); |
| | | setVisible(true); |
| | | } catch (error) { |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | showToast({ title: "获取详情失败", icon: "none" }); |
| | | } |
| | | }; |
| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { useCallback, useMemo, useState } from 'react'; |
| | | import { showToast } from '../../../components/toast'; |
| | | import { getStorage } from '../../../../utils/tools'; |
| | | |
| | | /** |
| | |
| | | ...item, |
| | | status: 'failed' |
| | | })); |
| | | Taro.showToast({ |
| | | showToast({ |
| | | title: error?.message || '上传失败,请重试', |
| | | icon: 'none' |
| | | }); |
| | |
| | | const chooseAndUpload = useCallback(async () => { |
| | | const remainCount = Math.max(0, options.maxCount - items.length); |
| | | if (remainCount <= 0) { |
| | | Taro.showToast({ |
| | | showToast({ |
| | | title: `最多可上传${options.maxCount}个图片或视频`, |
| | | icon: 'none' |
| | | }); |
| | |
| | | for (const file of files) { |
| | | const mediaType: MediaType = file.fileType === 'video' ? 'video' : 'image'; |
| | | if (mediaType === 'video' && Number(file.size || 0) > videoSizeLimitBytes) { |
| | | Taro.showToast({ |
| | | showToast({ |
| | | title: '视频不能超过20MB', |
| | | icon: 'none' |
| | | }); |
| | |
| | | import { useEffect, useMemo, useRef, useState } from 'react'; |
| | | import CustomNavbar from '../../../components/custom-navbar'; |
| | | import { withRobotaxiWhitelist } from '../../../utils/whitelist'; |
| | | import { showToast, hideToast } from '../../components/toast'; |
| | | import { withToast } from '../../components/toast/with-toast'; |
| | | import { getFeedbackTypeList, submitComplaint } from '../../api/feedback'; |
| | | import { _ROBOTAXI_HOST } from '../../../constants/api'; |
| | | import useMediaUpload from './hooks/use-media-upload'; |
| | |
| | | } |
| | | |
| | | isSubmittingRef.current = true; |
| | | Taro.showLoading({ title: '提交中...', mask: true }); |
| | | showToast({ title: '提交中...', icon: 'loading', mask: true }); |
| | | try { |
| | | const networkTypeRes = await Taro.getNetworkType(); |
| | | if (networkTypeRes.networkType === 'none') { |
| | |
| | | showFeedbackToast(errorTitle); |
| | | } finally { |
| | | isSubmittingRef.current = false; |
| | | Taro.hideLoading(); |
| | | hideToast(); |
| | | } |
| | | }; |
| | | |
| | |
| | | ); |
| | | } |
| | | |
| | | export default withRobotaxiWhitelist(FeedbackPage); |
| | | export default withRobotaxiWhitelist(withToast(FeedbackPage)); |
| | |
| | | try { |
| | | const activeOrder = await getOrderActive(); |
| | | if (activeOrder) { |
| | | Taro.showToast({ |
| | | showToast({ |
| | | title: '有进行中的订单,暂无法关闭服务', |
| | | icon: 'none' |
| | | }); |
| | |
| | | } |
| | | return true; |
| | | } catch (error) { |
| | | Taro.showToast({ |
| | | showToast({ |
| | | title: '查询订单状态失败,请稍后重试', |
| | | icon: 'none' |
| | | }); |
| | |
| | | return; |
| | | } |
| | | |
| | | Taro.showToast({ title: "功能建设中", icon: "none" }); |
| | | showToast({ title: "功能建设中", icon: "none" }); |
| | | }; |
| | | |
| | | return ( |