| | |
| | | import { useQuery } from '@tanstack/vue-query'; |
| | | import { useLifeRechargeContext, CreateEditPayChannelsInput } from '@life-payment/core-vue'; |
| | | import { |
| | | useLifeRechargeContext, |
| | | CreateEditPayChannelsInput, |
| | | GetShowingLifePayAnnouncementInput, |
| | | } from '@life-payment/core-vue'; |
| | | import { MaybeRef } from 'vue'; |
| | | import { Message } from '@/utils'; |
| | | |
| | | export function useOnlineService() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | |
| | | getChannlesNameByNum, |
| | | }; |
| | | } |
| | | |
| | | type UseShowingLifePayAnnouncementOptions = { |
| | | params?: MaybeRef<API.GetShowingLifePayAnnouncementInput>; |
| | | onSuccess?: (data: API.CreateEditLifePayAnnouncementOutput) => any; |
| | | }; |
| | | |
| | | export function useShowingLifePayAnnouncement(options: UseShowingLifePayAnnouncementOptions = {}) { |
| | | const { onSuccess, params = {} } = options; |
| | | |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | const { |
| | | data: announcement, |
| | | isLoading, |
| | | refetch, |
| | | } = useQuery({ |
| | | queryKey: ['blLifeRecharge/getShowingLifePayAnnouncement', params], |
| | | queryFn: async () => { |
| | | return await blLifeRecharge.services.getShowingLifePayAnnouncement(unref(params), { |
| | | showLoading: false, |
| | | skipErrorHandler: true, |
| | | }); |
| | | }, |
| | | onSuccess: (data) => { |
| | | onSuccess?.(data); |
| | | }, |
| | | }); |
| | | |
| | | return { |
| | | announcement, |
| | | isLoading, |
| | | refetch, |
| | | }; |
| | | } |
| | | |
| | | export function useDialogShowingLifePayAnnouncement() { |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | useShowingLifePayAnnouncement({ |
| | | params: { |
| | | announcementType: blLifeRecharge.constants.AnnouncementTypeEnum.Dialog, |
| | | }, |
| | | onSuccess(data) { |
| | | Message.confirm({ |
| | | title: '公告', |
| | | message: data.announcementContent ?? '', |
| | | showCancelBtn: false, |
| | | }); |
| | | }, |
| | | }); |
| | | } |