Explorar o código

广告主管理价格预警修改

liubei@c-top.com.cn %!s(int64=3) %!d(string=hai) anos
pai
achega
0a28450e3b

+ 43 - 22
src/views/modules/advertiser/AdvertiserList.vue

@@ -94,16 +94,27 @@
         :loading="loading"
         @change="handleTableChange"
       >
-        <span slot="ocpxActionType" slot-scope="text">
-          <div v-if="text">
-            <span v-for="(item, index) of JSON.parse(text)" :key="index"
-              >{{ item | ocpxActionType }}{{ index == JSON.parse(text).length - 1 ? '' : ',' }}</span
-            >
-          </div>
-          <div v-else>-</div>
+      <span slot="maxBid" slot-scope="text,record">{{ record.maxBid == 0? '-': record.maxBid / 1000 }}</span>
+      <span slot="ocpxActionType" slot-scope="text,record">
+        <div v-if="!!record.ocpxActionTypeArray&&record.ocpxActionTypeArray.length>0">
+          <span v-for="(item, index)  in record.ocpxActionTypeArray" :key="index"
+            >{{item.ocpxName}}({{(item.maxValue / 1000).toFixed(2)}})<br></span
+          >
+        </div>
+        <div v-else>-</div>
 
-          <!-- {{ text | ocpxActionType }} -->
-        </span>
+        <!-- {{ text | ocpxActionType }} -->
+      </span>
+      <span slot="deepConversionType" slot-scope="text,record">
+        <div v-if="!!record.deepConversionTypeArray&&record.deepConversionTypeArray.length != 0">
+          <span v-for="(item, index)  in record.deepConversionTypeArray" :key="index"
+            >{{item.deepName}}({{(item.deepValue / 1000).toFixed(2)}})<br></span
+          >
+        </div>
+        <div v-else>-</div>
+
+        <!-- {{ text | ocpxActionType }} -->
+      </span>
         <span slot="bidType" slot-scope="text">
           <div v-if="text && JSON.parse(text).length > 0">
             <span v-for="(item, index) of JSON.parse(text)" :key="index"
@@ -137,8 +148,8 @@
             <a>删除</a>
           </a-popconfirm>
         </span>
-        <span slot="maxBid" slot-scope="text">{{ text / 1000 }}</span>
-        <span slot="maxDeepCpaBid" slot-scope="text">{{ text / 1000 }}</span>
+        <!-- <span slot="maxBid" slot-scope="text">{{ text / 1000 }}</span> -->
+        <!-- <span slot="maxDeepCpaBid" slot-scope="text">{{ text / 1000 }}</span> -->
         <a slot="name" slot-scope="text, record" @click="toProduct(record, 'product')">{{ text }}</a>
         <a slot="productName" slot-scope="text, record" @click="toProduct(record, 'project')">{{ text }}</a>
       </a-table>
@@ -257,21 +268,21 @@ const projectColumns = [
     dataIndex: 'advertiserId_dictText',
   },
   {
-    title: '最高出价',
+    title: '最高出价(元)',
     align: 'center',
     dataIndex: 'maxBid',
     scopedSlots: {
       customRender: 'maxBid',
     },
   },
