Browse Source

'2021/02/05最终代码/智能投放应用'

魏志佳 4 years ago
parent
commit
0991e2b222

+ 647 - 0
src/views/modules/autoLaunch/appIdList.vue

@@ -0,0 +1,647 @@
+<template>
+    <div class="toutiaoBatch">
+        
+        
+        <div class="toolbox-automate-rules-create-content_title">
+            <h3>账户应用信息</h3>
+            <a-button type='primary' @click="goNewConfigInfo" class="goNewConfigInfo">添加应用</a-button>
+        </div>
+        
+        <div class="topOptions">
+            <div >
+                <Treeselect :appId.sync="accountId" :multiple="false"  request="2,4"   ref="treeSelect" style="margin-bottom:8px;width:600px " />               
+            </div>
+            <span class="optionBtn">
+                <a-button type='primary' @click="search" class="searchBtn">查询</a-button>
+            </span>
+        </div>
+        <div class="tableArea">
+            <!-- <div class="tableOption" v-if="selectedRowKeys.length">
+                
+                
+               :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+            </div> -->
+            <div class="table">
+                <a-table
+                    :columns="columns"
+                    :data-source="data"
+                    bordered
+                    :pagination="ipagination"
+                    :loading="loading"
+                    @change="sort"
+                    :scroll="{'x':scrollX}"
+                    
+                >
+
+                    
+                    <span slot="authName" slot-scope="text">
+                        <!-- <a href="javascript:;" >{{text}}</a> -->
+                        {{text || '-'}}
+                    </span>
+                    <span slot="time" slot-scope="text,record">
+                        {{record.startTime}}至{{record.endTime}}
+                    </span>
+                    <span slot="status" slot-scope="text">
+                        {{text | handlerStatus}}
+                    </span>
+                    <span slot="operator" slot-scope="text,record">
+                        <a href="javascript:;"  @click="goPlanList(record)">编辑</a>
+                        <a-divider type="vertical" />
+                        <a href="javascript:;"  @click="deleteRecord(record)">删除</a>
+                        <a-divider type="vertical" />
+                        <a-popover v-model="record.show" trigger="click" placement="topRight" @visibleChange='visibleChange'>
+                            <div slot="content">
+                                    <span style='font-weight:700;margin-right:15px;font-size:15px'>修改后重提</span>
+                                    <a-radio-group v-model="examineAgainType" >
+                                        <a-radio :value="1">修改广告语</a-radio>
+                                        <a-radio :value="0">修改封面</a-radio>
+                                    </a-radio-group>
+                                    <a-button type='default' @click="examineAgainCancel(record)" size='small' style='margin-right:10px'>取消</a-button>
+                                    <a-button type='primary' @click="examineAgainOk(record)" size='small'  class="ok">重提</a-button>
+                            </div>
+                            <a href="javascript:;"  type='primary' @click="()=>{record.show=true}">一键重提</a>
+                            
+                        </a-popover>
+                        <a-divider type="vertical" />
+                        <a-popover v-model="record.visible" trigger="click" placement="topLeft" @visibleChange='visibleChange'>
+                            <span slot="title">出价</span>
+                            <template  slot="content" style="width:300px;">
+                                <div style="margin:5px 0 0">
+                                    <span ><a-input-number :min="0" v-model="newBid" :step="0.1" placeholder="请输入出价" size="small" style='margin-right:20px;width:120px' /></span>
+                                    <p style="color:red;font-size:12px;height:16px;padding:5px 0">{{bidErrorMessage}}</p>
+                                </div>
+                                
+                                <div>
+                                    <a-button type='default' @click="bidChangeCancel(record)" size='small' style='margin-right:10px'>取消</a-button>
+                                    <a-button type='primary' @click="bidChangeOk(record)" size='small' class="ok">修改</a-button>
+                                </div>
+                                
+                            </template>
+                            <a href="javascript:;"  type='primary' @click="()=>{record.visible=true}">修改出价</a>
+                        </a-popover>
+                    </span>
+
+                </a-table>
+            </div>
+        </div>
+        
+       
+              
+    <!-- </a-spin> -->
+    </div>
+</template>
+
+<script>
+import moment from 'moment';
+import { getAction, postAction, downFile, downFilePost,deleteAction } from '@/api/manage';
+// import { JeecgListMixin } from '@/mixins/ipagination'
+// import editableCell from './editableCell'
+import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
+import qs from 'qs'
+let typeValue='预算'
+
+
+const strategyColumns = [
+  
+//   {
+//     title: 'ID',
+//     dataIndex: 'id',
+//     key: 'id',
+//     align: 'center',
+//     scopedSlots: { customRender: 'id' },
+//     width:110,
+    
+//   },
+//    {
+//     title: '所属账户名称',
+//     dataIndex: 'authName',
+//     key: 'authName',
+//     align: 'center',
+//     scopedSlots: { customRender: 'authName' }, 
+//     width:200  
+//   },
+  {
+    title: '所属账户ID',
+    dataIndex: 'accountId',
+    key: 'accountId',
+    align: 'center',
+    scopedSlots: { customRender: 'accountId' },   
+  },
+  
+  
+    {
+        title: '应用名称',
+        dataIndex: 'appName',
+        align: 'appName',    
+        scopedSlots: { customRender: 'appName' },
+        align: 'center',
+        // sorter:() => {}
+    },
+    {
+        title: '应用标识',
+        dataIndex: 'appVersion',
+        align: 'appVersion',    
+        scopedSlots: { customRender: 'appVersion' },
+        align: 'center',
+        // sorter:() => {}
+    },
+    {
+        title: '状态',
+        dataIndex: 'status',
+        align: 'status',    
+        scopedSlots: { customRender: 'status' },
+        align: 'center',
+        // sorter:() => {}
+    },
+    {
+        title: '备注',
+        dataIndex: 'remark',
+        align: 'remark',    
+        scopedSlots: { customRender: 'remark' },
+        align: 'center',
+        // sorter:() => {}
+    },
+    {
+        title: '创建时间',
+        dataIndex: 'createTime',
+        key: 'createTime',
+        align: 'center',
+        scopedSlots: { customRender: 'createTime' },
+            
+    },
+//  {
+//     title: '操作',
+//     dataIndex: 'operator',
+//     key: 'operator',
+//     align: 'center',
+//     scopedSlots: { customRender: 'operator' },
+//     width:350,
+   
+//   },
+
+];
+
+const publicColumns = [    
+    
+]
+
+export default {
+    name:'strategy-list',
+    components: {
+        // editableCell,
+        Treeselect,
+    },
+    // mixins: [JeecgListMixin],
+    data() {
+        return {
+            selectedRecord:{},
+            bidErrorMessage:'',
+            examineAgainType:1,
+            newBid:undefined,
+            examineAgain:false,
+            accountId:[],
+            accountList:[],
+            strategyState:undefined,
+            strategyName:'',
+            strategyId:undefined,
+            accountId:[],
+            scrollX:0,
+            ipagination: {
+                current: 1,
+                pageSize: 10,
+                //   pageSizeOptions: ['10', '20', '30'],
+                showTotal: (total, range) => {
+                    return range[0] + "-" + range[1] + " 共" + total + "条"
+                },
+                showQuickJumper: true,
+                showSizeChanger:true,
+                pageSizeOptions: ['10', '30', '50'],
+                total: 0,
+                onChange: (current, pageSize) => {
+                    // 切换分页时的回调,
+                    // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
+                    this.ipagination.current = current;
+                    this.ipagination.pageSize= pageSize;
+                }
+            },
+           
+            spinning:false,
+            moment,
+           
+            optionId:'',//input输入的id或关键词
+          
+           
+            selectDisable:true,
+            optValue:undefined,//操作设置的值 删除 暂停 开启
+            visible: false,//出价里的弹出框
+
+            //主页的表格
+            data:[],
+            columns:[...strategyColumns,...publicColumns],
+            selectedRowKeys:[],
+            
+            loading:false,
+            editID:0,
+
+            url: {               
+                list:'/ai/aiKuaiShouAppInfo/list',
+                delete:'/ctop/aiKuaishouAdvertiserStrategy/delete',
+            },
+
+
+            
+        }
+    },
+    computed: {
+        hasSelected() {
+        return this.selectedRowKeys.length > 0;
+        },
+    },
+    methods: {
+        examineAgainMethod(record){
+            console.log(record)
+            this.examineAgain=true;
+            this.selectedRecord=record
+        },
+        visibleChange(){
+            this.bidErrorMessage='';
+            this.examineAgainType=1;
+            this.newBid=undefined;
+            
+        },
+        bidChangeCancel(record){
+            record.visible=false;
+            this.newBid=undefined;
+            this.bidErrorMessage=''
+        },
+        bidChangeOk(record){
+            if(this.newBid){
+                record.visible=false;
+                postAction('/ai/batchUpdate/updateGroupBid',{
+                    accountId:record.accountId,
+                    bid:this.newBid*1000
+                }).then(res=>{
+                    console.log(res)
+                    if(res.code==0){
+                        this.$message.success(res.message)
+                        this.newBid=undefined;
+                        this.getStrategyList()
+                    }
+                    
+                })
+            }else{
+                this.bidErrorMessage='请正确填写出价'
+                // this.$message.error('请正确填写出价')
+            }
+            
+        },
+
+        examineAgainCancel(record){
+            record.show=false;
+            this.examineAgainType=1
+        },
+        examineAgainOk(record){
+            record.show=false;
+            postAction('/kuaishou/creative/again',{
+                accountId:record.accountId,
+                updateType:this.examineAgainType
+            }).then(res=>{
+                console.log(res);
+                if(res.code==0){
+                    this.$message.success('正在重提中,您可稍后查看结果')
+                }else{
+                    this.$message.success(res.message)
+                }
+                this.examineAgainType=1
+            })
+            
+        },
+        onSelectChange(selectedRowKeys) {
+            console.log('selectedRowKeys changed: ', selectedRowKeys);
+            this.selectedRowKeys = selectedRowKeys;
+        },
+        goNewConfigInfo(){
+            this.$router.push('/autoLaunch/newAppId')
+        },
+        goPlanList(record){
+            console.log(record)
+            this.$parent.currentStrategyId=record.id;
+            this.$router.push(`/autoLaunch/configLaunchInfo?id=${record.id}`)
+        },
+        deleteRecord(record){
+            this.loading=true
+            deleteAction(this.url.delete,{
+                id:record.id
+            }).then(res=>{
+                this.loading=false
+                if(res.success){
+                    this.$message.success(res.message);
+                    this.getStrategyList()
+                }else{
+                    this.$message.success(res.message);
+                }
+            })
+        },
+        filterOption(input, option) {
+            return (
+                option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+            );
+        },
+        
+        //查询按钮事件
+        search(){
+            this.ipagination.current=1;
+            this.getStrategyList()            
+        },
+        //点击分页
+        sort(pagination, filters, sorter, { currentDataSource }){
+            console.log(pagination)
+            this.ipagination.current=pagination.current;
+
+            this.ipagination.pageSize=pagination.pageSize;
+            this.getStrategyList()
+        },
+
+        getStrategyList(){
+            this.loading = true
+            console.log(this.accountId)
+            getAction(this.url.list,{
+                strategyId:this.strategyId==undefined?null:this.strategyId,
+                accountId:this.accountId,
+                pageNo:this.ipagination.current,
+                pageSize:this.ipagination.pageSize
+            }).then((res)=>{
+                this.data=[]
+                console.log(res)
+                this.loading = false
+                if(res.success){
+
+                    this.ipagination.total = res.result.total
+                    
+                    res.result.records.forEach((item)=>{
+                        item.key=item.id;
+                        item.show=false;
+                        item.visible=false;
+                    })
+
+                    this.data = res.result.records;
+                    this.selectedRowKeys=[];
+                }
+            })
+        },
+      
+    },
+    mounted() {
+       
+        this.getStrategyList()
+    },
+    
+    activated() {
+        this.getStrategyList()
+    },
+    beforeDestroy() {
+
+    },
+    filters: {
+        toPercentage(val) {
+            if(val){
+                if(typeof val != 'string'){
+                    return (val * 100).toFixed(2) + '%'
+                }else{
+                    return val
+                }
+            }else if(typeof val =='string'){
+                    return val
+                }
+            else{
+                return 0
+            }
+        },
+        //保留两位小数并且变成货币格式
+        decimalsHandle(val){
+
+            if(val && typeof val !='string'){
+                if(val>=0){
+                    val=parseFloat(val).toFixed(2);
+                    let numberStr = val.toString()
+                    let str = numberStr.split('.')
+
+                    let str0=str[0].split('').reverse();
+                    for (let i = 0; i < str0.length; i++) {
+                        if ((i + 1) % 4 === 0) {
+                            str0.splice(i, 0, ',')
+                        }
+                    }
+                    str0.reverse()
+                    let handleResult = ''
+                    for (let j = 0; j < str0.length; j++) {
+                        handleResult += str0[j]
+                    }
+
+                    return handleResult+'.'+str[1]
+                }else{
+                    val=parseFloat(val).toFixed(2);
+                    let numberStr = val.toString()
+                    let str = numberStr.split('.')
+
+                    let str0=str[0].substr(1).split('').reverse();
+                    for (let i = 0; i < str0.length; i++) {
+                        if ((i + 1) % 4 === 0) {
+                            str0.splice(i, 0, ',')
+                        }
+                    }
+                    str0.reverse()
+                    let handleResult = ''
+                    for (let j = 0; j < str0.length; j++) {
+                        handleResult += str0[j]
+                    }
+
+                    return '-'+handleResult+'.'+str[1]
+                }
+
+            }else if(typeof val =='string'){
+                return val
+            }
+            else{
+                return 0
+            }
+        },
+        //变成货币格式
+        formatCurrency(val){
+            if((val||val==0)&& typeof val !='string'){
+                let numberStr = val.toString()
+                let str = numberStr.split('').reverse()
+                for (let i = 0; i < str.length; i++) {
+                    if ((i + 1) % 4 === 0) {
+                    str.splice(i, 0, ',')
+                    }
+                }
+                str.reverse()
+                let handleResult = ''
+                for (let j = 0; j < str.length; j++) {
+                    handleResult += str[j]
+                }
+                return handleResult
+            }else if(typeof val =='string'){
+                    return val
+            }
+            else{
+                return '-'
+            }
+
+        },
+        
+        handlerStatus(val){
+            let string='';
+            switch (val) {
+                case 0:
+                    string='待创建'
+                    break;
+                case 1:
+                    string='创建中'
+                    break;
+                case 2:
+                    string='创建成功'
+                    break;
+                case 3:
+                    string='创建失败'
+                    break;
+            
+                default:
+                    break;
+            }
+            return string
+        }
+    }
+}
+</script>
+<style lang="scss">
+    #closeIcon{
+         color: #0E74D2;
+    }
+    .toutiaoBatch{
+        .ant-tag .anticon-close {      
+            color: #1890ff;        
+        }
+        .ant-tag .anticon-close:hover{      
+            color: rgba(0, 0, 0, 0.85);    
+        }
+
+    }
+    
+    .ant-tooltip-inner,.ant-tooltip,.ant-tooltip-arrow::before{
+        background-color: #fff;
+        color: #333;
+    }
+    #batchModal{
+        .rules,.totalPrice{
+            font-weight: 600;
+        }
+
+        .selectePlan{
+            font-size: 14px;
+            font-weight: 700;
+            color: #333;
+            padding: 20px 0;
+        }
+        .totalPrice{
+            margin-left: 20px;
+        }
+        .modifyTable{
+            margin-top: 20px;
+            width: 100%;
+            height: 400px;
+            overflow: auto;
+            font-weight: 600;
+        }
+    }
+    #copyModal{
+        .ant-modal-header{
+            text-align: center;
+        }
+        .copyTip{
+            font-size: 12px;
+            color: #999;
+        }
+        .copyName{
+            width: 118px;
+            display: inline-block;
+            text-align: right;
+            .copyKeyStart{
+                color: red;
+            }
+        }
+        // font-weight: 600;
+    }
+</style>
+<style lang="scss" scoped>
+.toutiaoBatch{
+    .breadcrumb{
+            height: 22px;
+            font-size: 12px;
+            font-family: PingFangSC-Regular, PingFang SC;
+            font-weight: 400;
+            color: #000000;
+            line-height: 22px;
+        }
+    background-color: #fff;
+    padding: 10px 20px;
+    position: relative;
+    width: 100%;
+    .OptinItem{
+        display: inline-block;
+        margin-right: 15px;
+        margin-top: 15px;
+        .ok{
+            margin-right: 15px;
+        }
+    }
+    .OptinItem:first-child{
+        margin-right: 10px;
+    }
+    .topOptions{
+        padding: 15px 0;
+        display: flex;
+        justify-content: space-between;
+        .topOpt{
+            width: 100%;
+            margin-bottom: 10px;
+        }
+    }
+    .optionBtn{
+        // display: inline-block;
+        float: right;
+        // .searchBtn{
+            // margin-right: 10px;
+        // }
+    }
+    .tableArea{
+        .tableOption{
+            padding: 20px 0;
+        }
+    }
+    .toolbox-automate-rules-create-content_title {
+        background-color: #fff;
+        display: flex;
+        flex-flow: row nowrap;
+        justify-content: flex-start;
+        align-items: center;
+        margin-bottom: 28px;
+        position: relative;
+        h3 {
+            font-size: 22px;
+            margin: 0;
+            font-weight: 400;
+            height: 30px;
+            line-height: 30px;
+        }
+        .goNewConfigInfo{
+            position: absolute;
+            right: 0;
+            top: 4px;
+        }
+    }
+
+}
+
+</style>

