feat(distribution): 分站发布群只使用自己的二维码池
主站单独维护分站码池,池空时不再借用主站或其他分站,并去掉已停用的固定二维码入口。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,8 +8,6 @@ import {
|
||||
DocumentCopy,
|
||||
Refresh,
|
||||
Clock,
|
||||
Picture,
|
||||
Upload,
|
||||
Coin,
|
||||
Message,
|
||||
Edit,
|
||||
@@ -33,8 +31,6 @@ import {
|
||||
type OnboardDistributionSitePayload,
|
||||
type OnboardDistributionSiteResult,
|
||||
} from '@/features/admin/api/adminDistribution'
|
||||
import { uploadAdminFile } from '@/shared/api/files'
|
||||
import AuthImage from '@/shared/components/business/AuthImage.vue'
|
||||
import { formatDateTime } from '@/shared/utils/time'
|
||||
import { readError } from '@/shared/utils/error'
|
||||
import {
|
||||
@@ -110,15 +106,6 @@ const receiveRatioForm = reactive({
|
||||
receive_cost_delta: 0,
|
||||
})
|
||||
|
||||
const qrDialogVisible = ref(false)
|
||||
const qrSubmitting = ref(false)
|
||||
const qrUploading = ref(false)
|
||||
const qrForm = reactive({
|
||||
site_id: 0,
|
||||
site_name: '',
|
||||
listing_qrcode_url: '',
|
||||
})
|
||||
|
||||
const smsDialogVisible = ref(false)
|
||||
const smsLoading = ref(false)
|
||||
const smsSubmitting = ref(false)
|
||||
@@ -204,51 +191,6 @@ async function handleReceiveRatioSubmit() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleOpenQrcode(row: DistributionSite) {
|
||||
qrForm.site_id = row.id
|
||||
qrForm.site_name = row.site_name
|
||||
qrForm.listing_qrcode_url = row.listing_qrcode_url || ''
|
||||
qrDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function uploadSiteQrcode(file: File) {
|
||||
qrUploading.value = true
|
||||
try {
|
||||
const uploaded = await uploadAdminFile(file, 'qrcode')
|
||||
qrForm.listing_qrcode_url = uploaded.url
|
||||
ElMessage.success('二维码已上传,保存后生效')
|
||||
} catch (err) {
|
||||
ElMessage.error(readError(err, '上传二维码失败'))
|
||||
} finally {
|
||||
qrUploading.value = false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function clearSiteQrcode() {
|
||||
qrForm.listing_qrcode_url = ''
|
||||
}
|
||||
|
||||
async function handleQrcodeSubmit() {
|
||||
qrSubmitting.value = true
|
||||
try {
|
||||
await updateDistributionSite(qrForm.site_id, {
|
||||
listing_qrcode_url: qrForm.listing_qrcode_url.trim(),
|
||||
})
|
||||
ElMessage.success(
|
||||
qrForm.listing_qrcode_url.trim()
|
||||
? `【${qrForm.site_name}】发布群固定二维码已更新`
|
||||
: `【${qrForm.site_name}】已清空发布群固定二维码`
|
||||
)
|
||||
qrDialogVisible.value = false
|
||||
await loadSites()
|
||||
} catch (err) {
|
||||
ElMessage.error(readError(err, '更新发布群二维码失败'))
|
||||
} finally {
|
||||
qrSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleOpenSMS(row: DistributionSite) {
|
||||
smsForm.site_id = row.id
|
||||
smsForm.site_name = row.site_name
|
||||
@@ -676,8 +618,8 @@ onMounted(() => {
|
||||
<div>
|
||||
<h2 class="page-title">分销站点管理</h2>
|
||||
<p class="page-subtitle">
|
||||
开通分销站、配置结算冷却期、收号比例上限与发布群固定二维码。利润按 35% 收号 / 40% 卖出 /
|
||||
25% 服务费切分。
|
||||
开通分销站、配置结算冷却期与收号比例上限。发布群进群码在「分站二维码池」按站点维护。利润按
|
||||
35% 收号 / 40% 卖出 / 25% 服务费切分。
|
||||
</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
@@ -811,18 +753,6 @@ onMounted(() => {
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="发布群二维码" width="120" align="center">
|
||||
<template #default="{ row }">
|
||||
<AuthImage
|
||||
v-if="row.listing_qrcode_url"
|
||||
:source="row.listing_qrcode_url"
|
||||
fit="cover"
|
||||
:image-style="{ width: '48px', height: '48px', borderRadius: '6px' }"
|
||||
:preview-src-list="[row.listing_qrcode_url]"
|
||||
/>
|
||||
<el-tag v-else type="info" size="small">未配置</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="created_at" min-width="160">
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.created_at) }}
|
||||
@@ -854,9 +784,6 @@ onMounted(() => {
|
||||
<el-dropdown-item :icon="Coin" @click="handleOpenReceiveRatio(row)">
|
||||
收号比例
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :icon="Picture" @click="handleOpenQrcode(row)">
|
||||
发布二维码
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :icon="Message" @click="handleOpenSMS(row)">
|
||||
短信配置
|
||||
</el-dropdown-item>
|
||||
@@ -1089,58 +1016,6 @@ onMounted(() => {
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 发布群固定二维码 -->
|
||||
<el-dialog v-model="qrDialogVisible" title="发布群固定二维码" width="520px" destroy-on-close>
|
||||
<el-alert
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
title="号主在该分站上传账号后,会把这张固定二维码发到对应发布群。同一分站可重复使用,不消耗主站二维码池。"
|
||||
style="margin-bottom: 16px"
|
||||
/>
|
||||
<el-form label-width="110px">
|
||||
<el-form-item label="分销站点">
|
||||
<el-input :model-value="qrForm.site_name" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="固定二维码">
|
||||
<div class="qr-row">
|
||||
<AuthImage
|
||||
v-if="qrForm.listing_qrcode_url"
|
||||
:source="qrForm.listing_qrcode_url"
|
||||
fit="contain"
|
||||
:image-style="{
|
||||
width: '160px',
|
||||
height: '160px',
|
||||
borderRadius: '12px',
|
||||
background: '#f7f9fc',
|
||||
}"
|
||||
:preview-src-list="[qrForm.listing_qrcode_url]"
|
||||
/>
|
||||
<div v-else class="qr-empty">尚未配置</div>
|
||||
<div class="qr-actions">
|
||||
<el-upload
|
||||
:show-file-list="false"
|
||||
accept="image/*"
|
||||
:disabled="qrUploading"
|
||||
:before-upload="uploadSiteQrcode"
|
||||
>
|
||||
<el-button :icon="Upload" :loading="qrUploading">上传二维码</el-button>
|
||||
</el-upload>
|
||||
<el-button :disabled="!qrForm.listing_qrcode_url" @click="clearSiteQrcode">
|
||||
清空
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="qrDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="qrSubmitting" @click="handleQrcodeSubmit">
|
||||
保存设置
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 短信配置对话框 -->
|
||||
<el-dialog
|
||||
v-model="smsDialogVisible"
|
||||
@@ -1457,29 +1332,4 @@ onMounted(() => {
|
||||
color: #6b7280;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.qr-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.qr-empty {
|
||||
width: 160px;
|
||||
height: 160px;
|
||||
border-radius: 12px;
|
||||
background: #f7f9fc;
|
||||
color: #9ca3af;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.qr-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user