| | |
| | | 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" |
| | |
| | | <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" |
| | |
| | | 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'; |
| | |
| | | |
| | | defineOptions({ |
| | | name: 'PhoneBillRecharge', |
| | | }); |
| | | |
| | | type Props = { |
| | | isDev?: boolean; |
| | | }; |
| | | |
| | | const props = withDefaults(defineProps<Props>(), { |
| | | isDev: false, |
| | | }); |
| | | |
| | | const form = reactive({ |
| | |
| | | }); |
| | | |
| | | 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) |
| | |
| | | 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 : '', |
| | | }, |