zhengyiming
2025-03-11 f2025539d8bf4798b90a5ab8a47c5a379ab68e9b
fix: 二期需求
16个文件已修改
12个文件已添加
2211 ■■■■ 已修改文件
apps/taro/src/subpackages/recharge/gasBillRecharge/InnerPage.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/components/Card/AccountAddCard.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/components/RechargeTipsView/RechargeTipsView.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/hooks/index.ts 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/index.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/styles/gas.scss 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/styles/index.scss 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/styles/rechargeGrid.scss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/GasBillRecharge/GasBillRecharge.vue 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/GasBillRecharge/GasBillRechargeBaseForm.vue 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/GasBillRecharge/GasBillRechargeStep1.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/GasBillRecharge/GasBillRechargeStep2.vue 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/GasBillRecharge/GasBillRechargeStep3.vue 244 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/GasBillRecharge/GasOrgTypeCard.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/GasBillRecharge/context.ts 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep1.vue 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/PhoneBillRecharge/context.ts 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/electricBillRecharge/ElectricBillRechargeBaseForm.vue 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep1.vue 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep2.vue 249 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/electricBillRecharge/context.ts 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/components/src/views/electricBillRecharge/electricBillRecharge.vue 260 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/core/src/lifeRecharge.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/core/src/lifeRechargeConstants.ts 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/core/src/lifeRechargeServices.ts 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/services/api/LifePay.ts 238 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
packages/services/api/typings.d.ts 211 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
apps/taro/src/subpackages/recharge/gasBillRecharge/InnerPage.vue
@@ -1,13 +1,23 @@
<template>
  <div>燃气充值</div>
  <ContentScrollView :paddingH="false" style="background-color: #fff">
    <GasBillRecharge @goPay="goPay" :isDev="isDev" />
  </ContentScrollView>
</template>
<script setup lang="ts">
import { GasBillRecharge } from '@life-payment/components';
import { BlLifeRecharge } from '@life-payment/core-vue';
import Taro from '@tarojs/taro';
defineOptions({
  name: 'InnerPage',
});
</script>
<style lang="scss">
@import '@/styles/common.scss';
</style>
const isDev = process.env.NODE_ENV === 'development';
function goPay(orderNo: string) {
  Taro.navigateTo({
    url: `${RouterPath.selectPayType}?orderNo=${orderNo}&lifePayOrderType=${BlLifeRecharge.constants.LifePayOrderTypeEnum.燃气订单}`,
  });
}
</script>
packages/components/src/components/Card/AccountAddCard.vue
@@ -1,5 +1,5 @@
<template>
  <div class="account-add-card"><Uploader /> 新增手机号</div>
  <div class="account-add-card"><Uploader /> {{ text }}</div>
</template>
<script setup lang="ts">
@@ -8,4 +8,12 @@
defineOptions({
  name: 'AccountAddCard',
});
type Props = {
  text?: string;
};
const props = withDefaults(defineProps<Props>(), {
  text: '新增手机号',
});
</script>
packages/components/src/components/RechargeTipsView/RechargeTipsView.vue
@@ -3,7 +3,9 @@
    <div class="recharge-tips-title">充值须知</div>
    <div class="recharge-tips-content">
      <div class="recharge-tips-top">
        *同一号码充值期间【切勿多平台重复充值】!!!在下单前,请务必仔细阅读公告内容!!!若接到陌生来电,请勿轻信!!!
        <slot name="tips-top">
          *同一号码充值期间【切勿多平台重复充值】!!!在下单前,请务必仔细阅读公告内容!!!若接到陌生来电,请勿轻信!!!
        </slot>
      </div>
      <div class="recharge-tips-list">
        <div class="recharge-tips-item" v-for="(item, index) in props.tips" :key="index">
