粉丝管理

This commit is contained in:
zhonghua.li
2026-06-03 14:08:04 +08:00
parent 1cdea9052c
commit 4eba0ea3dc
6 changed files with 587 additions and 105 deletions

View File

@@ -0,0 +1,33 @@
import request from '@/utils/request'
export function getLbFanManagementList(params) {
return request({
url: '/lbFanManagement/list',
method: 'get',
params
})
}
export function addLbFanManagement(data) {
return request({
url: '/lbFanManagement/add',
method: 'post',
data
})
}
export function updateLbFanManagement(data) {
return request({
url: '/lbFanManagement/update',
method: 'put',
data
})
}
export function deleteLbFanManagement(idTenantId) {
return request({
url: '/lbFanManagement/delete',
method: 'delete',
params: { idTenantId }
})
}

View File

@@ -56,6 +56,142 @@ export const constantRoutes = [
}]
},
{
path: '/lb-business',
component: Layout,
redirect: '/lb-business/report-manage/daily-trade',
name: 'LbBusinessRoot',
meta: { title: '轻美业务', icon: 'el-icon-s-data', alwaysShow: true },
children: [
{
path: 'report-manage',
component: () => import('@/views/lb-business/report-manage/index'),
redirect: '/lb-business/report-manage/daily-trade',
name: 'LbReportManage',
meta: { title: '报表管理', icon: 'el-icon-s-marketing', alwaysShow: true },
children: [
{
path: 'daily-trade',
name: 'LbDailyTrade',
component: () => import('@/views/lb-business/daily-trade/index'),
meta: { title: '当天交易', icon: 'el-icon-s-order' }
},
{
path: 'daily-report',
name: 'LbDailyReport',
component: () => import('@/views/lb-business/daily-report/index'),
meta: { title: '当天报表', icon: 'el-icon-data-analysis' }
},
{
path: 'deduction-manage',
name: 'LbDeductionManage',
component: () => import('@/views/lb-business/deduction-manage/index'),
meta: { title: '抵扣金管理', icon: 'el-icon-wallet' }
}
]
},
{
path: 'department-user',
name: 'LbDepartmentUser',
component: () => import('@/views/lb-business/department-user/index'),
meta: { title: '部门人员', icon: 'el-icon-user-solid' }
},
{
path: 'purchase-assessment',
component: () => import('@/views/lb-business/purchase-assessment/index'),
redirect: '/lb-business/purchase-assessment/purchase-apply',
name: 'LbPurchaseAssessment',
meta: { title: '进货评估', icon: 'el-icon-s-claim', alwaysShow: true },
children: [
{
path: 'purchase-apply',
name: 'LbPurchaseApply',
component: () => import('@/views/lb-business/purchase-apply/index'),
meta: { title: '进货申请', icon: 'el-icon-tickets' }
},
{
path: 'assessment-apply',
name: 'LbAssessmentApply',
component: () => import('@/views/lb-business/assessment-apply/index'),
meta: { title: '评估申请', icon: 'el-icon-edit-outline' }
}
]
},
{
path: 'order-manage',
name: 'LbOrderManage',
component: () => import('@/views/lb-business/order-manage/index'),
meta: { title: '订单管理', icon: 'el-icon-s-goods' }
},
{
path: 'user-manage',
name: 'LbUserManage',
component: () => import('@/views/lb-business/user-manage/index'),
meta: { title: '用户管理', icon: 'el-icon-user' }
},
{
path: 'rush-order',
component: () => import('@/views/lb-business/rush-order/index'),
redirect: '/lb-business/rush-order/config',
name: 'LbRushOrder',
meta: { title: '抢单管理', icon: 'el-icon-s-order', alwaysShow: true },
children: [
{
path: 'config',
name: 'LbRushOrderConfig',
component: () => import('@/views/lb-business/config-manage/index'),
meta: { title: '三方配置', icon: 'el-icon-setting' }
},
{
path: 'account',
name: 'LbRushOrderAccount',
component: () => import('@/views/lb-business/rush-order-account/index'),
meta: { title: '抢单账号', icon: 'el-icon-user-solid' }
},
{
path: 'record',
name: 'LbRushOrderRecord',
component: () => import('@/views/lb-business/rush-order-record/index'),
meta: { title: '抢单记录', icon: 'el-icon-document' }
},
{
path: 'goods-package-predict',
name: 'LbGoodsPackagePredict',
component: () => import('@/views/lb-business/goods-package-predict/index'),
meta: { title: '货物包预测', icon: 'el-icon-box' }
}
]
},
{
path: 'order-add-stop',
name: 'LbOrderAddStop',
component: () => import('@/views/lb-business/order-add-stop/index'),
meta: { title: '加单停单', icon: 'el-icon-switch-button' }
},
{
path: 'agent-center',
component: () => import('@/views/lb-business/agent-center/index'),
redirect: '/lb-business/agent-center/fan-manage',
name: 'LbAgentCenter',
meta: { title: '代理商中心', icon: 'el-icon-s-shop', alwaysShow: true },
children: [
{
path: 'fan-manage',
name: 'LbFanManage',
component: () => import('@/views/lb-business/fan-manage/index'),
meta: { title: '粉丝管理', icon: 'el-icon-star-on' }
},
{
path: 'shopping-manage',
name: 'LbShoppingManage',
component: () => import('@/views/lb-business/shopping-manage/index'),
meta: { title: '购物管理', icon: 'el-icon-shopping-cart-full' }
}
]
}
]
},
{
path: '/sales',
component: Layout,
@@ -367,111 +503,6 @@ export const constantRoutes = [
}
]
},
{
path: '/lb-business',
component: Layout,
redirect: '/lb-business/report-manage/daily-trade',
name: 'LbBusinessRoot',
meta: { title: '轻美业务', icon: 'el-icon-s-data', alwaysShow: true },
children: [
{
path: 'report-manage',
component: () => import('@/views/lb-business/report-manage/index'),
redirect: '/lb-business/report-manage/daily-trade',
name: 'LbReportManage',
meta: { title: '报表管理', icon: 'el-icon-s-marketing', alwaysShow: true },
children: [
{
path: 'daily-trade',
name: 'LbDailyTrade',
component: () => import('@/views/lb-business/daily-trade/index'),
meta: { title: '当天交易', icon: 'el-icon-s-order' }
},
{
path: 'daily-report',
name: 'LbDailyReport',
component: () => import('@/views/lb-business/daily-report/index'),
meta: { title: '当天报表', icon: 'el-icon-data-analysis' }
},
{
path: 'deduction-manage',
name: 'LbDeductionManage',
component: () => import('@/views/lb-business/deduction-manage/index'),
meta: { title: '抵扣金管理', icon: 'el-icon-wallet' }
}
]
},
{
path: 'department-user',
name: 'LbDepartmentUser',
component: () => import('@/views/lb-business/department-user/index'),
meta: { title: '部门人员', icon: 'el-icon-user-solid' }
},
{
path: 'purchase-apply',
name: 'LbPurchaseApply',
component: () => import('@/views/lb-business/purchase-apply/index'),
meta: { title: '进货申请', icon: 'el-icon-tickets' }
},
{
path: 'assessment-apply',
name: 'LbAssessmentApply',
component: () => import('@/views/lb-business/assessment-apply/index'),
meta: { title: '评估申请', icon: 'el-icon-edit-outline' }
},
{
path: 'order-manage',
name: 'LbOrderManage',
component: () => import('@/views/lb-business/order-manage/index'),
meta: { title: '订单管理', icon: 'el-icon-s-goods' }
},
{
path: 'user-manage',
name: 'LbUserManage',
component: () => import('@/views/lb-business/user-manage/index'),
meta: { title: '用户管理', icon: 'el-icon-user' }
},
{
path: 'rush-order',
component: () => import('@/views/lb-business/rush-order/index'),
redirect: '/lb-business/rush-order/config',
name: 'LbRushOrder',
meta: { title: '抢单管理', icon: 'el-icon-s-order', alwaysShow: true },
children: [
{
path: 'config',
name: 'LbRushOrderConfig',
component: () => import('@/views/lb-business/config-manage/index'),
meta: { title: '三方配置', icon: 'el-icon-setting' }
},
{
path: 'account',
name: 'LbRushOrderAccount',
component: () => import('@/views/lb-business/rush-order-account/index'),
meta: { title: '抢单账号', icon: 'el-icon-user-solid' }
},
{
path: 'record',
name: 'LbRushOrderRecord',
component: () => import('@/views/lb-business/rush-order-record/index'),
meta: { title: '抢单记录', icon: 'el-icon-document' }
},
{
path: 'goods-package-predict',
name: 'LbGoodsPackagePredict',
component: () => import('@/views/lb-business/goods-package-predict/index'),
meta: { title: '货物包预测', icon: 'el-icon-box' }
}
]
},
{
path: 'order-add-stop',
name: 'LbOrderAddStop',
component: () => import('@/views/lb-business/order-add-stop/index'),
meta: { title: '加单停单', icon: 'el-icon-switch-button' }
}
]
},
{
path: '/system',

View File

@@ -0,0 +1,9 @@
<template>
<router-view />
</template>
<script>
export default {
name: 'LbAgentCenter'
}
</script>

View File

@@ -0,0 +1,378 @@
<template>
<div class="app-container">
<el-card class="filter-container" shadow="never">
<el-form :model="queryParams" :inline="true" label-width="90px">
<el-form-item label="昵称">
<el-input v-model="queryParams.nickname" clearable placeholder="请输入昵称" style="width: 160px" />
</el-form-item>
<el-form-item label="手机号">
<el-input v-model="queryParams.mobile" clearable placeholder="请输入手机号" style="width: 160px" />
</el-form-item>
<el-form-item label="分享次数">
<el-input-number
v-model="queryParams.shareNumMin"
:min="0"
:controls="false"
placeholder="最小"
style="width: 100px"
/>
<span class="range-separator">-</span>
<el-input-number
v-model="queryParams.shareNumMax"
:min="0"
:controls="false"
placeholder="最大"
style="width: 100px"
/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="createdAtRange"
type="datetimerange"
range-separator=""
start-placeholder="开始"
end-placeholder="结束"
value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00', '23:59:59']"
style="width: 360px"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-delete" @click="resetQuery">清空</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="action-container" shadow="never">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
</el-card>
<el-card class="table-container" shadow="never">
<el-table v-loading="loading" :data="list" style="width: 100%">
<el-table-column label="头像" width="72" align="center">
<template slot-scope="scope">
<el-avatar v-if="scope.row.avatar" :size="40" :src="scope.row.avatar" />
<el-avatar v-else :size="40" icon="el-icon-user-solid" />
</template>
</el-table-column>
<el-table-column label="粉丝ID" prop="id" min-width="100" show-overflow-tooltip />
<el-table-column label="昵称" prop="nickname" min-width="120" show-overflow-tooltip />
<el-table-column label="手机号" prop="mobile" min-width="120" show-overflow-tooltip />
<el-table-column label="分享次数" prop="shareNum" width="100" align="center">
<template slot-scope="scope">
{{ scope.row.shareNum == null ? '-' : scope.row.shareNum }}
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createdAt" min-width="160">
<template slot-scope="scope">
{{ formatDateTime(scope.row.createdAt) }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="140">
<template slot-scope="scope">
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="text" style="color:#F56C6C;" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="queryParams.current"
:page-size="queryParams.size"
:page-sizes="[10, 20, 50, 100]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="560px" @close="resetForm">
<el-form ref="dataForm" :model="form" :rules="formRules" label-width="100px">
<el-form-item v-if="isEdit" label="唯一ID">
<el-input v-model="form.idTenantId" disabled />
</el-form-item>
<el-form-item label="粉丝ID">
<el-input v-model="form.id" :disabled="isEdit" placeholder="选填,为空由服务端生成" />
</el-form-item>
<el-form-item label="昵称" prop="nickname">
<el-input v-model="form.nickname" placeholder="请输入昵称" />
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="form.mobile" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="头像路径">
<el-input v-model="form.avatar" placeholder="请输入头像路径或 URL" />
</el-form-item>
<el-form-item label="分享次数">
<el-input-number
v-model="form.shareNum"
:min="0"
:controls-position="right"
style="width: 100%"
placeholder="请输入分享次数"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
addLbFanManagement,
deleteLbFanManagement,
getLbFanManagementList,
updateLbFanManagement
} from '@/api/lb-fan-management'
import { getBusinessHeaders } from '@/utils/business-headers'
export default {
name: 'LbFanManage',
data() {
return {
loading: false,
submitLoading: false,
list: [],
total: 0,
createdAtRange: [],
dialogVisible: false,
dialogTitle: '',
isEdit: false,
queryParams: {
current: 1,
size: 10,
nickname: '',
mobile: '',
shareNumMin: undefined,
shareNumMax: undefined
},
form: {
idTenantId: '',
id: '',
nickname: '',
mobile: '',
avatar: '',
shareNum: undefined
},
formRules: {
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }],
mobile: [{ required: true, message: '请输入手机号', trigger: 'blur' }]
}
}
},
created() {
this.fetchList()
},
methods: {
getTenantIdFromBusinessHeaders() {
const headers = getBusinessHeaders()
const value = headers && headers['X-Tenant-Id']
return value ? String(value).trim() : ''
},
fetchList() {
this.loading = true
getLbFanManagementList(this.buildListParams())
.then((res) => {
if (res && (res.code === 20000 || res.code === 200 || res.success === true)) {
this.list = Array.isArray(res.data) ? res.data : []
this.total = typeof res.total === 'number'
? res.total
: (res.page && typeof res.page.total === 'number' ? res.page.total : this.list.length)
} else {
this.list = []
this.total = 0
}
})
.catch(() => {
this.list = []
this.total = 0
})
.finally(() => {
this.loading = false
})
},
buildListParams() {
const params = {
current: this.queryParams.current,
size: this.queryParams.size,
nickname: this.queryParams.nickname || undefined,
mobile: this.queryParams.mobile || undefined,
shareNumMin: this.queryParams.shareNumMin,
shareNumMax: this.queryParams.shareNumMax
}
const range = this.createdAtRange || []
if (range[0]) params.createdAtStart = range[0]
if (range[1]) params.createdAtEnd = range[1]
Object.keys(params).forEach((key) => {
if (params[key] === undefined || params[key] === '') delete params[key]
})
return params
},
handleQuery() {
this.queryParams.current = 1
this.fetchList()
},
resetQuery() {
this.queryParams = {
current: 1,
size: 10,
nickname: '',
mobile: '',
shareNumMin: undefined,
shareNumMax: undefined
}
this.createdAtRange = []
this.fetchList()
},
handleSizeChange(size) {
this.queryParams.size = size
this.fetchList()
},
handleCurrentChange(current) {
this.queryParams.current = current
this.fetchList()
},
handleAdd() {
this.dialogTitle = '新增粉丝'
this.isEdit = false
this.resetFormData()
this.dialogVisible = true
this.$nextTick(() => {
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
})
},
handleEdit(row) {
this.dialogTitle = '编辑粉丝'
this.isEdit = true
this.form = {
idTenantId: row.idTenantId || '',
id: row.id != null ? String(row.id) : '',
nickname: row.nickname || '',
mobile: row.mobile || '',
avatar: row.avatar || '',
shareNum: row.shareNum == null ? undefined : Number(row.shareNum)
}
this.dialogVisible = true
this.$nextTick(() => {
this.$refs.dataForm && this.$refs.dataForm.clearValidate()
})
},
handleDelete(row) {
const idTenantId = row.idTenantId
if (!idTenantId) {
this.$message.error('缺少唯一ID无法删除')
return
}
this.$confirm('确定删除这条粉丝记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => deleteLbFanManagement(idTenantId))
.then((res) => {
this.$message.success((res && res.message) || '删除成功')
this.fetchList()
})
.catch(() => {})
},
handleSubmit() {
this.$refs.dataForm.validate((valid) => {
if (!valid) return
const tenantId = this.getTenantIdFromBusinessHeaders()
if (!tenantId) {
this.$message.error('未获取到租户ID请先登录或配置业务请求头中的租户')
return
}
const payload = { ...this.buildPayload(), tenantId }
this.submitLoading = true
const req = this.isEdit ? updateLbFanManagement(payload) : addLbFanManagement(payload)
req.then((res) => {
this.$message.success((res && res.message) || (this.isEdit ? '更新成功' : '新增成功'))
this.dialogVisible = false
this.fetchList()
}).finally(() => {
this.submitLoading = false
})
})
},
buildPayload() {
const payload = {
nickname: this.form.nickname,
mobile: this.form.mobile,
avatar: this.form.avatar || undefined,
shareNum: this.form.shareNum,
id: this.normalizeFormNumber(this.form.id)
}
if (this.isEdit) {
payload.idTenantId = this.form.idTenantId || undefined
}
Object.keys(payload).forEach((key) => {
if (payload[key] === undefined || payload[key] === '') delete payload[key]
})
return payload
},
normalizeFormNumber(value) {
if (value === undefined || value === null || value === '') return undefined
const n = Number(value)
return Number.isNaN(n) ? undefined : n
},
resetForm() {
this.$refs.dataForm && this.$refs.dataForm.resetFields()
this.resetFormData()
},
resetFormData() {
this.form = {
idTenantId: '',
id: '',
nickname: '',
mobile: '',
avatar: '',
shareNum: undefined
}
},
formatDateTime(dateTime) {
if (!dateTime) return '-'
const date = new Date(String(dateTime).replace('T', ' '))
if (Number.isNaN(date.getTime())) return String(dateTime)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
.filter-container {
margin-bottom: 20px;
}
.action-container {
margin-bottom: 20px;
}
.table-container {
.el-pagination {
margin-top: 20px;
text-align: right;
}
}
.range-separator {
display: inline-block;
width: 24px;
text-align: center;
color: #909399;
}
}
</style>

View File

@@ -0,0 +1,9 @@
<template>
<router-view />
</template>
<script>
export default {
name: 'LbPurchaseAssessment'
}
</script>

View File

@@ -0,0 +1,22 @@
<template>
<div class="app-container">
<el-card shadow="never">
<div class="page-placeholder">购物管理</div>
</el-card>
</div>
</template>
<script>
export default {
name: 'LbShoppingManage'
}
</script>
<style scoped>
.page-placeholder {
padding: 40px 0;
text-align: center;
color: #909399;
font-size: 16px;
}
</style>