| | |
| | | } from '@life-payment/core-vue'; |
| | | import { MaybeRef } from 'vue'; |
| | | import { Message } from '@/utils'; |
| | | import Taro from '@tarojs/taro'; |
| | | |
| | | export function useOnlineService() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | |
| | | type UseShowingLifePayAnnouncementOptions = { |
| | | params?: MaybeRef<API.GetShowingLifePayAnnouncementInput>; |
| | | onSuccess?: (data: API.CreateEditLifePayAnnouncementOutput) => any; |
| | | staleTime?: MaybeRef<number>; |
| | | }; |
| | | |
| | | export function useShowingLifePayAnnouncement(options: UseShowingLifePayAnnouncementOptions = {}) { |
| | | const { onSuccess, params = {} } = options; |
| | | const { onSuccess, params = {}, staleTime } = options; |
| | | |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | |
| | | onSuccess: (data) => { |
| | | onSuccess?.(data); |
| | | }, |
| | | staleTime: staleTime, |
| | | }); |
| | | |
| | | return { |
| | |
| | | }; |
| | | } |
| | | |
| | | const dialogShowingLifePayAnnouncementCache = {}; |
| | | |
| | | export function useDialogShowingLifePayAnnouncement() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | const router = Taro.useRouter(); |
| | | |
| | | useShowingLifePayAnnouncement({ |
| | | params: { |
| | | announcementType: blLifeRecharge.constants.AnnouncementTypeEnum.Dialog, |
| | | }, |
| | | onSuccess(data) { |
| | | if (!dialogShowingLifePayAnnouncementCache[router.path]) { |
| | | dialogShowingLifePayAnnouncementCache[router.path] = true; |
| | | Message.confirm({ |
| | | title: '公告', |
| | | message: data.announcementContent ?? '', |
| | | showCancelBtn: false, |
| | | }); |
| | | } |
| | | }, |
| | | staleTime: Infinity, |
| | | }); |
| | | } |