packages/components/src/hooks/index.ts
@@ -7,8 +7,12 @@
  LifeRechargeConstants,
  ElectricParValueResponse,
  ElectricSupportAreaResponse,
  QueryUserAccountAllListInput,
  UserAccountListOutput,
  AddUpdateUserAccountInput,
  GasParValueResponse,
} from '@life-payment/core-vue';
import { useQuery } from '@tanstack/vue-query';
import { useQuery, useQueryClient } from '@tanstack/vue-query';
import { computed, MaybeRef, reactive, unref } from 'vue';
import { useInfiniteLoading } from './infiniteLoading';
import { OrderInputType } from '../constants';
@@ -28,20 +32,28 @@
    () =>
      lifePayRateList.value.find(
        (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.默认话费折扣
      )?.rate ?? 1
      )?.rate ?? 100
  );
  const lifePayElectricRate = computed(
    () =>
      lifePayRateList.value.find(
        (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.默认电费折扣
      )?.rate ?? 1
      )?.rate ?? 100
  );
  const lifePayGasRate = computed(
    () =>
      lifePayRateList.value.find(
        (x) => x.rateType === blLifeRecharge.constants.LifePayRateTypeEnum.默认燃气折扣
      )?.rate ?? 100
  );
  return {
    lifePayRateList,
    lifePayPhoneRate,
    lifePayElectricRate,
    lifePayGasRate,
  };
}
@@ -127,3 +139,127 @@
    infiniteLoadingProps,
  };
}
type UseUserAccountAllListOptions = {
  lifePayOrderType: MaybeRef<LifeRechargeConstants.LifePayOrderTypeEnum>;
  onSuccess?: (data: UserAccountListOutput[]) => any;
};
export function useUserAccountAllList({
  lifePayOrderType,
  onSuccess,
}: UseUserAccountAllListOptions) {
  const { blLifeRecharge } = useLifeRechargeContext();
  const { data: userAccountAllList, isLoading } = useQuery({
    queryKey: [
      'blLifeRecharge/getUserAccountAllList',
      blLifeRecharge.accountModel.userId,
      lifePayOrderType,
    ],
    queryFn: async () => {
      let params: QueryUserAccountAllListInput = {
        userId: blLifeRecharge.accountModel.userId,
        lifePayOrderType: unref(lifePayOrderType),
      };
      return await blLifeRecharge.services.getUserAccountAllList(params, { showLoading: false });
    },
    placeholderData: () => [] as UserAccountListOutput[],
    onSuccess(data) {
      onSuccess?.(data);
    },
  });
  const queryClient = useQueryClient();
  function invalidateQueries() {
    return queryClient.invalidateQueries({
      queryKey: [
        'blLifeRecharge/getUserAccountAllList',
        blLifeRecharge.accountModel.userId,
        lifePayOrderType,
      ],
    });
  }
  return {
    userAccountAllList,
    isLoading,
    invalidateQueries,
  };
}
export function useAddUpdateUserAccount() {
  const { blLifeRecharge } = useLifeRechargeContext();
  const queryClient = useQueryClient();
  function invalidateQueries(lifePayOrderType: LifeRechargeConstants.LifePayOrderTypeEnum) {
    return queryClient.invalidateQueries({
      queryKey: [
        'blLifeRecharge/getUserAccountAllList',
        blLifeRecharge.accountModel.userId,
        lifePayOrderType,
      ],
    });
  }
  async function addUpdateUserAccount(params: AddUpdateUserAccountInput) {
    let res = await blLifeRecharge.services.addUpdateUserAccount(params);
    if (res) {
      invalidateQueries(params.lifePayType);
    }
    return res;
  }
  return { addUpdateUserAccount };
}
type UseSetUserAccountBySelectOptions = {
  lifePayOrderType: MaybeRef<LifeRechargeConstants.LifePayOrderTypeEnum>;
  onSetUserAccount: (currentUserAccount: UserAccountListOutput) => any;
};
export function useSetUserAccountBySelect({
  lifePayOrderType,
  onSetUserAccount,
}: UseSetUserAccountBySelectOptions) {
  const { userAccountAllList } = useUserAccountAllList({
    lifePayOrderType: lifePayOrderType,
    onSuccess(data) {
      if (data.length > 0) {
        const currentUserAccount = data[0];
        onSetUserAccount?.(currentUserAccount);
      }
    },
  });
  function handleUserAccountChange(val: string) {
    const currentUserAccount = userAccountAllList.value.find((x) => x.id === val);
    onSetUserAccount?.(currentUserAccount);
  }
  return {
    handleUserAccountChange,
    userAccountAllList,
  };
}
export function useGetGasParValue() {
  const { blLifeRecharge } = useLifeRechargeContext();
  const { data: gasParValueList, isLoading } = useQuery({
    queryKey: ['blLifeRecharge/getGasParValue'],
    queryFn: async () => {
      return await blLifeRecharge.services.getGasParValue({ showLoading: false });
    },
    select(data) {
      return data?.gasParValue ?? [];
    },
    placeholderData: () => ({} as GasParValueResponse),
  });
  return {
    gasParValueList,
  };
}
packages/components/src/index.ts
@@ -1,6 +1,7 @@
export { default as RechargeGrid } from './views/RechargeGrid/RechargeGrid.vue';
export { default as PhoneBillRecharge } from './views/PhoneBillRecharge/PhoneBillRecharge.vue';
export { default as electricBillRecharge } from './views/electricBillRecharge/electricBillRecharge.vue';
export { default as GasBillRecharge } from './views/GasBillRecharge/GasBillRecharge.vue';
export { default as SelectPayTypeView } from './views/SelectPayTypeView/SelectPayTypeView.vue';
export { default as RechargeResultView } from './views/RechargeResultView/RechargeResultView.vue';
export { default as PhoneOrder } from './views/Order/components/PhoneOrder.vue';
packages/components/src/styles/gas.scss
New file
@@ -0,0 +1,24 @@
@use './common.scss' as *;
.gas-bill-recharge-wrapper {
  .gasOrgType-card {
    border-radius: 16px;
    border: 1px solid #e8e8e8;
    padding: 28px;
    min-height: 120px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    &:last-child {
      margin-bottom: 0;
    }
    .gasOrgType-card-title {
      font-size: 36px;
      line-height: 48px;
      color: boleGetCssVar('text-color', 'primary');
    }
  }
}
packages/components/src/styles/index.scss
@@ -3,6 +3,7 @@
@use './function.scss' as *;
@use './orderCard.scss' as *;
@use './card.scss' as *;
@use './gas.scss' as *;
@use './nut.scss' as *;
@use './layout.scss' as *;
@use './rechargeGrid.scss' as *;
packages/components/src/styles/rechargeGrid.scss
@@ -128,6 +128,10 @@
        margin-left: 20px;
      }
    }
    &.nut-button--plain {
      border-width: 1px;
    }
  }
  &.electric {
packages/components/src/views/GasBillRecharge/GasBillRecharge.vue
New file
@@ -0,0 +1,51 @@
<template>
  <GasBillRechargeStep1 v-if="current === 'step1'" />
  <GasBillRechargeStep2 v-else-if="current === 'step2'" />
  <GasBillRechargeStep3
    v-else-if="current === 'step3'"
    v-bind="props"
    @go-pay="emit('goPay', $event)"
  />
</template>
<script setup lang="ts">
import { computed, provide, reactive } from 'vue';
import { useStepper } from 'senin-mini/hooks';
import { GasBillRechargeContextKey } from './context';
import GasBillRechargeStep1 from './GasBillRechargeStep1.vue';
import GasBillRechargeStep2 from './GasBillRechargeStep2.vue';
import GasBillRechargeStep3 from './GasBillRechargeStep3.vue';
import { LifeRechargeConstants } from '@life-payment/core-vue';
defineOptions({
  name: 'GasBillRecharge',
});
type Props = {
  isDev?: boolean;
};
const props = withDefaults(defineProps<Props>(), {
  isDev: false,
});
const stepperInfo = useStepper(['step1', 'step2', 'step3'], 'step3');
const current = computed(() => stepperInfo.current.value);
const emit = defineEmits<{
  (e: 'goPay', orderNo: string): void;
}>();
const preSetForm = reactive({
  gasOrgType: '' as any as LifeRechargeConstants.GasOrgCodeEnum,
  province: '',
  city: '',
  gasAccount: '',
  remark: '',
});
provide(GasBillRechargeContextKey, {
  ...stepperInfo,
  preSetForm,
});
</script>
packages/components/src/views/GasBillRecharge/GasBillRechargeBaseForm.vue
New file
@@ -0,0 +1,51 @@
<template>
  <NutForm
    :model-value="form"
    ref="formRef"
    :rules="rules"
    label-position="top"
    class="order-bill-recharge electric"
  >
    <NutFormItem label="缴费户号" class="bole-form-item" prop="gasAccount" required>
      <NutInput
        v-model.trim="form.gasAccount"
        class="bole-input-text"
        placeholder="请输入缴费户号"
        type="text"
        max-length="13"
      />
    </NutFormItem>
    <slot></slot>
  </NutForm>
</template>
<script setup lang="ts">
import { Form as NutForm, FormItem as NutFormItem, Input as NutInput } from '@nutui/nutui-taro';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { reactive, ref, computed, watch } from 'vue';
import { useGetGasParValue } from '../../hooks';
defineOptions({
  name: 'GasBillRechargeBaseForm',
});
const form = defineModel<{
  province: string;
  city: string;
  gasAccount: string;
}>('form');
const { gasParValueList } = useGetGasParValue();
const rules = reactive<FormRules>({
  province: [{ required: true, message: '请选择所在区域' }],
  city: [{ required: true, message: '请选择所在城市' }],
  gasAccount: [{ required: true, message: '请输入缴费户号', regex: /^\d{13}$/ }],
});
const formRef = ref<any>(null);
defineExpose({
  validate: computed(() => formRef.value.validate),
});
</script>
packages/components/src/views/GasBillRecharge/GasBillRechargeStep1.vue
New file
@@ -0,0 +1,37 @@
<template>
  <NutForm label-position="top" class="order-bill-recharge gas-bill-recharge-wrapper phone">
    <NutFormItem class="bole-form-item">
      <GasOrgTypeCard
        :title="item"
        v-for="(item, gasOrgCodeEnum) in BlLifeRecharge.constants.GasOrgCodeEnumText"
        :key="item"
        @click="goNext(gasOrgCodeEnum)"
      ></GasOrgTypeCard>
    </NutFormItem>
    <div class="common-content">
      <NutButton class="recharge-button" type="primary" plain @click="goTo('step3')">
        <div class="recharge-button-inner">
          <div class="recharge-button-text">返回</div>
        </div>
      </NutButton>
    </div>
  </NutForm>
</template>
<script setup lang="ts">
import { Form as NutForm, FormItem as NutFormItem, Button as NutButton } from '@nutui/nutui-taro';
import GasOrgTypeCard from './GasOrgTypeCard.vue';
import { BlLifeRecharge, LifeRechargeConstants } from '@life-payment/core-vue';
import { useGasBillRechargeContext } from './context';
defineOptions({
  name: 'GasBillRechargeStep1',
});
const { preSetForm, goToNext, goTo } = useGasBillRechargeContext();
function goNext(gasOrgType: LifeRechargeConstants.GasOrgCodeEnum) {
  preSetForm.gasOrgType = gasOrgType;
  goToNext();
}
</script>
packages/components/src/views/GasBillRecharge/GasBillRechargeStep2.vue
New file
@@ -0,0 +1,74 @@
<template>
  <GasBillRechargeBaseForm ref="formRef" v-model:form="preSetForm">
    <NutFormItem label="备注信息" class="bole-form-item" prop="remark">
      <NutInput
        v-model.trim="preSetForm.remark"
        class="bole-input-text"
        placeholder="请输入备注信息"
        type="text"
        max-length="30"
      />
    </NutFormItem>
    <div class="common-content">
      <nut-button class="recharge-button" type="primary" @click="handleNext">
        <div class="recharge-button-inner">
          <div class="recharge-button-text">立即充值</div>
        </div>
      </nut-button>
      <nut-button class="recharge-button" type="primary" plain @click="goToPrevious">
        <div class="recharge-button-inner">
          <div class="recharge-button-text">返回</div>
        </div>
      </nut-button>
    </div>
  </GasBillRechargeBaseForm>
</template>
<script setup lang="ts">
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { reactive, ref, computed, watch } from 'vue';
import GasBillRechargeBaseForm from './GasBillRechargeBaseForm.vue';
import { useGasBillRechargeContext } from './context';
import {
  useLifeRechargeContext,
  LifeRechargeConstants,
  AddUpdateUserAccountInput,
} from '@life-payment/core-vue';
import { useAddUpdateUserAccount } from '../../hooks';
defineOptions({
  name: 'GasBillRechargeStep2',
});
const { preSetForm, goToPrevious, goToNext } = useGasBillRechargeContext();
const formRef = ref<any>(null);
function handleNext() {
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      handleAddUpdateUserAccount();
    }
  });
}
const { addUpdateUserAccount } = useAddUpdateUserAccount();
const { blLifeRecharge } = useLifeRechargeContext();
async function handleAddUpdateUserAccount() {
  try {
    let params: AddUpdateUserAccountInput = {
      userId: blLifeRecharge.accountModel.userId,
      lifePayType: LifeRechargeConstants.LifePayOrderTypeEnum.燃气订单,
      content: preSetForm.gasAccount,
      province: preSetForm.province,
      city: preSetForm.city,
      extraProperties: JSON.stringify(preSetForm),
      remark: preSetForm.remark,
    };
    await addUpdateUserAccount(params);
    goToNext();
  } catch (error) {}
}
</script>
packages/components/src/views/GasBillRecharge/GasBillRechargeStep3.vue
New file
@@ -0,0 +1,244 @@
<template>
  <NutForm
    :model-value="form"
    ref="formRef"
    :rules="rules"
    label-position="top"
    class="order-bill-recharge electric"
  >
    <NutFormItem class="bole-form-item" prop="currentUserAccountId">
      <NutRadioGroup
        v-model="form.currentUserAccountId"
        direction="horizontal"
        class="par-account-list"
        v-if="userAccountAllList.length > 0"
        @change="handleUserAccountChange"
      >
        <NutRadio :label="item.id" shape="button" v-for="item in userAccountAllList" :key="item.id"
          >{{ item.city }}-{{ item.content }}</NutRadio
        >
      </NutRadioGroup>
      <AccountCard
        v-if="userAccountAllList.length > 0"
        title="充值户号"
        :content="`${form.city} ${form.gasAccount}`"
        :remark="form.remark"
      >
        <template #action>
          <div class="account-card-action" @click="handleAddUserAccount">新增</div>
        </template>
      </AccountCard>
      <AccountAddCard text="新增户号" v-else @click="handleAddUserAccount" />
    </NutFormItem>
    <NutFormItem
      v-if="!!form.province"
      label="选择充值金额"
      class="bole-form-item"
      prop="parValue"
      required
    >
      <NutRadioGroup v-model="form.parValue" direction="horizontal" class="parValue-radio-group">
        <!-- <NutRadio
          :label="Number(item)"
          :key="item"
          shape="button"
          v-for="item in parValueList"
          class="parValue-item"
        >
          <div class="parValue-item-inner">
            <div class="amount-wrapper">
              <div class="amount">{{ item }}</div>
              <div class="unit">元</div>
            </div>
            <div class="price-wrapper">
              <div class="price-text">折后</div>
              <div class="price">
                {{ blLifeRecharge.getRechargeParValue(item, lifePayGasRate) }}元
              </div>
            </div>
            <div class="discountTag">{{ lifePayGasRate }}折</div>
          </div>
        </NutRadio> -->
      </NutRadioGroup>
    </NutFormItem>
    <div class="common-content">
      <nut-button class="recharge-button" type="primary" @click="handleSubmit">
        <div class="recharge-button-inner">
          <!-- <div>¥{{ realParValue }}</div> -->
          <div class="recharge-button-text">立即充值</div>
        </div>
      </nut-button>
      <RechargeTipsView :tips="tips">
        <template #tips-top>
          同一电费账户在充值期间切勿在多平台重复充值,下单前请仔细阅读下方须知内容。若接到陌生来电,切勿轻信!!!
        </template>
      </RechargeTipsView>
    </div>
    <ConfirmDialog v-model:visible="confirmDialogVisible" @ok="goPay">
      <template #tips>
        该产品为慢充模式,0-72小时内到账,介意请勿付款!充值前请仔细阅读充值须知!
      </template>
      <template #info>
        <ConfirmDialogInfoItem
          label="燃气类型"
          :content="blLifeRecharge.constants.GasOrgCodeEnumText[form.gasOrgType]"
        />
        <ConfirmDialogInfoItem :label-width="96" label="户号" :content="form.gasAccount" />
        <ConfirmDialogInfoItem label="充值金额" :content="`¥${form.parValue.toFixed(2)}`" danger />
        <ConfirmDialogInfoItem label="优惠金额" :content="`¥${discountParValue.toFixed(2)}`" />
        <ConfirmDialogInfoItem label="实付金额" :content="`¥${realParValue}`" danger />
      </template>
      <template #warning>
        同一燃气费账户在充值期间,未到账前切勿在其他任何平台再次充值。因此造成的资金损失须用户自行承担!!!
      </template>
    </ConfirmDialog>
  </NutForm>
