整理代码
This commit is contained in:
@@ -172,6 +172,10 @@ export function createDigitalAccountApi(
|
||||
return http.post('/pt/digital-accounts', payload)
|
||||
}
|
||||
|
||||
export function updateDigitalAccountStatusApi(id: string, status: string): Promise<string> {
|
||||
return http.put(`/pt/digital-accounts/${id}/status`, { status })
|
||||
}
|
||||
|
||||
export interface PresetData {
|
||||
bankName: string
|
||||
bankAccount: string
|
||||
|
||||
@@ -110,6 +110,7 @@ import {
|
||||
NIcon,
|
||||
NInput,
|
||||
NModal,
|
||||
NPopconfirm,
|
||||
NSelect,
|
||||
NSpace,
|
||||
NTag,
|
||||
@@ -122,7 +123,8 @@ import {
|
||||
listDigitalAccountsApi,
|
||||
refreshDigitalAccountsApi,
|
||||
sendLoginSmsCodeApi,
|
||||
smsLoginApi
|
||||
smsLoginApi,
|
||||
updateDigitalAccountStatusApi
|
||||
} from '@/api/piaotong'
|
||||
import type { DigitalAccountItem } from '@/api/piaotong'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
@@ -144,6 +146,7 @@ const selected = ref<DigitalAccountItem | null>(null)
|
||||
const createFormRef = ref<FormInst | null>(null)
|
||||
|
||||
const canManage = computed(() => authStore.user?.userType !== 'DIGITAL_OPERATOR')
|
||||
const canUpdateStatus = computed(() => authStore.hasPermission('digital-account:status'))
|
||||
|
||||
const createForm = reactive({
|
||||
account: '',
|
||||
@@ -197,6 +200,17 @@ const columns: DataTableColumns<DigitalAccountItem> = [
|
||||
)
|
||||
},
|
||||
{ title: '最近认证', key: 'lastAuthSuccTime', minWidth: 160 },
|
||||
{
|
||||
title: '平台状态',
|
||||
key: 'status',
|
||||
width: 110,
|
||||
render: (row) =>
|
||||
h(
|
||||
NTag,
|
||||
{ type: row.status === 'ENABLED' ? 'success' : 'warning' },
|
||||
{ default: () => (row.status === 'ENABLED' ? '可用' : '禁用') }
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'API Key',
|
||||
key: 'apiKey',
|
||||
@@ -207,19 +221,49 @@ const columns: DataTableColumns<DigitalAccountItem> = [
|
||||
title: '操作',
|
||||
key: 'actions',
|
||||
fixed: 'right',
|
||||
width: 220,
|
||||
width: 300,
|
||||
render: (row) =>
|
||||
h('div', { class: 'row-actions' }, [
|
||||
h(
|
||||
NButton,
|
||||
{ size: 'small', secondary: true, onClick: () => openSms(row) },
|
||||
{
|
||||
size: 'small',
|
||||
secondary: true,
|
||||
disabled: row.status !== 'ENABLED',
|
||||
onClick: () => openSms(row)
|
||||
},
|
||||
{ icon: () => h(NIcon, { component: KeyRound }), default: () => '短信登录' }
|
||||
),
|
||||
h(
|
||||
NButton,
|
||||
{ size: 'small', tertiary: true, onClick: () => openQrcode(row) },
|
||||
{
|
||||
size: 'small',
|
||||
tertiary: true,
|
||||
disabled: row.status !== 'ENABLED',
|
||||
onClick: () => openQrcode(row)
|
||||
},
|
||||
{ icon: () => h(NIcon, { component: ShieldCheck }), default: () => '认证' }
|
||||
)
|
||||
),
|
||||
canUpdateStatus.value
|
||||
? h(
|
||||
NPopconfirm,
|
||||
{
|
||||
onPositiveClick: () => updateAccountStatus(row)
|
||||
},
|
||||
{
|
||||
trigger: () =>
|
||||
h(
|
||||
NButton,
|
||||
{ size: 'small', tertiary: true, type: row.status === 'ENABLED' ? 'warning' : 'success' },
|
||||
{ default: () => (row.status === 'ENABLED' ? '禁用' : '恢复') }
|
||||
),
|
||||
default: () =>
|
||||
row.status === 'ENABLED'
|
||||
? `确认禁用数电账号 ${row.account} 吗?`
|
||||
: `确认恢复数电账号 ${row.account} 吗?`
|
||||
}
|
||||
)
|
||||
: null
|
||||
])
|
||||
}
|
||||
]
|
||||
@@ -270,6 +314,13 @@ async function createAccount() {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateAccountStatus(row: DigitalAccountItem) {
|
||||
const nextStatus = row.status === 'ENABLED' ? 'DISABLED' : 'ENABLED'
|
||||
await updateDigitalAccountStatusApi(row.id, nextStatus)
|
||||
message.success(nextStatus === 'ENABLED' ? '数电账号已恢复' : '数电账号已禁用')
|
||||
await load()
|
||||
}
|
||||
|
||||
async function openSms(row: DigitalAccountItem) {
|
||||
selected.value = row
|
||||
smsCode.value = ''
|
||||
|
||||
@@ -400,7 +400,6 @@
|
||||
style="color: #e74c3c; font-size: 12px"
|
||||
>农产品开票:销方信息代表实际的购方信息</span
|
||||
>
|
||||
<span v-else class="section-hint">不填则使用平台默认配置</span>
|
||||
</div>
|
||||
<div class="section-body">
|
||||
<n-grid item-responsive responsive="screen" cols="2 s:2 m:3 l:4 xl:5 2xl:6" :x-gap="12" :y-gap="4">
|
||||
|
||||
@@ -102,26 +102,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-section">
|
||||
<div class="detail-section-title">税务信息</div>
|
||||
<div class="detail-grid">
|
||||
<div v-for="item in taxDetailItems" :key="item.label" class="detail-item">
|
||||
<span>{{ item.label }}</span>
|
||||
<strong>{{ item.value }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-section">
|
||||
<div class="detail-section-title">银行与预设信息</div>
|
||||
<div class="detail-grid">
|
||||
<div v-for="item in presetDetailItems" :key="item.label" class="detail-item">
|
||||
<span>{{ item.label }}</span>
|
||||
<strong>{{ item.value }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-section">
|
||||
<div class="detail-section-title">系统信息</div>
|
||||
<div class="detail-grid">
|
||||
@@ -342,36 +322,6 @@ const baseDetailItems = computed(() => {
|
||||
]
|
||||
})
|
||||
|
||||
const taxDetailItems = computed(() => {
|
||||
const user = detailUser.value
|
||||
if (!user) return []
|
||||
return [
|
||||
{ label: '纳税人识别号', value: displayValue(user.taxpayerNum) },
|
||||
{ label: '数电账号', value: displayValue(user.account) },
|
||||
{ label: '身份类型', value: displayValue(user.taxIdentityType) },
|
||||
{ label: '联系人', value: displayValue(user.taxContactName) },
|
||||
{ label: '联系人电话', value: displayValue(user.taxContactPhone) },
|
||||
{ label: '联系人邮箱', value: displayValue(user.taxContactEmail) },
|
||||
{ label: '法定代表人', value: displayValue(user.taxLegalPersonName) },
|
||||
{ label: '企业名称', value: displayValue(user.taxEnterpriseName) },
|
||||
{ label: '地区编码', value: displayValue(user.taxRegionCode) },
|
||||
{ label: '城市', value: displayValue(user.taxCityName) },
|
||||
{ label: '企业地址', value: displayValue(user.taxEnterpriseAddress) },
|
||||
{ label: '税务登记证', value: displayValue(user.taxRegistrationCertificate) }
|
||||
]
|
||||
})
|
||||
|
||||
const presetDetailItems = computed(() => {
|
||||
const user = detailUser.value
|
||||
if (!user) return []
|
||||
return [
|
||||
{ label: '开户行', value: displayValue(user.bankName) },
|
||||
{ label: '银行账号', value: displayValue(user.bankAccount) },
|
||||
{ label: '预设地址', value: displayValue(user.presetAddress) },
|
||||
{ label: '预设电话', value: displayValue(user.presetPhone) }
|
||||
]
|
||||
})
|
||||
|
||||
const systemDetailItems = computed(() => {
|
||||
const user = detailUser.value
|
||||
if (!user) return []
|
||||
|
||||
@@ -36,22 +36,6 @@ export interface UserDetail {
|
||||
deletedAt?: string | null
|
||||
deletedBy?: string | null
|
||||
version: number
|
||||
taxpayerNum?: string | null
|
||||
account?: string | null
|
||||
taxIdentityType?: string | null
|
||||
taxContactName?: string | null
|
||||
taxContactPhone?: string | null
|
||||
taxContactEmail?: string | null
|
||||
taxLegalPersonName?: string | null
|
||||
taxEnterpriseName?: string | null
|
||||
taxRegionCode?: string | null
|
||||
taxCityName?: string | null
|
||||
taxEnterpriseAddress?: string | null
|
||||
taxRegistrationCertificate?: string | null
|
||||
bankName?: string | null
|
||||
bankAccount?: string | null
|
||||
presetAddress?: string | null
|
||||
presetPhone?: string | null
|
||||
}
|
||||
|
||||
export interface UserRoleBrief {
|
||||
@@ -90,10 +74,6 @@ export interface UpdateUserRequest {
|
||||
email?: string
|
||||
avatar?: string
|
||||
orgId?: string
|
||||
taxpayerNum?: string
|
||||
account?: string
|
||||
taxPassword?: string
|
||||
taxIdentityType?: string
|
||||
}
|
||||
|
||||
export interface UpdateUserStatusRequest {
|
||||
|
||||
Reference in New Issue
Block a user