Commit 0a7542e3 by zhangquan

联调

1 parent 26c8e49d
import request from './request' import request from "./request"
const path = 'dj.api.' const path = "dj.api."
// 内容管理列表查询条件可见门店列表 // 内容管理列表查询条件可见门店列表
export function getMerchantList(data) { export function getMerchantList(data) {
data.method = `${path}merchant.page` data.method = `${path}merchant.page`
return request(data) return request(data)
} }
// 内容管理列表查询 // 内容管理列表查询
export function getContenttList(data) { export function getContenttList(data) {
data.method = `${path}material.record.page` data.method = `${path}material.record.page`
return request(data) return request(data)
} }
// 内容管理详情 // 内容管理详情
export function getContentDetail(data) { export function getContentDetail(data) {
data.method = `${path}material.record.detail` data.method = `${path}material.record.detail`
return request(data) return request(data)
}
// 批量启停用内容
export function batchOperaterContent(data) {
data.method = `${path}material.record.batch.operate`
return request(data)
}
//删除内容
export function delContent(data) {
data.method = `${path}material.record.delete`
return request(data)
}
//统计列表
export function getStatisticsList(data) {
data.method = `dj.api.customer.dynamic.record.page`
return request(data)
}
//导出统计列表
export function exportStatisticsList(data) {
data.method = `dj.api.customer.dynamic.record.page.export`
return request(data)
} }
...@@ -50,6 +50,21 @@ export const routerName = { ...@@ -50,6 +50,21 @@ export const routerName = {
} }
] ]
}, },
{
authId: "9130103",
parentId: "91301",
label: "统计",
category: "Button",
type: "primary",
handle: "goStatisticsPage",
addRoutePath: [
{
authId: "91304",
name: "统计",
parentId: "91301"
}
]
}
], ],
component: _import("contentManager/contentManagerList") component: _import("contentManager/contentManagerList")
}, },
...@@ -77,4 +92,16 @@ export const routerName = { ...@@ -77,4 +92,16 @@ export const routerName = {
}, },
component: _import("contentManager/contentDetail") component: _import("contentManager/contentDetail")
}, },
91304: {
path: "/contentManager",
name: "statisticsList",
meta: {
title: "查看",
authId: "91304",
parentId: "91301",
cache: false,
activePath: "/contentManagerList"
},
component: _import("contentManager/statisticsList")
}
} }
// 内容类型 // 内容类型
export const CONTENT_TYPE_OPTIONS = [ export const CONTENT_TYPE_OPTIONS = [
{ {
id: 0, id: 0,
label: "图片" label: "图片"
}, },
{ {
id: 1, id: 1,
label: "视频" label: "视频"
}, },
{ {
id: 2, id: 2,
label: "PDF" label: "PDF"
} }
] ]
// 场景 // 场景
export const SCENE_OPTIONS = [ export const SCENE_OPTIONS = [
{ {
id: 0, id: 1,
label: "精品升级" label: "精品升级"
}, },
{ {
id: 1, id: 2,
label: "次新车转化" label: "次新车转化"
}, },
{ {
id: 2, id: 3,
label: "售后众筹" label: "售后众筹"
}, },
{ {
id: 3, id: 0,
label: "会员权益/升级" label: "会员权益/升级"
}, },
{ {
id: 4, id: 4,
label: "积分商城" label: "积分商城"
}, }
] ]
// 渠道 // 渠道
export const CHANNEL_OPTIONS = [ export const CHANNEL_OPTIONS = [
{ {
id: 0, id: 0,
label: "培训资料" label: "培训资料"
}, },
{ {
id: 1, id: 1,
label: "营销素材" label: "营销素材"
} }
] ]
// 状态 // 状态
export const STATUS_OPTIONS = [ export const STATUS_OPTIONS = [
{
id: 0,
label: "草稿"
},
{
id: 1,
label: "启用"
},
{
id: 2,
label: "停用"
},
]
\ No newline at end of file \ No newline at end of file
{
id: 0,
label: "草稿"
},
{
id: 1,
label: "启用"
},
{
id: 2,
label: "停用"
}
]
export const STATUS_ENUM = {
0: {
name: "草稿",
color: "#CCCCCC"
},
1: {
name: "启用",
color: "#2CCA74"
},
2: {
name: "停用",
color: "#EB4E4E"
}
}
...@@ -39,18 +39,63 @@ ...@@ -39,18 +39,63 @@
:get-list-api="getListApi" :get-list-api="getListApi"
:before-search-fn="beforeSearchFn" :before-search-fn="beforeSearchFn"
> >
<div slot="merchantSlot" slot-scope="scope">
<div v-if="scope.scope.showMerchant == 0">全部门店</div>
<el-popover v-else placement="top" width="200" trigger="hover">
<div
class="merchant-name"
v-for="(item, index) in scope.scope.assignInfos || []"
:key="index"
>
{{ item.assignName }}
</div>
<div slot="reference">
<span class="merchant-num">{{
scope.scope.assignInfos ? scope.scope.assignInfos.length : 0
}}</span>
</div>
</el-popover>
</div>
<div slot="statusSlot" slot-scope="scope">
<span
:style="{
'background-color': statusEnum[scope.scope.status].color
}"
class="circle"
></span>
<span>{{ statusEnum[scope.scope.status].name }}</span>
</div>
<div slot="auth-button" slot-scope="scope"> <div slot="auth-button" slot-scope="scope">
<!-- 查看 --> <el-button type="text" size="mini" @click="handleDetail(scope.scope)">
<span style="margin-right: 10px"> 查看
</el-button>
<el-button type="text" size="mini" @click="handleDetail(scope.scope)">
编辑
</el-button>
<el-button
type="text"
size="mini"
@click="handleDel(scope.scope)"
v-if="scope.scope.status == 0"
>
删除
</el-button>
<template v-else>
<el-button
type="text"
size="mini"
@click="operatStatus(scope.scope)"
>
{{ scope.scope.status == 1 ? "停用" : "启用" }}
</el-button>
<el-button <el-button
type="text" type="text"
size="mini" size="mini"
style="margin-right: 10px" @click="goStatisticsPage(scope.scope)"
@click="handleDetail(scope.scope)"
> >
查看 统计
</el-button> </el-button>
</span> </template>
</div> </div>
</d2-table> </d2-table>
</div> </div>
...@@ -63,13 +108,20 @@ import { ...@@ -63,13 +108,20 @@ import {
CONTENT_TYPE_OPTIONS, CONTENT_TYPE_OPTIONS,
SCENE_OPTIONS, SCENE_OPTIONS,
CHANNEL_OPTIONS, CHANNEL_OPTIONS,
STATUS_OPTIONS STATUS_OPTIONS,
STATUS_ENUM
} from "./constant" } from "./constant"
import { getMerchantList, getContenttList } from "@api/contentManager" import {
getMerchantList,
getContenttList,
batchOperaterContent,
delContent
} from "@api/contentManager"
export default { export default {
name: "contentManagerList", name: "contentManagerList",
data() { data() {
return { return {
statusEnum: STATUS_ENUM,
searchForm: { searchForm: {
title: "", title: "",
type: "", type: "",
...@@ -171,10 +223,10 @@ export default { ...@@ -171,10 +223,10 @@ export default {
width: "100px", width: "100px",
formatter: (cellValue) => { formatter: (cellValue) => {
return { return {
0: "精品升级", 1: "精品升级",
1: "次新车转化", 2: "次新车转化",
2: "售后众筹", 3: "售后众筹",
3: "会员权益/升级", 0: "会员权益/升级",
4: "积分商城" 4: "积分商城"
}[cellValue.scene] }[cellValue.scene]
} }
...@@ -193,14 +245,9 @@ export default { ...@@ -193,14 +245,9 @@ export default {
{ {
label: "可见门店", label: "可见门店",
prop: "showMerchant", prop: "showMerchant",
width:"120px", width: "120px",
formatter: (cellValue) => { type: "slot",
return { addHtml: "merchantSlot"
0: "全部门店",
1: "指定品牌",
2: "指定门店"
}[cellValue.showMerchant]
}
}, },
{ {
label: "浏览次数", label: "浏览次数",
...@@ -211,13 +258,8 @@ export default { ...@@ -211,13 +258,8 @@ export default {
label: "状态", label: "状态",
prop: "status", prop: "status",
width: "80px", width: "80px",
formatter: (cellValue) => { type: "slot",
return { addHtml: "statusSlot"
0: "草稿",
1: "启用",
2: "停用"
}[cellValue.status]
}
}, },
{ {
label: "创建时间", label: "创建时间",
...@@ -231,11 +273,13 @@ export default { ...@@ -231,11 +273,13 @@ export default {
mounted() { mounted() {
var params = { currentPage: 1, pageSize: 100, merchantIdName: "" } var params = { currentPage: 1, pageSize: 100, merchantIdName: "" }
getMerchantList(params).then((res) => { getMerchantList(params)
this.getBaseData(res.list) .then((res) => {
}).catch(()=>{ this.getBaseData(res.list)
this.getBaseData([]) })
}) .catch(() => {
this.getBaseData([])
})
}, },
methods: { methods: {
...@@ -272,7 +316,7 @@ export default { ...@@ -272,7 +316,7 @@ export default {
for (const key in this.searchForm) { for (const key in this.searchForm) {
this.searchForm[key] = "" this.searchForm[key] = ""
} }
this.$refs.contentTable.refreshTable(true, true) this.$refs.contentTable.refreshTable(true, true)
}, },
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve) => { return new Promise((resolve) => {
...@@ -291,21 +335,53 @@ export default { ...@@ -291,21 +335,53 @@ export default {
this.$router.push({ this.$router.push({
name: "contentDetail", name: "contentDetail",
params: { params: {
id:row.id id: row.id
} }
}) })
}, },
mutiStartOrStop(type) { goStatisticsPage(row) {
let selectedData = [] this.$router.push({
console.log(this.$refs.contentTable.mutiSelectArr); name: "statisticsList",
if (this.$refs.contentTable.mutiSelectArr.contentIndex) { params: {
id: row.id
}
})
},
handleDel(row) {
this.$confirm("删除后内容不可恢复", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then((end) => {
if (end == "confirm") {
delContent({ id: row.id }).then((res) => {
if (res) {
this.$message.success("删除成功")
this.$refs.contentTable.refreshTable(true, true)
}
})
}
})
},
operatStatus(row) {
this.mutiStartOrStop(row.status == 1 ? 2 : 1, [row])
},
mutiStartOrStop(type, data) {
let selectedData = []
if (data) {
selectedData = data
} else if (this.$refs.contentTable.mutiSelectArr.contentIndex) {
selectedData = this.$refs.contentTable.mutiSelectArr.contentIndex selectedData = this.$refs.contentTable.mutiSelectArr.contentIndex
} }
let status = selectedData.map(v => { return v.status }) || [] let status =
if (status.includes(0) || !selectedData.length) { // 包含0草稿 未选择 selectedData.map((v) => {
return v.status
}) || []
if (status.includes(0) || !selectedData.length) {
// 包含0草稿 未选择
this.$message({ this.$message({
message: `请选择${type==2?'已停用':'已开启'}的内容`, message: `请选择${type == 2 ? "已停用" : "已开启"}的内容`,
type: 'warning', type: "warning",
showClose: true showClose: true
}) })
return false return false
...@@ -320,7 +396,22 @@ export default { ...@@ -320,7 +396,22 @@ export default {
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}) })
.then(() => {}) .then((end) => {
if (end == "confirm") {
const params = {
ids: selectedData.map((item) => {
return item.id
}),
operateType: type
}
batchOperaterContent(params).then((res) => {
if (res) {
this.$message.success("操作成功")
this.$refs.contentTable.refreshTable(true, true)
}
})
}
})
.catch((err) => { .catch((err) => {
console.log(err) console.log(err)
}) })
...@@ -329,4 +420,16 @@ export default { ...@@ -329,4 +420,16 @@ export default {
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.merchant-num {
color: #185efe;
}
.circle {
display: inline-block;
border-radius: 50%;
width: 8px;
height: 8px;
background: #2cca74;
margin-right: 6px;
vertical-align: middle;
}
</style> </style>
<!-- 规则配置 -->
<template>
<d2-container class="container">
<div class="header" slot="header">
<d2-search
ref="showSearch"
class="show-search"
:search-form="searchForm"
:form-data="showFormData"
>
</d2-search>
<div class="up-btns">
<el-button :id="tableParams.btnId" size="small" type="primary" handle>
查询
</el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button>
</div>
</div>
<div class="d2-container-content">
<d2-table-header>
<el-button size="mini" @click="exportList()"> 导出 </el-button>
</d2-table-header>
<d2-table
ref="contentTable"
:search-form="realSearchForm"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
</d2-table>
</div>
</d2-container>
</template>
<script>
import { Util, deepClone } from "@/common/util"
import {
CONTENT_TYPE_OPTIONS,
SCENE_OPTIONS,
CHANNEL_OPTIONS,
STATUS_OPTIONS,
STATUS_ENUM
} from "./constant"
import { getStatisticsList, exportStatisticsList } from "@api/contentManager"
export default {
name: "contentManagerList",
data() {
return {
searchForm: {
goodsId: "",
goodsType: 0,
EnterDate: [],
merchantId: ""
},
realSearchForm: {},
showFormData: [
{
label: "浏览时间",
name: "EnterDate",
type: "datePicker",
isClear: true,
pickerOptions: "beforeRangePickerOptions"
},
{
label: "所属门店",
name: "type",
type: "select",
optionList: [],
optionId: "id",
optionLabel: "label",
optionsName: "contentTypeOptions"
}
],
// 基本数据
baseData: {
contentTypeOptions: [],
sceneOptions: [],
channelOptions: [],
statuslOptions: []
},
tableSearchForm: {},
getListApi: getStatisticsList,
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: "list",
tableColumns: [
{
label: "用户",
prop: "customerAccountName"
},
{
label: "手机号",
prop: "customerMobile"
},
{
label: "浏览时间",
prop: "enterDate"
},
{
label: "浏览时长/秒",
prop: "browseDuration"
},
{
label: "所属门店",
prop: "merchantName"
}
]
}
}
},
mounted() {
this.searchForm.goodsId = this.$route.params.id
var params = { currentPage: 1, pageSize: 100, merchantIdName: "" }
getMerchantList(params)
.then((res) => {
this.getBaseData(res.list)
})
.catch(() => {
this.getBaseData([])
})
},
methods: {
getBaseData(res) {
const allOpt = {
id: "",
label: "全部"
}
this.baseData = {
contentTypeOptions: deepClone(CONTENT_TYPE_OPTIONS),
sceneOptions: deepClone(SCENE_OPTIONS),
channelOptions: deepClone(CHANNEL_OPTIONS),
statuslOptions: deepClone(STATUS_OPTIONS)
}
this.showFormData.forEach((item, index) => {
if (item.type === "select" && this.baseData[item.optionsName]) {
this.baseData[item.optionsName].unshift(allOpt)
this.$set(
this.showFormData[index],
"optionList",
this.baseData[item.optionsName]
)
}
if (item.type === "select" && item.name === "merchantId") {
res.unshift({
merchantNo: "",
merchantName: "全部"
})
this.$set(this.showFormData[index], "optionList", res)
}
})
},
handleReset() {
for (const key in this.searchForm) {
this.searchForm[key] = ""
}
this.realSearchForm = {}
this.$refs.contentTable.refreshTable(true, true)
},
exportList() {
const params = this.getParams()
exportStatisticsList(params).then((res) => {
console.log(res, "res")
// window.open(res)
let tempaa = utils.getExplorer()
if (tempaa == "QQ") {
window.open(res)
} else {
let iframe = document.createElement("iframe")
iframe.style.display = "none"
iframe.src = res
document.body.appendChild(iframe)
}
})
},
getParams() {
let params = deepClone(this.searchForm)
console.log(params, "params")
if (params.EnterDate?.length) {
params.startEnterDate =
new Date(params.EnterDate[0])
.toLocaleDateString()
.replace(/\//g, "-") + " 00:00:00"
params.endEnterDate =
new Date(params.EnterDate[1])
.toLocaleDateString()
.replace(/\//g, "-") + " 23:59:59"
}
delete params.EnterDate
return params
},
beforeSearchFn() {
return new Promise((resolve) => {
this.realSearchForm = this.getParams()
resolve()
})
}
}
}
</script>
<style scoped lang="scss"></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!