</template>
<script setup lang="ts">
import {
  Form as NutForm,
  FormItem as NutFormItem,
  RadioGroup as NutRadioGroup,
  Radio as NutRadio,
  Button as NutButton,
} from '@nutui/nutui-taro';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { reactive, ref, computed } from 'vue';
import {
  useLifeRechargeContext,
  LifeElectricDataCreateLifePayOrderInput,
  LifeRechargeConstants,
  LifeGasDataCreateLifePayOrderInput,
} from '@life-payment/core-vue';
import { useGetRate, useGetGasParValue, useSetUserAccountBySelect } from '../../hooks';
import { useGasBillRechargeContext, GasUserAccountExtraProperties } from './context';
import { FormValidator } from '../../utils';
import { CustomerServiceTips } from '../../constants';
import AccountAddCard from '../../components/Card/AccountAddCard.vue';
import AccountCard from '../../components/Card/AccountCard.vue';
import RechargeTipsView from '../../components/RechargeTipsView/RechargeTipsView.vue';
import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue';
import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue';
defineOptions({
  name: 'GasBillRechargeStep3',
});
type Props = {
  isDev?: boolean;
};
const props = withDefaults(defineProps<Props>(), {
  isDev: false,
});
const emit = defineEmits<{
  (e: 'goPay', orderNo: string): void;
}>();
const { goTo } = useGasBillRechargeContext();
const { blLifeRecharge } = useLifeRechargeContext();
const { lifePayGasRate } = useGetRate();
const form = reactive({
  parValue: 0,
  province: '',
  city: '',
  gasOrgType: '',
  gasAccount: '',
  currentUserAccountId: '',
  remark: '',
});
const { userAccountAllList, handleUserAccountChange } = useSetUserAccountBySelect({
  lifePayOrderType: LifeRechargeConstants.LifePayOrderTypeEnum.燃气订单,
  onSetUserAccount(currentUserAccount) {
    const currentUserAccountExtraProperties = JSON.parse(
      currentUserAccount.extraProperties
    ) as GasUserAccountExtraProperties;
    // form.currentUserAccountId = currentUserAccount.id;
    // form.electricAccount = currentUserAccount.content;
    // form.province = currentUserAccount.province;
    // form.city = currentUserAccount.city;
    // form.electricType = currentUserAccountExtraProperties.electricType;
    // form.electricAccountType = currentUserAccountExtraProperties.electricAccountType;
    // form.sixID = currentUserAccountExtraProperties.sixID;
    // form.remark = currentUserAccount.remark;
    // const electricParValueItem = electricParValueList.value.find(
    //   (x) => x.cityName === form.province
    // );
    // if (
    //   electricParValueItem &&
    //   electricParValueItem.parValue.every((x) => Number(x) !== form.parValue)
    // ) {
    //   form.parValue = 0;
    // }
  },
});
function handleAddUserAccount() {
  goTo('step1');
}
const realParValue = computed(() =>
  blLifeRecharge.getRechargeParValue(form.parValue, lifePayGasRate.value)
);
const discountParValue = computed(() => form.parValue - Number(realParValue.value));
const rules = reactive<FormRules>({
  parValue: [
    { required: true, message: '请选择充值金额', validator: FormValidator.validatorNumberNotNull },
  ],
  currentUserAccountId: [{ required: true, message: '请选择充值户号' }],
});
const formRef = ref<any>(null);
function handleSubmit() {
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      recharge();
    }
  });
}
const tips = [
  '平台提供慢充服务,订单提交后,燃气将于0 - 72 小时内到账,若未能按时到账,系统将自动发起退款。',
  '目前平台仅支持中国燃气和北京燃气充值服务。',
  '中国燃气充值户号必须在“壹品慧”APP燃气缴费界面查询到账户信息,户号为11开头或者5开头的10位数字。',
  '北京燃气不支持欠费充值,仅支持智能表的户号,户号是9开头11位的账户进行充值。',
  '充值期间,若同一账户的充值款未到账,请勿在其他平台重复充值,因上述操作导致的资金损失,由用户自行承担。',
  '如接到陌生来电,对方以缴费或误操作等理由要求处理款项,务必立即拉黑,谨防诈骗。',
  '下单时,请您务必准确填写完整的省市及户号信息。充值完成后,发票由运营商提供,您可登录网上营业厅下载对应的电子发票。',
  CustomerServiceTips,
];
const confirmDialogVisible = ref(false);
function recharge() {
  confirmDialogVisible.value = true;
}
async function goPay() {
  try {
    let params: LifeGasDataCreateLifePayOrderInput = {
      userId: blLifeRecharge.accountModel.userId,
      productData: {
        parValue: props.isDev ? 0.1 : form.parValue,
        gasOrgType: form.gasOrgType,
        gasAccount: form.gasAccount,
        province: form.province,
        city: form.city,
      },
    };
    let res = await blLifeRecharge.services.createLifePayGasOrder(params);
    emit('goPay', res.orderNo);
  } catch (error) {}
}
</script>
packages/components/src/views/GasBillRecharge/GasOrgTypeCard.vue
New file
@@ -0,0 +1,20 @@
<template>
  <div class="gasOrgType-card">
    <div class="gasOrgType-card-title">{{ title }}</div>
    <NutButton class="gasOrgType-card-button" type="primary"> 进入充值 </NutButton>
  </div>
</template>
<script setup lang="ts">
import { Button as NutButton } from '@nutui/nutui-taro';
defineOptions({
  name: 'GasOrgTypeCard',
});
type Props = {
  title?: string;
};
const props = withDefaults(defineProps<Props>(), {});
</script>
packages/components/src/views/GasBillRecharge/context.ts
New file
@@ -0,0 +1,27 @@
import type { InjectionKey, UnwrapNestedRefs, Ref } from 'vue';
import { inject } from 'vue';
import { UseStepperReturn } from 'senin-mini/hooks';
import { LifeRechargeConstants } from '@life-payment/core-vue';
type GasBillRechargeSteps = 'step1' | 'step2' | 'step3';
export interface GasBillRechargeContext
  extends UseStepperReturn<GasBillRechargeSteps, GasBillRechargeSteps[], GasBillRechargeSteps> {
  preSetForm: GasUserAccountExtraProperties;
}
export const GasBillRechargeContextKey: InjectionKey<GasBillRechargeContext> = Symbol(
  'GasBillRechargeContextKey'
);
export function useGasBillRechargeContext() {
  return inject(GasBillRechargeContextKey);
}
export type GasUserAccountExtraProperties = {
  gasOrgType: LifeRechargeConstants.GasOrgCodeEnum;
  province: string;
  city: string;
  gasAccount: string;
  remark: string;
};
packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep1.vue
@@ -1,9 +1,23 @@
<template>
  <PhoneBillRechargeBaseForm ref="formRef" v-model:form="form">
    <NutFormItem label="备注信息" class="bole-form-item" prop="remark">
      <NutInput
        v-model.trim="form.remark"
        class="bole-input-text"
        placeholder="请输入备注信息"
        type="text"
        max-length="30"
      />
    </NutFormItem>
    <div class="common-content">
      <nut-button class="recharge-button" type="primary" @click="handleNext">
        <div class="recharge-button-inner">
          <div class="recharge-button-text">立即充值</div>
        </div>
      </nut-button>
      <nut-button class="recharge-button" type="primary" plain @click="goToNext">
        <div class="recharge-button-inner">
          <div class="recharge-button-text">返回</div>
        </div>
      </nut-button>
    </div>
@@ -11,30 +25,16 @@
</template>
<script setup lang="ts">
import {
  Form as NutForm,
  FormItem as NutFormItem,
  RadioGroup as NutRadioGroup,
  Radio as NutRadio,
  Input as NutInput,
  Button as NutButton,
} from '@nutui/nutui-taro';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { Button as NutButton, FormItem as NutFormItem, Input as NutInput } from '@nutui/nutui-taro';
import { reactive, ref, computed, provide } from 'vue';
import BlRadio from '../../components/Radio/Radio.vue';
import { FormValidator } from '../../utils';
import {
  useLifeRechargeContext,
  BlLifeRecharge,
  LifePhoneDataCreateLifePayOrderInput,
  LifeRechargeConstants,
} from '@life-payment/core-vue';
import RechargeTipsView from '../../components/RechargeTipsView/RechargeTipsView.vue';
import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue';
import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue';
import { useGetRate, useGetPhoneParValue } from '../../hooks';
import PhoneBillRechargeBaseForm from './PhoneBillRechargeBaseForm.vue';
import { usePhoneBillRechargeContext } from './context';
import {
  useLifeRechargeContext,
  LifeRechargeConstants,
  AddUpdateUserAccountInput,
} from '@life-payment/core-vue';
import { useAddUpdateUserAccount } from '../../hooks';
defineOptions({
  name: 'PhoneBillRechargeStep1',
@@ -44,6 +44,7 @@
  ispCode: '',
  phone: '',
  name: '',
  remark: '',
});
const { goToNext } = usePhoneBillRechargeContext();
@@ -54,8 +55,26 @@
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      goToNext();
      handleAddUpdateUserAccount();
    }
  });
}
const { addUpdateUserAccount } = useAddUpdateUserAccount();
const { blLifeRecharge } = useLifeRechargeContext();
async function handleAddUpdateUserAccount() {
  try {
    let params: AddUpdateUserAccountInput = {
      userId: blLifeRecharge.accountModel.userId,
      operators: form.ispCode,
      lifePayType: LifeRechargeConstants.LifePayOrderTypeEnum.话费订单,
      content: form.phone,
      extraProperties: JSON.stringify(form),
      remark: form.remark,
    };
    await addUpdateUserAccount(params);
    goToNext();
  } catch (error) {}
}
</script>
packages/components/src/views/PhoneBillRecharge/PhoneBillRechargeStep2.vue
@@ -6,21 +6,33 @@
    label-position="top"
    class="order-bill-recharge phone"
  >
    <NutFormItem class="bole-form-item">
      <!-- <AccountAddCard /> -->
      <NutRadioGroup v-model="val1" direction="horizontal" class="par-account-list">
        <NutRadio label="1" shape="button">Option 1</NutRadio>
        <NutRadio label="2" shape="button">Option 2</NutRadio>
        <NutRadio label="3" shape="button">Option 3</NutRadio>
        <NutRadio label="4" shape="button">Option 4</NutRadio>
        <NutRadio label="5" shape="button">Option 5</NutRadio>
        <NutRadio label="6" shape="button">Option 6</NutRadio>
    <NutFormItem class="bole-form-item" prop="currentUserAccountId">
      <NutRadioGroup
        v-model="form.currentUserAccountId"
        direction="horizontal"
        class="par-account-list"
        v-if="userAccountAllList.length > 0"
        @change="handleUserAccountChange"
      >
        <NutRadio
          :label="item.id"
          shape="button"
          v-for="item in userAccountAllList"
          :key="item.id"
          >{{ item.content }}</NutRadio
        >
      </NutRadioGroup>
      <AccountCard title="充值手机号" content="18858418480" remark="的地方骄傲的开始和">
      <AccountCard
        v-if="userAccountAllList.length > 0"
        title="充值手机号"
        :content="form.phone"
        :remark="form.remark"
      >
        <template #action>
          <div class="account-card-action">新增</div>
          <div class="account-card-action" @click="handleAddUserAccount">新增</div>
        </template>
      </AccountCard>
      <AccountAddCard v-else @click="handleAddUserAccount" />
    </NutFormItem>
    <NutFormItem label="选择充值金额" class="bole-form-item" prop="parValue" required>
