|
|
@ -137,6 +137,7 @@ |
|
|
|
|
|
|
|
|
<div class="business-panel account-panel" :class="{ active: tab === 'sim' }" style="padding:16px"> |
|
|
<div class="business-panel account-panel" :class="{ active: tab === 'sim' }" style="padding:16px"> |
|
|
<div class="communication-status-grid"><div><strong>{{ simTotal }}</strong><span>通信卡总数</span></div><div><strong>{{ activeSimCount }}</strong><span>正常</span></div><div><strong>{{ warnSimCount }}</strong><span>异常或未同步</span></div></div> |
|
|
<div class="communication-status-grid"><div><strong>{{ simTotal }}</strong><span>通信卡总数</span></div><div><strong>{{ activeSimCount }}</strong><span>正常</span></div><div><strong>{{ warnSimCount }}</strong><span>异常或未同步</span></div></div> |
|
|
|
|
|
<div class="account-card-actions"><t-button theme="primary" @click="openSimAdd">新增通信卡</t-button></div> |
|
|
<t-table row-key="id" :data="simCards" :columns="simColumns" empty="暂无通信卡"> |
|
|
<t-table row-key="id" :data="simCards" :columns="simColumns" empty="暂无通信卡"> |
|
|
<template #carrier="{ row }"><strong>{{ row.carrier || '--' }}</strong></template> |
|
|
<template #carrier="{ row }"><strong>{{ row.carrier || '--' }}</strong></template> |
|
|
<template #iccid="{ row }"><strong>{{ row.iccid || '--' }}</strong><small>{{ row.phone || '--' }}</small></template> |
|
|
<template #iccid="{ row }"><strong>{{ row.iccid || '--' }}</strong><small>{{ row.phone || '--' }}</small></template> |
|
|
@ -145,7 +146,13 @@ |
|
|
<template #status="{ row }"><span class="carrier-status" :class="simStatus(row).cls"><i></i>{{ simStatus(row).name }}</span></template> |
|
|
<template #status="{ row }"><span class="carrier-status" :class="simStatus(row).cls"><i></i>{{ simStatus(row).name }}</span></template> |
|
|
<template #lastSyncAt="{ row }">{{ fmtTime(row.lastSyncAt) }}</template> |
|
|
<template #lastSyncAt="{ row }">{{ fmtTime(row.lastSyncAt) }}</template> |
|
|
<template #actions="{ row }"> |
|
|
<template #actions="{ row }"> |
|
|
<t-button variant="text" theme="primary" @click="openSimRecharge(row)">充值</t-button> |
|
|
|
|
|
|
|
|
<t-button |
|
|
|
|
|
variant="text" |
|
|
|
|
|
theme="primary" |
|
|
|
|
|
:loading="syncingSimId === String(row.id)" |
|
|
|
|
|
@click="syncSimCard(row)" |
|
|
|
|
|
>同步</t-button> |
|
|
|
|
|
<t-button variant="text" theme="danger" @click="deleteSimCard(row)">删除</t-button> |
|
|
</template> |
|
|
</template> |
|
|
</t-table> |
|
|
</t-table> |
|
|
<div class="table-footer" v-if="simTotal"><t-pagination v-model:current="simPageNum" :total="simTotal" :page-size="10" @current-change="loadSim" /></div> |
|
|
<div class="table-footer" v-if="simTotal"><t-pagination v-model:current="simPageNum" :total="simTotal" :page-size="10" @current-change="loadSim" /></div> |
|
|
@ -180,7 +187,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
<div class="account-subsection-title"><h3>通信卡充值记录</h3><span>共 {{ simRechargeTotal }} 条</span></div> |
|
|
<div class="account-subsection-title"><h3>通信卡充值记录</h3><span>共 {{ simRechargeTotal }} 条</span></div> |
|
|
<t-table row-key="id" :data="simRechargeLogs" :columns="simRechargeColumns" empty="暂无通信卡充值记录"> |
|
|
<t-table row-key="id" :data="simRechargeLogs" :columns="simRechargeColumns" empty="暂无通信卡充值记录"> |
|
|
<template #simCardId="{ row }">{{ cardLabel(row.simCardId) }}</template> |
|
|
|
|
|
|
|
|
<template #simCardId="{ row }">{{ row.carrierSnapshot || '--' }} · {{ row.iccidSnapshot || row.simCardId || '--' }}</template> |
|
|
<template #amountGb="{ row }"><strong>{{ row.amountGb }} GB</strong></template> |
|
|
<template #amountGb="{ row }"><strong>{{ row.amountGb }} GB</strong></template> |
|
|
<template #totalPrice="{ row }"><strong>{{ money(row.totalPrice) }}</strong></template> |
|
|
<template #totalPrice="{ row }"><strong>{{ money(row.totalPrice) }}</strong></template> |
|
|
<template #payStatus="{ row }"><em>{{ payStatusName(row.payStatus || row.paymentStatus) }}</em></template> |
|
|
<template #payStatus="{ row }"><em>{{ payStatusName(row.payStatus || row.paymentStatus) }}</em></template> |
|
|
@ -266,6 +273,7 @@ |
|
|
<t-button theme="primary" @click="changePassword">确认修改</t-button> |
|
|
<t-button theme="primary" @click="changePassword">确认修改</t-button> |
|
|
</template> |
|
|
</template> |
|
|
</t-dialog> |
|
|
</t-dialog> |
|
|
|
|
|
<t-dialog v-model:visible="simAddOpen" header="新增通信卡" width="440px" destroy-on-close><label><span>ICCID<b>*</b></span><t-input v-model="simAddForm.iccid" placeholder="请输入通信卡 ICCID" /></label><label><span>绑定机巢</span><t-input v-model="simAddForm.dockId" placeholder="可选" /></label><template #footer><t-button variant="outline" @click="simAddOpen=false">取消</t-button><t-button theme="primary" @click="submitSimAdd">确认添加</t-button></template></t-dialog> |
|
|
<t-dialog |
|
|
<t-dialog |
|
|
v-model:visible="simRechargeOpen" |
|
|
v-model:visible="simRechargeOpen" |
|
|
header="通信卡充值" |
|
|
header="通信卡充值" |
|
|
@ -380,7 +388,9 @@ const usage = ref([]); const usageTotal = ref(0); const usagePages = ref(1); con |
|
|
const simCards = ref([]); const simTotal = ref(0); const simPages = ref(1); const simPageNum = ref(1) |
|
|
const simCards = ref([]); const simTotal = ref(0); const simPages = ref(1); const simPageNum = ref(1) |
|
|
const simRechargeLogs = ref([]); const simRechargeTotal = ref(0); const simRechargePages = ref(1); const simRechargePageNum = ref(1) |
|
|
const simRechargeLogs = ref([]); const simRechargeTotal = ref(0); const simRechargePages = ref(1); const simRechargePageNum = ref(1) |
|
|
const simPackages = ref([]) |
|
|
const simPackages = ref([]) |
|
|
const simRechargeOpen = ref(false) |
|
|
|
|
|
|
|
|
const syncingSimId = ref(null) |
|
|
|
|
|
const simAddOpen = ref(false) |
|
|
|
|
|
const simAddForm = ref({ iccid: '', dockId: '' }) |
|
|
const simRechargeCard = ref(null) |
|
|
const simRechargeCard = ref(null) |
|
|
const selectedSimPackageId = ref(0) |
|
|
const selectedSimPackageId = ref(0) |
|
|
const simRecharging = ref(false) |
|
|
const simRecharging = ref(false) |
|
|
@ -618,7 +628,40 @@ async function createInvoiceRequest() { try { await request.post(urls.INVOICE_RE |
|
|
|
|
|
|
|
|
async function loadOrders() { try { const page = await request.get(urls.TRAFFIC_ORDERS, { params: { pageNum: orderPageNum.value, pageSize: 10 } }); const meta = applyPage(orders, page); orderTotal.value = meta.total; orderPages.value = meta.pages } catch { orders.value = [] } } |
|
|
async function loadOrders() { try { const page = await request.get(urls.TRAFFIC_ORDERS, { params: { pageNum: orderPageNum.value, pageSize: 10 } }); const meta = applyPage(orders, page); orderTotal.value = meta.total; orderPages.value = meta.pages } catch { orders.value = [] } } |
|
|
async function loadUsage() { try { const page = await request.get(urls.TRAFFIC_USAGE, { params: { pageNum: usagePageNum.value, pageSize: 10 } }); const meta = applyPage(usage, page); usageTotal.value = meta.total; usagePages.value = meta.pages } catch { usage.value = [] } } |
|
|
async function loadUsage() { try { const page = await request.get(urls.TRAFFIC_USAGE, { params: { pageNum: usagePageNum.value, pageSize: 10 } }); const meta = applyPage(usage, page); usageTotal.value = meta.total; usagePages.value = meta.pages } catch { usage.value = [] } } |
|
|
async function loadSim() { const [cards, logs] = await Promise.all([request.get(urls.SIM_CARDS, { params: { pageNum: simPageNum.value, pageSize: 10 } }), request.get(urls.SIM_RECHARGE_LOGS, { params: { pageNum: simRechargePageNum.value, pageSize: 10 } })]); const cardMeta = applyPage(simCards, cards); const logMeta = applyPage(simRechargeLogs, logs); simTotal.value = cardMeta.total; simPages.value = cardMeta.pages; simRechargeTotal.value = logMeta.total; simRechargePages.value = logMeta.pages } |
|
|
|
|
|
|
|
|
async function syncSimCard(card) { |
|
|
|
|
|
if (!card?.id || syncingSimId.value) return |
|
|
|
|
|
syncingSimId.value = String(card.id) |
|
|
|
|
|
try { |
|
|
|
|
|
await request.get(urls.SIM_CARD(card.id), { params: { refresh: true } }) |
|
|
|
|
|
await loadSim() |
|
|
|
|
|
ui.toast('通信卡信息已同步') |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
// HTTP 拦截器已展示失败原因;保留状态以便用户重试。 |
|
|
|
|
|
} finally { |
|
|
|
|
|
syncingSimId.value = null |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function openSimAdd() { simAddForm.value = { iccid: '', dockId: '' }; simAddOpen.value = true } |
|
|
|
|
|
async function submitSimAdd() { |
|
|
|
|
|
if (!simAddForm.value.iccid.trim()) { ui.toast('请输入 ICCID'); return } |
|
|
|
|
|
try { await request.post(urls.SIM_CARD_CREATE, simAddForm.value); simAddOpen.value = false; await loadSim(); ui.toast('通信卡已添加') } catch {} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function deleteSimCard(card) { const ok = await ui.confirm('确认删除该通信卡?', '删除只移除通信卡主数据,充值订单、用量快照等历史记录会保留。'); if (!ok) return; try { await request.delete(urls.SIM_CARD(card.id)); await loadSim(); ui.toast('通信卡已删除') } catch {} } |
|
|
|
|
|
|
|
|
|
|
|
async function loadSim() { |
|
|
|
|
|
const [cards, logs] = await Promise.all([ |
|
|
|
|
|
request.get(urls.SIM_CARDS, { params: { pageNum: simPageNum.value, pageSize: 10 } }), |
|
|
|
|
|
request.get(urls.SIM_RECHARGE_LOGS, { params: { pageNum: simRechargePageNum.value, pageSize: 10 } }) |
|
|
|
|
|
]) |
|
|
|
|
|
const cardMeta = applyPage(simCards, cards) |
|
|
|
|
|
const logMeta = applyPage(simRechargeLogs, logs) |
|
|
|
|
|
simTotal.value = cardMeta.total |
|
|
|
|
|
simPages.value = cardMeta.pages |
|
|
|
|
|
simRechargeTotal.value = logMeta.total |
|
|
|
|
|
simRechargePages.value = logMeta.pages |
|
|
|
|
|
} |
|
|
async function loadDeviceCount() { try { await deviceStore.load(); deviceCount.value = deviceStore.docks.length + deviceStore.drones.length } catch { deviceLoadFailed.value = true } } |
|
|
async function loadDeviceCount() { try { await deviceStore.load(); deviceCount.value = deviceStore.docks.length + deviceStore.drones.length } catch { deviceLoadFailed.value = true } } |
|
|
async function loadTrafficPackages() { |
|
|
async function loadTrafficPackages() { |
|
|
try { |
|
|
try { |
|
|
|