materialStatistics.vue 14 KB

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