fix: 认证策略是先充值后实名, 首页入口
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m11s
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m11s
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { assetApi, deviceApi, realnameApi } from '@/api/index.js';
|
||||
import { assetApi, deviceApi, hasActiveOrPendingPackage, realnameApi } from '@/api/index.js';
|
||||
import { useUserStore } from '@/store/index.js';
|
||||
import slot1Icon from '@/static/卡槽1.png';
|
||||
import slot2Icon from '@/static/卡槽2.png';
|
||||
@@ -74,6 +74,7 @@
|
||||
let switching = ref(false);
|
||||
let showIccidModal = ref(false);
|
||||
let currentModalIccid = ref('');
|
||||
let realnameEntryChecking = ref(false);
|
||||
|
||||
const carrierMap = {
|
||||
CMCC: { name: '中国移动', logo: cmccLogo },
|
||||
@@ -126,6 +127,7 @@
|
||||
carrier_name: card.carrier_name,
|
||||
is_current: card.is_active,
|
||||
real_name_status: card.real_name_status,
|
||||
realname_policy: card.realname_policy,
|
||||
network_status: card.network_status,
|
||||
slot_position: card.slot_position
|
||||
}));
|
||||
@@ -176,11 +178,52 @@
|
||||
switching.value = false;
|
||||
};
|
||||
|
||||
const toReal = (card) => {
|
||||
currentModalIccid.value = card.iccid;
|
||||
const openRealnameModal = (iccid) => {
|
||||
currentModalIccid.value = iccid;
|
||||
showIccidModal.value = true;
|
||||
};
|
||||
|
||||
const toReal = async (card) => {
|
||||
if (realnameEntryChecking.value) return;
|
||||
if (card.realname_policy !== 'after_order') {
|
||||
openRealnameModal(card.iccid);
|
||||
return;
|
||||
}
|
||||
|
||||
realnameEntryChecking.value = true;
|
||||
uni.showLoading({ title: '校验中...', mask: true });
|
||||
try {
|
||||
const data = await deviceApi.getCards(userStore.state.identifier);
|
||||
const cards = Array.isArray(data?.cards) ? data.cards : [];
|
||||
const currentCard = cards.find(item => item.iccid === card.iccid) || card;
|
||||
const hasRealNamedCard = cards.some(item => Number(item?.real_name_status) === 1);
|
||||
|
||||
if (currentCard.realname_policy !== 'after_order' || hasRealNamedCard ||
|
||||
await hasActiveOrPendingPackage(userStore.state.identifier)) {
|
||||
uni.hideLoading();
|
||||
openRealnameModal(card.iccid);
|
||||
return;
|
||||
}
|
||||
|
||||
uni.hideLoading();
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '当前设备所有卡均未实名,且暂无生效中或待生效套餐。请先订购套餐,再进行实名认证。',
|
||||
confirmText: '去订购',
|
||||
cancelText: '取消',
|
||||
success: ({ confirm }) => {
|
||||
if (confirm) uni.navigateTo({ url: '/pages/package-order/package-order' });
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
console.error('校验切换运营商实名条件失败', error);
|
||||
uni.showToast({ title: '实名条件校验失败,请稍后重试', icon: 'none' });
|
||||
} finally {
|
||||
realnameEntryChecking.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const closeModal = () => {
|
||||
showIccidModal.value = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user