This commit is contained in:
雷欧(林平凡)
2025-08-15 18:01:05 +08:00
parent 5f2fbe3412
commit 5508c72442
11 changed files with 916 additions and 174 deletions

View File

@@ -10,5 +10,5 @@ VUE_APP_BASE_API = ''
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
VUE_APP_BASE_API = 'http://127.0.0.1:30313'
VUE_APP_BASE_API = 'http://134.175.126.60:30313'
port = 8888

10
src/api/system/jdorder.js Normal file
View File

@@ -0,0 +1,10 @@
import request from '@/utils/request'
// 一键转链
export function generatePromotionContent(data) {
return request({
url: '/jarvis/jdorder/generatePromotionContent',
method: 'post',
data: data
})
}

61
src/api/system/xbgroup.js Normal file
View File

@@ -0,0 +1,61 @@
import request from '@/utils/request'
// 查询线报群列表
export function listXbgroup(query) {
return request({
url: '/jarvis/xbgroup/list',
method: 'get',
params: query
})
}
// 查询线报群详细
export function getXbgroup(groupId) {
return request({
url: '/jarvis/xbgroup/' + groupId,
method: 'get'
})
}
// 新增线报群
export function addXbgroup(data) {
return request({
url: '/jarvis/xbgroup',
method: 'post',
data: data
})
}
// 修改线报群
export function updateXbgroup(data) {
return request({
url: '/jarvis/xbgroup',
method: 'put',
data: data
})
}
// 删除线报群
export function delXbgroup(groupId) {
return request({
url: '/jarvis/xbgroup/' + groupId,
method: 'delete'
})
}
// 导出线报群
export function exportXbgroup(query) {
return request({
url: '/jarvis/xbgroup/export',
method: 'get',
params: query
})
}
// 获取群类型下拉选项
export function getGroupTypeOptions() {
return request({
url: '/jarvis/xbgroup/select/groupType',
method: 'get'
})
}

View File

@@ -42,3 +42,11 @@ export function delXbmessage(messageId) {
method: 'delete'
})
}
// 获取群名称列表
export function getGroupNameOptions() {
return request({
url: '/jarvis/xbgroup/select/groupName',
method: 'get'
})
}

View File

@@ -5,7 +5,7 @@
:current-page.sync="currentPage"
:page-size.sync="pageSize"
:layout="layout"
:page-sizes="[10, 50, 100, 200,1]"
:page-sizes="[15, 50, 100, 200,1]"
:pager-count="pagerCount"
:total="total"
v-bind="$attrs"
@@ -31,12 +31,12 @@ export default {
},
limit: {
type: Number,
default: 20
default: 15
},
pageSizes: {
type: Array,
default() {
return [10, 20, 30, 50]
return [15, 50, 100, 200,1]
}
},
// 移动端页码按钮的数量端默认值5

View File

@@ -7,17 +7,9 @@
<div class="right-menu">
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip content="文档地址" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip>
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<!-- <screenfull id="screenfull" class="right-menu-item hover-effect" /> -->
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />

View File

@@ -116,6 +116,52 @@ export const constantRoutes = [
}
]
},
{
path: '/message',
component: Layout,
redirect: 'noredirect',
name: 'Message',
meta: { title: '线报消息', icon: 'message' },
children: [
{
path: 'index',
component: () => import('@/views/system/xbmessage/index'),
name: 'MessageIndex',
meta: { title: '线报消息', icon: 'list' }
}
]
},
{
path: '/xbgroup',
component: Layout,
redirect: 'noredirect',
name: 'Xbgroup',
meta: { title: '线报群管理', icon: 'peoples' },
children: [
{
path: 'index',
component: () => import('@/views/system/xbgroup/index'),
name: 'XbgroupIndex',
meta: { title: '线报群列表', icon: 'list' }
}
]
},
{
path: '/jdorder',
component: Layout,
redirect: 'noredirect',
name: 'Jdorder',
meta: { title: '一键转链', icon: 'link' },
children: [
{
path: 'index',
component: () => import('@/views/system/jdorder/index'),
name: 'JdorderIndex',
meta: { title: '转链工具', icon: 'tool' }
}
]
},
{
path: '/system',
component: Layout,
@@ -128,15 +174,9 @@ export const constantRoutes = [
component: () => import('@/views/system/superadmin/index'),
name: 'Superadmin',
meta: { title: '超级管理员', icon: 'user' }
},
{
path: 'xbmessage',
component: () => import('@/views/system/xbmessage/index'),
name: 'Xbmessage',
meta: { title: '消息管理', icon: 'message' }
}
]
}
},
]
// 动态路由,基于用户权限动态去加载

