From 2e800655947439e8d71f05fddb3ad49770eec9fd Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期二, 16 九月 2025 13:40:30 +0800 Subject: [PATCH] Merge branch 'dev-1.4.1' --- apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue | 1 packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeBaseForm.vue | 16 apps/taro/src/utils/common/message.tsx | 9 packages/components/src/views/GasBillRecharge/GasBillRechargeStep3.vue | 32 ++ packages/services/api/WxPayNotify.ts | 15 + packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep2.vue | 32 ++ apps/taro/src/hooks/lifepay.ts | 68 +++++ apps/taro/config/staging.js | 2 packages/components/src/hooks/rate.ts | 101 +++++++ types/api.d.ts | 1 packages/services/api/LifePayRate.ts | 81 ++++++ packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue | 23 - packages/services/api/typings.d.ts | 122 +++++++++ packages/core/src/lifeRechargeConstants.ts | 23 + apps/taro/src/pages/home/index.vue | 6 packages/services/api/index.ts | 4 apps/taro/src/pages/home/components/NormalAnnouncement.vue | 31 ++ packages/services/api/LifePayAnnouncement.ts | 69 +++++ packages/core/src/lifeRechargeServices.ts | 72 +++++ packages/components/src/hooks/index.ts | 70 +++- 20 files changed, 724 insertions(+), 54 deletions(-) diff --git a/apps/taro/config/staging.js b/apps/taro/config/staging.js index 1a6e4ad..20f2259 100644 --- a/apps/taro/config/staging.js +++ b/apps/taro/config/staging.js @@ -4,7 +4,7 @@ env: { // BASE_URL: '"https://testrlywx.boleyuma.com"', BASE_URL: '"https://api.81812333.com"', - BASE_URL_H5: '"https://testrlywx.boleyuma.com"', + BASE_URL_H5: '"https://testlifepay.81812333.com"', BASE_URL_JX: '"https://api.jx818.com"', APP_ENV: '"staging"', diff --git a/apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue b/apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue index ed91b01..b1b86d0 100644 --- a/apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue +++ b/apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue @@ -36,7 +36,6 @@ const props = defineProps(commonNavigationBarProps); const router = Taro.useRouter(); -console.log('router: ', router); const isLastPage = computed(() => { const pages = Taro.getCurrentPages(); diff --git a/apps/taro/src/hooks/lifepay.ts b/apps/taro/src/hooks/lifepay.ts index 28090cd..eb019fa 100644 --- a/apps/taro/src/hooks/lifepay.ts +++ b/apps/taro/src/hooks/lifepay.ts @@ -1,6 +1,12 @@ 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'; +import Taro from '@tarojs/taro'; export function useOnlineService() { const { blLifeRecharge } = useLifeRechargeContext(); @@ -60,3 +66,63 @@ getChannlesNameByNum, }; } + +type UseShowingLifePayAnnouncementOptions = { + params?: MaybeRef<API.GetShowingLifePayAnnouncementInput>; + onSuccess?: (data: API.CreateEditLifePayAnnouncementOutput) => any; + staleTime?: MaybeRef<number>; +}; + +export function useShowingLifePayAnnouncement(options: UseShowingLifePayAnnouncementOptions = {}) { + const { onSuccess, params = {}, staleTime } = 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); + }, + staleTime: staleTime, + }); + + return { + announcement, + isLoading, + refetch, + }; +} + +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, + }); +} diff --git a/apps/taro/src/pages/home/components/NormalAnnouncement.vue b/apps/taro/src/pages/home/components/NormalAnnouncement.vue new file mode 100644 index 0000000..bd972f4 --- /dev/null +++ b/apps/taro/src/pages/home/components/NormalAnnouncement.vue @@ -0,0 +1,31 @@ +<template> + <nut-noticebar :left-icon="false" :text="text" v-if="!!text" /> +</template> + +<script setup lang="ts"> +import { BlLifeRecharge } from '@life-payment/core-vue'; +import { useShowingLifePayAnnouncement } from '@/hooks'; + +defineOptions({ + name: 'NormalAnnouncement', +}); + +// type Props = {}; + +// const props = withDefaults(defineProps<Props>(), {}); + +const text = ref(''); + +useShowingLifePayAnnouncement({ + params: { + announcementType: BlLifeRecharge.constants.AnnouncementTypeEnum.Normal, + }, + onSuccess(data) { + text.value = data.announcementContent; + }, +}); +</script> + +<style lang="scss"> +@import '@/styles/common.scss'; +</style> diff --git a/apps/taro/src/pages/home/index.vue b/apps/taro/src/pages/home/index.vue index 45bf44c..30d2ee7 100644 --- a/apps/taro/src/pages/home/index.vue +++ b/apps/taro/src/pages/home/index.vue @@ -7,6 +7,7 @@ <template #bg> <img :src="OssAssets.common.HomePageBg" class="home-page-bg" /> </template> + <NormalAnnouncement /> <ContentView> <div class="home-page-banner-wrapper"> <div class="home-page-banner-left"> @@ -38,7 +39,7 @@ </template> <script setup lang="ts"> -import { useAccessLogin } from '@/hooks'; +import { useAccessLogin, useDialogShowingLifePayAnnouncement } from '@/hooks'; import { useUserStore } from '@/stores/modules/user'; import Taro from '@tarojs/taro'; import { OrderInputType } from '@life-payment/constants'; @@ -48,11 +49,14 @@ import IconBanner from '@/assets/home/icon-banner.png'; import IconBannerLogo from '@/assets/home/icon-banner-logo.png'; import IconBannerItem from '@/assets/home/icon-banner-item.png'; +import NormalAnnouncement from './components/NormalAnnouncement.vue'; const userStore = useUserStore(); const router = Taro.useRouter(); +useDialogShowingLifePayAnnouncement(); + const goPhoneBillRecharge = useAccessLogin(() => { RouteHelper.navigateTo({ url: `${RouterPath.phoneBillRecharge}`, diff --git a/apps/taro/src/utils/common/message.tsx b/apps/taro/src/utils/common/message.tsx index 937d801..9a64b30 100644 --- a/apps/taro/src/utils/common/message.tsx +++ b/apps/taro/src/utils/common/message.tsx @@ -24,11 +24,17 @@ title?: string; message?: string | VNode; confirmText?: string; + showCancelBtn?: boolean; }; export class Message { static confirm(options: ConfirmOptions = {}) { - const { title = '鎻愮ず', message = '纭畾瑕佸垹闄よ鏁版嵁鍚�?', confirmText = '纭' } = options; + const { + title = '鎻愮ず', + message = '纭畾瑕佸垹闄よ鏁版嵁鍚�?', + confirmText = '纭', + showCancelBtn = true, + } = options; return new Promise((resolve, reject) => { Portal.add((key) => { return ( @@ -54,6 +60,7 @@ onClose(); }} confirmText={confirmText} + showCancelBtn={showCancelBtn} ></Model> ), }} diff --git a/packages/components/src/hooks/index.ts b/packages/components/src/hooks/index.ts index 6eca483..8288b45 100644 --- a/packages/components/src/hooks/index.ts +++ b/packages/components/src/hooks/index.ts @@ -18,17 +18,19 @@ import { useInfiniteLoading } from './infiniteLoading'; import { OrderInputType } from '../constants'; import { convertOrderFrontStatus } from '../utils'; +import { useLifePayRateChannelAllList } from './rate'; export function useGetRate() { const { blLifeRecharge } = useLifeRechargeContext(); - const { data: lifePayRateList, isLoading } = useQuery({ - queryKey: ['blLifeRecharge/getRate'], - queryFn: async () => { - return await blLifeRecharge.services.getRate({ showLoading: false }); - }, - placeholderData: () => [] as LifePayRateListOutput[], - }); + // const { data: lifePayRateList, isLoading } = useQuery({ + // queryKey: ['blLifeRecharge/getRate'], + // queryFn: async () => { + // return await blLifeRecharge.services.getRate({ showLoading: false }); + // }, + // placeholderData: () => [] as LifePayRateListOutput[], + // }); + const { allRateChannelList } = useLifePayRateChannelAllList(); const hasChannel = computed(() => !!blLifeRecharge.accountModel.channlesNum); @@ -50,10 +52,15 @@ if (hasChannel.value && channelRate.value.channlesRate) { return channelRate.value.channlesRate; } + // return ( + // lifePayRateList.value.find( + // (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸 + // )?.rate ?? 0 + // ); return ( - lifePayRateList.value.find( - (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿璇濊垂鎶樻墸 - )?.rate ?? 0 + allRateChannelList.value + .filter((x) => x.lifePayOrderType == blLifeRecharge.constants.LifePayOrderTypeEnum.璇濊垂璁㈠崟) + .toSorted((a, b) => a.platformRate - b.platformRate)?.[0]?.platformRate ?? 0 ); }); @@ -61,10 +68,15 @@ if (hasChannel.value && channelRate.value.channlesRate) { return channelRate.value.channlesRate; } + // return ( + // lifePayRateList.value.find( + // (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸 + // )?.rate ?? 0 + // ); return ( - lifePayRateList.value.find( - (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸 - )?.rate ?? 0 + allRateChannelList.value + .filter((x) => x.lifePayOrderType == blLifeRecharge.constants.LifePayOrderTypeEnum.鐢佃垂璁㈠崟) + .toSorted((a, b) => a.platformRate - b.platformRate)?.[0]?.platformRate ?? 0 ); }); @@ -72,18 +84,24 @@ if (hasChannel.value && channelRate.value.channlesRate) { return channelRate.value.channlesRate; } + // return ( + // lifePayRateList.value.find( + // (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿鐕冩皵鎶樻墸 + // )?.rate ?? 0 + // ); return ( - lifePayRateList.value.find( - (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.榛樿鐕冩皵鎶樻墸 - )?.rate ?? 0 + allRateChannelList.value + .filter((x) => x.lifePayOrderType == blLifeRecharge.constants.LifePayOrderTypeEnum.鐕冩皵璁㈠崟) + .toSorted((a, b) => a.platformRate - b.platformRate)?.[0]?.platformRate ?? 0 ); }); return { - lifePayRateList, + // lifePayRateList, lifePayPhoneRate, lifePayElectricRate, lifePayGasRate, + allRateChannelList, }; } @@ -265,23 +283,25 @@ onSetUserAccount: (currentUserAccount: UserAccountListOutput) => any; getDefaultUserAccount?: ( userAccountList: UserAccountListOutput[] - ) => UserAccountListOutput | undefined; + ) => Promise<UserAccountListOutput | undefined>; }; export function useSetUserAccountBySelect({ lifePayOrderType, onSetUserAccount, - getDefaultUserAccount = (data) => data[0], + getDefaultUserAccount = (data) => Promise.resolve(data[0]), }: UseSetUserAccountBySelectOptions) { const { userAccountAllList } = useUserAccountAllList({ lifePayOrderType: lifePayOrderType, - onSuccess(data) { - if (data.length > 0) { - const currentUserAccount = getDefaultUserAccount(data); - if (currentUserAccount) { - onSetUserAccount?.(currentUserAccount); + async onSuccess(data) { + try { + if (data.length > 0) { + const currentUserAccount = await getDefaultUserAccount(data); + if (currentUserAccount) { + onSetUserAccount?.(currentUserAccount); + } } - } + } catch (error) {} }, }); diff --git a/packages/components/src/hooks/rate.ts b/packages/components/src/hooks/rate.ts new file mode 100644 index 0000000..48b30b4 --- /dev/null +++ b/packages/components/src/hooks/rate.ts @@ -0,0 +1,101 @@ +import { + useLifeRechargeContext, + QueryRateChannelInput, + CreateEditRateChannelOutput, +} from '@life-payment/core-vue'; +import { useQuery, useQueryClient } from '@tanstack/vue-query'; +import { MaybeRef, unref, computed, Ref } from 'vue'; + +type UseLifePayRateChannelAllListOptions = { + params?: MaybeRef<QueryRateChannelInput>; +}; + +export function useLifePayRateChannelAllList(options: UseLifePayRateChannelAllListOptions = {}) { + const { params = {} } = options; + + const { blLifeRecharge } = useLifeRechargeContext(); + + const queryClient = useQueryClient(); + + const _params = computed(() => ({ + status: blLifeRecharge.constants.LifePayRateChannelStatus.Enabled, + ...unref(params), + })); + + const { data: allRateChannelList } = useQuery({ + queryKey: ['blLifeRecharge/getLifePayRateChannelAllList', _params], + queryFn: async () => { + return await blLifeRecharge.services.getLifePayRateChannelAllList(_params.value, { + showLoading: false, + }); + }, + placeholderData: () => [] as CreateEditRateChannelOutput[], + }); + + function ensureLifePayRateChannelAllList() { + return queryClient.ensureQueryData({ + queryKey: ['blLifeRecharge/getLifePayRateChannelAllList', _params], + }); + } + + function getRateChannelByCode(code: string) { + return allRateChannelList.value.find((item) => item.code === code); + } + + return { + allRateChannelList, + ensureLifePayRateChannelAllList, + getRateChannelByCode, + }; +} + +type UseCheckCanRechargeOptions = { + msg: Ref<string>; + show: Ref<boolean>; +}; + +export function useCheckCanRecharge(options: UseCheckCanRechargeOptions) { + const { msg, show } = options; + + const { blLifeRecharge } = useLifeRechargeContext(); + + const { getRateChannelByCode, ensureLifePayRateChannelAllList } = useLifePayRateChannelAllList({ + params: { + status: null, + }, + }); + + /** + * + * @param rateChannelCode + * @description rateChannelCode鍊艰瘽璐逛负IspCode銆佺數璐逛负electricType銆佺噧姘旇垂涓篻asOrgType + * @returns + */ + function isCanRecharge(rateChannelCode: string) { + const rateChannel = getRateChannelByCode(rateChannelCode); + return rateChannel?.status === blLifeRecharge.constants.LifePayRateChannelStatus.Enabled; + } + + /** + * + * @param rateChannelCode + * @description rateChannelCode鍊艰瘽璐逛负IspCode銆佺數璐逛负electricType銆佺噧姘旇垂涓篻asOrgType + * @returns + */ + function checkCanRecharge(rateChannelCode: string) { + const rateChannel = getRateChannelByCode(rateChannelCode); + if (!isCanRecharge(rateChannelCode)) { + //閫氶亾姝e湪鍗囩骇锛岀粰鎮ㄥ甫鏉ヤ笉渚垮敖鎯呰皡瑙� + msg.value = rateChannel?.remark ?? ''; + show.value = true; + return false; + } + return true; + } + + return { + isCanRecharge, + checkCanRecharge, + ensureLifePayRateChannelAllList, + }; +} diff --git a/packages/components/src/views/GasBillRecharge/GasBillRechargeStep3.vue b/packages/components/src/views/GasBillRecharge/GasBillRechargeStep3.vue index be78bf7..ef36068 100644 --- a/packages/components/src/views/GasBillRecharge/GasBillRechargeStep3.vue +++ b/packages/components/src/views/GasBillRecharge/GasBillRechargeStep3.vue @@ -13,7 +13,7 @@ direction="horizontal" class="par-account-list" v-if="userAccountAllList.length > 0" - @change="handleUserAccountChange" + @change="_handleUserAccountChange" > <NutRadio :label="item.id" @@ -145,6 +145,7 @@ import { RechargeProps } from '../PhoneBillRecharge/types'; import Chunk from '../../components/Layout/Chunk.vue'; import IconSelect from '../../assets/recharge/icon-select.png'; +import { useCheckCanRecharge } from '../../hooks/rate'; defineOptions({ name: 'GasBillRechargeStep3', @@ -199,7 +200,28 @@ form.parValue = 0; } }, + async getDefaultUserAccount(userAccountList) { + await ensureLifePayRateChannelAllList(); + const defaultUserAccount = userAccountList.find((x) => { + const currentUserAccountExtraProperties = JSON.parse( + x.extraProperties + ) as GasUserAccountExtraProperties; + return isCanRecharge(currentUserAccountExtraProperties.gasOrgType); + }); + return defaultUserAccount; + }, }); + +function _handleUserAccountChange(userAccountId: string) { + const currentUserAccount = userAccountAllList.value.find((x) => x.id === userAccountId); + const currentUserAccountExtraProperties = JSON.parse( + currentUserAccount.extraProperties + ) as GasUserAccountExtraProperties; + if (!checkCanRecharge(currentUserAccountExtraProperties.gasOrgType)) { + // return; + } + handleUserAccountChange(userAccountId); +} function handleAddUserAccount() { goTo('step1'); @@ -257,8 +279,16 @@ const currentOrderNo = ref(''); +const { isCanRecharge, checkCanRecharge, ensureLifePayRateChannelAllList } = useCheckCanRecharge({ + msg: toRef(state, 'msg'), + show: toRef(state, 'show'), +}); + async function goPay() { try { + if (!checkCanRecharge(form.gasOrgType)) { + return; + } let params: LifeGasDataCreateLifePayOrderInput = { userId: blLifeRecharge.accountModel.userId, channelId: blLifeRecharge.accountModel.channlesNum, diff --git a/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeBaseForm.vue b/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeBaseForm.vue index 2b4f92a..bd2b1fb 100644 --- a/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeBaseForm.vue +++ b/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeBaseForm.vue @@ -8,12 +8,9 @@ > <NutFormItem label="閫夋嫨杩愯惀鍟�:" class="bole-form-item" prop="ispCode" required> <NutRadioGroup v-model="form.ispCode" direction="horizontal" @change="handleIspCodeChange"> - <BlRadio - :label="key" - v-for="(val, key) in BlLifeRecharge.constants.IspCodeTextForSelect" - :key="key" - >{{ val }}</BlRadio - > + <BlRadio :label="item.code" v-for="item in allRateChannelList" :key="item.id">{{ + item.rateChannelName + }}</BlRadio> </NutRadioGroup> </NutFormItem> <NutFormItem label="鍏呭�兼墜鏈哄彿" class="bole-form-item" prop="phone" required> @@ -56,6 +53,7 @@ import BlRadio from '../../components/Radio/Radio.vue'; import { FormValidator } from '../../utils'; import { BlLifeRecharge, LifeRechargeConstants } from '@life-payment/core-vue'; +import { useLifePayRateChannelAllList } from '../../hooks/rate'; defineOptions({ name: 'PhoneBillRechargeBaseForm', @@ -78,6 +76,12 @@ const dialogVisible = ref(false); +const { allRateChannelList } = useLifePayRateChannelAllList({ + params: { + lifePayOrderType: LifeRechargeConstants.LifePayOrderTypeEnum.璇濊垂璁㈠崟, + }, +}); + function handleIspCodeChange(ispCode: LifeRechargeConstants.IspCode) { console.log('ispCode: ', ispCode); if (ispCode === LifeRechargeConstants.IspCode.dianxin) { diff --git a/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue b/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue index 1ca4086..a5508c1 100644 --- a/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue +++ b/packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue @@ -132,6 +132,7 @@ import { RechargeProps } from './types'; import Chunk from '../../components/Layout/Chunk.vue'; import IconSelect from '../../assets/recharge/icon-select.png'; +import { useCheckCanRecharge } from '../../hooks/rate'; defineOptions({ name: 'PhoneBillRechargeStep2', @@ -166,7 +167,8 @@ form.remark = currentUserAccount.remark; changeIspCode(form.ispCode as any); }, - getDefaultUserAccount(userAccountList) { + async getDefaultUserAccount(userAccountList) { + await ensureLifePayRateChannelAllList(); const defaultUserAccount = userAccountList.find((x) => { const currentUserAccountExtraProperties = JSON.parse( x.extraProperties @@ -262,21 +264,10 @@ const currentOrderNo = ref(''); -function isCanRecharge(ispCode: string) { - // return ispCode !== blLifeRecharge.constants.IspCode.yidong; - return true; -} - -function checkCanRecharge(ispCode: string) { - if (!isCanRecharge(ispCode)) { - //閫氶亾姝e湪鍗囩骇锛岀粰鎮ㄥ甫鏉ヤ笉渚垮敖鎯呰皡瑙� - state.msg = - '灏婃暚鐨勭敤鎴凤紝涓烘彁渚涙洿瀹夊叏銆佺ǔ瀹氱殑鍏呭�兼湇鍔★紝绉诲姩鍏呭�奸�氶亾姝e湪杩涜鍗囩骇缁存姢锛岀淮鎶ゆ湡闂存殏鏃犳硶鍙戣捣鍏呭��'; - state.show = true; - return false; - } - return true; -} +const { isCanRecharge, checkCanRecharge, ensureLifePayRateChannelAllList } = useCheckCanRecharge({ + msg: toRef(state, 'msg'), + show: toRef(state, 'show'), +}); async function goPay() { try { diff --git a/packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep2.vue b/packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep2.vue index 40844f6..719bc65 100644 --- a/packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep2.vue +++ b/packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep2.vue @@ -13,7 +13,7 @@ direction="horizontal" class="par-account-list" v-if="userAccountAllList.length > 0" - @change="handleUserAccountChange" + @change="_handleUserAccountChange" > <NutRadio :label="item.id" @@ -143,6 +143,7 @@ import { RechargeProps } from '../PhoneBillRecharge/types'; import Chunk from '../../components/Layout/Chunk.vue'; import IconSelect from '../../assets/recharge/icon-select.png'; +import { useCheckCanRecharge } from '../../hooks/rate'; defineOptions({ name: 'ElectricBillRechargeStep2', @@ -201,7 +202,28 @@ form.parValue = 0; } }, + async getDefaultUserAccount(userAccountList) { + await ensureLifePayRateChannelAllList(); + const defaultUserAccount = userAccountList.find((x) => { + const currentUserAccountExtraProperties = JSON.parse( + x.extraProperties + ) as ElectricUserAccountExtraProperties; + return isCanRecharge(currentUserAccountExtraProperties.electricType); + }); + return defaultUserAccount; + }, }); + +function _handleUserAccountChange(userAccountId: string) { + const currentUserAccount = userAccountAllList.value.find((x) => x.id === userAccountId); + const currentUserAccountExtraProperties = JSON.parse( + currentUserAccount.extraProperties + ) as ElectricUserAccountExtraProperties; + if (!checkCanRecharge(currentUserAccountExtraProperties.electricType)) { + // return; + } + handleUserAccountChange(userAccountId); +} function handleAddUserAccount() { goTo('step1'); @@ -261,8 +283,16 @@ const currentOrderNo = ref(''); +const { isCanRecharge, checkCanRecharge, ensureLifePayRateChannelAllList } = useCheckCanRecharge({ + msg: toRef(state, 'msg'), + show: toRef(state, 'show'), +}); + async function goPay() { try { + if (!checkCanRecharge(form.electricType)) { + return; + } let params: LifeElectricDataCreateLifePayOrderInput = { userId: blLifeRecharge.accountModel.userId, channelId: blLifeRecharge.accountModel.channlesNum, diff --git a/packages/core/src/lifeRechargeConstants.ts b/packages/core/src/lifeRechargeConstants.ts index 528cfbe..5dff6c0 100644 --- a/packages/core/src/lifeRechargeConstants.ts +++ b/packages/core/src/lifeRechargeConstants.ts @@ -231,4 +231,27 @@ [LifePayChannelAgentType.BrandAgent]: '鍝佺墝浠g悊', [LifePayChannelAgentType.AreaAgent]: '鍖哄煙浠g悊', }; + + export enum AnnouncementTypeEnum { + /**鏅�氬叕鍛� */ + Normal = 10, + /**寮圭獥鍏憡 */ + Dialog = 20, + } + + export enum AnnouncementStatusEnum { + /**灞曠ず涓� */ + Showing = 10, + /**寰呭睍绀� */ + Wait = 20, + /**宸插仠姝� */ + Stop = 30, + } + + export enum LifePayRateChannelStatus { + /**鍚敤 */ + Disabled = -10, + /**绂佺敤 */ + Enabled = 10, + } } diff --git a/packages/core/src/lifeRechargeServices.ts b/packages/core/src/lifeRechargeServices.ts index 41e981e..9bfcac7 100644 --- a/packages/core/src/lifeRechargeServices.ts +++ b/packages/core/src/lifeRechargeServices.ts @@ -464,6 +464,39 @@ ...(options || {}), }); } + + /** 鑾峰彇褰撳墠灞曠ず涓殑鍏憡 POST /api/LifePayAnnouncement/GetShowingLifePayAnnouncement */ + async getShowingLifePayAnnouncement( + body: GetShowingLifePayAnnouncementInput, + options?: RequestConfig + ) { + return this.request<CreateEditLifePayAnnouncementOutput>( + '/api/LifePayAnnouncement/GetShowingLifePayAnnouncement', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + } + ); + } + + /** 鑾峰彇鎶樻墸閫氶亾閰嶇疆鍒楄〃 POST /api/LifePayRate/GetLifePayRateChannelAllList */ + async getLifePayRateChannelAllList(body: QueryRateChannelInput, options?: RequestConfig) { + return this.request<CreateEditRateChannelOutput[]>( + '/api/LifePayRate/GetLifePayRateChannelAllList', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + } + ); + } } export interface PhoneMesssageCodeLoginInput { @@ -1069,3 +1102,42 @@ /** IdNumber */ idNumber?: string; } + +export interface GetShowingLifePayAnnouncementInput { + announcementType?: LifeRechargeConstants.AnnouncementTypeEnum; +} + +export interface CreateEditLifePayAnnouncementOutput { + id?: string; + announcementType: LifeRechargeConstants.AnnouncementTypeEnum; + /** 鐢熸晥鏃ユ湡 */ + startTime: string; + /** 鎴鏃ユ湡 */ + endTime: string; + /** 鍏憡鍐呭 */ + announcementContent: string; + creationTime?: string; + status?: LifeRechargeConstants.AnnouncementStatusEnum; +} + +export interface QueryRateChannelInput { + status?: LifeRechargeConstants.LifePayRateChannelStatus; + lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum; +} + +export interface CreateEditRateChannelOutput { + id?: string; + lifePayOrderType: LifeRechargeConstants.LifePayOrderTypeEnum; + /** 閫氶亾 */ + rateChannelName: string; + /** ID */ + code: string; + /** 渚涘簲鍟嗘姌鎵� */ + supplierRate: number; + /** 骞冲彴鎶樻墸 */ + platformRate: number; + status: LifeRechargeConstants.LifePayRateChannelStatus; + /** 閫氱煡鍐呭 */ + remark: string; + creationTime?: string; +} diff --git a/packages/services/api/LifePayAnnouncement.ts b/packages/services/api/LifePayAnnouncement.ts new file mode 100644 index 0000000..4714e3e --- /dev/null +++ b/packages/services/api/LifePayAnnouncement.ts @@ -0,0 +1,69 @@ +/* eslint-disable */ +// @ts-ignore +import { request } from '@/utils/request'; + +/** 鏂板缂栬緫鍏憡 POST /api/LifePayAnnouncement/CreateOrEditLifePayAnnouncement */ +export async function createOrEditLifePayAnnouncement( + body: API.CreateEditLifePayAnnouncementInput, + options?: API.RequestConfig +) { + return request<number>('/api/LifePayAnnouncement/CreateOrEditLifePayAnnouncement', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + +/** 鍒犻櫎鍏憡 GET /api/LifePayAnnouncement/DeleteLifePayAnnouncement */ +export async function deleteLifePayAnnouncement( + // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄) + params: API.APIdeleteLifePayAnnouncementParams, + options?: API.RequestConfig +) { + return request<number>('/api/LifePayAnnouncement/DeleteLifePayAnnouncement', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} + +/** 鑾峰彇鍏憡鍒嗛〉 POST /api/LifePayAnnouncement/GetLifePayAnnouncementPage */ +export async function getLifePayAnnouncementPage( + body: API.GetLifePayAnnouncementPageInput, + options?: API.RequestConfig +) { + return request<API.CreateEditLifePayAnnouncementOutputPageOutput>( + '/api/LifePayAnnouncement/GetLifePayAnnouncementPage', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + } + ); +} + +/** 鑾峰彇褰撳墠灞曠ず涓殑鍏憡 POST /api/LifePayAnnouncement/GetShowingLifePayAnnouncement */ +export async function getShowingLifePayAnnouncement( + body: API.GetShowingLifePayAnnouncementInput, + options?: API.RequestConfig +) { + return request<API.CreateEditLifePayAnnouncementOutput>( + '/api/LifePayAnnouncement/GetShowingLifePayAnnouncement', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + } + ); +} diff --git a/packages/services/api/LifePayRate.ts b/packages/services/api/LifePayRate.ts new file mode 100644 index 0000000..6d326d1 --- /dev/null +++ b/packages/services/api/LifePayRate.ts @@ -0,0 +1,81 @@ +/* eslint-disable */ +// @ts-ignore +import { request } from '@/utils/request'; + +/** 鏂板缂栬緫鎶樻墸閫氶亾閰嶇疆 POST /api/LifePayRate/CreateOrEditLifePayRateChannel */ +export async function createOrEditLifePayRateChannel( + body: API.CreateEditRateChannelInput, + options?: API.RequestConfig +) { + return request<number>('/api/LifePayRate/CreateOrEditLifePayRateChannel', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + +/** 鍒犻櫎鎶樻墸閫氶亾 POST /api/LifePayRate/DeleteRateChannel */ +export async function deleteRateChannel( + // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄) + params: API.APIdeleteRateChannelParams, + options?: API.RequestConfig +) { + return request<number>('/api/LifePayRate/DeleteRateChannel', { + method: 'POST', + params: { + ...params, + }, + ...(options || {}), + }); +} + +/** 鑾峰彇鎶樻墸閫氶亾閰嶇疆鍒楄〃 POST /api/LifePayRate/GetLifePayRateChannelAllList */ +export async function getLifePayRateChannelAllList( + body: API.QueryRateChannelInput, + options?: API.RequestConfig +) { + return request<API.CreateEditRateChannelOutput[]>( + '/api/LifePayRate/GetLifePayRateChannelAllList', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + } + ); +} + +/** 鑾峰彇鎶樻墸閫氶亾閰嶇疆鍒嗛〉 POST /api/LifePayRate/GetLifePayRateChannelPage */ +export async function getLifePayRateChannelPage(body: API.PageInput, options?: API.RequestConfig) { + return request<API.CreateEditRateChannelOutputPageOutput>( + '/api/LifePayRate/GetLifePayRateChannelPage', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + } + ); +} + +/** 璁剧疆鎶樻墸閫氶亾鐘舵�� GET /api/LifePayRate/SetRateChannelStatus */ +export async function setRateChannelStatus( + // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄) + params: API.APIsetRateChannelStatusParams, + options?: API.RequestConfig +) { + return request<number>('/api/LifePayRate/SetRateChannelStatus', { + method: 'GET', + params: { + ...params, + }, + ...(options || {}), + }); +} diff --git a/packages/services/api/WxPayNotify.ts b/packages/services/api/WxPayNotify.ts index fa00992..ac15ac8 100644 --- a/packages/services/api/WxPayNotify.ts +++ b/packages/services/api/WxPayNotify.ts @@ -17,6 +17,21 @@ }); } +/** 姝ゅ鍚庣娌℃湁鎻愪緵娉ㄩ噴 POST /api/WxPayNotify/WxPayDomesticRefundsNotifyImp */ +export async function wxPayDomesticRefundsNotifyImp( + body: API.WxPayDomesticRefundsNotice, + options?: API.RequestConfig +) { + return request<any>('/api/WxPayNotify/WxPayDomesticRefundsNotifyImp', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); +} + /** 寰俊鏀粯鍥炶皟閫氱煡 POST /api/WxPayNotify/WxRechargeNotify */ export async function wxRechargeNotify( body: API.WxRechargeNotifyInput, diff --git a/packages/services/api/index.ts b/packages/services/api/index.ts index 8bc1a3d..002daba 100644 --- a/packages/services/api/index.ts +++ b/packages/services/api/index.ts @@ -14,6 +14,8 @@ import * as IdentityUser from './IdentityUser'; import * as IdentityUserLookup from './IdentityUserLookup'; import * as LifePay from './LifePay'; +import * as LifePayAnnouncement from './LifePayAnnouncement'; +import * as LifePayRate from './LifePayRate'; import * as Log from './Log'; import * as OperateHistory from './OperateHistory'; import * as Permissions from './Permissions'; @@ -38,6 +40,8 @@ IdentityUser, IdentityUserLookup, LifePay, + LifePayAnnouncement, + LifePayRate, Log, OperateHistory, Permissions, diff --git a/packages/services/api/typings.d.ts b/packages/services/api/typings.d.ts index 6640eab..81c5ffa 100644 --- a/packages/services/api/typings.d.ts +++ b/packages/services/api/typings.d.ts @@ -139,6 +139,10 @@ column?: ModuleColumnDto[]; } + type AnnouncementStatusEnum = 10 | 20 | 30; + + type AnnouncementTypeEnum = 10 | 20; + interface APIaddOrEditModuleStatusParams { id?: string; isMenu?: number; @@ -169,6 +173,10 @@ id?: string; } + interface APIdeleteLifePayAnnouncementParams { + id?: string; + } + interface APIdeleteModuleButtonParams { id?: string; } @@ -178,6 +186,10 @@ } interface APIdeleteModuleParams { + id?: string; + } + + interface APIdeleteRateChannelParams { id?: string; } @@ -390,6 +402,11 @@ interface APIsetLifePayChannelsStatusParams { id?: string; status?: LifePayChannelsStatsEnum; + } + + interface APIsetRateChannelStatusParams { + id?: string; + status?: LifePayRateChannelStatus; } interface APIstatisticsByDateParams { @@ -717,6 +734,36 @@ customerResources?: string; } + interface CreateEditLifePayAnnouncementInput { + id?: string; + announcementType: AnnouncementTypeEnum; + /** 鐢熸晥鏃ユ湡 */ + startTime: string; + /** 鎴鏃ユ湡 */ + endTime: string; + /** 鍏憡鍐呭 */ + announcementContent: string; + } + + interface CreateEditLifePayAnnouncementOutput { + id?: string; + announcementType: AnnouncementTypeEnum; + /** 鐢熸晥鏃ユ湡 */ + startTime: string; + /** 鎴鏃ユ湡 */ + endTime: string; + /** 鍏憡鍐呭 */ + announcementContent: string; + creationTime?: string; + status?: AnnouncementStatusEnum; + } + + interface CreateEditLifePayAnnouncementOutputPageOutput { + pageModel?: Pagination; + objectData?: any; + data?: CreateEditLifePayAnnouncementOutput[]; + } + interface CreateEditPayChannelsInput { id?: string; channlesName?: string; @@ -741,6 +788,45 @@ pageModel?: Pagination; objectData?: any; data?: CreateEditPayChannelsInput[]; + } + + interface CreateEditRateChannelInput { + id?: string; + lifePayOrderType: LifePayOrderTypeEnum; + /** 閫氶亾 */ + rateChannelName: string; + /** ID */ + code: string; + /** 渚涘簲鍟嗘姌鎵� */ + supplierRate: number; + /** 骞冲彴鎶樻墸 */ + platformRate: number; + status: LifePayRateChannelStatus; + /** 閫氱煡鍐呭 */ + remark: string; + } + + interface CreateEditRateChannelOutput { + id?: string; + lifePayOrderType: LifePayOrderTypeEnum; + /** 閫氶亾 */ + rateChannelName: string; + /** ID */ + code: string; + /** 渚涘簲鍟嗘姌鎵� */ + supplierRate: number; + /** 骞冲彴鎶樻墸 */ + platformRate: number; + status: LifePayRateChannelStatus; + /** 閫氱煡鍐呭 */ + remark: string; + creationTime?: string; + } + + interface CreateEditRateChannelOutputPageOutput { + pageModel?: Pagination; + objectData?: any; + data?: CreateEditRateChannelOutput[]; } interface CreateLifePayOrderOutput { @@ -1052,6 +1138,15 @@ groups?: FeatureGroupDto[]; } + interface GetLifePayAnnouncementPageInput { + pageModel?: Pagination; + creationTimeBegin?: string; + creationTimeEnd?: string; + startTime?: string; + endTime?: string; + status?: AnnouncementStatusEnum; + } + interface GetOperateHistoryInput { pageModel?: Pagination; relationId?: string; @@ -1093,6 +1188,10 @@ pageModel?: Pagination; /** 鏌ヨ鏉′欢锛氳鑹插悕绉� */ queryCondition?: string; + } + + interface GetShowingLifePayAnnouncementInput { + announcementType?: AnnouncementTypeEnum; } interface IanaTimeZone { @@ -1631,6 +1730,8 @@ rate?: number; id?: string; } + + type LifePayRateChannelStatus = 10 | -10; interface LifePayRateInput { rateType?: LifePayRateTypeEnum; @@ -2202,6 +2303,11 @@ phoneChargeOrder?: PhoneChargeOrderOutput; } + interface QueryRateChannelInput { + status?: LifePayRateChannelStatus; + lifePayOrderType?: LifePayOrderTypeEnum; + } + interface QueryUserAccountAllListInput { pageModel?: Pagination; checkChannelId?: string; @@ -2245,6 +2351,13 @@ receiveList?: ReceiptsDetail[]; /** 30澶╂敹鍏� */ incomeList?: ReceiptsDetail[]; + } + + interface RefundAmount { + total: number; + refund: number; + payerTotal: string; + payerRefund: string; } interface RefundLifePayOrderInput { @@ -2781,6 +2894,15 @@ unionId?: string; } + interface WxPayDomesticRefundsNotice { + mchid?: string; + outTradeNo?: string; + transactionId?: string; + outRefundNo?: string; + refundStatus?: string; + amount?: RefundAmount; + } + interface WxPayDomesticRefundsQueryReponse { code?: string; message?: string; diff --git a/types/api.d.ts b/types/api.d.ts index 3241ace..95e117a 100644 --- a/types/api.d.ts +++ b/types/api.d.ts @@ -2,6 +2,7 @@ interface RequestConfig extends GlobalType.RequestConfig { showNavigationBarLoading?: boolean; showLoading?: boolean; + skipErrorHandler?: boolean; mock?: boolean; customErrorHandler?: (error: any) => boolean; } -- Gitblit v1.9.1