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) {
data.method = `${path}merchant.page`
return request(data)
data.method = `${path}merchant.page`
return request(data)
}
// 内容管理列表查询
export function getContenttList(data) {
data.method = `${path}material.record.page`
return request(data)
data.method = `${path}material.record.page`
return request(data)
}
// 内容管理详情
export function getContentDetail(data) {
data.method = `${path}material.record.detail`
return request(data)
data.method = `${path}material.record.detail`
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 = {
}
]
},
{
authId: "9130103",
parentId: "91301",
label: "统计",
category: "Button",
type: "primary",
handle: "goStatisticsPage",
addRoutePath: [
{
authId: "91304",
name: "统计",
parentId: "91301"
}
]
}
],
component: _import("contentManager/contentManagerList")
},
......@@ -77,4 +92,16 @@ export const routerName = {
},
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 = [
{
id: 0,
label: "图片"
},
{
id: 1,
label: "视频"
},
{
id: 2,
label: "PDF"
}
{
id: 0,
label: "图片"
},
{
id: 1,
label: "视频"
},
{
id: 2,
label: "PDF"
}
]
// 场景
export const SCENE_OPTIONS = [
{
id: 0,
label: "精品升级"
},
{
id: 1,
label: "次新车转化"
},
{
id: 2,
label: "售后众筹"
},
{
id: 3,
label: "会员权益/升级"
},
{
id: 4,
label: "积分商城"
},
{
id: 1,
label: "精品升级"
},
{
id: 2,
label: "次新车转化"
},
{
id: 3,
label: "售后众筹"
},
{
id: 0,
label: "会员权益/升级"
},
{
id: 4,
label: "积分商城"
}
]
// 渠道
export const CHANNEL_OPTIONS = [
{
id: 0,
label: "培训资料"
},
{
id: 1,
label: "营销素材"
}
{
id: 0,
label: "培训资料"
},
{
id: 1,
label: "营销素材"
}
]
// 状态
export const STATUS_OPTIONS = [
{
id: 0,
label: "草稿"
},
{
id: 1,
label: "启用"
},
{
id: 2,
label: "停用"
},
]
\ 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 @@
:get-list-api="getListApi"
: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">
<!-- 查看 -->
<span style="margin-right: 10px">
<el-button type="text" size="mini" @click="handleDetail(scope.scope)">
查看
</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
type="text"
size="mini"
style="margin-right: 10px"
@click="handleDetail(scope.scope)"
@click="goStatisticsPage(scope.scope)"
>
查看
统计
</el-button>
</span>
</template>
</div>
</d2-table>
</div>
......@@ -63,13 +108,20 @@ import {
CONTENT_TYPE_OPTIONS,
SCENE_OPTIONS,
CHANNEL_OPTIONS,
STATUS_OPTIONS
STATUS_OPTIONS,
STATUS_ENUM
} from "./constant"
import { getMerchantList, getContenttList } from "@api/contentManager"
import {
getMerchantList,
getContenttList,
batchOperaterContent,
delContent
} from "@api/contentManager"
export default {
name: "contentManagerList",
data() {
return {
statusEnum: STATUS_ENUM,
searchForm: {
title: "",
type: "",
......@@ -171,10 +223,10 @@ export default {
width: "100px",
formatter: (cellValue) => {
return {
0: "精品升级",
1: "次新车转化",
2: "售后众筹",
3: "会员权益/升级",
1: "精品升级",
2: "次新车转化",
3: "售后众筹",
0: "会员权益/升级",
4: "积分商城"
}[cellValue.scene]
}
......@@ -193,14 +245,9 @@ export default {
{
label: "可见门店",
prop: "showMerchant",
width:"120px",
formatter: (cellValue) => {
return {
0: "全部门店",
1: "指定品牌",
2: "指定门店"
}[cellValue.showMerchant]
}
width: "120px",
type: "slot",
addHtml: "merchantSlot"
},
{
label: "浏览次数",
......@@ -211,13 +258,8 @@ export default {
label: "状态",
prop: "status",
width: "80px",
formatter: (cellValue) => {
return {
0: "草稿",
1: "启用",
2: "停用"
}[cellValue.status]
}
type: "slot",
addHtml: "statusSlot"
},
{
label: "创建时间",
......@@ -231,11 +273,13 @@ export default {
mounted() {
var params = { currentPage: 1, pageSize: 100, merchantIdName: "" }
getMerchantList(params).then((res) => {
this.getBaseData(res.list)
}).catch(()=>{
this.getBaseData([])
})
getMerchantList(params)
.then((res) => {
this.getBaseData(res.list)
})
.catch(() => {
this.getBaseData([])
})
},
methods: {
......@@ -272,7 +316,7 @@ export default {
for (const key in this.searchForm) {
this.searchForm[key] = ""
}
this.$refs.contentTable.refreshTable(true, true)
this.$refs.contentTable.refreshTable(true, true)
},
beforeSearchFn() {
return new Promise((resolve) => {
......@@ -291,21 +335,53 @@ export default {
this.$router.push({
name: "contentDetail",
params: {
id:row.id
id: row.id
}
})
},
mutiStartOrStop(type) {
let selectedData = []
console.log(this.$refs.contentTable.mutiSelectArr);
if (this.$refs.contentTable.mutiSelectArr.contentIndex) {
goStatisticsPage(row) {
this.$router.push({
name: "statisticsList",
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
}
let status = selectedData.map(v => { return v.status }) || []
if (status.includes(0) || !selectedData.length) { // 包含0草稿 未选择
let status =
selectedData.map((v) => {
return v.status
}) || []
if (status.includes(0) || !selectedData.length) {
// 包含0草稿 未选择
this.$message({
message: `请选择${type==2?'已停用':'已开启'}的内容`,
type: 'warning',
message: `请选择${type == 2 ? "已停用" : "已开启"}的内容`,
type: "warning",
showClose: true
})
return false
......@@ -320,7 +396,22 @@ export default {
cancelButtonText: "取消",
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) => {
console.log(err)
})
......@@ -329,4 +420,16 @@ export default {
}
</script>
<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>
<!-- 规则配置 -->
<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!