+ 10 - 5
src/views/modules/autoLaunch/configLaunchList.vue

@@ -61,7 +61,7 @@
                             <a href="javascript:;"  type='primary' @click="()=>{record.show=true}">一键重提</a>
                             
                         </a-popover>
-                        <!-- <a-divider type="vertical" /> -->
+                        <a-divider type="vertical" />
                         <a-popover v-model="record.visible" trigger="click" placement="topLeft" @visibleChange='visibleChange'>
                             <span slot="title">出价</span>
                             <template  slot="content" style="width:300px;">
@@ -76,7 +76,7 @@
                                 </div>
                                 
                             </template>
-                            <!-- <a href="javascript:;"  type='primary' @click="()=>{record.visible=true}">修改出价</a> -->
+                            <a href="javascript:;"  type='primary' @click="()=>{record.visible=true}">修改出价</a>
                         </a-popover>
                     </span>
 
@@ -250,12 +250,17 @@ export default {
         bidChangeOk(record){
             if(this.newBid){
                 record.visible=false;
-                postAction('',{
+                postAction('/ai/batchUpdate/updateGroupBid',{
                     accountId:record.accountId,
-                    bid:this.newBid
+                    bid:this.newBid*1000
                 }).then(res=>{
                     console.log(res)
-                    this.newBid=undefined;
+                    if(res.code==0){
+                        this.$message.success(res.message)
+                        this.newBid=undefined;
+                        this.getStrategyList()
+                    }
+                    
                 })
             }else{
                 this.bidErrorMessage='请正确填写出价'

+ 5 - 21
src/views/modules/autoLaunch/newAppId.vue

@@ -230,8 +230,8 @@ export default {
         },
        
         goBack() {
-            this.$router.replace('/autoLaunch/autoLaunchList')
-            this.$bus.$emit('remove', '/autoLaunch/newStrategy')
+            this.$router.replace('/autoLaunch/appIdList')
+            this.$bus.$emit('remove', '/autoLaunch/newAppId')
         },
     
        
@@ -343,6 +343,8 @@ export default {
                 this.loadDisabled = false 
                 if(info.file.response.code==0){
                   this.$message.success(info.file.response.message)
+                  this.$router.replace('/autoLaunch/appIdList')
+                  this.$bus.$emit('remove', '/autoLaunch/newAppId')
                 }else{
                   this.$message.error(info.file.response.message)
                 }
@@ -354,25 +356,7 @@ export default {
 
             // console.log(this.form)
         },
-        goBack(){
-            this.$router.replace('/autoLaunch/configLaunchList')
-            this.$bus.$emit('remove', '/autoLaunch/newAppId')  
-            
-        },
-        goNext(){
-            if(this.urlListImage.signature){
-              postAction('/ai/aiKuaiShouAppInfo/importAppExcel',{
-                accountId:this.accountId,
-                file:this.file,
-                platform:this.platform,
-                imageToken:this.urlListImage.imageToken
-              }).then(res=>{
-                console.log(res)
-              })
-            }else{
-              this.$message.error('正在获取图片信息,请稍后再试')
-            }
-        },
+        
     },
     
   mounted() {

+ 2 - 2
vue.config.js

@@ -68,7 +68,7 @@ module.exports = {
     open : true,
     proxy: {
       '/jeecg-boot': {
-        //  target: 'http://192.168.1.8:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
+         target: 'http://192.168.1.8:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
         // target: 'http://192.168.0.59:8088', //请求本地 需要jeecg-boot后台项目  英豪
         // target: 'http://192.168.1.188:8088', //请求本地 需要jeecg-boot后台项目  英豪
         // target: 'http://192.168.2.115:8080', //请求本地 需要jeecg-boot后台项目  祚云
@@ -79,7 +79,7 @@ module.exports = {
         // target: 'http://192.168.1.219:8080', //请求本地 需要jeecg-boot后台项目  赵西安
         // target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目  李煜一
         // target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目  李煜一
-         target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
+        //  target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
         // target: 'https://trac.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
         // target: 'http://39.106.184.70:8088/', //请求本地 需要jeecg-boot后台项目
         //  target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目