@@ -43,7 +55,7 @@
                {{ blLifeRecharge.getRechargeParValue(item, lifePayPhoneRate) }}元
              </div>
            </div>
            <div class="discountTag">{{ lifePayPhoneRate * 100 }}折</div>
            <div class="discountTag">{{ lifePayPhoneRate }}折</div>
          </div>
        </NutRadio>
      </NutRadioGroup>
@@ -89,10 +101,11 @@
import RechargeTipsView from '../../components/RechargeTipsView/RechargeTipsView.vue';
import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue';
import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue';
import { useGetRate, useGetPhoneParValue } from '../../hooks';
import { useGetRate, useGetPhoneParValue, useSetUserAccountBySelect } from '../../hooks';
import { CustomerServiceTips } from '../../constants';
import AccountAddCard from '../../components/Card/AccountAddCard.vue';
import AccountCard from '../../components/Card/AccountCard.vue';
import { usePhoneBillRechargeContext, PhoneUserAccountExtraProperties } from './context';
defineOptions({
  name: 'PhoneBillRechargeStep2',
@@ -106,14 +119,37 @@
  isDev: false,
});
const { goTo } = usePhoneBillRechargeContext();
const form = reactive({
  ispCode: '',
  phone: '',
  parValue: 0,
  name: '',
  currentUserAccountId: '',
  remark: '',
});
const val1 = ref('');
const { userAccountAllList, handleUserAccountChange } = useSetUserAccountBySelect({
  lifePayOrderType: LifeRechargeConstants.LifePayOrderTypeEnum.话费订单,
  onSetUserAccount(currentUserAccount) {
    const currentUserAccountExtraProperties = JSON.parse(
      currentUserAccount.extraProperties
    ) as PhoneUserAccountExtraProperties;
    form.currentUserAccountId = currentUserAccount.id;
    form.phone = currentUserAccount.content;
    form.ispCode = currentUserAccountExtraProperties.ispCode;
    form.name = currentUserAccountExtraProperties.name;
    form.remark = currentUserAccount.remark;
    changeIspCode(form.ispCode as any);
  },
});
function handleAddUserAccount() {
  goTo('step1');
}
const emit = defineEmits<{
  (e: 'goPay', orderNo: string): void;
@@ -130,7 +166,7 @@
function changeIspCode(val: LifeRechargeConstants.IspCode) {
  const phoneParValueItem = phoneParValueList.value.find((x) => x.ispCode === val);
  if (phoneParValueItem.parValue.every((x) => Number(x) !== form.parValue)) {
  if (phoneParValueItem && phoneParValueItem.parValue.every((x) => Number(x) !== form.parValue)) {
    form.parValue = 0;
  }
}
@@ -146,6 +182,7 @@
  parValue: [
    { required: true, message: '请选择充值金额', validator: FormValidator.validatorNumberNotNull },
  ],
  currentUserAccountId: [{ required: true, message: '请选择充值手机号' }],
});
const formRef = ref<any>(null);
packages/components/src/views/PhoneBillRecharge/context.ts
@@ -25,3 +25,10 @@
export function usePhoneBillRechargeContext() {
  return inject(PhoneBillRechargeContextKey);
}
export type PhoneUserAccountExtraProperties = {
  ispCode: string;
  phone: string;
  name: string;
  remark: string;
};
packages/components/src/views/electricBillRecharge/ElectricBillRechargeBaseForm.vue
New file
@@ -0,0 +1,128 @@
<template>
  <NutForm
    :model-value="form"
    ref="formRef"
    :rules="rules"
    label-position="top"
    class="order-bill-recharge electric"
  >
    <NutFormItem label="所在区域" class="bole-form-item" prop="province" required>
      <ChooseInputWithPicker
        v-model="form.province"
        placeholder="请选择区域"
        :value-enum="electricParValueList"
        enum-label-key="cityName"
        enum-value-key="cityName"
      />
    </NutFormItem>
    <NutFormItem label="所在城市" class="bole-form-item" prop="city" required v-if="form.province">
      <ChooseInputWithPicker
        v-model="form.city"
        placeholder="请选择城市"
        :value-enum="electricCityList"
        enum-label-key="cityName"
        enum-value-key="cityName"
      />
    </NutFormItem>
    <!-- <NutFormItem label="电网类型" class="bole-form-item" prop="electricType" required>
      <ChooseInputWithPicker
        v-model="form.electricType"
        placeholder="请选择电网类型"
        :value-enum="blLifeRecharge.constants.ElectricTypeText"
      />
    </NutFormItem> -->
    <NutFormItem label="电费类型" class="bole-form-item" prop="electricAccountType" required>
      <ChooseInputWithPicker
        v-model="form.electricAccountType"
        placeholder="请选择电费类型"
        :value-enum="blLifeRecharge.constants.ElectricAccountTypeText"
      />
    </NutFormItem>
    <NutFormItem label="电网户号" class="bole-form-item" prop="electricAccount" required>
      <NumberInput
        v-model.trim="form.electricAccount"
        class="bole-input-text"
        placeholder="请输入13位数字编号"
        max-length="13"
      />
    </NutFormItem>
    <NutFormItem
      v-if="form.electricType === blLifeRecharge.constants.ElectricType.nanwang"
      label="身份证后六位"
      class="bole-form-item"
      prop="sixID"
      required
    >
      <NutInput
        v-model.trim="form.sixID"
        class="bole-input-text"
        placeholder="请输入身份证后六位"
        type="text"
        max-length="6"
      />
    </NutFormItem>
    <slot />
  </NutForm>
</template>
<script setup lang="ts">
import { Form as NutForm, FormItem as NutFormItem, Input as NutInput } from '@nutui/nutui-taro';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { reactive, ref, computed, watch } from 'vue';
import { useLifeRechargeContext } from '@life-payment/core-vue';
import ChooseInputWithPicker from '../../components/Input/ChooseInputWithPicker.vue';
import NumberInput from '../../components/Input/NumberInput.vue';
import { useGetElectricParValue } from '../../hooks';
import { FormValidator } from '../../utils';
defineOptions({
  name: 'ElectricBillRechargeBaseForm',
});
const form = defineModel<{
  electricAccount: string;
  electricType: string;
  electricAccountType: string;
  province: string;
  city: string;
  sixID: string;
}>('form');
const { electricParValueList } = useGetElectricParValue();
const electricCityList = computed(
  () =>
    electricParValueList.value.find((x) => x.cityName === form.value.province)?.childCityList ?? []
);
watch(
  () => form.value.province,
  (provinceName) => {
    const electricParValue = electricParValueList.value.find(
      (item) => item.cityName === provinceName
    );
    form.value.electricType = electricParValue.electricType;
  }
);
const { blLifeRecharge } = useLifeRechargeContext();
const rules = reactive<FormRules>({
  province: [{ required: true, message: '请选择所在区域' }],
  city: [{ required: true, message: '请选择所在城市' }],
  electricAccountType: [{ required: true, message: '请选择电费类型' }],
  electricAccount: [{ required: true, message: '请输入电网户号', regex: /^\d{13}$/ }],
  sixID: [
    {
      required: true,
      message: '请输入身份证后六位',
      validator: FormValidator.validatorIDNumberSix,
    },
  ],
});
const formRef = ref<any>(null);
defineExpose({
  validate: computed(() => formRef.value.validate),
});
</script>
packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep1.vue
New file
@@ -0,0 +1,84 @@
<template>
  <ElectricBillRechargeBaseForm ref="formRef" v-model:form="form">
    <NutFormItem label="备注信息" class="bole-form-item" prop="remark">
      <NutInput
        v-model.trim="form.remark"
        class="bole-input-text"
        placeholder="请输入备注信息"
        type="text"
        max-length="30"
      />
    </NutFormItem>
    <div class="common-content">
      <nut-button class="recharge-button" type="primary" @click="handleNext">
        <div class="recharge-button-inner">
          <div class="recharge-button-text">立即充值</div>
        </div>
      </nut-button>
      <nut-button class="recharge-button" type="primary" plain @click="goToNext">
        <div class="recharge-button-inner">
          <div class="recharge-button-text">返回</div>
        </div>
      </nut-button>
    </div>
  </ElectricBillRechargeBaseForm>
