wupengfei
2025-02-24 dd7d743197d2cbb2aa0626a55d3a8cc20cce4295
packages/components/src/views/PhoneBillRecharge/PhoneBillRecharge.vue
@@ -7,7 +7,7 @@
    class="order-bill-recharge phone"
  >
    <FormItem label="选择运营商:" class="bole-form-item" prop="ispCode" required>
      <RadioGroup v-model="form.ispCode" direction="horizontal">
      <RadioGroup v-model="form.ispCode" direction="horizontal" @change="changeIspCode">
        <BlRadio
          :label="key"
          v-for="(val, key) in BlLifeRecharge.constants.IspCodeText"
@@ -41,7 +41,7 @@
    <FormItem label="选择充值金额" class="bole-form-item" prop="parValue" required>
      <RadioGroup v-model="form.parValue" direction="horizontal" class="parValue-radio-group">
        <Radio
          :label="item"
          :label="Number(item)"
          :key="item"
          shape="button"
          v-for="item in parValueList"
@@ -88,12 +88,13 @@
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { reactive, ref, computed } from 'vue';
import BlRadio from '../../components/Radio/Radio.vue';
import { FormValidator } from '../../utils';
import {
  useLifeRechargeContext,
  BlLifeRecharge,
  LifePhoneDataCreateLifePayOrderInput,
  FormValidator,
} from '../../utils';
  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';
@@ -101,6 +102,14 @@
defineOptions({
  name: 'PhoneBillRecharge',
});
type Props = {
  isDev?: boolean;
};
const props = withDefaults(defineProps<Props>(), {
  isDev: false,
});
const form = reactive({
@@ -111,22 +120,22 @@
});
const emit = defineEmits<{
  (
    e: 'goPay',
    // form: {
    //   ispCode: typeof BlLifeRecharge.constants.IspCode;
    //   phone: string;
    //   parValue: number;
    //   name: string;
    // }
    orderNo: string
  ): void;
  (e: 'goPay', orderNo: string): void;
}>();
const { lifePayPhoneRate } = useGetRate();
const { phoneParValueList } = useGetPhoneParValue();
const parValueList = [50, 100, 200];
const parValueList = computed(
  () => phoneParValueList.value.find((x) => x.ispCode === form.ispCode)?.parValue ?? []
);
function changeIspCode(val: LifeRechargeConstants.IspCode) {
  const phoneParValueItem = phoneParValueList.value.find((x) => x.ispCode === val);
  if (phoneParValueItem.parValue.every((x) => Number(x) !== form.parValue)) {
    form.parValue = 0;
  }
}
const realParValue = computed(() =>
  blLifeRecharge.getRechargeParValue(form.parValue, lifePayPhoneRate.value)
@@ -176,10 +185,10 @@
async function goPay() {
  try {
    let params: LifePhoneDataCreateLifePayOrderInput = {
      userId: blLifeRecharge.userId,
      userId: blLifeRecharge.accountModel.userId,
      productData: {
        ispCode: form.ispCode,
        parValue: 0.1,
        parValue: props.isDev ? 0.1 : form.parValue,
        phone: form.phone,
        name: form.ispCode === BlLifeRecharge.constants.IspCode.dianxin ? form.name : '',
      },