refuseData.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <style></style>
  2. <template>
  3. <div class="data-refuse-statistics">
  4. <a-row class="image-list-heading vm-panel">
  5. <a-row type="flex" align="middle" justify="space-between" class="panel-body">
  6. <div class="search-bar" style="width:100%;display:flex">
  7. <span style="line-height:35px;margin-left:15px">账户选择:</span>
  8. <treeselect :appId.sync="appId" :multiple="false" />
  9. <a-button type="primary" style="margin-left:10px" @click="(ipagination.current=1);addUser()">搜索</a-button>
  10. </div>
  11. </a-row>
  12. </a-row>
  13. <a-row :gutter="10" style="margin-top:10px">
  14. <a-col :span="24">
  15. <a-card style="width:100%;">
  16. <!-- <div style="display:flex;margin:0 0 20px 0">
  17. <a-input placeholder="请输出要查找的创意名称" style="width:300px;" v-model="keyWord" />
  18. <a-button type="primary" style="margin-left:10px" @click="addUserKey">搜索</a-button>
  19. <a-button type="primary" style="margin-left:10px" @click="clickAgain" v-if="selectedRowKeys.length>0"
  20. :loading="loadingList">一键重提
  21. </a-button>
  22. </div> -->
  23. <a-table :columns="columns" :dataSource="dataList" bordered :loading="loading" size="middle"
  24. :pagination="ipagination" :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
  25. <!-- <div slot="videoUrl" slot-scope="videoUrl">
  26. <video class="video" :src="videoUrl" controls="controls" style="height:200px;width:112.5px">
  27. 您的浏览器不支持 video 标签。
  28. </video>
  29. </div> -->
  30. <template slot="campaignName" slot-scope="text, record">
  31. <div style="display:flex;justify-content: center;">
  32. <a @click="toDetail(record)" class="count" v-show="!record.editName">{{ text }}</a>
  33. </div>
  34. </template>
  35. <span slot="campaignType" slot-scope="text">
  36. {{ text | typeStatus }}
  37. </span>
  38. <span slot="status" slot-scope="text">
  39. {{ text | status }}
  40. </span>
  41. <span slot="putStatus" slot-scope="text">
  42. {{ text | putStatus }}
  43. </span>
  44. <span slot="createChannel" slot-scope="text">
  45. {{ text | createChannel }}
  46. </span>
  47. <template slot="dayBudget" slot-scope="text, record">
  48. <div style="display:flex;justify-content: center;">
  49. <span class="count">{{ text ? (text / 1000).toFixed(2) : '不限制预算' }}</span>
  50. </div>
  51. </template>
  52. <div slot="coverUrl" slot-scope="coverUrl">
  53. <img :src="coverUrl" controls="controls" style="height:200px;width:112.5px" />
  54. </div>
  55. <template slot="creativeName" slot-scope="text, record">
  56. <div>
  57. {{ text }}
  58. <a-icon type="edit" style="cursor: pointer;" @click="onCellChange(record, 'creativeName')" />
  59. </div>
  60. </template>
  61. <template slot="description" slot-scope="text, record">
  62. <div>
  63. {{ text }}
  64. <a-icon type="edit" style="cursor: pointer;" @click="onCellChange(record, 'description')" />
  65. </div>
  66. </template>
  67. </a-table>
  68. </a-card>
  69. </a-col>
  70. </a-row>
  71. <a-modal :title="editTitle" :visible="visible" @ok="handleOk" :confirmLoading="confirmLoading"
  72. @cancel="handleCancel">
  73. <a-textarea v-model="editWord" autosize />
  74. </a-modal>
  75. <a-modal v-model="visibleFail" title="重提信息" :footer="null">
  76. <div v-if="fail">
  77. 修改成功条数:{{ fail.successCount }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;失败条数:{{
  78. fail.failCount
  79. }}
  80. <div style="margin-top:20px">
  81. <p v-for="(item, index) of fail.failInfo" :key="index">
  82. <span>名称:{{ item.campaignName?item.campaignName:item.unitName }}</span><br />
  83. <span>错误信息:{{ item.message }}</span>
  84. </p>
  85. </div>
  86. </div>
  87. </a-modal>
  88. </div>
  89. </template>
  90. <script>
  91. import moment from 'moment'
  92. import {
  93. getRefuseCreative,
  94. updateCreative,
  95. selectByCreateName
  96. } from '@api/statistics'
  97. import axios from 'axios'
  98. import EditableCell from './components/EditableCell'
  99. import {
  100. mapGetters
  101. } from 'vuex'
  102. import {
  103. deleteAction,
  104. getAction,
  105. postAction
  106. } from '@/api/manage'
  107. import Treeselect from './components/Treeselect.vue'
  108. import {
  109. stopOtherVideo,
  110. closeAllVideoFun
  111. } from '@/utils/videoControl' // 停止除当前外的其他视频播放,及停止所有视频播放的方法
  112. const columns = [{
  113. title: '账号Id',
  114. dataIndex: 'accountId',
  115. key: 'accountId',
  116. align: 'center'
  117. },
  118. {
  119. title: '计划Id',
  120. dataIndex: 'campaignId',
  121. key: 'campaignId',
  122. align: 'center'
  123. },
  124. {
  125. title: '广告组id',
  126. dataIndex: 'unitId',
  127. key: 'unitId',
  128. align: 'center'
  129. },
  130. {
  131. title: '创意id',
  132. dataIndex: 'creativeId',
  133. key: 'photoClick',
  134. align: 'center'
  135. },
  136. {
  137. title: '创意名称',
  138. dataIndex: 'creativeName',
  139. key: 'creativeName',
  140. align: 'left',
  141. scopedSlots: {
  142. customRender: 'creativeName'
  143. }
  144. },
  145. // {
  146. // title: '视频',
  147. // dataIndex: 'videoUrl',
  148. // key: 'videoUrl',
  149. // align: 'center',
  150. // scopedSlots: {
  151. // customRender: 'videoUrl'
  152. // }
  153. // },
  154. {
  155. title: '封面',
  156. dataIndex: 'coverUrl',
  157. key: 'coverUrl',
  158. align: 'center',
  159. scopedSlots: {
  160. customRender: 'coverUrl'
  161. }
  162. },
  163. {
  164. title: '拒绝原因',
  165. dataIndex: 'reviewDetail',
  166. key: 'reviewDetail',
  167. align: 'left'
  168. },
  169. {
  170. title: '广告语',
  171. dataIndex: 'description',
  172. key: 'description',
  173. align: 'left',
  174. scopedSlots: {
  175. customRender: 'description'
  176. }
  177. }
  178. ]
  179. var columnsCam = [{
  180. title: '广告计划名称',
  181. align: 'center',
  182. dataIndex: 'campaignName',
  183. fixed: 'left',
  184. width: 300,
  185. scopedSlots: {
  186. customRender: 'campaignName'
  187. }
  188. },
  189. {
  190. title: '计划单日预算金额',
  191. align: 'center',
  192. dataIndex: 'dayBudget',
  193. scopedSlots: {
  194. customRender: 'dayBudget'
  195. },
  196. width: 200
  197. },
  198. {
  199. title: '计划状态',
  200. align: 'center',
  201. dataIndex: 'status',
  202. scopedSlots: {
  203. customRender: 'status'
  204. }
  205. },
  206. {
  207. title: '计划类型',
  208. align: 'center',
  209. dataIndex: 'campaignType',
  210. scopedSlots: {
  211. customRender: 'campaignType'
  212. }
  213. },
  214. {
  215. title: '渠道',
  216. align: 'center',
  217. dataIndex: 'createChannel',
  218. scopedSlots: {
  219. customRender: 'createChannel'
  220. }
  221. },
  222. {
  223. title: '投放状态',
  224. align: 'center',
  225. dataIndex: 'putStatus',
  226. scopedSlots: {
  227. customRender: 'putStatus'
  228. },
  229. filters: [{
  230. text: '投放中',
  231. value: '1'
  232. },
  233. {
  234. text: '暂停',
  235. value: '2'
  236. }
  237. ],
  238. onFilter: (value, record) =>
  239. record.putStatus
  240. .toString()
  241. .toLowerCase()
  242. .includes(value.toLowerCase()),
  243. },
  244. {
  245. title: '创建时间',
  246. align: 'center',
  247. dataIndex: 'putCreateTime'
  248. },
  249. {
  250. title: '更新时间',
  251. align: 'center',
  252. dataIndex: 'putUpdateTime'
  253. }
  254. ]
  255. export default {
  256. name: 'refuse-data',
  257. components: {
  258. EditableCell,
  259. Treeselect
  260. },
  261. data: function () {
  262. return {
  263. title: '被拒创意列表',
  264. visibleFail: false,
  265. fail: null,
  266. appId: null,
  267. loading: false,
  268. columns: columnsCam,
  269. dataList: [],
  270. keyWord: '',
  271. editTitle: '',
  272. confirmLoading: false,
  273. visible: false,
  274. editWord: '',
  275. nowData: null,
  276. selectedRowKeys: [],
  277. selectedRowKeysValue: [],
  278. loadingList: false,
  279. ipagination: {
  280. current: 1,
  281. pageSize: 50,
  282. showTotal: (total, range) => {
  283. return range[0] + '-' + range[1] + ' 共' + total + '条'
  284. },
  285. showQuickJumper: true,
  286. // showSizeChanger: true,
  287. total: 0,
  288. onChange: current => {
  289. // 切换分页时的回调,
  290. // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
  291. this.ipagination.current = current
  292. this.selectedRowKeys = []
  293. this.selectedRowKeysValue = []
  294. this.addUser()
  295. }
  296. }
  297. }
  298. },
  299. filters: {
  300. typeStatus(type) {
  301. // 2 - 提升应用安装;
  302. // 3 - 获取电商下单;
  303. // 4 - 推广品牌活动;
  304. // 5 - 收集销售线索;
  305. var data = ['', '', '提升应用安装', '获取电商下单', '推广品牌活动', '收集销售线索']
  306. return data[type]
  307. },
  308. status(sta) {
  309. var data = {
  310. '-1': '不限',
  311. 1: '已暂停',
  312. 3: '计划超预算',
  313. 4: '有效',
  314. 6: '余额不足'
  315. }
  316. return data[sta]
  317. },
  318. putStatus(sta) {
  319. var data = {
  320. 1: '投放中',
  321. 2: '暂停'
  322. }
  323. return data[sta]
  324. },
  325. createChannel(sta) {
  326. var data = {
  327. 0: '投放后台',
  328. 1: '汇创助手'
  329. }
  330. return data[sta]
  331. }
  332. },
  333. watch: {
  334. appId(n, o) {
  335. console.log(n, o)
  336. if (n != o) {
  337. this.ipagination.current = 1
  338. }
  339. }
  340. },
  341. methods: {
  342. toDetail(record) {
  343. localStorage.setItem('accountIdCreat', record.campaignId)
  344. localStorage.setItem('accountIdCreatNow', this.appId)
  345. this.$router.replace({
  346. path: '/Statistics/refuseDataCreat'
  347. })
  348. },
  349. clickAgain() {
  350. this.loadingList = true
  351. var params = {}
  352. params.accountId = this.appId + ''
  353. params.creativeArr = this.selectedRowKeysValue
  354. postAction('/MaterialRefuse/batchUpdateCreative', params).then(res => {
  355. if (res.success) {
  356. this.loadingList = false
  357. this.selectedRowKeysValue = []
  358. this.selectedRowKeys = []
  359. this.visibleFail = true
  360. this.fail = res.result
  361. this.addUser()
  362. } else {
  363. this.loadingList = false
  364. this.visibleFail = true
  365. this.fail = res.result
  366. this.$message.error(res.message)
  367. }
  368. })
  369. },
  370. onSelectChange(selectedRowKeys, selectionRows) {
  371. this.selectedRowKeys = selectedRowKeys
  372. this.selectedRowKeysValue = selectionRows.map(item => {
  373. return {
  374. description: item.description,
  375. creativeId: item.creativeId
  376. }
  377. })
  378. // this.selectedRowKeysValue.length > 0 ? this.selectedRowKeysValue :
  379. },
  380. handleOk(e) {
  381. this.confirmLoading = true
  382. var params = {}
  383. params.accountId = this.nowData.accountId
  384. params.campaignId = this.nowData.campaignId
  385. params.unitId = this.nowData.unitId
  386. params.creativeId = this.nowData.creativeId
  387. params.creativeName = this.editTitle == '创意名称修改' ? this.editWord : this.nowData.creativeName
  388. params.description = this.editTitle == '广告语修改' ? this.editWord : this.nowData.description
  389. updateCreative(params).then(res => {
  390. if (res.code == 0) {
  391. this.addUser()
  392. this.visible = false
  393. this.confirmLoading = false
  394. } else {
  395. this.$message.error(res.message)
  396. this.visible = false
  397. this.confirmLoading = false
  398. }
  399. })
  400. },
  401. handleCancel(e) {
  402. this.visible = false
  403. },
  404. onCellChange(item, dataIndex) {
  405. this.editWord = item[dataIndex]
  406. this.editTitle = dataIndex == 'creativeName' ? '创意名称修改' : '广告语修改'
  407. this.nowData = item
  408. this.visible = true
  409. },
  410. moment,
  411. ...mapGetters(['nickname', 'avatar', 'userInfo']),
  412. addUser() {
  413. this.loading = true
  414. var params = {}
  415. params.accountId = this.appId + ''
  416. params.pageSize = this.ipagination.pageSize
  417. params.pageNo = this.ipagination.current
  418. if (this.appId) {
  419. getAction('/kuaishou/kuaiShouCampaign/list', params).then(res => {
  420. if (res.code == 0) {
  421. this.dataList = res.result.records.map((v, index) => {
  422. return {
  423. ...v,
  424. key: index
  425. }
  426. })
  427. this.list = this.dataList
  428. this.loading = false
  429. this.ipagination.total = res.result.total
  430. }
  431. })
  432. // getAction('/MaterialRefuse/getRefuseCreative', params).then(res => {
  433. // if (res.code == 0) {
  434. // this.dataList = res.result.records.map((v, index) => {
  435. // return {
  436. // ...v,
  437. // key: index
  438. // }
  439. // })
  440. // this.list = this.dataList
  441. // this.loading = false
  442. // this.ipagination.total = res.result.total
  443. // }
  444. // })
  445. } else {
  446. this.$message.error('请选择账户')
  447. }
  448. },
  449. addUserKey() {
  450. this.dataList = this.list.filter(item => {
  451. return item.creativeName.toLowerCase().indexOf(this.keyWord.toLowerCase()) > -1
  452. })
  453. }
  454. },
  455. watch: {},
  456. distoryed() {},
  457. updated() {
  458. stopOtherVideo()
  459. },
  460. mounted: function () {
  461. this.$nextTick(() => {})
  462. }
  463. }
  464. </script>