View File

@@ -17,7 +17,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 10000
timeout: 600000
})
// request拦截器

View File

@@ -0,0 +1,281 @@
<template>
<div class="app-container">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>一键转链</span>
</div>
<el-form :model="form" label-width="120px">
<el-form-item label="输入内容">
<el-input
v-model="form.inputContent"
type="textarea"
:rows="6"
placeholder="请输入需要转链的内容,如商品链接、商品名称等"
style="width: 100%"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleGenerate" :loading="loading">
生成转链内容
</el-button>
<el-button @click="handleClear">清空</el-button>
</el-form-item>
</el-form>
<div v-if="result" style="margin-top: 20px;">
<h4>转链结果</h4>
<!-- 商品列表 -->
<div v-if="parsedResult && Array.isArray(parsedResult) && parsedResult.length > 0" style="margin-bottom: 20px;">
<h5>商品列表 ({{ parsedResult.length }}个商品)</h5>
<el-tabs v-model="activeProductTab" type="card">
<el-tab-pane
v-for="(product, productIndex) in parsedResult"
:key="productIndex"
:label="`商品${productIndex + 1}`"
:name="productIndex"
>
<!-- 商品基本信息 -->
<el-descriptions :column="2" border style="margin-bottom: 20px;">
<el-descriptions-item label="商品名称">{{ product.skuName || '-' }}</el-descriptions-item>
<el-descriptions-item label="店铺">{{ product.shopName || '-' }}</el-descriptions-item>
<el-descriptions-item label="佣金">¥{{ product.commission || '-' }}</el-descriptions-item>
<el-descriptions-item label="佣金比例">{{ product.commissionShare || '-' }}%</el-descriptions-item>
<el-descriptions-item label="SPUID">{{ product.spuid || '-' }}</el-descriptions-item>
<el-descriptions-item label="商品链接">
<a :href="product.url || '#'" target="_blank" style="color: #409EFF;">{{ product.url || '-' }}</a>
</el-descriptions-item>
</el-descriptions>
<!-- 文案版本 -->
<div v-if="product.wenan && Array.isArray(product.wenan) && product.wenan.length > 0" style="margin-bottom: 20px;">
<h6>文案版本 ({{ product.wenan.length }})</h6>
<el-tabs v-model="activeWenanTab[productIndex]" type="border-card">
<el-tab-pane
v-for="(wenan, wenanIndex) in product.wenan"
:key="wenanIndex"
:label="wenan.type || `版本${wenanIndex + 1}`"
:name="wenanIndex"
>
<el-input
:value="wenan.content || ''"
type="textarea"
:rows="8"
readonly
style="width: 100%"
/>
<div style="margin-top: 10px;">
<el-button type="success" @click="handleCopyText(wenan.content || '')">复制此版本</el-button>
</div>
</el-tab-pane>
</el-tabs>
</div>
<!-- 商品图片 -->
<div v-if="product.images && Array.isArray(product.images) && product.images.length > 0" style="margin-bottom: 20px;">
<h6>商品图片 ({{ product.images.length }})</h6>
<div style="display: flex; flex-wrap: wrap; gap: 10px;">
<div
v-for="(image, imageIndex) in product.images"
:key="imageIndex"
style="text-align: center;"
>
<img
:src="image"
:alt="`商品${productIndex + 1}图片${imageIndex + 1}`"
style="width: 120px; height: 120px; object-fit: cover; border: 1px solid #ddd; border-radius: 4px;"
@click="handlePreviewImage(image)"
/>
<div style="margin-top: 5px; font-size: 12px; color: #666;">
<el-button type="text" size="mini" @click="handleCopyImageUrl(image)">复制链接</el-button>
</div>
</div>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
<!-- 原始数据 -->
<div style="margin-top: 20px;">
<h5>原始数据</h5>
<el-input
:value="result"
type="textarea"
:rows="6"
readonly
style="width: 100%"
/>
<div style="margin-top: 10px;">
<el-button type="success" @click="handleCopy">复制原始数据</el-button>
</div>
</div>
</div>
</el-card>
</div>
</template>
<script>
import { generatePromotionContent } from "@/api/system/jdorder";
export default {
name: "Jdorder",
data() {
return {
form: {
inputContent: ""
},
loading: false,
result: "",
parsedResult: {},
// 当前选中的商品
activeProductTab: 0,
// 每个商品的文案标签页状态
activeWenanTab: {}
};
},
methods: {
handleGenerate() {
if (!this.form.inputContent.trim()) {
this.$modal.msgError("请输入需要转链的内容");
return;
}
this.loading = true;
generatePromotionContent({
promotionContent: this.form.inputContent.trim()
}).then(response => {
this.loading = false;
if (response.code === 200) {
this.result = response.msg || response.data || "转链成功";
try {
if (typeof this.result === 'string') {
this.parsedResult = JSON.parse(this.result);
} else {
this.parsedResult = this.result;
}
// 初始化每个商品的文案标签页状态
if (Array.isArray(this.parsedResult)) {
this.parsedResult.forEach((_, index) => {
this.$set(this.activeWenanTab, index, 0);
});
}
} catch (e) {
console.log('数据解析失败,使用原始数据');
this.parsedResult = {};
}
this.$modal.msgSuccess("转链内容生成成功");
} else {
this.$modal.msgError(response.msg || "转链失败");
}
}).catch(error => {
this.loading = false;
console.error('转链失败:', error);
this.$modal.msgError("转链失败,请稍后重试");
});
},
handleClear() {
this.form.inputContent = "";
this.result = "";
this.parsedResult = {};
this.activeProductTab = 0;
this.activeWenanTab = {};
},
handleCopy() {
if (this.result) {
if (navigator.clipboard) {
navigator.clipboard.writeText(this.result).then(() => {
this.$modal.msgSuccess("复制成功");
}).catch(() => {
this.fallbackCopy();
});
} else {
this.fallbackCopy();
}
}
},
fallbackCopy() {
const textArea = document.createElement("textarea");
textArea.value = this.result;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
this.$modal.msgSuccess("复制成功");
} catch (err) {
this.$modal.msgError("复制失败");
}
document.body.removeChild(textArea);
},
handleCopyText(text) {
if (text) {
if (navigator.clipboard) {
navigator.clipboard.writeText(text).then(() => {
this.$modal.msgSuccess("复制成功");
}).catch(() => {
this.fallbackCopyText(text);
});
} else {
this.fallbackCopyText(text);
}
}
},
fallbackCopyText(text) {
const textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
this.$modal.msgSuccess("复制成功");
} catch (err) {
this.$modal.msgError("复制失败");
}
document.body.removeChild(textArea);
},
handleCopyImageUrl(imageUrl) {
if (imageUrl) {
if (navigator.clipboard) {
navigator.clipboard.writeText(imageUrl).then(() => {
this.$modal.msgSuccess("图片链接复制成功");
}).catch(() => {
this.fallbackCopyText(imageUrl);
});
} else {
this.fallbackCopyText(imageUrl);
}
}
},
handlePreviewImage(imageUrl) {
window.open(imageUrl, '_blank');
}
}
};
</script>
<style scoped>
.box-card {
margin: 20px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both;
}
</style>

