Commit bb48cd21 by Jaxon

Merge branch 'SAAS+V5.8.3' of http://192.168.3.233:8090/saas_plus/dj-car-life-sy…

…stem into feature/marketing-sop-push-strategy
2 parents c68bd46f 1dcdcf2e
const _import = require("@/libs/util.import." + process.env.NODE_ENV)
export const routerName = {
922: {
path: "/marketingManagement",
name: "marketingManagement",
meta: {
title: "营销管理",
authId: "922",
parentId: "1",
cache: false,
}
},
92201: {
path: "/marketingActivity",
name: "marketingActivity",
meta: {
title: "营销活动",
authId: "92201",
parentId: "922",
cache: false,
},
component: _import("marketingManagement/marketingActivity/index"),
auth: [
{
authId: "9220101",
parentId: "92201",
label: "新增活动",
category: "Button",
type: "primary",
handle: "handleAdd",
addRoutePath: [
{
authId: "92202",
name: "新增活动",
parentId: "92201"
}
]
},
{
authId: "9220102",
parentId: "92201",
label: "查看详情",
handle: "handleDetail",
addRoutePath: [
{
authId: "92203",
name: "订单详情",
parentId: "92201"
}
]
},
]
},
92202: {
path: "/addMarketingActivity",
name: "addMarketingActivity",
meta: {
title: "新增活动",
authId: "92202",
parentId: "92201",
cache: false,
sideHidden: true,
activePath: "/marketingActivity",
},
component: _import("marketingManagement/marketingActivity/addMarketingActivity")
},
92203: {
path: "/viewMarketingActivity",
name: "viewMarketingActivity",
meta: {
title: "查看详情",
authId: "92203",
parentId: "92201",
cache: false,
sideHidden: true,
activePath: "/marketingActivity",
},
component: _import("marketingManagement/marketingActivity/viewMarketingActivity"),
auth: [
{
authId: "9220103",
parentId: "92203",
label: "编辑",
category: "Button",
handle: "handleEdit",
},
{
authId: "9220104",
parentId: "92203",
label: "删除",
category: "Button",
handle: "handleDelete",
},
{
authId: "9220105",
parentId: "92203",
label: "暂停",
handle: "handleToggleStatus",
},
{
authId: "9220106",
parentId: "92203",
label: "恢复",
handle: "handleToggleStatus"
},
{
authId: "9220107",
parentId: "92203",
label: "延期",
handle: "handleDelay",
},
{
authId: "9220108",
parentId: "92203",
label: "下线",
handle: "handleOffline",
},
{
authId: "9220109",
parentId: "92203",
label: "再次创建",
handle: "handleRecreate"
}
]
}
}
<!-- 适用门店选择弹窗 -->
<template>
<el-dialog :visible.sync="dialogVisible" title="选择门店" width="1200px" :close-on-click-modal="false" custom-class="applicable-stores-dialog" @close="handleClose">
<div class="dialog-content">
<!-- 左侧:可选门店列表 -->
<div class="left-panel">
<!-- 搜索条件 -->
<div class="search-bar">
<el-input v-model="searchForm.merchantName" placeholder="门店名称" size="small" clearable @keyup.enter.native="handleSearch" />
<el-input v-model="searchForm.merchantId" placeholder="门店商户号" size="small" clearable @keyup.enter.native="handleSearch" />
<el-button type="primary" size="small" @click="handleSearch">查询</el-button>
</div>
<!-- 门店列表表格 -->
<el-table ref="selectingTable" :data="selectingData" border height="360" @select="handleChange" @select-all="handleAll">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="门店名称" prop="merchantName" align="center" />
<el-table-column label="门店商户号" prop="merchantId" align="center" />
<el-table-column label="门店地址" prop="merchantAddress" align="center" show-overflow-tooltip />
</el-table>
<!-- 分页 -->
<el-pagination background layout="prev, pager, next" :current-page.sync="currentPage" :page-size="pageSize" :total="total" small @current-change="handleCurrentChange" />
</div>
<!-- 右侧:已选结果 -->
<div class="right-panel">
<div class="selected-header">
<span class="selected-title">已选结果 ({{ selectedData.length }})</span>
<el-button type="text" size="small" :disabled="!selectedData.length" @click="handleClearAll">全部清空</el-button>
</div>
<!-- 已选列表 -->
<div v-if="selectedData.length" class="selected-list">
<div v-for="item in selectedData" :key="item.merchantId" class="selected-item">
<div class="item-name">{{ item.merchantName }}{{ item.merchantId }}</div>
<i class="el-icon-delete" @click="handleDelete(item)"></i>
</div>
</div>
<!-- 空状态 -->
<div v-else class="empty-state">
<i class="el-icon-folder-opened"></i>
<p>暂无数据</p>
</div>
</div>
</div>
<!-- 底部按钮 -->
<template #footer>
<div class="dialog-footer">
<el-button size="small" @click="handleCancel">取消</el-button>
<el-button type="primary" size="small" @click="handleConfirm">确定</el-button>
</div>
</template>
</el-dialog>
</template>
<script>
import { getMerchantList } from '@/api/merchant'
export default {
name: 'ApplicableStoresDialog',
props: {
visible: {
type: Boolean,
default: false
},
selectedStores: {
type: Array,
default: () => []
}
},
data() {
return {
searchForm: {
merchantName: '',
merchantId: ''
},
selectingData: [],
selectedData: [],
total: 0,
currentPage: 1,
pageSize: 10
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
watch: {
visible(val) {
if (val) {
this.selectedData = [...this.selectedStores]
this.currentPage = 1
this.searchForm = { merchantName: '', merchantId: '' }
this.getSelectingList()
}
}
},
methods: {
// 获取可选门店列表
getSelectingList() {
const params = {
currentPage: this.currentPage,
pageSize: this.pageSize,
merchantName: this.searchForm.merchantName || undefined,
merchantId: this.searchForm.merchantId || undefined
}
getMerchantList(params).then(res => {
console.log('门店列表接口返回:', res)
const list = res.list || []
// 处理商户号字段
list?.forEach(item => {
if (item.merchantNo && !item.merchantId) {
item.merchantId = item.merchantNo
}
})
this.selectingData = list
this.total = res.total || 0
this.$nextTick(() => {
this.recoverySelection()
})
})
},
// 恢复选中状态
recoverySelection() {
const exitIds = this.selectedData.map(item => item.merchantId)
this.selectingData.forEach(item => {
if (exitIds.includes(item.merchantId)) {
this.$refs.selectingTable.toggleRowSelection(item, true)
}
})
},
// 搜索
handleSearch() {
this.currentPage = 1
this.getSelectingList()
},
// 分页切换
handleCurrentChange(val) {
this.currentPage = val
this.getSelectingList()
},
// 单选
handleChange(selection, row) {
const isAdded = !!selection.find(item => item.merchantId === row.merchantId)
if (isAdded) {
if (!this.selectedData.find(item => item.merchantId === row.merchantId)) {
this.selectedData.push({ ...row })
}
} else {
this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId)
}
},
// 全选
handleAll(selection) {
this.selectingData.forEach(item => {
const isExit = this.selectedData.findIndex(subItem => subItem.merchantId === item.merchantId)
if (selection.length && isExit === -1) {
this.selectedData.push({ ...item })
} else if (!selection.length && isExit !== -1) {
this.selectedData.splice(isExit, 1)
}
})
},
// 删除已选
handleDelete(row) {
this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId)
const obj = this.selectingData.find(v => String(v.merchantId) === String(row.merchantId))
if (obj) {
this.$refs.selectingTable.toggleRowSelection(obj, false)
}
},
// 全部清空
handleClearAll() {
this.selectedData = []
this.$refs.selectingTable.clearSelection()
},
// 确定
handleConfirm() {
this.$emit('confirm', this.selectedData)
this.dialogVisible = false
},
// 取消
handleCancel() {
this.dialogVisible = false
},
// 关闭
handleClose() {
this.$emit('close')
}
}
}
</script>
<style lang="scss" scoped>
.applicable-stores-dialog {
::v-deep .el-dialog__body {
padding: 20px;
}
}
.dialog-content {
display: flex;
gap: 20px;
height: 450px;
}
.left-panel {
flex: 1.5;
display: flex;
flex-direction: column;
.search-bar {
display: flex;
gap: 12px;
margin-bottom: 16px;
.el-input {
width: 240px;
}
}
.el-table {
flex: 1;
}
.el-pagination {
margin-top: 12px;
text-align: right;
}
}
.right-panel {
flex: 1;
display: flex;
flex-direction: column;
border-left: 1px solid #ebeef5;
padding-left: 20px;
height: 100%;
overflow: hidden;
.selected-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
flex-shrink: 0;
.selected-title {
font-size: 14px;
font-weight: 600;
color: #303133;
}
}
.selected-list {
flex: 1;
overflow-y: auto;
min-height: 0;
.selected-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
margin-bottom: 8px;
background: #f5f7fa;
border-radius: 4px;
font-size: 13px;
min-width: 0;
.item-name {
color: #303133;
flex: 1;
min-width: 0;
word-break: break-all;
line-height: 1.4;
padding-right: 8px;
}
.el-icon-delete {
flex-shrink: 0;
cursor: pointer;
color: #c0c4cc;
font-size: 14px;
&:hover {
color: #f56c6c;
}
}
}
}
.empty-state {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #c0c4cc;
i {
font-size: 48px;
margin-bottom: 12px;
}
p {
font-size: 13px;
margin: 0;
}
}
}
.dialog-footer {
text-align: right;
}
</style>
<!-- 选择车系弹窗 -->
<template>
<el-dialog :visible.sync="dialogVisible" title="新增适用车系" width="500px" :close-on-click-modal="false" custom-class="series-select-dialog" @close="handleClose">
<el-form ref="formRef" :model="form" :rules="rules" label-width="80px" size="small">
<el-form-item label="品牌" prop="brandId">
<el-select v-model="form.brandId" placeholder="请选择品牌" style="width: 100%" @change="handleBrandChange">
<el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="子品牌" prop="subBrandId">
<el-select v-model="form.subBrandId" placeholder="请选择子品牌" style="width: 100%" :disabled="!form.brandId" @change="handleSubBrandChange">
<el-option v-for="item in subBrandList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="车系" prop="seriesId">
<el-select v-model="form.seriesId" placeholder="请选择车系" style="width: 100%" :disabled="!form.subBrandId">
<el-option v-for="item in seriesList" :key="item.id" :label="item.name" :value="item.id" :disabled="item.disabled">
<span>{{ item.name }}</span>
<span v-if="item.disabled" style="color: #c0c4cc; margin-left: 8px">(已添加)</span>
</el-option>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button size="small" @click="handleCancel">取消</el-button>
<el-button type="primary" size="small" @click="handleConfirm">确定</el-button>
</div>
</template>
</el-dialog>
</template>
<script>
export default {
name: 'SeriesSelectDialog',
props: {
visible: {
type: Boolean,
default: false
},
// 已选车系列表,用于禁用已选项
selectedSeries: {
type: Array,
default: () => []
}
},
data() {
return {
form: {
brandId: '',
subBrandId: '',
seriesId: ''
},
rules: {
brandId: [{ required: true, message: '请选择品牌', trigger: 'change' }],
subBrandId: [{ required: true, message: '请选择子品牌', trigger: 'change' }],
seriesId: [{ required: true, message: '请选择车系', trigger: 'change' }]
},
// 模拟树形结构数据(后续替换为接口请求)
treeData: [
{
id: 'brand_1',
name: '奥迪',
children: [
{
id: 'sub_1_1',
name: '一汽奥迪',
children: [
{ id: 'series_1_1_1', name: '奥迪A4L' },
{ id: 'series_1_1_2', name: '奥迪A6L' },
{ id: 'series_1_1_3', name: '奥迪Q5L' },
{ id: 'series_1_1_4', name: '奥迪Q8' }
]
},
{
id: 'sub_1_2',
name: '上汽奥迪',
children: [
{ id: 'series_1_2_1', name: '奥迪A7L' },
{ id: 'series_1_2_2', name: '奥迪Q6' }
]
},
{
id: 'sub_1_3',
name: '奥迪进口',
children: [
{ id: 'series_1_3_1', name: '奥迪RS6 Avant' },
{ id: 'series_1_3_2', name: '奥迪RS7' }
]
}
]
},
{
id: 'brand_2',
name: '宝马',
children: [
{
id: 'sub_2_1',
name: '华晨宝马',
children: [
{ id: 'series_2_1_1', name: '宝马3系' },
{ id: 'series_2_1_2', name: '宝马5系' },
{ id: 'series_2_1_3', name: '宝马X3' }
]
},
{
id: 'sub_2_2',
name: '宝马进口',
children: [
{ id: 'series_2_2_1', name: '宝马7系' },
{ id: 'series_2_2_2', name: '宝马X5' },
{ id: 'series_2_2_3', name: '宝马X7' }
]
}
]
},
{
id: 'brand_3',
name: '奔驰',
children: [
{
id: 'sub_3_1',
name: '北京奔驰',
children: [
{ id: 'series_3_1_1', name: '奔驰C级' },
{ id: 'series_3_1_2', name: '奔驰E级' },
{ id: 'series_3_1_3', name: '奔驰GLC' }
]
},
{
id: 'sub_3_2',
name: '奔驰进口',
children: [
{ id: 'series_3_2_1', name: '奔驰S级' },
{ id: 'series_3_2_2', name: '奔驰GLE' }
]
}
]
}
],
brandList: [],
subBrandList: [],
seriesList: []
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
watch: {
visible(val) {
if (val) {
this.resetForm()
this.loadBrandList()
}
}
},
methods: {
// 加载品牌列表
loadBrandList() {
// TODO: 替换为接口请求
// getBrandTree().then(res => { this.treeData = res.data })
this.brandList = this.treeData.map(item => ({ id: item.id, name: item.name }))
},
// 品牌切换
handleBrandChange(brandId) {
this.form.subBrandId = ''
this.form.seriesId = ''
this.subBrandList = []
this.seriesList = []
const brand = this.treeData.find(item => item.id === brandId)
if (brand && brand.children) {
this.subBrandList = brand.children.map(item => ({ id: item.id, name: item.name }))
}
},
// 子品牌切换
handleSubBrandChange(subBrandId) {
this.form.seriesId = ''
this.seriesList = []
const brand = this.treeData.find(item => item.id === this.form.brandId)
if (brand) {
const subBrand = brand.children.find(item => item.id === subBrandId)
if (subBrand && subBrand.children) {
// 标记已添加的车系
const selectedIds = this.selectedSeries.map(s => s.id)
this.seriesList = subBrand.children.map(item => ({
id: item.id,
name: item.name,
disabled: selectedIds.includes(item.id)
}))
}
}
},
// 确定
handleConfirm() {
this.$refs.formRef.validate(valid => {
if (!valid) return
// 查找完整信息
const brand = this.treeData.find(item => item.id === this.form.brandId)
const subBrand = brand?.children?.find(item => item.id === this.form.subBrandId)
const series = subBrand?.children?.find(item => item.id === this.form.seriesId)
if (!series) return
this.$emit('confirm', {
id: series.id,
name: `${brand.name} ${series.name}`, // tab显示:品牌 车系
brandId: brand.id,
brandName: brand.name,
subBrandId: subBrand.id,
subBrandName: subBrand.name,
seriesName: series.name
})
this.dialogVisible = false
})
},
// 取消
handleCancel() {
this.dialogVisible = false
},
// 关闭
handleClose() {
this.resetForm()
this.$emit('close')
},
// 重置表单
resetForm() {
this.form = { brandId: '', subBrandId: '', seriesId: '' }
this.brandList = []
this.subBrandList = []
this.seriesList = []
this.$nextTick(() => {
this.$refs.formRef && this.$refs.formRef.clearValidate()
})
}
}
}
</script>
<style lang="scss" scoped>
.series-select-dialog {
// 禁用关闭动画,避免与后续 $confirm 弹窗冲突
::v-deep .v-leave-active {
transition-duration: 0s !important;
}
::v-deep .el-dialog__body {
padding: 20px;
}
::v-deep .el-form-item__label {
font-weight: 500;
color: #303133;
&::before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
}
}
.dialog-footer {
text-align: right;
}
</style>
<!-- 销售门店列表弹窗 -->
<template>
<el-dialog :visible.sync="dialogVisible" title="相关门店列表" width="600px" :close-on-click-modal="false" append-to-body @close="handleClose">
<div class="store-list-dialog">
<el-table :data="storeList" border size="mini" max-height="400">
<el-table-column label="门店名称" prop="merchantName" min-width="150" />
<el-table-column label="门店商户号" prop="merchantId" width="120" />
<el-table-column label="门店地址" prop="address" min-width="200" show-overflow-tooltip />
</el-table>
</div>
<template #footer>
<div class="dialog-footer">
<el-button size="mini" @click="handleClose">关 闭</el-button>
</div>
</template>
</el-dialog>
</template>
<script>
export default {
name: 'StoreListDialog',
props: {
visible: {
type: Boolean,
default: false
},
storeList: {
type: Array
}
},
data() {
return {}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
methods: {
handleClose() {
this.dialogVisible = false
}
}
}
</script>
<style lang="scss" scoped>
.store-list-dialog {
padding: 10px 0;
}
</style>
<!-- 管理活动标签弹窗 -->
<template>
<el-dialog title="设置活动标签" :visible.sync="dialogVisible" width="500px" append-to-body custom-class="tag-manage-dialog">
<el-table :data="tagTableData" border size="small">
<el-table-column label="标签名称" prop="label">
<template #default="scope">
<el-input v-if="scope.row.editing" v-model="scope.row.editLabel" size="mini" maxlength="10" @keyup.enter.native="confirmEdit(scope.row)" />
<span v-else>{{ scope.row.label }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="160" align="center">
<template #default="scope">
<template v-if="scope.row.editing">
<el-button type="text" size="mini" @click="confirmEdit(scope.row)">确认</el-button>
<el-button type="text" size="mini" @click="cancelEdit(scope.row)">取消</el-button>
</template>
<template v-else>
<el-button type="text" size="mini" @click="startEdit(scope.row)">重命名</el-button>
<el-button type="text" size="mini" style="color: #f56c6c" @click="handleDeleteTag(scope.row)">删除</el-button>
</template>
</template>
</el-table-column>
</el-table>
<!-- 新增标签按钮 -->
<div v-if="!showAddInput" class="tag-add-btn-wrap">
<el-button class="add-tag-btn" size="small" @click="showAddInput = true">
<i class="el-icon-plus"></i>
新增标签
</el-button>
</div>
<!-- 新增标签输入行 -->
<div v-if="showAddInput" class="tag-add-row">
<el-input v-model="newTagName" placeholder="请输入标签名称" size="small" maxlength="10" style="width: 200px; margin-right: 8px" @keyup.enter.native="handleAddTag" />
<el-button type="primary" size="small" @click="handleAddTag">确认</el-button>
<el-button size="small" @click="cancelAdd">取消</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'TagManageDialog',
props: {
visible: {
type: Boolean,
default: false
},
// 初始标签列表
tagList: {
type: Array,
default: () => []
}
},
data() {
return {
tagTableData: [],
newTagName: '',
showAddInput: false
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
watch: {
visible(val) {
if (val) {
this.initTableData()
}
}
},
methods: {
// 初始化表格数据
initTableData() {
this.showAddInput = false
this.newTagName = ''
this.tagTableData = this.tagList.map(item => ({
...item,
editing: false,
editLabel: ''
}))
},
// 开始编辑
startEdit(row) {
row.editing = true
row.editLabel = row.label
},
// 确认编辑
confirmEdit(row) {
if (!row.editLabel.trim()) {
this.$message.warning('标签名称不能为空')
return
}
// 检查是否重复
const isDuplicate = this.tagTableData.some(item => item.label === row.editLabel.trim() && item.value !== row.value)
if (isDuplicate) {
this.$message.warning('标签名称已存在')
return
}
row.label = row.editLabel.trim()
row.editing = false
this.$message.success('修改成功')
this.emitChange()
},
// 取消编辑
cancelEdit(row) {
row.editing = false
row.editLabel = ''
},
// 删除标签
handleDeleteTag(row) {
this.$confirm(`确定删除标签"${row.label}"吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.tagTableData = this.tagTableData.filter(item => item.value !== row.value)
this.$message.success('删除成功')
this.emitChange()
})
.catch(() => {})
},
// 新增标签
handleAddTag() {
if (!this.newTagName.trim()) {
this.$message.warning('请输入标签名称')
return
}
// 检查是否重复
if (this.tagTableData.some(item => item.label === this.newTagName.trim())) {
this.$message.warning('标签名称已存在')
return
}
const newId = String(Date.now())
this.tagTableData.push({
label: this.newTagName.trim(),
value: newId,
editing: false,
editLabel: ''
})
this.newTagName = ''
this.showAddInput = false
this.$message.success('添加成功')
this.emitChange()
},
// 取消新增
cancelAdd() {
this.newTagName = ''
this.showAddInput = false
},
// 触发变更事件
emitChange() {
this.$emit(
'change',
this.tagTableData.map(item => ({
label: item.label,
value: item.value
}))
)
}
}
}
</script>
<style lang="scss" scoped>
.tag-add-btn-wrap {
padding: 16px 0 0;
text-align: left;
}
.add-tag-btn {
border: 1px dashed #dcdfe6;
color: #606266;
background: #fff;
&:hover {
border-color: #409eff;
color: #409eff;
}
}
.tag-add-row {
display: flex;
align-items: center;
padding: 16px 0 0;
}
</style>
<style lang="scss">
.tag-manage-dialog {
.el-dialog__body {
padding: 20px;
}
.el-table .cell {
line-height: 24px;
padding: 0 10px;
}
}
</style>
<!-- 营销活动 -->
<template>
<d2-container class="container">
<template #header>
<div class="header">
<d2-search ref="showSearch" class="show-search" label-width="100px" :form-data="showFormData" :search-form="searchForm"></d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId" handle size="small" type="primary">查询</el-button>
<el-button size="small" @click="handleReset">重置</el-button>
</div>
</div>
</template>
<div class="d2-container-content">
<d2-table-header>
<template #left>
<auth-button category="Button" :data="{ operate: 'create' }" :show-btn-ids="['9220101']" />
</template>
<span></span>
</d2-table-header>
<d2-table ref="activityTable" :before-search-fn="beforeSearchFn" :get-list-api="getListApi" :search-form="tableSearchForm" :table-data="tableData" :table-params="tableParams">
<template #activityStatus="scope">
<span :class="getStatusClass(scope.scope.activityStatus)">{{ scope.scope.activityStatusName || '-' }}</span>
</template>
<template #marketingStage="scope">
<span :class="scope.scope.marketingStage == 1 ? 'pre-sales' : 'after-sales'">{{ scope.scope.marketingStage == 1 ? '售前' : '售后' }}</span>
</template>
<template #applicableStoreCount="scope">
<div v-if="scope.scope.merchantGoodsRefList && scope.scope.merchantGoodsRefList.length > 0">
<el-popover placement="top" trigger="hover" width="200">
<div class="merchant-name-box">
<div class="title">适用门店</div>
<div v-for="(subItem, subIndex) in scope.scope.merchantGoodsRefList" :key="subIndex" class="merchant-item">
{{ subItem.merchantName }}
</div>
</div>
<template #reference>
<div>
<img src="../../goods/grounding/images/merchant_icon.png" style="width: 14px; height: 13px; margin-right: 5px" />
<span>x {{ scope.scope.merchantGoodsRefList.length }}</span>
</div>
</template>
</el-popover>
</div>
<div v-else>
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">{{ '-' }}</span>
</div>
</template>
<template #auth-button="scope">
<auth-button :data="scope" :show-btn-ids="['9220102']" />
</template>
</d2-table>
</div>
</d2-container>
</template>
<script>
import { getPurchaseOrderList } from '@/api/purchaseShopping.js'
import { deepClone } from '@/common/util'
import { mapActions } from 'vuex'
// import reportTrackPageMixin from '@/mixins/reportTrackPageMixin'
export default {
name: 'MarketingActivity',
// mixins: [reportTrackPageMixin],
data() {
return {
searchForm: {
activityName: '',
activityStatus: '',
marketingStage: '',
activityTimeStr: []
},
tableSearchForm: {},
tableData: [],
showFormData: [
{
label: '活动名称',
name: 'activityName',
type: 'input',
isClear: true
},
{
label: '活动状态',
name: 'activityStatus',
type: 'select',
optionList: [],
optionId: 'value',
optionLabel: 'label'
},
{
label: '营销阶段',
name: 'marketingStage',
type: 'select',
optionList: [],
optionId: 'value',
optionLabel: 'label'
},
{
label: '活动时间',
name: 'activityTimeStr',
type: 'datePicker',
isClear: true,
pickerType: 'datetimerange'
// pickerOptions: 'rangePickerOptions'
}
],
// 活动状态选项
activityStatusOptions: [
{ value: '', label: '全部' },
{ value: 0, label: '未开始' },
{ value: 1, label: '进行中' },
{ value: 2, label: '已暂停' },
{ value: 3, label: '已结束' },
{ value: 4, label: '已下线' }
],
// 营销阶段选项
marketingStageOptions: [
{ value: '', label: '全部' },
{ value: 1, label: '售前' },
{ value: 2, label: '售后' }
],
getListApi: getPurchaseOrderList,
// 表格参数
tableParams: {
btnId: new Date().getTime() + Number.parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '活动名称',
prop: 'activityName'
},
{
label: '活动时间',
prop: 'activityTime',
formatter: cellValue => {
if (!cellValue.startTime || !cellValue.endTime) return '-'
return `${cellValue.startTime} ~ ${cellValue.endTime}`
}
},
{
label: '营销阶段',
prop: 'marketingStage',
addHtml: 'marketingStage'
},
{
label: '适用门店数',
addHtml: 'applicableStoreCount'
},
{
label: '活动状态',
prop: 'activityStatus',
addHtml: 'activityStatus'
}
]
},
track_event_code: 'marketing_activity_list'
}
},
mounted() {
this.initOptions()
// this.onPageShow()
},
methods: {
...mapActions({
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
// 初始化下拉选项
initOptions() {
this.showFormData.forEach((item, index) => {
if (item.name === 'activityStatus') {
this.$set(this.showFormData[index], 'optionList', deepClone(this.activityStatusOptions))
}
if (item.name === 'marketingStage') {
this.$set(this.showFormData[index], 'optionList', deepClone(this.marketingStageOptions))
}
})
},
beforeSearchFn() {
return new Promise(resolve => {
this.filterSearchTime()
resolve()
})
},
filterSearchTime() {
this.tableSearchForm = deepClone(this.searchForm)
if (this.tableSearchForm.activityTimeStr && this.tableSearchForm.activityTimeStr.length === 2) {
this.tableSearchForm.startTime = this.tableSearchForm.activityTimeStr[0]
this.tableSearchForm.endTime = this.tableSearchForm.activityTimeStr[1]
}
delete this.tableSearchForm.activityTimeStr
},
handleReset() {
for (const key in this.searchForm) {
if (Array.isArray(this.searchForm[key])) {
this.searchForm[key] = []
} else {
this.searchForm[key] = ''
}
}
this.$refs.activityTable.refreshTable()
},
// 新增活动
handleAdd() {
this.close({ tagName: '/addMarketingActivity' })
this.$router.push({
name: 'addMarketingActivity'
})
},
// 查看详情
handleDetail(row) {
console.log('查看详情', row)
this.close({ tagName: '/viewMarketingActivity' })
this.$router.push({
name: 'viewMarketingActivity',
query: { id: row.id }
})
},
// 获取状态样式类
getStatusClass(status) {
const classMap = {
0: 'status-not-started',
1: 'status-in-progress',
2: 'status-paused',
3: 'status-ended',
4: 'status-offline'
}
return classMap[status] || ''
}
}
}
</script>
<style lang="scss" scoped>
.merchant-name-box {
font-size: 12px;
max-height: 400px;
overflow-y: auto;
.title {
color: #333333;
font-weight: 500;
margin-bottom: 7px;
}
.merchant-item {
color: #666666;
font-weight: 400;
}
}
// 活动状态样式
.status-not-started {
color: #909399;
}
.status-in-progress {
color: #409eff;
}
.status-paused {
color: #e6a23c;
}
.status-ended {
color: #67c23a;
}
.status-offline {
color: #f56c6c;
}
.pre-sales {
padding: 2px 8px;
background: #409eff1a;
color: #409eff;
}
.after-sales {
padding: 2px 8px;
background: #67c23a1a;
color: #67c23a;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!