| | |
| | | {{ blLifeRecharge.getRechargeParValue(item, lifePayPhoneRate) }}元 |
| | | </div> |
| | | </div> |
| | | <div class="discountTag">{{ lifePayPhoneRate }}折</div> |
| | | <div class="discountTag" v-if="lifePayPhoneRate > 0">{{ lifePayPhoneRate }}折</div> |
| | | </div> |
| | | </NutRadio> |
| | | </NutRadioGroup> |
| | | </NutFormItem> |
| | | <SelectPayTypeFormItem |
| | | v-model="form.lifePayType" |
| | | :showWeixinPay="showWeixinPay" |
| | | :showAliPay="showAliPay" |
| | | ></SelectPayTypeFormItem> |
| | | <div class="common-content"> |
| | | <nut-button class="recharge-button" type="primary" @click="handleSubmit"> |
| | | <div class="recharge-button-inner"> |
| | |
| | | <div class="recharge-button-text">立即充值</div> |
| | | </div> |
| | | </nut-button> |
| | | <RechargeTipsView :tips="tips" /> |
| | | <RechargeTipsView :lifePayOrderType="LifeRechargeConstants.LifePayOrderTypeEnum.话费订单" /> |
| | | </div> |
| | | <ConfirmDialog v-model:visible="confirmDialogVisible" @ok="goPay"> |
| | | <template #info> |
| | |
| | | <ConfirmDialogInfoItem label="实付金额" :content="`¥${realParValue}`" danger /> |
| | | </template> |
| | | </ConfirmDialog> |
| | | <NutToast :msg="state.msg" v-model:visible="state.show" type="warn" cover /> |
| | | </NutForm> |
| | | </template> |
| | | |
| | |
| | | Radio as NutRadio, |
| | | Input as NutInput, |
| | | Button as NutButton, |
| | | Toast as NutToast, |
| | | } from '@nutui/nutui-taro'; |
| | | import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types'; |
| | | import { reactive, ref, computed, provide } from 'vue'; |
| | | import { FormValidator } from '../../utils'; |
| | | import { reactive, ref, computed, toRef } from 'vue'; |
| | | import { FormValidator, initLifePayType } from '../../utils'; |
| | | import { |
| | | useLifeRechargeContext, |
| | | BlLifeRecharge, |
| | |
| | | import ConfirmDialog from '../../components/Dialog/ConfirmDialog.vue'; |
| | | import ConfirmDialogInfoItem from '../../components/Dialog/ConfirmDialogInfoItem.vue'; |
| | | 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'; |
| | | import SelectPayTypeFormItem from '../../components/SelectPayTypeFormItem/SelectPayTypeFormItem.vue'; |
| | | import { useSelectPayType, useGetPayStatusByOrderNo } from '../../hooks/selectPayType'; |
| | | import { RechargeProps } from './types'; |
| | | |
| | | defineOptions({ |
| | | name: 'PhoneBillRechargeStep2', |
| | | }); |
| | | |
| | | type Props = { |
| | | isDev?: boolean; |
| | | }; |
| | | |
| | | const props = withDefaults(defineProps<Props>(), { |
| | | const props = withDefaults(defineProps<RechargeProps>(), { |
| | | isDev: false, |
| | | }); |
| | | |
| | |
| | | name: '', |
| | | currentUserAccountId: '', |
| | | remark: '', |
| | | lifePayType: initLifePayType(props.isInWeChat, props.isInAlipay), |
| | | }); |
| | | |
| | | const { userAccountAllList, handleUserAccountChange } = useSetUserAccountBySelect({ |
| | |
| | | |
| | | const emit = defineEmits<{ |
| | | (e: 'goPay', orderNo: string): void; |
| | | (e: 'paySuccess', orderNo: string): void; |
| | | (e: 'missName', userAccountId: string): void; |
| | | }>(); |
| | | |
| | | const { lifePayPhoneRate } = useGetRate(); |
| | |
| | | { required: true, message: '请选择充值金额', validator: FormValidator.validatorNumberNotNull }, |
| | | ], |
| | | currentUserAccountId: [{ required: true, message: '请选择充值手机号' }], |
| | | lifePayType: [{ required: true, message: '请选择支付方式' }], |
| | | }); |
| | | |
| | | const formRef = ref<any>(null); |
| | |
| | | if (!formRef.value) return; |
| | | formRef.value.validate().then(({ valid, errors }: any) => { |
| | | if (valid) { |
| | | if (!form.name) { |
| | | emit('missName', form.currentUserAccountId); |
| | | return; |
| | | } |
| | | recharge(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | const tips = [ |
| | | '平台提供慢充服务,订单提交后,话费将于0 - 24小时内到账。若未能按时到账,系统将自动发起退款。', |
| | | '充值期间,若同一号码款项未到账,请勿在其他平台重复充值;主副卡不可同时充值。因上述操作导致的资金损失,由用户自行承担。', |
| | | '本平台话费充值服务不适用于已停机号码。电信号码若有欠费,也无法完成充值。电信已完成维护的区域包括:广东、江苏、湖北、四川、江西、河北、河南、福建、辽宁。其它区域正在分批次进行维护中,在此期间可能会出现充值不成功并自动退款的情况,请您谅解。', |
| | | '如接到陌生来电,对方以缴费或误操作等理由要求处理款项,务必立即拉黑,谨防诈骗。', |
| | | '充值发票由运营商提供,您可登录网上营业厅下载电子发票。', |
| | | CustomerServiceTips, |
| | | ]; |
| | | |
| | | const confirmDialogVisible = ref(false); |
| | | |
| | | function recharge() { |
| | | confirmDialogVisible.value = true; |
| | | } |
| | | |
| | | const { state, invokeAliPay, invokeWeixinPay } = useSelectPayType({ |
| | | getOpenId: toRef(props, 'getOpenId'), |
| | | isInWeChat: toRef(props, 'isInWeChat'), |
| | | isH5: toRef(props, 'isH5'), |
| | | appId: toRef(props, 'appId'), |
| | | }); |
| | | |
| | | const currentOrderNo = ref(''); |
| | | |
| | | async function goPay() { |
| | | try { |
| | |
| | | channelId: blLifeRecharge.accountModel.channlesNum, |
| | | productData: { |
| | | ispCode: form.ispCode, |
| | | parValue: props.isDev ? 0.1 : form.parValue, |
| | | parValue: form.parValue, |
| | | phone: form.phone, |
| | | name: form.ispCode === BlLifeRecharge.constants.IspCode.dianxin ? form.name : '', |
| | | name: form.name, |
| | | }, |
| | | }; |
| | | let res = await blLifeRecharge.services.createLifePayPhoneOrder(params); |
| | | emit('goPay', res.orderNo); |
| | | // emit('goPay', res.orderNo); |
| | | if (form.lifePayType === LifeRechargeConstants.LifePayTypeEnum.WxPay) { |
| | | await invokeWeixinPay(res.orderNo); |
| | | } else { |
| | | await invokeAliPay(res.orderNo); |
| | | } |
| | | currentOrderNo.value = res.orderNo; |
| | | } catch (error) {} |
| | | } |
| | | |
| | | useGetPayStatusByOrderNo({ |
| | | orderNo: currentOrderNo, |
| | | enabled: computed( |
| | | () => |
| | | form.lifePayType === LifeRechargeConstants.LifePayTypeEnum.WxPay && |
| | | props.isFocus && |
| | | !!currentOrderNo.value |
| | | ), |
| | | onPaySuccess: (orderNo) => { |
| | | emit('paySuccess', orderNo); |
| | | currentOrderNo.value = ''; |
| | | }, |
| | | }); |
| | | </script> |