View File

@@ -0,0 +1,335 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="群名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入群名称" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="群类型" prop="groupType">
<el-select v-model="queryParams.groupType" placeholder="请选择群类型" clearable style="width: 240px">
<el-option
v-for="item in groupTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="isActive">
<el-select v-model="queryParams.isActive" placeholder="请选择状态" clearable style="width: 240px">
<el-option label="启用" value="1" />
<el-option label="禁用" value="0" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" >新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" >删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" >导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="xbgroupList" @selection-change="handleSelectionChange" highlight-current-row>
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="群名称" align="left" prop="name" :show-overflow-tooltip="true" min-width="200">
<template slot-scope="scope">
<span>{{ decodeUnicode(scope.row.name) }}</span>
</template>
</el-table-column>
<el-table-column label="微信ID" align="center" prop="wxid" width="240" />
<el-table-column label="群类型" align="center" prop="groupTypeName" width="120">
</el-table-column>
<el-table-column label="状态" align="center" prop="isActive" width="100">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isActive"
:active-value="1"
:inactive-value="0"
@change="handleStatusChange(scope.row)"
v-hasPermi="['system:xbgroup:edit']"
></el-switch>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createDate" width="180">
<template slot-scope="scope">
<span>{{ scope.row.createDate ? parseTime(scope.row.createDate) : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updateDate" width="180">
<template slot-scope="scope">
<span>{{ scope.row.updateDate ? parseTime(scope.row.updateDate) : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:xbgroup:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:xbgroup:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改线报群对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="群名称" prop="name">
<el-input v-model="form.name" placeholder="请输入群名称" />
</el-form-item>
<el-form-item label="微信ID" prop="wxid">
<el-input v-model="form.wxid" placeholder="请输入微信ID" />
</el-form-item>
<el-form-item label="群类型" prop="groupType">
<el-select v-model="form.groupType" placeholder="请选择群类型" style="width: 100%">
<el-option
v-for="item in groupTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="isActive">
<el-select v-model="form.isActive" placeholder="请选择状态" style="width: 100%">
<el-option label="启用" :value="1" />
<el-option label="禁用" :value="0" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listXbgroup, getXbgroup, delXbgroup, addXbgroup, updateXbgroup, getGroupTypeOptions } from "@/api/system/xbgroup";
export default {
name: "Xbgroup",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 线报群表格数据
xbgroupList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
groupType: null,
isActive: null
},
// 表单参数
form: {},
// 群类型选项
groupTypeOptions: [],
// 表单校验
rules: {
name: [
{ required: true, message: "群名称不能为空", trigger: "blur" }
],
groupType: [
{ required: true, message: "群类型不能为空", trigger: "change" }
],
wxid: [
{ required: true, message: "微信ID不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询线报群列表 */
getList() {
this.loading = true;
listXbgroup(this.queryParams).then(response => {
this.xbgroupList = response.rows;
this.total = response.total;
this.loading = false;
// 列表加载成功后,再获取群类型选项
this.getGroupTypeOptions();
}).catch(error => {
console.error('获取列表失败:', error);
this.loading = false;
});
},
/** 获取群类型选项 */
getGroupTypeOptions() {
getGroupTypeOptions().then(response => {
this.groupTypeOptions = response.data || [];
}).catch(error => {
console.error('获取群类型选项失败:', error);
this.groupTypeOptions = [];
});
},
/** 解码Unicode字符 */
decodeUnicode(str) {
if (!str || typeof str !== 'string') return str;
try {
return str.replace(/\\u([0-9a-fA-F]{4})/g, (match, hex) => {
return String.fromCharCode(parseInt(hex, 16));
});
} catch (e) {
return str;
}
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
wxid: null,
groupType: null,
isActive: 1
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加线报群";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const groupId = row.id || this.ids[0];
if (!groupId) {
this.$modal.msgError("无法获取群组ID");
return;
}
getXbgroup(groupId).then(response => {
// 确保数据类型正确
this.form = {
...response.data,
isActive: parseInt(response.data.isActive) || 1
};
this.open = true;
this.title = "修改线报群";
}).catch(error => {
console.error("获取群组详情失败:", error);
this.$modal.msgError("获取群组详情失败");
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateXbgroup(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addXbgroup(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const groupIds = row.id || this.ids;
this.$modal.confirm('是否确认删除线报群编号为"' + groupIds + '"的数据项?').then(function() {
return delXbgroup(groupIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 状态修改 */
handleStatusChange(row) {
let text = row.isActive === 1 ? "启用" : "禁用";
this.$modal.confirm('确认要"' + text + '""' + row.name + '"线报群吗?').then(() => {
return updateXbgroup(row);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
// 状态修改成功后刷新列表
this.getList();
}).catch(() => {
// 失败时回滚状态
row.isActive = row.isActive === 1 ? 0 : 1;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/xbgroup/export', {
...this.queryParams
}, `xbgroup_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style scoped>
.mb8 {
margin-bottom: 8px;
}
</style>

View File

@@ -1,7 +1,7 @@
<template>
<div class="app-container">
<!-- 数据统计卡片 -->
<el-row :gutter="20" class="mb20" v-if="statistics">
<!-- <el-row :gutter="20" class="mb20" v-if="statistics">
<el-col :span="6">
<el-card shadow="hover">
<div class="statistics-card">
@@ -20,7 +20,7 @@
</el-col>
</el-row>
</el-row> -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="消息内容" prop="content">
@@ -33,12 +33,6 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:xbmessage:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:xbmessage:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:xbmessage:remove']">删除</el-button>
</el-col>
@@ -48,28 +42,51 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="xbmessageList" @selection-change="handleSelectionChange" row-key="id" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table v-loading="loading" :data="xbmessageList" @selection-change="handleSelectionChange" @row-click="handleRowClick" highlight-current-row>
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="首行" prop="firstLine" :show-overflow-tooltip="true" min-width="260" />
<el-table-column label="首个商品" prop="firstSkuName" :show-overflow-tooltip="true" min-width="220" />
<el-table-column label="首价" prop="firstPrice" width="120" align="center" />
<el-table-column label="商品数" width="100" align="center">
<el-table-column label="首行" prop="firstLine" :show-overflow-tooltip="true" min-width="180">
<template slot-scope="scope">
<el-tag v-if="scope.row.children && scope.row.children.length > 0" type="success" size="mini">
{{ scope.row.children.length }}
<span>{{ decodeUnicode(scope.row.firstLine) }}</span>
</template>
</el-table-column>
<el-table-column label="线报商品" prop="firstSkuName" :show-overflow-tooltip="true" min-width="480">
<template slot-scope="scope">
<span>{{ decodeUnicode(scope.row.firstSkuName) }}</span>
</template>
</el-table-column>
<el-table-column label="线报价格" prop="firstPrice" width="100" align="center" />
<el-table-column label="线报商品数" width="80" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.childrenCount > 0" type="success" size="mini">
{{ scope.row.childrenCount }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="店铺信息" width="200" align="left">
<template slot-scope="scope">
<div v-if="scope.row.children && scope.row.children.length > 0">
<span v-html="parseOwner(scope.row.children[0].owner)"></span>-
<span v-if="scope.row.children[0].jsonShopInfo">{{ decodeUnicode(getJsonValue(scope.row.children[0].jsonShopInfo, 'shopName')) || '-' }}</span>
<span v-else>-</span>
</div>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="线报群" prop="fromWxid" width="240" align="center">
<template slot-scope="scope">
<span>{{ getGroupName(scope.row.fromWxid) || scope.row.fromWxid || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="线报时间" prop="createDate" width="180" align="center">
<template slot-scope="scope">
<span>{{ scope.row.createDate ? parseTime(scope.row.createDate) : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-info" @click="showMessageDetail(scope.row)">详情</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:xbmessage:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:xbmessage:remove']">删除</el-button>
</template>
</el-table-column>
@@ -83,50 +100,42 @@
@pagination="getList"
/>
<!-- 添加或修改消息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="消息类型" prop="type">
<el-input v-model="form.type" placeholder="请输入消息类型" />
</el-form-item>
<el-form-item label="消息内容" prop="content">
<el-input v-model="form.content" type="textarea" placeholder="请输入消息内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 子消息详情对话框 -->
<el-dialog title="子消息详情" :visible.sync="childDetailVisible" width="900px" append-to-body>
<el-dialog title="商品详情" :visible.sync="childDetailVisible" width="1200px" append-to-body>
<div v-if="currentChild">
<el-descriptions :column="2" border>
<el-descriptions-item label="ID">{{ currentChild.id }}</el-descriptions-item>
<el-descriptions-item label="商品名称">{{ currentChild.skuName || '-' }}</el-descriptions-item>
<el-descriptions-item label="店铺名称">{{ decodeUnicode(getJsonValue(currentChild.jsonQueryResult, 'shopInfo.shopName')) || '-' }}</el-descriptions-item>
<el-descriptions-item label="商品名称">{{ decodeUnicode(currentChild.skuName) || '-' }}</el-descriptions-item>
<el-descriptions-item label="价格">{{ currentChild.firstPrice ? `¥${currentChild.firstPrice}` : '-' }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ currentChild.createDate ? parseTime(currentChild.createDate) : '-' }}</el-descriptions-item>
<el-descriptions-item label="SPUID">{{ currentChild.spuid || '-' }}</el-descriptions-item>
<el-descriptions-item label="所有者">{{ currentChild.owner || '-' }}</el-descriptions-item>
<el-descriptions-item label="所有者"></el-descriptions-item>
</el-descriptions>
<!-- 商品查询结果 -->
<div v-if="currentChild.jsonQueryResult" style="margin-top: 20px;">
<h4>商品查询结果</h4>
<el-descriptions :column="1" border>
<el-descriptions-item label="品牌">{{ getJsonValue(currentChild.jsonQueryResult, 'brandName') || '-' }}</el-descriptions-item>
<el-descriptions-item label="分类">{{ getCategoryPath(currentChild.jsonQueryResult) || '-' }}</el-descriptions-item>
<el-descriptions-item label="评论数">{{ getJsonValue(currentChild.jsonQueryResult, 'comments') || '-' }}</el-descriptions-item>
<el-descriptions-item label="好评率">{{ getJsonValue(currentChild.jsonQueryResult, 'goodCommentsShare') ? `${getJsonValue(currentChild.jsonQueryResult, 'goodCommentsShare')}%` : '-' }}</el-descriptions-item>
<el-descriptions-item label="30天订单数">{{ getJsonValue(currentChild.jsonQueryResult, 'inOrderCount30Days') || '-' }}</el-descriptions-item>
<el-descriptions-item label="是否热门">{{ getJsonValue(currentChild.jsonQueryResult, 'isHot') ? '是' : '否' }}</el-descriptions-item>
<el-descriptions-item label="是否京东自营">{{ getJsonValue(currentChild.jsonQueryResult, 'isJdSale') ? '是' : '否' }}</el-descriptions-item>
<!-- 佣金信息 -->
<div v-if="currentChild.jsonQueryResult" style="margin-top: 20px;">
<h4>佣金信息</h4>
<el-descriptions :column="2" border>
<el-descriptions-item label="佣金">{{ getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.commission') ? `¥${getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.commission')}` : '-' }}</el-descriptions-item>
<el-descriptions-item label="佣金比例">{{ getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.commissionShare') ? `${getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.commissionShare')}%` : '-' }}</el-descriptions-item>
<el-descriptions-item label="券佣金">{{ getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.couponCommission') ? `¥${getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.couponCommission')}` : '-' }}</el-descriptions-item>
<el-descriptions-item label="PLUS佣金比例">{{ getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.plusCommissionShare') ? `${getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.plusCommissionShare')}%` : '-' }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 商品查询结果 -->
<!-- <div v-if="currentChild.jsonQueryResult" style="margin-top: 20px;">
<h4>商品查询结果</h4>
<el-descriptions :column="1" border>
<el-descriptions-item label="品牌">{{ decodeUnicode(getJsonValue(currentChild.jsonQueryResult, 'brandName')) || '-' }}</el-descriptions-item>
<el-descriptions-item label="分类">{{ decodeUnicode(getCategoryPath(currentChild.jsonQueryResult)) || '-' }}</el-descriptions-item>
<el-descriptions-item label="评论数">{{ getJsonValue(currentChild.jsonQueryResult, 'comments') || '-' }}</el-descriptions-item>
<el-descriptions-item label="好评率">{{ getJsonValue(currentChild.jsonQueryResult, 'goodCommentsShare') ? `${getJsonValue(currentChild.jsonQueryResult, 'goodCommentsShare')}%` : '-' }}</el-descriptions-item>
<el-descriptions-item label="30天订单数">{{ getJsonValue(currentChild.jsonQueryResult, 'inOrderCount30Days') || '-' }}</el-descriptions-item>
<el-descriptions-item label="是否热门">{{ getJsonValue(currentChild.jsonQueryResult, 'isHot') ? '是' : '否' }}</el-descriptions-item>
<el-descriptions-item label="是否京东自营">{{ getJsonValue(currentChild.jsonQueryResult, 'isJdSale') ? '是' : '否' }}</el-descriptions-item>
</el-descriptions>
</div> -->
<!-- 价格信息 -->
<div v-if="currentChild.jsonQueryResult" style="margin-top: 20px;">
@@ -139,27 +148,17 @@
</el-descriptions>
</div>
<!-- 佣金信息 -->
<div v-if="currentChild.jsonQueryResult" style="margin-top: 20px;">
<h4>佣金信息</h4>
<el-descriptions :column="2" border>
<el-descriptions-item label="佣金">{{ getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.commission') ? `¥${getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.commission')}` : '-' }}</el-descriptions-item>
<el-descriptions-item label="佣金比例">{{ getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.commissionShare') ? `${getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.commissionShare')}%` : '-' }}</el-descriptions-item>
<el-descriptions-item label="券佣金">{{ getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.couponCommission') ? `¥${getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.couponCommission')}` : '-' }}</el-descriptions-item>
<el-descriptions-item label="PLUS佣金比例">{{ getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.plusCommissionShare') ? `${getJsonValue(currentChild.jsonQueryResult, 'commissionInfo.plusCommissionShare')}%` : '-' }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 店铺信息 -->
<div v-if="currentChild.jsonQueryResult" style="margin-top: 20px;">
<!-- <div v-if="currentChild.jsonQueryResult" style="margin-top: 20px;">
<h4>店铺信息</h4>
<el-descriptions :column="2" border>
<el-descriptions-item label="店铺ID">{{ getJsonValue(currentChild.jsonQueryResult, 'shopInfo.shopId') || '-' }}</el-descriptions-item>
<el-descriptions-item label="店铺名称">{{ getJsonValue(currentChild.jsonQueryResult, 'shopInfo.shopName') || '-' }}</el-descriptions-item>
<el-descriptions-item label="店铺等级">{{ getJsonValue(currentChild.jsonQueryResult, 'shopInfo.shopLevel') || '-' }}</el-descriptions-item>
<el-descriptions-item label="店铺标签">{{ getJsonValue(currentChild.jsonQueryResult, 'shopInfo.shopLabel') || '-' }}</el-descriptions-item>
<el-descriptions-item label="店铺标签">{{ decodeUnicode(getJsonValue(currentChild.jsonQueryResult, 'shopInfo.shopLabel')) || '-' }}</el-descriptions-item>
</el-descriptions>
</div>
</div> -->
<!-- 优惠券信息 -->
<div v-if="currentChild.jsonCouponList && currentChild.jsonCouponList !== '[]'" style="margin-top: 20px;">
@@ -202,42 +201,66 @@
</el-dialog>
<!-- 消息详情对话框 -->
<el-dialog title="消息详情" :visible.sync="messageDetailVisible" width="900px" append-to-body>
<el-dialog title="消息详情" :visible.sync="messageDetailVisible" width="1600px" append-to-body>
<div v-if="currentMessageDetail">
<el-descriptions :column="2" border>
<el-descriptions-item label="消息ID">{{ currentMessageDetail.id }}</el-descriptions-item>
<el-descriptions :column="3" border>
<el-descriptions-item label="创建时间">{{ currentMessageDetail.createDate ? parseTime(currentMessageDetail.createDate) : '-' }}</el-descriptions-item>
<el-descriptions-item label="来源微信ID">{{ currentMessageDetail.fromWxid || '-' }}</el-descriptions-item>
<el-descriptions-item label="SKUID">{{ currentMessageDetail.skuid || '-' }}</el-descriptions-item>
<el-descriptions-item label="线报群名称">{{ getGroupName(currentMessageDetail.fromWxid) || '-' }}</el-descriptions-item>
<!-- <el-descriptions-item label="SKUID">{{ currentMessageDetail.skuid || '-' }}</el-descriptions-item> -->
</el-descriptions>
<!-- 原始消息内容 -->
<div style="margin-top: 20px;">
<h4>原始消息内容</h4>
<h4 style="font-size: 18px; font-weight: bold; color: #303133;">原始消息内容</h4>
<el-input
type="textarea"
:rows="8"
v-model="currentMessageDetail.tipOriginalMessage"
:value="decodeUnicode(currentMessageDetail.tipOriginalMessage)"
readonly
placeholder="暂无消息内容"
style="font-size: 18px; font-weight: bold;"
class="original-message-content"
/>
</div>
<!-- 子消息列表 -->
<div v-if="currentMessageDetail.children && currentMessageDetail.children.length > 0" style="margin-top: 20px;">
<h4>子消息列表 ({{ currentMessageDetail.children.length }})</h4>
<el-table :data="currentMessageDetail.children" border style="width: 100%" max-height="400">
<el-table-column label="ID" align="center" prop="id" width="80" />
<el-table-column label="商品名称" align="left" prop="skuName" :show-overflow-tooltip="true" min-width="200" />
<el-table-column label="价格" align="center" prop="firstPrice" width="100">
<el-table :data="currentMessageDetail.children" border style="width: 100%" max-height="400" @row-click="handleChildRowClick" highlight-current-row>
<el-table-column label="商品名称" align="left" prop="skuName" :show-overflow-tooltip="true" min-width="250">
<template slot-scope="scope">
<span>{{ decodeUnicode(scope.row.skuName) }}</span>
</template>
</el-table-column>
<el-table-column label="价格" align="center" prop="firstPrice" width="120">
<template slot-scope="scope">
<span v-if="scope.row.firstPrice">¥{{ scope.row.firstPrice }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="商品详情" align="left" min-width="300">
<el-table-column label="店铺名称" align="center" width="150">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="showChildDetail(scope.row)">查看详情</el-button>
<span v-html="parseOwner(scope.row.owner)"></span>-
<span v-if="scope.row.jsonQueryResult">{{ decodeUnicode(getJsonValue(scope.row.jsonQueryResult, 'shopInfo.shopName')) || '-' }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="佣金比例" align="center" width="80">
<template slot-scope="scope">
<span v-if="scope.row.jsonQueryResult && getJsonValue(scope.row.jsonQueryResult, 'commissionInfo.commissionShare')">{{ getJsonValue(scope.row.jsonQueryResult, 'commissionInfo.commissionShare') }}%</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="佣金" align="center" width="120">
<template slot-scope="scope">
<span v-if="scope.row.jsonQueryResult && getJsonValue(scope.row.jsonQueryResult, 'commissionInfo.commission')">¥{{ getJsonValue(scope.row.jsonQueryResult, 'commissionInfo.commission') }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-info" @click.stop="showChildDetail(scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table>
@@ -252,7 +275,7 @@
</template>
<script>
import { listXbmessage, getXbmessage, delXbmessage, addXbmessage, updateXbmessage } from "@/api/system/xbmessage";
import { listXbmessage, delXbmessage, getGroupNameOptions } from "@/api/system/xbmessage";
import { parseTime } from "@/utils/ruoyi";
export default {
@@ -263,8 +286,6 @@ export default {
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
@@ -273,29 +294,12 @@ export default {
total: 0,
// 消息表格数据
xbmessageList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
id: null,
type: null,
content: null
},
// 表单参数
form: {},
// 表单校验
rules: {
type: [
{ required: true, message: "消息类型不能为空", trigger: "blur" }
],
content: [
{ required: true, message: "消息内容不能为空", trigger: "blur" }
]
},
// 子消息详情对话框
childDetailVisible: false,
// 当前查看的子消息
@@ -305,11 +309,14 @@ export default {
// 当前查看的消息详情
currentMessageDetail: {},
// 统计数据
statistics: null
statistics: null,
// 群名称选项
groupNameOptions: []
};
},
created() {
this.getList();
this.getGroupNameOptions();
},
methods: {
/** 查询消息列表 */
@@ -325,11 +332,30 @@ export default {
this.processStatistics(response);
});
},
/** 获取群名称选项 */
getGroupNameOptions() {
getGroupNameOptions().then(response => {
this.groupNameOptions = response.data || [];
console.log('群名称选项加载完成:', this.groupNameOptions);
}).catch(error => {
console.error('获取群名称选项失败:', error);
this.groupNameOptions = [];
});
},
/** 根据微信ID获取群名称 */
getGroupName(wxid) {
if (!wxid || !this.groupNameOptions || this.groupNameOptions.length === 0) return null;
const group = this.groupNameOptions.find(item => item.value === wxid);
return group ? group.label : null;
},
/** 归一化列表数据(解决 children 字段结构不同) */
normalizeList(rows) {
if (!Array.isArray(rows)) return [];
return rows.map(parent => {
const normalized = { ...parent };
// 添加childrenCount字段
normalized.childrenCount = Array.isArray(parent.children) ? parent.children.length : 0;
if (Array.isArray(parent.children) && parent.children.length > 0) {
normalized.children = parent.children.map(child => {
// 如果接口已经提供了这些字段直接使用否则从jsonQueryResult中解析
@@ -408,6 +434,41 @@ export default {
return null;
}
},
/** 解析所有者字段 */
parseOwner(owner) {
if (!owner) return '-';
if (owner === 'g') return '<span style="color: #67C23A; font-weight: bold;">自营</span>';
if (owner === 'p') return '<span style="color: #409EFF; font-weight: bold;">POP</span>';
return owner;
},
/** 解码Unicode字符 */
decodeUnicode(str) {
if (!str || typeof str !== 'string') return str;
try {
// 处理 \u 开头的Unicode转义序列
return str.replace(/\\u([0-9a-fA-F]{4})/g, (match, hex) => {
return String.fromCharCode(parseInt(hex, 16));
});
} catch (e) {
return str;
}
},
/** 行点击事件 */
handleRowClick(row, column, event) {
// 如果点击的是操作列,不触发详情
if (column.label === '操作') {
return;
}
this.showMessageDetail(row);
},
/** 子消息行点击事件 */
handleChildRowClick(row, column, event) {
// 如果点击的是操作列,不触发详情
if (column.label === '操作') {
return;
}
this.showChildDetail(row);
},
/** 解析优惠券列表 */
parseCouponList(couponListStr) {
try {
@@ -472,20 +533,6 @@ export default {
};
}
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
type: null,
content: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@@ -499,50 +546,12 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加消息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getXbmessage(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改消息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateXbmessage(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addXbmessage(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除消息编号为"' + ids + '"的数据').then(function() {
this.$modal.confirm('是否确认删除选中的消息数据?').then(function() {
return delXbmessage(ids);
}).then(() => {
this.getList();
@@ -580,4 +589,10 @@ export default {
.mb20 {
margin-bottom: 20px;
}
.original-message-content .el-textarea__inner {
font-size: 18px !important;
font-weight: bold !important;
line-height: 1.6;
}
</style>