Jelajahi Sumber

广告组删除

zhuxinbo 5 tahun lalu
induk
melakukan
602dd9255f

+ 5 - 5
src/components/layouts/TabLayout.vue

@@ -1,5 +1,5 @@
 <template>
-  <global-layout @dynamicRouterShow="dynamicRouterShow">
+  <global-layout @dynamicRouterShow="dynamicRouterShow"  @removeTab="remove">
     <contextmenu :itemList="menuItemList" :visible.sync="menuVisible" @select="onMenuSelect"/>
     <a-tabs
       @contextmenu.native="e => onContextmenu(e)"
@@ -17,10 +17,10 @@
     </a-tabs>
     <div style="margin: 12px 12px 0;">
       <transition name="page-toggle">
-        <keep-alive v-if="multipage">
-          <router-view/>
+        <keep-alive v-if="multipage"  >
+          <router-view @removeTab="remove"/>
         </keep-alive>
-        <router-view v-else/>
+        <router-view v-else  @removeTab="remove"/>
       </transition>
     </div>
   </global-layout>
@@ -64,6 +64,7 @@
       }
     },
     created() {
+      this.$bus.$on('remove',this.remove)
       if (this.$route.path != indexKey) {
         this.pageList.push({
           name: 'dashboard-analysis',
@@ -125,7 +126,6 @@
         this[action](key)
       },
       remove(key) {
-          console.log(key)
         if (key == indexKey) {
           this.$message.warning('首页不能关闭!')
           return

+ 40 - 8
src/views/modules/Statistics/dataDisplayStatistics.vue

@@ -185,8 +185,23 @@ th div {
     <a-row :gutter="10" style="margin-top:10px">
       <a-col :span="24">
         <a-card style="width:100%;">
-          <div style="display:flex;margin-bottom:15px" v-show="active == 1 || active == 2">
-            <a-select style="width: 120px" v-model="statHour" @change="getElseData" allowClear>
+          <div
+            style="display:flex;margin-bottom:15px"
+            v-show="
+              role.roleCode == 'operator' ||
+                role.roleCode == 'kuaishouOperationManager' ||
+                role.roleCode == 'admin' ||
+                role.roleCode == 'operationAssistant' ||
+                role.roleCode == 'touTiaoOperationManager'
+            "
+          >
+            <a-select
+              style="width: 120px"
+              v-model="statHour"
+              @change="getElseData"
+              allowClear
+              v-if="active == 1 || active == 2"
+            >
               <a-select-option v-for="item of 24" :key="item - 1" :value="item - 1">{{ item - 1 }}</a-select-option>
             </a-select>
             <a-button type="primary" @click="exportExcel" style="margin-left:15px">导出</a-button>
@@ -215,6 +230,10 @@ import axios from 'axios'
 import lifting from './components/lifting'
 import timeCheck from './components/timeCheck'
 import Treeselect from './components/Treeselect.vue'
+
+import { getAction, postAction, postFile } from '@/api/manage'
+import { mapGetters } from 'vuex'
+
 // 引入基本模板
 let echarts = require('echarts/lib/echarts')
 // 引入柱状图组件
@@ -464,7 +483,9 @@ export default {
           tab: '素材曝光数'
         }
       ],
-      noTitleKey: 'cost'
+      noTitleKey: 'cost',
+      role: { roleCode: '' },
+      statDate: ''
     }
   },
   filters: {
@@ -486,6 +507,7 @@ export default {
   },
   methods: {
     moment,
+    ...mapGetters(['nickname', 'avatar', 'userInfo']),
     disabledDate(current) {
       return current && current > moment().endOf('day')
     },
@@ -606,6 +628,7 @@ export default {
         console.log(res)
         if (res.success) {
           if (res.result.accountDetail) {
+            this.statDate = res.result.statDate
             this.data = res.result.accountDetail.map((item, index) => {
               return {
                 key: index,
@@ -655,7 +678,7 @@ export default {
                   ? (res.result.now.activationPrice / this.discount).toFixed(2)
                   : 0,
                 formCount: res.result.now.formCount > 0 ? res.result.now.formCount : res.result.now.activationCount,
-                eventRegister: res.result.now.eventRegister.toFixed(2),
+                eventRegister: res.result.now.eventRegister,
                 eventRegisterCost: res.result.now.eventRegisterCost.toFixed(2)
               }
               var allYesterday = {
@@ -683,7 +706,7 @@ export default {
                   res.result.yesterday.formCount > 0
                     ? res.result.yesterday.formCount
                     : res.result.yesterday.activationCount,
-                eventRegister: res.result.yesterday.eventRegister.toFixed(2),
+                eventRegister: res.result.yesterday.eventRegister,
                 eventRegisterCost: res.result.yesterday.eventRegisterCost.toFixed(2)
               }
               var chainRatio = {
@@ -745,9 +768,12 @@ export default {
                   : 0,
                 formCount: res.result.ratioJson.conversions,
                 beforeFormPrice: res.result.ratioJson.conversionPrice.toFixed(2),
-                afterFormPrice: res.result.ratioJson.discountConversionPrice.toFixed(2)
+                afterFormPrice: res.result.ratioJson.discountConversionPrice.toFixed(2),
+                eventRegister: res.result.ratioJson.eventRegister,
+                eventRegisterCost: res.result.ratioJson.eventRegisterCost.toFixed(2)
               }
               this.data.push(allNow)
+              this.statDate = res.result.statDate
             }
 
             length = this.data.length
@@ -1033,8 +1059,10 @@ export default {
         } else {
           title = this.getDate() + '时数据报表'
         }
-      } else {
+      } else if (this.active == 2) {
         title = this.getDate() + '数据报表'
+      } else {
+        title = this.statDate + '数据报表'
       }
       const borderAll = {
         //单元格外侧框线
@@ -1170,7 +1198,11 @@ export default {
   watch: {},
   distoryed() {},
   mounted: function() {
-    this.$nextTick(() => {})
+    this.$nextTick(() => {
+      getAction('/sys/user/getRoleInfo', { userId: this.userInfo().id }).then(res => {
+        this.role = res
+      })
+    })
   }
 }
 </script>

+ 41 - 20
src/views/modules/kuaishouapp/account/accountIndex.vue

@@ -67,6 +67,7 @@
           :pagination="ipagination"
           :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
         >
+          <a slot="campaignName" slot-scope="text, record" @click="toDetail(record)">{{ text }}</a>
           <span slot="action" slot-scope="text, record">
             <a-switch v-model="record.showSwich" @change="onChangeSwitch(record)" />
           </span>
@@ -116,7 +117,6 @@ import countTo from 'vue-count-to'
 import { mapGetters } from 'vuex'
 import { deleteAction, getAction, postAction } from '@/api/manage'
 
-
 import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
 
 var columns = [
@@ -133,7 +133,8 @@ var columns = [
     align: 'center',
     dataIndex: 'campaignName',
     fixed: 'left',
-    width: 200
+    width: 200,
+    scopedSlots: { customRender: 'campaignName' }
   },
 
   {
@@ -209,24 +210,24 @@ export default {
         on: {
           dblclick: () => {
             // 点击改行时要做的事情
-            localStorage.setItem('advertisingGroupKey', record.campaignId)
-            localStorage.setItem('accountId', this.appId)
-            if (localStorage.getItem('advertisingGroup')) {
-              var dataElse = JSON.parse(localStorage.getItem('advertisingGroup'))
-              console.log(dataElse)
-              for (let i = 0; i < dataElse.length; i++) {
-                if (dataElse[i].key == record.key) {
-                  this.$router.replace({ path: '/account/advertisingGroup' })
-                  return
-                }
-              }
-              dataElse.push(record)
-              localStorage.setItem('advertisingGroup', JSON.stringify(dataElse))
-            } else {
-              var data = [record]
-              localStorage.setItem('advertisingGroup', JSON.stringify(data))
-            }
-            this.$router.replace({ path: '/account/advertisingGroup' })
+            // localStorage.setItem('advertisingGroupKey', record.campaignId)
+            // localStorage.setItem('accountId', this.appId)
+            // if (localStorage.getItem('advertisingGroup')) {
+            //   var dataElse = JSON.parse(localStorage.getItem('advertisingGroup'))
+            //   console.log(dataElse)
+            //   for (let i = 0; i < dataElse.length; i++) {
+            //     if (dataElse[i].key == record.key) {
+            //       this.$router.replace({ path: '/account/advertisingGroup' })
+            //       return
+            //     }
+            //   }
+            //   dataElse.push(record)
+            //   localStorage.setItem('advertisingGroup', JSON.stringify(dataElse))
+            // } else {
+            //   var data = [record]
+            //   localStorage.setItem('advertisingGroup', JSON.stringify(data))
+            // }
+            // this.$router.replace({ path: '/account/advertisingGroup' })
           }
         }
       }),
@@ -271,6 +272,26 @@ export default {
     }
   },
   methods: {
+    toDetail(record) {
+      localStorage.setItem('advertisingGroupKey', record.campaignId)
+      localStorage.setItem('accountId', this.appId)
+      if (localStorage.getItem('advertisingGroup')) {
+        var dataElse = JSON.parse(localStorage.getItem('advertisingGroup'))
+        console.log(dataElse)
+        for (let i = 0; i < dataElse.length; i++) {
+          if (dataElse[i].key == record.key) {
+            this.$router.replace({ path: '/account/advertisingGroup' })
+            return
+          }
+        }
+        dataElse.push(record)
+        localStorage.setItem('advertisingGroup', JSON.stringify(dataElse))
+      } else {
+        var data = [record]
+        localStorage.setItem('advertisingGroup', JSON.stringify(data))
+      }
+      this.$router.replace({ path: '/account/advertisingGroup' })
+    },
     onChangeSwitch(item) {
       console.log(item)
       var params = {}

+ 167 - 104
src/views/modules/kuaishouapp/account/advertisingGroup.vue

@@ -14,101 +14,117 @@
 <template>
   <div class="advertising-group">
     <a-row style="margin-top:15px">
-      <a-card :tabList="title" :activeTabKey="titleKey" @tabChange="key => onTabChange(key, 'titleKey')">
-        <a-button @click="dianji" style="margin-bottom:15px;">新增广告组</a-button>
-        <a-button @click="showEdit = true" style="margin:0 0 15px 15px;">列表项筛选</a-button>
+      <a-card title="">
+        <!-- :tabList="title" :activeTabKey="titleKey" @tabChange="key => onTabChange(key, 'titleKey')" -->
+        <a-tabs v-model="titleKey" type="editable-card" hideAdd @edit="remove">
+          <a-tab-pane v-for="pane in title" :tab="pane.tab" :key="pane.key">
+            <a-button @click="dianji" style="margin-bottom:15px;">新增广告组</a-button>
+            <a-button @click="showEdit = true" style="margin:0 0 15px 15px;">列表项筛选</a-button>
 
-        <div v-show="selectedRowKeys.length > 0">
-          批量修改预算:<a-input-number :min="0" :step="0.01" v-model="allMoney" style="width:150px" @fouse.stop />
-          <a-button @click="editMoney" style="margin:0 15px 15px 15px" type="primary">修改</a-button>
+            <div v-show="selectedRowKeys.length > 0">
+              批量修改预算:<a-input-number :min="0" :step="0.01" v-model="allMoney" style="width:150px" @fouse.stop />
+              <a-button @click="editMoney" style="margin:0 15px 15px 15px" type="primary">修改</a-button>
 
-          批量修改出价:<a-input-number :min="0" :step="0.01" v-model="allMoneyBid" style="width:150px" @fouse.stop />
-          <a-button @click="editMoneyBid" style="margin:0 15px 15px 15px" type="primary">修改</a-button>
-
-          批量操作:
-          <a-select style="width: 120px" v-model="allType">
-            <a-select-option value="1">启动</a-select-option>
-            <a-select-option value="2">暂停</a-select-option>
-            <a-select-option value="3">删除</a-select-option>
-          </a-select>
-          <a-button @click="editStatus" style="margin:0 0 15px 15px" type="primary">确认</a-button>
-        </div>
-        <a-modal title="列表项筛选" v-model="showEdit" @ok="handleOk">
-          <a-checkbox :indeterminate="indeterminate" @change="onCheckAllChange" :checked="checkAll">全选</a-checkbox>
-          <a-checkbox-group :options="showList" v-model="dataValue" class="checked" />
-        </a-modal>
-
-        <a-table
-          size="middle"
-          :columns="columns"
-          :dataSource="dataList"
-          bordered
-          :customRow="rowClick"
-          :pagination="ipagination"
-          :scroll="{ x: 1900 }"
-          :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
-        >
-          <span slot="action" slot-scope="text, record">
-            <a-switch v-model="record.showSwich" @change="onChangeSwitch(record)" />
-          </span>
-
-          <span slot="status" slot-scope="text">{{ text | status }}</span>
-          <span slot="putStatus" slot-scope="text">{{ text | putStatus }}</span>
-          <span slot="createChannel" slot-scope="text">{{ text | createChannel }}</span>
-          <span slot="bidType" slot-scope="text, record">
-            <!-- {{ text | bidType }} -->
-            {{ record.ocpxActionType | ocpxActionType }}</span
-          >
-          <!-- <span slot="ocpxActionType" slot-scope="text">{{ text | ocpxActionType }}</span> -->
-
-          <span slot="speed" slot-scope="text">{{ text | speed }}</span>
-          <span slot="sceneId" slot-scope="text"
-            ><span v-for="item of text" :key="item">{{ item | sceneId }}</span></span
-          >
-          <span slot="showModel" slot-scope="text">{{ text | showModel }}</span>
-          <span slot="unitType" slot-scope="text">{{ text == 4 ? '自定义' : '' }}</span>
-          <span slot="urlType" slot-scope="text">{{ text | urlType }}</span>
-
-          <template slot="dayBudget" slot-scope="text, record">
-            <div style="display:flex;justify-content: center;">
-              <span v-show="!record.edit" class="count">{{ text ? (text / 1000).toFixed(2) : '不限制预算' }}</span>
-              <a-input-number
-                :min="0"
-                :step="0.01"
-                v-show="record.edit"
-                v-model="record.elseMoney"
-                style="width:150px"
-                @fouse.stop
-              />
-              <a-icon
-                :type="record.edit ? 'check' : 'edit'"
-                @click.stop=";(record.edit = !record.edit), editShow(record)"
-                style="margin-left:10px"
-                class="count"
-              />
-            </div>
-          </template>
-          <template slot="bid" slot-scope="text, record">
-            <!-- <span slot="bid" slot-scope="text, record">{{ text == 0 ? record.cpaBid / 1000 : text / 1000 }}</span> -->
-            <div style="display:flex;justify-content: center;">
-              <span v-show="!record.editBid" class="count">{{ text == 0 ? record.cpaBid / 1000 : text / 1000 }}</span>
-              <a-input-number
+              批量修改出价:<a-input-number
                 :min="0"
                 :step="0.01"
-                v-show="record.editBid"
-                v-model="record.elseMoneyBid"
+                v-model="allMoneyBid"
                 style="width:150px"
                 @fouse.stop
               />
-              <a-icon
-                :type="record.editBid ? 'check' : 'edit'"
-                @click.stop=";(record.editBid = !record.editBid), editShowBid(record)"
-                style="margin-left:10px"
-                class="count"
-              />
+              <a-button @click="editMoneyBid" style="margin:0 15px 15px 15px" type="primary">修改</a-button>
+
+              批量操作:
+              <a-select style="width: 120px" v-model="allType">
+                <a-select-option value="1">启动</a-select-option>
+                <a-select-option value="2">暂停</a-select-option>
+                <a-select-option value="3">删除</a-select-option>
+              </a-select>
+              <a-button @click="editStatus" style="margin:0 0 15px 15px" type="primary">确认</a-button>
             </div>
-          </template>
-        </a-table>
+            <a-modal title="列表项筛选" v-model="showEdit" @ok="handleOk">
+              <a-checkbox :indeterminate="indeterminate" @change="onCheckAllChange" :checked="checkAll"
+                >全选</a-checkbox
+              >
+              <a-checkbox-group :options="showList" v-model="dataValue" class="checked" />
+            </a-modal>
+
+            <a-table
+              size="middle"
+              :columns="columns"
+              :dataSource="dataList"
+              bordered
+              :customRow="rowClick"
+              :pagination="ipagination"
+              :scroll="{ x: true }"
+              :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+            >
+              <a slot="unitName" slot-scope="text, record" @click="toDetail(record)">{{ text }}</a>
+              <span slot="action" slot-scope="text, record">
+                <a-switch v-model="record.showSwich" @change="onChangeSwitch(record)" />
+              </span>
+
+              <span slot="status" slot-scope="text">{{ text | status }}</span>
+              <span slot="putStatus" slot-scope="text">{{ text | putStatus }}</span>
+              <span slot="createChannel" slot-scope="text">{{ text | createChannel }}</span>
+              <span slot="bidType" slot-scope="text, record">
+                <!-- {{ text | bidType }} -->
+                {{ record.ocpxActionType | ocpxActionType }}</span
+              >
+              <!-- <span slot="ocpxActionType" slot-scope="text">{{ text | ocpxActionType }}</span> -->
+
+              <span slot="speed" slot-scope="text">{{ text | speed }}</span>
+              <span slot="sceneId" slot-scope="text"
+                ><span v-for="item of text" :key="item">{{ item | sceneId }}</span></span
+              >
+              <span slot="showModel" slot-scope="text">{{ text | showModel }}</span>
+              <span slot="unitType" slot-scope="text">{{ text == 4 ? '自定义' : '' }}</span>
+              <span slot="urlType" slot-scope="text">{{ text | urlType }}</span>
+
+              <template slot="dayBudget" slot-scope="text, record">
+                <div style="display:flex;justify-content: center;">
+                  <span v-show="!record.edit" class="count">{{ text ? (text / 1000).toFixed(2) : '不限制预算' }}</span>
+                  <a-input-number
+                    :min="0"
+                    :step="0.01"
+                    v-show="record.edit"
+                    v-model="record.elseMoney"
+                    style="width:150px"
+                    @fouse.stop
+                  />
+                  <a-icon
+                    :type="record.edit ? 'check' : 'edit'"
+                    @click.stop=";(record.edit = !record.edit), editShow(record)"
+                    style="margin-left:10px"
+                    class="count"
+                  />
+                </div>
+              </template>
+              <template slot="bid" slot-scope="text, record">
+                <!-- <span slot="bid" slot-scope="text, record">{{ text == 0 ? record.cpaBid / 1000 : text / 1000 }}</span> -->
+                <div style="display:flex;justify-content: center;">
+                  <span v-show="!record.editBid" class="count">{{
+                    text == 0 ? record.cpaBid / 1000 : text / 1000
+                  }}</span>
+                  <a-input-number
+                    :min="0"
+                    :step="0.01"
+                    v-show="record.editBid"
+                    v-model="record.elseMoneyBid"
+                    style="width:150px"
+                    @fouse.stop
+                  />
+                  <a-icon
+                    :type="record.editBid ? 'check' : 'edit'"
+                    @click.stop=";(record.editBid = !record.editBid), editShowBid(record)"
+                    style="margin-left:10px"
+                    class="count"
+                  />
+                </div>
+              </template>
+            </a-table>
+          </a-tab-pane>
+        </a-tabs>
       </a-card>
     </a-row>
     <a-modal v-model="visible" title="错误信息" onOk="handleOk" :footer="null">
@@ -165,6 +181,7 @@ var columns = [
     title: '广告组名称',
     align: 'center',
     dataIndex: 'unitName',
+    scopedSlots: { customRender: 'unitName' },
     colSpan: 1,
     fixed: 'left',
     width: 200
@@ -281,23 +298,23 @@ export default {
         on: {
           dblclick: () => {
             // 点击改行时要做的事情
-            localStorage.setItem('originalityKey', record.unitId)
-            localStorage.setItem('campaignId', record.campaignId)
-            if (localStorage.getItem('originality')) {
-              var dataElse = JSON.parse(localStorage.getItem('originality'))
-              for (let i = 0; i < dataElse.length; i++) {
-                if (dataElse[i].key == record.unitId) {
-                  this.$router.replace({ path: '/account/originality' })
-                  return
-                }
-              }
-              dataElse.push(record)
-              localStorage.setItem('originality', JSON.stringify(dataElse))
-            } else {
-              var data = [record]
-              localStorage.setItem('originality', JSON.stringify(data))
-            }
-            this.$router.replace({ path: '/account/originality' })
+            // localStorage.setItem('originalityKey', record.unitId)
+            // localStorage.setItem('campaignId', record.campaignId)
+            // if (localStorage.getItem('originality')) {
+            //   var dataElse = JSON.parse(localStorage.getItem('originality'))
+            //   for (let i = 0; i < dataElse.length; i++) {
+            //     if (dataElse[i].key == record.unitId) {
+            //       this.$router.replace({ path: '/account/originality' })
+            //       return
+            //     }
+            //   }
+            //   dataElse.push(record)
+            //   localStorage.setItem('originality', JSON.stringify(dataElse))
+            // } else {
+            //   var data = [record]
+            //   localStorage.setItem('originality', JSON.stringify(data))
+            // }
+            // this.$router.replace({ path: '/account/originality' })
           }
         }
       }),
@@ -389,6 +406,52 @@ export default {
     }
   },
   methods: {
+    remove(targetKey) {
+      let activeKey = this.titleKey
+      let lastIndex
+      this.title.forEach((pane, i) => {
+        if (pane.key === targetKey) {
+          lastIndex = i - 1
+        }
+      })
+      const panes = this.title.filter(pane => pane.key !== targetKey)
+      if (panes.length && activeKey === targetKey) {
+        if (lastIndex >= 0) {
+          activeKey = panes[lastIndex].key
+        } else {
+          activeKey = panes[0].key
+        }
+      }
+      this.title = panes
+      this.titleKey = activeKey
+      if (this.title.length == 0) {
+        this.$bus.$emit('remove', '/account/advertisingGroup')
+      } else {
+        localStorage.setItem('advertisingGroup', JSON.stringify(this.title))
+        localStorage.setItem('advertisingGroupKey', JSON.stringify(this.titleKey))
+        this.getDataList(activeKey)
+      }
+    },
+    toDetail(record) {
+      // 点击改行时要做的事情
+      localStorage.setItem('originalityKey', record.unitId)
+      localStorage.setItem('campaignId', record.campaignId)
+      if (localStorage.getItem('originality')) {
+        var dataElse = JSON.parse(localStorage.getItem('originality'))
+        for (let i = 0; i < dataElse.length; i++) {
+          if (dataElse[i].unitId == record.unitId) {
+            this.$router.replace({ path: '/account/originality' })
+            return
+          }
+        }
+        dataElse.push(record)
+        localStorage.setItem('originality', JSON.stringify(dataElse))
+      } else {
+        var data = [record]
+        localStorage.setItem('originality', JSON.stringify(data))
+      }
+      this.$router.replace({ path: '/account/originality' })
+    },
     ...mapGetters(['nickname', 'avatar', 'userInfo']),
     onChangeSwitch(item) {
       console.log(item)

+ 49 - 14
src/views/modules/kuaishouapp/account/originality.vue

@@ -11,13 +11,25 @@
 <template>
   <div class="creative-name">
     <a-row style="margin-top:15px">
-      <a-card :tabList="title" :activeTabKey="titleKey" @tabChange="key => onTabChange(key, 'titleKey')">
-        <a-button @click="dianji" style="margin-bottom:15px">新增创意</a-button>
-        <a-table :columns="columns" :dataSource="dataList" bordered :scroll="{ x: true }" :customRow="rowClick">
-          <span slot="status" slot-scope="text">{{ text | status }}</span>
-          <span slot="putStatus" slot-scope="text">{{ text | putStatus }}</span>
-          <img slot="coverUrl" slot-scope="text" :src="text" alt="" style="width:100px" />
-        </a-table>
+      <a-card title="">
+        <!-- :tabList="title" :activeTabKey="titleKey" @tabChange="key => onTabChange(key, 'titleKey')" -->
+        <a-tabs v-model="titleKey" type="editable-card" hideAdd @edit="remove">
+          <a-tab-pane v-for="pane in title" :tab="pane.tab" :key="pane.key">
+            <a-button @click="dianji" style="margin-bottom:15px">新增创意</a-button>
+            <a-table
+              :columns="columns"
+              :dataSource="dataList"
+              bordered
+              :scroll="{ x: true }"
+              :customRow="rowClick"
+              size="middle"
+            >
+              <span slot="status" slot-scope="text">{{ text | status }}</span>
+              <span slot="putStatus" slot-scope="text">{{ text | putStatus }}</span>
+              <img slot="coverUrl" slot-scope="text" :src="text" alt="" style="width:100px" />
+            </a-table>
+          </a-tab-pane>
+        </a-tabs>
       </a-card>
     </a-row>
   </div>
@@ -165,12 +177,8 @@ export default {
         return
       } else {
         localStorage.setItem('step', 2)
-        var dataJson = JSON.stringify(
-          this.title.filter(item => {
-            return item.key == this.titleKey
-          })
-        )
-        console.log(this.title,this.titleKey)
+        var dataJson = JSON.stringify(this.title)
+        console.log(this.title, this.titleKey)
         localStorage.setItem('pans', dataJson)
         this.$router.replace({ path: '/account/stepForm' })
       }
@@ -193,6 +201,32 @@ export default {
           })
         }
       })
+    },
+    remove(targetKey) {
+      let activeKey = this.titleKey
+      let lastIndex
+      this.title.forEach((pane, i) => {
+        if (pane.key === targetKey) {
+          lastIndex = i - 1
+        }
+      })
+      const panes = this.title.filter(pane => pane.key !== targetKey)
+      if (panes.length && activeKey === targetKey) {
+        if (lastIndex >= 0) {
+          activeKey = panes[lastIndex].key
+        } else {
+          activeKey = panes[0].key
+        }
+      }
+      this.title = panes
+      this.titleKey = activeKey
+      if (this.title.length == 0) {
+        this.$bus.$emit('remove', '/account/originality')
+      } else {
+        localStorage.setItem('originality', JSON.stringify(this.title))
+        localStorage.setItem('originalityKey', JSON.stringify(this.titleKey))
+        this.getDataList(activeKey)
+      }
     }
   },
   watch: {},
@@ -204,7 +238,8 @@ export default {
       return {
         key: item.unitId + '',
         tab: '广告组:' + item.unitName,
-        sceneId: item.sceneId
+        sceneId: item.sceneId,
+        bid_type: item.ocpxActionType
       }
     })
     this.getDataList(localStorage.getItem('originalityKey'))

+ 1 - 1
src/views/modules/kuaishouapp/account/stepForm/Step2.vue

@@ -882,7 +882,7 @@ export default {
               if (res.result.success.length > 0) {
                 var dataJson = JSON.stringify(
                   res.result.success.map(item => {
-                    return { tab: item.unit_name, key: item.unit_id }
+                    return { tab: item.unit_name, key: item.unit_id, bid_type: item.ocpx_action_type }
                   })
                 )
                 localStorage.setItem('pans', dataJson)

+ 135 - 29
src/views/modules/kuaishouapp/account/stepForm/Step3.vue

@@ -2,8 +2,15 @@
 
 <template>
   <a-card :body-style="{ padding: '24px 32px' }" :bordered="false">
-    <a-tabs style="width:50%;margin:0 auto">
-      <a-tab-pane v-for="pane in pans" :tab="pane.tab" :key="pane.key">
+    <a-tabs style="width:50%;margin:0 auto" type="editable-card" hideAdd @edit="remove">
+      <a-tab-pane
+        v-for="(pane, bestIndex) in pans"
+        :tab="pane.tab"
+        :key="pane.key"
+        v-model="pansKey"
+        disabled
+        :closable="pane.closable"
+      >
         <a-form @submit="handleSubmit" :form="form" style="margin-top:20px" :hideRequiredMark="true">
           <a-form-item
             label="素材类型"
@@ -19,16 +26,20 @@
             <a-layout>
               <a-layout-content style="padding:10px;">
                 <div :style="{ marginBottom: '16px' }">
-                  <a-button @click="addCreative()">添加创意</a-button>
+                  <a-button @click="addCreative(bestIndex)">添加创意</a-button>
                 </div>
                 <a-row>
-                  <a-col :span="24" v-for="(item, index) of list" :key="index">
+                  <a-col :span="24" v-for="(item, index) of pane.list" :key="index">
                     <a-card title :ref="item">
-                      <a-icon type="close" style="float:right;cursor: pointer;" @click="deleteCreative(index)" />
+                      <a-icon
+                        type="close"
+                        style="float:right;cursor: pointer;"
+                        @click="deleteCreative(bestIndex, index)"
+                      />
                       <div style="clear:both"></div>
                       <div class="dynamically_add_form_item">
                         <a-form-item label="">
-                          <a @click="getVideoList('video', index, item)">选择视频</a>
+                          <a @click="getVideoList('video', index, item, bestIndex)">选择视频</a>
                           <br />
                           <video
                             :src="item.videoList.url"
@@ -38,7 +49,7 @@
                           ></video>
                         </a-form-item>
                         <a-form-item label="">
-                          <a @click="getVideoList('image', index, item)">选择封面</a>
+                          <a @click="getVideoList('image', index, item, bestIndex)">选择封面</a>
                           <br />
                           <img
                             :src="item.url"
@@ -66,7 +77,7 @@
             </a-layout>
           </a-form-item>
           <a-form-item
-            label="素材类型"
+            label="行动号召"
             :labelCol="{ lg: { span: 2 }, sm: { span: 4 } }"
             :wrapperCol="{ lg: { span: 18 }, sm: { span: 17 } }"
           >
@@ -93,7 +104,15 @@
             :wrapperCol="{ lg: { span: 18 }, sm: { span: 18 } }"
           >
             <a-input
-              v-decorator="['click_track_url', { rules: [{ required: true, message: '请输入第三方检测链接' },{ validator: handleConfirmValue }] }]"
+              v-decorator="[
+                'click_track_url',
+                {
+                  rules: [
+                    { required: pane.bid_type == 6, message: '请输入第三方检测链接' },
+                    { validator: handleConfirmValue }
+                  ]
+                }
+              ]"
               placeholder="请输入第三方检测链接"
             >
             </a-input>
@@ -105,6 +124,31 @@
       <a-button type="primary" @click="handleSubmit">提交</a-button>
     </a-form-item>
     <checkMatemal ref="check" @showVideo="showData"></checkMatemal>
+    <a-modal v-model="visible" title="广告创意创建情况">
+      <div>
+        创建成功:{{ allForm.success.length }}条
+        <div style="margin-top:20px">
+          <p v-for="(item, index) of allForm.success" :key="index">
+            <span>名称:{{ item.creative_name }}</span>
+          </p>
+        </div>
+        <br />
+        创建失败:{{ allForm.fail.length }}条
+        <div style="margin-top:20px">
+          <p v-for="(item, index) of allForm.fail" :key="index">
+            <span>名称:{{ item.creative_name }}</span
+            ><br />
+            <span>错误信息:{{ item.failMessage }}</span>
+          </p>
+        </div>
+      </div>
+      <template slot="footer">
+        <a-button key="back" @click="handleCancel">关闭</a-button>
+        <a-button key="submit" type="primary" @click="handleOk">
+          返回列表
+        </a-button>
+      </template>
+    </a-modal>
   </a-card>
 </template>
 
@@ -127,11 +171,13 @@ export default {
   data() {
     return {
       pans: [],
-      allForm: { videoList: '', imageList: [] },
+      pansKey: '',
+      allForm: { videoList: '', imageList: [], fail: [], success: [] },
       form: this.$form.createForm(this),
       list: [],
       vertical: 'vertical',
-      appList: []
+      appList: [],
+      visible: false
     }
   },
   methods: {
@@ -143,23 +189,24 @@ export default {
       }
     },
     showData(item, type) {
-      this.list[item.key].imageList = []
+      var index = this.pans.findIndex(item => item.key === this.pansKey)
+      this.pans[index].list[item.key].imageList = []
       if (type == 'video') {
-        this.list[item.key].videoList = item.video
+        this.pans[index].list[item.key].videoList = item.video
         getAction('/kuaishou/batch/getCreativeCopywriter', { code: item.video.signature }).then(res => {
           console.log(res)
           if (res.success) {
-            this.list[item.key].description = res.result.creativeCopywriter
+            this.pans[index].list[item.key].description = res.result.creativeCopywriter
           }
         })
       } else {
-        this.list[item.key].imageList.push(...item.image)
+        this.pans[index].list[item.key].imageList.push(...item.image)
       }
     },
     getData(className) {
       return this.form.getFieldValue(className)
     },
-    getVideoList(type, index, item) {
+    getVideoList(type, index, item, bestIndex) {
       if (type == 'video') {
         this.$refs.check.showCheck(
           this.getData('creative_material_type'),
@@ -178,14 +225,48 @@ export default {
         )
       }
     },
+    remove(targetKey) {
+      let activeKey = this.pansKey
+      let lastIndex
+      this.pans.forEach((pane, i) => {
+        if (pane.key === targetKey) {
+          lastIndex = i - 1
+        }
+      })
+      const panes = this.pans.filter(pane => pane.key !== targetKey)
+      if (panes.length && activeKey === targetKey) {
+        if (lastIndex >= 0) {
+          activeKey = panes[lastIndex].key
+        } else {
+          activeKey = panes[0].key
+        }
+      }
+      this.pans = panes
+      this.pansKey = activeKey
+      this.form.resetFields()
+      if (this.pans.length == 0) {
+        this.$bus.$emit('remove', '/account/stepForm')
+      }
+    },
+    handleOk() {
+      if (this.allForm.fail.length == 0) {
+        this.remove(this.pansKey)
+        this.visible = false
+      } else {
+        this.visible = false
+      }
+    },
+    handleCancel(e) {
+      this.visible = false
+    },
     handleSubmit(e) {
       //   e.preventDefault()
       //   this.nextStep()
-
       e.preventDefault()
+      var index = this.pans.findIndex(item => item.key === this.pansKey)
       this.form.validateFields((err, values) => {
         if (!err) {
-          var dataJson = this.list.map(item => {
+          var dataJson = this.pans[index].list.map(item => {
             return {
               description: item.description,
               image_tokens: item.imageList.map((ele, index) => {
@@ -195,8 +276,16 @@ export default {
             }
           })
 
-          var params = { ...dataJson, ...values }
+          var params = { dataJson, ...values, unitId: this.pansKey, accountId: localStorage.getItem('accountId') }
           console.log(params)
+          postAction('/kuaishou/batch/createCreative', params).then(res => {
+            console.log(res)
+            if (res.success) {
+              this.visible = true
+              this.allForm.fail = res.result.fail
+              this.allForm.success = res.result.success
+            }
+          })
         }
       })
     },
@@ -209,11 +298,18 @@ export default {
     prevStep() {
       this.$emit('prevStep')
     },
-    addCreative() {
-      this.list.push({ videoList: '', imageList: [], name: '', description: '' })
+    addCreative(index) {
+      this.pans[index].list.push({
+        videoList: '',
+        imageList: [],
+        name: '',
+        description: '',
+        creative_material_type: '1',
+        action_bar_text: ''
+      })
     },
-    deleteCreative(index) {
-      this.list.splice(index, 1)
+    deleteCreative(bestIndex, index) {
+      this.pans[bestIndex].list.splice(index, 1)
     },
     filterOption(input, option) {
       return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
@@ -241,13 +337,23 @@ export default {
       return 'video/' + y + '-' + MM + '-' + d + '/'
     }
   },
+  watch: {},
   mounted: function() {
-    this.pans = JSON.parse(localStorage.getItem('pans'))
-    getAction('/kuaishou/batch/getActionBarText', { campaignId: localStorage.getItem('campaignId') }).then(res => {
-      if (res.success) {
-        this.appList = res.result
-      }
-    })
+    if (localStorage.getItem('pans')) {
+      this.pans = JSON.parse(localStorage.getItem('pans')).map(item => {
+        return {
+          ...item,
+          list: []
+        }
+      })
+      console.log(this.pans)
+      this.pansKey = this.pans[0].key
+      getAction('/kuaishou/batch/getActionBarText', { campaignId: localStorage.getItem('campaignId') }).then(res => {
+        if (res.success) {
+          this.appList = res.result
+        }
+      })
+    }
   }
 }
 </script>

+ 9 - 1
src/views/modules/kuaishouapp/account/stepForm/StepForm.vue

@@ -9,7 +9,7 @@
     <div class="content">
       <step1 v-if="currentTab === 0" @nextStep="nextStep" ref="step" />
       <step2 v-if="currentTab === 1" :campaignId="campaignId" @nextStep="nextStepTwo" @prevStep="prevStep" />
-      <step3 v-show="currentTab === 2" @prevStep="prevStepTwo" />
+      <step3 v-if="currentTab === 2" @prevStep="prevStepTwo" @removeTab="remove" />
       <!-- <step4 v-if="currentTab === 3" @prevStep="prevStep" @finish="finish" /> -->
     </div>
   </a-card>
@@ -43,16 +43,19 @@ export default {
       this.campaignId = campaignId
       if (this.currentTab < 2) {
         this.currentTab += 1
+        localStorage.setItem('step', this.currentTab)
       }
     },
     nextStepTwo() {
       if (this.currentTab < 2) {
         this.currentTab += 1
+        localStorage.setItem('step', this.currentTab)
       }
     },
     prevStep(campaignId) {
       if (this.currentTab > 0) {
         this.currentTab -= 1
+        localStorage.setItem('step', this.currentTab)
         this.$nextTick(() => {
           this.$refs.step.getCampaignId(campaignId)
         })
@@ -61,10 +64,15 @@ export default {
     prevStepTwo() {
       if (this.currentTab > 0) {
         this.currentTab -= 1
+        localStorage.setItem('step', this.currentTab)
       }
     },
     finish() {
       this.currentTab = 0
+    },
+    remove(key) {
+      alert(key)
+      this.$emit('removeTab', key)
     }
   },
   mounted() {

+ 37 - 9
src/views/modules/material/materialList.vue

@@ -203,6 +203,20 @@ a {
       <a-button v-if="queryParam.projectId && active == '1'" :disabled="checkArr.length == 0" @click="tongbu"
         >一键下载</a-button
       >
+      <a-button
+        v-if="
+          queryParam.projectId &&
+            active == '1' &&
+            (role.roleCode == 'operator' ||
+              role.roleCode == 'kuaishouOperationManager' ||
+              role.roleCode == 'admin' ||
+              role.roleCode == 'operationAssistant' ||
+              role.roleCode == 'touTiaoOperationManager')
+        "
+        :disabled="checkArr.length == 0"
+        @click="tongbuImage"
+        >一键同步</a-button
+      >
     </div>
     <a-tabs @change="callbackTwo" v-model="active" id="material-card" type="card">
       <a-tab-pane :tab="item.tab" v-for="item of examinelList" :key="item.value">
@@ -261,7 +275,8 @@ a {
                     v-if="
                       role.roleCode == 'operator' ||
                         role.roleCode == 'kuaishouOperationManager' ||
-                        role.roleCode == 'admin'
+                        role.roleCode == 'admin' ||
+                        role.roleCode == 'touTiaoOperationManager'
                     "
                   >
                     <div slot="title">
@@ -300,7 +315,8 @@ a {
                     v-if="
                       role.roleCode == 'operator' ||
                         role.roleCode == 'kuaishouOperationManager' ||
-                        role.roleCode == 'admin'
+                        role.roleCode == 'admin' ||
+                        role.roleCode == 'touTiaoOperationManager'
                     "
                   >
                     <div slot="title">
@@ -320,7 +336,8 @@ a {
                       v-if="
                         role.roleCode == 'operator' ||
                           role.roleCode == 'kuaishouOperationManager' ||
-                          role.roleCode == 'admin'
+                          role.roleCode == 'admin' ||
+                          role.roleCode == 'touTiaoOperationManager'
                       "
                     >
                       通过审核</a
@@ -528,7 +545,8 @@ a {
                 active != '2' &&
                   (role.roleCode == 'operator' ||
                     role.roleCode == 'kuaishouOperationManager' ||
-                    role.roleCode == 'admin')
+                    role.roleCode == 'admin' ||
+                    role.roleCode == 'touTiaoOperationManager')
               "
             >
               <a-button type="primary" @click="edit(null, '0', '1')" v-if="active == '0'" style="margin-right:10px"
@@ -729,11 +747,13 @@ export default {
     a(item) {
       item.showVideo = true
     },
+    tongbuImage() {
+      this.$refs.check.getData('/ctop/userAllocation/getAccountList', {
+        userId: this.userInfo().id,
+        projectId: this.queryParam.projectId
+      })
+    },
     tongbu() {
-      //   this.$refs.check.getData('/ctop/userAllocation/getAccountList', {
-      //     userId: this.userInfo().id,
-      //     projectId: this.queryParam.projectId
-      //   })
       if (this.checkArr.length > 1) {
         downFilePost('/download/zip', { urls: this.checkArr }).then(res => {
           let blob = new Blob([res], {
@@ -796,8 +816,16 @@ export default {
     },
     implement(data) {
       var params = {}
+      var dataJson = []
+      for (let i = 0; i < this.dataSource.length; i++) {
+        for (let j = 0; j < this.checkArr.length; j++) {
+          if (this.dataSource[i].url == this.checkArr[j]) {
+            dataJson.push(this.dataSource[i].id)
+          }
+        }
+      }
       params.mediaId = this.mediaId
-      params.materialArray = JSON.stringify(this.checkArr)
+      params.materialArray = JSON.stringify(dataJson)
       params.accountArray = JSON.stringify(data)
       postAction('/ctop/materialUpload/uploadAccount', params).then(res => {
         if (res.code == 0) {

+ 14 - 7
src/views/modules/material/videoMaterial.vue

@@ -212,7 +212,8 @@ a {
             (role.roleCode == 'operator' ||
               role.roleCode == 'kuaishouOperationManager' ||
               role.roleCode == 'admin' ||
-              role.roleCode == 'operationAssistant')
+              role.roleCode == 'operationAssistant' ||
+              role.roleCode == 'touTiaoOperationManager')
         "
         >{{ checkAll ? '取消  (  ' + checkArr.length + '  )' : '全选' }}</a-button
       >
@@ -223,7 +224,8 @@ a {
             (role.roleCode == 'operator' ||
               role.roleCode == 'kuaishouOperationManager' ||
               role.roleCode == 'admin' ||
-              role.roleCode == 'operationAssistant')
+              role.roleCode == 'operationAssistant' ||
+              role.roleCode == 'touTiaoOperationManager')
         "
         :disabled="checkArr.length == 0"
         @click="tongbu"
@@ -295,7 +297,8 @@ a {
                       role.roleCode == 'operator' ||
                         role.roleCode == 'kuaishouOperationManager' ||
                         role.roleCode == 'admin' ||
-                        role.roleCode == 'operationAssistant'
+                        role.roleCode == 'operationAssistant' ||
+                        role.roleCode == 'touTiaoOperationManager'
                     "
                   >
                     <div slot="title">
@@ -335,7 +338,8 @@ a {
                       role.roleCode == 'operator' ||
                         role.roleCode == 'kuaishouOperationManager' ||
                         role.roleCode == 'admin' ||
-                        role.roleCode == 'operationAssistant'
+                        role.roleCode == 'operationAssistant' ||
+                        role.roleCode == 'touTiaoOperationManager'
                     "
                   >
                     <div slot="title">
@@ -356,7 +360,8 @@ a {
                         role.roleCode == 'operator' ||
                           role.roleCode == 'kuaishouOperationManager' ||
                           role.roleCode == 'admin' ||
-                          role.roleCode == 'operationAssistant'
+                          role.roleCode == 'operationAssistant' ||
+                          role.roleCode == 'touTiaoOperationManager'
                       "
                     >
                       通过审核</a
@@ -637,7 +642,8 @@ a {
                   (role.roleCode == 'operator' ||
                     role.roleCode == 'kuaishouOperationManager' ||
                     role.roleCode == 'admin' ||
-                    role.roleCode == 'operationAssistant')
+                    role.roleCode == 'operationAssistant' ||
+                    role.roleCode == 'touTiaoOperationManager')
               "
             >
               <a-popconfirm
@@ -647,7 +653,8 @@ a {
                   role.roleCode == 'operator' ||
                     role.roleCode == 'kuaishouOperationManager' ||
                     role.roleCode == 'admin' ||
-                    role.roleCode == 'operationAssistant'
+                    role.roleCode == 'operationAssistant' ||
+                    role.roleCode == 'touTiaoOperationManager'
                 "
               >
                 <div slot="title">