fix: bug
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 7m11s

This commit is contained in:
sexygoat
2026-04-24 18:39:39 +08:00
parent 2d6b5d7903
commit 17c299e4ce
27 changed files with 500 additions and 481 deletions

View File

@@ -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>

View File

@@ -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)

View File

@@ -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')
}

View File

@@ -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>

View File

@@ -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,