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:
@@ -14,9 +14,6 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-row-g20">
|
||||
<view class="operator">
|
||||
<up-tag type="primary" size="mini" v-if="item.is_current">当前使用</up-tag>
|
||||
</view>
|
||||
<view class="operator">
|
||||
<up-tag :type="item.real_name_status === 1 ? 'primary' : 'success'" size="mini">{{ item.real_name_status === 1 ? '已实名' : '未实名' }}</up-tag>
|
||||
</view>
|
||||
@@ -25,7 +22,10 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn flex-row-g20 mt-30">
|
||||
<up-button class="btn-apple btn-success" v-if="!item.is_current" type="success" @tap="switchOperator(item)" :loading="switching">
|
||||
<up-button class="btn-apple btn-primary" v-if="item.is_current" type="primary" disabled>
|
||||
当前使用
|
||||
</up-button>
|
||||
<up-button class="btn-apple btn-success" v-else type="success" @tap="switchOperator(item)" :loading="switching">
|
||||
切换此运营商
|
||||
</up-button>
|
||||
</view>
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { deviceApi } from '@/api/index.js';
|
||||
import { assetApi, deviceApi } from '@/api/index.js';
|
||||
import { useUserStore } from '@/store/index.js';
|
||||
|
||||
const userStore = useUserStore();
|
||||
@@ -56,16 +56,34 @@
|
||||
|
||||
const loadCards = async () => {
|
||||
try {
|
||||
const data = await deviceApi.getCards(userStore.state.identifier);
|
||||
if (data.cards && data.cards.length > 0) {
|
||||
mchList.splice(0, mchList.length, ...data.cards.map(card => ({
|
||||
iccid: card.iccid,
|
||||
carrier_name: card.carrier_name,
|
||||
is_current: card.is_active,
|
||||
real_name_status: card.real_name_status,
|
||||
slot_position: card.slot_position,
|
||||
category: getCarrierCategory(card.carrier_name)
|
||||
})));
|
||||
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) {
|
||||
mchList.splice(0, mchList.length, ...data.cards.map(card => ({
|
||||
iccid: card.iccid,
|
||||
carrier_name: card.carrier_name,
|
||||
is_current: card.is_active,
|
||||
real_name_status: card.real_name_status,
|
||||
slot_position: card.slot_position,
|
||||
category: getCarrierCategory(card.carrier_name)
|
||||
})));
|
||||
}
|
||||
} else {
|
||||
// 不是设备(单卡),直接使用 asset info 数据,只有一个卡
|
||||
if (assetData.identifier) {
|
||||
mchList.splice(0, mchList.length, {
|
||||
iccid: assetData.identifier,
|
||||
carrier_name: assetData.carrier_name,
|
||||
is_current: true,
|
||||
real_name_status: assetData.real_name_status,
|
||||
slot_position: 1,
|
||||
category: getCarrierCategory(assetData.carrier_name)
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载卡列表失败', e);
|
||||
|
||||
Reference in New Issue
Block a user