accountMaterStatistics.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. <style lang="scss" scoped>
  2. .search-bar {
  3. display: flex;
  4. align-items: center;
  5. }
  6. .search-box p {
  7. display: inline-block;
  8. border: 1px solid #f2f2f2;
  9. border-radius: 5px;
  10. margin-right: 10px;
  11. padding: 5px 10px;
  12. cursor: pointer;
  13. }
  14. </style>
  15. <style>
  16. .search-box .ant-card-body {
  17. padding: 5px 15px;
  18. }
  19. .ant-modal-wrap .yincang .ant-modal-content .ant-modal-footer {
  20. display: none !important;
  21. }
  22. .yincang .ant-col-6 p {
  23. text-align: left;
  24. color: red;
  25. font-size: 16px;
  26. font-weight: 500;
  27. }
  28. .ant-table-thead div {
  29. font-weight: 700;
  30. }
  31. .tool-tip {
  32. position: absolute;
  33. top: 65px;
  34. right: 10px;
  35. }
  36. th div {
  37. white-space: nowrap;
  38. }
  39. </style>
  40. <template>
  41. <div class="data-account-statistics">
  42. <a-row class="image-list-heading vm-panel">
  43. <div class="panel-heading" style="display:flex;justify-content: space-between;">
  44. {{ title }}
  45. <a-button @click="dianji">进入素材报表</a-button>
  46. </div>
  47. <a-row type="flex" align="middle" justify="space-between" class="panel-body">
  48. <div class="search-bar" style="width:100%">
  49. <span>账户选择:</span>
  50. <treeselect :appId.sync="appId" request="2,4"/>
  51. <a-button type="primary" style="margin:10px" @click="addUser">搜索</a-button>
  52. <a-button
  53. type="primary"
  54. icon="reload"
  55. @click="getDataReset"
  56. style="background-color:#67c23a;border-color:#67c23a"
  57. >刷新</a-button
  58. >
  59. <a-button type="primary" style="margin:10px" @click="getDataResetAll">重置</a-button>
  60. </div>
  61. </a-row>
  62. <a-row>
  63. <a-col :span="24">
  64. <a-card :bordered="false" class="search-box">
  65. <time-check
  66. @getAdd="getAdd"
  67. :startValue.sync="startValue"
  68. :timeList="timeList"
  69. ref="timeCheck"
  70. :activeNow="2"
  71. ></time-check>
  72. </a-card>
  73. </a-col>
  74. </a-row>
  75. </a-row>
  76. <a-row :gutter="10" style="margin-top:10px">
  77. <a-col :span="24">
  78. <a-card style="width:100%;">
  79. <a-table
  80. :columns="columns"
  81. :dataSource="data"
  82. bordered
  83. id="outTable"
  84. :pagination="ipagination"
  85. size="middle"
  86. :customRow="rowClick"
  87. :loading="loading"
  88. :scroll="{ x: 2400 }"
  89. >
  90. <div slot="url" slot-scope="url">
  91. <video class="video" :src="url" controls="controls" style="height:200px;width:112.5px">
  92. 您的浏览器不支持 video 标签。
  93. </video>
  94. </div>
  95. <span slot="photoClickRatio" slot-scope="photoClickRatio">{{ photoClickRatio | getBo }}</span>
  96. <span slot="actionRatio" slot-scope="actionRatio">{{ actionRatio | getBo }}</span>
  97. <span slot="impression1kCost" slot-scope="impression1kCost">{{ impression1kCost | toFixtwo }}</span>
  98. <span slot="photoClickCost" slot-scope="photoClickCost">{{ photoClickCost | toFixtwo }}</span>
  99. <span slot="actionCost" slot-scope="actionCost">{{ actionCost | toFixtwo }}</span>
  100. <span slot="conversionPrice" slot-scope="conversionPrice">{{ conversionPrice | toFixtwo }}</span>
  101. <span slot="operation" slot-scope="text,record">
  102. <a href="javascript:;" @click.stop="showRelevantPeople(record)">查看相关人员</a>
  103. </span>
  104. </a-table>
  105. </a-card>
  106. </a-col>
  107. </a-row>
  108. <div class="relevantPeople">
  109. <a-modal v-model="relevantPeopleVisible" title="相关人员" :footer="null" :centered='true'>
  110. <p>编导:{{relevantPeopleData.planName || '暂无数据'}}</p>
  111. <p>剪辑:{{relevantPeopleData.clipName || '暂无数据'}}</p>
  112. <p>拍摄:{{relevantPeopleData.shotName || '暂无数据'}}</p>
  113. </a-modal>
  114. </div>
  115. <ratio-modal ref="ratio" />
  116. </div>
  117. </template>
  118. <script>
  119. import ARow from 'ant-design-vue/es/grid/Row'
  120. import ACol from 'ant-design-vue/es/grid/Col'
  121. import countTo from 'vue-count-to'
  122. import moment from 'moment'
  123. import { getMaterialReportByAccount } from '@api/statistics'
  124. import axios from 'axios'
  125. import lifting from './components/lifting'
  126. import timeCheck from './components/timeCheck'
  127. import ratioModal from './components/ratioModal'
  128. import { mapGetters } from 'vuex'
  129. import { JeecgListMixin } from '@/mixins/ipagination'
  130. // import the component
  131. import Treeselect from './components/Treeselect.vue'
  132. import { getAction } from '../../../api/manage'
  133. // 引入基本模板
  134. let echarts = require('echarts/lib/echarts')
  135. // 引入柱状图组件
  136. require('echarts/lib/chart/bar')
  137. require('echarts/lib/chart/pie')
  138. require('echarts/lib/chart/line')
  139. // 引入提示框和title组件
  140. require('echarts/lib/component/tooltip')
  141. require('echarts/lib/component/title')
  142. require('echarts/lib/component/graphic')
  143. require('echarts/lib/component/toolbox')
  144. require('echarts/lib/component/legend')
  145. var length = 0
  146. var active = 1
  147. const columns = [
  148. {
  149. title: '视频',
  150. dataIndex: 'url',
  151. key: 'url',
  152. align: 'center',
  153. scopedSlots: { customRender: 'url' },
  154. fixed: 'left',
  155. width: 150
  156. },
  157. {
  158. title: '视频md5',
  159. dataIndex: 'signature',
  160. key: 'signature',
  161. align: 'center',
  162. scopedSlots: { customRender: 'signature' },
  163. fixed: 'left',
  164. width: 250
  165. },
  166. {
  167. title: '花费',
  168. dataIndex: 'cost',
  169. key: 'cost',
  170. align: 'center',
  171. sorter: (a, b) => a.cost - b.cost
  172. },
  173. {
  174. title: '安卓下载完成数',
  175. dataIndex: 'downloadCompleted',
  176. key: 'downloadCompleted',
  177. align: 'center',
  178. sorter: (a, b) => a.downloadCompleted - b.downloadCompleted
  179. },
  180. {
  181. title: '封面曝光数',
  182. dataIndex: 'photoShow',
  183. key: 'photoShow',
  184. align: 'center',
  185. sorter: (a, b) => a.photoShow - b.photoShow
  186. },
  187. {
  188. title: '封面点击数',
  189. dataIndex: 'photoClick',
  190. key: 'photoClick',
  191. align: 'center',
  192. sorter: (a, b) => a.photoClick - b.photoClick
  193. },
  194. {
  195. title: '素材曝光数',
  196. dataIndex: 'aclick',
  197. key: 'aclick',
  198. align: 'center',
  199. sorter: (a, b) => a.aclick - b.aclick
  200. },
  201. {
  202. title: '行为数',
  203. dataIndex: 'bclick',
  204. key: 'bclick',
  205. align: 'center',
  206. sorter: (a, b) => a.bclick - b.bclick
  207. },
  208. {
  209. title: '封面点击率',
  210. dataIndex: 'photoClickRatio',
  211. key: 'photoClickRatio',
  212. align: 'center',
  213. scopedSlots: { customRender: 'photoClickRatio' },
  214. sorter: (a, b) => a.photoClickRatio - b.photoClickRatio
  215. },
  216. {
  217. title: '行为率',
  218. dataIndex: 'actionRatio',
  219. key: 'actionRatio',
  220. align: 'center',
  221. scopedSlots: { customRender: 'actionRatio' },
  222. sorter: (a, b) => a.actionRatio - b.actionRatio
  223. },
  224. {
  225. title: '均千次封面曝光花费(元)',
  226. dataIndex: 'impression1kCost',
  227. key: 'impression1kCost',
  228. scopedSlots: { customRender: 'impression1kCost' },
  229. align: 'center',
  230. sorter: (a, b) => a.impression1kCost - b.impression1kCost,
  231. },
  232. {
  233. title: '平均封面点击单价(元)',
  234. dataIndex: 'photoClickCost',
  235. key: 'photoClickCost',
  236. scopedSlots: { customRender: 'photoClickCost' },
  237. align: 'center',
  238. sorter: (a, b) => a.photoClickCost - b.photoClickCost,
  239. },
  240. {
  241. title: '平均行为单价(元)',
  242. dataIndex: 'actionCost',
  243. key: 'actionCost',
  244. scopedSlots: { customRender: 'actionCost' },
  245. align: 'center',
  246. sorter: (a, b) => a.actionCost - b.actionCost
  247. },
  248. {
  249. title: '转化数',
  250. dataIndex: 'conversions',
  251. key: 'conversions',
  252. align: 'center',
  253. sorter: (a, b) => a.conversions - b.conversions
  254. },
  255. {
  256. title: '转化单价(元)',
  257. dataIndex: 'conversionPrice',
  258. key: 'conversionPrice',
  259. scopedSlots: { customRender: 'conversionPrice' },
  260. align: 'center',
  261. sorter: (a, b) => a.conversionPrice - b.conversionPrice
  262. },
  263. {
  264. title:'相关人员',
  265. dataIndex:'operation',
  266. key:'operation',
  267. scopedSlots: { customRender: 'operation' },
  268. align: 'center',
  269. width:120,
  270. }
  271. ]
  272. const columnsDetail = [
  273. {
  274. title: '日期',
  275. dataIndex: 'statDate',
  276. key: 'statDate',
  277. align: 'center'
  278. },
  279. {
  280. title: '花费',
  281. dataIndex: 'cost',
  282. key: 'cost',
  283. align: 'center'
  284. },
  285. {
  286. title: '封面曝光数',
  287. dataIndex: 'photoShow',
  288. key: 'photoShow',
  289. align: 'center'
  290. },
  291. {
  292. title: '封面点击数',
  293. dataIndex: 'photoClick',
  294. key: 'photoClick',
  295. align: 'center'
  296. },
  297. {
  298. title: '素材曝光数',
  299. dataIndex: 'aclick',
  300. key: 'aclick',
  301. align: 'center'
  302. },
  303. {
  304. title: '行为数',
  305. dataIndex: 'bclick',
  306. key: 'bclick',
  307. align: 'center'
  308. },
  309. {
  310. title: '封面点击率',
  311. dataIndex: 'photoClickRatio',
  312. key: 'photoClickRatio',
  313. align: 'center',
  314. scopedSlots: { customRender: 'photoClickRatio' }
  315. },
  316. {
  317. title: '行为率',
  318. dataIndex: 'actionRatio',
  319. key: 'actionRatio',
  320. align: 'center',
  321. scopedSlots: { customRender: 'actionRatio' }
  322. },
  323. {
  324. title: '均千次封面曝光花费(元)',
  325. dataIndex: 'impression1kCost',
  326. key: 'impression1kCost',
  327. scopedSlots: { customRender: 'impression1kCost' },
  328. align: 'center'
  329. },
  330. {
  331. title: '平均封面点击单价(元)',
  332. dataIndex: 'photoClickCost',
  333. key: 'photoClickCost',
  334. scopedSlots: { customRender: 'photoClickCost' },
  335. align: 'center'
  336. },
  337. {
  338. title: '平均行为单价(元)',
  339. dataIndex: 'actionCost',
  340. key: 'actionCost',
  341. scopedSlots: { customRender: 'actionCost' },
  342. align: 'center'
  343. },
  344. {
  345. title: '转化数',
  346. dataIndex: 'conversions',
  347. key: 'conversions',
  348. align: 'center'
  349. },
  350. {
  351. title: '转化单价(元)',
  352. dataIndex: 'conversionPrice',
  353. key: 'conversionPrice',
  354. scopedSlots: { customRender: 'conversionPrice' },
  355. align: 'center'
  356. }
  357. ]
  358. export default {
  359. name: 'data-display-statistics',
  360. components: {
  361. ACol,
  362. ARow,
  363. countTo,
  364. lifting,
  365. timeCheck,
  366. ratioModal,
  367. Treeselect
  368. },
  369. mixins: [JeecgListMixin],
  370. data: function() {
  371. return {
  372. relevantPeopleVisible:false,
  373. relevantPeopleData:{},
  374. title: '账户素材报表',
  375. show: true,
  376. timeList: [
  377. // { label: '今天', value: 1, show: false },
  378. { label: '昨天', value: 2, show: true },
  379. { label: '近一周', value: 3, show: true },
  380. { label: '近十五天', value: 4, show: true },
  381. { label: '近一月', value: 5, show: true },
  382. { label: '近三月', value: 6, show: true }
  383. ],
  384. active: 2,
  385. data: [],
  386. columns,
  387. columnsDetail,
  388. list: [],
  389. appId: [],
  390. startValue: [],
  391. allValue: [],
  392. loading: false,
  393. rowClick: record => ({
  394. // 事件
  395. on: {
  396. click: () => {
  397. // 点击改行时要做的事情
  398. // this.detail = record
  399. // this.visible = true
  400. // this.getMineList(record.signature)
  401. this.$refs.ratio.getMineList(record, this.active)
  402. }
  403. }
  404. }),
  405. }
  406. },
  407. filters: {
  408. formatDate: function(value) {
  409. let date = new Date(value)
  410. let y = date.getFullYear()
  411. let MM = date.getMonth() + 1
  412. MM = MM < 10 ? '0' + MM : MM
  413. let d = date.getDate()
  414. d = d < 10 ? '0' + d : d
  415. let h = date.getHours()
  416. h = h < 10 ? '0' + h : h
  417. let m = date.getMinutes()
  418. m = m < 10 ? '0' + m : m
  419. let s = date.getSeconds()
  420. s = s < 10 ? '0' + s : s
  421. return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
  422. },
  423. toFixtwo: function(value) {
  424. if (value) {
  425. return value.toFixed(2)
  426. } else {
  427. return 0.0
  428. }
  429. },
  430. getBo: function(value) {
  431. if (value) {
  432. return (value * 100).toFixed(2) + '%'
  433. } else {
  434. return '0.00%'
  435. }
  436. }
  437. },
  438. methods: {
  439. moment,
  440. ...mapGetters(['nickname', 'avatar', 'userInfo']),
  441. // 查看相关人员
  442. showRelevantPeople(record){
  443. this.relevantPeopleVisible=true;
  444. console.log(record)
  445. getAction('/ctop/materialAscription/getDetail',{
  446. code:record.signature
  447. }).then(res=>{
  448. console.log(res);
  449. if(res.result&&res.success){
  450. this.relevantPeopleData=res.result
  451. }
  452. })
  453. },
  454. disabledDate(current) {
  455. return current && current > moment().endOf('day')
  456. },
  457. handleChange(value) {
  458. console.log(value)
  459. // this.appId = value
  460. },
  461. getElseData(value) {
  462. this.getStatistics()
  463. },
  464. handleBlur() {
  465. console.log('blur')
  466. },
  467. getDataReset() {
  468. this.active = 2
  469. this.allValue = []
  470. this.addUser()
  471. },
  472. getDataResetAll() {
  473. this.active = 2
  474. this.$refs.timeCheck.active = 1
  475. this.allValue = []
  476. this.appId = []
  477. this.data = []
  478. },
  479. addUser() {
  480. this.loading = true
  481. var that = this
  482. if (this.appId.length > 0) {
  483. var params = {}
  484. params.accountIds = JSON.stringify(that.appId)
  485. params.type = that.active
  486. if (that.active == 9) {
  487. params.startDate = this.allValue[0]
  488. params.endDate = this.allValue[1]
  489. }
  490. } else {
  491. this.$message.error('请选择账户')
  492. return
  493. }
  494. getMaterialReportByAccount(params).then(res => {
  495. if (res.success) {
  496. if (res.result.length > 0) {
  497. this.data = res.result
  498. this.ipagination.total = res.result.length
  499. } else {
  500. this.$message.error('选择的账户无数据')
  501. }
  502. this.loading = false
  503. } else {
  504. this.$message.error(res.message)
  505. this.loading = false
  506. }
  507. })
  508. },
  509. getStatistics() {
  510. var params = {}
  511. params.accountIds = JSON.stringify(this.appId)
  512. params.type = this.active
  513. params.statHour = this.statHour
  514. params.discount = this.discount
  515. if (this.active == 9) {
  516. params.startDate = this.allValue[0]
  517. params.endDate = this.allValue[1]
  518. }
  519. this.data = []
  520. },
  521. getAdd(checked) {
  522. if (checked == 9) {
  523. if (this.startValue.length > 0 && this.startValue[0]) {
  524. this.allValue[0] = moment(this.startValue[0]._d).format('YYYY-MM-DD')
  525. this.allValue[1] = moment(this.startValue[1]._d).format('YYYY-MM-DD')
  526. }
  527. } else {
  528. this.startValue = []
  529. this.allValue = []
  530. }
  531. this.active = checked
  532. active = checked
  533. this.ipagination.current = 1
  534. this.addUser(checked)
  535. },
  536. dianji() {
  537. this.$router.replace({ path: '/Statistics/materialStatistics' })
  538. }
  539. },
  540. watch: {},
  541. distoryed() {},
  542. mounted: function() {
  543. this.$nextTick(() => {})
  544. }
  545. }
  546. </script>