This commit is contained in:
@@ -199,7 +199,7 @@
|
||||
{{ getRealnamePolicyName(scope.row.realname_policy) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="实名时间" width="180">
|
||||
<ElTableColumn label="实名时间" width="170">
|
||||
<template #default="scope">
|
||||
{{ scope.row.real_name_at ? formatDateTime(scope.row.real_name_at) : '-' }}
|
||||
</template>
|
||||
|
||||
@@ -36,10 +36,17 @@
|
||||
<div class="flow-stat-item">
|
||||
<span class="flow-stat-label">总量</span>
|
||||
<span class="flow-stat-value">
|
||||
{{ formatDataSize(currentPackage.data_limit_mb || currentPackage.package_total_data || 0) }}
|
||||
{{
|
||||
formatDataSize(
|
||||
currentPackage.data_limit_mb || currentPackage.package_total_data || 0
|
||||
)
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="isAdminOrPlatform && currentPackage.enable_virtual_data" class="flow-stat-item">
|
||||
<div
|
||||
v-if="isAdminOrPlatform && currentPackage.enable_virtual_data"
|
||||
class="flow-stat-item"
|
||||
>
|
||||
<span class="flow-stat-label">实际可用</span>
|
||||
<span class="flow-stat-value">
|
||||
{{ formatDataSize(currentPackage.virtual_limit_mb || 0) }}
|
||||
@@ -52,7 +59,8 @@
|
||||
formatDataSize(
|
||||
currentPackage.enable_virtual_data
|
||||
? currentPackage.virtual_remain_mb || 0
|
||||
: (currentPackage.data_limit_mb || currentPackage.package_total_data || 0) - (currentPackage.data_usage_mb || 0)
|
||||
: (currentPackage.data_limit_mb || currentPackage.package_total_data || 0) -
|
||||
(currentPackage.data_usage_mb || 0)
|
||||
)
|
||||
}}
|
||||
</span>
|
||||
@@ -62,13 +70,29 @@
|
||||
<ElProgress
|
||||
:percentage="
|
||||
currentPackage.enable_virtual_data
|
||||
? getUsageProgress(currentPackage.virtual_data_used || 0, currentPackage.virtual_data_total || 0)
|
||||
: getUsageProgress(currentPackage.real_data_used || 0, currentPackage.real_data_total || 0)
|
||||
? getUsageProgress(
|
||||
currentPackage.virtual_data_used || 0,
|
||||
currentPackage.virtual_data_total || 0
|
||||
)
|
||||
: getUsageProgress(
|
||||
currentPackage.real_data_used || 0,
|
||||
currentPackage.real_data_total || 0
|
||||
)
|
||||
"
|
||||
:color="
|
||||
currentPackage.enable_virtual_data
|
||||
? getProgressColorByPercentage(getUsageProgress(currentPackage.virtual_data_used || 0, currentPackage.virtual_data_total || 0))
|
||||
: getProgressColorByPercentage(getUsageProgress(currentPackage.real_data_used || 0, currentPackage.real_data_total || 0))
|
||||
? getProgressColorByPercentage(
|
||||
getUsageProgress(
|
||||
currentPackage.virtual_data_used || 0,
|
||||
currentPackage.virtual_data_total || 0
|
||||
)
|
||||
)
|
||||
: getProgressColorByPercentage(
|
||||
getUsageProgress(
|
||||
currentPackage.real_data_used || 0,
|
||||
currentPackage.real_data_total || 0
|
||||
)
|
||||
)
|
||||
"
|
||||
:stroke-width="14"
|
||||
/>
|
||||
@@ -89,7 +113,10 @@
|
||||
<ElDescriptionsItem label="套餐类型">
|
||||
{{ getPackageTypeName(currentPackage.package_type) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="isAdminOrPlatform && currentPackage.enable_virtual_data" label="虚流量比例">
|
||||
<ElDescriptionsItem
|
||||
v-if="isAdminOrPlatform && currentPackage.enable_virtual_data"
|
||||
label="虚流量比例"
|
||||
>
|
||||
{{ currentPackage.virtual_ratio || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="开始时间">
|
||||
@@ -98,7 +125,7 @@
|
||||
<ElDescriptionsItem label="到期时间">
|
||||
{{ formatDateTime(currentPackage.expire_time) || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="购买时间">
|
||||
<ElDescriptionsItem label="下单时间">
|
||||
{{ formatDateTime(currentPackage.created_at) || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="currentPackage.duration_days" label="套餐时长">
|
||||
@@ -128,12 +155,8 @@
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import type { PackageInfo } from '../types'
|
||||
|
||||
const {
|
||||
formatAmount,
|
||||
formatDataSize,
|
||||
getUsageProgress,
|
||||
getProgressColorByPercentage
|
||||
} = useAssetFormatters()
|
||||
const { formatAmount, formatDataSize, getUsageProgress, getProgressColorByPercentage } =
|
||||
useAssetFormatters()
|
||||
|
||||
const userStore = useUserStore()
|
||||
const { info: userInfo } = storeToRefs(userStore)
|
||||
|
||||
@@ -25,7 +25,19 @@
|
||||
</ElEmpty>
|
||||
<div v-else-if="packageList && packageList.length > 0" class="table-scroll-container">
|
||||
<ElTable :data="packageList" class="package-table" border>
|
||||
<ElTableColumn prop="order_no" label="订单号" width="180" show-overflow-tooltip />
|
||||
<ElTableColumn label="订单号" width="240">
|
||||
<template #default="scope">
|
||||
<ElButton
|
||||
type="primary"
|
||||
link
|
||||
@click="handleOrderNoClick(scope.row)"
|
||||
v-if="hasAuth('order:detail')"
|
||||
>
|
||||
{{ scope.row.order_no }}
|
||||
</ElButton>
|
||||
<span v-else>{{ scope.row.order_no }}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="套餐名称" width="150">
|
||||
<template #default="scope">
|
||||
<ElButton
|
||||
@@ -50,11 +62,6 @@
|
||||
</ElTag>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn prop="data_limit_mb" label="总流量" width="120">
|
||||
<template #default="scope">
|
||||
{{ formatDataSize(scope.row.data_limit_mb) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="流量" min-width="320">
|
||||
<template #default="scope">
|
||||
<div class="traffic-progress">
|
||||
@@ -108,12 +115,12 @@
|
||||
{{ formatDateTime(scope.row.expires_at) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn prop="created_at" label="购买时间" width="170" show-overflow-tooltip>
|
||||
<ElTableColumn prop="created_at" label="下单时间" width="170" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ formatDateTime(scope.row.created_at) }}
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="操作" width="100" fixed="right">
|
||||
<ElTableColumn label="操作" width="120" fixed="right">
|
||||
<template #default="scope">
|
||||
<ElButton
|
||||
v-if="scope.row.status !== 4 && hasAuth('package:create_refund')"
|
||||
@@ -123,6 +130,18 @@
|
||||
>
|
||||
退款申请
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="
|
||||
scope.row.status === 4 &&
|
||||
scope.row.refund_id &&
|
||||
hasAuth('refund:package_list_detail')
|
||||
"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleViewRefundDetail(scope.row)"
|
||||
>
|
||||
退款详情
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
</ElTable>
|
||||
@@ -217,6 +236,8 @@
|
||||
(e: 'page-change', page: number): void
|
||||
(e: 'size-change', size: number): void
|
||||
(e: 'navigateToDevice', deviceNo: string): void
|
||||
(e: 'navigateToOrder', orderId: number): void
|
||||
(e: 'navigateToRefund', refundId: number): void
|
||||
(e: 'refresh'): void
|
||||
}
|
||||
|
||||
@@ -262,6 +283,24 @@
|
||||
emit('showDailyRecords', { packageRow })
|
||||
}
|
||||
|
||||
// 点击订单号
|
||||
const handleOrderNoClick = (packageRow: PackageInfo) => {
|
||||
if (!hasAuth('order:package_list_detail')) {
|
||||
ElMessage.warning('您没有查看订单详情的权限')
|
||||
return
|
||||
}
|
||||
emit('navigateToOrder', packageRow.order_id!)
|
||||
}
|
||||
|
||||
// 查看退款详情
|
||||
const handleViewRefundDetail = (packageRow: PackageInfo) => {
|
||||
if (!hasAuth('refund:detail')) {
|
||||
ElMessage.warning('您没有查看退款详情的权限')
|
||||
return
|
||||
}
|
||||
emit('navigateToRefund', packageRow.refund_id!)
|
||||
}
|
||||
|
||||
const handleShowRecharge = () => {
|
||||
emit('showRecharge')
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" title="设置切卡模式" width="500px">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="120px">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="80px">
|
||||
<ElFormItem label="设备标识">
|
||||
<span style="font-weight: bold; color: #409eff">{{ deviceIdentifier }}</span>
|
||||
</ElFormItem>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" title="设置WiFi" width="500px" :append-to-body="true">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="120px">
|
||||
<ElDialog v-model="visible" title="设置WiFi" width="30%" :append-to-body="true">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="80px" autocomplete="off">
|
||||
<ElFormItem label="WiFi状态" prop="enabled">
|
||||
<ElRadioGroup v-model="form.enabled">
|
||||
<ElRadio :value="1">启用</ElRadio>
|
||||
@@ -15,6 +15,7 @@
|
||||
show-word-limit
|
||||
clearable
|
||||
autocomplete="off"
|
||||
name="wifi_ssid"
|
||||
/>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="WiFi密码" prop="password">
|
||||
@@ -27,6 +28,7 @@
|
||||
show-password
|
||||
clearable
|
||||
autocomplete="off"
|
||||
name="wifi_password"
|
||||
/>
|
||||
</ElFormItem>
|
||||
</ElForm>
|
||||
@@ -53,14 +55,33 @@
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
cardNo?: string // 流量卡号(ICCID)
|
||||
deviceIdentifier?: string // 设备标识(IMEI)
|
||||
wifiEnabled?: number // WiFi启用状态
|
||||
wifiSsid?: string // WiFi名称
|
||||
wifiPassword?: string // WiFi密码
|
||||
}
|
||||
|
||||
interface Emits {
|
||||
(e: 'update:modelValue', value: boolean): void
|
||||
(e: 'confirm', data: { card_no: string; enabled: number; ssid: string; password: string }): void
|
||||
(
|
||||
e: 'confirm',
|
||||
data: {
|
||||
deviceIdentifier?: string
|
||||
card_no: string
|
||||
enabled: number
|
||||
ssid: string
|
||||
password: string
|
||||
}
|
||||
): void
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
cardNo: '',
|
||||
deviceIdentifier: '',
|
||||
wifiEnabled: 1,
|
||||
wifiSsid: '',
|
||||
wifiPassword: ''
|
||||
})
|
||||
const emit = defineEmits<Emits>()
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
@@ -91,9 +112,9 @@
|
||||
// 监听对话框打开,重置表单
|
||||
watch(visible, (newVal) => {
|
||||
if (newVal) {
|
||||
form.enabled = 1
|
||||
form.ssid = ''
|
||||
form.password = ''
|
||||
form.enabled = props.wifiEnabled ?? 1
|
||||
form.ssid = props.wifiSsid ?? ''
|
||||
form.password = props.wifiPassword ?? ''
|
||||
}
|
||||
})
|
||||
|
||||
@@ -107,6 +128,7 @@
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
emit('confirm', {
|
||||
deviceIdentifier: props.deviceIdentifier,
|
||||
card_no: props.cardNo || '',
|
||||
enabled: form.enabled,
|
||||
ssid: form.ssid,
|
||||
|
||||
@@ -65,6 +65,8 @@
|
||||
@page-change="handlePackagePageChange"
|
||||
@size-change="handlePackageSizeChange"
|
||||
@navigate-to-device="handleNavigateToDevice"
|
||||
@navigate-to-order="handleNavigateToOrder"
|
||||
@navigate-to-refund="handleNavigateToRefund"
|
||||
@refresh="handlePackageRefresh"
|
||||
/>
|
||||
</div>
|
||||
@@ -106,6 +108,9 @@
|
||||
<WiFiConfigDialog
|
||||
v-model="setWiFiDialogVisible"
|
||||
:card-no="deviceRealtime?.current_iccid"
|
||||
:wifi-enabled="deviceRealtime?.wifi_enabled ? 1 : 0"
|
||||
:wifi-ssid="deviceRealtime?.ssid || ''"
|
||||
:wifi-password="deviceRealtime?.wifi_password || ''"
|
||||
@confirm="handleConfirmSetWiFi"
|
||||
/>
|
||||
<PackageRechargeDialog
|
||||
@@ -147,8 +152,9 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted, nextTick } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage, ElCard, ElEmpty } from 'element-plus'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
|
||||
// 引入子组件
|
||||
import AssetSearchCard from './components/AssetSearchCard.vue'
|
||||
@@ -179,6 +185,7 @@
|
||||
defineOptions({ name: 'SingleCard' })
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
// ========== 组件引用 ==========
|
||||
const assetSearchCardRef = ref<InstanceType<typeof AssetSearchCard>>()
|
||||
@@ -560,6 +567,20 @@
|
||||
await handleSearch({ identifier: deviceNo })
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到订单详情
|
||||
*/
|
||||
const handleNavigateToOrder = (orderId: number) => {
|
||||
router.push(`${RoutesAlias.OrderDetail}/${orderId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到退款详情
|
||||
*/
|
||||
const handleNavigateToRefund = (refundId: number) => {
|
||||
router.push(`${RoutesAlias.RefundDetail}/${refundId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* URL参数自动加载
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user