-  {
-    title: '最高转化出价',
-    align: 'center',
-    dataIndex: 'maxDeepCpaBid',
-    scopedSlots: {
-      customRender: 'maxDeepCpaBid',
-    },
-  },
+  // {
+  //   title: '最高转化出价',
+  //   align: 'center',
+  //   dataIndex: 'maxDeepCpaBid',
+  //   scopedSlots: {
+  //     customRender: 'maxDeepCpaBid',
+  //   },
+  // },
   {
     title: '优化目标',
     align: 'center',
@@ -281,13 +292,22 @@ const projectColumns = [
     },
   },
   {
-    title: '转化目标',
+    title: '转化目标(出价/元)',
     align: 'center',
     dataIndex: 'ocpxActionType',
+    width: 150,
     scopedSlots: {
       customRender: 'ocpxActionType',
     },
-  },
+  },{
+          title: '深度转化目标(出价)',
+          align: 'center',
+          dataIndex: 'deepConversionType',
+          width: 150,
+          scopedSlots: {
+            customRender: 'deepConversionType',
+          },
+        },
   {
     title: '供应商',
     align: 'center',
@@ -312,6 +332,7 @@ const projectColumns = [
     title: '操作',
     dataIndex: 'actionProject',
     align: 'center',
+    width:100,
     scopedSlots: {
       customRender: 'actionProject',
     },

+ 10 - 10
src/views/modules/advertiser/ProjectList.vue

@@ -121,7 +121,7 @@
         @change="handleTableChange"
       >
         <span slot="maxBid" slot-scope="text,record">{{ record.maxBid == 0? '-': record.maxBid / 1000 }}</span>
-        <span slot="maxDeepCpaBid" slot-scope="text">{{ text / 1000 }}</span>
+        <!-- <span slot="maxDeepCpaBid" slot-scope="text">{{ text / 1000 }}</span> -->
         <span slot="ocpxActionType" slot-scope="text,record">
           <div v-if="!!record.ocpxActionTypeArray&&record.ocpxActionTypeArray.length>0">
             <span v-for="(item, index)  in record.ocpxActionTypeArray" :key="index"
@@ -205,21 +205,21 @@ export default {
           dataIndex: 'advertiserId_dictText',
         },
         {
-          title: '最高出价',
+          title: '最高出价(元)',
           align: 'center',
           dataIndex: 'maxBid',
           scopedSlots: {
             customRender: 'maxBid',
           },
         },
-        {
-          title: '最高转化出价',
-          align: 'center',
-          dataIndex: 'maxDeepCpaBid',
-          scopedSlots: {
-            customRender: 'maxDeepCpaBid',
-          },
-        },
+        // {
+        //   title: '最高转化出价',
+        //   align: 'center',
+        //   dataIndex: 'maxDeepCpaBid',
+        //   scopedSlots: {
+        //     customRender: 'maxDeepCpaBid',
+        //   },
+        // },
         {
           title: '优化目标',
           align: 'center',

+ 36 - 6
src/views/modules/advertiser/modules/ProjectModal.vue

@@ -62,7 +62,7 @@
               <a-select-option :value="2">点击数</a-select-option>
               <a-select-option :value="10">OCPM</a-select-option>
               <a-select-option :value="6">OCPC</a-select-option>
-              <a-select-option :value="12">最大转化</a-select-option>
+              <a-select-option :value="12">最大转化</a-select-option>
             </a-select>
           </a-form-item>
           <div v-if="Array.isArray(getFormFieldValue('bidType'))">
@@ -72,7 +72,7 @@
                 getFormFieldValue('bidType').findIndex((item) => item == 12) > -1
               ">
               <!-- v-model="model.ocpxActionType" -->
-              <a-select @change="ocpxActionTypeChange($event)" v-decorator="[
+              <a-select @change="ocpxActionTypeChange($event)" @deselect="ocpextiondeselect" v-decorator="[
                   'ocpxActionType',
                   { rules: [{ required: true, message: '请选择转化目标' }] },
                 ]" mode="multiple">
@@ -86,7 +86,7 @@
             <div v-if="Array.isArray(getFormFieldValue('ocpxActionType'))">
               <a-form-item v-show="getFormFieldValue('ocpxActionType').length > 0" :labelCol="labelCol"
                 :wrapperCol="wrapperCol" v-for="(item, index) in ocpxActionTypeArray" :key="index"
-                :label="item.ocpxName+'最高价'">
+                :label="item.ocpxName+'最高价'">
                 <a-input @input="maxValueInput"
                   @keyup.native="item.maxValue = item.maxValue.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');"
                   placeholder="请输入最高出价" v-model="item.maxValue" addonAfter="元" />
@@ -94,7 +94,11 @@
             </div>
 
             <div v-if="Array.isArray(getFormFieldValue('ocpxActionType'))">
-              <a-form-item label="深度转化目标" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="getFormFieldValue('ocpxActionType').length > 0">
+              <a-form-item v-if="
+              getFormFieldValue('bidType').findIndex((item) => item == 10) > -1 ||
+              getFormFieldValue('bidType').findIndex((item) => item == 6) > -1||
+              getFormFieldValue('bidType').findIndex((item) => item == 12) > -1 || getFormFieldValue('ocpxActionType').length == 0
+            " label="深度转化目标" :labelCol="labelCol" :wrapperCol="wrapperCol" >
                 <!-- v-model="model.ocpxActionType" -->
                 <a-select @change="depthChange($event)" v-model="model.deepConversionType" mode="multiple">
                   <a-select-option :value="item.deepCode" v-for="(item, index) in depthList" :key="index">{{
@@ -106,7 +110,7 @@
 
             <div v-if="model.deepConversionType">
               <a-form-item v-show="model.deepConversionType.length >0" :labelCol="labelCol" :wrapperCol="wrapperCol"
-                v-for="(item, index) in depthArray" :key="index" :label="item.deepName+'最高价'">
+                v-for="(item, index) in depthArray" :key="index" :label="item.deepName+'最高价'">
                 <a-input placeholder="请输入最高出价" @input="deepInput"
                   @keyup.native="item.deepValue = item.deepValue.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');"
                   v-model="item.deepValue" addonAfter="元" />
@@ -234,6 +238,10 @@
           this.maxBidShow = false;
         } else {
           this.maxBidShow = true;
+          this.model.deepConversionType = [];
+          this.depthArray = [];
+          this.ocpxActionTypeArray = [];
+          // this.maxBidShow = false;
         }
         // item.indexOf(item=>{
         //   console.log(item);
@@ -253,19 +261,41 @@
         }
       },
       ocpxActionTypeChange(item) {
-        this.ocpxActionTypeArray = [];
+        // this.ocpxActionTypeArray = [];
         item.forEach(element => {
           this.ocpxList.find((par) => {
             if (par.ocpxActionType == element) {
+             
               this.ocpxActionTypeArray.push({ ocpxCode: par.ocpxActionType, ocpxName: par.ocpxActionName });
             }
 
           })
         });
+        this.deWeight();
         if (item.length == 0) {
           this.model.deepConversionType = [];
         }
       },
+      deWeight() {
+            for (var i = 0; i < this.ocpxActionTypeArray.length - 1; i++) {
+                for (var j = i + 1; j < this.ocpxActionTypeArray.length; j++) {
+                    if (this.ocpxActionTypeArray[i].ocpxName == this.ocpxActionTypeArray[j].ocpxName) {
+                        this.ocpxActionTypeArray.splice(j, 1);
+                        //因为数组长度减小1,所以直接 j++ 会漏掉一个元素,所以要 j--
+                        j--;
+                    }
+                }
+            }
+            // return this.ocpxActionTypeArray;
+            
+        },
+        ocpextiondeselect(item){
+          this.ocpxActionTypeArray.forEach((element,index) => {
+            if (element.ocpxCode == item) {
+              this.ocpxActionTypeArray.splice(index,1)
+            }
+          });
+        },
       depthChange(event) {
         this.depthArray = [];
         event.forEach(element => {

+ 31 - 6
src/views/modules/advertiser/modules/projectListModal.vue

@@ -55,7 +55,7 @@
               <a-select-option :value="2">点击数</a-select-option>
               <a-select-option :value="10">OCPM</a-select-option>
               <a-select-option :value="6">OCPC</a-select-option>
-              <a-select-option :value="12">最大转化</a-select-option>
+              <a-select-option :value="12">最大转化</a-select-option>
             </a-select>
           </a-form-item>
           <div v-if="Array.isArray(getFormFieldValue('bidType'))">
@@ -64,7 +64,7 @@
                 getFormFieldValue('bidType').findIndex((item) => item == 6) > -1||
                 getFormFieldValue('bidType').findIndex((item) => item == 12) > -1
               ">
-              <a-select v-model="model.ocpxActionType" @change="ocpxActionTypeChange($event)" mode="multiple">
+              <a-select v-model="model.ocpxActionType" @change="ocpxActionTypeChange($event)"  @deselect="ocpextiondeselect" mode="multiple">
                 <!-- <a-select-option :value="2">行为数</a-select-option> -->
                 <a-select-option :value="item.ocpxActionType" v-for="(item, index) in ocpxList" :key="item.id">{{
                   item.ocpxActionName
@@ -74,7 +74,7 @@
 
             <div v-if="model.ocpxActionType">
               <a-form-item v-show="model.ocpxActionType.length > 0" :labelCol="labelCol" :wrapperCol="wrapperCol"
-                v-for="(item, index) in ocpxActionTypeArray" :key="index" :label="item.ocpxName+'最高价'">
+                v-for="(item, index) in ocpxActionTypeArray" :key="index" :label="item.ocpxName+'最高价'">
                 <a-input @input="maxValueInput"
                   @keyup.native="item.maxValue = item.maxValue.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');"
                   placeholder="请输入最高出价" v-model="item.maxValue" addonAfter="元" />
@@ -97,7 +97,7 @@
 
           <div v-if="model.deepConversionType">
             <a-form-item v-show="model.deepConversionType.length >0" :labelCol="labelCol" :wrapperCol="wrapperCol"
-              v-for="(item, index) in depthArray" :key="index" :label="item.deepName+'最高价'">
+              v-for="(item, index) in depthArray" :key="index" :label="item.deepName+'最高价'">
               <a-input placeholder="请输入最高出价" @input="deepInput"
                 @keyup.native="item.deepValue = item.deepValue.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');"
                 v-model="item.deepValue" addonAfter="元" />
@@ -254,6 +254,11 @@
           this.maxBidShow = false;
         } else {
           this.maxBidShow = true;
+          this.model.deepConversionType = [];
+          this.model.ocpxActionType = [];
+          this.depthArray = [];
+          this.ocpxActionTypeArray = [];
+          // this.maxBidShow = false;
         }
         if (item.length == 0) {
           this.model.deepConversionType = [];
@@ -264,7 +269,7 @@
         }
       },
       ocpxActionTypeChange(item) {
-        this.ocpxActionTypeArray = [];
+        // this.ocpxActionTypeArray = [];
         item.forEach(element => {
           this.ocpxList.find((par) => {
             if (par.ocpxActionType == element) {
@@ -274,12 +279,32 @@
 
           })
         });
-
+        this.deWeight();
         if (item.length == 0) {
           this.model.deepConversionType = [];
         }
 
       },
+      deWeight() {
+            for (var i = 0; i < this.ocpxActionTypeArray.length - 1; i++) {
+                for (var j = i + 1; j < this.ocpxActionTypeArray.length; j++) {
+                    if (this.ocpxActionTypeArray[i].ocpxName == this.ocpxActionTypeArray[j].ocpxName) {
+                        this.ocpxActionTypeArray.splice(j, 1);
+                        //因为数组长度减小1,所以直接 j++ 会漏掉一个元素,所以要 j--
+                        j--;
+                    }
+                }
+            }
+            // return this.ocpxActionTypeArray;
+            
+        },
+        ocpextiondeselect(item){
+          this.ocpxActionTypeArray.forEach((element,index) => {
+            if (element.ocpxCode == item) {
+              this.ocpxActionTypeArray.splice(index,1)
+            }
+          });
+        },
       depthChange(event) {
         this.depthArray = [];
         event.forEach(element => {