appIdList.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. <template>
  2. <div class="toutiaoBatch">
  3. <div class="toolbox-automate-rules-create-content_title">
  4. <h3>账户应用信息</h3>
  5. <a-button type='primary' @click="goNewConfigInfo" class="goNewConfigInfo">添加应用</a-button>
  6. </div>
  7. <div class="topOptions">
  8. <div >
  9. <Treeselect :appId.sync="accountId" :multiple="false" request="2,4" ref="treeSelect" style="margin-bottom:8px;width:600px " />
  10. </div>
  11. <span class="optionBtn">
  12. <a-button type='primary' @click="search" class="searchBtn">查询</a-button>
  13. </span>
  14. </div>
  15. <div class="tableArea">
  16. <!-- <div class="tableOption" v-if="selectedRowKeys.length">
  17. :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  18. </div> -->
  19. <div class="table">
  20. <a-table
  21. :columns="columns"
  22. :data-source="data"
  23. bordered
  24. :pagination="ipagination"
  25. :loading="loading"
  26. @change="sort"
  27. :scroll="{'x':scrollX}"
  28. >
  29. <span slot="authName" slot-scope="text">
  30. <!-- <a href="javascript:;" >{{text}}</a> -->
  31. {{text || '-'}}
  32. </span>
  33. <span slot="time" slot-scope="text,record">
  34. {{record.startTime}}至{{record.endTime}}
  35. </span>
  36. <span slot="status" slot-scope="text">
  37. {{text | handlerStatus}}
  38. </span>
  39. <span slot="operator" slot-scope="text,record">
  40. <a href="javascript:;" @click="goPlanList(record)">编辑</a>
  41. <a-divider type="vertical" />
  42. <a href="javascript:;" @click="deleteRecord(record)">删除</a>
  43. <a-divider type="vertical" />
  44. <a-popover v-model="record.show" trigger="click" placement="topRight" @visibleChange='visibleChange'>
  45. <div slot="content">
  46. <span style='font-weight:700;margin-right:15px;font-size:15px'>修改后重提</span>
  47. <a-radio-group v-model="examineAgainType" >
  48. <a-radio :value="1">修改广告语</a-radio>
  49. <a-radio :value="0">修改封面</a-radio>
  50. </a-radio-group>
  51. <a-button type='default' @click="examineAgainCancel(record)" size='small' style='margin-right:10px'>取消</a-button>
  52. <a-button type='primary' @click="examineAgainOk(record)" size='small' class="ok">重提</a-button>
  53. </div>
  54. <a href="javascript:;" type='primary' @click="()=>{record.show=true}">一键重提</a>
  55. </a-popover>
  56. <a-divider type="vertical" />
  57. <a-popover v-model="record.visible" trigger="click" placement="topLeft" @visibleChange='visibleChange'>
  58. <span slot="title">出价</span>
  59. <template slot="content" style="width:300px;">
  60. <div style="margin:5px 0 0">
  61. <span ><a-input-number :min="0" v-model="newBid" :step="0.1" placeholder="请输入出价" size="small" style='margin-right:20px;width:120px' /></span>
  62. <p style="color:red;font-size:12px;height:16px;padding:5px 0">{{bidErrorMessage}}</p>
  63. </div>
  64. <div>
  65. <a-button type='default' @click="bidChangeCancel(record)" size='small' style='margin-right:10px'>取消</a-button>
  66. <a-button type='primary' @click="bidChangeOk(record)" size='small' class="ok">修改</a-button>
  67. </div>
  68. </template>
  69. <a href="javascript:;" type='primary' @click="()=>{record.visible=true}">修改出价</a>
  70. </a-popover>
  71. </span>
  72. </a-table>
  73. </div>
  74. </div>
  75. <!-- </a-spin> -->
  76. </div>
  77. </template>
  78. <script>
  79. import moment from 'moment';
  80. import { getAction, postAction, downFile, downFilePost,deleteAction } from '@/api/manage';
  81. // import { JeecgListMixin } from '@/mixins/ipagination'
  82. // import editableCell from './editableCell'
  83. import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
  84. import qs from 'qs'
  85. let typeValue='预算'
  86. const strategyColumns = [
  87. // {
  88. // title: 'ID',
  89. // dataIndex: 'id',
  90. // key: 'id',
  91. // align: 'center',
  92. // scopedSlots: { customRender: 'id' },
  93. // width:110,
  94. // },
  95. // {
  96. // title: '所属账户名称',
  97. // dataIndex: 'authName',
  98. // key: 'authName',
  99. // align: 'center',
  100. // scopedSlots: { customRender: 'authName' },
  101. // width:200
  102. // },
  103. {
  104. title: '所属账户ID',
  105. dataIndex: 'accountId',
  106. key: 'accountId',
  107. align: 'center',
  108. scopedSlots: { customRender: 'accountId' },
  109. },
  110. {
  111. title: '应用名称',
  112. dataIndex: 'appName',
  113. align: 'appName',
  114. scopedSlots: { customRender: 'appName' },
  115. align: 'center',
  116. // sorter:() => {}
  117. },
  118. {
  119. title: '应用标识',
  120. dataIndex: 'appVersion',
  121. align: 'appVersion',
  122. scopedSlots: { customRender: 'appVersion' },
  123. align: 'center',
  124. // sorter:() => {}
  125. },
  126. {
  127. title: '状态',
  128. dataIndex: 'status',
  129. align: 'status',
  130. scopedSlots: { customRender: 'status' },
  131. align: 'center',
  132. // sorter:() => {}
  133. },
  134. {
  135. title: '备注',
  136. dataIndex: 'remark',
  137. align: 'remark',
  138. scopedSlots: { customRender: 'remark' },
  139. align: 'center',
  140. // sorter:() => {}
  141. },
  142. {
  143. title: '创建时间',
  144. dataIndex: 'createTime',
  145. key: 'createTime',
  146. align: 'center',
  147. scopedSlots: { customRender: 'createTime' },
  148. },
  149. // {
  150. // title: '操作',
  151. // dataIndex: 'operator',
  152. // key: 'operator',
  153. // align: 'center',
  154. // scopedSlots: { customRender: 'operator' },
  155. // width:350,
  156. // },
  157. ];
  158. const publicColumns = [
  159. ]
  160. export default {
  161. name:'strategy-list',
  162. components: {
  163. // editableCell,
  164. Treeselect,
  165. },
  166. // mixins: [JeecgListMixin],
  167. data() {
  168. return {
  169. selectedRecord:{},
  170. bidErrorMessage:'',
  171. examineAgainType:1,
  172. newBid:undefined,
  173. examineAgain:false,
  174. accountId:[],
  175. accountList:[],
  176. strategyState:undefined,
  177. strategyName:'',
  178. strategyId:undefined,
  179. accountId:[],
  180. scrollX:0,
  181. ipagination: {
  182. current: 1,
  183. pageSize: 10,
  184. // pageSizeOptions: ['10', '20', '30'],
  185. showTotal: (total, range) => {
  186. return range[0] + "-" + range[1] + " 共" + total + "条"
  187. },
  188. showQuickJumper: true,
  189. showSizeChanger:true,
  190. pageSizeOptions: ['10', '30', '50'],
  191. total: 0,
  192. onChange: (current, pageSize) => {
  193. // 切换分页时的回调,
  194. // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
  195. this.ipagination.current = current;
  196. this.ipagination.pageSize= pageSize;
  197. }
  198. },
  199. spinning:false,
  200. moment,
  201. optionId:'',//input输入的id或关键词
  202. selectDisable:true,
  203. optValue:undefined,//操作设置的值 删除 暂停 开启
  204. visible: false,//出价里的弹出框
  205. //主页的表格
  206. data:[],
  207. columns:[...strategyColumns,...publicColumns],
  208. selectedRowKeys:[],
  209. loading:false,
  210. editID:0,
  211. url: {
  212. list:'/ai/aiKuaiShouAppInfo/pageList',
  213. delete:'/ctop/aiKuaishouAdvertiserStrategy/delete',
  214. },
  215. }
  216. },
  217. computed: {
  218. hasSelected() {
  219. return this.selectedRowKeys.length > 0;
  220. },
  221. },
  222. methods: {
  223. examineAgainMethod(record){
  224. console.log(record)
  225. this.examineAgain=true;
  226. this.selectedRecord=record
  227. },
  228. visibleChange(){
  229. this.bidErrorMessage='';
  230. this.examineAgainType=1;
  231. this.newBid=undefined;
  232. },
  233. bidChangeCancel(record){
  234. record.visible=false;
  235. this.newBid=undefined;
  236. this.bidErrorMessage=''
  237. },
  238. bidChangeOk(record){
  239. if(this.newBid){
  240. record.visible=false;
  241. postAction('/ai/batchUpdate/updateGroupBid',{
  242. accountId:record.accountId,
  243. bid:this.newBid*1000
  244. }).then(res=>{
  245. console.log(res)
  246. if(res.code==0){
  247. this.$message.success(res.message)
  248. this.newBid=undefined;
  249. this.getStrategyList()
  250. }
  251. })
  252. }else{
  253. this.bidErrorMessage='请正确填写出价'
  254. // this.$message.error('请正确填写出价')
  255. }
  256. },
  257. examineAgainCancel(record){
  258. record.show=false;
  259. this.examineAgainType=1
  260. },
  261. examineAgainOk(record){
  262. record.show=false;
  263. postAction('/kuaishou/creative/again',{
  264. accountId:record.accountId,
  265. updateType:this.examineAgainType
  266. }).then(res=>{
  267. console.log(res);
  268. if(res.code==0){
  269. this.$message.success('正在重提中,您可稍后查看结果')
  270. }else{
  271. this.$message.success(res.message)
  272. }
  273. this.examineAgainType=1
  274. })
  275. },
  276. onSelectChange(selectedRowKeys) {
  277. console.log('selectedRowKeys changed: ', selectedRowKeys);
  278. this.selectedRowKeys = selectedRowKeys;
  279. },
  280. goNewConfigInfo(){
  281. this.$router.push('/autoLaunch/newAppId')
  282. },
  283. goPlanList(record){
  284. console.log(record)
  285. this.$parent.currentStrategyId=record.id;
  286. this.$router.push(`/autoLaunch/configLaunchInfo?id=${record.id}`)
  287. },
  288. deleteRecord(record){
  289. this.loading=true
  290. deleteAction(this.url.delete,{
  291. id:record.id
  292. }).then(res=>{
  293. this.loading=false
  294. if(res.success){
  295. this.$message.success(res.message);
  296. this.getStrategyList()
  297. }else{
  298. this.$message.success(res.message);
  299. }
  300. })
  301. },
  302. filterOption(input, option) {
  303. return (
  304. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  305. );
  306. },
  307. //查询按钮事件
  308. search(){
  309. this.ipagination.current=1;
  310. this.getStrategyList()
  311. },
  312. //点击分页
  313. sort(pagination, filters, sorter, { currentDataSource }){
  314. console.log(pagination)
  315. this.ipagination.current=pagination.current;
  316. this.ipagination.pageSize=pagination.pageSize;
  317. this.getStrategyList()
  318. },
  319. getStrategyList(){
  320. this.loading = true
  321. console.log(this.accountId)
  322. getAction(this.url.list,{
  323. strategyId:this.strategyId==undefined?null:this.strategyId,
  324. accountId:this.accountId,
  325. pageNo:this.ipagination.current,
  326. pageSize:this.ipagination.pageSize
  327. }).then((res)=>{
  328. this.data=[]
  329. console.log(res)
  330. this.loading = false
  331. if(res.success){
  332. this.ipagination.total = res.result.total
  333. res.result.records.forEach((item)=>{
  334. item.key=item.id;
  335. item.show=false;
  336. item.visible=false;
  337. })
  338. this.data = res.result.records;
  339. this.selectedRowKeys=[];
  340. }
  341. })
  342. },
  343. },
  344. mounted() {
  345. this.getStrategyList()
  346. },
  347. activated() {
  348. this.getStrategyList()
  349. },
  350. beforeDestroy() {
  351. },
  352. filters: {
  353. toPercentage(val) {
  354. if(val){
  355. if(typeof val != 'string'){
  356. return (val * 100).toFixed(2) + '%'
  357. }else{
  358. return val
  359. }
  360. }else if(typeof val =='string'){
  361. return val
  362. }
  363. else{
  364. return 0
  365. }
  366. },
  367. //保留两位小数并且变成货币格式
  368. decimalsHandle(val){
  369. if(val && typeof val !='string'){
  370. if(val>=0){
  371. val=parseFloat(val).toFixed(2);
  372. let numberStr = val.toString()
  373. let str = numberStr.split('.')
  374. let str0=str[0].split('').reverse();
  375. for (let i = 0; i < str0.length; i++) {
  376. if ((i + 1) % 4 === 0) {
  377. str0.splice(i, 0, ',')
  378. }
  379. }
  380. str0.reverse()
  381. let handleResult = ''
  382. for (let j = 0; j < str0.length; j++) {
  383. handleResult += str0[j]
  384. }
  385. return handleResult+'.'+str[1]
  386. }else{
  387. val=parseFloat(val).toFixed(2);
  388. let numberStr = val.toString()
  389. let str = numberStr.split('.')
  390. let str0=str[0].substr(1).split('').reverse();
  391. for (let i = 0; i < str0.length; i++) {
  392. if ((i + 1) % 4 === 0) {
  393. str0.splice(i, 0, ',')
  394. }
  395. }
  396. str0.reverse()
  397. let handleResult = ''
  398. for (let j = 0; j < str0.length; j++) {
  399. handleResult += str0[j]
  400. }
  401. return '-'+handleResult+'.'+str[1]
  402. }
  403. }else if(typeof val =='string'){
  404. return val
  405. }
  406. else{
  407. return 0
  408. }
  409. },
  410. //变成货币格式
  411. formatCurrency(val){
  412. if((val||val==0)&& typeof val !='string'){
  413. let numberStr = val.toString()
  414. let str = numberStr.split('').reverse()
  415. for (let i = 0; i < str.length; i++) {
  416. if ((i + 1) % 4 === 0) {
  417. str.splice(i, 0, ',')
  418. }
  419. }
  420. str.reverse()
  421. let handleResult = ''
  422. for (let j = 0; j < str.length; j++) {
  423. handleResult += str[j]
  424. }
  425. return handleResult
  426. }else if(typeof val =='string'){
  427. return val
  428. }
  429. else{
  430. return '-'
  431. }
  432. },
  433. handlerStatus(val){
  434. let string='';
  435. switch (val) {
  436. case 0:
  437. string='待创建'
  438. break;
  439. case 1:
  440. string='创建中'
  441. break;
  442. case 2:
  443. string='创建成功'
  444. break;
  445. case 3:
  446. string='创建失败'
  447. break;
  448. default:
  449. break;
  450. }
  451. return string
  452. }
  453. }
  454. }
  455. </script>
  456. <style lang="scss">
  457. #closeIcon{
  458. color: #0E74D2;
  459. }
  460. .toutiaoBatch{
  461. .ant-tag .anticon-close {
  462. color: #1890ff;
  463. }
  464. .ant-tag .anticon-close:hover{
  465. color: rgba(0, 0, 0, 0.85);
  466. }
  467. }
  468. .ant-tooltip-inner,.ant-tooltip,.ant-tooltip-arrow::before{
  469. background-color: #fff;
  470. color: #333;
  471. }
  472. #batchModal{
  473. .rules,.totalPrice{
  474. font-weight: 600;
  475. }
  476. .selectePlan{
  477. font-size: 14px;
  478. font-weight: 700;
  479. color: #333;
  480. padding: 20px 0;
  481. }
  482. .totalPrice{
  483. margin-left: 20px;
  484. }
  485. .modifyTable{
  486. margin-top: 20px;
  487. width: 100%;
  488. height: 400px;
  489. overflow: auto;
  490. font-weight: 600;
  491. }
  492. }
  493. #copyModal{
  494. .ant-modal-header{
  495. text-align: center;
  496. }
  497. .copyTip{
  498. font-size: 12px;
  499. color: #999;
  500. }
  501. .copyName{
  502. width: 118px;
  503. display: inline-block;
  504. text-align: right;
  505. .copyKeyStart{
  506. color: red;
  507. }
  508. }
  509. // font-weight: 600;
  510. }
  511. </style>
  512. <style lang="scss" scoped>
  513. .toutiaoBatch{
  514. .breadcrumb{
  515. height: 22px;
  516. font-size: 12px;
  517. font-family: PingFangSC-Regular, PingFang SC;
  518. font-weight: 400;
  519. color: #000000;
  520. line-height: 22px;
  521. }
  522. background-color: #fff;
  523. padding: 10px 20px;
  524. position: relative;
  525. width: 100%;
  526. .OptinItem{
  527. display: inline-block;
  528. margin-right: 15px;
  529. margin-top: 15px;
  530. .ok{
  531. margin-right: 15px;
  532. }
  533. }
  534. .OptinItem:first-child{
  535. margin-right: 10px;
  536. }
  537. .topOptions{
  538. padding: 15px 0;
  539. display: flex;
  540. justify-content: space-between;
  541. .topOpt{
  542. width: 100%;
  543. margin-bottom: 10px;
  544. }
  545. }
  546. .optionBtn{
  547. // display: inline-block;
  548. float: right;
  549. // .searchBtn{
  550. // margin-right: 10px;
  551. // }
  552. }
  553. .tableArea{
  554. .tableOption{
  555. padding: 20px 0;
  556. }
  557. }
  558. .toolbox-automate-rules-create-content_title {
  559. background-color: #fff;
  560. display: flex;
  561. flex-flow: row nowrap;
  562. justify-content: flex-start;
  563. align-items: center;
  564. margin-bottom: 28px;
  565. position: relative;
  566. h3 {
  567. font-size: 22px;
  568. margin: 0;
  569. font-weight: 400;
  570. height: 30px;
  571. line-height: 30px;
  572. }
  573. .goNewConfigInfo{
  574. position: absolute;
  575. right: 0;
  576. top: 4px;
  577. }
  578. }
  579. }
  580. </style>