123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511 |
- <style lang="scss" scoped>
- .search-bar {
- display: flex;
- align-items: center;
- }
- .search-box p {
- display: inline-block;
- border: 1px solid #f2f2f2;
- border-radius: 5px;
- margin-right: 10px;
- padding: 5px 10px;
- cursor: pointer;
- }
- </style>
- <style>
- .search-box .ant-card-body {
- padding: 5px 15px;
- }
- .ant-modal-wrap .yincang .ant-modal-content .ant-modal-footer {
- display: none !important;
- }
- .yincang .ant-col-6 p {
- text-align: left;
- color: red;
- font-size: 16px;
- font-weight: 500;
- }
- .ant-table-thead div {
- font-weight: 700;
- }
- .tool-tip {
- position: absolute;
- top: 65px;
- right: 10px;
- }
- th div {
- white-space: nowrap;
- }
- </style>
- <template>
- <div class="data-account-statistics">
- <a-row class="image-list-heading vm-panel">
- <div class="panel-heading" style="display:flex;justify-content: space-between;">
- {{ title }}
- <a-button @click="dianji">进入素材报表</a-button>
- </div>
- <a-row type="flex" align="middle" justify="space-between" class="panel-body">
- <div class="search-bar" style="width:100%">
- <span>账户选择:</span>
- <treeselect :appId.sync="appId" request="2,4"/>
- <a-button type="primary" style="margin:10px" @click="addUser">搜索</a-button>
- <a-button
- type="primary"
- icon="reload"
- @click="getDataReset"
- style="background-color:#67c23a;border-color:#67c23a"
- >刷新</a-button
- >
- <a-button type="primary" style="margin:10px" @click="getDataResetAll">重置</a-button>
- </div>
- </a-row>
- <a-row>
- <a-col :span="24">
- <a-card :bordered="false" class="search-box">
- <time-check
- @getAdd="getAdd"
- :startValue.sync="startValue"
- :timeList="timeList"
- ref="timeCheck"
- :activeNow="2"
- ></time-check>
- </a-card>
- </a-col>
- </a-row>
- </a-row>
- <a-row :gutter="10" style="margin-top:10px">
- <a-col :span="24">
- <a-card style="width:100%;">
- <a-table
- :columns="columns"
- :dataSource="data"
- bordered
- id="outTable"
- :pagination="ipagination"
- size="middle"
- :customRow="rowClick"
- :loading="loading"
- :scroll="{ x: 2000 }"
- >
- <div slot="url" slot-scope="url">
- <video class="video" :src="url" controls="controls" style="height:200px;width:112.5px">
- 您的浏览器不支持 video 标签。
- </video>
- </div>
- <span slot="photoClickRatio" slot-scope="photoClickRatio">{{ photoClickRatio | getBo }}</span>
- <span slot="actionRatio" slot-scope="actionRatio">{{ actionRatio | getBo }}</span>
- <span slot="impression1kCost" slot-scope="impression1kCost">{{ impression1kCost | toFixtwo }}</span>
- <span slot="photoClickCost" slot-scope="photoClickCost">{{ photoClickCost | toFixtwo }}</span>
- <span slot="actionCost" slot-scope="actionCost">{{ actionCost | toFixtwo }}</span>
- <span slot="conversionPrice" slot-scope="conversionPrice">{{ conversionPrice | toFixtwo }}</span>
- </a-table>
- </a-card>
- </a-col>
- </a-row>
- <ratio-modal ref="ratio" />
- </div>
- </template>
- <script>
- import ARow from 'ant-design-vue/es/grid/Row'
- import ACol from 'ant-design-vue/es/grid/Col'
- import countTo from 'vue-count-to'
- import moment from 'moment'
- import { getMaterialReportByAccount } from '@api/statistics'
- import axios from 'axios'
- import lifting from './components/lifting'
- import timeCheck from './components/timeCheck'
- import ratioModal from './components/ratioModal'
- import { mapGetters } from 'vuex'
- import { JeecgListMixin } from '@/mixins/ipagination'
- // import the component
- import Treeselect from './components/Treeselect.vue'
- // 引入基本模板
- let echarts = require('echarts/lib/echarts')
- // 引入柱状图组件
- require('echarts/lib/chart/bar')
- require('echarts/lib/chart/pie')
- require('echarts/lib/chart/line')
- // 引入提示框和title组件
- require('echarts/lib/component/tooltip')
- require('echarts/lib/component/title')
- require('echarts/lib/component/graphic')
- require('echarts/lib/component/toolbox')
- require('echarts/lib/component/legend')
- var length = 0
- var active = 1
- const columns = [
- {
- title: '视频',
- dataIndex: 'url',
- key: 'url',
- align: 'center',
- scopedSlots: { customRender: 'url' },
- fixed: 'left',
- width: 150
- },
- {
- title: '花费',
- dataIndex: 'cost',
- key: 'cost',
- align: 'center',
- sorter: (a, b) => a.cost - b.cost
- },
- {
- title: '安卓下载完成数',
- dataIndex: 'downloadCompleted',
- key: 'downloadCompleted',
- align: 'center',
- sorter: (a, b) => a.downloadCompleted - b.downloadCompleted
- },
- {
- title: '封面曝光数',
- dataIndex: 'photoShow',
- key: 'photoShow',
- align: 'center',
- sorter: (a, b) => a.photoShow - b.photoShow
- },
- {
- title: '封面点击数',
- dataIndex: 'photoClick',
- key: 'photoClick',
- align: 'center',
- sorter: (a, b) => a.photoClick - b.photoClick
- },
- {
- title: '素材曝光数',
- dataIndex: 'aclick',
- key: 'aclick',
- align: 'center',
- sorter: (a, b) => a.aclick - b.aclick
- },
- {
- title: '行为数',
- dataIndex: 'bclick',
- key: 'bclick',
- align: 'center',
- sorter: (a, b) => a.bclick - b.bclick
- },
- {
- title: '封面点击率',
- dataIndex: 'photoClickRatio',
- key: 'photoClickRatio',
- align: 'center',
- scopedSlots: { customRender: 'photoClickRatio' },
- sorter: (a, b) => a.photoClickRatio - b.photoClickRatio
- },
- {
- title: '行为率',
- dataIndex: 'actionRatio',
- key: 'actionRatio',
- align: 'center',
- scopedSlots: { customRender: 'actionRatio' },
- sorter: (a, b) => a.actionRatio - b.actionRatio
- },
- {
- title: '均千次封面曝光花费(元)',
- dataIndex: 'impression1kCost',
- key: 'impression1kCost',
- scopedSlots: { customRender: 'impression1kCost' },
- align: 'center',
- sorter: (a, b) => a.impression1kCost - b.impression1kCost
- },
- {
- title: '平均封面点击单价(元)',
- dataIndex: 'photoClickCost',
- key: 'photoClickCost',
- scopedSlots: { customRender: 'photoClickCost' },
- align: 'center',
- sorter: (a, b) => a.photoClickCost - b.photoClickCost
- },
- {
- title: '平均行为单价(元)',
- dataIndex: 'actionCost',
- key: 'actionCost',
- scopedSlots: { customRender: 'actionCost' },
- align: 'center',
- sorter: (a, b) => a.actionCost - b.actionCost
- },
- {
- title: '转化数',
- dataIndex: 'conversions',
- key: 'conversions',
- align: 'center',
- sorter: (a, b) => a.conversions - b.conversions
- },
- {
- title: '转化单价(元)',
- dataIndex: 'conversionPrice',
- key: 'conversionPrice',
- scopedSlots: { customRender: 'conversionPrice' },
- align: 'center',
- sorter: (a, b) => a.conversionPrice - b.conversionPrice
- }
- ]
- const columnsDetail = [
- {
- title: '日期',
- dataIndex: 'statDate',
- key: 'statDate',
- align: 'center'
- },
- {
- title: '花费',
- dataIndex: 'cost',
- key: 'cost',
- align: 'center'
- },
- {
- title: '封面曝光数',
- dataIndex: 'photoShow',
- key: 'photoShow',
- align: 'center'
- },
- {
- title: '封面点击数',
- dataIndex: 'photoClick',
- key: 'photoClick',
- align: 'center'
- },
- {
- title: '素材曝光数',
- dataIndex: 'aclick',
- key: 'aclick',
- align: 'center'
- },
- {
- title: '行为数',
- dataIndex: 'bclick',
- key: 'bclick',
- align: 'center'
- },
- {
- title: '封面点击率',
- dataIndex: 'photoClickRatio',
- key: 'photoClickRatio',
- align: 'center',
- scopedSlots: { customRender: 'photoClickRatio' }
- },
- {
- title: '行为率',
- dataIndex: 'actionRatio',
- key: 'actionRatio',
- align: 'center',
- scopedSlots: { customRender: 'actionRatio' }
- },
- {
- title: '均千次封面曝光花费(元)',
- dataIndex: 'impression1kCost',
- key: 'impression1kCost',
- scopedSlots: { customRender: 'impression1kCost' },
- align: 'center'
- },
- {
- title: '平均封面点击单价(元)',
- dataIndex: 'photoClickCost',
- key: 'photoClickCost',
- scopedSlots: { customRender: 'photoClickCost' },
- align: 'center'
- },
- {
- title: '平均行为单价(元)',
- dataIndex: 'actionCost',
- key: 'actionCost',
- scopedSlots: { customRender: 'actionCost' },
- align: 'center'
- },
- {
- title: '转化数',
- dataIndex: 'conversions',
- key: 'conversions',
- align: 'center'
- },
- {
- title: '转化单价(元)',
- dataIndex: 'conversionPrice',
- key: 'conversionPrice',
- scopedSlots: { customRender: 'conversionPrice' },
- align: 'center'
- }
- ]
- export default {
- name: 'data-display-statistics',
- components: {
- ACol,
- ARow,
- countTo,
- lifting,
- timeCheck,
- ratioModal,
- Treeselect
- },
- mixins: [JeecgListMixin],
- data: function() {
- return {
- title: '账户素材报表',
- show: true,
- timeList: [
- // { label: '今天', value: 1, show: false },
- { label: '昨天', value: 2, show: true },
- { label: '近一周', value: 3, show: true },
- { label: '近十五天', value: 4, show: true },
- { label: '近一月', value: 5, show: true },
- { label: '近三月', value: 6, show: true }
- ],
- active: 2,
- data: [],
- columns,
- columnsDetail,
- list: [],
- appId: [],
- startValue: [],
- allValue: [],
- loading: false,
- rowClick: record => ({
- // 事件
- on: {
- click: () => {
- // 点击改行时要做的事情
- // this.detail = record
- // this.visible = true
- // this.getMineList(record.signature)
- this.$refs.ratio.getMineList(record, this.active)
- }
- }
- })
- }
- },
- filters: {
- formatDate: function(value) {
- let date = new Date(value)
- let y = date.getFullYear()
- let MM = date.getMonth() + 1
- MM = MM < 10 ? '0' + MM : MM
- let d = date.getDate()
- d = d < 10 ? '0' + d : d
- let h = date.getHours()
- h = h < 10 ? '0' + h : h
- let m = date.getMinutes()
- m = m < 10 ? '0' + m : m
- let s = date.getSeconds()
- s = s < 10 ? '0' + s : s
- return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
- },
- toFixtwo: function(value) {
- if (value) {
- return value.toFixed(2)
- } else {
- return 0.0
- }
- },
- getBo: function(value) {
- if (value) {
- return (value * 100).toFixed(2) + '%'
- } else {
- return '0.00%'
- }
- }
- },
- methods: {
- moment,
- ...mapGetters(['nickname', 'avatar', 'userInfo']),
- disabledDate(current) {
- return current && current > moment().endOf('day')
- },
- handleChange(value) {
- console.log(value)
- // this.appId = value
- },
- getElseData(value) {
- this.getStatistics()
- },
- handleBlur() {
- console.log('blur')
- },
- getDataReset() {
- this.active = 2
- this.allValue = []
- this.addUser()
- },
- getDataResetAll() {
- this.active = 2
- this.$refs.timeCheck.active = 1
- this.allValue = []
- this.appId = []
- this.data = []
- },
- addUser() {
- this.loading = true
- var that = this
- if (this.appId.length > 0) {
- var params = {}
- params.accountIds = JSON.stringify(that.appId)
- params.type = that.active
- if (that.active == 9) {
- params.startDate = this.allValue[0]
- params.endDate = this.allValue[1]
- }
- } else {
- this.$message.error('请选择账户')
- return
- }
- getMaterialReportByAccount(params).then(res => {
- if (res.success) {
- if (res.result.length > 0) {
- this.data = res.result
- this.ipagination.total = res.result.length
- } else {
- this.$message.error('选择的账户无数据')
- }
- this.loading = false
- } else {
- this.$message.error(res.message)
- this.loading = false
- }
- })
- },
- getStatistics() {
- var params = {}
- params.accountIds = JSON.stringify(this.appId)
- params.type = this.active
- params.statHour = this.statHour
- params.discount = this.discount
- if (this.active == 9) {
- params.startDate = this.allValue[0]
- params.endDate = this.allValue[1]
- }
- this.data = []
- },
- getAdd(checked) {
- if (checked == 9) {
- if (this.startValue.length > 0 && this.startValue[0]) {
- this.allValue[0] = moment(this.startValue[0]._d).format('YYYY-MM-DD')
- this.allValue[1] = moment(this.startValue[1]._d).format('YYYY-MM-DD')
- }
- } else {
- this.startValue = []
- this.allValue = []
- }
- this.active = checked
- active = checked
- this.ipagination.current = 1
- this.addUser(checked)
- },
- dianji() {
- this.$router.replace({ path: '/Statistics/materialStatistics' })
- }
- },
- watch: {},
- distoryed() {},
- mounted: function() {
- this.$nextTick(() => {})
- }
- }
- </script>
|