浏览代码

提交file

xia 4 年之前
父节点
当前提交
51b4274d47
共有 5 个文件被更改,包括 125 次插入47 次删除
  1. 21 0
      README.md
  2. 9 1
      src/views/put/ad-group.vue
  3. 39 34
      src/views/put/put-ad-account.vue
  4. 35 12
      src/views/put/put-ad-plan.vue
  5. 21 0
      src/views/put/put-data.vue

+ 21 - 0
README.md

@@ -20,3 +20,24 @@ yarn build
 
 ### Customize configuration
 See [Configuration Reference](https://cli.vuejs.org/config/).
+
+test Rdr1ly
+13127819373 9WbqQ8
+songdb pma465
+liukf sGwRX8
+xiabx HApWmb
+caicf OzQ8G4
+changjy SIYytq
+chenb RFTHZL
+hanyh 18HDkc
+jiangxf iMPyho
+jiangjx 8RFPv3
+liwh dw6mab
+wangdd QHfnGD
+zhangt adQ2mX
+zhaox DFw4VH
+baixq tXb37o
+zhaoy rjdihe
+zhoulj CHtkNe
+zhengxw rXCjvN
+gudy h0JWaM

+ 9 - 1
src/views/put/ad-group.vue

@@ -186,9 +186,17 @@ const Adgroup = defineComponent({
       });
     });
     const goAdlgroup = (id: string, campaign_id: string) => {
+      let begin_date, end_date;
+      if(state.pickered){
+        let [begin_dates, end_dates] = state.pickered;
+        if (begin_dates && end_dates) {
+          begin_date = moment(begin_dates).format("YYYY-MM-DD");
+          end_date = moment(end_dates).format("YYYY-MM-DD");
+        }
+      }
       router.push({
         path: "/put/datas/ad-plan",
-        query: { campaign_id },
+        query: { campaign_id,begin_date,end_date },
       });
     };
     return {

+ 39 - 34
src/views/put/put-ad-account.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="page-wrap page-wrap-put-books">
     <tool-bar
-      :text="['email', 'account_id', 'account_name','advertiser_id']"
-      :label="['邮箱', '账户名/ID', '用户名','广告主ID']"
+      :text="['email', 'account_id', 'account_name', 'advertiser_id']"
+      :label="['邮箱', '账户名/ID', '用户名', '广告主ID']"
       v-model:loading="inSearching"
       @confirm="onSearch"
     >
@@ -19,19 +19,19 @@
       :loading="loading.value"
       bordered
       @change="handleTableChange"
-      :scroll="{y: 600 }"
+      :scroll="{ y: 600 }"
       rowKey="id"
     >
-    <template #operator="{ text, record }">
-          <a-switch
-            v-model:checked="record.is_enable"
-            @change="switchMethod(record)"
-          />
-        </template>
-    <template #email="{ text, record }">
-      <p>账户ID{{record.account_id}}</p>
-      <p>邮箱:{{record.email}}</p>
-    </template>
+      <template #operator="{ text, record }">
+        <a-switch
+          v-model:checked="record.is_enable"
+          @change="switchMethod(record)"
+        />
+      </template>
+      <template #email="{ text, record }">
+        <p>账户ID{{ record.account_id }}</p>
+        <p>邮箱:{{ record.email }}</p>
+      </template>
     </a-table>
   </div>
 </template>
@@ -41,7 +41,7 @@ import { defineComponent, reactive, toRefs, ref } from "vue";
 import ToolBar from "@/components/tool-bar/index.vue";
 import { TableColumnOfPutAdAccount } from "../_pageOptions/table-put";
 import usePagination from "@/hooks/usePagination";
-import { getAdPushList, getAdauth,statusAdChange } from "@/api";
+import { getAdPushList, getAdauth, statusAdChange } from "@/api";
 import { ADpushSimple, PageOptions } from "@/types/api";
 import useDebounceFn from "@/hooks/useDebounceFn";
 import { message } from "ant-design-vue";
@@ -59,12 +59,17 @@ const PutAdAccount = defineComponent({
       tablePageOptions,
     });
     getAdPushList({ page: 1 }).then((res) => {
-      state.list = res.data.list;
+      let clist = res.data.list.map((r: any) => {
+        r.is_enable == 0 ? (r.is_enable = false) : (r.is_enable = true);
+        return r;
+      });
+
+      state.list = clist;
       meta.value = res.data.meta;
     });
     const onSearch = async (fields: Record<string, string>) => {
       try {
-        const { email, account_name, account_id,advertiser_id } = fields;
+        const { email, account_name, account_id, advertiser_id } = fields;
         const { data } = await getAdPushList({
           email,
           account_name,
@@ -72,28 +77,28 @@ const PutAdAccount = defineComponent({
           advertiser_id,
           page: 1,
         });
-        let clist = data.list.map((r:any)=>{
-          r.is_enable == 0? r.is_enable =false : r.is_enable = true;
+        let clist = data.list.map((r: any) => {
+          r.is_enable == 0 ? (r.is_enable = false) : (r.is_enable = true);
           return r;
-        })
+        });
+        console.log(clist);
         state.list = clist;
         meta.value = data.meta;
       } catch (e) {
         console.log(e);
       } finally {
-
         state.inSearching = false;
       }
     };
-   const switchMethod = (record:any) =>{
-     let data = {
+    const switchMethod = (record: any) => {
+      let data = {
         advertiser_id: record.advertiser_id,
         is_enable: Number(!record.is_enable),
       };
       statusAdChange(data).then((res) => {
-        message.success('修改成功!')
+        message.success("修改成功!");
       });
-   }
+    };
     const handleTableChange = (pagination: PageOptions) => {
       const { current, pageSize, total } = pagination;
       getAdPushList({ page: current }).then((res) => {
@@ -101,19 +106,19 @@ const PutAdAccount = defineComponent({
         meta.value = res.data.meta;
       });
     };
-    return { ...toRefs(state), onSearch, handleTableChange,switchMethod};
+    return { ...toRefs(state), onSearch, handleTableChange, switchMethod };
   },
-  methods:{
-    async handleClick(){
-      let res:any = await getAdauth();
+  methods: {
+    async handleClick() {
+      let res: any = await getAdauth();
 
-      if(res.data && res.data.url){
-        window.open(res.data.url)
-      }else{
-        this.$message.error('暂未配置授权地址');
+      if (res.data && res.data.url) {
+        window.open(res.data.url);
+      } else {
+        this.$message.error("暂未配置授权地址");
       }
-    }
-  }
+    },
+  },
 });
 
 export default PutAdAccount;

+ 35 - 12
src/views/put/put-ad-plan.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="page-wrap page-wrap-account page-adplan">
     <tool-bar
-      :text="['ad_id', 'advertiser_id', 'campaign_id']"
-      :label="['计划名/ID', '账号名/ID', '广告组名称/ID']"
+      :text="['ad_id', 'advertiser_id', 'campaign_id', 'channel_id', 'book_id']"
+      :label="['计划名/ID', '账号名/ID', '广告组名称/ID', '站点ID', '书籍ID']"
       :defaultVal="defaultToolvalue"
       v-model:loading="inSearching"
       @confirm="onSearch"
@@ -268,7 +268,7 @@
 
 <script lang="ts">
 import { defineComponent, reactive, toRefs, ref, unref, onMounted } from "vue";
-import moment from "moment";
+import moment,{ Moment } from "moment";
 import ToolBar from "@/components/tool-bar/index.vue";
 import PutData from "@/views/put/put-log.vue";
 import CustomCloumn from "@/views/put/component/customClomu.vue";
@@ -367,6 +367,8 @@ const PutAdPlan = defineComponent({
       ],
       isInit: false,
       cost_order: 0,
+      convert_order:0,
+      convert_cost_order:0,
       optionList: opList,
       statsList: stList,
       currentStats: "paid_order_amount",
@@ -375,14 +377,21 @@ const PutAdPlan = defineComponent({
       rangePick: picker,
     });
 
-    if (route.query && route.query.campaign_id) {
+    if (route.query &&( route.query.campaign_id || route.query.channel_id || route.query.book_id)) {
       state.defaultToolvalue = {
-        campaign_id: route.query.campaign_id,
+        campaign_id: route.query.campaign_id || '',
+        channel_id: route.query.channel_id || '',
+        book_id: route.query.book_id || '',
       };
       state.fields = {
-        campaign_id: route.query.campaign_id,
+         campaign_id: route.query.campaign_id || '',
+        channel_id: route.query.channel_id || '',
+        book_id: route.query.book_id || '',
       };
     }
+    if (route.query && route.query.begin_date && route.query.end_date) {
+      state.pickerFilter =[moment(route.query.begin_date as any), moment(route.query.end_date as any)]
+    }
 
     getAddStatus().then((res) => {
       res.data.unshift({
@@ -428,7 +437,7 @@ const PutAdPlan = defineComponent({
         },
         query || {},
         { begin_date, end_date, status: state.currentSelect },
-        state.cost_order ? { cost_order: state.cost_order } : {}
+        { cost_order: state.cost_order,convert_order:state.convert_order, convert_cost_order:state.convert_cost_order }
       );
       const { data } = await getADPlanlist(datas);
       const { data: taotals } = await getadDataSum(datas);
@@ -437,6 +446,7 @@ const PutAdPlan = defineComponent({
         item.popShow = false;
         return item;
       });
+      let sortList = ['cost','convert','convert_cost']
       let columns = state.columns.map((r) => {
         if (r.dataIndex === "ad_name") {
           r.children = [
@@ -458,7 +468,8 @@ const PutAdPlan = defineComponent({
               dataIndex: r.dataIndex,
               width: r.width,
               ellipsis: true,
-              sorter: r.dataIndex === "cost" ? true : false,
+              sorter: sortList.includes(r.dataIndex) ? true : false,
+              sortDirections:['descend', 'ascend',false]
             },
           ];
         }
@@ -555,6 +566,9 @@ const PutAdPlan = defineComponent({
     });
 
     const setSateSwitch = (val: string, name: string) => {
+      state.cost_order = 0;
+      state.convert_order = 0;
+      state.convert_cost_order = 0;
       switch (val) {
         case "ascend":
           (state as any)[name] = 2;
@@ -572,22 +586,31 @@ const PutAdPlan = defineComponent({
       filters: any,
       sorter: any
     ) => {
-      console.log(sorter)
+
       if (sorter.columnKey == "cost") {
         setSateSwitch(sorter.order, "cost_order");
       }
+      if(sorter.columnKey == "convert"){
+        setSateSwitch(sorter.order, "convert_order");
+      }
+      if(sorter.columnKey == "convert_cost"){
+        setSateSwitch(sorter.order, "convert_cost_order");
+      }
+
       const { current, pageSize, total } = pagination;
-      getData({ campaign_id: route.query?.campaign_id ?? "",page: current });
+      getData({ campaign_id: route.query?.campaign_id ?? "",channel_id:route.query?.channel_id ?? "",book_id:route.query?.book_id?? "",page: current });
     };
 
     onMounted(() => {
       setTimeout(()=>{
         getData({
         campaign_id: route.query?.campaign_id ?? "",
+        channel_id:route.query?.channel_id ?? "",
+        book_id:route.query?.book_id ?? "",
         current: 1,
       });
       },200)
-      
+
     });
 
     return { ...toRefs(state), handleTableChange, onSearch, switchDate };
@@ -596,7 +619,7 @@ const PutAdPlan = defineComponent({
     let winHeight =
       document.documentElement.clientHeight || document.body.clientHeight;
     this.scrollY = winHeight - 352;
-    
+
   },
   methods: {
     moment,

+ 21 - 0
src/views/put/put-data.vue

@@ -39,6 +39,9 @@
       @change="handleTableChange"
       bordered
     >
+      <template #opertate="{ text, record }">
+        <p @click="goPlan(record)"><a>查看广告计划</a></p>
+      </template>
     </a-table>
   </div>
 </template>
@@ -48,6 +51,7 @@ import { defineComponent, reactive, toRefs, ref, onMounted } from "vue";
 import { picker } from "@/helper/config/range";
 import ToolBar from "@/components/tool-bar/index.vue";
 import moment from "moment";
+import router from "@/router";
 import {
   TableColumnOfPutData,
   TableColumnOfMoreStat,
@@ -144,8 +148,18 @@ const PutData = defineComponent({
           if (whiteList.includes(item.name)) {
             lolumnItem.fixed = "left";
           }
+
           columns.push(lolumnItem);
         });
+        let column = {
+          title: "操作",
+          dataIndex: "operte",
+          ellipsis: true,
+          width: 120,
+          fixed: "right",
+          slots: { customRender: "opertate" },
+        };
+        columns.push(column);
         state.columns = columns;
       });
     };
@@ -175,6 +189,13 @@ const PutData = defineComponent({
   },
   methods: {
     moment,
+    goPlan(record: any) {
+      const { date, channel_id, book_id } = record;
+      router.push({
+        path: "/put/datas/ad-plan",
+        query: { channel_id, begin_date: date, end_date: date, book_id },
+      });
+    },
   },
 });