Compare commits
7 Commits
984db9889c
...
iteration/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dec2b42f8 | ||
|
|
0d094a0537 | ||
|
|
c907d6e21f | ||
|
|
227dd63bb8 | ||
|
|
8fe65ca66d | ||
|
|
8b01169219 | ||
|
|
3411b66c71 |
@@ -110,3 +110,37 @@ test('退款后处理状态与权限码常量', () => {
|
|||||||
assert.equal(constants.labelOf(constants.TRAFFIC_DECISION_LABELS, 'new_value'), 'new_value')
|
assert.equal(constants.labelOf(constants.TRAFFIC_DECISION_LABELS, 'new_value'), 'new_value')
|
||||||
assert.equal(constants.labelOf(constants.TRAFFIC_DECISION_LABELS, ''), '-')
|
assert.equal(constants.labelOf(constants.TRAFFIC_DECISION_LABELS, ''), '-')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('卡 / 设备展示优先用 ICCID、设备号,没有时才显示内部 ID', () => {
|
||||||
|
assert.equal(
|
||||||
|
utils.assetDisplay({ iot_card_id: 367218, iccid: '89860624660030813727' }),
|
||||||
|
'89860624660030813727'
|
||||||
|
)
|
||||||
|
assert.equal(
|
||||||
|
utils.assetDisplay({
|
||||||
|
device_id: 49323,
|
||||||
|
device_virtual_no: '60003081372',
|
||||||
|
device_imei: '869555083099518'
|
||||||
|
}),
|
||||||
|
'60003081372(IMEI 869555083099518)'
|
||||||
|
)
|
||||||
|
assert.equal(
|
||||||
|
utils.assetDisplay({
|
||||||
|
device_id: 1,
|
||||||
|
device_virtual_no: '862639078983683',
|
||||||
|
device_imei: '862639078983683'
|
||||||
|
}),
|
||||||
|
'862639078983683'
|
||||||
|
)
|
||||||
|
assert.equal(
|
||||||
|
utils.assetDisplay({ device_id: 1, device_imei: '869555083099518' }),
|
||||||
|
'869555083099518'
|
||||||
|
)
|
||||||
|
assert.equal(utils.assetDisplay({ iot_card_id: 367218 }), '卡ID 367218')
|
||||||
|
assert.equal(utils.assetDisplay({ device_id: 49323 }), '设备ID 49323')
|
||||||
|
assert.equal(utils.assetDisplay({}), '-')
|
||||||
|
assert.equal(utils.nameOrId('移动账户A', 3), '移动账户A')
|
||||||
|
assert.equal(utils.nameOrId('', 3), 'ID 3')
|
||||||
|
assert.equal(utils.nameOrId('', 7, '账号ID'), '账号ID 7')
|
||||||
|
assert.equal(utils.nameOrId(undefined, 0), '-')
|
||||||
|
})
|
||||||
|
|||||||
@@ -58,6 +58,13 @@ export class PackageSilenceService extends BaseService {
|
|||||||
static order(id: number): Promise<BaseResponse<SilenceExtensionOrderResponse>> {
|
static order(id: number): Promise<BaseResponse<SilenceExtensionOrderResponse>> {
|
||||||
return this.get(`${root}/orders/${id}`, undefined, quiet)
|
return this.get(`${root}/orders/${id}`, undefined, quiet)
|
||||||
}
|
}
|
||||||
|
/** 作废待支付延期订单(作废前后端先查单,已支付则按支付成功办理并拒绝作废) */
|
||||||
|
static closeOrder(
|
||||||
|
id: number,
|
||||||
|
reason?: string
|
||||||
|
): Promise<BaseResponse<SilenceExtensionOrderResponse>> {
|
||||||
|
return this.post(`${root}/orders/${id}/close`, { reason }, quiet)
|
||||||
|
}
|
||||||
static batches(params: SilenceBatchQuery): Promise<BaseResponse<SilenceBatchPageResult>> {
|
static batches(params: SilenceBatchQuery): Promise<BaseResponse<SilenceBatchPageResult>> {
|
||||||
return this.get(`${root}/batches`, params, quiet)
|
return this.get(`${root}/batches`, params, quiet)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,10 @@
|
|||||||
>支付截止:{{ data.expire_at ? formatDateTime(data.expire_at) : '-' }}</p
|
>支付截止:{{ data.expire_at ? formatDateTime(data.expire_at) : '-' }}</p
|
||||||
></div
|
></div
|
||||||
>
|
>
|
||||||
|
<div v-if="canCloseOrder" class="silence-order-actions">
|
||||||
|
<ElButton type="danger" plain :loading="handling" @click="closeOrder">作废订单</ElButton>
|
||||||
|
<span class="silence-order-tip">作废后同一套餐可以重新下单;已支付的订单不能作废。</span>
|
||||||
|
</div>
|
||||||
<ElAlert
|
<ElAlert
|
||||||
v-if="kind === 'orders' && data.status === 'pending_approval'"
|
v-if="kind === 'orders' && data.status === 'pending_approval'"
|
||||||
title="审批中,尚未生效。请以订单完成状态及实际截止日为准。"
|
title="审批中,尚未生效。请以订单完成状态及实际截止日为准。"
|
||||||
@@ -209,6 +213,47 @@
|
|||||||
void load()
|
void load()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
// 作废待支付订单:需要发起延期的权限(与生成二维码相同)
|
||||||
|
const canCloseOrder = computed(
|
||||||
|
() =>
|
||||||
|
props.kind === 'orders' &&
|
||||||
|
data.value?.status === 'pending_payment' &&
|
||||||
|
data.value?.payment_method !== 'offline' &&
|
||||||
|
allowed.value &&
|
||||||
|
hasAuth(P.extend)
|
||||||
|
)
|
||||||
|
async function closeOrder() {
|
||||||
|
if (handling.value || !data.value) return
|
||||||
|
const scope = pollingScope(user),
|
||||||
|
path = route.fullPath,
|
||||||
|
id = silenceId(Number(data.value.id))
|
||||||
|
handling.value = true
|
||||||
|
try {
|
||||||
|
requireGatewayAccess(canCloseOrder.value)
|
||||||
|
const { value } = await ElMessageBox.prompt(
|
||||||
|
'作废后该订单不能再支付,同一套餐可以重新下单。作废前会先向支付渠道确认,已支付的会按支付成功办理延期。可填写作废原因(选填)。',
|
||||||
|
'作废延期订单',
|
||||||
|
{
|
||||||
|
type: 'warning',
|
||||||
|
confirmButtonText: '确认作废',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
inputPlaceholder: '作废原因(选填)'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
requireGatewayAccess(
|
||||||
|
active && canCloseOrder.value && scope === pollingScope(user) && path === route.fullPath
|
||||||
|
)
|
||||||
|
silenceData(await Service.closeOrder(id, value?.trim() || undefined))
|
||||||
|
if (active && scope === pollingScope(user) && path === route.fullPath) await load()
|
||||||
|
} catch (e) {
|
||||||
|
if (active && e !== 'cancel' && e !== 'close') {
|
||||||
|
actionError.value = gatewayError(e)
|
||||||
|
await load()
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
handling.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
async function handle(row: Record<string, any>, action: 'retry' | 'close') {
|
async function handle(row: Record<string, any>, action: 'retry' | 'close') {
|
||||||
if (handling.value) return
|
if (handling.value) return
|
||||||
const scope = pollingScope(user),
|
const scope = pollingScope(user),
|
||||||
@@ -281,4 +326,16 @@
|
|||||||
margin: 4px;
|
margin: 4px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.silence-order-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
margin: 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.silence-order-tip {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<ElDialog
|
<ElDialog
|
||||||
:model-value="true"
|
:model-value="true"
|
||||||
|
append-to-body
|
||||||
title="办理沉默期延期"
|
title="办理沉默期延期"
|
||||||
width="min(760px, 96vw)"
|
width="min(760px, 96vw)"
|
||||||
destroy-on-close
|
destroy-on-close
|
||||||
@@ -31,13 +32,43 @@
|
|||||||
value="special"
|
value="special"
|
||||||
label="特殊延期" /></ElSelect
|
label="特殊延期" /></ElSelect
|
||||||
></ElFormItem>
|
></ElFormItem>
|
||||||
|
<ElFormItem v-if="mode === 'offline'" label="收款凭证" required
|
||||||
|
><div class="silence-receipt"
|
||||||
|
><VoucherUpload
|
||||||
|
v-model="vouchers"
|
||||||
|
key="vouchers-offline"
|
||||||
|
:max-count="5"
|
||||||
|
@uploading-change="(value) => (uploadingReceipt = value)"
|
||||||
|
/><p class="silence-ocr-tip"
|
||||||
|
>先上传收款凭证,系统会自动识别交易单号,可在下方核对修改。</p
|
||||||
|
></div
|
||||||
|
></ElFormItem
|
||||||
|
>
|
||||||
<template v-if="usageId">
|
<template v-if="usageId">
|
||||||
<ElFormItem label="套餐记录"
|
<ElFormItem label="套餐"
|
||||||
>{{ usageId }}
|
>{{ packageLabel }}
|
||||||
<ElButton link :loading="eligibilityLoading" @click="loadEligibility"
|
<ElButton link :loading="eligibilityLoading" @click="loadEligibility"
|
||||||
>刷新资格</ElButton
|
>刷新资格</ElButton
|
||||||
></ElFormItem
|
></ElFormItem
|
||||||
>
|
>
|
||||||
|
<ElFormItem v-if="eligibility" label="订购时间">{{
|
||||||
|
eligibility.purchased_at ? formatDateTime(eligibility.purchased_at) : '-'
|
||||||
|
}}</ElFormItem>
|
||||||
|
<ElFormItem v-if="eligibility" label="到期时间">{{
|
||||||
|
eligibility.expires_at
|
||||||
|
? formatDateTime(eligibility.expires_at)
|
||||||
|
: '未生效(实名激活后开始计算)'
|
||||||
|
}}</ElFormItem>
|
||||||
|
<ElFormItem v-if="eligibility" label="沉默期截止"
|
||||||
|
><span class="silence-deadline">{{
|
||||||
|
eligibility.silence_deadline_at
|
||||||
|
? formatDateTime(eligibility.silence_deadline_at)
|
||||||
|
: eligibility.original_deadline || '-'
|
||||||
|
}}</span
|
||||||
|
><span v-if="eligibility.overdue_days" class="silence-overdue"
|
||||||
|
>(已过期 {{ eligibility.overdue_days }} 天)</span
|
||||||
|
></ElFormItem
|
||||||
|
>
|
||||||
<ElFormItem v-if="eligibility" label="延期资格"
|
<ElFormItem v-if="eligibility" label="延期资格"
|
||||||
><span
|
><span
|
||||||
>{{
|
>{{
|
||||||
@@ -110,7 +141,15 @@
|
|||||||
:value="item.id"
|
:value="item.id"
|
||||||
:label="item.name" /></ElSelect
|
:label="item.name" /></ElSelect
|
||||||
></ElFormItem>
|
></ElFormItem>
|
||||||
<ElFormItem label="交易单号" required><ElInput v-model="tradeNo" /></ElFormItem>
|
<ElFormItem label="交易单号" required
|
||||||
|
><ElInput
|
||||||
|
v-model="tradeNo"
|
||||||
|
:placeholder="ocrLoading ? '正在识别凭证中的交易单号…' : '请输入或核对交易单号'"
|
||||||
|
@input="tradeNoTouched = true"
|
||||||
|
/><span v-if="ocrMessage" :class="['silence-ocr-tip', ocrTone]">{{
|
||||||
|
ocrMessage
|
||||||
|
}}</span></ElFormItem
|
||||||
|
>
|
||||||
<ElFormItem v-if="mode === 'offline'" label="实收金额(元)" required
|
<ElFormItem v-if="mode === 'offline'" label="实收金额(元)" required
|
||||||
><ElInput v-model="paidYuan" inputmode="decimal"
|
><ElInput v-model="paidYuan" inputmode="decimal"
|
||||||
/></ElFormItem>
|
/></ElFormItem>
|
||||||
@@ -121,7 +160,7 @@
|
|||||||
value-format="YYYY-MM-DDTHH:mm:ssZ"
|
value-format="YYYY-MM-DDTHH:mm:ssZ"
|
||||||
format="YYYY-MM-DD HH:mm:ss"
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
/></ElFormItem>
|
/></ElFormItem>
|
||||||
<ElFormItem label="收款凭证" required
|
<ElFormItem v-if="mode !== 'offline'" label="收款凭证" required
|
||||||
><VoucherUpload
|
><VoucherUpload
|
||||||
v-model="vouchers"
|
v-model="vouchers"
|
||||||
:key="`vouchers-${mode}`"
|
:key="`vouchers-${mode}`"
|
||||||
@@ -183,6 +222,7 @@
|
|||||||
import QrcodeVue from 'qrcode.vue'
|
import QrcodeVue from 'qrcode.vue'
|
||||||
import { PackageSilenceService as Service } from '@/api/modules/packageSilence'
|
import { PackageSilenceService as Service } from '@/api/modules/packageSilence'
|
||||||
import { EmployeeCollectionService } from '@/api/modules/employeeCollection'
|
import { EmployeeCollectionService } from '@/api/modules/employeeCollection'
|
||||||
|
import { AgentRechargeService } from '@/api/modules/agentRecharge'
|
||||||
import { useAuth } from '@/composables/useAuth'
|
import { useAuth } from '@/composables/useAuth'
|
||||||
import { useUserStore } from '@/store/modules/user'
|
import { useUserStore } from '@/store/modules/user'
|
||||||
import { useSchedulerRequest } from '@/composables/useSchedulerRequest'
|
import { useSchedulerRequest } from '@/composables/useSchedulerRequest'
|
||||||
@@ -209,8 +249,25 @@
|
|||||||
} from '@/types/api/packageSilenceContract'
|
} from '@/types/api/packageSilenceContract'
|
||||||
import VoucherUpload from '@/components/business/VoucherUpload.vue'
|
import VoucherUpload from '@/components/business/VoucherUpload.vue'
|
||||||
import SilenceTable from './SilenceTable.vue'
|
import SilenceTable from './SilenceTable.vue'
|
||||||
const props = defineProps<{ usageId?: number; allowed?: boolean; batchMode?: boolean }>()
|
// allowed 未传时视为允许:Vue 会把未传的布尔 prop 当成 false,不设默认值时资产详情入口一律报"无权执行此操作"
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
usageId?: number
|
||||||
|
allowed?: boolean
|
||||||
|
batchMode?: boolean
|
||||||
|
packageName?: string
|
||||||
|
assetIdentifier?: string
|
||||||
|
}>(),
|
||||||
|
{ allowed: true, batchMode: false }
|
||||||
|
)
|
||||||
const emit = defineEmits<{ close: []; changed: [] }>()
|
const emit = defineEmits<{ close: []; changed: [] }>()
|
||||||
|
// 展示套餐名称(及资产),不展示内部套餐记录 ID;调用方未传名称时才退回显示 ID
|
||||||
|
const packageLabel = computed(() => {
|
||||||
|
const name = eligibility.value?.package_name?.trim() || props.packageName?.trim()
|
||||||
|
const asset = eligibility.value?.asset_identifier || props.assetIdentifier
|
||||||
|
if (!name) return props.usageId ? `套餐记录 ${props.usageId}` : '-'
|
||||||
|
return asset ? `${name}(${asset})` : name
|
||||||
|
})
|
||||||
const { hasAuth } = useAuth(),
|
const { hasAuth } = useAuth(),
|
||||||
user = useUserStore()
|
user = useUserStore()
|
||||||
const mode = ref<'online' | 'offline' | 'special'>(
|
const mode = ref<'online' | 'offline' | 'special'>(
|
||||||
@@ -288,6 +345,62 @@
|
|||||||
quote.value.forUsage === props.usageId &&
|
quote.value.forUsage === props.usageId &&
|
||||||
Number.isSafeInteger(quote.value.amount))
|
Number.isSafeInteger(quote.value.amount))
|
||||||
)
|
)
|
||||||
|
// 线下登记:上传第一张收款凭证后自动识别交易单号(复用代理充值的凭证识别,只预填、需人工核对)
|
||||||
|
const ocrLoading = ref(false),
|
||||||
|
ocrMessage = ref(''),
|
||||||
|
ocrTone = ref<'info' | 'success' | 'warning'>('info'),
|
||||||
|
tradeNoTouched = ref(false)
|
||||||
|
let ocrSequence = 0,
|
||||||
|
ocrKey = ''
|
||||||
|
async function recognizeTradeNo(key: string) {
|
||||||
|
if (!key || key === ocrKey) return
|
||||||
|
ocrKey = key
|
||||||
|
const current = ++ocrSequence
|
||||||
|
ocrLoading.value = true
|
||||||
|
ocrTone.value = 'info'
|
||||||
|
ocrMessage.value = '正在识别交易单号…'
|
||||||
|
try {
|
||||||
|
const res = await AgentRechargeService.recognizePaymentVoucher({ payment_voucher_key: key })
|
||||||
|
if (current !== ocrSequence) return
|
||||||
|
const transactionNo = res.code === 0 ? res.data?.external_transaction_no?.trim() : ''
|
||||||
|
if (!transactionNo) {
|
||||||
|
ocrTone.value = 'warning'
|
||||||
|
ocrMessage.value = '未识别到交易单号,请手动填写'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!tradeNoTouched.value || !tradeNo.value.trim()) {
|
||||||
|
tradeNo.value = transactionNo
|
||||||
|
tradeNoTouched.value = false
|
||||||
|
}
|
||||||
|
ocrTone.value = 'success'
|
||||||
|
ocrMessage.value = `已识别交易单号 ${transactionNo},请对照凭证核对`
|
||||||
|
} catch {
|
||||||
|
if (current !== ocrSequence) return
|
||||||
|
ocrTone.value = 'warning'
|
||||||
|
ocrMessage.value = '识别失败,请手动填写交易单号'
|
||||||
|
} finally {
|
||||||
|
if (current === ocrSequence) ocrLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
() => [mode.value, vouchers.value[0]] as const,
|
||||||
|
([currentMode, firstKey]) => {
|
||||||
|
if (currentMode === 'offline' && firstKey) void recognizeTradeNo(firstKey)
|
||||||
|
if (!firstKey) {
|
||||||
|
ocrKey = ''
|
||||||
|
ocrMessage.value = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
// 线下登记的实收金额必须等于试算金额:试算后自动带入,仍可修改
|
||||||
|
watch(
|
||||||
|
() => quote.value?.amount,
|
||||||
|
(amount) => {
|
||||||
|
if (mode.value === 'offline' && Number.isSafeInteger(amount) && !paidYuan.value) {
|
||||||
|
paidYuan.value = (Number(amount) / 100).toFixed(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
let active = true,
|
let active = true,
|
||||||
version = 0,
|
version = 0,
|
||||||
timer: ReturnType<typeof setTimeout> | undefined
|
timer: ReturnType<typeof setTimeout> | undefined
|
||||||
@@ -314,6 +427,11 @@
|
|||||||
basis.value = ''
|
basis.value = ''
|
||||||
methodId.value = undefined
|
methodId.value = undefined
|
||||||
tradeNo.value = ''
|
tradeNo.value = ''
|
||||||
|
tradeNoTouched.value = false
|
||||||
|
ocrSequence++
|
||||||
|
ocrKey = ''
|
||||||
|
ocrLoading.value = false
|
||||||
|
ocrMessage.value = ''
|
||||||
paidYuan.value = ''
|
paidYuan.value = ''
|
||||||
paidAt.value = ''
|
paidAt.value = ''
|
||||||
batchItems.value = []
|
batchItems.value = []
|
||||||
@@ -592,4 +710,28 @@
|
|||||||
margin-left: 0 !important;
|
margin-left: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.silence-receipt {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.silence-ocr-tip {
|
||||||
|
margin: 4px 0 0;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
color: var(--el-color-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.warning {
|
||||||
|
color: var(--el-color-warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.silence-overdue {
|
||||||
|
margin-left: 4px;
|
||||||
|
color: var(--el-color-danger);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
v-if="row.silence.extendable && (hasAuth(P.extend) || hasAuth(P.offline))"
|
v-if="row.silence.extendable && (hasAuth(P.extend) || hasAuth(P.offline))"
|
||||||
link
|
link
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="extendId = row.package_usage_id"
|
@click="openExtension(row)"
|
||||||
>延期</ElButton
|
>延期</ElButton
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
@@ -140,6 +140,8 @@
|
|||||||
<SilenceExtendDialog
|
<SilenceExtendDialog
|
||||||
v-if="extendId || batchVisible"
|
v-if="extendId || batchVisible"
|
||||||
:usage-id="extendId"
|
:usage-id="extendId"
|
||||||
|
:package-name="extendRow?.package_name"
|
||||||
|
:asset-identifier="extendRow?.asset_identifier"
|
||||||
:batch-mode="batchVisible"
|
:batch-mode="batchVisible"
|
||||||
:allowed="allowed"
|
:allowed="allowed"
|
||||||
@close="closeExtension"
|
@close="closeExtension"
|
||||||
@@ -232,6 +234,7 @@
|
|||||||
changing = ref(false)
|
changing = ref(false)
|
||||||
const recordsId = ref<number>(),
|
const recordsId = ref<number>(),
|
||||||
extendId = ref<number>(),
|
extendId = ref<number>(),
|
||||||
|
extendRow = ref<Record<string, any>>(),
|
||||||
batchVisible = ref(false),
|
batchVisible = ref(false),
|
||||||
policyVisible = ref(false),
|
policyVisible = ref(false),
|
||||||
policyId = ref<number>(),
|
policyId = ref<number>(),
|
||||||
@@ -533,6 +536,10 @@
|
|||||||
actionError.value = gatewayError(e)
|
actionError.value = gatewayError(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function openExtension(row: Record<string, any>) {
|
||||||
|
extendRow.value = row
|
||||||
|
extendId.value = row.package_usage_id
|
||||||
|
}
|
||||||
async function matchPolicy() {
|
async function matchPolicy() {
|
||||||
if (!canManagePolicy.value || !matchPackage.value || matching.value) return
|
if (!canManagePolicy.value || !matchPackage.value || matching.value) return
|
||||||
const scope = pollingScope(user),
|
const scope = pollingScope(user),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<ElDialog
|
<ElDialog
|
||||||
|
append-to-body
|
||||||
:model-value="true"
|
:model-value="true"
|
||||||
:title="id ? '编辑延期政策' : '新增延期政策'"
|
:title="id ? '编辑延期政策' : '新增延期政策'"
|
||||||
width="min(780px, 96vw)"
|
width="min(780px, 96vw)"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<ElDialog
|
<ElDialog
|
||||||
:model-value="true"
|
:model-value="true"
|
||||||
|
append-to-body
|
||||||
:title="firstPurchase ? '首次购买套餐记录' : '沉默期流水'"
|
:title="firstPurchase ? '首次购买套餐记录' : '沉默期流水'"
|
||||||
width="min(1100px, 96vw)"
|
width="min(1100px, 96vw)"
|
||||||
destroy-on-close
|
destroy-on-close
|
||||||
@@ -16,12 +17,16 @@
|
|||||||
import { useSchedulerRequest } from '@/composables/useSchedulerRequest'
|
import { useSchedulerRequest } from '@/composables/useSchedulerRequest'
|
||||||
import { silenceData, silenceId } from '@/utils/business/silenceExtension'
|
import { silenceData, silenceId } from '@/utils/business/silenceExtension'
|
||||||
import SilenceTable from './SilenceTable.vue'
|
import SilenceTable from './SilenceTable.vue'
|
||||||
const props = defineProps<{
|
// allowed 未传时视为允许(Vue 会把未传的布尔 prop 当成 false)
|
||||||
usageId?: number
|
const props = withDefaults(
|
||||||
assetId?: number
|
defineProps<{
|
||||||
assetType?: 'card' | 'device'
|
usageId?: number
|
||||||
allowed?: boolean
|
assetId?: number
|
||||||
}>()
|
assetType?: 'card' | 'device'
|
||||||
|
allowed?: boolean
|
||||||
|
}>(),
|
||||||
|
{ allowed: true }
|
||||||
|
)
|
||||||
defineEmits<{ close: [] }>()
|
defineEmits<{ close: [] }>()
|
||||||
const firstPurchase = computed(() => !!props.assetType)
|
const firstPurchase = computed(() => !!props.assetType)
|
||||||
const { data, error, loading, load } = useSchedulerRequest<object[]>(
|
const { data, error, loading, load } = useSchedulerRequest<object[]>(
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
<SilenceExtendDialog
|
<SilenceExtendDialog
|
||||||
v-if="extendVisible && usageId"
|
v-if="extendVisible && usageId"
|
||||||
:usage-id="usageId"
|
:usage-id="usageId"
|
||||||
|
:package-name="packageName"
|
||||||
|
:asset-identifier="assetIdentifier"
|
||||||
@close="closeExtension"
|
@close="closeExtension"
|
||||||
@changed="dirty = true"
|
@changed="dirty = true"
|
||||||
/>
|
/>
|
||||||
@@ -56,7 +58,12 @@
|
|||||||
import type { PackageSilenceInfo } from '@/types/api/packageSilence'
|
import type { PackageSilenceInfo } from '@/types/api/packageSilence'
|
||||||
import { silenceStatusLabel } from '@/utils/business/packageSilence'
|
import { silenceStatusLabel } from '@/utils/business/packageSilence'
|
||||||
import { formatDateTime } from '@/utils/business/format'
|
import { formatDateTime } from '@/utils/business/format'
|
||||||
const props = defineProps<{ silence?: PackageSilenceInfo | null; usageId?: number }>()
|
const props = defineProps<{
|
||||||
|
silence?: PackageSilenceInfo | null
|
||||||
|
usageId?: number
|
||||||
|
packageName?: string
|
||||||
|
assetIdentifier?: string
|
||||||
|
}>()
|
||||||
const emit = defineEmits<{ changed: [] }>()
|
const emit = defineEmits<{ changed: [] }>()
|
||||||
const { hasAuth } = useAuth()
|
const { hasAuth } = useAuth()
|
||||||
const recordsVisible = ref(false),
|
const recordsVisible = ref(false),
|
||||||
|
|||||||
@@ -20,10 +20,12 @@
|
|||||||
>
|
>
|
||||||
<ElTable v-loading="loading" :data="rows" row-key="id" border empty-text="暂无卡日流量">
|
<ElTable v-loading="loading" :data="rows" row-key="id" border empty-text="暂无卡日流量">
|
||||||
<ElTableColumn label="日期" prop="date" width="120" />
|
<ElTableColumn label="日期" prop="date" width="120" />
|
||||||
<ElTableColumn label="ICCID / 卡 ID" min-width="190">
|
<ElTableColumn label="ICCID" min-width="190">
|
||||||
<template #default="{ row }">{{ row.iccid || row.iot_card_id }}</template>
|
<template #default="{ row }">{{ assetDisplay(row) }}</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
<ElTableColumn label="运营商账户" min-width="140" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">{{ nameOrId(row.carrier_name, row.carrier_id) }}</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn label="运营商账户" prop="carrier_id" width="100" />
|
|
||||||
<ElTableColumn label="当日用量" min-width="110">
|
<ElTableColumn label="当日用量" min-width="110">
|
||||||
<template #default="{ row }">{{ formatMb(row.settled_mb) }}</template>
|
<template #default="{ row }">{{ formatMb(row.settled_mb) }}</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
@@ -47,18 +49,19 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive } from 'vue'
|
import { computed, reactive } from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { TrafficRecordsService } from '@/api/modules/trafficRecords'
|
import { TrafficRecordsService } from '@/api/modules/trafficRecords'
|
||||||
import { useRecordList } from '@/composables/useRecordList'
|
import { useCarrierFilterItem, useRecordList } from '@/composables/useRecordList'
|
||||||
import { useUserStore } from '@/store/modules/user'
|
import { useUserStore } from '@/store/modules/user'
|
||||||
import type { SearchFormItem } from '@/types'
|
import type { SearchFormItem } from '@/types'
|
||||||
import type { CardDailyUsage } from '@/types/api/trafficRecords'
|
import type { CardDailyUsage } from '@/types/api/trafficRecords'
|
||||||
import { formatDateTime } from '@/utils/business/format'
|
import { formatDateTime } from '@/utils/business/format'
|
||||||
import {
|
import {
|
||||||
compactQuery,
|
compactQuery,
|
||||||
|
assetDisplay,
|
||||||
formatMb,
|
formatMb,
|
||||||
optionalPositiveInt,
|
nameOrId,
|
||||||
recentDateRange,
|
recentDateRange,
|
||||||
requireIdentifierForNonPlatform,
|
requireIdentifierForNonPlatform,
|
||||||
toDateQuery
|
toDateQuery
|
||||||
@@ -68,7 +71,7 @@
|
|||||||
const { info: userInfo } = storeToRefs(useUserStore())
|
const { info: userInfo } = storeToRefs(useUserStore())
|
||||||
const emptyFilters = () => ({
|
const emptyFilters = () => ({
|
||||||
identifier: '',
|
identifier: '',
|
||||||
carrier_id: '',
|
carrier_id: undefined as number | undefined,
|
||||||
min_usage_mb: '',
|
min_usage_mb: '',
|
||||||
range: recentDateRange(7) as [string, string] | null
|
range: recentDateRange(7) as [string, string] | null
|
||||||
})
|
})
|
||||||
@@ -87,13 +90,14 @@
|
|||||||
...page,
|
...page,
|
||||||
...toDateQuery(filters.range),
|
...toDateQuery(filters.range),
|
||||||
identifier,
|
identifier,
|
||||||
carrier_id: optionalPositiveInt(filters.carrier_id, '运营商账户 ID'),
|
carrier_id: filters.carrier_id,
|
||||||
min_usage_mb: minUsage
|
min_usage_mb: minUsage
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const searchItems: SearchFormItem[] = [
|
const { item: carrierItem } = useCarrierFilterItem()
|
||||||
|
const searchItems = computed<SearchFormItem[]>(() => [
|
||||||
{
|
{
|
||||||
label: '资产标识',
|
label: '资产标识',
|
||||||
prop: 'identifier',
|
prop: 'identifier',
|
||||||
@@ -113,14 +117,14 @@
|
|||||||
clearable: false
|
clearable: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label: '运营商账户ID', prop: 'carrier_id', type: 'input', config: { clearable: true } },
|
|
||||||
{
|
{
|
||||||
label: '当日用量≥(MB)',
|
label: '当日用量≥(MB)',
|
||||||
prop: 'min_usage_mb',
|
prop: 'min_usage_mb',
|
||||||
type: 'input',
|
type: 'input',
|
||||||
config: { clearable: true, placeholder: '排查异常大流量' }
|
config: { clearable: true, placeholder: '排查异常大流量' }
|
||||||
}
|
},
|
||||||
]
|
carrierItem.value
|
||||||
|
])
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
Object.assign(filters, emptyFilters())
|
Object.assign(filters, emptyFilters())
|
||||||
|
|||||||
@@ -33,20 +33,14 @@
|
|||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
v-if="!isFixed"
|
v-if="!isFixed"
|
||||||
label="套餐使用记录ID"
|
label="ICCID / 设备号"
|
||||||
prop="package_usage_id"
|
min-width="200"
|
||||||
min-width="130"
|
show-overflow-tooltip
|
||||||
/>
|
>
|
||||||
<ElTableColumn v-if="!isFixed" label="卡ID / 设备ID" min-width="120">
|
<template #default="{ row }">{{ assetDisplay(row) }}</template>
|
||||||
<template #default="{ row }">
|
</ElTableColumn>
|
||||||
{{
|
<ElTableColumn v-if="!isFixed" label="套餐" min-width="180" show-overflow-tooltip>
|
||||||
row.iot_card_id
|
<template #default="{ row }">{{ row.package_name || '-' }}</template>
|
||||||
? `卡 ${row.iot_card_id}`
|
|
||||||
: row.device_id
|
|
||||||
? `设备 ${row.device_id}`
|
|
||||||
: '-'
|
|
||||||
}}
|
|
||||||
</template>
|
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn label="调整量" min-width="110">
|
<ElTableColumn label="调整量" min-width="110">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
@@ -66,7 +60,11 @@
|
|||||||
</template>
|
</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn label="原因" prop="reason" min-width="200" show-overflow-tooltip />
|
<ElTableColumn label="原因" prop="reason" min-width="200" show-overflow-tooltip />
|
||||||
<ElTableColumn label="操作人ID" prop="operator_id" width="100" />
|
<ElTableColumn label="操作人" min-width="120">
|
||||||
|
<template #default="{ row }">{{
|
||||||
|
nameOrId(row.operator_name, row.operator_id, '账号ID')
|
||||||
|
}}</template>
|
||||||
|
</ElTableColumn>
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
label="关联采集 ID"
|
label="关联采集 ID"
|
||||||
prop="ref_observation_id"
|
prop="ref_observation_id"
|
||||||
@@ -98,8 +96,9 @@
|
|||||||
import { ADJUSTMENT_DIRECTION_OPTIONS } from '@/config/constants/trafficRecords'
|
import { ADJUSTMENT_DIRECTION_OPTIONS } from '@/config/constants/trafficRecords'
|
||||||
import {
|
import {
|
||||||
compactQuery,
|
compactQuery,
|
||||||
|
assetDisplay,
|
||||||
formatMb,
|
formatMb,
|
||||||
optionalPositiveInt,
|
nameOrId,
|
||||||
recentTimeRange,
|
recentTimeRange,
|
||||||
requireIdentifierForNonPlatform,
|
requireIdentifierForNonPlatform,
|
||||||
toTimeQuery
|
toTimeQuery
|
||||||
@@ -128,8 +127,7 @@
|
|||||||
const { info: userInfo } = storeToRefs(useUserStore())
|
const { info: userInfo } = storeToRefs(useUserStore())
|
||||||
const emptyFilters = () => ({
|
const emptyFilters = () => ({
|
||||||
identifier: '',
|
identifier: '',
|
||||||
package_usage_id: '',
|
operator_id: undefined as number | undefined,
|
||||||
operator_id: '',
|
|
||||||
direction: '',
|
direction: '',
|
||||||
range: recentTimeRange(7) as [string, string] | null
|
range: recentTimeRange(7) as [string, string] | null
|
||||||
})
|
})
|
||||||
@@ -145,17 +143,13 @@
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
const identifier = filters.identifier.trim()
|
const identifier = filters.identifier.trim()
|
||||||
const packageUsageId = optionalPositiveInt(filters.package_usage_id, '套餐使用记录 ID')
|
requireIdentifierForNonPlatform(identifier, userInfo.value.user_type)
|
||||||
if (packageUsageId === undefined) {
|
|
||||||
requireIdentifierForNonPlatform(identifier, userInfo.value.user_type)
|
|
||||||
}
|
|
||||||
return TrafficRecordsService.getTrafficAdjustments(
|
return TrafficRecordsService.getTrafficAdjustments(
|
||||||
compactQuery({
|
compactQuery({
|
||||||
...page,
|
...page,
|
||||||
...toTimeQuery(filters.range),
|
...toTimeQuery(filters.range),
|
||||||
identifier,
|
identifier,
|
||||||
package_usage_id: packageUsageId,
|
operator_id: filters.operator_id || undefined,
|
||||||
operator_id: optionalPositiveInt(filters.operator_id, '操作人账号 ID'),
|
|
||||||
direction: filters.direction as 'deduct' | 'refund' | ''
|
direction: filters.direction as 'deduct' | 'refund' | ''
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -182,12 +176,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '套餐使用记录ID',
|
label: '操作人',
|
||||||
prop: 'package_usage_id',
|
prop: 'operator_id',
|
||||||
type: 'input',
|
type: 'business-select',
|
||||||
config: { clearable: true }
|
config: { entity: 'account', placeholder: '输入账号用户名搜索' }
|
||||||
},
|
},
|
||||||
{ label: '操作人账号ID', prop: 'operator_id', type: 'input', config: { clearable: true } },
|
|
||||||
{
|
{
|
||||||
label: '调整方向',
|
label: '调整方向',
|
||||||
prop: 'direction',
|
prop: 'direction',
|
||||||
|
|||||||
@@ -21,12 +21,11 @@
|
|||||||
>
|
>
|
||||||
<ElTable v-loading="loading" :data="rows" row-key="id" border empty-text="暂无套餐日流量">
|
<ElTable v-loading="loading" :data="rows" row-key="id" border empty-text="暂无套餐日流量">
|
||||||
<ElTableColumn label="日期" prop="date" width="120" />
|
<ElTableColumn label="日期" prop="date" width="120" />
|
||||||
<ElTableColumn label="套餐使用记录ID" prop="package_usage_id" min-width="130" />
|
<ElTableColumn label="ICCID / 设备号" min-width="200" show-overflow-tooltip>
|
||||||
<ElTableColumn label="套餐ID" prop="package_id" width="100" />
|
<template #default="{ row }">{{ assetDisplay(row) }}</template>
|
||||||
<ElTableColumn label="卡ID / 设备ID" min-width="130">
|
</ElTableColumn>
|
||||||
<template #default="{ row }">
|
<ElTableColumn label="套餐" min-width="200" show-overflow-tooltip>
|
||||||
{{ row.iot_card_id ? `卡 ${row.iot_card_id}` : `设备 ${row.device_id}` }}
|
<template #default="{ row }">{{ row.package_name || '-' }}</template>
|
||||||
</template>
|
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn label="当日流量" min-width="110">
|
<ElTableColumn label="当日流量" min-width="110">
|
||||||
<template #default="{ row }">{{ formatMb(row.daily_usage_mb) }}</template>
|
<template #default="{ row }">{{ formatMb(row.daily_usage_mb) }}</template>
|
||||||
@@ -44,18 +43,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive } from 'vue'
|
import { computed, reactive } from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { TrafficRecordsService } from '@/api/modules/trafficRecords'
|
import { TrafficRecordsService } from '@/api/modules/trafficRecords'
|
||||||
import { useRecordList } from '@/composables/useRecordList'
|
import { useCarrierFilterItem, useRecordList } from '@/composables/useRecordList'
|
||||||
import { useUserStore } from '@/store/modules/user'
|
import { useUserStore } from '@/store/modules/user'
|
||||||
import type { SearchFormItem } from '@/types'
|
import type { SearchFormItem } from '@/types'
|
||||||
import type { PackageUsageDailyRecord } from '@/types/api/trafficRecords'
|
import type { PackageUsageDailyRecord } from '@/types/api/trafficRecords'
|
||||||
import { formatDateTime } from '@/utils/business/format'
|
import { formatDateTime } from '@/utils/business/format'
|
||||||
import {
|
import {
|
||||||
compactQuery,
|
compactQuery,
|
||||||
|
assetDisplay,
|
||||||
formatMb,
|
formatMb,
|
||||||
optionalPositiveInt,
|
|
||||||
recentDateRange,
|
recentDateRange,
|
||||||
requireIdentifierForNonPlatform,
|
requireIdentifierForNonPlatform,
|
||||||
toDateQuery
|
toDateQuery
|
||||||
@@ -65,9 +64,8 @@
|
|||||||
const { info: userInfo } = storeToRefs(useUserStore())
|
const { info: userInfo } = storeToRefs(useUserStore())
|
||||||
const emptyFilters = () => ({
|
const emptyFilters = () => ({
|
||||||
identifier: '',
|
identifier: '',
|
||||||
package_usage_id: '',
|
package_id: undefined as number | undefined,
|
||||||
package_id: '',
|
carrier_id: undefined as number | undefined,
|
||||||
carrier_id: '',
|
|
||||||
range: recentDateRange(7) as [string, string] | null
|
range: recentDateRange(7) as [string, string] | null
|
||||||
})
|
})
|
||||||
const filters = reactive(emptyFilters())
|
const filters = reactive(emptyFilters())
|
||||||
@@ -75,23 +73,20 @@
|
|||||||
const { rows, total, loading, error, pagination, load, search, changePage, changeSize } =
|
const { rows, total, loading, error, pagination, load, search, changePage, changeSize } =
|
||||||
useRecordList<PackageUsageDailyRecord>((page) => {
|
useRecordList<PackageUsageDailyRecord>((page) => {
|
||||||
const identifier = filters.identifier.trim()
|
const identifier = filters.identifier.trim()
|
||||||
const packageUsageId = optionalPositiveInt(filters.package_usage_id, '套餐使用记录 ID')
|
requireIdentifierForNonPlatform(identifier, userInfo.value.user_type)
|
||||||
if (packageUsageId === undefined) {
|
|
||||||
requireIdentifierForNonPlatform(identifier, userInfo.value.user_type)
|
|
||||||
}
|
|
||||||
return TrafficRecordsService.getPackageUsageDailyRecords(
|
return TrafficRecordsService.getPackageUsageDailyRecords(
|
||||||
compactQuery({
|
compactQuery({
|
||||||
...page,
|
...page,
|
||||||
...toDateQuery(filters.range),
|
...toDateQuery(filters.range),
|
||||||
identifier,
|
identifier,
|
||||||
package_usage_id: packageUsageId,
|
package_id: filters.package_id || undefined,
|
||||||
package_id: optionalPositiveInt(filters.package_id, '套餐 ID'),
|
carrier_id: filters.carrier_id
|
||||||
carrier_id: optionalPositiveInt(filters.carrier_id, '运营商账户 ID')
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const searchItems: SearchFormItem[] = [
|
const { item: carrierItem } = useCarrierFilterItem()
|
||||||
|
const searchItems = computed<SearchFormItem[]>(() => [
|
||||||
{
|
{
|
||||||
label: '资产标识',
|
label: '资产标识',
|
||||||
prop: 'identifier',
|
prop: 'identifier',
|
||||||
@@ -112,14 +107,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '套餐使用记录ID',
|
label: '套餐',
|
||||||
prop: 'package_usage_id',
|
prop: 'package_id',
|
||||||
type: 'input',
|
type: 'business-select',
|
||||||
config: { clearable: true }
|
config: { entity: 'package', placeholder: '输入套餐名称搜索' }
|
||||||
},
|
},
|
||||||
{ label: '套餐ID', prop: 'package_id', type: 'input', config: { clearable: true } },
|
carrierItem.value
|
||||||
{ label: '运营商账户ID', prop: 'carrier_id', type: 'input', config: { clearable: true } }
|
])
|
||||||
]
|
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
Object.assign(filters, emptyFilters())
|
Object.assign(filters, emptyFilters())
|
||||||
|
|||||||
@@ -37,7 +37,15 @@
|
|||||||
<ElTableColumn label="资产" min-width="200">
|
<ElTableColumn label="资产" min-width="200">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.asset_type === 'device' ? '设备' : '单卡' }}
|
{{ row.asset_type === 'device' ? '设备' : '单卡' }}
|
||||||
{{ row.iccid || row.asset_id || '' }}
|
{{
|
||||||
|
row.asset_type === 'device'
|
||||||
|
? assetDisplay({
|
||||||
|
device_id: row.asset_id,
|
||||||
|
device_virtual_no: row.device_virtual_no,
|
||||||
|
device_imei: row.device_imei
|
||||||
|
})
|
||||||
|
: assetDisplay({ iot_card_id: row.asset_id, iccid: row.iccid })
|
||||||
|
}}
|
||||||
</template>
|
</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn label="第几次" prop="attempt" width="80" />
|
<ElTableColumn label="第几次" prop="attempt" width="80" />
|
||||||
@@ -94,8 +102,8 @@
|
|||||||
} from '@/config/constants/trafficRecords'
|
} from '@/config/constants/trafficRecords'
|
||||||
import {
|
import {
|
||||||
compactQuery,
|
compactQuery,
|
||||||
|
assetDisplay,
|
||||||
isPlatformAccount,
|
isPlatformAccount,
|
||||||
optionalPositiveInt,
|
|
||||||
recentTimeRange,
|
recentTimeRange,
|
||||||
toTimeQuery
|
toTimeQuery
|
||||||
} from '@/utils/business/trafficRecords'
|
} from '@/utils/business/trafficRecords'
|
||||||
@@ -107,7 +115,6 @@
|
|||||||
const allowed = computed(() => isPlatformAccount(userInfo.value.user_type))
|
const allowed = computed(() => isPlatformAccount(userInfo.value.user_type))
|
||||||
|
|
||||||
const emptyFilters = () => ({
|
const emptyFilters = () => ({
|
||||||
refund_id: props.refundId ? String(props.refundId) : '',
|
|
||||||
refund_no: '',
|
refund_no: '',
|
||||||
identifier: '',
|
identifier: '',
|
||||||
step: '',
|
step: '',
|
||||||
@@ -124,7 +131,8 @@
|
|||||||
compactQuery({
|
compactQuery({
|
||||||
...page,
|
...page,
|
||||||
...toTimeQuery(filters.range, true),
|
...toTimeQuery(filters.range, true),
|
||||||
refund_id: optionalPositiveInt(filters.refund_id, '退款单 ID'),
|
// 从退款详情进入时固定按该退款单筛选,不让用户手填内部 ID
|
||||||
|
refund_id: props.refundId || undefined,
|
||||||
refund_no: filters.refund_no.trim(),
|
refund_no: filters.refund_no.trim(),
|
||||||
identifier: filters.identifier.trim(),
|
identifier: filters.identifier.trim(),
|
||||||
step: filters.step,
|
step: filters.step,
|
||||||
@@ -156,7 +164,6 @@
|
|||||||
clearable: true
|
clearable: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ label: '退款单ID', prop: 'refund_id', type: 'input', config: { clearable: true } },
|
|
||||||
{ label: '退款单号', prop: 'refund_no', type: 'input', config: { clearable: true } },
|
{ label: '退款单号', prop: 'refund_no', type: 'input', config: { clearable: true } },
|
||||||
{
|
{
|
||||||
label: '资产标识',
|
label: '资产标识',
|
||||||
|
|||||||
@@ -43,10 +43,12 @@
|
|||||||
</ElTag>
|
</ElTag>
|
||||||
</template>
|
</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn v-if="!isAsset" label="ICCID / 卡 ID" min-width="190">
|
<ElTableColumn v-if="!isAsset" label="ICCID" min-width="190">
|
||||||
<template #default="{ row }">{{ row.iccid || row.iot_card_id || '-' }}</template>
|
<template #default="{ row }">{{ assetDisplay(row) }}</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
<ElTableColumn v-if="!isAsset" label="运营商账户" min-width="140" show-overflow-tooltip>
|
||||||
|
<template #default="{ row }">{{ nameOrId(row.carrier_name, row.carrier_id) }}</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
<ElTableColumn v-if="!isAsset" label="运营商账户" prop="carrier_id" width="100" />
|
|
||||||
<ElTableColumn label="来源" width="90">
|
<ElTableColumn label="来源" width="90">
|
||||||
<template #default="{ row }">{{ labelOf(TRAFFIC_SOURCE_LABELS, row.source) }}</template>
|
<template #default="{ row }">{{ labelOf(TRAFFIC_SOURCE_LABELS, row.source) }}</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
@@ -135,7 +137,7 @@
|
|||||||
import { computed, reactive, watch } from 'vue'
|
import { computed, reactive, watch } from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { TrafficRecordsService } from '@/api/modules/trafficRecords'
|
import { TrafficRecordsService } from '@/api/modules/trafficRecords'
|
||||||
import { useRecordList } from '@/composables/useRecordList'
|
import { useCarrierFilterItem, useRecordList } from '@/composables/useRecordList'
|
||||||
import { useUserStore } from '@/store/modules/user'
|
import { useUserStore } from '@/store/modules/user'
|
||||||
import type { SearchFormItem } from '@/types'
|
import type { SearchFormItem } from '@/types'
|
||||||
import type { RawDataBlock, TrafficCollectionRecord } from '@/types/api/trafficRecords'
|
import type { RawDataBlock, TrafficCollectionRecord } from '@/types/api/trafficRecords'
|
||||||
@@ -154,9 +156,10 @@
|
|||||||
} from '@/config/constants/trafficRecords'
|
} from '@/config/constants/trafficRecords'
|
||||||
import {
|
import {
|
||||||
compactQuery,
|
compactQuery,
|
||||||
|
assetDisplay,
|
||||||
formatMb,
|
formatMb,
|
||||||
|
nameOrId,
|
||||||
optionalBoolean,
|
optionalBoolean,
|
||||||
optionalPositiveInt,
|
|
||||||
recentTimeRange,
|
recentTimeRange,
|
||||||
requireIdentifierForNonPlatform,
|
requireIdentifierForNonPlatform,
|
||||||
toTimeQuery
|
toTimeQuery
|
||||||
@@ -174,6 +177,7 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
const isAsset = computed(() => props.mode === 'asset')
|
const isAsset = computed(() => props.mode === 'asset')
|
||||||
|
const { item: carrierItem } = useCarrierFilterItem(props.mode !== 'asset')
|
||||||
const { info: userInfo } = storeToRefs(useUserStore())
|
const { info: userInfo } = storeToRefs(useUserStore())
|
||||||
const pageSizes = computed(() => (isAsset.value ? [50, 100] : [20, 50, 100]))
|
const pageSizes = computed(() => (isAsset.value ? [50, 100] : [20, 50, 100]))
|
||||||
const emptyText = computed(() => (props.mode === 'failure' ? '暂无采集失败记录' : '暂无采集记录'))
|
const emptyText = computed(() => (props.mode === 'failure' ? '暂无采集失败记录' : '暂无采集记录'))
|
||||||
@@ -185,7 +189,7 @@
|
|||||||
|
|
||||||
const emptyFilters = () => ({
|
const emptyFilters = () => ({
|
||||||
identifier: '',
|
identifier: '',
|
||||||
carrier_id: '' as string | number,
|
carrier_id: undefined as number | undefined,
|
||||||
decision: '',
|
decision: '',
|
||||||
source: '',
|
source: '',
|
||||||
scene: '',
|
scene: '',
|
||||||
@@ -222,7 +226,7 @@
|
|||||||
...page,
|
...page,
|
||||||
...time,
|
...time,
|
||||||
identifier,
|
identifier,
|
||||||
carrier_id: optionalPositiveInt(filters.carrier_id, '运营商账户 ID'),
|
carrier_id: filters.carrier_id,
|
||||||
source: filters.source,
|
source: filters.source,
|
||||||
scene: filters.scene.trim()
|
scene: filters.scene.trim()
|
||||||
}
|
}
|
||||||
@@ -288,7 +292,7 @@
|
|||||||
const common = [
|
const common = [
|
||||||
input('资产标识', 'identifier', 'ICCID / 虚拟号 / MSISDN / IMEI / SN'),
|
input('资产标识', 'identifier', 'ICCID / 虚拟号 / MSISDN / IMEI / SN'),
|
||||||
rangeItem,
|
rangeItem,
|
||||||
input('运营商账户ID', 'carrier_id'),
|
carrierItem.value,
|
||||||
select('来源', 'source', TRAFFIC_SOURCE_OPTIONS),
|
select('来源', 'source', TRAFFIC_SOURCE_OPTIONS),
|
||||||
input('场景', 'scene')
|
input('场景', 'scene')
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { onBeforeUnmount, reactive, ref, shallowRef } from 'vue'
|
import { computed, onBeforeUnmount, reactive, ref, shallowRef } from 'vue'
|
||||||
|
import { useGatewayCarriers } from '@/composables/useGateway'
|
||||||
|
import type { SearchFormItem } from '@/types'
|
||||||
import type { BaseResponse } from '@/types/api/common'
|
import type { BaseResponse } from '@/types/api/common'
|
||||||
import type { RecordPage } from '@/types/api/trafficRecords'
|
import type { RecordPage } from '@/types/api/trafficRecords'
|
||||||
import { errorMessage } from '@/utils/business/trafficRecords'
|
import { errorMessage } from '@/utils/business/trafficRecords'
|
||||||
@@ -66,3 +68,24 @@ export function useRecordList<T>(
|
|||||||
|
|
||||||
return { rows, total, loading, error, pagination, load, search, changePage, changeSize, clear }
|
return { rows, total, loading, error, pagination, load, search, changePage, changeSize, clear }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 运营商账户筛选:按名称远程搜索,提交的是账户 ID(复用网关页面的运营商候选)。 */
|
||||||
|
export function useCarrierFilterItem(loadOnMount = true) {
|
||||||
|
const carriers = useGatewayCarriers(loadOnMount)
|
||||||
|
const item = computed<SearchFormItem>(() => ({
|
||||||
|
label: '运营商账户',
|
||||||
|
prop: 'carrier_id',
|
||||||
|
type: 'select',
|
||||||
|
options: carriers.options.value,
|
||||||
|
onChange: ({ val }: { val: unknown }) => carriers.select(val),
|
||||||
|
config: {
|
||||||
|
clearable: true,
|
||||||
|
filterable: true,
|
||||||
|
remote: true,
|
||||||
|
remoteMethod: carriers.search,
|
||||||
|
loading: carriers.loading.value,
|
||||||
|
placeholder: '输入运营商名称搜索'
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
return { item, carriers }
|
||||||
|
}
|
||||||
|
|||||||
@@ -122,6 +122,18 @@ export interface SilenceExtensionResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SilenceEligibilityResponse {
|
export interface SilenceEligibilityResponse {
|
||||||
|
/** 套餐名称 */
|
||||||
|
package_name?: string
|
||||||
|
/** 资产标识 */
|
||||||
|
asset_identifier?: string
|
||||||
|
/** 套餐订购时间(购买支付成功时间) */
|
||||||
|
purchased_at?: string
|
||||||
|
/** 套餐生效时间(未实名激活时为空) */
|
||||||
|
activated_at?: string
|
||||||
|
/** 套餐到期时间(未实名激活时为空) */
|
||||||
|
expires_at?: string
|
||||||
|
/** 沉默期截止时间 */
|
||||||
|
silence_deadline_at?: string
|
||||||
/** 能否办理付费延期 */
|
/** 能否办理付费延期 */
|
||||||
can_extend?: boolean
|
can_extend?: boolean
|
||||||
/** 已累计延期天数 */
|
/** 已累计延期天数 */
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ export interface TrafficCollectionRecord {
|
|||||||
iot_card_id?: number
|
iot_card_id?: number
|
||||||
iccid?: string
|
iccid?: string
|
||||||
carrier_id?: number
|
carrier_id?: number
|
||||||
|
carrier_name?: string
|
||||||
source?: string
|
source?: string
|
||||||
scene?: string
|
scene?: string
|
||||||
result?: string
|
result?: string
|
||||||
@@ -99,6 +100,7 @@ export interface CardDailyUsage {
|
|||||||
iot_card_id: number
|
iot_card_id: number
|
||||||
iccid?: string
|
iccid?: string
|
||||||
carrier_id?: number
|
carrier_id?: number
|
||||||
|
carrier_name?: string
|
||||||
settled_mb: number
|
settled_mb: number
|
||||||
month_used_mb: number
|
month_used_mb: number
|
||||||
vendor_used_mb: number
|
vendor_used_mb: number
|
||||||
@@ -119,8 +121,12 @@ export interface PackageUsageDailyRecord {
|
|||||||
date: string
|
date: string
|
||||||
package_usage_id: number
|
package_usage_id: number
|
||||||
package_id: number
|
package_id: number
|
||||||
|
package_name?: string
|
||||||
iot_card_id: number
|
iot_card_id: number
|
||||||
|
iccid?: string
|
||||||
device_id: number
|
device_id: number
|
||||||
|
device_virtual_no?: string
|
||||||
|
device_imei?: string
|
||||||
daily_usage_mb: number
|
daily_usage_mb: number
|
||||||
cumulative_usage_mb: number
|
cumulative_usage_mb: number
|
||||||
updated_at?: string
|
updated_at?: string
|
||||||
@@ -137,8 +143,12 @@ export interface PackageTrafficAdjustment {
|
|||||||
id: number
|
id: number
|
||||||
created_at: string
|
created_at: string
|
||||||
package_usage_id: number
|
package_usage_id: number
|
||||||
|
package_name?: string
|
||||||
iot_card_id?: number
|
iot_card_id?: number
|
||||||
|
iccid?: string
|
||||||
device_id?: number
|
device_id?: number
|
||||||
|
device_virtual_no?: string
|
||||||
|
device_imei?: string
|
||||||
delta_mb: number
|
delta_mb: number
|
||||||
before_usage_mb: number
|
before_usage_mb: number
|
||||||
after_usage_mb: number
|
after_usage_mb: number
|
||||||
@@ -146,6 +156,7 @@ export interface PackageTrafficAdjustment {
|
|||||||
after_status?: number
|
after_status?: number
|
||||||
reason: string
|
reason: string
|
||||||
operator_id?: number
|
operator_id?: number
|
||||||
|
operator_name?: string
|
||||||
ref_event_id?: string
|
ref_event_id?: string
|
||||||
ref_observation_id?: string
|
ref_observation_id?: string
|
||||||
}
|
}
|
||||||
@@ -175,6 +186,8 @@ export interface RefundPostProcessAttempt {
|
|||||||
asset_type?: string
|
asset_type?: string
|
||||||
asset_id?: number
|
asset_id?: number
|
||||||
iccid?: string
|
iccid?: string
|
||||||
|
device_virtual_no?: string
|
||||||
|
device_imei?: string
|
||||||
attempt: number
|
attempt: number
|
||||||
step: string
|
step: string
|
||||||
result: string
|
result: string
|
||||||
|
|||||||
@@ -125,6 +125,30 @@ export function formatMb(value: unknown): string {
|
|||||||
return `${Number.isInteger(number) ? number : number.toFixed(2)} MB`
|
return `${Number.isInteger(number) ? number : number.toFixed(2)} MB`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 卡 / 设备展示:优先 ICCID、设备号(IMEI),都没有时才显示内部 ID */
|
||||||
|
export function assetDisplay(row: {
|
||||||
|
iot_card_id?: number | null
|
||||||
|
iccid?: string
|
||||||
|
device_id?: number | null
|
||||||
|
device_virtual_no?: string
|
||||||
|
device_imei?: string
|
||||||
|
}): string {
|
||||||
|
if (row.iccid) return row.iccid
|
||||||
|
if (row.device_virtual_no || row.device_imei) {
|
||||||
|
const no = row.device_virtual_no || row.device_imei
|
||||||
|
return row.device_imei && row.device_imei !== no
|
||||||
|
? `${no}(IMEI ${row.device_imei})`
|
||||||
|
: String(no)
|
||||||
|
}
|
||||||
|
if (row.iot_card_id) return `卡ID ${row.iot_card_id}`
|
||||||
|
if (row.device_id) return `设备ID ${row.device_id}`
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 名称为空时退回显示 ID */
|
||||||
|
export const nameOrId = (name?: string, id?: number | null, idLabel = 'ID'): string =>
|
||||||
|
name || (id ? `${idLabel} ${id}` : '-')
|
||||||
|
|
||||||
export function errorMessage(error: unknown): string {
|
export function errorMessage(error: unknown): string {
|
||||||
const data = (error as { response?: { data?: { msg?: string; message?: string } } })?.response
|
const data = (error as { response?: { data?: { msg?: string; message?: string } } })?.response
|
||||||
?.data
|
?.data
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
<SilenceSummary
|
<SilenceSummary
|
||||||
:silence="currentPackage.silence"
|
:silence="currentPackage.silence"
|
||||||
:usage-id="currentPackage.package_usage_id ?? currentPackage.id"
|
:usage-id="currentPackage.package_usage_id ?? currentPackage.id"
|
||||||
|
:package-name="currentPackage.package_name"
|
||||||
@changed="emit('refresh')"
|
@changed="emit('refresh')"
|
||||||
/>
|
/>
|
||||||
<!-- 流量使用情况 - 横向进度条卡片 -->
|
<!-- 流量使用情况 - 横向进度条卡片 -->
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
v-if="row.silence"
|
v-if="row.silence"
|
||||||
:silence="row.silence"
|
:silence="row.silence"
|
||||||
:usage-id="row.package_usage_id ?? row.id"
|
:usage-id="row.package_usage_id ?? row.id"
|
||||||
|
:package-name="row.package_name"
|
||||||
@changed="emit('refresh')"
|
@changed="emit('refresh')"
|
||||||
/><span v-else>-</span></template
|
/><span v-else>-</span></template
|
||||||
></ElTableColumn
|
></ElTableColumn
|
||||||
|
|||||||
@@ -171,7 +171,8 @@
|
|||||||
<ElDatePicker
|
<ElDatePicker
|
||||||
v-model="form.time_period_started_at"
|
v-model="form.time_period_started_at"
|
||||||
type="datetime"
|
type="datetime"
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
value-format="YYYY-MM-DDTHH:mm:ssZ"
|
||||||
placeholder="请选择时间起点"
|
placeholder="请选择时间起点"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user