</template>
<script setup lang="ts">
import { Button as NutButton, FormItem as NutFormItem, Input as NutInput } from '@nutui/nutui-taro';
import { reactive, ref } from 'vue';
import { useElectricBillRechargeContext } from './context';
import ElectricBillRechargeBaseForm from './ElectricBillRechargeBaseForm.vue';
import {
  useLifeRechargeContext,
  LifeRechargeConstants,
  AddUpdateUserAccountInput,
} from '@life-payment/core-vue';
import { useAddUpdateUserAccount } from '../../hooks';
defineOptions({
  name: 'ElectricBillRechargeStep1',
});
const form = reactive({
  electricAccount: '',
  electricType: '',
  electricAccountType: '',
  province: '',
  city: '',
  sixID: '',
  remark: '',
});
const { goToNext } = useElectricBillRechargeContext();
const formRef = ref<any>(null);
function handleNext() {
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      handleAddUpdateUserAccount();
    }
  });
}
const { addUpdateUserAccount } = useAddUpdateUserAccount();
const { blLifeRecharge } = useLifeRechargeContext();
async function handleAddUpdateUserAccount() {
  try {
    let params: AddUpdateUserAccountInput = {
      userId: blLifeRecharge.accountModel.userId,
      lifePayType: LifeRechargeConstants.LifePayOrderTypeEnum.电费订单,
      content: form.electricAccount,
      province: form.province,
      city: form.city,
      extraProperties: JSON.stringify(form),
      remark: form.remark,
    };
    await addUpdateUserAccount(params);
    goToNext();
  } catch (error) {}
}
</script>
packages/components/src/views/electricBillRecharge/ElectricBillRechargeStep2.vue
New file
@@ -0,0 +1,249 @@
<template>
  <NutForm
    :model-value="form"
    ref="formRef"
    :rules="rules"
    label-position="top"
    class="order-bill-recharge electric"
  >
    <NutFormItem class="bole-form-item" prop="currentUserAccountId">
      <NutRadioGroup
        v-model="form.currentUserAccountId"
        direction="horizontal"
        class="par-account-list"
        v-if="userAccountAllList.length > 0"
        @change="handleUserAccountChange"
      >
        <NutRadio :label="item.id" shape="button" v-for="item in userAccountAllList" :key="item.id"
          >{{ item.city }}-{{ item.content }}</NutRadio
        >
      </NutRadioGroup>
      <AccountCard
        v-if="userAccountAllList.length > 0"
        title="充值户号"
        :content="`${form.city} ${form.electricAccount}`"
        :remark="form.remark"
      >
        <template #action>
          <div class="account-card-action" @click="handleAddUserAccount">新增</div>
        </template>
      </AccountCard>
      <AccountAddCard text="新增户号" v-else @click="handleAddUserAccount" />
    </NutFormItem>
    <NutFormItem
      v-if="!!form.province"
      label="选择充值金额"
      class="bole-form-item"
      prop="parValue"
      required
    >
      <NutRadioGroup v-model="form.parValue" direction="horizontal" class="parValue-radio-group">
        <NutRadio
          :label="Number(item)"
          :key="item"
          shape="button"
          v-for="item in parValueList"
          class="parValue-item"
        >
          <div class="parValue-item-inner">
            <div class="amount-wrapper">
              <div class="amount">{{ item }}</div>
              <div class="unit">元</div>
            </div>
            <div class="price-wrapper">
              <div class="price-text">折后</div>
              <div class="price">
                {{ blLifeRecharge.getRechargeParValue(item, lifePayElectricRate) }}元
              </div>
            </div>
            <div class="discountTag">{{ lifePayElectricRate }}折</div>
          </div>
        </NutRadio>
      </NutRadioGroup>
    </NutFormItem>
    <div class="common-content">
      <nut-button class="recharge-button" type="primary" @click="handleSubmit">
        <div class="recharge-button-inner">
          <div>¥{{ realParValue }}</div>
          <div class="recharge-button-text">立即充值</div>
        </div>
      </nut-button>
      <RechargeTipsView :tips="tips" />
    </div>
    <ConfirmDialog v-model:visible="confirmDialogVisible" @ok="goPay">
      <template #tips>
        该产品为慢充模式,0-72小时内到账,介意请勿付款!充值前请仔细阅读充值须知!
      </template>
      <template #info>
        <ConfirmDialogInfoItem
          label="电网类型"
          :content="blLifeRecharge.constants.ElectricTypeText[form.electricType]"
        />
        <ConfirmDialogInfoItem :label-width="96" label="户号" :content="form.electricAccount" />
        <ConfirmDialogInfoItem label="充值金额" :content="`¥${form.parValue.toFixed(2)}`" danger />
        <ConfirmDialogInfoItem label="优惠金额" :content="`¥${discountParValue.toFixed(2)}`" />
        <ConfirmDialogInfoItem label="实付金额" :content="`¥${realParValue}`" danger />
      </template>
      <template #warning>
        同一电费账户在充值期间,未到账前切勿在其他任何平台再次充值。因此造成的资金损失须用户自行承担!!!
      </template>
    </ConfirmDialog>
  </NutForm>
</template>
<script setup lang="ts">
import {
  Form as NutForm,
  FormItem as NutFormItem,
  RadioGroup as NutRadioGroup,
  Radio as NutRadio,
  Button as NutButton,
} from '@nutui/nutui-taro';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { reactive, ref, computed } from 'vue';
import {
  useLifeRechargeContext,
  LifeElectricDataCreateLifePayOrderInput,
  LifeRechargeConstants,
  UserAccountListOutput,
} from '@life-payment/core-vue';
import RechargeTipsView from '../../components/RechargeTipsView/RechargeTipsView.vue';
import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue';
import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue';
import { useGetRate, useGetElectricParValue, useSetUserAccountBySelect } from '../../hooks';
import { FormValidator } from '../../utils';
import { CustomerServiceTips } from '../../constants';
import AccountAddCard from '../../components/Card/AccountAddCard.vue';
import AccountCard from '../../components/Card/AccountCard.vue';
import { useElectricBillRechargeContext, ElectricUserAccountExtraProperties } from './context';
defineOptions({
  name: 'ElectricBillRechargeStep2',
});
type Props = {
  isDev?: boolean;
};
const props = withDefaults(defineProps<Props>(), {
  isDev: false,
});
const emit = defineEmits<{
  (e: 'goPay', orderNo: string): void;
}>();
const { goTo } = useElectricBillRechargeContext();
const form = reactive({
  parValue: 0,
  electricAccount: '',
  electricType: '',
  electricAccountType: '',
  province: '',
  city: '',
  sixID: '',
  currentUserAccountId: '',
  remark: '',
});
const { userAccountAllList, handleUserAccountChange } = useSetUserAccountBySelect({
  lifePayOrderType: LifeRechargeConstants.LifePayOrderTypeEnum.电费订单,
  onSetUserAccount(currentUserAccount) {
    const currentUserAccountExtraProperties = JSON.parse(
      currentUserAccount.extraProperties
    ) as ElectricUserAccountExtraProperties;
    form.currentUserAccountId = currentUserAccount.id;
    form.electricAccount = currentUserAccount.content;
    form.province = currentUserAccount.province;
    form.city = currentUserAccount.city;
    form.electricType = currentUserAccountExtraProperties.electricType;
    form.electricAccountType = currentUserAccountExtraProperties.electricAccountType;
    form.sixID = currentUserAccountExtraProperties.sixID;
    form.remark = currentUserAccount.remark;
    const electricParValueItem = electricParValueList.value.find(
      (x) => x.cityName === form.province
    );
    if (
      electricParValueItem &&
      electricParValueItem.parValue.every((x) => Number(x) !== form.parValue)
    ) {
      form.parValue = 0;
    }
  },
});
function handleAddUserAccount() {
  goTo('step1');
}
const { lifePayElectricRate } = useGetRate();
const { electricParValueList } = useGetElectricParValue();
const { blLifeRecharge } = useLifeRechargeContext();
const parValueList = computed(() => {
  const parValueList =
    electricParValueList.value.find((x) => x.cityName === form.province)?.parValue ?? [];
  return blLifeRecharge.filterParValueList(parValueList);
});
const realParValue = computed(() =>
  blLifeRecharge.getRechargeParValue(form.parValue, lifePayElectricRate.value)
);
const discountParValue = computed(() => form.parValue - Number(realParValue.value));
const rules = reactive<FormRules>({
  parValue: [
    { required: true, message: '请选择充值金额', validator: FormValidator.validatorNumberNotNull },
  ],
  currentUserAccountId: [{ required: true, message: '请选择充值户号' }],
});
const formRef = ref<any>(null);
function handleSubmit() {
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      recharge();
    }
  });
}
const tips = [
  '平台提供慢充服务,订单提交后,电费将于0 - 72 小时内到账,若未能按时到账,系统将自动发起退款。',
  '充值期间,若同一账户的充值款未到账,请勿在其他平台重复充值,因上述操作导致的资金损失,由用户自行承担。',
  '为确保充值顺利进行,目前平台不支持对欠款金额超过1000元的账户进行充值,且每次充值金额必须高于欠费总额。',
  '如接到陌生来电,对方以缴费或误操作等理由要求处理款项,务必立即拉黑,谨防诈骗。',
  '下单时,请您务必准确填写完整的省市及户号信息。充值完成后,发票由运营商提供,您可登录网上营业厅下载对应的电子发票。',
  CustomerServiceTips,
];
const confirmDialogVisible = ref(false);
function recharge() {
  confirmDialogVisible.value = true;
}
async function goPay() {
  try {
    let params: LifeElectricDataCreateLifePayOrderInput = {
      userId: blLifeRecharge.accountModel.userId,
      productData: {
        parValue: props.isDev ? 0.1 : form.parValue,
        electricType: form.electricType,
        electricAccountType: form.electricAccountType,
        electricAccount: form.electricAccount,
        province: form.province,
        city: form.city,
        sixID: form.sixID,
      },
    };
    let res = await blLifeRecharge.services.createLifePayElectricOrder(params);
    emit('goPay', res.orderNo);
  } catch (error) {}
}
</script>
packages/components/src/views/electricBillRecharge/context.ts
New file
@@ -0,0 +1,37 @@
import type { InjectionKey, UnwrapNestedRefs, Ref } from 'vue';
import { inject } from 'vue';
import { UseStepperReturn } from 'senin-mini/hooks';
type ElectricBillRechargeSteps = 'step1' | 'step2';
export interface ElectricBillRechargeContext
  extends UseStepperReturn<
    ElectricBillRechargeSteps,
    ElectricBillRechargeSteps[],
    ElectricBillRechargeSteps
  > {
  //   form: UnwrapNestedRefs<{
  //     ispCode: string;
  //     phone: string;
  //     parValue: number;
  //     name: string;
  //   }>;
}
export const ElectricBillRechargeContextKey: InjectionKey<ElectricBillRechargeContext> = Symbol(
  'ElectricBillRechargeContextKey'
);
export function useElectricBillRechargeContext() {
  return inject(ElectricBillRechargeContextKey);
}
export type ElectricUserAccountExtraProperties = {
  electricAccount: string;
  electricType: string;
  electricAccountType: string;
  province: string;
  city: string;
  sixID: string;
  remark: string;
};
packages/components/src/views/electricBillRecharge/electricBillRecharge.vue
@@ -1,151 +1,18 @@
<template>
  <NutForm
    :model-value="form"
    ref="formRef"
    :rules="rules"
    label-position="top"
    class="order-bill-recharge electric"
  >
    <FormItem label="所在区域" class="bole-form-item" prop="province" required>
      <ChooseInputWithPicker
        v-model="form.province"
        placeholder="请选择区域"
        :value-enum="electricParValueList"
        enum-label-key="cityName"
        enum-value-key="cityName"
      />
    </FormItem>
    <FormItem label="所在城市" class="bole-form-item" prop="city" required v-if="form.province">
      <ChooseInputWithPicker
        v-model="form.city"
        placeholder="请选择城市"
        :value-enum="electricCityList"
        enum-label-key="cityName"
        enum-value-key="cityName"
      />
    </FormItem>
    <!-- <FormItem label="电网类型" class="bole-form-item" prop="electricType" required>
      <ChooseInputWithPicker
        v-model="form.electricType"
        placeholder="请选择电网类型"
        :value-enum="blLifeRecharge.constants.ElectricTypeText"
      />
    </FormItem> -->
    <FormItem label="电费类型" class="bole-form-item" prop="electricAccountType" required>
      <ChooseInputWithPicker
        v-model="form.electricAccountType"
        placeholder="请选择电费类型"
        :value-enum="blLifeRecharge.constants.ElectricAccountTypeText"
      />
    </FormItem>
    <FormItem label="电网户号" class="bole-form-item" prop="electricAccount" required>
      <NumberInput
        v-model.trim="form.electricAccount"
        class="bole-input-text"
        placeholder="请输入13位数字编号"
        max-length="13"
      />
    </FormItem>
    <FormItem
      v-if="form.electricType === blLifeRecharge.constants.ElectricType.nanwang"
      label="身份证后六位"
      class="bole-form-item"
      prop="sixID"
      required
    >
      <NutInput
        v-model.trim="form.sixID"
        class="bole-input-text"
        placeholder="请输入身份证后六位"
        type="text"
        max-length="6"
      />
    </FormItem>
    <FormItem
      v-if="!!form.province"
      label="选择充值金额"
      class="bole-form-item"
      prop="parValue"
      required
    >
      <NutRadioGroup v-model="form.parValue" direction="horizontal" class="parValue-radio-group">
        <NutRadio
          :label="Number(item)"
          :key="item"
          shape="button"
          v-for="item in parValueList"
          class="parValue-item"
        >
          <div class="parValue-item-inner">
            <div class="amount-wrapper">
              <div class="amount">{{ item }}</div>
              <div class="unit">元</div>
            </div>
            <div class="price-wrapper">
              <div class="price-text">折后</div>
              <div class="price">
                {{ blLifeRecharge.getRechargeParValue(item, lifePayElectricRate) }}元
              </div>
            </div>
            <div class="discountTag">{{ lifePayElectricRate * 100 }}折</div>
          </div>
        </NutRadio>
      </NutRadioGroup>
    </FormItem>
    <div class="common-content">
      <nut-button class="recharge-button" type="primary" @click="handleSubmit">
        <div class="recharge-button-inner">
          <div>¥{{ realParValue }}</div>
          <div class="recharge-button-text">立即充值</div>
        </div>
      </nut-button>
      <RechargeTipsView :tips="tips" />
    </div>
    <ConfirmDialog v-model:visible="confirmDialogVisible" @ok="goPay">
      <template #tips>
        该产品为慢充模式,0-72小时内到账,介意请勿付款!充值前请仔细阅读充值须知!
      </template>
      <template #info>
        <ConfirmDialogInfoItem
          label="电网类型"
          :content="blLifeRecharge.constants.ElectricTypeText[form.electricType]"
        />
        <ConfirmDialogInfoItem :label-width="96" label="户号" :content="form.electricAccount" />
        <ConfirmDialogInfoItem label="充值金额" :content="`¥${form.parValue.toFixed(2)}`" danger />
        <ConfirmDialogInfoItem label="优惠金额" :content="`¥${discountParValue.toFixed(2)}`" />
        <ConfirmDialogInfoItem label="实付金额" :content="`¥${realParValue}`" danger />
      </template>
      <template #warning>
        同一电费账户在充值期间,未到账前切勿在其他任何平台再次充值。因此造成的资金损失须用户自行承担!!!
      </template>
    </ConfirmDialog>
  </NutForm>
  <ElectricBillRechargeStep1 v-if="current === 'step1'" />
  <ElectricBillRechargeStep2
    v-else-if="current === 'step2'"
    v-bind="props"
    @go-pay="emit('goPay', $event)"
  />
