This commit is contained in:
liufumingren 2026-08-05 09:23:58 +08:00
parent 064635a59d
commit d11c89a54d
2 changed files with 130 additions and 0 deletions

View File

@ -114,3 +114,18 @@ export function inboxStats(direction?: string) {
isSystemApi: true
} as any)
}
/** 生成货主绑群码(inbox.bindCode) */
export function inboxBindCode(storeId: number) {
return request({
url: '/system',
method: 'post',
params: {
method: 'inbox.bindCode',
v,
timestamp: Date.now()
},
data: { storeId },
isSystemApi: true
} as any)
}

View File

@ -151,6 +151,12 @@
link
@click.stop="openPolicyDialog(row)"
>策略配置</el-button>
<el-button
size="small"
type="success"
link
@click.stop="handleGenerateBindCode(row)"
>生成加群授权码</el-button>
<el-button
v-if="row.current_subject_role === 'warehouse'"
size="small"
@ -941,6 +947,36 @@
:update-time="exportTaskProgress.updateTime"
@update:visible="exportDialogVisible = $event"
/>
<!-- 生成加群授权码弹窗 -->
<el-dialog
v-model="bindCodeDialog.visible"
title="生成加群授权码"
width="460px"
align-center
:close-on-click-modal="false"
@close="resetBindCodeDialog"
>
<div v-loading="bindCodeDialog.loading" style="padding: 10px 0">
<el-descriptions :column="1" size="small" border style="margin-bottom: 20px">
<el-descriptions-item label="货主名称">
{{ bindCodeDialog.storeName }}
</el-descriptions-item>
</el-descriptions>
<div v-if="bindCodeDialog.code" class="bind-code-display">
<div class="bind-code-label">授权码(5分钟有效)</div>
<div class="bind-code-row">
<span class="bind-code-value">{{ bindCodeDialog.code }}</span>
<el-button size="small" type="primary" @click="copyBindCode">一键复制</el-button>
</div>
</div>
</div>
<template #footer>
<el-button size="small" @click="bindCodeDialog.visible = false">关闭</el-button>
</template>
</el-dialog>
</div>
</template>
@ -970,6 +1006,7 @@ import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
import { safeInvoke } from '@/utils/safe-invoke'
import { columns as defaultColumns, availableFields as defaultAvailableFields, presetTree as defaultPresetTree, qimenFormDefault, qimenFormItems, qimenTableColumns, adjustBalanceDialogDefault, adjustBalanceFormDefault, adjustBalanceFormItems, openAccountDialogDefault, openAccountFormDefault, openAccountFormItems, storeToolbarButtons } from './store-config.ts'
import { inboxBindCode } from '@/api/inbox/inbox'
// ─── 列表 ───────────────────────────────────────────────────────────────────
const settingsStore = useSettingsStore()
@ -2361,6 +2398,53 @@ async function handleDeleteQimenConfig(config: any) {
}
}
// ─── 生成加群授权码 ────────────────────────────────────────────────────────────
const bindCodeDialog = reactive({
visible: false,
loading: false,
storeName: '',
code: '',
contractRow: null as any
})
function resetBindCodeDialog() {
bindCodeDialog.contractRow = null
bindCodeDialog.storeName = ''
bindCodeDialog.code = ''
}
async function handleGenerateBindCode(row: any) {
bindCodeDialog.contractRow = row
bindCodeDialog.storeName = row.store_name || row.remask || row.counterparty_name || ''
bindCodeDialog.code = ''
bindCodeDialog.visible = true
bindCodeDialog.loading = true
try {
const storeId = row.store_id || row.id
const res = await inboxBindCode(storeId) as any
if (res?.data?.code) {
bindCodeDialog.code = res.data.code
ElMessage.success('授权码生成成功')
} else if (res?.code === 200 && res?.data) {
bindCodeDialog.code = res.data.code || res.data
} else {
ElMessage.error(res?.message || '生成授权码失败')
}
} catch {
ElMessage.error('生成授权码失败')
} finally {
bindCodeDialog.loading = false
}
}
function copyBindCode() {
if (!bindCodeDialog.code) {
ElMessage.warning('暂无可复制的授权码')
return
}
copyText(`授权:${bindCodeDialog.code}`)
}
// ─── 初始化 ───────────────────────────────────────────────────────────────────
onMounted(loadList)
</script>
@ -2398,6 +2482,37 @@ onMounted(loadList)
font-size: 12px;
}
// ─── 加群授权码弹窗样式 ────────────────────────────────────────────────────────
.bind-code-display {
text-align: center;
padding: 16px;
background: #f5f7fa;
border-radius: 8px;
border: 1px dashed #dcdfe6;
}
.bind-code-label {
font-size: 13px;
color: #909399;
margin-bottom: 12px;
}
.bind-code-row {
display: flex;
align-items: center;
justify-content: center;
gap: 16px;
}
.bind-code-value {
font-size: 32px;
font-weight: 700;
font-family: 'Courier New', Courier, monospace;
letter-spacing: 6px;
color: #303133;
user-select: all;
}
.text-muted {
color: #c0c4cc;
}