zhengyiming
19 小时以前 5cd618c9523ad30dccf858a00ff6d99a28de4187
feat: 公告
7个文件已修改
182 ■■■■ 已修改文件
apps/taro/src/components/NavigationBar/TransparentNavigationBar.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/hooks/index.ts 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/hooks/rate.ts 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/GasBillRecharge/GasBillRechargeStep3.vue 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeBaseForm.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep2.vue 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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();
packages/components/src/hooks/index.ts
@@ -283,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) {
    async onSuccess(data) {
      try {
      if (data.length > 0) {
        const currentUserAccount = getDefaultUserAccount(data);
          const currentUserAccount = await getDefaultUserAccount(data);
        if (currentUserAccount) {
          onSetUserAccount?.(currentUserAccount);
        }
      }
      } catch (error) {}
    },
  });
packages/components/src/hooks/rate.ts
@@ -3,8 +3,8 @@
  QueryRateChannelInput,
  CreateEditRateChannelOutput,
} from '@life-payment/core-vue';
import { useQuery } from '@tanstack/vue-query';
import { MaybeRef, unref, computed } from 'vue';
import { useQuery, useQueryClient } from '@tanstack/vue-query';
import { MaybeRef, unref, computed, Ref } from 'vue';
type UseLifePayRateChannelAllListOptions = {
  params?: MaybeRef<QueryRateChannelInput>;
@@ -14,6 +14,8 @@
  const { params = {} } = options;
  const { blLifeRecharge } = useLifeRechargeContext();
  const queryClient = useQueryClient();
  const _params = computed(() => ({
    status: blLifeRecharge.constants.LifePayRateChannelStatus.Enabled,
@@ -30,7 +32,70 @@
    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、燃气费为gasOrgType
   * @returns
   */
  function isCanRecharge(rateChannelCode: string) {
    const rateChannel = getRateChannelByCode(rateChannelCode);
    return rateChannel?.status === blLifeRecharge.constants.LifePayRateChannelStatus.Enabled;
  }
  /**
   *
   * @param rateChannelCode
   * @description rateChannelCode值话费为IspCode、电费为electricType、燃气费为gasOrgType
   * @returns
   */
  function checkCanRecharge(rateChannelCode: string) {
    const rateChannel = getRateChannelByCode(rateChannelCode);
    if (!isCanRecharge(rateChannelCode)) {
      //通道正在升级,给您带来不便尽情谅解
      msg.value = rateChannel?.remark ?? '';
      show.value = true;
      return false;
    }
    return true;
  }
  return {
    isCanRecharge,
    checkCanRecharge,
    ensureLifePayRateChannelAllList,
  };
}
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,
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) {
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,20 +264,10 @@
const currentOrderNo = ref('');
function isCanRecharge(ispCode: string) {
  return ispCode !== blLifeRecharge.constants.IspCode.yidong;
}
function checkCanRecharge(ispCode: string) {
  if (!isCanRecharge(ispCode)) {
    //通道正在升级,给您带来不便尽情谅解
    state.msg =
      '尊敬的用户,为提供更安全、稳定的充值服务,移动充值通道正在进行升级维护,维护期间暂无法发起充值';
    state.show = true;
    return false;
  }
  return true;
}
const { isCanRecharge, checkCanRecharge, ensureLifePayRateChannelAllList } = useCheckCanRecharge({
  msg: toRef(state, 'msg'),
  show: toRef(state, 'show'),
});
async function goPay() {
  try {
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,