</template>
<script setup lang="ts">
import {
  Form as NutForm,
  FormItem,
  RadioGroup as NutRadioGroup,
  Radio as NutRadio,
  Input as NutInput,
  Button as NutButton,
} from '@nutui/nutui-taro';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { reactive, ref, computed, watch } from 'vue';
import {
  useLifeRechargeContext,
  BlLifeRecharge,
  LifeElectricDataCreateLifePayOrderInput,
} from '@life-payment/core-vue';
import RechargeTipsView from '../../components/RechargeTipsView/RechargeTipsView.vue';
import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue';
import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue';
import ChooseInputWithPicker from '../../components/Input/ChooseInputWithPicker.vue';
import NumberInput from '../../components/Input/NumberInput.vue';
import { useGetRate, useGetElectricParValue } from '../../hooks';
import { FormValidator } from '../../utils';
import { CustomerServiceTips } from '../../constants';
import { computed, provide } from 'vue';
import { useStepper } from 'senin-mini/hooks';
import { ElectricBillRechargeContextKey } from './context';
import ElectricBillRechargeStep1 from './ElectricBillRechargeStep1.vue';
import ElectricBillRechargeStep2 from './ElectricBillRechargeStep2.vue';
defineOptions({
  name: 'electricBillRecharge',
@@ -163,105 +30,10 @@
  (e: 'goPay', orderNo: string): void;
}>();
const form = reactive({
  parValue: 0,
  electricAccount: '',
  electricType: '',
  electricAccountType: '',
  province: '',
  city: '',
  sixID: '',
const stepperInfo = useStepper(['step1', 'step2'], 'step2');
const current = computed(() => stepperInfo.current.value);
provide(ElectricBillRechargeContextKey, {
  ...stepperInfo,
});
const { lifePayElectricRate } = useGetRate();
const { electricParValueList } = useGetElectricParValue();
const parValueList = computed(() => {
  const parValueList =
    electricParValueList.value.find((x) => x.cityName === form.province)?.parValue ?? [];
  return blLifeRecharge.filterParValueList(parValueList);
});
const electricCityList = computed(
  () => electricParValueList.value.find((x) => x.cityName === form.province)?.childCityList ?? []
);
watch(
  () => form.province,
  (provinceName) => {
    const electricParValue = electricParValueList.value.find(
      (item) => item.cityName === provinceName
    );
    form.electricType = electricParValue.electricType;
  }
);
const realParValue = computed(() =>
  blLifeRecharge.getRechargeParValue(form.parValue, lifePayElectricRate.value)
);
const discountParValue = computed(() => form.parValue - Number(realParValue.value));
const { blLifeRecharge } = useLifeRechargeContext();
const rules = reactive<FormRules>({
  province: [{ required: true, message: '请选择所在区域' }],
  city: [{ required: true, message: '请选择所在城市' }],
  electricAccountType: [{ required: true, message: '请选择电费类型' }],
  electricAccount: [{ required: true, message: '请输入电网户号', regex: /^\d{13}$/ }],
  sixID: [
    {
      required: true,
      message: '请输入身份证后六位',
      validator: FormValidator.validatorIDNumberSix,
    },
  ],
  parValue: [
    { required: true, message: '请选择充值金额', validator: FormValidator.validatorNumberNotNull },
  ],
});
const formRef = ref<any>(null);
function handleSubmit() {
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      recharge();
    }
  });
}
const tips = [
  '平台提供慢充服务,订单提交后,电费将于0 - 72 小时内到账,若未能按时到账,系统将自动发起退款。',
  '充值期间,若同一账户的充值款未到账,请勿在其他平台重复充值,因上述操作导致的资金损失,由用户自行承担。',
  '为确保充值顺利进行,目前平台不支持对欠款金额超过1000元的账户进行充值,且每次充值金额必须高于欠费总额。',
  '如接到陌生来电,对方以缴费或误操作等理由要求处理款项,务必立即拉黑,谨防诈骗。',
  '下单时,请您务必准确填写完整的省市及户号信息。充值完成后,发票由运营商提供,您可登录网上营业厅下载对应的电子发票。',
  CustomerServiceTips,
];
const confirmDialogVisible = ref(false);
function recharge() {
  confirmDialogVisible.value = true;
}
async function goPay() {
  try {
    let params: LifeElectricDataCreateLifePayOrderInput = {
      userId: blLifeRecharge.accountModel.userId,
      productData: {
        parValue: props.isDev ? 0.1 : form.parValue,
        electricType: form.electricType,
        electricAccountType: form.electricAccountType,
        electricAccount: form.electricAccount,
        province: form.province,
        city: form.city,
        sixID: form.sixID,
      },
    };
    let res = await blLifeRecharge.services.createLifePayElectricOrder(params);
    emit('goPay', res.orderNo);
  } catch (error) {}
}
</script>
packages/core/src/lifeRecharge.ts
@@ -43,7 +43,7 @@
  }
  getRechargeParValue(amount: number | string, rate: number) {
    return (Number(amount) * rate).toFixed(2);
    return ((Number(amount) * rate) / 100).toFixed(2);
  }
  MaxParValue = 300;
