fix: 资产套餐历史,设备换货
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 47s
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { deviceApi, realnameApi } from '@/api/index.js';
|
||||
import { assetApi, deviceApi, realnameApi } from '@/api/index.js';
|
||||
import { useUserStore } from '@/store/index.js';
|
||||
|
||||
const userStore = useUserStore();
|
||||
@@ -55,13 +55,28 @@
|
||||
|
||||
const loadCards = async () => {
|
||||
try {
|
||||
const data = await deviceApi.getCards(userStore.state.identifier);
|
||||
if (data.cards && data.cards.length > 0) {
|
||||
list.splice(0, list.length, ...data.cards.map(card => ({
|
||||
iccid: card.iccid,
|
||||
category: getCarrierCategory(card.carrier_name),
|
||||
isRealName: card.real_name_status === 1
|
||||
})));
|
||||
const assetData = await assetApi.getInfo(userStore.state.identifier);
|
||||
|
||||
// 判断是否为设备
|
||||
if (assetData.asset_type === 'device') {
|
||||
// 是设备,调用设备卡列表接口
|
||||
const data = await deviceApi.getCards(userStore.state.identifier);
|
||||
if (data.cards && data.cards.length > 0) {
|
||||
list.splice(0, list.length, ...data.cards.map(card => ({
|
||||
iccid: card.iccid,
|
||||
category: getCarrierCategory(card.carrier_name),
|
||||
isRealName: card.real_name_status === 1
|
||||
})));
|
||||
}
|
||||
} else {
|
||||
// 不是设备(单卡),直接使用 asset info 数据
|
||||
if (assetData.identifier) {
|
||||
list.splice(0, list.length, {
|
||||
iccid: assetData.identifier,
|
||||
category: getCarrierCategory(assetData.carrier_name),
|
||||
isRealName: assetData.real_name_status === 1
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载卡列表失败', e);
|
||||
|
||||
Reference in New Issue
Block a user