Files
dvcp_v2_webapp/project/oms/apps/AppWechatStatistics/AppWechatStatistics.vue

269 lines
7.4 KiB
Vue
Raw Normal View History

2023-06-05 17:22:30 +08:00
<template>
2023-06-09 11:14:34 +08:00
<ai-list class="AppWechatStatistics">
2023-06-05 17:22:30 +08:00
<template slot="title">
2023-06-09 11:14:34 +08:00
<ai-title title="公众号统计" isShowBottomBorder :instance="instance" @change="onChange()">
2023-06-05 17:22:30 +08:00
<template #rightBtn>
2023-06-09 11:14:34 +08:00
<div class="flex" flex>
<el-radio-group style="margin: 0 12px;" v-model="search.type" size="small" @change="getInfo">
<el-radio-button label="0">昨日</el-radio-button>
<el-radio-button label="1">近七天</el-radio-button>
<el-radio-button label="2">近30天</el-radio-button>
</el-radio-group>
<el-date-picker
style="width: 240px; margin-right: 12px;"
v-model="date"
value-format="yyyy-MM-dd"
@change="onDateChange"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
size="small">
</el-date-picker>
<ai-select
:selectList="wechatList"
placeholder="请选择公众号"
v-model="search.appId"
@change="getInfo">
</ai-select>
</div>
2023-06-05 17:22:30 +08:00
</template>
</ai-title>
</template>
<template slot="content">
<div class="statistics-top">
<div class="statistics-top__item">
2023-06-09 11:14:34 +08:00
<span>曝光量</span>
<h2 style="color: #2266FF;">{{ info['曝光量'] || 0 }}</h2>
2023-06-05 17:22:30 +08:00
</div>
<div class="statistics-top__item">
2023-06-09 11:14:34 +08:00
<span>曝光率</span>
2023-06-09 17:44:27 +08:00
<h2 style="color: #22AA99;">{{ ((info['曝光率'] || 0) * 100).toFixed(2) + '%' || 0 }}</h2>
2023-06-05 17:22:30 +08:00
</div>
<div class="statistics-top__item">
2023-06-09 11:14:34 +08:00
<span>点击量</span>
<h2 style="color: #F8B425">{{ info['点击量'] || 0 }}</h2>
</div>
<div class="statistics-top__item">
<span>收入</span>
<h2 style="color: #2266FF;">{{ info['收入'] ? (info['收入'] / 100).toFixed(2) : 0 }}</h2>
</div>
<div class="statistics-top__item">
<span>已结算金额</span>
2023-06-09 14:29:30 +08:00
<h2 style="color: #22AA99;">{{ info['已结算金额'] || 0 }}</h2>
2023-06-05 17:22:30 +08:00
</div>
</div>
2023-06-09 11:14:34 +08:00
<ai-card title="每日收益明细">
2023-06-09 14:19:22 +08:00
<template #right>
<ai-download
:instance="instance"
url="/api/wxmppublisheradposgeneral/export"
2023-06-09 14:20:18 +08:00
:params="params" fileName="每日收益明细"
2023-06-09 14:19:22 +08:00
:disabled="tableData.length == 0">
<el-button icon="iconfont iconExported" :disabled="tableData.length == 0">导出</el-button>
</ai-download>
</template>
2023-06-09 11:14:34 +08:00
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
</ai-table>
</ai-card>
2023-06-05 17:22:30 +08:00
</template>
</ai-list>
</template>
<script>
export default {
2023-06-09 11:14:34 +08:00
name: 'AppWechatStatistics',
label: '公众号统计',
2023-06-05 17:22:30 +08:00
props: {
instance: Function,
dict: Object
},
data () {
return {
today: '',
2023-06-09 11:14:34 +08:00
date: '',
2023-06-05 17:22:30 +08:00
search: {
2023-06-09 11:14:34 +08:00
current: 1,
size: 10,
type: '0',
appId: ''
2023-06-05 17:22:30 +08:00
},
2023-06-09 11:14:34 +08:00
total: 0,
info: {},
tableData: [],
wechatList: [],
colConfigs: [
{ prop: 'ymd', label: '日期' },
2023-06-09 14:29:30 +08:00
{ prop: 'adSlot', label: '广告位类型', align: 'center', format: v => this.dict.getLabel('ad_slot', v) },
2023-06-09 11:14:34 +08:00
{ prop: 'reqSuccCount', label: '拉取量', align: 'center' },
{ prop: 'exposureCount', label: '曝光量', align: 'center' },
{ prop: 'exposureRate', label: '曝光率', align: 'center', format: v => (v * 100).toFixed(2) + '%' },
{ prop: 'clickCount', label: '点击量', align: 'center' },
{ prop: 'clickRate', label: '点击率', align: 'center', format: v => (v * 100).toFixed(2) + '%' },
2023-06-09 14:19:22 +08:00
{ prop: 'ecpm', label: 'eCPM', align: 'center', format: v => (v / 100).toFixed(2) },
{ prop: 'income', label: '收入(元)', align: 'center', format: v => (v / 100).toFixed(2) }
2023-06-09 11:14:34 +08:00
]
2023-06-05 17:22:30 +08:00
}
},
2023-06-09 14:19:22 +08:00
computed: {
params () {
return {
...this.search,
startTime: this.search.type === '3' ? this.date[0] : '',
endTime: this.search.type === '3' ? this.date[1] : ''
}
}
},
2023-06-05 17:22:30 +08:00
created () {
2023-06-09 11:14:34 +08:00
this.getInfo()
2023-06-09 14:29:30 +08:00
this.dict.load('ad_slot').then(() => {
this.getWechatList()
})
2023-06-05 17:22:30 +08:00
},
methods: {
2023-06-09 11:14:34 +08:00
onDateChange (e) {
if (!e) {
this.search.type = '0'
} else {
this.search.type = '3'
}
this.getInfo()
2023-06-05 17:22:30 +08:00
},
2023-06-09 11:14:34 +08:00
getInfo () {
2023-06-09 13:44:23 +08:00
this.instance.post(`/api/wxmppublisheradposgeneral/statistics`, null, {
2023-06-09 11:14:34 +08:00
params: {
...this.search,
startTime: this.search.type === '3' ? this.date[0] : '',
endTime: this.search.type === '3' ? this.date[1] : ''
}
}).then(res => {
if (res.code === 0) {
2023-06-09 14:40:47 +08:00
this.info = res.data || {}
2023-06-09 11:14:34 +08:00
this.getList()
}
})
},
2023-06-05 17:22:30 +08:00
2023-06-09 11:14:34 +08:00
getList () {
2023-06-09 13:44:23 +08:00
this.instance.post(`/api/wxmppublisheradposgeneral/list`, null, {
2023-06-09 11:14:34 +08:00
params: {
...this.search,
startTime: this.search.type === '3' ? this.date[0] : '',
endTime: this.search.type === '3' ? this.date[1] : ''
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
getWechatList () {
2023-06-09 14:13:05 +08:00
this.instance.post(`/api/wxmpconfig/queryMyAppids`).then(res => {
2023-06-09 11:14:34 +08:00
if (res.code == 0) {
2023-06-09 14:13:05 +08:00
this.wechatList = res.data.map(v => {
2023-06-09 11:14:34 +08:00
return {
dictValue: v.appId,
dictName: v.mpName
}
})
2023-06-09 17:44:27 +08:00
if (res.data.length) {
this.search.appId = res.data[0].appId
2023-06-12 09:20:19 +08:00
this.getInfo()
2023-06-09 17:44:27 +08:00
}
2023-06-09 11:14:34 +08:00
}
})
},
2023-06-05 17:22:30 +08:00
}
}
</script>
<style lang="scss" scoped>
2023-06-09 11:14:34 +08:00
.AppWechatStatistics {
2023-06-05 17:22:30 +08:00
.bottom {
display: flex;
align-items: center;
& > .ai-card {
flex: 1;
&:last-child {
margin-left: 20px;
}
}
}
:deep( .ai-list__content ){
padding: 0!important;
.ai-list__content--right-wrapper {
background: transparent!important;
box-shadow: none!important;
margin: 0!important;
padding: 12px 16px 12px!important;
}
}
2023-06-09 11:14:34 +08:00
:deep( .ai-card) {
.ai-card__body {
padding: 12px 16px;
}
}
2023-06-05 17:22:30 +08:00
.statistics-top {
display: flex;
align-items: center;
margin-bottom: 20px;
& > div {
flex: 1;
height: 96px;
line-height: 1;
margin-right: 20px;
padding: 16px 24px;
background: #FFFFFF;
box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.15);
border-radius: 4px;
&:last-child {
margin-right: 0;
}
h3 {
font-size: 24px;
}
span {
display: block;
margin-bottom: 16px;
color: #888888;
font-size: 16px;
}
}
}
.content {
padding: 16px;
background: #FFFFFF;
box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.15);
}
}
</style>