packages/core/src/lifeRechargeConstants.ts
@@ -1,7 +1,11 @@
export namespace LifeRechargeConstants {
  export enum LifePayRateTypeEnum {
    '默认话费折扣' = 10,
    '默认电费折扣' = 10,
    '默认电费折扣' = 20,
    默认燃气折扣 = 30,
    供应商折扣价 = 40,
  }
  export enum LifePayTypeEnum {
@@ -12,6 +16,7 @@
  export enum LifePayOrderTypeEnum {
    话费订单 = 10,
    电费订单 = 20,
    燃气订单 = 30,
  }
  export enum LifePayStatusEnum {
@@ -76,4 +81,22 @@
    [ElectricAccountType.shop]: '店铺',
    [ElectricAccountType.nanwashopng]: '店铺-不建议使用',
  };
  export enum GasOrgCodeEnum {
    中国燃气 = 'zhong_guo',
    新奥燃气 = 'xin_ao',
    华润燃气 = 'hua_run',
    港华燃气 = 'gang_hua',
    中燃燃气 = 'zhong_ran',
    北京燃气 = 'bei_jing',
  }
  export const GasOrgCodeEnumText = {
    [GasOrgCodeEnum.中国燃气]: '中国燃气',
    [GasOrgCodeEnum.新奥燃气]: '新奥燃气',
    [GasOrgCodeEnum.华润燃气]: '华润燃气',
    [GasOrgCodeEnum.港华燃气]: '港华燃气',
    [GasOrgCodeEnum.中燃燃气]: '中燃燃气',
    [GasOrgCodeEnum.北京燃气]: '北京燃气',
  };
}
packages/core/src/lifeRechargeServices.ts
@@ -156,6 +156,50 @@
      ...(options || {}),
    });
  }
  /** 获取我的全部户号列表 POST /api/LifePay/GetUserAccountAllList */
  async getUserAccountAllList(body: QueryUserAccountAllListInput, options?: RequestConfig) {
    return this.request<UserAccountListOutput[]>('/api/LifePay/GetUserAccountAllList', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
  /** 添加或修改我的户号 POST /api/LifePay/AddUpdateUserAccount */
  async addUpdateUserAccount(body: AddUpdateUserAccountInput, options?: RequestConfig) {
    return this.request<number>('/api/LifePay/AddUpdateUserAccount', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
  /** 创建生活缴费燃气订单 POST /api/LifePay/CreateLifePayGasOrder */
  async createLifePayGasOrder(body: LifeGasDataCreateLifePayOrderInput, options?: RequestConfig) {
    return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayGasOrder', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
  /** 获取燃气面值 GET /api/LifePay/GetGasParValue */
  async getGasParValue(options?: RequestConfig) {
    return this.request<GasParValueResponse>('/api/LifePay/GetGasParValue', {
      method: 'GET',
      ...(options || {}),
    });
  }
}
export interface PhoneMesssageCodeLoginInput {
@@ -392,3 +436,89 @@
  timeExpire?: string;
  message?: string;
}
export interface QueryUserAccountAllListInput {
  /** 用户Id */
  userId?: string;
  lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum;
}
export interface UserAccountListOutput {
  id?: string;
  lifePayType?: LifeRechargeConstants.LifePayOrderTypeEnum;
  /** 运营商 */
  operators?: string;
  /** 手机号/户号 */
  content?: string;
  /** 省 */
  province?: string;
  /** 市 */
  city?: string;
  /** 拓展字段(电费类型) */
  extraProperties?: string;
  /** 备注 */
  remark?: string;
  /** 创建时间 */
  creationTime?: string;
  isDeleted?: boolean;
}
export interface AddUpdateUserAccountInput {
  id?: string;
  /** 用户编号 */
  userId?: string;
  lifePayType?: LifeRechargeConstants.LifePayOrderTypeEnum;
  /** 运营商 */
  operators?: string;
  /** 手机号/户号 */
  content?: string;
  /** 省 */
  province?: string;
  /** 市 */
  city?: string;
  /** 拓展字段(电费类型) */
  extraProperties?: string;
  /** 备注 */
  remark?: string;
}
export interface LifeGasDataCreateLifePayOrderInput {
  userId?: string;
  productData?: LifeGasData;
}
export interface LifeGasData {
  /** 充值面额,单位为元。 */
  parValue: number;
  /** 天然气公司类型,"zhong_ran"代表中燃燃气,"bei_jing"代表北京燃气。 */
  gasOrgType: string;
  /** 燃气户号 */
  gasAccount: string;
  /** 省份 */
  province: string;
  /** 城市 */
  city?: string;
}
export interface GasParValueResponse {
  success?: boolean;
  requestNo?: string;
  partnerId?: string;
  service?: string;
  version?: string;
  protocol?: string;
  context?: string;
  ext?: any;
  code?: string;
  message?: string;
  detail?: string;
  gasParValue?: GasParValueOutput;
}
export interface GasParValueOutput {
  gasOrgName?: string;
  gasOrgCode?: string;
  parValue?: string[];
  rate?: number;
  comments?: string;
}
packages/services/api/LifePay.ts
@@ -2,6 +2,51 @@
// @ts-ignore
import { request } from '@/utils/request';
/** 添加或修改我的户号 POST /api/LifePay/AddUpdateUserAccount */
export async function addUpdateUserAccount(
  body: API.AddUpdateUserAccountInput,
  options?: API.RequestConfig
) {
  return request<number>('/api/LifePay/AddUpdateUserAccount', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 折扣配置 POST /api/LifePay/CreateEditLifePayRate */
export async function createEditLifePayRate(
  body: API.LifePayRateInput[],
  options?: API.RequestConfig
) {
  return request<number>('/api/LifePay/CreateEditLifePayRate', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 渠道管理 POST /api/LifePay/CreateEditPayChannels */
export async function createEditPayChannels(
  body: API.CreateEditPayChannelsInput,
  options?: API.RequestConfig
) {
  return request<number>('/api/LifePay/CreateEditPayChannels', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 创建生活缴费电费订单 POST /api/LifePay/CreateLifePayElectricOrder */
export async function createLifePayElectricOrder(
  body: API.LifeElectricDataCreateLifePayOrderInput,
@@ -17,12 +62,57 @@
  });
}
/** 创建生活缴费燃气订单 POST /api/LifePay/CreateLifePayGasOrder */
export async function createLifePayGasOrder(
  body: API.LifeGasDataCreateLifePayOrderInput,
  options?: API.RequestConfig
) {
  return request<API.CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayGasOrder', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 创建生活缴费话费订单 POST /api/LifePay/CreateLifePayPhoneOrder */
export async function createLifePayPhoneOrder(
  body: API.LifePhoneDataCreateLifePayOrderInput,
  options?: API.RequestConfig
) {
  return request<API.CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayPhoneOrder', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 删除我的户号 POST /api/LifePay/DeleteUserAccount */
export async function deleteUserAccount(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.APIdeleteUserAccountParams,
  options?: API.RequestConfig
) {
  return request<number>('/api/LifePay/DeleteUserAccount', {
    method: 'POST',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
/** 获取用户户号分页数据 POST /api/LifePay/GetAccountPage */
export async function getAccountPage(
  body: API.QueryUserAccountListInput,
  options?: API.RequestConfig
) {
  return request<API.UserAccountListOutputPageOutput>('/api/LifePay/GetAccountPage', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
@@ -48,12 +138,70 @@
  });
}
/** 获取燃气支持商户 GET /api/LifePay/GetGasOrgType */
export async function getGasOrgType(options?: API.RequestConfig) {
  return request<API.GasOrgTypeValueResponse>('/api/LifePay/GetGasOrgType', {
    method: 'GET',
    ...(options || {}),
  });
}
/** 获取燃气面值 GET /api/LifePay/GetGasParValue */
export async function getGasParValue(options?: API.RequestConfig) {
  return request<API.GasParValueResponse>('/api/LifePay/GetGasParValue', {
    method: 'GET',
    ...(options || {}),
  });
}
/** 获取渠道详情 GET /api/LifePay/GetLifePayChannlesDto */
export async function getLifePayChannlesDto(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.APIgetLifePayChannlesDtoParams,
  options?: API.RequestConfig
) {
  return request<API.CreateEditPayChannelsInput>('/api/LifePay/GetLifePayChannlesDto', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
/** 获取缴费渠道列表 POST /api/LifePay/GetLifePayChannlesPage */
export async function getLifePayChannlesPage(body: API.PageInput, options?: API.RequestConfig) {
  return request<API.CreateEditPayChannelsInputPageOutput>('/api/LifePay/GetLifePayChannlesPage', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 获取订单分页数据 POST /api/LifePay/GetLifePayOrderPage */
export async function getLifePayOrderPage(
  body: API.QueryLifePayOrderListInput,
  options?: API.RequestConfig
) {
  return request<API.LifePayOrderListOutputPageOutput>('/api/LifePay/GetLifePayOrderPage', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 此处后端没有提供注释 POST /api/LifePay/GetLifePayOrderPageExport */
export async function getLifePayOrderPageExport(
  body: API.QueryLifePayOrderListInput,
  options?: API.RequestConfig
) {
  return request<any>('/api/LifePay/GetLifePayOrderPageExport', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
@@ -109,6 +257,36 @@
  });
}
/** 获取我的全部户号列表 POST /api/LifePay/GetUserAccountAllList */
export async function getUserAccountAllList(
  body: API.QueryUserAccountAllListInput,
  options?: API.RequestConfig
) {
  return request<API.UserAccountListOutput[]>('/api/LifePay/GetUserAccountAllList', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 获取我的户号列表 POST /api/LifePay/GetUserAccountList */
export async function getUserAccountList(
  body: API.QueryUserAccountListInput,
  options?: API.RequestConfig
) {
  return request<API.UserAccountListOutputPageOutput>('/api/LifePay/GetUserAccountList', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 获取我的订单分页数据 POST /api/LifePay/GetUserLifePayOrderPage */
export async function getUserLifePayOrderPage(
  body: API.QueryLifePayOrderListInput,
@@ -120,6 +298,21 @@
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 用户查看生活缴费退款失败详情 GET /api/LifePay/GetUserLifePayOrderRefund */
export async function getUserLifePayOrderRefund(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.APIgetUserLifePayOrderRefundParams,
  options?: API.RequestConfig
) {
  return request<API.UserLifePayOrderRefundOutput>('/api/LifePay/GetUserLifePayOrderRefund', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
@@ -151,6 +344,51 @@
  });
}
/** 用户发起生活缴费退款 POST /api/LifePay/RefundUserLifePayOrder */
export async function refundUserLifePayOrder(
  body: API.RefundUserLifePayOrderInput,
  options?: API.RequestConfig
) {
  return request<number>('/api/LifePay/RefundUserLifePayOrder', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 退款驳回 POST /api/LifePay/RejectRefundLifePayOrder */
export async function rejectRefundLifePayOrder(
  body: API.RefundLifePayOrderInput,
  options?: API.RequestConfig
) {
  return request<number>('/api/LifePay/RejectRefundLifePayOrder', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
/** 设置渠道启用状态 GET /api/LifePay/SetLifePayChannelsStatus */
export async function setLifePayChannelsStatus(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.APIsetLifePayChannelsStatusParams,
  options?: API.RequestConfig
) {
  return request<number>('/api/LifePay/SetLifePayChannelsStatus', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}
/** 设置生活缴费支付类型 POST /api/LifePay/SetLifePayOrderPayType */
export async function setLifePayOrderPayType(
  body: API.SetLifePayOrderPayTypeInput,
packages/services/api/typings.d.ts
@@ -517,6 +517,25 @@
    jobType?: string;
  }
  interface AddUpdateUserAccountInput {
    id?: string;
    /** 用户编号 */
    userId?: string;
    lifePayType?: LifePayOrderTypeEnum;
    /** 运营商 */
    operators: string;
    /** 手机号/户号 */
    content?: string;
    /** 省 */
    province?: string;
    /** 市 */
    city?: string;
    /** 拓展字段(电费类型) */
    extraProperties?: string;
    /** 备注 */
    remark?: string;
  }
  interface AddUserCertificationAuditDto {
    id?: string;
    auditNo?: string;
@@ -1126,6 +1145,10 @@
    id?: string;
  }
  interface APIdeleteUserAccountParams {
    id?: string;
  }
  interface APIdeleteUserParams {
    id?: string;
  }
@@ -1466,6 +1489,10 @@
    id?: string;
  }
  interface APIgetLifePayChannlesDtoParams {
    id?: string;
  }
  interface APIgetLifePayWxIndentityParams {
    /** 用户登录凭证 */
    code?: string;
@@ -1713,6 +1740,10 @@
    userId?: string;
  }
  interface APIgetUserLifePayOrderRefundParams {
    id?: string;
  }
  interface APIgetUserListByPhoneNumberParams {
    phoneNumber?: string;
    clientId?: string;
@@ -1866,6 +1897,11 @@
  interface APIsetForUserParams {
    userId?: string;
    permissionName?: string;
  }
  interface APIsetLifePayChannelsStatusParams {
    id?: string;
    status?: LifePayChannelsStatsEnum;
  }
  interface APIsetMessageIsReadParams {
@@ -3884,6 +3920,22 @@
    /** 跟进备注 */
    remark?: string;
    status?: CooperationApplyStatusEnum;
  }
  interface CreateEditPayChannelsInput {
    id?: string;
    channlesName?: string;
    channlesNum?: string;
    channlesRate?: number;
    switchType?: LifePaySwitchTypeEnum;
    status?: LifePayChannelsStatsEnum;
    channlesType?: LifePayChannlesTypeEnum;
  }
  interface CreateEditPayChannelsInputPageOutput {
    pageModel?: Pagination;
    objectData?: any;
    data?: CreateEditPayChannelsInput[];
  }
  interface CreateInformationAdvertiseInput {
@@ -6237,6 +6289,49 @@
    sign?: string;
    signType?: string;
    charset?: string;
  }
  interface GasOrgTypeValueResponse {
    success?: boolean;
    requestNo?: string;
    partnerId?: string;
    service?: string;
    version?: string;
    protocol?: string;
    context?: string;
    ext?: any;
    code?: string;
    message?: string;
    detail?: string;
    gasSupportMerchantInfos?: GasSupportMerchantInfos[];
  }
  interface GasParValueOutput {
    gasOrgName?: string;
    gasOrgCode?: string;
    parValue?: string[];
    rate?: number;
    comments?: string;
  }
  interface GasParValueResponse {
    success?: boolean;
    requestNo?: string;
    partnerId?: string;
    service?: string;
    version?: string;
    protocol?: string;
    context?: string;
    ext?: any;
    code?: string;
    message?: string;
    detail?: string;
    gasParValue?: GasParValueOutput;
  }
  interface GasSupportMerchantInfos {
    gasOrgTypeCode?: string;
    gasOrgTypeName?: string;
  }
  interface GeAlltCompanyUsersInput {
@@ -12220,8 +12315,34 @@
  interface LifeElectricDataCreateLifePayOrderInput {
    userId?: string;
    /** 渠道Id */
    channelId?: string;
    productData?: LifeElectricData;
  }
  interface LifeGasData {
    /** 充值面额,单位为元。 */
    parValue: number;
    /** 天然气公司类型,"zhong_ran"代表中燃燃气,"bei_jing"代表北京燃气。 */
    gasOrgType: string;
    /** 燃气户号 */
    gasAccount: string;
    /** 省份 */
    province: string;
    /** 城市 */
    city?: string;
  }
  interface LifeGasDataCreateLifePayOrderInput {
    userId?: string;
    /** 渠道Id */
    channelId?: string;
    productData?: LifeGasData;
  }
  type LifePayChannelsStatsEnum = 10 | 20;
  type LifePayChannlesTypeEnum = 10 | 20;
  interface LifePayOrderListOutput {
    id?: string;
@@ -12250,6 +12371,11 @@
    refundCredentialsImgUrl?: string;
    /** 下单时间 */
    creationTime?: string;
    /** 退款时间 */
    refundTime?: string;
    refundApplyRemark?: string;
    refundCheckRemark?: string;
    acoolyOrderNo?: string;
  }
  interface LifePayOrderListOutputPageOutput {
@@ -12258,23 +12384,32 @@
    data?: LifePayOrderListOutput[];
  }
  type LifePayOrderStatusEnum = 10 | 20 | 30;
  type LifePayOrderStatusEnum = 10 | 20 | 30 | 40 | 50 | 60;
  type LifePayOrderTypeEnum = 10 | 20;
  type LifePayOrderTypeEnum = 10 | 20 | 30;
  interface LifePayPhoneMesssageCodeLoginInput {
    /** 手机号 */
    phoneNumber: string;
  }
  interface LifePayRateInput {
    rateType?: LifePayRateTypeEnum;
    rate?: number;
    id?: string;
  }
  interface LifePayRateListOutput {
    rateType?: LifePayRateTypeEnum;
    rate?: number;
    id?: string;
  }
  type LifePayRateTypeEnum = 10 | 20;
  type LifePayRateTypeEnum = 10 | 20 | 30 | 40;
  type LifePayStatusEnum = 10 | 20 | 30 | 40;
  type LifePaySwitchTypeEnum = 10 | 20 | 30;
  type LifePayTypeEnum = 10 | 20;
@@ -12291,6 +12426,8 @@
  interface LifePhoneDataCreateLifePayOrderInput {
    userId?: string;
    /** 渠道Id */
    channelId?: string;
    productData?: LifePhoneData;
  }
@@ -16101,6 +16238,7 @@
  interface QueryLifePayOrderListInput {
    pageModel?: Pagination;
    lifePayOrderType?: LifePayOrderTypeEnum;
    lifePayType?: LifePayTypeEnum;
    /** 开始支付时间 */
    beginPayTime?: string;
    /** 结束支付时间 */
@@ -16113,6 +16251,8 @@
    endFinishTime?: string;
    /** 用户Id */
    userId?: string;
    /** 搜索关键词 */
    keyWords?: string;
  }
  interface QueryMatchMakingApplyByOrderInput {
@@ -16279,6 +16419,19 @@
    pageModel?: Pagination;
    applyUserId?: string;
    orderUserId?: string;
  }
  interface QueryUserAccountAllListInput {
    /** 用户Id */
    userId?: string;
    lifePayOrderType?: LifePayOrderTypeEnum;
  }
  interface QueryUserAccountListInput {
    pageModel?: Pagination;
    /** 用户Id */
    userId?: string;
    lifePayOrderType?: LifePayOrderTypeEnum;
  }
  interface QueryUserCertificationAuditListInput {
@@ -16777,6 +16930,7 @@
  interface RefundLifePayOrderInput {
    id?: string;
    refundCredentialsImgUrl?: string;
    refundCheckRemark?: string;
  }
  interface RefundOrderContactSignInput {
@@ -16786,6 +16940,13 @@
    userId?: string;
    /** 订单协议Id */
    orderSignId?: string;
  }
  interface RefundUserLifePayOrderInput {
    id?: string;
    /** 用户Id */
    userId?: string;
    refundApplyRemark?: string;
  }
  interface RegisterDto {
@@ -19387,6 +19548,32 @@
    staffCount?: number;
  }
  interface UserAccountListOutput {
    id?: string;
    lifePayType?: LifePayOrderTypeEnum;
    /** 运营商 */
    operators?: string;
    /** 手机号/户号 */
    content?: string;
    /** 省 */
    province?: string;
    /** 市 */
    city?: string;
    /** 拓展字段(电费类型) */
    extraProperties?: string;
    /** 备注 */
    remark?: string;
    /** 创建时间 */
    creationTime?: string;
    isDeleted?: boolean;
  }
  interface UserAccountListOutputPageOutput {
    pageModel?: Pagination;
    objectData?: any;
    data?: UserAccountListOutput[];
  }
  interface UserAttentionsDto {
    /** 产品关注数 */
    productCount?: number;
@@ -20285,6 +20472,12 @@
    creationTime?: string;
    /** 退款时间 */
    refundTime?: string;
    /** 退款凭证 */
    refundCredentialsImgUrl?: string;
    refundApplyRemark?: string;
    refundCheckRemark?: string;
    /** 渠道流水号 */
    acoolyOrderNo?: string;
  }
  interface UserLifePayOrderOutputPageOutput {
@@ -20293,6 +20486,18 @@
    data?: UserLifePayOrderOutput[];
  }
  interface UserLifePayOrderRefundOutput {
    /** 订单编号 */
    id?: string;
    /** 订单号 */
    orderNo?: string;
    /** 退款原因 */
    refundApplyRemark?: string;
    /** 后台填写的驳回原因 */
    refundCheckRemark?: string;
    lifePayOrderStatus?: LifePayOrderStatusEnum;
  }
  interface UserListOutput {
    id?: string;
    /** 用户手机号 */