| | |
| | | name: 'PhoneBillRechargeStep1', |
| | | }); |
| | | |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | const form = reactive({ |
| | | ispCode: '', |
| | | phone: '', |
| | | ispCode: blLifeRecharge.getCarrierByPhoneNumber(blLifeRecharge.accountModel.phoneNumber), |
| | | phone: blLifeRecharge.accountModel.phoneNumber, |
| | | name: '', |
| | | remark: '', |
| | | }); |
| | |
| | | } |
| | | |
| | | const { addUpdateUserAccount } = useAddUpdateUserAccount(); |
| | | const { blLifeRecharge } = useLifeRechargeContext(); |
| | | |
| | | async function handleAddUpdateUserAccount() { |
| | | try { |
| | |
| | | filterParValueList(parValueList: string[]) { |
| | | return parValueList.filter((x) => Number(x) <= this.MaxParValue); |
| | | } |
| | | |
| | | getCarrierByPhoneNumber(phoneNumber: string): LifeRechargeConstants.IspCode { |
| | | // 定义号段和对应的运营商 |
| | | const carrierSegments = { |
| | | [LifeRechargeConstants.IspCode.yidong]: [ |
| | | '134', |
| | | '135', |
| | | '136', |
| | | '137', |
| | | '138', |
| | | '139', |
| | | '150', |
| | | '151', |
| | | '152', |
| | | '157', |
| | | '158', |
| | | '159', |
| | | '182', |
| | | '183', |
| | | '184', |
| | | '187', |
| | | '188', |
| | | '198', |
| | | '147', |
| | | '178', |
| | | '165', |
| | | ], |
| | | [LifeRechargeConstants.IspCode.liantong]: [ |
| | | '130', |
| | | '131', |
| | | '132', |
| | | '155', |
| | | '156', |
| | | '185', |
| | | '186', |
| | | '145', |
| | | '176', |
| | | '166', |
| | | ], |
| | | [LifeRechargeConstants.IspCode.dianxin]: [ |
| | | '133', |
| | | '153', |
| | | '180', |
| | | '181', |
| | | '189', |
| | | '177', |
| | | '199', |
| | | '191', |
| | | ], |
| | | }; |
| | | |
| | | // 检查手机号是否有效(这里只简单检查长度) |
| | | if (!/^\d{11}$/.test(phoneNumber)) { |
| | | return '' as any; |
| | | } |
| | | |
| | | let prefix = phoneNumber.substr(0, 3); |
| | | for (let carrier in carrierSegments) { |
| | | if (carrierSegments[carrier].includes(prefix)) { |
| | | return carrier as LifeRechargeConstants.IspCode; |
| | | } |
| | | } |
| | | |
| | | // 如果没有找到匹配的号段,则返回未知 |
| | | return '' as any; |
| | | } |
| | | } |