feat: 线下登记延期先传凭证自动识别交易单号,弹窗显示套餐名称
Some checks failed
构建并部署前端到测试环境 / deploy (push) Has been cancelled
Some checks failed
构建并部署前端到测试环境 / deploy (push) Has been cancelled
- 登记线下付款时收款凭证放到最前,上传后自动识别交易单号预填(复用凭证识别,需人工核对,不覆盖手填) - 试算后自动带入实收金额 - 延期弹窗显示套餐名称(及资产),不再显示套餐记录 ID
This commit is contained in:
@@ -32,9 +32,21 @@
|
|||||||
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
|
||||||
@@ -111,7 +123,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>
|
||||||
@@ -122,7 +142,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}`"
|
||||||
@@ -184,6 +204,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'
|
||||||
@@ -212,10 +233,22 @@
|
|||||||
import SilenceTable from './SilenceTable.vue'
|
import SilenceTable from './SilenceTable.vue'
|
||||||
// allowed 未传时视为允许:Vue 会把未传的布尔 prop 当成 false,不设默认值时资产详情入口一律报"无权执行此操作"
|
// allowed 未传时视为允许:Vue 会把未传的布尔 prop 当成 false,不设默认值时资产详情入口一律报"无权执行此操作"
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{ usageId?: number; allowed?: boolean; batchMode?: boolean }>(),
|
defineProps<{
|
||||||
|
usageId?: number
|
||||||
|
allowed?: boolean
|
||||||
|
batchMode?: boolean
|
||||||
|
packageName?: string
|
||||||
|
assetIdentifier?: string
|
||||||
|
}>(),
|
||||||
{ allowed: true, batchMode: false }
|
{ allowed: true, batchMode: false }
|
||||||
)
|
)
|
||||||
const emit = defineEmits<{ close: []; changed: [] }>()
|
const emit = defineEmits<{ close: []; changed: [] }>()
|
||||||
|
// 展示套餐名称(及资产),不展示内部套餐记录 ID;调用方未传名称时才退回显示 ID
|
||||||
|
const packageLabel = computed(() => {
|
||||||
|
const name = props.packageName?.trim()
|
||||||
|
if (!name) return props.usageId ? `套餐记录 ${props.usageId}` : '-'
|
||||||
|
return props.assetIdentifier ? `${name}(${props.assetIdentifier})` : name
|
||||||
|
})
|
||||||
const { hasAuth } = useAuth(),
|
const { hasAuth } = useAuth(),
|
||||||
user = useUserStore()
|
user = useUserStore()
|
||||||
const mode = ref<'online' | 'offline' | 'special'>(
|
const mode = ref<'online' | 'offline' | 'special'>(
|
||||||
@@ -293,6 +326,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
|
||||||
@@ -319,6 +408,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 = []
|
||||||
@@ -597,4 +691,23 @@
|
|||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
</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),
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user